i3.dragos.gm.core.schema
Interface Schema

All Known Implementing Classes:
FilteringSchema

public interface Schema

The Schema class provides access to the graph schema of a pool. It is used to create, modify, and query the schema.

Author:
Boris Boehlen <boehlen@cs.rwth-aachen.de>, Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>
See Also:
Core Graph Model, Implementation Issues

Method Summary
 void clear()
          Removes every class declaration from this schema.
 EdgeClass declareDirectedEdgeClass(java.lang.String name, boolean abstractClass, GraphEntityClass source, Cardinality srcCard, GraphEntityClass target, Cardinality trgCard)
          Declare a new edge class for directed edges and returns it.
 GraphClass declareGraphClass(java.lang.String name, boolean abstractClass)
          Declare a new graph class and returns it.
 GraphEntityClass declareGraphEntityClass(java.lang.String name)
          Declare a new abstract graph entity class and returns it.
 NodeClass declareNodeClass(java.lang.String name, boolean abstractClass)
          Declare a new node class and returns it.
 RelationClass declareRelationClass(java.lang.String name, boolean abstractClass)
          Declare a new relations class and returns it.
 EdgeClass declareUndirectedEdgeClass(java.lang.String name, boolean abstractClass, GraphEntityClass entityClass, Cardinality cardinality)
          Declare a new edge class for undirected edges and returns it.
 boolean existsEdgeClass(EdgeClass id)
          Returns true if the edge class is declared in this schema and false otherwise.
 boolean existsEdgeClass(java.lang.String name)
          Returns true if the edge class is declared in this schema and false otherwise.
 boolean existsGraphClass(GraphClass id)
          Returns true if the graph class is declared in this schema and false otherwise.
 boolean existsGraphClass(java.lang.String name)
          Returns true if the graph class is declared in this schema and false otherwise.
 boolean existsGraphEntityClass(GraphEntityClass id)
          Returns true if the schema entity is declared in this schema and false otherwise.
 boolean existsGraphEntityClass(java.lang.String name)
          Returns true if the schema entity is declared in this schema and false otherwise.
 boolean existsNodeClass(NodeClass id)
          Returns true if the node class is declared in this schema and false otherwise.
 boolean existsNodeClass(java.lang.String name)
          Returns true if the node class is declared in this schema and false otherwise.
 boolean existsRelationClass(RelationClass id)
          Returns true if the relation class is declared in this schema and false otherwise.
 boolean existsRelationClass(java.lang.String name)
          Returns true if the relation class is declared in this schema and false otherwise.
 boolean existsRelationEndClass(RelationEndClass id)
          Returns true if the relation end class is declared in this schema and false otherwise.
 boolean existsRelationEndClass(java.lang.String name)
          Returns true if the relation end class is declared in this schema and false otherwise.
 java.util.Collection<? extends EdgeClass> getAllEdgeClasses()
          Returns a collection containing all edge classes defined in the schema.
 java.util.Collection<? extends GraphClass> getAllGraphClasses()
          Returns a collection containing all graph classes defined in the schema.
 java.util.Collection<? extends GraphEntityClass> getAllGraphEntityClasses()
          Returns a collection containing all graph entity classes defined in the schema.
 java.util.Collection<? extends NodeClass> getAllNodeClasses()
          Returns a collection containing all node classes defined in the schema.
 java.util.Collection<? extends RelationClass> getAllRelationClasses()
          Returns a collection containing all relation classes defined in the schema.
 EdgeClass getEdgeClassByName(java.lang.String name)
          Returns the edge class specified by the given name.
 GraphClass getGraphClassByName(java.lang.String name)
          Returns the graph class specified by the given name.
 GraphEntityClass getGraphEntityClassByInternalIdentifier(java.io.Serializable identifier)
          Retrieves a graph entity class by its internal identifier.
 GraphEntityClass getGraphEntityClassByName(java.lang.String name)
          Returns the graph entity class specified by the given name.
 NodeClass getNodeClassByName(java.lang.String name)
          Returns the node class specified by the given name.
 RelationClass getRelationClassByName(java.lang.String name)
          Returns the relation class specified by the given name.
 RelationEndClass getRelationEndClassByName(java.lang.String name)
          Returns the relation end class specified by the given name.
 DefaultSchemaChecker getSchemaChecker()
          Returns the SchemaChecker used by the Schema, which will always be an instance of DefaultSchemaChecker.
 void undeclareGraphEntityClass(GraphEntityClass g)
          Undeclares a graph entity class.
 

