Salt  3.4.2
A powerful, tagset-independent and theory-neutral meta model and API for storing, manipulating, and representing nearly all types of linguistic data .
org.corpus_tools.salt.common.impl.SDocumentGraphImpl Class Reference

Inherits org.corpus_tools.salt.core.impl.SGraphImpl, and org.corpus_tools.salt.common.SDocumentGraph.

Public Member Functions

 SDocumentGraphImpl ()
 Initializes an object of type SDocumentGraphImpl.
 
 SDocumentGraphImpl (Graph delegate)
 Initializes an object of type SDocumentGraphImpl. More...
 
void addRelation (Relation<? extends SNode, ? extends SNode > relation)
 
void addNode (SNode node)
 
SDocument getDocument ()
 Returns the SDocument object containing this graph object.The SDocument object is linked via a SFeature object having the namespace {@value SaltFactory::NAMESPACE_SALT} and the name {@value SFEATURE_NAME::SDOCUMENT}.
Returns
the value of the 'SDocument' reference.

 
void setDocument (SDocument document)
 Sets the SDocument object as a container for this graph.The given SDocument object is linked via a SFeature object having the namespace {@value SaltFactory::NAMESPACE_SALT} and the name {@value SFEATURE_NAME::SDOCUMENT}.
Parameters
documentthe new value of the 'SDocument Graph' reference.
documentthe new value of the 'SDocument' reference.

 
void basic_setDocument (SDocument document)
 This is an internally used method. More...
 
List< STextualDSgetTextualDSs ()
 Returns all primary texts contained in this document structure.
Returns
a list of contained primary texts

 
List< SRelationgetRelations (SALT_TYPE type)
 Returns all relations of the passed type.
Parameters
typetype of relations
Returns
a list of relations matching passed type

 
List< SRelationgetRelations (Class<?> clazz)
 Returns all relations of the passed class.
Parameters
clazzclass of relations
Returns
a list of relations matching passed class

 
List< SNodegetNodes (SALT_TYPE type)
 Returns all nodes of the passed type.
Parameters
typetype of nodes
Returns
a list of nodes matching passed type

 
List< SNodegetNodes (Class<?> clazz)
 Returns all nodes of the passed class.
Parameters
clazzclass of nodes
Returns
a list of nodes matching passed class

 
List< STextualRelationgetTextualRelations ()
 Returns all relations which connects a token with a primary text contained in this document structure.
Returns
all relations which connects a token with a primary text

 
List< STokengetTokens ()
 Returns all tokens contained contained in this document structure.
Returns
all tokens

 
STimeline getTimeline ()
 Returns the timeline of this document graph.A timeline is a specific datasource and acts as an anchor for STimelineRelations. A timeline is necessary to set tokens in correspondance when they belong to different STextualDSs. For instance a timeline is necessary to model dialogue data.
Returns
timeline

 
void setTimeline (STimeline value)
 Sets a new timeline- A timeline is a specific datasource and acts as an anchor for STimelineRelations.A timeline is necessary to set tokens in correspondance when they belong to different STextualDSs. For instance a timeline is necessary to model dialogue data.
Parameters
valuenew timeline, which replaces the old one

 
List< STimelineRelationgetTimelineRelations ()
 
List< SSpanningRelationgetSpanningRelations ()
 
List< SSpangetSpans ()
 
List< SStructuregetStructures ()
 
List< SDominanceRelationgetDominanceRelations ()
 
List< SPointingRelationgetPointingRelations ()
 
List< SMedialRelationgetMedialRelations ()
 
List< SMedialDSgetMedialDSs ()
 
List< SOrderRelationgetOrderRelations ()
 
SRelation addNode (SNode source, SNode target, SALT_TYPE sRelationType)
 Creates and returns a 'SRelation' of the type given by sRelationType between source and target.Note that the source is required to be in the SDocumentGraph already and that the elationType may only be one of SALT_TYPE#STEXTUAL_RELATION, SALT_TYPE#SSPANNING_RELATION, SALT_TYPE#SDOMINANCE_RELATION and SALT_TYPE#SPOINTING_RELATION.
Parameters
sourcesource node
targettarget node
SALT_TYPEtype of the relation to be created between source and target
Returns
created relation

 
STextualDS createTextualDS (String text)
 Creates and adds a new STextualDS node object and sets its text to the passed one and adds it to the graph.
Parameters
textthe text which shall be the primary text and be added to the created STextualDS node
Returns
the created STextualDS node which has been created

 
SToken createToken (List< DataSourceSequence > sequences)
 Creates a new SToken object and adds it to the graph.The SToken object will be connected with the SSequentialDS object given in the passed DataSourceSequence object. The created relations get the borders also given in the DataSourceSequence object.
