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.SDocumentGraph Interface Reference

The document-structure covers the "real" linguistic data, which means primary data, linguistic structures and annotations on them. More...

Inherits org.corpus_tools.salt.core.SGraph.

Inherited by org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

Public Member Functions

SDocument getDocument ()
 Returns the SDocument object containing this graph object. More...
 
void setDocument (SDocument document)
 Sets the SDocument object as a container for this graph. More...
 
List< STextualDSgetTextualDSs ()
 Returns all primary texts contained in this document structure. More...
 
List< STextualRelationgetTextualRelations ()
 Returns all relations which connects a token with a primary text contained in this document structure. More...
 
List< STokengetTokens ()
 Returns all tokens contained contained in this document structure. More...
 
STimeline getTimeline ()
 Returns the timeline of this document graph. More...
 
void setTimeline (STimeline value)
 Sets a new timeline- A timeline is a specific datasource and acts as an anchor for STimelineRelations. More...
 
List< SRelationgetRelations (SALT_TYPE type)
 Returns all relations of the passed type. More...
 
List< SRelationgetRelations (Class<?> clazz)
 Returns all relations of the passed class. More...
 
List< SNodegetNodes (SALT_TYPE type)
 Returns all nodes of the passed type. More...
 
List< SNodegetNodes (Class<?> clazz)
 Returns all nodes of the passed class. More...
 
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 relationType)
 Creates and returns a 'SRelation' of the type given by sRelationType between source and target. More...
 
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. More...
 
SToken createToken (List< DataSourceSequence > sequences)
 Creates a new SToken object and adds it to the graph. More...
 
SToken createToken (DataSourceSequence sequence)
 Creates a new SToken object and adds it to the graph. More...
 
SSpan createSpan (SToken... sourceToken)
 Creates a new SSpan object, adds it to the graph and returns the new object. More...
 
SSpan createSpan (List< SToken > sourceTokens)
 Creates a SSpan object, adds it to the graph and returns the new object. More...
 
SStructure createStructure (SStructuredNode... structure)
 Creates a new SStructure object, adds it to the graph and returns the new object. More...
 
SStructure createStructure (List< SStructuredNode > structures)
 Creates a new SStructure object, adds it to the graph and returns the new object. More...
 
STimeline createTimeline ()
 Creates an STimeline object being contained in this SDocumentGraph object. More...
 
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. More...
 
List< STokengetTokensBySequence (DataSourceSequence sequence)
 Returns all SToken objects which refer to the passed DataSourceSequence object. More...
 
List< SSpangetSpansBySequence (DataSourceSequence sequence)
 Returns all SSpan objects which refer to the passed DataSourceSequence object. More...
 
List< SStructuregetStructuresBySequence (DataSourceSequence sequence)
 Returns all SStructure objects which refer to the passed DataSourceSequence object. More...
 
List< SNodegetNodesBySequence (DataSourceSequence sequence)
 Returns all SNode objects which refer to the passed DataSourceSequence object. More...
 
List< DataSourceSequencegetOverlappedDataSourceSequence (SNode node, SALT_TYPE... relationTypes)
 Returns the sequences as DataSourceSequence which are overlapped by the given SNode node. More...
 
List< DataSourceSequencegetOverlappedDataSourceSequence (List< SNode > nodes, SALT_TYPE... relationTypes)
 Returns the sequences as DataSourceSequence which are overlapped by the given SNode node. More...
 
boolean isContinuousByText (List< SNode > subNodeList, List< SNode > fullNodeList)
 Returns true, if the given list of nodes subNodeList is continuous respecting the overlapped text. More...
 
boolean isContinuousByText (List< SNode > subNodeList)
 Returns true, if the given list of nodes subNodeList is continuous respecting the overlapped text. More...
 
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. More...
 
List< STokengetSortedTokenByText ()
 Returns all SToken objects being contained in the list SDocumentGraph#getTokens() and sorts them by the STextualRelation#getStart() value of SToken object. More...
 
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. More...
 
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. More...
 
SToken createToken (SSequentialDS sequentialDS, Integer start, Integer end)
 Creates a new SToken object and adds it to the graph. More...
 