Method Detail

declareGraphClass

GraphClass declareGraphClass(java.lang.String name,
                             boolean abstractClass)
                             throws EntityAlreadyExistsException,
                                    DragosException
Declare a new graph class and returns it.

Parameters:
name - The graph classes name.
abstractClass - Is the class abstract or not.
Returns:
the new graph class.
Throws:
EntityAlreadyExistsException - if a schema entity with the same name has already been declared
DragosException - if something went wrong.

declareGraphEntityClass

GraphEntityClass declareGraphEntityClass(java.lang.String name)
                                         throws EntityAlreadyExistsException,
                                                DragosException
Declare a new abstract graph entity class and returns it. Graph entity classes are always abstract because they can't be instantiated.

Parameters:
name - The graph entity classes name.
Returns:
the new graph entity class.
Throws:
EntityAlreadyExistsException - if a schema entity with the same name has already been declared
DragosException - if something went wrong.

declareNodeClass

NodeClass declareNodeClass(java.lang.String name,
                           boolean abstractClass)
                           throws EntityAlreadyExistsException,
                                  DragosException
Declare a new node class and returns it.

Parameters:
name - The node classes name.
abstractClass - Is the class abstract or not.
Returns:
the new node class.
Throws:
EntityAlreadyExistsException - if a schema entity with the same name has already been declared
DragosException - if something went wrong.

declareDirectedEdgeClass

EdgeClass declareDirectedEdgeClass(java.lang.String name,
                                   boolean abstractClass,
                                   GraphEntityClass source,
                                   Cardinality srcCard,
                                   GraphEntityClass target,
                                   Cardinality trgCard)
                                   throws EntityAlreadyExistsException,
                                          EntityNotFoundException,
                                          DragosException
Declare a new edge class for directed edges and returns it.

Parameters:
name - The edge classes name.
abstractClass - Is the class abstract or not.
source - The graph entity class allowed as a source.
srcCard - The source cardinality.
target - The graph entity class allowed as a target.
trgCard - The target cardinality.
Returns:
the new edge class.
Throws:
EntityNotFoundException - if the source or target graph class do not exist.
EntityAlreadyExistsException - if a schema entity with the same name has already been declared
DragosException - if something went wrong.

declareUndirectedEdgeClass

EdgeClass declareUndirectedEdgeClass(java.lang.String name,
                                     boolean abstractClass,
                                     GraphEntityClass entityClass,
                                     Cardinality cardinality)
                                     throws EntityAlreadyExistsException,
                                            EntityNotFoundException,
                                            DragosException
Declare a new edge class for undirected edges and returns it.

Parameters:
name - The edge classes name.
abstractClass - Is the class abstract or not.
entityClass - The graph entity class allowed as source and target.
cardinality - The cardinality of the edge.
Returns:
the new edge class.
Throws:
EntityNotFoundException - if the source or target graph class do not exist.
EntityAlreadyExistsException - if a schema entity with the same name has already been declared
DragosException - if something went wrong.

declareRelationClass

RelationClass declareRelationClass(java.lang.String name,
                                   boolean abstractClass)
                                   throws EntityAlreadyExistsException,
                                          DragosException
Declare a new relations class and returns it.

Parameters:
name - The relation classes name.
abstractClass - Is the class abstract or not.
Returns:
the new relation class.
Throws:
EntityAlreadyExistsException - if a schema entity with the same name has already been declared
DragosException - if something went wrong.

undeclareGraphEntityClass

void undeclareGraphEntityClass(GraphEntityClass g)
                               throws EntityNotFoundException,
                                      DragosException
Undeclares a graph entity class.

Deletion is cascading, meaning any dependent graph entity classes and attributes will be undeclared as well. You should also be aware that this method only ensures a consistent schema at core GM level (e.g. by simply removing the class from the class hierachy), which in most cases is not sufficient to ensure meaningful semantics at application level. Usually the application GM will perform additional checks and operations.

This method proceeds in the following order:

  1. If the class in question is a RelationClass, undeclares all its RelationEndClasses using this same method.
  2. Cuts all connections to super and sub classes using GraphEntityClass.removeSubClass(GraphEntityClass).
  3. Undeclares all attributes using GraphEntityClass.undeclareAllAttributes().
  4. If the class in question is the source or target type of an EdgeClass, or the target type of a RelationEndClass, it undeclares those using this same method.
  5. Calls GraphPool.removeAllInstances(GraphEntityClass) to remove all instances of the class from the GraphPool.
  6. Removes all MetaAttributes of the class.
  7. Finally removes the class itself.