Parameters
sequenceslist of sequences which shall be overlapped by the created token
Returns
returns the created token

 
SToken createToken (SSequentialDS sequentialDS, Integer start, Integer end)
 Creates a new SToken object and adds it to the graph.The SToken object will be connected with the given SSequentialDS object. The created relation get the passed positions.
Parameters
sequentialDSthe data source to which the created token should be connected
startthe offset in the data source where the created token starts
endthe offset in the data source where the created token ends
Returns
the created token

 
SToken createToken (DataSourceSequence sDSSequence)
 Creates a new SToken object and adds it to the graph.The SToken object will be connected with the SSequentialDS objects given in the passed DataSourceSequence object. The created relations get the borders also given in the DataSourceSequence object.
Parameters
sequencethe sequence which shall be overlapped by the created token
Returns
returns the created token

 
SSpan createSpan (List< SToken > tokens)
 Creates a SSpan object, adds it to the graph and returns the new object.Further, this method creates SSpanningRelation relations and sets their source to the created SSpan object and the targets to the given source nodes.
Parameters
sourceTokenssource SToken node to which the SSpanningRelation relation points to
Returns
the created SSpan node

 
SSpan createSpan (SToken... tokens)
 Creates a new SSpan object, adds it to the graph and returns the new object.Further, this method creates a SSpanningRelation object and sets its source to the created SSpan object and the target to the given source node.
Parameters
sourceTokensource SToken node to which the SSpanningRelation relation points to
Returns
the created SSpan node

 
SStructure createStructure (List< SStructuredNode > sourceNodes)
 Creates a new SStructure object, adds it to the graph and returns the new object.Further, this method creates SDominanceRelation relations and sets their sources to the created SStructure object and the targets to the given source nodes.
Parameters
structureslist of source SStructuredNode nodes to which the SDominanceRelation relation points to
Returns
SStructure node

 
SStructure createStructure (SStructuredNode... structures)
 Creates a new SStructure object, adds it to the graph and returns the new object.Further, this method creates a SDominanceRelation object and sets its source to the created SStructure object and the target to the given source node.
Parameters
structuresource SStructuredNode node to which the SDominanceRelation relation points to
Returns
SStructure node

 
STimeline createTimeline ()
 Creates an STimeline object being contained in this SDocumentGraph object.The new STimeline object is filled with points of time computed out of the STextualRelation objects being contained by this SDocumentGraph object. For each STextualDS object, for each STextualRelation object one point of time would be created. If this object already contains a not empty STimeline object the already existing one would be returned.
Returns
returns a new created and automatically filled STimeline object if no one exists yet

 
STimelineRelation createTimelineRelation (SToken token, int timeSteps)
 Creates a STimelineRelation object being contained in this SDocumentGraph object, and attaches the SToken parameter to the document graph's timeline at the end, its start being the current end of the timeline, its end being the current end of the timeline + the time steps passed in as the second parameter.
Parameters
tokenThe token to attach the timeline relation to
timeStepsThe number of time steps on the timeline the token covers.
Returns
returns the newly created STimelineRelation object

 
List< STokengetTokensBySequence (DataSourceSequence sequence)
 Returns all SToken objects which refer to the passed DataSourceSequence object.The passed object determines the borders of the sequence by the values sStart and sEnd and the type of data source by the instance sSequentialDS.
Parameters
sequencean object determining the sequence to which the returned SToken objects refer to.
Returns
a list of SToken objects which refer or overlap the passed sequence

 
List< SSpangetSpansBySequence (DataSourceSequence sequence)
 Returns all SSpan objects which refer to the passed DataSourceSequence object.The passed object determines the borders of the sequence by the values sStart and sEnd and the type of data source by the instance sSequentialDS.
Parameters
sequencean object determining the sequence to which the returned SSpan objects refer to.
Returns
a list of SSpan objects which refer or overlap the passed sequence

 
List< SStructuregetStructuresBySequence (DataSourceSequence sequence)
 Returns all SStructure objects which refer to the passed DataSourceSequence object.The passed object determines the borders of the sequence by the values sStart and sEnd and the type of datasource by the instance sSequentialDS.
Parameters
sequencean object determining the sequence to which the returned SStructure objects refer to.
Returns
a list of SStructure objects which refer or overlap the passed sequence

 
List< SNodegetNodesBySequence (DataSourceSequence sequence)
 Returns all SNode objects which refer to the passed DataSourceSequence object.The passed object determines the borders of the sequence by the values sStart and sEnd and the type of data source by the instance sSequentialDS.
Parameters
sequencean object determining the sequence to which the returned SNode objects refer to.
Returns
a list of SNode objects which refer or overlap the passed sequence

 
List< DataSourceSequencegetOverlappedDataSourceSequence (SNode node, SALT_TYPE... relationTypes)
 Returns the sequences as DataSourceSequence which are overlapped by the given SNode node.Overlapped means, that starting from the given SNode node the SSequentialDS can reached by traversing relations of one of the types contained in the given list of SALT_TYPE.
