ssdbms.manager.primitives
Interface SSDBPrimitiveManager


public interface SSDBPrimitiveManager

This interface give the primitive operations that can be used for manipulation of semistructured data stored in a database. This interface is used to implement a module of a Semistructured Database Manager System for manipulating the primitive data operations, it has the purpose to be a base for the construction of higher level modules.

Author:
Egar Arturo García Cárdenas.
See Also:
ssdbms.ssd

Method Summary
 void add(ID parent, Label childsLabel, ID child)
          Adds a labeled semistructured datum in other's content.
 void addSSDTable(Label name, ID root)
          Adds a SSD Table in the database.
 boolean belongs(ID child, ID parent)
          Checks if a given semistructured belongs to another given datum.
 void commit()
          Commits the current Transaction and leaves the system ready to init another new.
 boolean contains(ID parent, ID child)
          Checks if a given semistructured datum owns another given datum in its content.
 boolean containsLabel(ID parent, Label childLabel)
          Checks if a given semistructured datum owns a specified label.
 ID createBLOB()
          Creates a new primitive BLOB datum.
 ID createByteSequence(ByteSequenceValue value)
          Creates a new primitive byte sequence datum.
 ID createCLOB()
          Creates a new primitive CLOB datum.
 ID createInteger(IntegerValue value)
          Creates a new primitive integer datum.
 ID createNonPrimitive()
          Creates a new non primitive semistructured datum.
 ID createReal(RealValue value)
          Creates a new primitive real datum.
 ID createString(StringValue value)
          Creates a new primitive string datum.
 void drop(ID id)
          Drops a semistructured datum giving its identifier.
 SetOfLabeledSSD getAllContent(ID parent)
          Given a semistructured datum, this returns the semistructured data in its content.
 SSDValue getContent(ID id)
          Returns the content of a specified datum in a SSDValue object.
 SetOfLabeledSSD getContentWithID(ID parent, ID child)
          Given a semistructured datum, this returns the semistructured data in its content with the specified identifier.
 SetOfLabeledSSD getContentWithLabel(ID parent, Label childLabel)
          Given a semistructured datum, this returns the semistructured data in its content with the specified label.
 SetOfID getParents(ID id)
          Returns the parents of a given semistructured datum.
 ID getRoot(Label name)
          Returns the identifier of the semistructured datum which is the root of the SSD-Table.
 int getType(ID id)
          Returns the kind of this semistructured datum.
 boolean isPrimitive(ID id)
          Checks if a semistructured datum with a given identifier is primitive or not.
 void remove(ID parent, Label childsLabel, ID child)
          Removes a labeled semistructured datum from other's content.
 void removeID(ID parent, ID child)
          Removes a datum from other's content.
 void removeLabel(ID parent, Label childsLabel)
          Removes all subdata from a specified datum with a given label.
 void removeSSDTable(Label name)
          Removes a SSD-Table from the database.
 void removeSSDTablesWithID(ID id)
          Removes the SSD-Tables whith the specified datum.
 void rollback()
          Rollbacks the current Transaction and leaves the system ready to init another new.
 

Method Detail

commit

public void commit()
            throws FatalErrorException
Commits the current Transaction and leaves the system ready to init another new.

Throws:
FatalErrorException

rollback

public void rollback()
              throws FatalErrorException
Rollbacks the current Transaction and leaves the system ready to init another new.

Throws:
FatalErrorException

createNonPrimitive

public ID createNonPrimitive()
                      throws BadFunctionException,
                             FatalErrorException
Creates a new non primitive semistructured datum.

Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

createInteger

public ID createInteger(IntegerValue value)
                 throws BadFunctionException,
                        FatalErrorException
Creates a new primitive integer datum.

Parameters:
value - The integer value of the semistructured datum to be created.
Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

createReal

public ID createReal(RealValue value)
              throws BadFunctionException,
                     FatalErrorException
Creates a new primitive real datum.

Parameters:
value - The real value of the semistructured datum to be created.
Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

createString

public ID createString(StringValue value)
                throws BadFunctionException,
                       FatalErrorException
Creates a new primitive string datum.

Parameters:
value - The string value of the semistructured datum to be created.
Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

createByteSequence

public ID createByteSequence(ByteSequenceValue value)
                      throws BadFunctionException,
                             FatalErrorException
Creates a new primitive byte sequence datum.

Parameters:
value - The byte sequence value of the semistructured datum to be created.
Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

createBLOB

public ID createBLOB()
              throws BadFunctionException,
                     FatalErrorException
Creates a new primitive BLOB datum.

Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

createCLOB

public ID createCLOB()
              throws BadFunctionException,
                     FatalErrorException
Creates a new primitive CLOB datum.

