i3.dragos.gm.core.schema
Interface GraphEntityClass

All Superinterfaces:
ExistenceCheckable, MetaAttributable
All Known Subinterfaces:
EdgeClass, GraphClass, NodeClass, RelationClass, RelationEndClass
All Known Implementing Classes:
EdgeClassProxy, GraphClassProxy, GraphEntityClassProxy, NodeClassProxy, RelationClassProxy, RelationEndClassProxy

public interface GraphEntityClass
extends MetaAttributable, ExistenceCheckable

The GraphEntityClass interface defines the properties that hold for all schema elements.

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 addSubClass(GraphEntityClass clazz)
          Adds the specified class to the set of sub classes of this class.
 Attribute declareAttribute(java.lang.String name, java.lang.Class type)
          Declares a new attribute with the given name and type.
 boolean equals(java.lang.Object o)
          Checks for equality with another object.
 java.util.Collection<? extends Attribute> getAllDeclaredAttributes()
          Returns a collection containg all attributes declared in this graph element class and all its super classes.
 java.util.Collection<? extends GraphEntityClass> getAllSubClasses()
          Returns all sub classes of this class.
 java.util.Collection<? extends GraphEntityClass> getAllSuperClasses()
          Returns all super classes of this class.
 Attribute getAttribute(java.lang.String name)
          Returns the attribute with the given name.
 DataSourceURL getDataSourceURL()
          Returns the URL to the data source that stores this graph entity class.
 java.util.Collection<? extends Attribute> getDeclaredAttributes()
          Returns a collection containing the attributes declared for the schema entity.
 java.util.Collection<? extends GraphEntityClass> getDirectSubClasses()
          Returns all direct sub classes of this class.
 java.util.Collection<? extends GraphEntityClass> getDirectSuperClasses()
          Returns all direct super classes of this class.
 java.io.Serializable getInternalIdentifier()
          Returns the internal identifier used to uniquely identify this object in the storage backend.
 java.lang.String getName()
          Returns the name of the graph entity class.
 GraphEntityClass getWrappedGraphEntityClass()
          Returns the wrapped entity class, null if none.
 boolean hasAttribute(java.lang.String name)
          Returns true if an attribute with the given name is declared in the graph entity class.
 int hashCode()
          To comply with the general contract for Object.hashCode(), it is recommended to return the hash code of the internal identifier.
 boolean isAbstract()
          Returns true if the schema entity is abstract or false otherwise.
 boolean isSubClassOf(GraphEntityClass clazz)
          Returns true if the specified class is the same as this class or a super class of this class and false otherwise.
 boolean isSuperClassOf(GraphEntityClass clazz)
          Returns true if the specified class is the same as this class or a sub class of this class and false otherwise.
 void removeSubClass(GraphEntityClass clazz)
          Removes the specified class from the set of direct sub classes of this class.
 void undeclareAllAttributes()
          Undeclares all attributes of this graph entity class.
 void undeclareAttribute(Attribute attribute)
          Undeclares an attribute.
 void undeclareAttribute(java.lang.String name)
          Undeclares the attribute with the given name.
 
Methods inherited from interface i3.dragos.gm.core.schema.MetaAttributable
getAllMetaAttributes, getMetaAttribute, isMetaAttributeKeyReserved, isMetaAttributeSet, setMetaAttribute, unsetMetaAttribute
 
Methods inherited from interface i3.dragos.gm.core.schema.ExistenceCheckable
checkExistence, checkExistenceOptional
 

Method Detail

equals

boolean equals(java.lang.Object o)
Checks for equality with another object.

This object is considered equal if all of the following conditions are met:

Subclasses and implementations might want to extend this list by adding assertions comparing additional or internal data (e.g. the type of the graph entity). However, equality must only be determined by the above rules, preferably by using super.equals(o), and any difference in the additional data for two object equal according to the rules above is to be considered an error.

Overrides:
equals in class java.lang.Object
Parameters:
o - The Object to compare to.
Returns:
true if o is equal according to above rules, false otherwise.

getDataSourceURL

DataSourceURL getDataSourceURL()
Returns the URL to the data source that stores this graph entity class. The returned value is guaranteed to not be null.

Returns:
the URL to the data source that stores the graph entity class.

