de.fuberlin.wiwiss.d2rq.find
Class URIMakerRule

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.find.URIMakerRule
All Implemented Interfaces:
Comparator

public class URIMakerRule
extends Object
implements Comparator

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:

  1. An URIMakerRuleChecker is created using createRuleChecker(Node),
  2. node makers are added one by one to the rule checker,
  3. 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.

Version:
$Id: URIMakerRule.java,v 1.1 2006/09/17 00:36:27 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de)

Nested Class Summary
 class URIMakerRule.URIMakerRuleChecker
           
 
Constructor Summary
URIMakerRule()
           
 
Method Summary
 int compare(Object o1, Object o2)
           
 URIMakerRule.URIMakerRuleChecker createRuleChecker(Node node)
           
 List sortRDFRelations(Collection rdfRelations)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

URIMakerRule

public URIMakerRule()
Method Detail

sortRDFRelations

public List sortRDFRelations(Collection rdfRelations)

createRuleChecker

public URIMakerRule.URIMakerRuleChecker createRuleChecker(Node node)

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator