net.sourceforge.nite.search
Interface SearchableCorpus

All Known Implementing Classes:
NOMReadCorpus, NOMWriteCorpus

public interface SearchableCorpus

Every corpus which implement the interface SearchableCorpus could be read by NXT Search.
For more information and web demo of NXT Search visit

Method Summary
 java.lang.Comparable getAttributeComparableValue(java.lang.Object element, java.lang.String name)
          Returns the value of an attribute of an element as Comparable.
 java.lang.Comparable getCenterComparableValue(java.lang.Object element)
          Returns the center of start and end time as a Comparable value.
 java.lang.Comparable getDurationComparableValue(java.lang.Object element)
          Returns the temporal duration as a Comparable value.
 java.util.Iterator getElements()
          Returns an Iterator which visits each element in the corpora exactly once.
 java.util.Iterator getElements(java.util.List types)
          Returns an Iterator which visits each element with the specified type (= name of element) in the corpora exactly once.
 java.util.Iterator getElementsDominatedBy(java.lang.Object rootElement)
          Returns an Iterator which visits each element dominated by the specified element in the corpora exactly once.
 java.util.Iterator getElementsDominating(java.lang.Object childElement)
          Returns an Iterator which visits each element dominating the specified element in the corpora exactly once.
 java.util.Iterator getElementsOfSubgraph(java.lang.Object pointingElement)
          Returns an Iterator which visits each element of the specified subgraphs in the corpora exactly once.
 java.util.Iterator getElementsPointedBy(java.lang.Object startElement)
          Returns an Iterator which visits each element which has a pointer from the specified element in the corpora exactly once.
 java.lang.Comparable getEndComparableValue(java.lang.Object element)
          Returns the end time as a Comparable value.
 java.lang.Comparable getIdComparableValue(java.lang.Object element)
          Returns the ID of an element as a Comparable value.
 java.lang.String getNameOfElement(java.lang.Object element)
          Returns the name resp.
 QueryRewriter getQueryRewriter()
          Return the query rewriter that should be used (or null if it is not set)
 java.lang.Comparable getStartComparableValue(java.lang.Object element)
          Returns the start time as a Comparable value.
 java.lang.Comparable getText(java.lang.Object element)
          Returns the value of the text content as Comparable.
 boolean isQueryRewriting()
          true means we have enabled the new query rewrite functionality that can increase the speed of your queries.
 void setQueryRewriter(QueryRewriter writer)
          Enable the query rewrite functionality and select a rewriter to use (if the argument is null, query rewriting will not be enabled).
 void setQueryRewriting(boolean val)
          set to true to enable the new query rewrite functionality that can increase the speed of your queries
 boolean testContactWith(java.lang.Object a, java.lang.Object b)
          Returns true if element A ends at the time element B starts.
 boolean testDominates(java.lang.Object a, java.lang.Object b)
          Returns true if element A dominates element B.
 boolean testDominates(java.lang.Object a, java.lang.Object b, int distance)
          Returns true if element A dominates element B with the specified distance.
 boolean testDominatesSubgraph(java.lang.Object from, java.lang.Object to)
          Returns true if there is a pointer from the first element to another element which is dominated by the second element.
 boolean testDominatesSubgraph(java.lang.Object from, java.lang.Object to, java.lang.String role)
          Returns true if there is a pointer with a specified role from the first element to another element which is dominated by the second element.
 boolean testHasPointer(java.lang.Object from, java.lang.Object to)
          Returns true if there is a pointer from the first to the second element.
 boolean testHasPointer(java.lang.Object from, java.lang.Object to, java.lang.String role)
          Returns true if there is a pointer from the first to the second element with the specified role.
 boolean testIncludes(java.lang.Object a, java.lang.Object b)
          Returns true if element A temporally includes element B.
 boolean testIsEqual(java.lang.Object a, java.lang.Object b)
          Returns true if element A is the same element as element B.
 boolean testIsInequal(java.lang.Object a, java.lang.Object b)
          Returns true if element A is not the same element as element B.
 boolean testLeftAlignedWith(java.lang.Object a, java.lang.Object b)
          Returns true if element A is left aligned with element B.
 boolean testOverlapsLeft(java.lang.Object a, java.lang.Object b)
          Returns true if element A overlaps left element B.
 boolean testOverlapsWith(java.lang.Object a, java.lang.Object b)
          Returns true if element A overlaps element B.
 boolean testPrecedes(java.lang.Object a, java.lang.Object b)
          Returns true if element A precedes element B.
 boolean testPrecedesTemporal(java.lang.Object a, java.lang.Object b)
          Returns true if element A temporally precedes element B.
 boolean testRightAlignedWith(java.lang.Object a, java.lang.Object b)
          Returns true if element A is right aligned with element B.
 boolean testSameExtend(java.lang.Object a, java.lang.Object b)
          Returns true if element A and element B have the same duration.
 boolean testTimed(java.lang.Object a)
          Returns true if the element A is timed.
 

Method Detail

getElements

java.util.Iterator getElements()
Returns an Iterator which visits each element in the corpora exactly once.

