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 .
|
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< STextualDS > | getTextualDSs () |
Returns all primary texts contained in this document structure. More... | |
List< STextualRelation > | getTextualRelations () |
Returns all relations which connects a token with a primary text contained in this document structure. More... | |
List< SToken > | getTokens () |
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< SRelation > | getRelations (SALT_TYPE type) |
Returns all relations of the passed type. More... | |
List< SRelation > | getRelations (Class<?> clazz) |
Returns all relations of the passed class. More... | |
List< SNode > | getNodes (SALT_TYPE type) |
Returns all nodes of the passed type. More... | |
List< SNode > | getNodes (Class<?> clazz) |
Returns all nodes of the passed class. More... | |
List< STimelineRelation > | getTimelineRelations () |
List< SSpanningRelation > | getSpanningRelations () |
List< SSpan > | getSpans () |
List< SStructure > | getStructures () |
List< SDominanceRelation > | getDominanceRelations () |
List< SPointingRelation > | getPointingRelations () |
List< SMedialRelation > | getMedialRelations () |
List< SMedialDS > | getMedialDSs () |
List< SOrderRelation > | getOrderRelations () |
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< SToken > | getTokensBySequence (DataSourceSequence sequence) |
Returns all SToken objects which refer to the passed DataSourceSequence object. More... | |
List< SSpan > | getSpansBySequence (DataSourceSequence sequence) |
Returns all SSpan objects which refer to the passed DataSourceSequence object. More... | |
List< SStructure > | getStructuresBySequence (DataSourceSequence sequence) |
Returns all SStructure objects which refer to the passed DataSourceSequence object. More... | |
List< SNode > | getNodesBySequence (DataSourceSequence sequence) |
Returns all SNode objects which refer to the passed DataSourceSequence object. More... | |
List< DataSourceSequence > | getOverlappedDataSourceSequence (SNode node, SALT_TYPE... relationTypes) |
Returns the sequences as DataSourceSequence which are overlapped by the given SNode node. More... | |
List< DataSourceSequence > | getOverlappedDataSourceSequence (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< SToken > | 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. More... | |
List< SToken > | getSortedTokenByText () |
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< SNode > | getRootsByRelation (SALT_TYPE... type) |
Returns all SNode objects which are roots for the given types of SRelation. More... | |
Multimap< String, SNode > | getRootsByRelationType (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< SToken > | tokenize () |
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< SToken > | 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. 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< SToken > | 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. More... | |
List< SToken > | 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. 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< Difference > | findDiffs (SDocumentGraph other) |
Compares the passed graph with the current one and returns if they are isomorph or not. More... | |
Set< Difference > | findDiffs (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< SNode > | getRoots () |
Returns all root nodes, if exist. More... | |
List< SNode > | getLeafs () |
Returns all leaf nodes, if exist. More... | |
List< SNode > | getChildren (SNode parent, SALT_TYPE relationType) |
Returns a list of nodes in base document. More... | |
List< SNode > | getSharedParent (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< SNode > | getNodesByName (String nodeName) |
Searches for a node or a set of nodes having the given node name. More... | |
List< SRelation > | getRelationsByName (String relationName) |
Searches for a relation or a set of relations having the given relation name. More... | |
List< SLayer > | getLayerByName (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... | |
R | 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... | |
N | 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... | |
L | 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< Label > | getLabels () |
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< Label > | getLabelsByNamespace (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< SAnnotation > | iterator_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< SMetaAnnotation > | iterator_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< SProcessingAnnotation > | iterator_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< SFeature > | iterator_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... | |
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.
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.
source | source node |
target | target node |
SALT_TYPE | type of the relation to be created between source and target |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
source | source node |
target | target node |
relationType | type of the relation |
annotations | annotations to be added to the created relation (SNS::)?SNAME(=SVALUE)?(;SNS::SNAME=SVALUE)+ |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sourceTokens | source SToken node to which the SSpanningRelation relation points to |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sourceToken | source SToken node to which the SSpanningRelation relation points to |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
structures | list of source SStructuredNode nodes to which the SDominanceRelation relation points to |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
structure | source SStructuredNode node to which the SDominanceRelation relation points to |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
text | the text which shall be the primary text and be added to the created STextualDS node |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
token | The token to attach the timeline relation to |
timeSteps | The number of time steps on the timeline the token covers. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequence | the sequence which shall be overlapped by the created token |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequences | list of sequences which shall be overlapped by the created token |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequentialDS | the data source to which the created token should be connected |
start | the offset in the data source where the created token starts |
end | the offset in the data source where the created token ends |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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().
other | the graph to be compared with this one |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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().
other | the graph to be compared with this one |
options | an option map to customize the isomorphie comparison, for more information about how to customize the comparison, please check the javadoc to DiffOptions |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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}.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
List<SNode> org.corpus_tools.salt.common.SDocumentGraph.getNodes | ( | Class<?> | clazz | ) |
Returns all nodes of the passed class.
clazz | class of nodes |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
Returns all nodes of the passed type.
type | type of nodes |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequence | an object determining the sequence to which the returned SNode objects refer to. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
nodes | a list of nodes to start from |
relationTypes | a list of relation types, which are traversed |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
node | node to start from |
relationTypes | a list of relation types, which are traversed |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
overlappingNode | anchor node, which overlaps the returned tokens |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
overlappingNode | anchor node, which overlaps the returned tokens |
overlappingRelationTypes | relation types |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
List<SRelation> org.corpus_tools.salt.common.SDocumentGraph.getRelations | ( | Class<?> | clazz | ) |
Returns all relations of the passed class.
clazz | class of relations |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
Returns all relations of the passed type.
type | type of relations |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
saltTypes | a set of types for which nodes have to be computed. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
type | type, which shall be used for computing roots |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
tokens2sort | the list of SToken objects to sort |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequence | an object determining the sequence to which the returned SSpan objects refer to. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequence | an object determining the sequence to which the returned SStructure objects refer to. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sNode | the node for which the text should be retrieved. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
List<STextualDS> org.corpus_tools.salt.common.SDocumentGraph.getTextualDSs | ( | ) |
Returns all primary texts contained in this document structure.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
List<SToken> org.corpus_tools.salt.common.SDocumentGraph.getTokens | ( | ) |
Returns all tokens contained contained in this document structure.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
sequence | an object determining the sequence to which the returned SToken objects refer to. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
textualDS | the STextualDS object to which the new tokens should be related to. Make sure, that stextualDS is already contained in the SDocumentGraph |
posInText | textual position where to add the new tokens. |
text | text value, the new token should cover |
insertSpace | if true, a blank after each new text is inserted |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
textualDS | the STextualDS object to which the new tokens should be related to. Make sure, that stextualDS is already contained in the SDocumentGraph |
posInText | textual position where to add the new tokens. |
texts | text values, the new tokens should cover |
insertSpace | if true, a blank after each new text is inserted |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
subNodeList | list to check against fullSNodeList |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
subNodeList | list to check against fullSNodeList |
fullNodeList | list which contains all nodes in correct order |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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().
other | the graph to be compared with this one |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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().
other | the graph to be compared with this one |
options | an option map to customize the isomorphie comparison, for more information about how to customize the comparison, please check the javadoc to DiffOptions |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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}.
document | the new value of the 'SDocument Graph' reference. |
document | the new value of the 'SDocument' reference. |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
value | new timeline, which replaces the old one |
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
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.
Implemented in org.corpus_tools.salt.common.impl.SDocumentGraphImpl.