public class SaltUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FEAT_NAME
Name for
SFeature to store the name of a node, relation, graph or
label. |
static String |
FEAT_NAME_QNAME
Qualified name for
SFeature to store the name of a node,
relation, graph or label. |
static String |
FEAT_SDATA
The name of the
SFeature for the data label for textual sources,
etc.. |
static String |
FEAT_SDATA_QNAME
Qualified name name of the
SFeature for the data label for
textual sources, etc.. |
static String |
FEAT_SDOCUMENT
|
static String |
FEAT_SDOCUMENT_GRAPH
|
static String |
FEAT_SDOCUMENT_GRAPH_LOCATION
|
static String |
FEAT_SDOCUMENT_GRAPH_LOCATION_QNAME
|
static String |
FEAT_SDOCUMENT_GRAPH_QNAME
|
static String |
FEAT_SDOCUMENT_QNAME
|
static String |
FEAT_SEND
The name of the
SFeature for the end value. |
static String |
FEAT_SEND_QNAME
The qualified name of the name of the
SFeature for the end value. |
static String |
FEAT_SMEDIA_REFERNCE
The name of the
SFeature for the reference to an audio file. |
static String |
FEAT_SMEDIA_REFERNCE_QNAME
The qualified name of the name of the
SFeature for the reference
to an audio file. |
static String |
FEAT_SSTART
The name of the
SFeature for the start value. |
static String |
FEAT_SSTART_QNAME
The qualified name of the name of the
SFeature for the start
value. |
static String |
FEAT_TYPE
Name for
SFeature to store the type of a relation. |
static String |
FEAT_TYPE_QNAME
Qualified name for
SFeature to store the type of a relation. |
static String |
FEAT_VALUE_DATATYPE
Name for
SFeature to store the type of a labels value. |
static String |
FILE_ENDING_DOT
The ending of a dot file.
|
static String |
FILE_ENDING_SALT_XML
The ending of a Salt XML file.
|
static String |
FILE_SALT_PROJECT
Default name of the saltProject file.
|
static String |
IDX_ID_LAYER
name of index for relating ids and layers
|
static String |
IDX_ID_NODES
name of index for relating ids and nodes
|
static String |
IDX_ID_NODES_INVERSE
name of index for relating ids and nodes (inverse)
|
static String |
IDX_ID_RELATIONS
name of index for relating ids and relations
|
static String |
IDX_ID_RELATIONS_INVERSE
name of index for relating ids and relations (inverse)
|
static String |
IDX_IN_RELATIONS
name of index for relating node ids and incoming relations
|
static String |
IDX_NODETYPE
name of index for node-types
|
static String |
IDX_OUT_RELATIONS
name of index for relating node ids and outgoing relations
|
static String |
IDX_RELATIONTYPE
name of index for relation-types
|
static String |
LABEL_ID
Name of
Label to store the identifier of a node, relation, graph
or layer. |
static String |
LABEL_ID_QNAME
Qualified name of
Label to store the identifier of a node,
relation, graph or layer. |
static String |
NAMESPACE_SEPERATOR
Separator between namespace and name: qname= NAMESPACE
"::" NAME.
|
static String |
SALT_NAMESPACE
default name for of derived namespace-attribute
|
static String |
SALT_NULL_VALUE
A NULL value as String.
|
static String |
SALT_SCHEME
The URI scheme for corpus pathes.
|
static String |
SEMANTICS_CAT
name for
SCatAnnotation |
static String |
SEMANTICS_LEMMA
name for
SLemmaAnnotation |
static String |
SEMANTICS_POS
name for
SPOSAnnotation |
static String |
SEMANTICS_SENTENCE
name for
SSentenceAnnotation |
static String |
SEMANTICS_TYPE
value for
STypeAnnotation |
static String |
SEMANTICS_UNIT
name for
SWordAnnotation and SSentenceAnnotation |
static String |
SEMANTICS_WORD
value for
SWordAnnotation |
| Constructor and Description |
|---|
SaltUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
belongsToCorpusStructure(Object element)
Returns whether specified Salt element is part of the corpus structure.
|
static <S> Diff.Builder<S> |
compare(S saltElement)
Creates a builder to have a fluent api for comparing two
SDocumentGraphs or SCorpusGraphs. |
static String |
createQName(String namespace,
String name)
Returns the concatenation of a labels namespace and a labels name as a
qualified name: qname= NAMESPACE "::" NAME.
|
static org.eclipse.emf.common.util.URI |
createSaltURI(String path)
When specified corpus path already contains salt schema, then specified
corpus path is returned.
|
static org.eclipse.emf.common.util.URI |
createSaltURI(org.eclipse.emf.common.util.URI path)
When specified corpus path already contains salt schema, then specified
corpus path is returned.
|
static <P extends Label> |
getAnnotation(Integer idx,
Set<P> annotations)
Returns the annotation at position idx in the passed set of annotations.
|
static String |
getGlobalId(Identifier id)
Returns a global ID for the passed object (either if
Identifier
belongs to SDocument or SCorpus object). |
static <T> boolean |
isNotNullOrEmpty(Collection<T> collection)
Checks whether a collection is not null nor empty
|
static <T> boolean |
isNullOrEmpty(Collection<T> collection)
Checks whether a collection is null or empty
|
static Object |
load(org.eclipse.emf.common.util.URI location)
Loads an object coming from a SaltXML (.
|
static SaltProject |
loadCompleteSaltProject(org.eclipse.emf.common.util.URI location)
Loads a SaltProject from given uri and returns it as object structure.
|
static SCorpusGraph |
loadCorpusGraph(org.eclipse.emf.common.util.URI corpusPath)
Loads the given SaltXML file (.
|
static SCorpusGraph |
loadCorpusGraph(org.eclipse.emf.common.util.URI corpusPath,
Integer idxOfSCorpusGraph)
Loads the given SaltXML file (.
|
static SDocumentGraph |
loadDocumentGraph(org.eclipse.emf.common.util.URI location)
Loads a
SDocumentGraph object and returns it. |
static List<Object> |
loadObjects(org.eclipse.emf.common.util.URI location)
Loads a list of root objects coming from a SaltXML (.
|
static SaltProject |
loadSaltProject(org.eclipse.emf.common.util.URI location)
Loads a SaltProject from given uri and returns it as object structure.
|
static void |
moveAnnotations(SAnnotationContainer from,
SAnnotationContainer to)
|
static void |
moveCorpusGraph(SCorpusGraph source,
SCorpusGraph target)
Moves the content of
source to target. |
static void |
moveMetaAnnotations(SAnnotationContainer from,
SAnnotationContainer to)
|
static void |
save_DOT(Object saltObject,
org.eclipse.emf.common.util.URI location)
This method stores a Salt model in the dot syntax (see:
http://www.graphviz.org/) in a file.
|
static void |
saveCorpusGraph_DOT(SCorpusGraph corpusGraph,
org.eclipse.emf.common.util.URI location)
Stores a
SCorpusGraph into DOT file. |
static void |
saveCorpusGraph(SCorpusGraph corpusGraph,
org.eclipse.emf.common.util.URI location)
Persists the passed
SCorpusGraph object in a
file at the passed location. |
static void |
saveDocumentGraph_DOT(SDocumentGraph documentGraph,
org.eclipse.emf.common.util.URI location)
Stores a
SDocumentGraph into DOT file. |
static void |
saveDocumentGraph(SDocumentGraph documentGraph,
org.eclipse.emf.common.util.URI location)
Persists the passed
SDocumentGraph object in a SaltXML file at
the passed location. |
static void |
saveSaltProject(SaltProject saltProject,
org.eclipse.emf.common.util.URI location)
Persists the passed
SaltProject object in a SaltXML file at the
passed location. |
static org.apache.commons.lang3.tuple.Pair<String,String> |
splitQName(String qName)
Splits the passed qName into a namespace and a name.
|
static Collection<String[]> |
unmarshalAnnotation(String marshalledString)
Splits an annotation string of the form 'namespace::name=value
(,namespace::name=value)* into a collection of (namespace, name, value).
|
static <T> Validator.Builder<T> |
validate(T saltObject)
Validates a salt project, a document structure or a corpus structure.
|
public static final String SALT_SCHEME
public static final String FILE_ENDING_SALT_XML
public static final String FILE_ENDING_DOT
public static final String FILE_SALT_PROJECT
public static final String SALT_NAMESPACE
public static final String NAMESPACE_SEPERATOR
public static final String SALT_NULL_VALUE
public static final String IDX_NODETYPE
public static final String IDX_RELATIONTYPE
public static final String IDX_ID_NODES
public static final String IDX_ID_NODES_INVERSE
public static final String IDX_ID_RELATIONS
public static final String IDX_ID_RELATIONS_INVERSE
public static final String IDX_ID_LAYER
public static final String IDX_OUT_RELATIONS
public static final String IDX_IN_RELATIONS
public static final String LABEL_ID
Label to store the identifier of a node, relation, graph
or layer.public static final String LABEL_ID_QNAME
Label to store the identifier of a node,
relation, graph or layer.public static final String FEAT_VALUE_DATATYPE
SFeature to store the type of a labels value.public static final String FEAT_NAME
SFeature to store the name of a node, relation, graph or
label.public static final String FEAT_NAME_QNAME
SFeature to store the name of a node,
relation, graph or label.public static final String FEAT_TYPE
SFeature to store the type of a relation.public static final String FEAT_TYPE_QNAME
SFeature to store the type of a relation.public static final String FEAT_SDOCUMENT_GRAPH
public static final String FEAT_SDOCUMENT_GRAPH_QNAME
public static final String FEAT_SDOCUMENT
public static final String FEAT_SDOCUMENT_QNAME
public static final String FEAT_SDOCUMENT_GRAPH_LOCATION
public static final String FEAT_SDOCUMENT_GRAPH_LOCATION_QNAME
public static final String FEAT_SMEDIA_REFERNCE
SFeature for the reference to an audio file.public static final String FEAT_SMEDIA_REFERNCE_QNAME
SFeature for the reference
to an audio file.public static final String FEAT_SSTART
SFeature for the start value.public static final String FEAT_SSTART_QNAME
SFeature for the start
value.public static final String FEAT_SEND
SFeature for the end value.public static final String FEAT_SEND_QNAME
SFeature for the end value.public static final String FEAT_SDATA
SFeature for the data label for textual sources,
etc..public static final String FEAT_SDATA_QNAME
SFeature for the data label for
textual sources, etc..public static final String SEMANTICS_CAT
SCatAnnotationpublic static final String SEMANTICS_POS
SPOSAnnotationpublic static final String SEMANTICS_LEMMA
SLemmaAnnotationpublic static final String SEMANTICS_SENTENCE
SSentenceAnnotationpublic static final String SEMANTICS_TYPE
STypeAnnotationpublic static final String SEMANTICS_WORD
SWordAnnotationpublic static final String SEMANTICS_UNIT
SWordAnnotation and SSentenceAnnotationpublic static String createQName(String namespace, String name)
namespace - the namespace of a labelname - the name of a labelpublic static org.apache.commons.lang3.tuple.Pair<String,String> splitQName(String qName)
Pair.getLeft() is the namespace, whereas
Pair.getRight() is the namepublic static org.eclipse.emf.common.util.URI createSaltURI(org.eclipse.emf.common.util.URI path)
path - public static org.eclipse.emf.common.util.URI createSaltURI(String path)
path - path to an elementpublic static String getGlobalId(Identifier id)
Identifier
belongs to SDocument or SCorpus object). A global id only
can be returned, if the element is contained in a SCorpusGraph
object.id - Object to retrieve global id.public static Object load(org.eclipse.emf.common.util.URI location)
FILE_ENDING_SALT_XML)
and returns it.
If multiple objects are contained in the file it will only load the first
one.location - URI to SaltXML file containing the object or
null if the fule does not contain any objects.loadObjects(...):
similar function that returns all the objects of a file.public static List<Object> loadObjects(org.eclipse.emf.common.util.URI location)
FILE_ENDING_SALT_XML) and returns it.objectURI - URI to SaltXML file containing the objectpublic static void moveCorpusGraph(SCorpusGraph source, SCorpusGraph target)
source to target. Caution:
Object contained in source will be moved, which from
target to source, which will mean, that object
are not content of source any more after using
moveCorpusGraph(SCorpusGraph, SCorpusGraph).source - SCorpusGraph delivering the content to
moveSCorpusGraphtarget - SCorpusGraph object to where the content will be movedpublic static void saveDocumentGraph(SDocumentGraph documentGraph, org.eclipse.emf.common.util.URI location)
SDocumentGraph object in a SaltXML file at
the passed location.documentGraph - SDocumentGraph object to persistlocation - location of where to persist object as URIpublic static SDocumentGraph loadDocumentGraph(org.eclipse.emf.common.util.URI location)
SDocumentGraph object and returns it. The location of
where to find the SaltXML containing the SDocumentGraph object is
given by the passed URI object.location - location of SaltXML to load SDocumentGraph object.public static void saveCorpusGraph(SCorpusGraph corpusGraph, org.eclipse.emf.common.util.URI location)
SCorpusGraph object in a
file at the passed location. The
relation between all SDocuments and their SDocumentGraph
will be removed.corpusGraph - SCorpusGraph object to persistlocation - location of where to persist object as URIpublic static SCorpusGraph loadCorpusGraph(org.eclipse.emf.common.util.URI corpusPath)
SCorpusGraph object persisting, an exception will be thrown. If
the SaltXML file contains persistings for more than one
SCorpusGraph object, the first one will be loaded.corpusPath - the URI to locate the SaltXML filepublic static SCorpusGraph loadCorpusGraph(org.eclipse.emf.common.util.URI corpusPath, Integer idxOfSCorpusGraph)
SCorpusGraph object persisting, an exception will be thrown. The
parameter idxOfSCorpusGraph determines which object shall be
load, in case of the given SaltXML file contains more than one persisting
of SCorpusGraph objects.corpusPath - the URI to locate the SaltXML fileidxOfSCorpusGraph - number of graph to be load, note that the list of graphs
starts with 0public static void saveSaltProject(SaltProject saltProject, org.eclipse.emf.common.util.URI location)
SaltProject object in a SaltXML file at the
passed location. The relation between all SDocuments and their
SDocumentGraph will be removed.saltProject - SaltProject object to persistlocation - location of where to persist object as URIpublic static SaltProject loadCompleteSaltProject(org.eclipse.emf.common.util.URI location)
location - location to the Salt project filepublic static SaltProject loadSaltProject(org.eclipse.emf.common.util.URI location)
SaltProject from the disk. To load the entire project use
loadCompleteSaltProject(URI) or call
SDocument.loadDocumentGraph() on each document to load the
actual document graph.location - location to the Salt project filepublic static void saveCorpusGraph_DOT(SCorpusGraph corpusGraph, org.eclipse.emf.common.util.URI location)
SCorpusGraph into DOT file.corpusGraph - the corpus graph to be storedlocation - the location to where the corpus graph is storedpublic static void saveDocumentGraph_DOT(SDocumentGraph documentGraph, org.eclipse.emf.common.util.URI location)
SDocumentGraph into DOT file.documentGraph - the document graph to be storedlocation - the location to where the document graph is storedpublic static void save_DOT(Object saltObject, org.eclipse.emf.common.util.URI location)
SaltProject like the following is stored:
|-----------------------------------------------| | SaltProject: | |-----------------------------------------------| | corpus-structure 0 | corpus-structure 1 | | | | | c1 | c1 | | / \ | | | | c2 c3 | d1 | | / | \ | \ | | | d1 d2 d3 d4 d5 | | |-----------------------------------------------|A structure like the following is created:
|-0
| |-c1
| | |-c2
| | |-d1.dot
| | |-d2.dot
| | |-d3.dot
| | |-c3
| | |-d4.dot
| | |-d5.dot
| |-0.dot
|-1
|-c1
| |-d1.dot
|-1.dot
public static <P extends Label> P getAnnotation(Integer idx, Set<P> annotations)
idx - position of the annotation to be returnedannotations - set of annotationspublic static void moveAnnotations(SAnnotationContainer from, SAnnotationContainer to)
from - SAnnotatableElement object from which
SAnnotation object should be movedto - SAnnotatableElement object to which
SAnnotation object should be movedpublic static void moveMetaAnnotations(SAnnotationContainer from, SAnnotationContainer to)
from - SMetaAnnotatableElement object from which
SMetaAnnotation object should be movedto - SMetaAnnotatableElement object to which
SMetaAnnotation object should be movedpublic static Collection<String[]> unmarshalAnnotation(String marshalledString)
marshalledString - the annotation string to be unmarschalledpublic static <S> Diff.Builder<S> compare(S saltElement)
SDocumentGraphs or SCorpusGraphs.
compare(graph1).with(graph2).useOption(key, value).andCheckIsomorphie(). or compare(graph1).with(graph2).useOption(key, value).andFindDiffs().
public static <T> boolean isNullOrEmpty(Collection<T> collection)
list - public static <T> boolean isNotNullOrEmpty(Collection<T> collection)
list - public static boolean belongsToCorpusStructure(Object element)
element - Salt elementpublic static <T> Validator.Builder<T> validate(T saltObject)
saltObject - Salt object to be validatedCopyright © 2009–2020 Humboldt-Universität zu Berlin, INRIA. All rights reserved.