Returns:
an Iterator which visits each element in the corpora exactly once

getElements

java.util.Iterator getElements(java.util.List types)
Returns an Iterator which visits each element with the specified type (= name of element) in the corpora exactly once. It is allowed to visit also elements with other types but then there is no search space reduction and the query processing may be less efficient. It is not allowed to visit an element two times.

Parameters:
types - list of types
Returns:
an Iterator which visits each element with the specified type (= name of element) in the corpora exactly once

getElementsDominatedBy

java.util.Iterator getElementsDominatedBy(java.lang.Object rootElement)
Returns an Iterator which visits each element dominated by the specified element in the corpora exactly once. It is allowed to visit also elements not dominated by the specified element but then there is no search space reduction and the query processing may be less efficient. It is not allowed to visit an element two times.

Parameters:
rootElement - the element which should dominate the requested elements
Returns:
an Iterator which visits each element dominated by the specified element in the corpora exactly once

getElementsDominating

java.util.Iterator getElementsDominating(java.lang.Object childElement)
Returns an Iterator which visits each element dominating the specified element in the corpora exactly once. It is allowed to visit also elements not dominating the specified element but then there is no search space reduction and the query processing may be less efficient. It is not allowed to visit an element two times.

Parameters:
childElement - the element whisch should be dominated by the requested elements
Returns:
an Iterator which visits each element dominating the specified element in the corpora exactly once

getElementsPointedBy

java.util.Iterator getElementsPointedBy(java.lang.Object startElement)
Returns an Iterator which visits each element which has a pointer from the specified element in the corpora exactly once. It is allowed to visit also elements not having a pointer from the specified element but then there is no search space reduction and the query processing may be less efficient. It is not allowed to visit an element two times.

Parameters:
startElement - the element where a pointer pointing to the requested elements starts
Returns:
an Iterator which visits each element which has a pointer from the specified element in the corpora exactly once

getElementsOfSubgraph

java.util.Iterator getElementsOfSubgraph(java.lang.Object pointingElement)
Returns an Iterator which visits each element of the specified subgraphs in the corpora exactly once. It is allowed to visit also elements not being in the specified subgraphs but then there is no search space reduction and the query processing may be less efficient. It is not allowed to visit an element two times.

Parameters:
pointingElement - the element pointing to the subgraphs
Returns:
an Iterator which visits each element of the specified subgraphs in the corpora exactly once.

getAttributeComparableValue

java.lang.Comparable getAttributeComparableValue(java.lang.Object element,
                                                 java.lang.String name)
Returns the value of an attribute of an element as Comparable.

Parameters:
element - the element with the attribute, that will be returned
name - the name of the attribute
Returns:
the value of an attribute of an element as Comparable

getText

java.lang.Comparable getText(java.lang.Object element)
Returns the value of the text content as Comparable.

Parameters:
element - the element containing the text, that will be returned
Returns:
the value of the text content as Comparable

getNameOfElement

java.lang.String getNameOfElement(java.lang.Object element)
Returns the name resp. type of an element.

Parameters:
element - the element with the name, that will be returned
Returns:
the name resp. type of an element

getStartComparableValue

java.lang.Comparable getStartComparableValue(java.lang.Object element)
Returns the start time as a Comparable value.

Parameters:
elemen - the element with the start time, that will be returned
Returns:
the start time as a Comparable value

getEndComparableValue

java.lang.Comparable getEndComparableValue(java.lang.Object element)
Returns the end time as a Comparable value.

Parameters:
elemen - the element with the end time, that will be returned
Returns:
the end time as a Comparable value

getDurationComparableValue

java.lang.Comparable getDurationComparableValue(java.lang.Object element)
Returns the temporal duration as a Comparable value.

Parameters:
elemen - the element with the temporal duration, that will be returned
Returns:
the temporal duration as a Comparable value

getCenterComparableValue

java.lang.Comparable getCenterComparableValue(java.lang.Object element)
Returns the center of start and end time as a Comparable value.

Parameters:
elemen - the element with the center of start and end time, that will be returned
Returns:
the center of start and end time as a Comparable value

getIdComparableValue

java.lang.Comparable getIdComparableValue(java.lang.Object element)
Returns the ID of an element as a Comparable value.

Parameters:
element - the element with the ID, that will be returned
Returns:
the ID of an element as a Comparable value

testIsEqual

boolean testIsEqual(java.lang.Object a,
                    java.lang.Object b)
Returns true if element A is the same element as element B.

Parameters:
a - element A
b - element B
Returns:
true if element A is the same element as element B

testIsInequal

boolean testIsInequal(java.lang.Object a,
                      java.lang.Object b)
Returns true if element A is not the same element as element B.

Parameters:
a - element A
b - element B
Returns:
true if element A is not the same element as element B

testDominates

boolean testDominates(java.lang.Object a,
                      java.lang.Object b)
Returns true if element A dominates element B. Notice that an element also dominates itself.

Parameters:
a - element A
b - element B
Returns:
true if element A dominates element B

testDominates

boolean testDominates(java.lang.Object a,
                      java.lang.Object b,
                      int distance)
