|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
The Graph
interface offers access to the graph and its sub
graphs.
Only top-level graphs (those without a parent) have a name (!= null
),
For all other graphs it must be null
. Thus, the following
condition always holds:
(hasParent() and (name == null)) or (not hasParent() and (name != null))
All methods taking GraphEntity
s as parameters
only work on graph elements directly contained in this graph, and throw an
exception if this graph is not the element's parent (as determined by
GraphEntity.getParent()
).
Method Summary | |
---|---|
void |
clear()
Removes everything in the graph. |
boolean |
contains(GraphEntity ge)
Returns true if the specified graph element is in the graph. |
Edge |
createEdge(GraphEntity source,
GraphEntity target,
EdgeClass type)
Creates a new edge between the specified source and target graph element, which will belong to this graph and returns it. |
Graph |
createGraph(GraphClass type)
Creates a new graph, which will belong to this graph, and returns it. |
Node |
createNode(NodeClass type)
Creates a new node, which will belong to this graph and returns it. |
Relation |
createRelation(RelationClass type)
Creates a new relation, which will belong to this graph and returns it. |
java.util.Collection<? extends Edge> |
getAllEdgesOfGraph()
Returns a collection containing all edges stored in the graph. |
java.util.Collection<? extends Edge> |
getAllEdgesOfGraph(EdgeClass type,
boolean includeSubClasses)
Returns a collection containing all edges of the specified type stored in the graph. |
java.util.Collection<? extends GraphEntity> |
getAllGraphEntitiesOfGraph()
Returns a collection containing all graph entities stored in the graph. |
java.util.Collection<? extends GraphEntity> |
getAllGraphEntitiesOfGraph(GraphEntityClass type,
boolean includeSubClasses)
Returns a collection containing all graph entities of the specified type stored in the graph. |
java.util.Collection<? extends Graph> |
getAllGraphsOfGraph()
Returns a collection containing all graphs stored in the graph. |
java.util.Collection<? extends Graph> |
getAllGraphsOfGraph(GraphClass type,
boolean includeSubClasses)
Returns a collection containing the graphs of the specified type stored in the graph. |
java.util.Collection<? extends Node> |
getAllNodesOfGraph()
Returns a collection containing all nodes stored in the graph. |
java.util.Collection<? extends Node> |
getAllNodesOfGraph(NodeClass type,
boolean includeSubClasses)
Returns a collection containing all nodes of the specified type stored in the graph. |
java.util.Collection<? extends Relation> |
getAllRelationsOfGraph()
Returns a collection containing all relations stored in the graph. |
java.util.Collection<? extends Relation> |
getAllRelationsOfGraph(RelationClass type,
boolean includeSubClasses)
Returns a collection containing all relations of the specified type stored in the graph. |
GraphClass |
getGraphClass()
Returns the type of the graph. |
java.util.Collection<? extends GraphEntity> |
getGraphEntitiesByAttributeValue(Attribute attribute,
java.io.Serializable value)
Returns a collection of graph elements ( GraphEntity ) which
have the requested value for the attribute. |
java.lang.String |
getName()
Returns the name of the graph. |
boolean |
hasParent()
Returns true if the graph is contained in another graph,
false otherwise. |
boolean |
isEmpty()
Returns true if not even a single graph element (graph,
node, edge, etc) is contained in the graph. |
void |
removeAllEdges()
Removes all edges froms the graph. |
void |
removeAllEdges(EdgeClass type,
boolean includeSubClasses)
Removes all edges of the specified type from the graph. |
void |
removeAllGraphs()
Removes all graphs froms the graph. |
void |
removeAllGraphs(GraphClass type,
boolean includeSubClasses)
Removes all graphs of the specified type from the graph. |
void |
removeAllNodes()
Removes all nodes froms the graph. |
void |
removeAllNodes(NodeClass type,
boolean includeSubClasses)
Removes all nodes of the specified type from the graph. |
void |
removeAllRelations()
Removes all relations froms the graph. |
void |
removeAllRelations(RelationClass type,
boolean includeSubClasses)
Removes all relations of the specified type from the graph. |
void |
removeGraphEntity(GraphEntity graphEntity)
Removes the graph entity from this graph. |
Methods inherited from interface i3.dragos.gm.core.GraphEntity |
---|
equals, getAdjacentGraphEntities, getAdjacentRelations, getAdjacentRelations, getAllValidAttributeValues, getAttributeValue, getDataSourceURL, getEdges, getEdges, getGraphEntityClass, getInternalIdentifier, getParent, getRelationEnds, getRelationEnds, getRelationEnds, getWrappedGraphEntity, hashCode, isAttributeValid, isIncident, isIncident, putAttributeValue, setAttributeInvalid |
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 |
---|
GraphClass getGraphClass() throws DragosException
DragosException
- if something went wrong.java.lang.String getName()
null
is always returned.
boolean hasParent() throws DragosException
true
if the graph is contained in another graph,
false
otherwise.
true
if the graph is contained in another graph,
false
otherwise.
DragosException
- if something went wrong.boolean isEmpty() throws DragosException
true
if not even a single graph element (graph,
node, edge, etc) is contained in the graph.
true
if the graph is empty, false
otherwise.
DragosException
- if something went wrong.void clear() throws DragosException
Note: This method follows the same rules as the methods for removing edges, nodes, graphs and relations individually!
DragosException
- if something went wrong.boolean contains(GraphEntity ge) throws DragosException
true
if the specified graph element is in the graph.
ge
- The requested graph element (must not be null
).
true
if the graph element is contained in the graph and
false
otherwise.
DragosException
- if anything went wrong.void removeGraphEntity(GraphEntity graphEntity) throws EntityNotFoundException, DragosException
Deletion proceeds as follows:
GraphEntity.getRelationEnds(ConnectionMode)
using
ConnectionMode.ANY_SET
as parameter) are removed.
clear()
.Relation.removeAllRelationEndsOfRelation()
.Implementation notice: Some edges and relation ends might already be deleted due to cascading removal of entities processed before, so take care when iterating through the instances.
graphEntity
- The graph, which shall be deleted.
EntityNotFoundException
- if the graph entity could not be found in the graph.
DragosException
- if something else went wrong.java.util.Collection<? extends GraphEntity> getAllGraphEntitiesOfGraph() throws DragosException
DragosException
- if anything went wrong.java.util.Collection<? extends GraphEntity> getAllGraphEntitiesOfGraph(GraphEntityClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
type
- The type of the edges (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match graph entities whose GraphEntityClass is a subclass of the specified type.
EntityNotFoundException
- if the requested type could not be found.
DragosException
- if anything went wrong.Graph createGraph(GraphClass type) throws EntityNotFoundException, GraphEntityInstantiationException, DragosException, java.lang.IllegalArgumentException
Since graphs created in other graphs are not top-level graphs,
their name will be null
by definition.
type
- The graph's type.
EntityNotFoundException
- if the type for the graph couldn't be
found.
java.lang.IllegalArgumentException
- if type is null
.
GraphEntityInstantiationException
- if type is declared as an abstract class.
DragosException
- if something else went wrong.void removeAllGraphs(GraphClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
removeGraphEntity(GraphEntity)
for details.
type
- The type of the graphs to be deleted (null
means "any type").includeSubClasses
- If and only if true
, this method will
also match graphs whose graph class is a subclass of the specified type.
EntityNotFoundException
- if the type could not be found.
DragosException
- if something else went wrong.void removeAllGraphs() throws DragosException
removeGraphEntity(GraphEntity)
for details.
DragosException
- if anything went wrong.java.util.Collection<? extends Graph> getAllGraphsOfGraph(GraphClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
type
- The type of the graphs (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match graphs whose GraphClass is a subclass of the specified type.
EntityNotFoundException
- if the requested type could not be found.
DragosException
- if anything went wrong.java.util.Collection<? extends Graph> getAllGraphsOfGraph() throws DragosException
DragosException
- if anything went wrong.Node createNode(NodeClass type) throws EntityNotFoundException, GraphEntityInstantiationException, DragosException, java.lang.IllegalArgumentException
type
- The type of the new node.
EntityNotFoundException
- if the type for the node couldn't be
found.
java.lang.IllegalArgumentException
- if type is null
.
GraphEntityInstantiationException
- if type is declared as an abstract class.
DragosException
- if something else went wrong.void removeAllNodes(NodeClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
removeGraphEntity(GraphEntity)
for details.
type
- The type of the nodes to be deleted (null
means "any type").includeSubClasses
- If and only if true
, this method will
also match nodes whose NodeClass is a subclass of the specified type.
EntityNotFoundException
- if the type could not be found.
DragosException
- if something else went wrong.void removeAllNodes() throws EntityInUseException, DragosException
removeGraphEntity(GraphEntity)
for details.
DragosException
- if anything went wrong.
EntityInUseException
- if one of the nodes is in use.java.util.Collection<? extends Node> getAllNodesOfGraph(NodeClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
type
- The type of the nodes (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match nodes whose NodeClass is a subclass of the specified type.
EntityNotFoundException
- if the requested type could not be found.
DragosException
- if anything went wrong.java.util.Collection<? extends Node> getAllNodesOfGraph() throws DragosException
DragosException
- if anything went wrong.Edge createEdge(GraphEntity source, GraphEntity target, EdgeClass type) throws EntityNotFoundException, GraphEntityInstantiationException, DragosException, java.lang.IllegalArgumentException
source
- The source graph element of the edge (may be null
).target
- The target graph element of the edge (may be null
).type
- The type of the new edge (must not be null
).
EntityNotFoundException
- if the source or the target were not
null
and could not be found, or if
the type for the edge could not be found.
java.lang.IllegalArgumentException
- if type is null
.
GraphEntityInstantiationException
- if type is declared as an abstract class.
DragosException
- if something else went wrong.void removeAllEdges(EdgeClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
removeGraphEntity(GraphEntity)
for details.
type
- The type of the edges to be deleted (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match edges whose EdgeClass is a subclass of the specified type.
EntityNotFoundException
- if the type could not be found.
DragosException
- if something else went wrong.void removeAllEdges() throws EntityInUseException, DragosException
removeGraphEntity(GraphEntity)
for details.
DragosException
- if anything went wrong.
EntityInUseException
- if one of the edges is in use.java.util.Collection<? extends Edge> getAllEdgesOfGraph(EdgeClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
type
- The type of the edges (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match edges whose EdgeClass is a subclass of the specified type.
EntityNotFoundException
- if the requested type could not be found.
DragosException
- if anything went wrong.java.util.Collection<? extends Edge> getAllEdgesOfGraph() throws DragosException
DragosException
- if anything went wrong.Relation createRelation(RelationClass type) throws EntityNotFoundException, GraphEntityInstantiationException, DragosException, java.lang.IllegalArgumentException
type
- The type of the new relation.
EntityNotFoundException
- if the type for the relation couldn't be
found.
java.lang.IllegalArgumentException
- if type is null
.
GraphEntityInstantiationException
- if type is declared as an abstract class.
DragosException
- if something else went wrong.void removeAllRelations(RelationClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
removeGraphEntity(GraphEntity)
for details.
type
- The type of the relations to be deleted (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match relations whose RelationClass is a subclass of the specified type.
EntityNotFoundException
- if the type could not be found.
DragosException
- if something else went wrong.void removeAllRelations() throws EntityInUseException, DragosException
removeGraphEntity(GraphEntity)
for details.
DragosException
- if anything went wrong.
EntityInUseException
- if one of the edges is in use.java.util.Collection<? extends Relation> getAllRelationsOfGraph(RelationClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
type
- The type of the relations (null
means "any type").includeSubClasses
- If and only if true
, this method
will also match relations whose RelationClass is a subclass of the specified type.
EntityNotFoundException
- if the requested type could not be found.
DragosException
- if anything went wrong.java.util.Collection<? extends Relation> getAllRelationsOfGraph() throws DragosException
DragosException
- if anything went wrong.java.util.Collection<? extends GraphEntity> getGraphEntitiesByAttributeValue(Attribute attribute, java.io.Serializable value) throws EntityNotFoundException, DragosException
GraphEntity
) which
have the requested value for the attribute.
attribute
- The attribute.value
- The requested value. May be null
.
GraphEntity
) which
have the requested value for the attribute.
EntityNotFoundException
- if the attribute could not be found.
DragosException
- if anything went wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |