public class TriplePattern extends Object implements ClauseEntry
Wildcards are recorded by using Node_RuleVariable entries rather than nulls because they can be named. If a null is specified that is converted to a variable of name "". Note that whilst some engines might simply require Node_Variables the forward engine requires variables represented using the more specialized subclass - Node_RuleVariable.
It would make more sense to have TriplePattern subclass Triple but that is final for some strange reason.
Constructor and Description |
---|
TriplePattern(Node subject,
Node predicate,
Node object)
Constructor - builds a pattern from three nodes,
use Node_RuleVariables as variables, use a variable
with an empty name as a wildcard, can also use null
as a wildcard.
|
TriplePattern(Triple match)
Constructor - builds a dgenerate pattern from a simple triple.
|
TriplePattern(TripleMatch match)
Constructor - builds a pattern from a standard triple match.
|
Modifier and Type | Method and Description |
---|---|
Triple |
asTriple()
Return the triple pattern as a triple
|
TripleMatch |
asTripleMatch()
Return the triple pattern as a triple match
|
boolean |
compatibleWith(TriplePattern pattern)
Compare two patterns for compatibility - i.e.
|
boolean |
equals(Object o)
Equality override - used so that TriplePattern variants (same to within variable renaming) test as equals
|
Node |
getObject()
Returns the object.
|
Node |
getPredicate()
Returns the predicate.
|
Node |
getSubject()
Returns the subject.
|
int |
hashCode()
hash function override
|
boolean |
isGround()
Test if the pattern is ground, contains no variables.
|
boolean |
isLegal()
Check a pattern to see if it is legal, used to exclude backchaining goals that
could never be satisfied.
|
boolean |
sameAs(Object o)
Compare triple patterns, taking into account variable indices.
|
static String |
simplePrintString(Node n)
Simplified printable name for a node
|
static String |
simplePrintString(Triple t)
Simplified printable name for a triple
|
boolean |
subsumes(TriplePattern arg)
Compare two patterns and return true if arg is a more
specific (more grounded) version of this one.
|
String |
toString()
Printable string
|
boolean |
variantOf(TriplePattern pattern)
Test if a pattern is just a variant of this pattern.
|
public TriplePattern(Node subject, Node predicate, Node object)
public TriplePattern(TripleMatch match)
public TriplePattern(Triple match)
public Node getObject()
public Node getPredicate()
public Node getSubject()
public TripleMatch asTripleMatch()
public Triple asTriple()
public boolean compatibleWith(TriplePattern pattern)
public boolean variantOf(TriplePattern pattern)
public boolean isLegal()
public boolean subsumes(TriplePattern arg)
public boolean isGround()
public static String simplePrintString(Triple t)
public static String simplePrintString(Node n)
public boolean equals(Object o)
public boolean sameAs(Object o)
sameAs
in interface ClauseEntry
Licenced under the Apache License, Version 2.0