Returns true if element A dominates element B with the specified distance. Notice that with distance=0 this metode is equale to testIsEqual(java.lang.Object, java.lang.Object). Also distance < 0 is possible, means element B dominates element B.

Parameters:
a - element A
b - element B
distance - distance between element A and element B
Returns:
true if element A dominates element B with the specified distance

testPrecedes

boolean testPrecedes(java.lang.Object a,
                     java.lang.Object b)
Returns true if element A precedes element B.

Parameters:
a - element A
b - element B
Returns:
true if element A precedes element B

testHasPointer

boolean testHasPointer(java.lang.Object from,
                       java.lang.Object to)
Returns true if there is a pointer from the first to the second element.

Parameters:
from - start element of the pointer
to - target element of the pointer
Returns:
true if there is a pointer from the first to the second element

testHasPointer

boolean testHasPointer(java.lang.Object from,
                       java.lang.Object to,
                       java.lang.String role)
Returns true if there is a pointer from the first to the second element with the specified role.

Parameters:
from - start element of the pointer
to - target element of the pointer
role - the role of the pointer
Returns:
true if there is a pointer from the first to the second element with the specified role

testDominatesSubgraph

boolean testDominatesSubgraph(java.lang.Object from,
                              java.lang.Object to)
Returns true if there is a pointer from the first element to another element which is dominated by the second element. This methode may be usefull for type hierarchies.

Parameters:
from - start element of the pointer
to - element which dominates target element of the pointer
Returns:
true if there is a pointer from the first element to another element which is dominated by the second element

testDominatesSubgraph

boolean testDominatesSubgraph(java.lang.Object from,
                              java.lang.Object to,
                              java.lang.String role)
Returns true if there is a pointer with a specified role from the first element to another element which is dominated by the second element. This methode may be usefull for type hierarchies.

Parameters:
from - start element of the pointer
to - element which dominates target element of the pointer
role - the role of the pointer
Returns:
true if there is a pointer with a specified role from the first element to another element which is dominated by the second element

testTimed

boolean testTimed(java.lang.Object a)
Returns true if the element A is timed. Timed means either the element has explicit start and end time or all its children are timed.

Parameters:
a - element A
Returns:
true if the element A is timed

testOverlapsLeft

boolean testOverlapsLeft(java.lang.Object a,
                         java.lang.Object b)
Returns true if element A overlaps left element B. Means a_start <= b_start and a_end > b_start and a_end <= b_end.

Parameters:
a - element A
b - element B
Returns:
true if element A overlaps left element B

testLeftAlignedWith

boolean testLeftAlignedWith(java.lang.Object a,
                            java.lang.Object b)
Returns true if element A is left aligned with element B. Element A and B are starting at the same time, so a_start is equale to b_start.

Parameters:
a - element A
b - element B
Returns:
true if element A is left aligned with element B

testRightAlignedWith

boolean testRightAlignedWith(java.lang.Object a,
                             java.lang.Object b)
Returns true if element A is right aligned with element B. Element A and B are stoping at the same time, so a_end is equale to b_end.

Parameters:
a - element A
b - element B
Returns:
true if element A is right aligned with element B

testIncludes

boolean testIncludes(java.lang.Object a,
                     java.lang.Object b)
Returns true if element A temporally includes element B. Means a_start <= b_start and a_end >= b_end.

Parameters:
a - element A
b - element B
Returns:
true if element A temporally includes element B.

testSameExtend

boolean testSameExtend(java.lang.Object a,
                       java.lang.Object b)
Returns true if element A and element B have the same duration. Means a_start == b_start and a_end == b_end.

Parameters:
a - element A
b - element B
Returns:
true if element A and element B have the same duration

testOverlapsWith

boolean testOverlapsWith(java.lang.Object a,
                         java.lang.Object b)
Returns true if element A overlaps element B. Means a_end > b_start and b_end > a_start.

Parameters:
a - element A
b - element B
Returns:
true if element A overlaps element B

testContactWith

boolean testContactWith(java.lang.Object a,
                        java.lang.Object b)
Returns true if element A ends at the time element B starts. Means a_end == b_start.

Parameters:
a - element A
b - element B
Returns:
true if element A ends at the time element B starts

testPrecedesTemporal

boolean testPrecedesTemporal(java.lang.Object a,
                             java.lang.Object b)
Returns true if element A temporally precedes element B. Means a_end <= b_start.

Parameters:
a - element A
b - element B
Returns:
true if element A temporally precedes element B

setQueryRewriting

void setQueryRewriting(boolean val)
set to true to enable the new query rewrite functionality that can increase the speed of your queries


isQueryRewriting

boolean isQueryRewriting()
true means we have enabled the new query rewrite functionality that can increase the speed of your queries. false (the default) means we haven't


setQueryRewriter

void setQueryRewriter(QueryRewriter writer)
Enable the query rewrite functionality and select a rewriter to use (if the argument is null, query rewriting will not be enabled).


getQueryRewriter

QueryRewriter getQueryRewriter()
Return the query rewriter that should be used (or null if it is not set)