Returns:
The identifier of the created semistructured datum.
Throws:
BadFunctionException
FatalErrorException

getType

public int getType(ID id)
            throws BadFunctionException,
                   NotExistingDatumException,
                   FatalErrorException
Returns the kind of this semistructured datum.

Parameters:
id - The identifier of the datum to check.
Returns:
The numeric constant that represents the kind of value of this semistructured datum.
Throws:
BadFunctionException
NotExistingDatumException
FatalErrorException
See Also:
SSDValue.NON_PRIMITIVE, SSDValue.INTEGER, SSDValue.REAL, SSDValue.STRING, SSDValue.BYTE_SEQUENCE, SSDValue.BLOB, SSDValue.CLOB

getContent

public SSDValue getContent(ID id)
                    throws NotExistingDatumException,
                           BadFunctionException,
                           FatalErrorException
Returns the content of a specified datum in a SSDValue object.

Parameters:
id - The identifier of the datum to get the content.
Returns:
The content in a SSDValue. Returns a SetOfLabeledSSD if the datum in non primitive. Returns a IntegerValue if the datum is an integer number. Returns a RealValue if the datum is a real number. Returns a StringValue if the datum is a string. Returns a ByteSequenceValue if the datum is a byte sequence. Returns a BLOBManager if the datum is BLOB. Returns a CLOBManager if the datum is CLOB.
Throws:
NotExistingDatumException
BadFunctionException
FatalErrorException

isPrimitive

public boolean isPrimitive(ID id)
                    throws BadFunctionException,
                           NotExistingDatumException,
                           FatalErrorException
Checks if a semistructured datum with a given identifier is primitive or not.

Parameters:
id - The datum's identifier to be checked.
Returns:
true if the datum is primitive, false otherwise.
Throws:
BadFunctionException
NotExistingDatumException
FatalErrorException

add

public void add(ID parent,
                Label childsLabel,
                ID child)
         throws NotExistingDatumException,
                InvalidDatumOperationException,
                BadFunctionException,
                FatalErrorException
Adds a labeled semistructured datum in other's content.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified, this has to be non-primitive.
childsLabel - The label of the datum to be added.
child - The identifier of the datum to be added.
Throws:
NotExistingDatumException
InvalidDatumOperationException
BadFunctionException
FatalErrorException

remove

public void remove(ID parent,
                   Label childsLabel,
                   ID child)
            throws BadFunctionException,
                   NotExistingDatumException,
                   InvalidDatumOperationException,
                   FatalErrorException
Removes a labeled semistructured datum from other's content.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified.
childsLabel - The label of the datum to be removed.
child - The identifier of the datum to be removed.
Throws:
BadFunctionException
NotExistingDatumException
InvalidDatumOperationException
FatalErrorException

removeID

public void removeID(ID parent,
                     ID child)
              throws BadFunctionException,
                     NotExistingDatumException,
                     InvalidDatumOperationException,
                     FatalErrorException
Removes a datum from other's content.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified.
child - The identifier of the datum to be removed.
Throws:
BadFunctionException
NotExistingDatumException
InvalidDatumOperationException
FatalErrorException

removeLabel

public void removeLabel(ID parent,
                        Label childsLabel)
                 throws NotExistingDatumException,
                        InvalidDatumOperationException,
                        BadFunctionException,
                        FatalErrorException
Removes all subdata from a specified datum with a given label.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified.
childsLabel - The label of the data to be removed.
Throws:
NotExistingDatumException
InvalidDatumOperationException
BadFunctionException
FatalErrorException

contains

public boolean contains(ID parent,
                        ID child)
                 throws BadFunctionException,
                        NotExistingDatumException,
                        FatalErrorException
Checks if a given semistructured datum owns another given datum in its content.

Parameters:
parent - The datum's identifier which content will be analized.
child - The datum's identifier will be searched in parent's content.
Returns:
true if child is in parents's content, false otherwise. Note: If parent is primitive this method returns false.
Throws:
BadFunctionException
NotExistingDatumException
FatalErrorException

belongs

public boolean belongs(ID child,
                       ID parent)
                throws BadFunctionException,
                       NotExistingDatumException,
                       FatalErrorException
Checks if a given semistructured belongs to another given datum.

Parameters:
child - The datum's identifier will be searched in parent's content.
parent - The datum's identifier which content will be analized.
Returns:
true if child is in parents's content, false otherwise. Note: If parent is primitive this method returns false.
Throws:
BadFunctionException
NotExistingDatumException
FatalErrorException

containsLabel

public boolean containsLabel(ID parent,
                             Label childLabel)
                      throws BadFunctionException,
                             NotExistingDatumException,
                             FatalErrorException
Checks if a given semistructured datum owns a specified label.

Parameters:
parent - The datum's identifier which content will be analized.
childLabel - The label to be searched in parent's content.
Returns:
true if childLabel is in parents's content, false otherwise. Note: If parent is primitive this method returns false.
Throws:
BadFunctionException
NotExistingDatumException
FatalErrorException

addSSDTable

public void addSSDTable(Label name,
                        ID root)
                 throws NotExistingDatumException,
                        AlreadyDefinedSSDTableException,
                        BadFunctionException,
                        FatalErrorException
Adds a SSD Table in the database.

Parameters:
name - The name of the new table.
root - The identifier of the semistructured datum which will be the root of the new SSD-Table.
Throws:
NotExistingDatumException
AlreadyDefinedSSDTableException
BadFunctionException
FatalErrorException

getRoot

public ID getRoot(Label name)
           throws BadFunctionException,
                  NotDefinedSSDTableException,
                  FatalErrorException
Returns the identifier of the semistructured datum which is the root of the SSD-Table.

Parameters:
name - The name of the SSD-Table to get its root.
Returns:
The root of the SSD-Table.
Throws:
BadFunctionException
NotDefinedSSDTableException
FatalErrorException

removeSSDTable

public void removeSSDTable(Label name)
                    throws BadFunctionException,
                           NotDefinedSSDTableException,
                           FatalErrorException
Removes a SSD-Table from the database.

Parameters:
name - The name of the SSD-Table to be removed.
Throws:
BadFunctionException
NotDefinedSSDTableException
FatalErrorException

removeSSDTablesWithID

public void removeSSDTablesWithID(ID id)
                           throws NotExistingDatumException,
                                  NotDefinedSSDTableException,
                                  BadFunctionException,
                                  FatalErrorException
Removes the SSD-Tables whith the specified datum.

Parameters:
id - The identifier of the root of the SSD-Tables to be removed.
Throws:
NotExistingDatumException
NotDefinedSSDTableException
BadFunctionException
FatalErrorException

drop

public void drop(ID id)
          throws NotExistingDatumException,
                 NotIsolatedDatumException,
                 BadFunctionException,
                 FatalErrorException
Drops a semistructured datum giving its identifier. The semistructured datum to be droped must be empty (i.e. without subdata) or primitive and isolated (i.e. without parents and dictionary references).

Parameters:
id - The identifier of the semistructured datum to be dropped.
Throws:
NotExistingDatumException
NotIsolatedDatumException
BadFunctionException
FatalErrorException

getParents

public SetOfID getParents(ID id)
                   throws NotExistingDatumException,
                          BadFunctionException,
                          FatalErrorException
Returns the parents of a given semistructured datum.

Parameters:
id - The datum's identifier to obtain its parents.
Returns:
A set contains the identifiers of the datum's parents.
Throws:
NotExistingDatumException
BadFunctionException
FatalErrorException

getContentWithID

public SetOfLabeledSSD getContentWithID(ID parent,
                                        ID child)
                                 throws NotExistingDatumException,
                                        InvalidDatumOperationException,
                                        BadFunctionException,
                                        FatalErrorException
Given a semistructured datum, this returns the semistructured data in its content with the specified identifier.

Parameters:
parent - The datum's identifier which its content will be analized.
child - The datum to search in parent's content.
Returns:
A set of labeled semistructured data in parent's content with the child identifier.
Throws:
NotExistingDatumException
InvalidDatumOperationException
BadFunctionException
FatalErrorException

getContentWithLabel

public SetOfLabeledSSD getContentWithLabel(ID parent,
                                           Label childLabel)
                                    throws NotExistingDatumException,
                                           InvalidDatumOperationException,
                                           BadFunctionException,
                                           FatalErrorException
Given a semistructured datum, this returns the semistructured data in its content with the specified label.

Parameters:
parent - The datum's identifier which its content will be analized.
childLabel - The label which data of parent's content must match to be returned.
Returns:
A set of labeled semistructured data in parent's content labeled as childrenLabel.
Throws:
NotExistingDatumException
InvalidDatumOperationException
BadFunctionException
FatalErrorException

getAllContent

public SetOfLabeledSSD getAllContent(ID parent)
                              throws NotExistingDatumException,
                                     InvalidDatumOperationException,
                                     BadFunctionException,
                                     FatalErrorException
Given a semistructured datum, this returns the semistructured data in its content.

Parameters:
parent - The datum's identifier which its content will be analized.
Returns:
The set of labeled semistructured data represents the parent's content.
Throws:
NotExistingDatumException
InvalidDatumOperationException
BadFunctionException
FatalErrorException