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 .
|
In Salt it is possible to create a treelike corpus structure to create hierarchies between corpora. More...
Inherits org.corpus_tools.salt.core.SGraph.
Inherited by org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
Public Member Functions | |
SaltProject | getSaltProject () |
Returns the salt project, to which this corpus structure belongs to. More... | |
void | setSaltProject (SaltProject saltProject) |
Sets the salt project, to which this corpus structure belongs to. More... | |
List< SDocument > | getDocuments () |
Returns all documents objects contained in this corpus structure. More... | |
List< SCorpus > | getCorpora () |
Returns all corpora contained in this corpus structure. More... | |
List< SCorpusRelation > | getCorpusRelations () |
Returns all corpus-corpus relations contained in this corpus structure. More... | |
List< SCorpusDocumentRelation > | getCorpusDocumentRelations () |
Returns all corpus-document relations contained in this corpus structure. More... | |
SCorpus | getCorpus (Identifier corpusId) |
Returns a corpus matching the passed identifier if such a corpus is contained in this corpus structure. More... | |
SDocument | getDocument (Identifier documentId) |
Returns a document matching the passed identifier if such a document is contained in this document structure. More... | |
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. More... | |
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. More... | |
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). More... | |
void | load (URI corpusGraphUri) |
Loads the content of this object by reading the SaltXML file located by the given URI. More... | |
SCorpus | createCorpus (SCorpus superCorpus, String corpusName) |
Creates a new SCorpus object having the name corpusName . More... | |
SDocument | createDocument (SCorpus parentCorpus, String documentName) |
Creates a SDocument object having the name documentName and is added to the given parentCorpus via a SCorpusDocumentRelation. More... | |
List< SCorpus > | createCorpus (URI corpusPath) |
Creates all SCorpus objects contained in the passed corpusPath and returns a list of all SCorpus objects. More... | |
SDocument | createDocument (URI documentPath) |
Creates all SCorpus objects contained in the passed corpusPath and assumes, that the last segment is a SDocument object. More... | |
String | toTreeString () |
Creates an ascii tree of the corpus structure and returns it. 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... | |
In Salt it is possible to create a treelike corpus structure to create hierarchies between corpora.
A hierarchie means that one corpus can contain other corpora. The contained corpora are called subcorpora for the containing corpus and the containing corpus is the super corpus of the contained ones. If a corpus does not have a super corpus it is called the root corpus, if a corpus does not have sub corpora it is called a leaf corpus.
In Salt such a treelike structure is represented by an object of type SCorpusGraph. A corpus is represented by an object of type SCorpus and can be added to a SCorpusGraph object. To create a hierarchical relation between to corpora we used the object SCorpusRelation to connect to objects of type SCorpus, where the super corpus is the source of that relation and the sub corpus is the target of that relation. A corpus can have an unbound number of sub corpora. To create such an relation in the SCorpusGraph, you first have to add the super corpus (for instance by calling SCorpusGraph#addSNode(SNode)) and second you can add the sub corpus by calling SCorpusGraph#addSSubCorpus(SCorpus, SCorpus). This will automatically create the relation between both corpora and returns a pointer to the relation. Another way to do this is to add both corpora by calling SCorpusGraph#addSSubCorpus(SCorpus, SCorpus), creating a relation of type SCorpusRelation, setting its source to the super corpus, setting its target to the sub corpus and adding the relation to the SCorpusGraph object by calling SCorpusGraph#addSRelation(SRelation) . But note, that first the second way contains more handwork and second it is recommended to use the first appoach, because the SElementId object belonging to the sub corpus can only represent the hierarchy, when the SCorpusGraph knows about it, when adding the sub corpus. The 'real' linguistic data containing primary data, tokens, structures, annotations and so on are contained in lets say a container-object called document. Such a document is represented by the type SDocument. A document always belongs to a corpus (if this corpus is a super or a sub corpus makes no difference). Parallel to a corpus, a document is a specialization of a node (in Salt of type SNode) as well. Such a containment between a corpus and a document is represented by the type SCorpusDocumentRelation, where the source of this relation is the corpus and the target of this relation is the document. To add such a SDocument object to the SCorpusGraph use the method SCorpusGraph#addDocument(SCorpus, SDocument). This method will automatically create the relation between them. Like with adding a sub corpus, here you can also do this by hand hand, but note that even here it is recommended using the method SCorpusGraph#addDocument(SCorpus, SDocument) because of the SElementId object belonging to the SDocument object. In Salt the 'real' linguistic data are also stored in a graph called document-graph which is represented by the type SDocumentGraph. An object of this type is contained in a SDocument object and can be set and get by calling SDocument#setDocumentGraph(SDocumentGraph) and SDocument#getDocumentGraph(). A closer documentation of a document graph, you can find in SDocumentGraph.
Identifier org.corpus_tools.salt.common.SCorpusGraph.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.
corpus | corpus to which the document has to be added |
document | document to add |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
Identifier org.corpus_tools.salt.common.SCorpusGraph.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.
superCorpus | corpus which already has to be added |
subCorpus | corpus to add |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
SCorpus org.corpus_tools.salt.common.SCorpusGraph.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.
superCorpus | the parent SCorpus object |
corpusName | the name of the SCorpus object to be new created |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
List<SCorpus> org.corpus_tools.salt.common.SCorpusGraph.createCorpus | ( | URI | corpusPath | ) |
Creates all SCorpus objects contained in the passed corpusPath
and returns a list of all SCorpus objects.
corpusPath | the URI path of corpora |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
SDocument org.corpus_tools.salt.common.SCorpusGraph.createDocument | ( | SCorpus | parentCorpus, |
String | documentName | ||
) |
Creates a SDocument object having the name documentName
and is added to the given parentCorpus
via a SCorpusDocumentRelation.
parentCorpus | the parent SCorpus object |
documentName | the name of the SDocument object to be new created |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
SDocument org.corpus_tools.salt.common.SCorpusGraph.createDocument | ( | 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.
documentPath | the URI path of the document |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
List<SCorpus> org.corpus_tools.salt.common.SCorpusGraph.getCorpora | ( | ) |
Returns all corpora contained in this corpus structure.
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
SCorpus org.corpus_tools.salt.common.SCorpusGraph.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.
corpusId | identifier corresponding to the corpus to be searched |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
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).
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
List<SCorpusDocumentRelation> org.corpus_tools.salt.common.SCorpusGraph.getCorpusDocumentRelations | ( | ) |
Returns all corpus-document relations contained in this corpus structure.
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
List<SCorpusRelation> org.corpus_tools.salt.common.SCorpusGraph.getCorpusRelations | ( | ) |
Returns all corpus-corpus relations contained in this corpus structure.
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
SDocument org.corpus_tools.salt.common.SCorpusGraph.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.
documentId | identifier corresponding to the document to be searched |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
List<SDocument> org.corpus_tools.salt.common.SCorpusGraph.getDocuments | ( | ) |
Returns all documents objects contained in this corpus structure.
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
SaltProject org.corpus_tools.salt.common.SCorpusGraph.getSaltProject | ( | ) |
Returns the salt project, to which this corpus structure belongs to.
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
void org.corpus_tools.salt.common.SCorpusGraph.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.
corpusGraphUri | loaction of the SaltXML file |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
void org.corpus_tools.salt.common.SCorpusGraph.setSaltProject | ( | SaltProject | saltProject | ) |
Sets the salt project, to which this corpus structure belongs to.
saltProject | salt project containing this corpus structure |
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.
String org.corpus_tools.salt.common.SCorpusGraph.toTreeString | ( | ) |
Creates an ascii tree of the corpus structure and returns it.
Implemented in org.corpus_tools.salt.common.impl.SCorpusGraphImpl.