Parameters
nodenode to start from
relationTypesa list of relation types, which are traversed
Returns
the overlapped DataSourceSequence objects

 
List< DataSourceSequencegetOverlappedDataSourceSequence (List< SNode > nodes, SALT_TYPE... relationTypes)
 Returns the sequences as DataSourceSequence which are overlapped by the given SNode node.Overlapped means, that starting from the given SNode node the SSequentialDS can reached by traversing relations of one of the types contained in the given list of SALT_TYPE.
Parameters
nodesa list of nodes to start from
relationTypesa list of relation types, which are traversed
Returns
the overlapped DataSourceSequence objects

 
boolean isContinuousByText (List< SNode > subNodeList, List< SNode > fullNodeList)
 Returns true, if the given list of nodes subNodeList is continuous respecting the overlapped text.A list of nodes is continuous, if there is no other node overlapping a text sequence, which is a subsequence of the sequence overlapped by the given list and is not part of the list.
Parameters
subNodeListlist to check against fullSNodeList
fullNodeListlist which contains all nodes in correct order
Returns
true, if list is continuous

 
boolean isContinuousByText (List< SNode > subNodeList)
 Returns true, if the given list of nodes subNodeList is continuous respecting the overlapped text.A list of nodes is continuous, if there is no other node overlapping a text sequence, which is a subsequence of the sequence overlapped by the given list and is not part of the list. The fullSNodeList is given by the token list of this graph.
Parameters
subNodeListlist to check against fullSNodeList
Returns
true, if list is continuous

 
List< STokengetSortedTokenByText (List< SToken > tokens2sort)
 Returns all SToken objects being contained in the given list and sorts them by the STextualRelation#getStart() value of SToken object.
Parameters
tokens2sortthe list of SToken objects to sort
Returns
list of tokens in order of left text position

 
List< STokengetSortedTokenByText ()
 Returns all SToken objects being contained in the list SDocumentGraph#getTokens() and sorts them by the STextualRelation#getStart() value of SToken object.
Returns
list of tokens in order of left text position

 
void sortTokenByText ()
 Sorts all SToken and STextualRelation objects being contained in the list SDocumentGraph#getTokens() and SDocumentGraph#getSTextualRelations() by the STextualRelation#getStart() value of SToken and STextualRelation object.
 
List< SNodegetRootsByRelation (SALT_TYPE... type)
 Returns all SNode objects which are roots for the given types of SRelation.Means, that all SNodes will be returned as roots, which have no incoming relations of the given type. For instance imagine the following structure and assume that the passed SALT_TYPEs are SALT_TYPE#SDOMINANCE_RELATION and SALT_TYPE#SSPANNING_RELATION:
      struct1
    //      ||
  span1     ||   span2
        /    \     ||    |
tok1    tok2  tok3  tok4
the nodes:struct1 and span2 are returned, even if a pointing relation connects struct1 and span2.
Parameters
saltTypesa set of types for which nodes have to be computed.
Returns
a list of SNodes which are roots

 
Multimap< String, SNodegetRootsByRelationType (SALT_TYPE type)
 Returns all nodes, which are roots for the given relation-class respects to the given SType of the traversed relation.The following example shows the different to the method getRootsBySRelation(): Imagine the following graphFor example:
node1 ->t1 node2, node2 ->t2-> node3
Also imagine, that -> is a relation of same class with sType=t1 respectivly sType=t2 The returned roots will be node1 and node 2, because of node1 is the root of a subgraph for relation.sType=t1 and node2 is the root of the subgraph for relation.sType=t2. Whereas the returned nodes of getRootsByRelation(SALT_TYPE) is only node1.
All relations having no type are stored in returned map corresponding to key SaltUtil#SALT_NULL_VALUE.
Parameters
typetype, which shall be used for computing roots
Returns
a map of types, with corresponding lists of root nodes

 
List< STokentokenize ()
 Tokenizes all STextualDS object being contained in this SDocumentGraph object.The Tokenization is similar to the tokenization made by the TreeTagger tokenizer. This method calls the method createTokenizer() and initializes with automatic detected values. The language will be detected automatically for each STextualDS object by use of the TextCategorizer (see: http://textcat.sourceforge.net/doc/org/knallgrau/utils/textcat/ TextCategorizer.html). If the language is one of the given ones: English, French, Italian and German, abbreviations also taken from the Treetagger will be used. To customize these settings use the method createTokenizer().The used Treetagger is a reimplementation in Java with permission from the original TreeTagger tokenizer in Perl by Helmut Schmid (see: http://www.ims.uni-stuttgart.de/projekte/corplex/TreeTagger/). For each token detected in the text given by sTextualDS.getSText() an SToken object is created and linked with the STextualDS object via a new STextualRelation object containing the textual offset.
Returns
a list of all created tokens

 
Tokenizer createTokenizer ()
 Creates a new Tokenizer object to tokenize the set STextualDS objects being contained in this SDocumentGraph object.To customize the tokenization, set take a look to the properties of the returned Tokenizer object. This method is used by the method tokenize(). The used Treetagger is a reimplementation in Java with permission from the original TreeTagger tokenizer in Perl by Helmut Schmid (see: http://www.ims.uni-stuttgart.de/projekte/corplex/TreeTagger/). For each token detected in the text given by sTextualDS.getSText() an SToken object is created and linked with the STextualDS object via a new STextualRelation object containing the textual offset. If the set STextualDS object is empty or if it does not belong to this SDocumentGraph object an exception is thrown.
Returns
a tokenizer object

 
SToken insertTokenAt (STextualDS sTextualDS, Integer posInText, String text, Boolean insertSpace)
 Inserts a token to the graph starting at position posInText and relates them to the given STextualDS object.
An example:
Imagine the following sText and tokenization
tok1  tok2  tok3  tok4
This  is    a     text.
the call insertSTokensAt(sTextualDS, 5, "additional", true);
results in
tok1  tok5        tok2  tok3  tok4
This  additional  is    a     text.
Parameters
textualDSthe STextualDS object to which the new tokens should be related to. Make sure, that stextualDS is already contained in the SDocumentGraph
posInTexttextual position where to add the new tokens.
texttext value, the new token should cover
insertSpaceif true, a blank after each new text is inserted
Returns
new created token

 
List< STokeninsertTokensAt (STextualDS sTextualDS, Integer posInText, List< String > texts, Boolean insertSpace)
 Inserts n tokens (where n is the size of the given list texts) to the graph starting at position posInText and relates them to the given STextualDS object.
An example:
Imagine the following sText and tokenization
tok1  tok2  tok3  tok4
This  is    a     text.
the call insertSTokensAt(sTextualDS, 5, {"additional" "text"}, true);
results in
tok1  tok5        tok6  tok2  tok3  tok4
This  additional  text  is    a     text.
Parameters
textualDSthe STextualDS object to which the new tokens should be related to. Make sure, that stextualDS is already contained in the SDocumentGraph
posInTexttextual position where to add the new tokens.
textstext values, the new tokens should cover
insertSpaceif true, a blank after each new text is inserted

 
SRelation createRelation (SNode sSource, SNode sTarget, SALT_TYPE sRelationType, String sAnnotations)
 Creates a SRelation object, and sets its sSource and sTarget to the passed ones.The created SRelation is of the passed type. If annotations are not empty, even SAnnotation objects will be created. The syntax to pass annotations is:
(SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+
where SNS is the namespace of the annotation, SNAME is its name and SVALUE is the value of the annotation.
Parameters
sourcesource node
targettarget node
relationTypetype of the relation
annotationsannotations to be added to the created relation (SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+
Returns
the created relation

 
List< STokengetOverlappedTokens (SNode overlappingNode)
 Returns all tokens in the graph, which are overlapped by the passed node and are reachable via SALT_TYPE#STEXT_OVERLAPPING_RELATION having at least one of the passed types.
Parameters
overlappingNodeanchor node, which overlaps the returned tokens

 
List< STokengetOverlappedTokens (SNode overlappingNode, SALT_TYPE... relationTypes)
 Returns all tokens in the graph, which are overlapped by the passed node and are reachable via relations having at least one of the passed types.
Parameters
overlappingNodeanchor node, which overlaps the returned tokens
overlappingRelationTypesrelation types

 
String getText (SNode sNode)
 This method returns the exact text overlapped in the STextualDS by the given SNode.Imagine the following graph:
      n1
     /  \
 t1 t2  t3 t4      t5
  |  |  |   |      |
This is a sample text.
The method will return the text 'text' for token t5 and 'is a' for node n1.
Parameters
sNodethe node for which the text should be retrieved.
Returns
the text which is overlapped by the passed node

 
boolean isIsomorph (SDocumentGraph other)
 {@inheritDoc SDocumentGraph::isIsomorph(SDocumentGraph)}
 
boolean isIsomorph (SDocumentGraph other, DiffOptions options)
 {@inheritDoc SDocumentGraph::isIsomorph(SDocumentGraph, DiffOptions)}
 
Set< DifferencefindDiffs (SDocumentGraph other)
 {@inheritDoc SDocumentGraph::findDiffs()}
 
Set< DifferencefindDiffs (SDocumentGraph other, DiffOptions options)
 {@inheritDoc SDocumentGraph::findDiffs(SDocumentGraph, DiffOptions)}
 
String toString ()
 
- Public Member Functions inherited from org.corpus_tools.salt.core.impl.SGraphImpl
 SGraphImpl ()
 Initializes an object of type SGraphImpl.
 
 SGraphImpl (Graph delegate)
 Initializes an object of type SGraphImpl. More...
 
void addLayer (SLayer layer)
 
List< SNodegetNodesByName (String nodeName)
 Searches for a node or a set of nodes having the given node name.
Parameters
nodeNameName of the node to search for
Returns
A complete list of all matching nodes. Is never null.

 
List< SRelationgetRelationsByName (String relationName)
 Searches for a relation or a set of relations having the given relation name.
Parameters
relationNameName of the relation to search for
Returns
A complete list of all matching relations. Is never null.

 
List< SLayergetLayerByName (String layerName)
 Searches for a layer or a set of layers having the given layer name.
Parameters
layerNameName of the layer to search for
Returns
A complete list of all matching layers. Is never null.

 
List< SNodegetRoots ()
 Returns all root nodes, if exist.A root node is a node, which has no incoming relations.
Returns
list of nodes being roots in the given graph.

 
List< SNodegetLeafs ()
 Returns all leaf nodes, if exist.A leaf node is a node, which has no outgoing relations.
Returns
list of nodes being leafs in the given graph.

 
List< SNodegetChildren (SNode parent, SALT_TYPE relationType)
 Returns a list of nodes in base document.The returned nodes are equivalents to the direct children of the passed parent node. The children are retrieved via traversing of relations of the passed SALT_TYPE.
Parameters
parentnode to who the children are retrieved
relationTypetype of relations to be traversed, if relationType is null, all relations are used
Returns
a list of children nodes, or an empty list

 
List< SNodegetSharedParent (List< SNode > children, SALT_TYPE nodeType)
 Returns a list of nodes that are the parents of every node in the given base list.Only nodes with the given SALT_TYPE will be considered.
Parameters
childrenlist of nodes whose parents are looked for
nodeTyperegarded types of relations
Returns
a list of parents
More...
 
void traverse (List< SNode > startNodes, GRAPH_TRAVERSE_TYPE traverseType, String traverseId, GraphTraverseHandler traverseHandler)
 Traverses a graph in the given order traverseType and starts traversing with the given startNodes.When a node is reached, first this method will invoke the method GraphTraverseHandler#checkConstraint(GRAPH_TRAVERSE_MODE, String, Edge, Node, long) of the given callback handler traverseHandler, second the method GraphTraverseHandler#nodeReached(GRAPH_TRAVERSE_MODE, String, Node, Edge, Node, long) is invoked. When a node was left, the method GraphTraverseHandler#nodeLeft(GRAPH_TRAVERSE_MODE, String, Node, Edge, Node, long) is invoked. When calling these methods, the traverseId will be passed, so that the callback handler knows which traversal is meant. This is helpful, in case of a single callback handler is used for more than one traversal at the same time. This method throws a GraphTraverserException in case of the graph contains a cycle. A cycle means a path containing the same node twice.
Parameters
startNodeslist of nodes at which the traversal shall start
traverseTypetype of traversing
traverseIdidentification for callback handler, in case of more than one traversal is running at the same time with the same callback handler
traverseHandlercallback handler, on which the three methods will be invoked

 
void traverse (List<? extends SNode > startNodes, GRAPH_TRAVERSE_TYPE traverseType, String traverseId, GraphTraverseHandler traverseHandler, boolean isCycleSafe)
 Traverses a graph in the given order traverseType and starts traversing with the given startNodes.When a node is reached, first this method will invoke the method GraphTraverseHandler#checkConstraint(GRAPH_TRAVERSE_MODE, String, Edge, Node, long) of the given callback handler traverseHandler, second the method GraphTraverseHandler#nodeReached(GRAPH_TRAVERSE_MODE, String, Node, Edge, Node, long) is invoked. When a node was left, the method GraphTraverseHandler#nodeLeft(GRAPH_TRAVERSE_MODE, String, Node, Edge, Node, long) is invoked. When calling these methods, the traverseId will be passed, so that the callback handler knows which traversal is meant. This is helpful, in case of a single callback handler is used for more than one traversal at the same time. This method throws a GraphTraverserException in case of the graph contains a cycle. A cycle means a path containing the same node twice.
Parameters
startNodeslist of nodes at which the traversal shall start
traverseTypetype of traversing
traverseIdidentification for callback handler, in case of more than one traversal is running at the same time with the same callback handler
traverseHandlercallback handler, on which the three methods will be invoked
isCycleSafedetermines whether cycle safeness chould be checked

 
void removeLabel (String qName)
 {@inheritDoc LabelableElement::removeLabel(String)} In case the passed qualified name is equal to SaltUtil#LABEL_ID_QNAME the internal reference to identifier is set to null. In case the passed qualified name is equal to SaltUtil#LABEL_ID_QNAME the internal reference to identifier is set to null.
 
String getName ()
 Returns the name of this element.The name of the element is not the identifier of the element. The identifier is given by the graph and constructed as a URI, where the name is used as fragment. If this is not unique, the graph will add a number to the fragment to make it unique.
Returns
name of the element.

 
void setName (String name)
 Sets the name of the element.The name of the element is not the identifier of the element. The identifier is given by the graph and constructed as a URI, where the name is used as fragment. If this is not unique, the graph will add a number to the fragment to make it unique.
Parameters
namename of the element.

 
SAnnotation createAnnotation (String namespace, String name, Object value)
 Creates and returns an annotation having the passed namespace, name and value.
Parameters
namespacenamespace of the annotation
namename of the annotation
valuevalue of the annotation
Returns
the created annotation

 
Set< SAnnotationcreateAnnotations (String annotationString)
 This method parses the given annotation String and adds an SAnnotation object for each annotation being contained in that string to the given SAnnotationContainer object.The syntax for Annotations is:
(SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+
where SNS is the namespace of the annotation, SNAME is its name and SVALUE is the value of the annotation
Parameters
annotationStringString containing the annotations

 
void addAnnotation (SAnnotation annotation)
 Adds the passed annotation to this container.
Parameters
annotationannotation to be added

 
SAnnotation getAnnotation (String qName)
 Returns an annotation having the passed qualified name, if this container contains such an annotation.
Parameters
qNamethe qualified of the annotation. A qualified name consists of: namespace+'::'+name
Returns
an annotation having the qualified name, if such an annotation exists, null otherwise

 
SAnnotation getAnnotation (String namespace, String name)
 Returns an annotation having the passed qualified name, if this container contains such an annotation.
Parameters
namespacethe namespace of the annotation.
namethe name of the annotation.
Returns
an annotation having the qualified name, if such an annotation exists, null otherwise

 
Iterator< SAnnotationiterator_SAnnotation ()
 Returns an iterator to iterate over the SAnnotation objects contained by this container.Using an iterator is slightly faster than getAnnotations().
Returns
an iterator of SAnnotation objects

 
void addMetaAnnotation (SMetaAnnotation metaAnnotation)
 Adds the passed meta annotation to this container.
Parameters
metaAnnotationmeta annotation to be added

 
SMetaAnnotation createMetaAnnotation (String namespace, String name, Object value)
 Creates and returns a meta annotation having the passed namespace, name and value.
Parameters
namespacenamespace of the meta annotation
namename of the meta annotation
valuevalue of the meta annotation
Returns
the created meta annotation

 
Set< SMetaAnnotationcreateMetaAnnotations (String annotationString)
 This method parses the given meta annotation String and adds an SMetaAnnotation object for each meta annotation being contained in that string to the given SAnnotationContainer object.The syntax for meta annotations is:
(SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+
where SNS is the namespace of the meta annotation, SNAME is its name and SVALUE is the value of the meta annotation
Parameters
metaAnnotationStringString containing the meta annotations

 
SMetaAnnotation getMetaAnnotation (String qName)
 Returns a meta annotation having the passed qualified name, if this container contains such a meta annotation. More...
 
Iterator< SMetaAnnotationiterator_SMetaAnnotation ()
 Returns an iterator to iterate over the SMetaAnnotation objects contained by this container. More...
 
SProcessingAnnotation createProcessingAnnotation (String namespace, String name, Object value)
 Creates and returns a processing-annotation having the passed namespace, name and value.
Parameters
namespacenamespace of the processing-annotation
namename of the processing-annotation
valuevalue of the processing-annotation
Returns
the created processing-annotation

 
Set< SProcessingAnnotationcreateProcessingAnnotations (String annotationString)
 This method parses the given processing-annotation String and adds an SProcessingAnnotation object for each processing-annotation being contained in that string to the given SAnnotationContainer object.The syntax for processing-annotations is:
(SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+
where SNS is the namespace of the processing-annotation, SNAME is its name and SVALUE is the value of the processing-annotation
Parameters
annotationStringString containing the processing-annotations

 
void addProcessingAnnotation (SProcessingAnnotation annotation)
 Adds the passed processing-annotation to this container.
Parameters
processingAnnotationannotation to be added

 
SProcessingAnnotation getProcessingAnnotation (String qName)
 Returns a processing-annotation having the passed qualified name, if this container contains such a processing-annotation.
Parameters
qNamethe qualified of the processing-annotation. A qualified name consists of: namespace+'::'+name
Returns
an processing-annotation having the qualified name, if such an processing-annotation exists, null otherwise

 
Iterator< SProcessingAnnotationiterator_SProcessingAnnotation ()
 Returns an iterator to iterate over the SProcessingAnnotation objects contained by this container.Using an iterator is slightly faster than getProcessingAnnotations().
Returns
an iterator of SAnnotation objects

 
SFeature createFeature (String namespace, String name, Object value)
 Creates and returns an feature having the passed namespace, name and value.
Parameters
namespacenamespace of the feature
namename of the feature
valuevalue of the feature
Returns
the created feature

 
Set< SFeaturecreateFeatures (String featureString)
 This method parses the given feature String and adds an SFeature object for each feature being contained in that string to the given SAnnotationContainer object.The syntax for Features is:
(SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+
where SNS is the namespace of the feature, SNAME is its name and SVALUE is the value of the feature
Parameters
featureStringString containing the features

 
void addFeature (SFeature feature)
 Adds the passed feature to this container.
Parameters
featurefeature to be added

 
SFeature getFeature (String qName)
 Returns an feature having the passed qualified name, if this container contains such an feature.
Parameters
qNamethe qualified of the feature. A qualified name consists of: namespace+'::'+name
Returns
an feature having the qualified name, if such an feature exists, null otherwise

 
SFeature getFeature (String namespace, String name)
 Returns an feature having the passed qualified name, if this container contains such an feature.
Parameters
namespacethe namespace of the feature.
namethe name of the feature.
Returns
an feature having the qualified name, if such an feature exists, null otherwise

 
Iterator< SFeatureiterator_SFeature ()
 Returns an iterator to iterate over the SFeature objects contained by this container.Using an iterator is slightly faster than getFeatures().
Returns
an iterator of SFeature objects

 
URI getPath ()
 Returns the id of this object as a URI path If no Id exists, null is returned.
Returns
uri path corresponding to the id of this object

 
- Public Member Functions inherited from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >
 GraphImpl (Graph< N, R, L > delegate)
 Initializes an object of type Graph. More...
 
IndexMgr getIndexMgr ()
 Returns the index manager. More...
 
 GraphImpl (int expectedNodes, int expectedRelations)
 Instantiates a new graph object and sets the initial capacity for all indexes to the passed ones. More...
 
List< N > getNodes ()
 {@inheritDoc Graph::getNodes()}
 
getNode (String nodeId)
 {@inheritDoc Graph::getNode(String)}
 
void addNode (N node)
 {@inheritDoc Graph::addNode(Node)}
 
void removeNode (N node)
 {@inheritDoc Graph::removeNode(Node)}
 
boolean containsNode (String nodeId)
 {@inheritDoc Graph::containsNode(String)}
 
List< R > getRelations ()
 {@inheritDoc Graph::getRelations()}
 
getRelation (String relationId)
 {@inheritDoc Graph::getRelation(String)}
 
List< R > getRelations (String sourceNodeId, String targetNodeId)
 Returns all relations,which connects the two passed nodes.
Parameters
sourceNodeIdthe id of the source node
targetNodeIdthe id of the target node
Returns
returns all nodes between source node and target node

 
List< R > getInRelations (String nodeId)
 Returns all relations, which have the node corresponding to the passed id as their target node.
Parameters
nodeIdid corresponding to the node, for which all incoming relations should be searched
Returns
a list of all incoming relations

 
List< R > getOutRelations (String nodeId)
 Returns all relations, which have the node corresponding to the passed id as their source node.
Parameters
nodeIdid corresponding to the node, for which all outgoing relations should be searched
Returns
a list of all outgoing relations

 
void addRelation (Relation<? extends N, ? extends N > relation)
 {@inheritDoc Graph::addRelation(Relation)}
 
void removeRelation (Relation<? extends N, ? extends N > rel)
 Removes the passed relation from this graph.If a relation is removed, it will be deleted from all indexes. If the passed relation is null, nothing is removed.
Parameters
relationrelation to be removed

 
void removeRelations ()
 Removes all relations from this graph and cleans all indexes.
 
boolean containsRelation (String relationId)
 {@inheritDoc Graph::containsRelation(String)}
 
Set< L > getLayers ()
 Returns a set of layers contained by this graph.
Returns
all contained layers

 
getLayer (String layerId)
 Returns a layer corresponding to the passed id, if such a layer is contained in the graph.
Parameters
layerIdid of the layer to be searched for

 
boolean containsLayer (String layerId)
 {@inheritDoc Graph::containsLayer(String)}
 
void addLayer (L layer)
 Adds the passed layer to this graph.If layer is null or layer is already contained nothing is inserted. The passed layer and this graph will be double chained, which means the method Layer#getGraph() will return this graph. If the passed layer contains nodes or relations, which are not already contained by the graph, they will be added.
Parameters
layerlayer to be inserted

 
void removeLayer (L layer)
 Removes the passed layer from this graph and cleans all indexes.It also ensures, that the graph is removed from the layer, thus invoking Layer#getGraph() will return null. The double chaining between this graph and the passed layer will be cut off. If the passed layer is null nothing happens.
Parameters
layerthe layer to be removed

 
- Public Member Functions inherited from org.corpus_tools.salt.graph.impl.IdentifiableElementImpl
 IdentifiableElementImpl (IdentifiableElement delegate)
 
Identifier getIdentifier ()
 {@inheritDoc IdentifiableElement::getIdentifier()}
 
void setIdentifier (Identifier identifier)
 {@inheritDoc IdentifiableElement::setIdentifier(Identifier)}
 
String getId ()
 {@inheritDoc IdentifiableElement::getId()}
 
void setId (String id)
 {@inheritDoc IdentifiableElement::setId(String)}
 
- Public Member Functions inherited from org.corpus_tools.salt.graph.impl.LabelableElementImpl
 LabelableElementImpl (LabelableElement delegatee)
 Initializes a new object and sets an internal delegate. More...
 
Collection< LabelgetLabels ()
 {@inheritDoc LabelableElement::getLabels()}
 
Label getLabel (String qName)
 {@inheritDoc LabelableElement::getLabel(String)}
 
Label getLabel (String namespace, String name)
 {@inheritedDoc LabelableElement::getLabel(String, String)}
 
Set< LabelgetLabelsByNamespace (String namespace)
 {@inheritDoc LabelableElement::getLabelsByNamespace(String)}
 
void addLabel (Label label)
 Adds the given Label object to the list of labels.
Parameters
labelthe Label object to be added

 
void basicAddLabel (Label label)
 This is an internally used method. More...
 
void basicRemoveLabel (String qName)
 This is an internally used method. More...
 
void removeLabel (String namespace, String name)
 {@inheritDoc LabelableElement::removeLabel(String, String))}
 
void removeAll ()
 {@inheritDoc LabelableElement::removeAll()}
 
boolean containsLabel (String qName)
 {@inheritDoc LabelableElement::containsLabel(String)}
 
Integer sizeLabels ()
 {@inheritDoc LabelableElement::sizeLabels()}
 

Protected Member Functions

void init ()
 Calls the init of super class and expands its initialization for adding SaltUtil#IDX_NODETYPE of indexes: More...
 
- Protected Member Functions inherited from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >
Graph< N, R, L > getDelegate ()
 Returns the delegate object.If delegate is not null, all functions of this method are delegated to the delegate object. Setting delegate makes this object to a container.
Returns
the delegate object

 
void basicAddNode (N node)
 This is an internally used method. More...
 
void basicRemoveNode (N node)
 This is an internally used method. More...
 
void basicAddRelation (Relation<? extends Node, ? extends Node > relation)
 This is an internally used method. More...
 
void update (Object oldValue, Object container, UPDATE_TYPE updateType) throws SaltException
 Updates all graph internal indexes, concerning the kind of the update which has been made. More...
 
void basicRemoveRelation (Relation<? extends N, ? extends N > rel)
 This is an internally used method. More...
 
void basicAddLayer (L layer)
 This is an internally used method. More...
 
void basicRemoveLayer (L layer)
 This is an internally used method. More...
 

Additional Inherited Members

- Static Public Attributes inherited from org.corpus_tools.salt.graph.impl.LabelableElementImpl
static final int EXPECTED_NUMBER_OF_LABELS = 5
 Determines the expected number of labels.
 
- Protected Attributes inherited from org.corpus_tools.salt.core.impl.SGraphImpl
SFeature name = null
 The feature object containing the name of the node.
 
- Protected Attributes inherited from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >
IndexMgr indexMgr = null
 Index manager.
 
int expectedNodes = 16
 Number of expected nodes to initialize indexes.
 
int expectedRelations = 16
 Number of expected relations to initialize indexes.
 
int approximatedNodeDegree = expectedRelations / expectedNodes
 Approximated node degree, which is expectedRelations / expectedNodes.
 
- Protected Attributes inherited from org.corpus_tools.salt.graph.impl.LabelableElementImpl
LabelableElement delegate = null
 A delegate object of the same type. More...
 

Constructor & Destructor Documentation

◆ SDocumentGraphImpl()

org.corpus_tools.salt.common.impl.SDocumentGraphImpl.SDocumentGraphImpl ( Graph  delegate)

Initializes an object of type SDocumentGraphImpl.

If delegate is not null, all functions of this method are delegated to the delegate object. Setting delegate makes this object to a container.

Parameters
adelegate object of the same type.

Member Function Documentation

◆ basic_setDocument()

void org.corpus_tools.salt.common.impl.SDocumentGraphImpl.basic_setDocument ( SDocument  document)

This is an internally used method.

To implement a double chaining of SDocument and SDocumentGraph object when a document is set to avoid an endless invocation. The invocation of methods is implement as follows:

setDocument(SDocument)                      SDocument#setDocumentGraph(Graph)
        ||             \ /                   ||
        ||              X                    ||
        \/             / \                   \/
basicDocument(SDocument)            SDocument#basicSetDocumentGraph(Graph)
Parameters
documentthe container document of this document graph

◆ init()

void org.corpus_tools.salt.common.impl.SDocumentGraphImpl.init ( )
protected

Calls the init of super class and expands its initialization for adding SaltUtil#IDX_NODETYPE of indexes:

Reimplemented from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >.