org.d2rq.find
Class URIMakerRule
java.lang.Object
org.d2rq.find.URIMakerRule
- All Implemented Interfaces:
- Comparator<TripleRelation>
public class URIMakerRule
- extends Object
- implements Comparator<TripleRelation>
The URI maker rule states that any URI that matches a URI pattern is not contained
in a URI column. The reasoning is that lookup of a node in a URI pattern is relatively
quick -- often it requires just an integer lookup in a primary key table -- but
lookup in URI columns may require multiple full table scans. Since URI lookup is
such a common operation, this rule can help a lot by reducing full table scans.
Checking a number of NodeMakers against the rule works like this:
- An URIMakerRuleChecker is created using
createRuleChecker(Node)
,
- node makers are added one by one to the rule checker,
- as soon as a NodeMaker backed by an URI pattern has matched, subsequent
calls to
URIMakerRule.URIMakerRuleChecker.canMatch(NodeMaker)
will return false
if the argument is backed by a URI column.
Performance is best when all candidate NodeMakers backed by URI patterns are
sent to the rule checker before any NodeMaker backed by a URI column. For this
purpose, sortRDFRelations(Collection)
sorts a collection of
RDFRelations in an order that puts URI patterns first.
- Author:
- Richard Cyganiak (richard@cyganiak.de)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
URIMakerRule
public URIMakerRule()
sortRDFRelations
public List<TripleRelation> sortRDFRelations(Collection<TripleRelation> tripleRelations)
createRuleChecker
public URIMakerRule.URIMakerRuleChecker createRuleChecker(Node node)
compare
public int compare(TripleRelation o1,
TripleRelation o2)
- Specified by:
compare
in interface Comparator<TripleRelation>