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 .
org.corpus_tools.salt.util.internal.DataSourceAccessor Class Reference

Provides some methods for an easier access to objects being contained by a given SDocumentGraph object. More...

Classes

enum  TRAVERSION_TYPE
 types of traversions, used by the several methods, used as id for traversion More...
 

Static Public Member Functions

static boolean isContinuousByText (SDocumentGraph documentGraph, List<? extends SNode > subSNodList, List<? extends SNode > fullSNodList)
 {@inheritDoc SDocumentGraph::isContinuousByText(List)} First sorts the given lists, than searches first occurance of first node in subSNodList in fullSNodList. More...
 
static boolean isContinuousByText (SDocumentGraph documentGraph, List< SNode > subSNodList)
 {@inheritDoc SDocumentGraph::isContinuousByText(List)}
 
static void sortSTokenByText (SDocumentGraph documentGraph)
 {@inheritDoc SDocumentGraph::sortSTokenByText()}
 
static List< STokengetSortedSTokenByText (SDocumentGraph documentGraph, List< SToken > sTokens2sort)
 {@inheritDoc SDocumentGraph::getSortedTokenByText(List)}
 
static List< STokengetSortedSTokenByText (SDocumentGraph documentGraph)
 {@inheritDoc SDocumentGraph::getSortedTokenByText()}
 
static List< DataSourceSequencegetOverlappedDataSourceSequence (SDocumentGraph documentGraph, SNode sNode, SALT_TYPE... relationTypes)
 {@inheritDoc SDocumentGraph::getOverlappedDSSequences(SNode, List)}
 
static List< DataSourceSequencegetOverlappedDataSourceSequence (SDocumentGraph documentGraph, List< SNode > nodes, SALT_TYPE... relationTypes)
 {@inheritDoc SDocumentGraph::getOverlappedDSSequences(SNode, List)}
 
static List< STokengetOverlappedSTokens (SDocumentGraph documentGraph, SNode overlappingNode, SALT_TYPE... relationTypes)
 This method searches for every SToken which is (transitively) overlapped by the given SNode by SRelation types which have one of the types given in the overlappingRelationTypes list. More...
 
static List< SNodegetRootsByRelation (SDocumentGraph documentGraph, SALT_TYPE... saltTypes)
 Returns all SNode objects which are roots for the given types of SRelation. More...
 
static Multimap< String, SNodegetRootsByRelationType (SDocumentGraph documentGraph, SALT_TYPE sType)
 Returns all nodes, which are roots for the given relation-class respects to the given SType of the traversed relation. More...
 
static Multimap< String, SNodegetRootsByRelationType (SDocumentGraph documentGraph, Class<? extends SRelation > clazz)
 {@inheritDoc SDocumentGraph::getRootsByRelationType(SALT_TYPE)} More...
 

Detailed Description

Provides some methods for an easier access to objects being contained by a given SDocumentGraph object.

Author
Florian Zipser

Class Documentation

◆ org::corpus_tools::salt::util::internal::DataSourceAccessor::TRAVERSION_TYPE

enum org::corpus_tools::salt::util::internal::DataSourceAccessor::TRAVERSION_TYPE

types of traversions, used by the several methods, used as id for traversion

Enumerator
OVERLAPPED_DS_SEQUENCES
OVERLAPPED_STOKEN

Member Function Documentation

◆ getOverlappedSTokens()

static List<SToken> org.corpus_tools.salt.util.internal.DataSourceAccessor.getOverlappedSTokens ( SDocumentGraph  documentGraph,
SNode  overlappingNode,
SALT_TYPE...  relationTypes 
)
static

This method searches for every SToken which is (transitively) overlapped by the given SNode by SRelation types which have one of the types given in the overlappingRelationTypes list.

Parameters
overlappingNodethe node for which the overlapped SToken objects are searched
overlappingRelationTypesthe list of SALT_TYPEs which are used for traversion. If, for example, all SToken are searched which are overlapped by a SStructure, the SALT_TYPE.SDOMINANCE_RELATION and SALT_TYPE.SPANNING_RELATION should be contained in this parameter.
Returns
a list of SToken which are overlapped by the overlappingNode.

◆ getRootsByRelation()

static List<SNode> org.corpus_tools.salt.util.internal.DataSourceAccessor.getRootsByRelation ( SDocumentGraph  documentGraph,
SALT_TYPE...  saltTypes 
)
static

Returns all SNode objects which are roots for the given types of SRelation.

Means, that all SNodes will be returned as roots, which have no incoming relations of the given type.

For instance imagine the following structure and assume that the passed SALT_TYPEs are SALT_TYPE#SDOMINANCE_RELATION and SALT_TYPE#SSPANNING_RELATION:

      struct1
    //      ||
  span1     ||   span2
        /    \     ||    |
tok1    tok2  tok3  tok4

the nodes:

struct1 and span2 are returned, even if a pointing relation connects struct1 and span2.

Parameters
saltTypesa set of types for which nodes have to be computed.
Returns
a list of SNodes which are roots

◆ getRootsByRelationType() [1/2]

static Multimap<String, SNode> org.corpus_tools.salt.util.internal.DataSourceAccessor.getRootsByRelationType ( SDocumentGraph  documentGraph,
Class<? extends SRelation clazz 
)
static

{@inheritDoc SDocumentGraph::getRootsByRelationType(SALT_TYPE)}

for each relation R of type class
    for each foregoing relation P (incoming relation of R'source)
        check whether P is a parent of R (true, if they have the same class and the same type)   
    if R has no parents store R corresponding to it's type in returned table

◆ getRootsByRelationType() [2/2]

static Multimap<String, SNode> org.corpus_tools.salt.util.internal.DataSourceAccessor.getRootsByRelationType ( SDocumentGraph  documentGraph,
SALT_TYPE  sType 
)
static

Returns all nodes, which are roots for the given relation-class respects to the given SType of the traversed relation.

The following example shows the different to the method getRootsBySRelation(): Imagine the following graphFor example: node1 ->t1 node2, node2 ->t2-> node3. Also imagine, that -> is a relation of same class with sType=t1 respectivly sType=t2 The returned roots will be node1 and node 2, because of node1 is the root of a subgraph for relation.sType=t1 and node2 is the root of the subgraph for relation.sType=t2. Whereas the returned nodes of getRootsBySRelation() is only node1.

Parameters
clazzclass of Relation to be traversed for searching roots
Returns
a map of types, with corresponding lists of root nodes

◆ isContinuousByText()

static boolean org.corpus_tools.salt.util.internal.DataSourceAccessor.isContinuousByText ( SDocumentGraph  documentGraph,
List<? extends SNode subSNodList,
List<? extends SNode fullSNodList 
)
static

{@inheritDoc SDocumentGraph::isContinuousByText(List)} First sorts the given lists, than searches first occurance of first node in subSNodList in fullSNodList.

Starting from this index, the method compares each element in subSNodList to element i in fullSNodList. If one is not equal the method returns false.