public abstract class SemgrexMatcher
extends java.lang.Object
SemgrexMatcher
can be used to match a SemgrexPattern
against a SemanticGraph
.
Usage should be the same as Matcher
.
Modifier and Type | Method and Description |
---|---|
boolean |
find()
Find the next match of the pattern in the graph.
|
boolean |
findNextMatchingNode()
Find the next match of the pattern in the graph such that the matching node
(that is, the node matching the root node of the pattern) differs from the
previous matching node.
|
SemanticGraphEdge |
getEdge(java.lang.String name) |
java.util.Set<java.lang.String> |
getEdgeNames()
Returns the set of names for named edges in this pattern
|
SemanticGraph |
getGraph()
Returns the graph associated with this match.
|
abstract IndexedWord |
getMatch()
Get the last matching node -- that is, the node that matches the root node
of the pattern.
|
IndexedWord |
getNode(java.lang.String name)
Returns the node labeled with
name in the pattern. |
java.util.Set<java.lang.String> |
getNodeNames()
Returns the set of names for named nodes in this pattern.
|
java.util.Set<java.lang.String> |
getRelationNames()
Returns the set of names for named relations in this pattern.
|
java.lang.String |
getRelnString(java.lang.String name) |
abstract boolean |
matches()
Does the pattern match the graph? It's actually closer to
java.util.regex's "lookingAt" in that the root of the graph has to match
the root of the pattern but the whole tree does not have to be "accounted
for".
|
boolean |
matchesAt(IndexedWord node)
Rests the matcher and tests if it matches in the graph when rooted at
node . |
SemanticGraphEdge |
putNamedEdge(java.lang.String name,
SemanticGraphEdge edge) |
IndexedWord |
putNode(java.lang.String name,
IndexedWord node) |
void |
reset()
Resets the matcher so that its search starts over.
|
abstract java.lang.String |
toString() |
public void reset()
public abstract boolean matches()
public boolean matchesAt(IndexedWord node)
node
.public abstract IndexedWord getMatch()
public boolean find()
public boolean findNextMatchingNode()
public IndexedWord getNode(java.lang.String name)
name
in the pattern.name
- the name of the node, specified in the pattern.public IndexedWord putNode(java.lang.String name, IndexedWord node)
public java.lang.String getRelnString(java.lang.String name)
public SemanticGraphEdge getEdge(java.lang.String name)
public java.util.Set<java.lang.String> getNodeNames()
public java.util.Set<java.lang.String> getRelationNames()
public java.util.Set<java.lang.String> getEdgeNames()
public SemanticGraphEdge putNamedEdge(java.lang.String name, SemanticGraphEdge edge)
public abstract java.lang.String toString()
toString
in class java.lang.Object
public SemanticGraph getGraph()