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 .
|
Inherits org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >, and org.corpus_tools.salt.core.SGraph.
Inherited by org.corpus_tools.salt.common.impl.SCorpusGraphImpl, and org.corpus_tools.salt.common.impl.SDocumentGraphImpl.
Public Member Functions | |||||||||||
SGraphImpl () | |||||||||||
Initializes an object of type SGraphImpl. | |||||||||||
SGraphImpl (Graph delegate) | |||||||||||
Initializes an object of type SGraphImpl. More... | |||||||||||
void | addLayer (SLayer layer) | ||||||||||
List< SNode > | getNodesByName (String nodeName) | ||||||||||
Searches for a node or a set of nodes having the given node name.
| |||||||||||
List< SRelation > | getRelationsByName (String relationName) | ||||||||||
Searches for a relation or a set of relations having the given relation name.
| |||||||||||
List< SLayer > | getLayerByName (String layerName) | ||||||||||
Searches for a layer or a set of layers having the given layer name.
| |||||||||||
List< SNode > | getRoots () | ||||||||||
Returns all root nodes, if exist.A root node is a node, which has no incoming relations.
| |||||||||||
List< SNode > | getLeafs () | ||||||||||
Returns all leaf nodes, if exist.A leaf node is a node, which has no outgoing relations.
| |||||||||||
List< SNode > | getChildren (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.
| |||||||||||
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.Only nodes with the given SALT_TYPE will be considered.
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
SAnnotation | createAnnotation (String namespace, String name, Object value) | ||||||||||
Creates and returns an annotation having the passed namespace, name and value.
| |||||||||||
Set< SAnnotation > | 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.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
| |||||||||||
void | addAnnotation (SAnnotation annotation) | ||||||||||
Adds the passed annotation to this container.
| |||||||||||
SAnnotation | getAnnotation (String qName) | ||||||||||
Returns an annotation having the passed qualified name, if this container contains such an annotation.
| |||||||||||
SAnnotation | getAnnotation (String namespace, String name) | ||||||||||
Returns an annotation having the passed qualified name, if this container contains such an annotation.
| |||||||||||
Iterator< SAnnotation > | iterator_SAnnotation () | ||||||||||
Returns an iterator to iterate over the SAnnotation objects contained by this container.Using an iterator is slightly faster than getAnnotations().
| |||||||||||
void | addMetaAnnotation (SMetaAnnotation metaAnnotation) | ||||||||||
Adds the passed meta annotation to this container.
| |||||||||||
SMetaAnnotation | createMetaAnnotation (String namespace, String name, Object value) | ||||||||||
Creates and returns a meta annotation having the passed namespace, name and value.
| |||||||||||
Set< SMetaAnnotation > | createMetaAnnotations (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
| |||||||||||
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.
| |||||||||||
Set< SProcessingAnnotation > | 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.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
| |||||||||||
void | addProcessingAnnotation (SProcessingAnnotation annotation) | ||||||||||
Adds the passed processing-annotation to this container.
| |||||||||||
SProcessingAnnotation | getProcessingAnnotation (String qName) | ||||||||||
Returns a processing-annotation having the passed qualified name, if this container contains such a processing-annotation.
| |||||||||||
Iterator< SProcessingAnnotation > | iterator_SProcessingAnnotation () | ||||||||||
Returns an iterator to iterate over the SProcessingAnnotation objects contained by this container.Using an iterator is slightly faster than getProcessingAnnotations().
| |||||||||||
SFeature | createFeature (String namespace, String name, Object value) | ||||||||||
Creates and returns an feature having the passed namespace, name and value.
| |||||||||||
Set< SFeature > | 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.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
| |||||||||||
void | addFeature (SFeature feature) | ||||||||||
Adds the passed feature to this container.
| |||||||||||
SFeature | getFeature (String qName) | ||||||||||
Returns an feature having the passed qualified name, if this container contains such an feature.
| |||||||||||
SFeature | getFeature (String namespace, String name) | ||||||||||
Returns an feature having the passed qualified name, if this container contains such an feature.
| |||||||||||
Iterator< SFeature > | iterator_SFeature () | ||||||||||
Returns an iterator to iterate over the SFeature objects contained by this container.Using an iterator is slightly faster than getFeatures().
| |||||||||||
URI | getPath () | ||||||||||
Returns the id of this object as a URI path If no Id exists, null is returned.
| |||||||||||
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()} | |||||||||||
N | 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()} | |||||||||||
R | getRelation (String relationId) | ||||||||||
{@inheritDoc Graph::getRelation(String)} | |||||||||||
List< R > | getRelations (String sourceNodeId, String targetNodeId) | ||||||||||
Returns all relations,which connects the two passed nodes.
| |||||||||||
List< R > | getInRelations (String nodeId) | ||||||||||
Returns all relations, which have the node corresponding to the passed id as their target node.
| |||||||||||
List< R > | getOutRelations (String nodeId) | ||||||||||
Returns all relations, which have the node corresponding to the passed id as their source node.
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
L | getLayer (String layerId) | ||||||||||
Returns a layer corresponding to the passed id, if such a layer is contained in the graph.
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
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)} | |||||||||||
String | toString () | ||||||||||
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< Label > | getLabels () | ||||||||||
{@inheritDoc LabelableElement::getLabels()} | |||||||||||
Label | getLabel (String qName) | ||||||||||
{@inheritDoc LabelableElement::getLabel(String)} | |||||||||||
Label | getLabel (String namespace, String name) | ||||||||||
{@inheritedDoc LabelableElement::getLabel(String, String)} | |||||||||||
Set< Label > | getLabelsByNamespace (String namespace) | ||||||||||
{@inheritDoc LabelableElement::getLabelsByNamespace(String)} | |||||||||||
void | addLabel (Label label) | ||||||||||
Adds the given Label object to the list of labels.
| |||||||||||
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 Attributes | |
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... | |
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 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.
| |
void | init () |
Initializes an object of type GraphImpl. More... | |
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... | |
org.corpus_tools.salt.core.impl.SGraphImpl.SGraphImpl | ( | Graph | delegate | ) |
Initializes an object of type SGraphImpl.
If delegate is not null, all functions of this method are delegated to the delegate object. Setting delegate makes this object to a container.
a | delegate object of the same type. |
SMetaAnnotation org.corpus_tools.salt.core.impl.SGraphImpl.getMetaAnnotation | ( | String | qName | ) |
Returns a meta annotation having the passed qualified name, if this container contains such a meta annotation.
qName | the qualified of the meta annotation. A qualified name consists of: namespace+'::'+name |
Implements org.corpus_tools.salt.core.SAnnotationContainer.
List<SNode> org.corpus_tools.salt.core.impl.SGraphImpl.getSharedParent | ( | 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.
children | list of nodes whose parents are looked for |
nodeType | regarded types of relations |
for all incoming relations of first child node add targets to sharedparents for each child in children for each incomming relation of child add source node of incomming relation to parent sharedparents= sharedparents ⋂ parents
Implements org.corpus_tools.salt.core.SGraph.
Iterator<SMetaAnnotation> org.corpus_tools.salt.core.impl.SGraphImpl.iterator_SMetaAnnotation | ( | ) |
Returns an iterator to iterate over the SMetaAnnotation objects contained by this container.
Using an iterator is slightly faster than getMetaAnnotations().
Implements org.corpus_tools.salt.core.SAnnotationContainer.