public interface SCorpusGraph extends SGraph
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
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
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.SGraph.GRAPH_TRAVERSE_TYPE| Modifier and Type | Method and Description |
|---|---|
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. |
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. |
SCorpus |
createCorpus(SCorpus superCorpus,
String corpusName)
Creates a new
SCorpus object having the name
corpusName. |
List<SCorpus> |
createCorpus(org.eclipse.emf.common.util.URI corpusPath)
|
SDocument |
createDocument(SCorpus parentCorpus,
String documentName)
Creates a
SDocument object having the name
documentName and is added to the given
parentCorpus via a SCorpusDocumentRelation. |
SDocument |
createDocument(org.eclipse.emf.common.util.URI documentPath)
|
List<SCorpus> |
getCorpora()
Returns all corpora 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.
|
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). |
List<SCorpusDocumentRelation> |
getCorpusDocumentRelations()
Returns all corpus-document relations contained in this corpus structure.
|
List<SCorpusRelation> |
getCorpusRelations()
Returns all corpus-corpus relations contained in this corpus structure.
|
SDocument |
getDocument(Identifier documentId)
Returns a document matching the passed identifier if such a document is
contained in this document structure.
|
List<SDocument> |
getDocuments()
Returns all documents objects contained in this corpus structure.
|
SaltProject |
getSaltProject()
Returns the salt project, to which this corpus structure belongs to.
|
void |
load(org.eclipse.emf.common.util.URI corpusGraphUri)
Loads the content of this object by reading the SaltXML file located by
the given
URI. |
void |
setSaltProject(SaltProject saltProject)
Sets the salt project, to which this corpus structure belongs to.
|
String |
toTreeString()
Creates an ascii tree of the corpus structure and returns it.
|
getChildren, getLayerByName, getLeafs, getNodesByName, getRelationsByName, getRoots, getSharedParent, traverse, traverseaddLayer, addNode, addRelation, containsLayer, containsNode, containsRelation, getIndexMgr, getInRelations, getLayer, getLayers, getNode, getNodes, getOutRelations, getRelation, getRelations, getRelations, removeLayer, removeNode, removeRelation, removeRelationsgetId, getIdentifier, setId, setIdentifieraddLabel, containsLabel, getLabel, getLabel, getLabels, getLabelsByNamespace, removeAll, removeLabel, removeLabel, sizeLabelsaddAnnotation, addFeature, addMetaAnnotation, addProcessingAnnotation, createAnnotation, createAnnotations, createFeature, createFeatures, createMetaAnnotation, createMetaAnnotations, createProcessingAnnotation, createProcessingAnnotations, getAnnotation, getAnnotation, getAnnotations, getFeature, getFeature, getFeatures, getMetaAnnotation, getMetaAnnotations, getProcessingAnnotation, getProcessingAnnotations, iterator_SAnnotation, iterator_SFeature, iterator_SMetaAnnotation, iterator_SProcessingAnnotationgetName, setNamegetPathSaltProject getSaltProject()
void setSaltProject(SaltProject saltProject)
saltProject - salt project containing this corpus structureList<SDocument> getDocuments()
List<SCorpus> getCorpora()
List<SCorpusRelation> getCorpusRelations()
List<SCorpusDocumentRelation> getCorpusDocumentRelations()
SCorpus getCorpus(Identifier corpusId)
corpusId - identifier corresponding to the corpus to be searchedSDocument getDocument(Identifier documentId)
documentId - identifier corresponding to the document to be searchedIdentifier addSubCorpus(SCorpus superCorpus, SCorpus subCorpus)
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 addedsubCorpus - corpus to addSCorpusRelation object.Identifier addDocument(SCorpus corpus, SDocument document)
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 addeddocument - document to addSCorpusDocumentRelation
objectSCorpus getCorpus(SDocument document)
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(org.eclipse.emf.common.util.URI corpusGraphUri)
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 fileSCorpus createCorpus(SCorpus superCorpus, String corpusName)
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)
SDocument object having the name
documentName and is added to the given
parentCorpus via a SCorpusDocumentRelation.List<SCorpus> createCorpus(org.eclipse.emf.common.util.URI corpusPath)
SCorpus objects contained in the passed
corpusPath and returns a list of all SCorpus
objects.corpusPath - the URI path of corporaSCorpus objects SDocument createDocument(org.eclipse.emf.common.util.URI documentPath)
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 documentString toTreeString()
Copyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.