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.core.impl.SGraphImpl, and org.corpus_tools.salt.common.SCorpusGraph.
Public Member Functions | |||||||||||
SCorpusGraphImpl () | |||||||||||
Initializes an object of type SGraphImpl. | |||||||||||
SCorpusGraphImpl (Graph delegate) | |||||||||||
Initializes an object of type SGraphImpl. More... | |||||||||||
SaltProject | getSaltProject () | ||||||||||
Returns the salt project, to which this corpus structure belongs to.
| |||||||||||
void | setSaltProject (SaltProject saltProject) | ||||||||||
Sets the salt project, to which this corpus structure belongs to.
| |||||||||||
void | basic_setSaltProject (SaltProject saltProject) | ||||||||||
This is an internally used method. More... | |||||||||||
void | addRelation (Relation<? extends SNode, ? extends SNode > relation) | ||||||||||
void | addNode (SNode node) | ||||||||||
List< SCorpus > | getCorpora () | ||||||||||
Returns all corpora contained in this corpus structure.
| |||||||||||
List< SDocument > | getDocuments () | ||||||||||
Returns all documents objects contained in this corpus structure.
| |||||||||||
List< SCorpusRelation > | getCorpusRelations () | ||||||||||
Returns all corpus-corpus relations contained in this corpus structure.
| |||||||||||
List< SCorpusDocumentRelation > | getCorpusDocumentRelations () | ||||||||||
Returns all corpus-document relations contained in this corpus structure.
| |||||||||||
SCorpus | getCorpus (Identifier corpusId) | ||||||||||
Returns a corpus matching the passed identifier if such a corpus is contained in this corpus structure.If no such corpus is contained, null is returned.
| |||||||||||
SDocument | getDocument (Identifier documentId) | ||||||||||
Returns a document matching the passed identifier if such a document is contained in this document structure.If no such document is contained, null is returned.
| |||||||||||
Identifier | addSubCorpus (SCorpus superCorpus, SCorpus subCorpus) | ||||||||||
Adds the given sSubCorpus to the SCorpusGraph object and creates an SCorpusRelation between the given super corpus and the sub corpus, if and only if the super corpus is already added to this object.Otherwise an exception will be thrown. The method returns the identifier for the generated SCorpusRelation object.
| |||||||||||
Identifier | addDocument (SCorpus corpus, SDocument document) | ||||||||||
Adds the given document to the SCorpusGraph object and creates an SCorpusDocumentRelation between the given corpus and the document, if and only if the corpus is already added to this object.Otherwise an exception will be thrown. The method returns the Identifier for the generated SCorpusDocumentRelation object.
| |||||||||||
SCorpus | getCorpus (SDocument document) | ||||||||||
Returns the SCorpus object, which contains the given SDocument object (means the SCorpus object and the given SDocument object must be connected via a SCorpusDocumentRelation object).
| |||||||||||
void | load (URI corpusGraphUri) | ||||||||||
Loads the content of this object by reading the SaltXML file located by the given URI.The SaltXML file can either contain a SaltProject, than the first SCorpusGraph object is loaded or just a SCorpusGraph object.
| |||||||||||
SCorpus | createCorpus (SCorpus superCorpus, String corpusName) | ||||||||||
Creates a new SCorpus object having the name corpusName .The new created SCorpus object is added as a sub corpus to the passed superCorpus . An SCorpusRelation is created to connect them. The new created SCorpus is returned. If superSCorpus does not exist, a root corpus is created.
| |||||||||||
SDocument | createDocument (SCorpus parentCorpus, String documentName) | ||||||||||
Creates a SDocument object having the name documentName and is added to the given parentCorpus via a SCorpusDocumentRelation.
| |||||||||||
List< SCorpus > | createCorpus (final URI corpusPath) | ||||||||||
Creates all SCorpus objects contained in the passed corpusPath and returns a list of all SCorpus objects.
| |||||||||||
SDocument | createDocument (final URI documentPath) | ||||||||||
Creates all SCorpus objects contained in the passed corpusPath and assumes, that the last segment is a SDocument object.The created SDocument than is returned.
| |||||||||||
String | toTreeString () | ||||||||||
Creates an ascii tree of the corpus structure and returns it.
| |||||||||||
Public Member Functions inherited from org.corpus_tools.salt.core.impl.SGraphImpl | |||||||||||
SGraphImpl () | |||||||||||
Initializes an object of type SGraphImpl. | |||||||||||
SGraphImpl (Graph delegate) | |||||||||||
Initializes an object of type SGraphImpl. More... | |||||||||||
void | addLayer (SLayer layer) | ||||||||||
List< 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 Member Functions | |
void | init () |
Calls the init of super class and expands its initialization for adding SaltUtil#IDX_NODETYPE of indexes: More... | |
void | basicAddRelation (Relation<? extends Node, ? extends Node > relation) |
Calls the super method an puts the given relation into a relation type index. More... | |
void | basicAddNode (SNode node) |
Calls the super method an puts the given node into a node type index. More... | |
Protected Member Functions inherited from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R > | |
Graph< N, R, L > | getDelegate () |
Returns the delegate object.If delegate is not null, all functions of this method are delegated to the delegate object. Setting delegate makes this object to a container.
| |
void | basicAddNode (N node) |
This is an internally used method. More... | |
void | basicRemoveNode (N node) |
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... | |
Protected Attributes | |
transient SaltProject | saltProject = null |
Salt-project containing this corpus structure. | |
Protected Attributes inherited from org.corpus_tools.salt.core.impl.SGraphImpl | |
SFeature | name = null |
The feature object containing the name of the node. | |
Protected Attributes inherited from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R > | |
IndexMgr | indexMgr = null |
Index manager. | |
int | expectedNodes = 16 |
Number of expected nodes to initialize indexes. | |
int | expectedRelations = 16 |
Number of expected relations to initialize indexes. | |
int | approximatedNodeDegree = expectedRelations / expectedNodes |
Approximated node degree, which is expectedRelations / expectedNodes. | |
Protected Attributes inherited from org.corpus_tools.salt.graph.impl.LabelableElementImpl | |
LabelableElement | delegate = null |
A delegate object of the same type. More... | |
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. | |
org.corpus_tools.salt.common.impl.SCorpusGraphImpl.SCorpusGraphImpl | ( | 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. |
void org.corpus_tools.salt.common.impl.SCorpusGraphImpl.basic_setSaltProject | ( | SaltProject | saltProject | ) |
This is an internally used method.
To implement a double chaining of SCorpusGraph and SaltProject object when an node is inserted into this graph and to avoid an endless invocation the insertion of an node is splited into the two methods setSaltProject(SaltProject) and basic_setSaltProject(SaltProject).
saltProject | the Salt project containing the corpus structure |
|
protected |
Calls the super method an puts the given node into a node type index.
an exception will be thrown.
node | to add |
|
protected |
Calls the super method an puts the given relation into a relation type index.
an exception will be thrown.
relation | to add |
Reimplemented from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >.
|
protected |
Calls the init of super class and expands its initialization for adding SaltUtil#IDX_NODETYPE of indexes:
Reimplemented from org.corpus_tools.salt.graph.impl.GraphImpl< N extends Node, R extends Relation< N, N, L extends Layer< N, R >.