Parameters:
g - The graph entity class to undeclare.
Throws:
EntityNotFoundException - if the class does not exist.
DragosException - if something else went wrong.

clear

void clear()
           throws DragosException
Removes every class declaration from this schema. Removal follows the same order and rules as if undeclareGraphEntityClass(GraphEntityClass) was called on each graph entity class separately (skipping classes already removed by cascading deletion, of course).

Throws:
DragosException - if something went wrong.

existsGraphEntityClass

boolean existsGraphEntityClass(GraphEntityClass id)
                               throws DragosException
Returns true if the schema entity is declared in this schema and false otherwise.

Parameters:
id - The schema entity.
Returns:
true if the schema entity is declared.
Throws:
DragosException - if something went wrong.

existsGraphEntityClass

boolean existsGraphEntityClass(java.lang.String name)
                               throws DragosException
Returns true if the schema entity is declared in this schema and false otherwise.

Parameters:
name - The name of the schema entity.
Returns:
true if the schema entity is declared.
Throws:
DragosException - if something went wrong.

existsGraphClass

boolean existsGraphClass(GraphClass id)
                         throws DragosException
Returns true if the graph class is declared in this schema and false otherwise.

Parameters:
id - The graph class.
Returns:
true if the graph class is declared.
Throws:
DragosException - if something went wrong.

existsGraphClass

boolean existsGraphClass(java.lang.String name)
                         throws DragosException
Returns true if the graph class is declared in this schema and false otherwise.

Parameters:
name - The name of the graph class.
Returns:
true if the graph class is declared.
Throws:
DragosException - if something went wrong.

existsNodeClass

boolean existsNodeClass(NodeClass id)
                        throws DragosException
Returns true if the node class is declared in this schema and false otherwise.

Parameters:
id - The node class.
Returns:
true if the node class is declared.
Throws:
DragosException - if something went wrong.

existsNodeClass

boolean existsNodeClass(java.lang.String name)
                        throws DragosException
Returns true if the node class is declared in this schema and false otherwise.

Parameters:
name - The name of the graph class.
Returns:
true if the node class is declared.
Throws:
DragosException - if something went wrong.

existsEdgeClass

boolean existsEdgeClass(EdgeClass id)
                        throws DragosException
Returns true if the edge class is declared in this schema and false otherwise.

Parameters:
id - The edge class.
Returns:
true if the edge class is declared.
Throws:
DragosException - if something went wrong.

existsEdgeClass

boolean existsEdgeClass(java.lang.String name)
                        throws DragosException
Returns true if the edge class is declared in this schema and false otherwise.

Parameters:
name - The name of the edge class.
Returns:
true if the edge class is declared.
Throws:
DragosException - if something went wrong.

existsRelationClass

boolean existsRelationClass(RelationClass id)
                            throws DragosException
Returns true if the relation class is declared in this schema and false otherwise.

Parameters:
id - The relation class.
Returns:
true if the relation class is declared.
Throws:
DragosException - if something went wrong.

existsRelationClass

boolean existsRelationClass(java.lang.String name)
                            throws DragosException
Returns true if the relation class is declared in this schema and false otherwise.

Parameters:
name - The name of the relation class.
Returns:
true if the relation class is declared.
Throws:
DragosException - if something went wrong.

existsRelationEndClass

boolean existsRelationEndClass(RelationEndClass id)
                               throws DragosException
Returns true if the relation end class is declared in this schema and false otherwise.

Parameters:
id - The relation end class.
Returns:
true if the relation end class is declared.
Throws:
DragosException - if something went wrong.

existsRelationEndClass

boolean existsRelationEndClass(java.lang.String name)
                               throws DragosException
Returns true if the relation end class is declared in this schema and false otherwise.

Parameters:
name - The name of the relation end class.
Returns:
true if the relation end class is declared.
Throws:
DragosException - if something went wrong.

getGraphEntityClassByName

GraphEntityClass getGraphEntityClassByName(java.lang.String name)
                                           throws EntityNotFoundException,
                                                  DragosException
Returns the graph entity class specified by the given name.

Parameters:
name - The name of the class (which must not be null).
Returns:
The class with the given name.
Throws:
EntityNotFoundException - if no class with this name could be found.
DragosException - if something else went wrong.