List< STokentokenize ()
 Tokenizes all STextualDS object being contained in this SDocumentGraph object. More...
 
Tokenizer createTokenizer ()
 Creates a new Tokenizer object to tokenize the set STextualDS objects being contained in this SDocumentGraph object. More...
 
SToken insertTokenAt (STextualDS textualDS, Integer posInText, String text, Boolean insertSpace)
 Inserts a token to the graph starting at position posInText and relates them to the given STextualDS object. More...
 
List< STokeninsertTokensAt (STextualDS textualDS, 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. More...
 
SRelation createRelation (SNode source, SNode target, SALT_TYPE relationType, String annotations)
 Creates a SRelation object, and sets its sSource and sTarget to the passed ones. More...
 
List< STokengetOverlappedTokens (SNode overlappingNode, SALT_TYPE... overlappingRelationTypes)
 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. More...
 
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. More...
 
String getText (SNode sNode)
 This method returns the exact text overlapped in the STextualDS by the given SNode. More...
 
boolean isIsomorph (SDocumentGraph other)
 Compares the passed graph with the current one and returns if they are isomorph or not. More...
 
boolean isIsomorph (SDocumentGraph other, DiffOptions options)
 Compares the passed graph with the current one and returns if they are isomorph or not. More...
 
Set< DifferencefindDiffs (SDocumentGraph other)
 Compares the passed graph with the current one and returns if they are isomorph or not. More...
 
Set< DifferencefindDiffs (SDocumentGraph other, DiffOptions options)
 Compares the passed graph with the current one and returns if they are isomorph or not. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.core.SGraph
List< SNodegetRoots ()
 Returns all root nodes, if exist. More...
 
List< SNodegetLeafs ()
 Returns all leaf nodes, if exist. More...
 
List< SNodegetChildren (SNode parent, SALT_TYPE relationType)
 Returns a list of nodes in base document. More...
 
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. 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. More...
 
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. More...
 
List< SNodegetNodesByName (String nodeName)
 Searches for a node or a set of nodes having the given node name. More...
 
List< SRelationgetRelationsByName (String relationName)
 Searches for a relation or a set of relations having the given relation name. More...
 
List< SLayergetLayerByName (String layerName)
 Searches for a layer or a set of layers having the given layer name. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.graph.Graph< N extends Node, R extends Relation< N, N, L extends Layer< N, R >
IndexMgr getIndexMgr ()
 Returns the index manager. More...
 
List< R > getRelations ()
 Returns a list of all relations contained in this graph. More...
 
getRelation (String relationId)
 Returns an relation corresponding to the passed id, if such an relation is contained in the graph. More...
 
List< R > getRelations (String sourceNodeId, String targetNodeId)
 Returns all relations,which connects the two passed nodes. More...
 
List< R > getInRelations (String nodeId)
 Returns all relations, which have the node corresponding to the passed id as their target node. More...
 
List< R > getOutRelations (String nodeId)
 Returns all relations, which have the node corresponding to the passed id as their source node. More...
 
void addRelation (Relation<? extends N, ? extends N > relation)
 Adds the passed relation to this graph and updates indexes. More...
 
void removeRelation (Relation<? extends N, ? extends N > relation)
 Removes the passed relation from this graph. More...
 
void removeRelations ()
 Removes all relations from this graph and cleans all indexes.
 
boolean containsRelation (String relationId)
 Returns whether this graph contains an Relation corresponding to the passed id. More...
 
List< N > getNodes ()
 Returns a list of all relations contained in this graph. More...
 
getNode (String nodeId)
 Returns a node corresponding to the passed id, if such a node is contained in the graph. More...
 
void addNode (N node)
 Adds the passed node to this graph and updates indexes. More...
 
void removeNode (N node)
 Removes the passed node from this graph and cleans all indexes. More...
 
boolean containsNode (String nodeId)
 Returns whether this graph contains a Node corresponding to the passed id. More...
 
getLayer (String layerId)
 Returns a layer corresponding to the passed id, if such a layer is contained in the graph. More...
 
Set< L > getLayers ()
 Returns a set of layers contained by this graph. More...
 
void addLayer (L layer)
 Adds the passed layer to this graph. More...
 
boolean containsLayer (String layerId)
 Returns whether this graph contains a Layer corresponding to the passed id. More...
 
void removeLayer (L layer)
 Removes the passed layer from this graph and cleans all indexes. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.graph.IdentifiableElement
String getId ()
 Returns the id of this object, which is the value of the contained Identifier object. More...
 
void setId (String id)
 Creates a new Identifier object and sets its value to the passed id. More...
 
Identifier getIdentifier ()
 Returns the Identifier label for this object. More...
 
void setIdentifier (Identifier identifier)
 Sets the Identifier label for this object. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.graph.LabelableElement
Collection< LabelgetLabels ()
 Returns all labels being contained by this object. More...
 
void addLabel (Label label)
 Adds the given Label object to the list of labels. More...
 
Label getLabel (String namespace, String name)
 Returns a label having the passed namespace and name, if such a label is contained by this object. More...
 
Label getLabel (String qName)
 Returns a label having the passed qualified name. More...
 
void removeLabel (String qName)
 Removes the label having the passed qName. More...
 
void removeLabel (String namespace, String name)
 Removes a Label object from the list of labels of this object. More...
 
void removeAll ()
 Removes all Label objects.
 
Set< LabelgetLabelsByNamespace (String namespace)
 Returns a set containing all Label objects having the given namespace. More...
 
boolean containsLabel (String qName)
 Checks if this object has a Label object in its list having the given qualified name. More...
 
Integer sizeLabels ()
 returns the number of Label objects contained by this object. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.core.SAnnotationContainer
SAnnotation createAnnotation (String namespace, String name, Object value)
 Creates and returns an annotation having the passed namespace, name and value. More...
 
public< A extends SAnnotation > Set< A > createAnnotations (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. More...
 
public< A extends SAnnotation > Set< A > getAnnotations ()
 Returns all annotations contained by this object. More...
 
void addAnnotation (SAnnotation annotation)
 Adds the passed annotation to this container. More...
 
SAnnotation getAnnotation (String qName)
 Returns an annotation having the passed qualified name, if this container contains such an annotation. More...
 
SAnnotation getAnnotation (String namespace, String name)
 Returns an annotation having the passed qualified name, if this container contains such an annotation. More...
 
Iterator< SAnnotationiterator_SAnnotation ()
 Returns an iterator to iterate over the SAnnotation objects contained by this container. More...
 
SMetaAnnotation createMetaAnnotation (String namespace, String name, Object value)
 Creates and returns a meta annotation having the passed namespace, name and value. More...
 
public< A extends SMetaAnnotation > Set< A > createMetaAnnotations (String metaAnnotationString)
 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. More...
 
public< A extends SMetaAnnotation > Set< A > getMetaAnnotations ()
 Returns all meta annotations contained by this object. More...
 
void addMetaAnnotation (SMetaAnnotation metaAnnotation)
 Adds the passed meta annotation to this container. More...
 
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. More...
 
public< A extends SProcessingAnnotation > Set< A > createProcessingAnnotations (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. More...
 
public< A extends SProcessingAnnotation > Set< A > getProcessingAnnotations ()
 Returns all processing-annotations contained by this object. More...
 
void addProcessingAnnotation (SProcessingAnnotation processingAnnotation)
 Adds the passed processing-annotation to this container. More...
 
SProcessingAnnotation getProcessingAnnotation (String qName)
 Returns a processing-annotation having the passed qualified name, if this container contains such a processing-annotation. More...
 
Iterator< SProcessingAnnotationiterator_SProcessingAnnotation ()
 Returns an iterator to iterate over the SProcessingAnnotation objects contained by this container. More...
 
SFeature createFeature (String namespace, String name, Object value)
 Creates and returns an feature having the passed namespace, name and value. More...
 
public< A extends SFeature > Set< A > createFeatures (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. More...
 
public< A extends SFeature > Set< A > getFeatures ()
 Returns all features contained by this object. More...
 
void addFeature (SFeature feature)
 Adds the passed feature to this container. More...
 
SFeature getFeature (String qName)
 Returns an feature having the passed qualified name, if this container contains such an feature. More...
 
SFeature getFeature (String namespace, String name)
 Returns an feature having the passed qualified name, if this container contains such an feature. More...
 
Iterator< SFeatureiterator_SFeature ()
 Returns an iterator to iterate over the SFeature objects contained by this container. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.core.SNamedElement
String getName ()
 Returns the name of this element. More...
 
void setName (String name)
 Sets the name of the element. More...
 
- Public Member Functions inherited from org.corpus_tools.salt.core.SPathElement
URI getPath ()
 Returns the id of this object as a URI path If no Id exists, null is returned. More...
 

Detailed Description

The document-structure covers the "real" linguistic data, which means primary data, linguistic structures and annotations on them.

The linguistic structure contains the nodes: SSequentialDS, STextualDS, SMedialDS, SToken, SSpan and SStructure and the relations: STextualRelation, SMedialRelation, SSpanningRelation, SDominanceRelation, SPointingRelation and SOrderRelation which we will discuss in the following. All these nodes and relations are contained in a graph, the SDocumentGraph, which is the model element representing the document-structure.

Author
florian

Member Function Documentation

◆ addNode()

SRelation org.corpus_tools.salt.common.SDocumentGraph.addNode ( SNode  source,
SNode  target,
SALT_TYPE  relationType 
)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createRelation()

SRelation org.corpus_tools.salt.common.SDocumentGraph.createRelation ( SNode  source,
SNode  target,
SALT_TYPE  relationType,
String  annotations 
)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createSpan() [1/2]

SSpan org.corpus_tools.salt.common.SDocumentGraph.createSpan ( List< SToken sourceTokens)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createSpan() [2/2]

SSpan org.corpus_tools.salt.common.SDocumentGraph.createSpan ( SToken...  sourceToken)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createStructure() [1/2]

SStructure org.corpus_tools.salt.common.SDocumentGraph.createStructure ( List< SStructuredNode structures)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createStructure() [2/2]

SStructure org.corpus_tools.salt.common.SDocumentGraph.createStructure ( SStructuredNode...  structure)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createTextualDS()

STextualDS org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createTimeline()

STimeline org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createTimelineRelation()

STimelineRelation org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createToken() [1/3]

SToken org.corpus_tools.salt.common.SDocumentGraph.createToken ( DataSourceSequence  sequence)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createToken() [2/3]

SToken org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createToken() [3/3]

SToken org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ createTokenizer()

Tokenizer org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ findDiffs() [1/2]

Set<Difference> org.corpus_tools.salt.common.SDocumentGraph.findDiffs ( SDocumentGraph  other)

Compares the passed graph with the current one and returns if they are isomorph or not.

If graphs are not isomporph, this method finds and records all differences and lists them. That means the entire graphs have to be compared and could slow down the computation. If you are only interested in the result and not in the particular differences, use method isIsomorph().

Parameters
otherthe graph to be compared with this one
Returns
true, if graphs are isomorph, false otherwise.

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ findDiffs() [2/2]

Set<Difference> org.corpus_tools.salt.common.SDocumentGraph.findDiffs ( SDocumentGraph  other,
DiffOptions  options 
)

Compares the passed graph with the current one and returns if they are isomorph or not.

If graphs are not isomporph, this method finds and records all differences and lists them. That means the entire graphs have to be compared and could slow down the computation. If you are only interested in the result and not in the particular differences, use method isIsomorph().

Parameters
otherthe graph to be compared with this one
optionsan option map to customize the isomorphie comparison, for more information about how to customize the comparison, please check the javadoc to DiffOptions
Returns
true, if graphs are isomorph, false otherwise.

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getDocument()

SDocument org.corpus_tools.salt.common.SDocumentGraph.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.

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getNodes() [1/2]

List<SNode> org.corpus_tools.salt.common.SDocumentGraph.getNodes ( Class<?>  clazz)

Returns all nodes of the passed class.

Parameters
clazzclass of nodes
Returns
a list of nodes matching passed class

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getNodes() [2/2]

List<SNode> org.corpus_tools.salt.common.SDocumentGraph.getNodes ( SALT_TYPE  type)

Returns all nodes of the passed type.

Parameters
typetype of nodes
Returns
a list of nodes matching passed type

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getNodesBySequence()

List<SNode> org.corpus_tools.salt.common.SDocumentGraph.getNodesBySequence ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getOverlappedDataSourceSequence() [1/2]

List<DataSourceSequence> org.corpus_tools.salt.common.SDocumentGraph.getOverlappedDataSourceSequence ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getOverlappedDataSourceSequence() [2/2]

List<DataSourceSequence> org.corpus_tools.salt.common.SDocumentGraph.getOverlappedDataSourceSequence ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getOverlappedTokens() [1/2]

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getOverlappedTokens ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getOverlappedTokens() [2/2]

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getOverlappedTokens ( SNode  overlappingNode,
SALT_TYPE...  overlappingRelationTypes 
)

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getRelations() [1/2]

List<SRelation> org.corpus_tools.salt.common.SDocumentGraph.getRelations ( Class<?>  clazz)

Returns all relations of the passed class.

Parameters
clazzclass of relations
Returns
a list of relations matching passed class

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getRelations() [2/2]

List<SRelation> org.corpus_tools.salt.common.SDocumentGraph.getRelations ( SALT_TYPE  type)

Returns all relations of the passed type.

Parameters
typetype of relations
Returns
a list of relations matching passed type

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getRootsByRelation()

List<SNode> org.corpus_tools.salt.common.SDocumentGraph.getRootsByRelation ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getRootsByRelationType()

Multimap<String, SNode> org.corpus_tools.salt.common.SDocumentGraph.getRootsByRelationType ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getSortedTokenByText() [1/2]

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getSortedTokenByText ( )

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getSortedTokenByText() [2/2]

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getSortedTokenByText ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getSpansBySequence()

List<SSpan> org.corpus_tools.salt.common.SDocumentGraph.getSpansBySequence ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getStructuresBySequence()

List<SStructure> org.corpus_tools.salt.common.SDocumentGraph.getStructuresBySequence ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getText()

String org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getTextualDSs()

List<STextualDS> org.corpus_tools.salt.common.SDocumentGraph.getTextualDSs ( )

Returns all primary texts contained in this document structure.

Returns
a list of contained primary texts

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getTextualRelations()

List<STextualRelation> org.corpus_tools.salt.common.SDocumentGraph.getTextualRelations ( )

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getTimeline()

STimeline org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getTokens()

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getTokens ( )

Returns all tokens contained contained in this document structure.

Returns
all tokens

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ getTokensBySequence()

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getTokensBySequence ( 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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ insertTokenAt()

SToken org.corpus_tools.salt.common.SDocumentGraph.insertTokenAt ( STextualDS  textualDS,
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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ insertTokensAt()

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.insertTokensAt ( STextualDS  textualDS,
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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ isContinuousByText() [1/2]

boolean org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ isContinuousByText() [2/2]

boolean org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ isIsomorph() [1/2]

boolean org.corpus_tools.salt.common.SDocumentGraph.isIsomorph ( SDocumentGraph  other)

Compares the passed graph with the current one and returns if they are isomorph or not.

In case of the graphs are not isomorph, this method does not record all differences. To speed up the computation. it just detects the first difference and returns false. To get a full list of all differences, use method findDiffs().

Parameters
otherthe graph to be compared with this one
Returns
true, if graphs are isomorph, false otherwise.

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ isIsomorph() [2/2]

boolean org.corpus_tools.salt.common.SDocumentGraph.isIsomorph ( SDocumentGraph  other,
DiffOptions  options 
)

Compares the passed graph with the current one and returns if they are isomorph or not.

In case of the graphs are not isomorph, this method does not record all differences. To speed up the computation. it just detects the first difference and returns false. To get a full list of all differences, use method findDiffs().

Parameters
otherthe graph to be compared with this one
optionsan option map to customize the isomorphie comparison, for more information about how to customize the comparison, please check the javadoc to DiffOptions
Returns
true, if graphs are isomorph, false otherwise.

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ setDocument()

void org.corpus_tools.salt.common.SDocumentGraph.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.

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ setTimeline()

void org.corpus_tools.salt.common.SDocumentGraph.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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.

◆ tokenize()

List<SToken> org.corpus_tools.salt.common.SDocumentGraph.tokenize ( )

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

Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.