com.hp.hpl.jena.reasoner.rdfsReasoner1
Class BRWRule

java.lang.Object
  extended bycom.hp.hpl.jena.reasoner.rdfsReasoner1.BRWRule
Direct Known Subclasses:
PropertyBRWRule, ResourceBRWRule

public class BRWRule
extends java.lang.Object

Datastructure to hold a trivial backward rewrite rule.

The rules take the form "pattern <- pattern" where the pattern is is a triple pattern with variables. The head pattern uses the variables s/p/o to refer to the subject/predicate/object parts of the body pattern. Similarly, the body pattern uses s/p/o to refer to the corresponding parts of the query being processed.

Version:
$Revision: 1.6 $ on $Date: 2003/04/15 21:21:53 $
Author:
Dave Reynolds

Constructor Summary
BRWRule(TriplePattern head, TriplePattern body)
          Constructor
 
Method Summary
 boolean completeFor(TriplePattern query)
          Return true if this rule is a a complete solution to the given query and the router need look no further
 boolean equals(java.lang.Object o)
          Equality override
 ExtendedIterator execute(TriplePattern query, InfGraph infGraph, Finder data, java.util.HashSet firedRules)
          Use the rule to implement the given query.
 TriplePattern getBody()
          Returns the body.
 TriplePattern getHead()
          Returns the head.
 int hashCode()
          hash function override
static BRWRule makeRule(java.lang.String rulespec)
          Factory method that builds a rule instance by parsing a simple string representation of the form: ?
static Node parseNode(java.lang.String token)
          Assistant method to makeRule than parses a token as a node.
 java.lang.String toString()
          Printable string form
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BRWRule

public BRWRule(TriplePattern head,
               TriplePattern body)
Constructor

Method Detail

makeRule

public static BRWRule makeRule(java.lang.String rulespec)
Factory method that builds a rule instance by parsing a simple string representation of the form:
   ?s prop foo <- ?a ns:prop _ 
 
Variables are either _ or ?x, uri's are either simple strings (no spaces) or qnames. The prefix in qnames are restricted to rdf and rdfs. Minimal error checking.


execute

public ExtendedIterator execute(TriplePattern query,
                                InfGraph infGraph,
                                Finder data,
                                java.util.HashSet firedRules)
Use the rule to implement the given query. This will instantiate the rule against the query, run the new query against the whole reasoner+rawdata again and then rewrite the results from that query according the rule.

Parameters:
query - the query being processed
infGraph - the parent infGraph that invoked us, will be called recursively
data - the raw data graph which gets passed back to the reasoner as part of the recursive invocation
firedRules - set of rules which have already been fired and should now be blocked
Returns:
a ExtendedIterator which aggregates the matches and rewrites them according to the rule

completeFor

public boolean completeFor(TriplePattern query)
Return true if this rule is a a complete solution to the given query and the router need look no further


parseNode

public static Node parseNode(java.lang.String token)
Assistant method to makeRule than parses a token as a node.


toString

public java.lang.String toString()
Printable string form


getBody

public TriplePattern getBody()
Returns the body.

Returns:
TriplePattern

getHead

public TriplePattern getHead()
Returns the head.

Returns:
TriplePattern

equals

public boolean equals(java.lang.Object o)
Equality override


hashCode

public int hashCode()
hash function override



Copyright © 2001-2003 Hewlett-Packard. All Rights Reserved.