getGraphClassByName

GraphClass getGraphClassByName(java.lang.String name)
                               throws EntityNotFoundException,
                                      DragosException
Returns the graph class specified by the given name.

Parameters:
name - The name of the class (which must not be null).
Returns:
The class with the given name.
Throws:
EntityNotFoundException - if no class with this name could be found.
DragosException - if something else went wrong.

getNodeClassByName

NodeClass getNodeClassByName(java.lang.String name)
                             throws EntityNotFoundException,
                                    DragosException
Returns the node class specified by the given name.

Parameters:
name - The name of the class (which must not be null).
Returns:
The class with the given name.
Throws:
EntityNotFoundException - if no class with this name could be found.
DragosException - if something else went wrong.

getEdgeClassByName

EdgeClass getEdgeClassByName(java.lang.String name)
                             throws EntityNotFoundException,
                                    DragosException
Returns the edge class specified by the given name.

Parameters:
name - The name of the class (which must not be null).
Returns:
The class with the given name.
Throws:
EntityNotFoundException - if no class with this name could be found.
DragosException - if something else went wrong.

getRelationClassByName

RelationClass getRelationClassByName(java.lang.String name)
                                     throws EntityNotFoundException,
                                            DragosException
Returns the relation class specified by the given name.

Parameters:
name - The name of the class (which must not be null).
Returns:
The class with the given name.
Throws:
EntityNotFoundException - if no class with this name could be found.
DragosException - if something else went wrong.

getRelationEndClassByName

RelationEndClass getRelationEndClassByName(java.lang.String name)
                                           throws EntityNotFoundException,
                                                  DragosException
Returns the relation end class specified by the given name.

Parameters:
name - The name of the class (which must not be null).
Returns:
The class with the given name.
Throws:
EntityNotFoundException - if no class with this name could be found.
DragosException - if something else went wrong.

getGraphEntityClassByInternalIdentifier

GraphEntityClass getGraphEntityClassByInternalIdentifier(java.io.Serializable identifier)
                                                         throws EntityNotFoundException,
                                                                DragosException
Retrieves a graph entity class by its internal identifier.

Parameters:
identifier - The internal identifier.
Returns:
The requested GraphEntity (subclass).
Throws:
EntityNotFoundException - if the graph entity does not exist.
DragosException - if something else went wrong.

getAllEdgeClasses

java.util.Collection<? extends EdgeClass> getAllEdgeClasses()
                                                            throws DragosException
Returns a collection containing all edge classes defined in the schema. The elements in the collection are of type Edge.

Returns:
All edge classes defined in the schema.
Throws:
DragosException - if queries are not allowed, or something else went wrong.

getAllGraphClasses

java.util.Collection<? extends GraphClass> getAllGraphClasses()
                                                              throws DragosException
Returns a collection containing all graph classes defined in the schema. The elements in the collection are of type Graph.

Returns:
All graph classes defined in the schema.
Throws:
DragosException - if queries are not allowed, or something else went wrong.

getAllNodeClasses

java.util.Collection<? extends NodeClass> getAllNodeClasses()
                                                            throws DragosException
Returns a collection containing all node classes defined in the schema. The elements in the collection are of type Node.

Returns:
All node classes defined in the schema.
Throws:
DragosException - if queries are not allowed, or something else went wrong.

getAllRelationClasses

java.util.Collection<? extends RelationClass> getAllRelationClasses()
                                                                    throws DragosException
Returns a collection containing all relation classes defined in the schema. The elements in the collection are of type Relation.

Returns:
All relation classes defined in the schema.
Throws:
DragosException - if queries are not allowed, or something else went wrong.

getAllGraphEntityClasses

java.util.Collection<? extends GraphEntityClass> getAllGraphEntityClasses()
                                                                          throws DragosException
Returns a collection containing all graph entity classes defined in the schema. The elements in the collection are of type GraphEntity.

Returns:
all graph entity classes defined in the schema.
Throws:
DragosException - if something went wrong.

getSchemaChecker

DefaultSchemaChecker getSchemaChecker()
Returns the SchemaChecker used by the Schema, which will always be an instance of DefaultSchemaChecker. This method is the schema version of GraphPool.getGraphPoolChecker().

This method must work even when the associated GraphPool is closed.

Returns:
the DefaultSchemaChecker used by the Schema (which is never null).
See Also:
SchemaChecker, DefaultSchemaChecker, GraphPool.getGraphPoolChecker()


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.