getInternalIdentifier

java.io.Serializable getInternalIdentifier()
Returns the internal identifier used to uniquely identify this object in the storage backend.

To retrieve the entity use Schema.getGraphEntityClassByInternalIdentifier(Serializable) As alternative you may consider to use the classes in the package i3.dragos.gm.core.schema.id.

Returns:
the internal identifier.

hashCode

int hashCode()
To comply with the general contract for Object.hashCode(), it is recommended to return the hash code of the internal identifier.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.

getName

java.lang.String getName()
                         throws DragosException
Returns the name of the graph entity class.

Returns:
the name of the graph entity class.
Throws:
DragosException - if something went wrong.

declareAttribute

Attribute declareAttribute(java.lang.String name,
                           java.lang.Class type)
                           throws EntityAlreadyExistsException,
                                  DragosException
Declares a new attribute with the given name and type. Neither name nor type are allowed to be null.

Parameters:
name - The name of the attribute.
type - The type of the attribute.
Returns:
the new attribute.
Throws:
EntityAlreadyExistsException - if an attribute with the given name already exists.
java.lang.IllegalArgumentException - if name or type is null.
DragosException - if something went wrong.

undeclareAttribute

void undeclareAttribute(java.lang.String name)
                        throws EntityNotFoundException,
                               DragosException
Undeclares the attribute with the given name.

All instances of this attribute are removed from the graph pool associated with this schema, using GraphPool.removeAllAttributeInstances(Attribute), before the attribute itself is undeclared.

Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.

Parameters:
name - The name of the attribute.
Throws:
EntityNotFoundException - if no attribute with the given name is declared for this GraphEntityClass.
DragosException - if something went wrong.

undeclareAttribute

void undeclareAttribute(Attribute attribute)
                        throws EntityNotFoundException,
                               DragosException
Undeclares an attribute.

All instances of this attribute are removed from the graph pool associated with this schema, using GraphPool.removeAllAttributeInstances(Attribute), before the attribute itself is undeclared.

Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.

Parameters:
attribute - The attribute.
Throws:
EntityNotFoundException - if the attribute is not declared for this GraphEntityClass.
DragosException - if something went wrong.

undeclareAllAttributes

void undeclareAllAttributes()
                            throws DragosException
Undeclares all attributes of this graph entity class.

All instances of an attribute are removed from the graph pool associated with this schema, using GraphPool.removeAllAttributeInstances(Attribute), before the attribute itself is undeclared. You may first remove all instances of all attributes, and then undeclare all attributes at once, or you may process each attribute seperately at your discretion.

Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.

Throws:
DragosException - if something went wrong.

getDeclaredAttributes

java.util.Collection<? extends Attribute> getDeclaredAttributes()
                                                                throws DragosException
Returns a collection containing the attributes declared for the schema entity. The elements in the collection are of type Attribute.

Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.

Returns:
A Collection containing the attributes declared for the graph entity class.
Throws:
DragosException - if something went wrong.

getAttribute

Attribute getAttribute(java.lang.String name)
                       throws EntityNotFoundException,
                              DragosException
Returns the attribute with the given name.

Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.

Parameters:
name - The name of the requested attribute.
Returns:
the attrinbute with the given name.
Throws:
EntityNotFoundException - if no attribute with the given name exists.
DragosException - if something went wrong.

hasAttribute

boolean hasAttribute(java.lang.String name)
                     throws DragosException
Returns true if an attribute with the given name is declared in the graph entity class.

Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.

Parameters:
name - The name of the requested attribute.
Returns:
the attrinbute with the given name.
Throws:
DragosException - if something went wrong.

addSubClass

void addSubClass(GraphEntityClass clazz)
                 throws EntityNotFoundException,
                        InheritanceCycleException,
                        DragosException
Adds the specified class to the set of sub classes of this class.

If clazz is already a direct sub class of this class, no action will be performed. Of course, this class will be added to the list of super classes of clazz.

If adding this sub class would result in circular references, a InheritanceCycleException is thrown, and no action will be performed.

When called on a specialized subinterface of GraphEntityClass (e.g. EdgeClass), the argument must be of the same type. You can not subclass an EdgeClass with a RelationClass, for example. If the parameter is invalid, a DragosException is thrown, and no action will be performed.

Parameters:
clazz - The class which should be a sub class of this class.
Throws:
EntityNotFoundException - if clazz does not exist in this schema.
InheritanceCycleException - if the inheritance relation would introduce a cycle.
DragosException - if clazz is of a different specialized type, or an internal error occurs.

removeSubClass

void removeSubClass(GraphEntityClass clazz)
                    throws EntityNotFoundException,
                           DragosException
Removes the specified class from the set of direct sub classes of this class. Of course, this class will also be removed from the list of super classes of clazz.

Parameters:
clazz - The sub class to remove.
Throws:
EntityNotFoundException - if clazz does not exist in this schema or is not a direct sub class.
DragosException - in case of internal errors.

getDirectSuperClasses

java.util.Collection<? extends GraphEntityClass> getDirectSuperClasses()
                                                                       throws DragosException
Returns all direct super classes of this class. The elements in the collection are of type GraphEntityClass.

Returns:
all direct super classes of this class.
Throws:
DragosException - if something went wrong.

getAllSuperClasses

java.util.Collection<? extends GraphEntityClass> getAllSuperClasses()
                                                                    throws DragosException
Returns all super classes of this class. The elements in the collection are of type GraphEntityClass.

While the sub class relationship is reflective (meaning c.isSuperClassOf(c) returns true for any GraphEntityClass c), the class this method is called on itself will not be included in the returned Collection. This decision was made because in practical use of this method one in most cases is only interested in real super classes.

Returns:
all super classes of this class.
Throws:
DragosException - if something went wrong.

getDirectSubClasses

java.util.Collection<? extends GraphEntityClass> getDirectSubClasses()
                                                                     throws DragosException
Returns all direct sub classes of this class. The elements in the collection are of type GraphEntityClass.

Returns:
all direct sub classes of this class.
Throws:
DragosException - if something went wrong.

getAllSubClasses

java.util.Collection<? extends GraphEntityClass> getAllSubClasses()
                                                                  throws DragosException
Returns all sub classes of this class. The elements in the collection are of type GraphEntityClass.

While the sub class relationship is reflective (meaning c.isSubClassOf(c) returns true for any GraphEntityClass c), the class this method is called on itself will not be included in the returned Collection. This decision was made because in practical use of this method one in most cases is only interested in real sub classes.

Returns:
all sub classes of this class.
Throws:
DragosException - if something went wrong.

isSuperClassOf

boolean isSuperClassOf(GraphEntityClass clazz)
                       throws EntityNotFoundException,
                              DragosException
Returns true if the specified class is the same as this class or a sub class of this class and false otherwise.

Parameters:
clazz - The class which is tested.
Returns:
true if the specified class is a super class of this class and false otherwise.
Throws:
EntityNotFoundException - if the graph element class could not be found.
DragosException - if something went wrong.

isSubClassOf

boolean isSubClassOf(GraphEntityClass clazz)
                     throws EntityNotFoundException,
                            DragosException
Returns true if the specified class is the same as this class or a super class of this class and false otherwise.

Parameters:
clazz - The class which is tested.
Returns:
true if the specified class is a super class of this class and false otherwise.
Throws:
EntityNotFoundException - if the graph element class could not be found.
DragosException - if something went wrong.

isAbstract

boolean isAbstract()
                   throws DragosException
Returns true if the schema entity is abstract or false otherwise. If a graph element class is abstract no graph element can be constructed for it.

Returns:
true if the schema entity is abstract or false otherwise.
Throws:
DragosException - if something went wrong.

getAllDeclaredAttributes

java.util.Collection<? extends Attribute> getAllDeclaredAttributes()
                                                                   throws DragosException
Returns a collection containg all attributes declared in this graph element class and all its super classes. The elements in the collection are of type Attribute.

Returns:
collection containg all attributes declared in this graph element class.
Throws:
DragosException - if something went wrong.

getWrappedGraphEntityClass

GraphEntityClass getWrappedGraphEntityClass()
Returns the wrapped entity class, null if none. For subinterfaces defined in the core GM (like EdgeClass, NodeClass...), the returned value is guaranteed to be an instance of the same subinterface.

Returns:
the wrapped entity class, null if none.


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