edu.lehigh.swat.obione
Class RuleGoalTree

java.lang.Object
  extended by edu.lehigh.swat.obione.RuleGoalTree

public class RuleGoalTree
extends java.lang.Object

Models the rule goal tree of the PDMS.

Author:
abirqasem

Field Summary
private  int counter
           
private  Node current
           
private  LAVProcessor lp
           
private  GoalNode root
           
private  Rewrite rw
           
private  java.util.ArrayList<org.semanticweb.kaon2.api.rules.Variable> varList
           
 
Constructor Summary
RuleGoalTree(GoalNode g)
          Constucts a RG tree with a goal node as its root The goal node's label should be the query goal and the rule nodes label should be the query itself.
 
Method Summary
(package private)  GoalNode addAndNode(GoalNode gn, RuleNode rule)
          Adds an andNode (i.e a GAV definitional expansion of a goal node)
(package private)  GoalNode addOrNode(GoalNode gn, RuleNode rule)
          Adds an orNode (i.e Performs a LAV definitional expansion of a goal node)
 void addRuleNode(GoalNode g, Map m)
          Adds a rule node child to goal node
private  org.semanticweb.kaon2.api.rules.Literal applySub(java.util.HashMap theta, org.semanticweb.kaon2.api.rules.Literal l)
           
private  org.semanticweb.kaon2.api.rules.Rule applySubToRule(java.util.HashMap theta, org.semanticweb.kaon2.api.rules.Rule r)
           
private  java.util.List<org.semanticweb.kaon2.api.rules.Variable> getExistentialVariables(org.semanticweb.kaon2.api.rules.Rule r)
          Helper function
 GoalNode getRoot()
           
 java.util.Vector<Node> getSiblings(Node n)
          Gets the siblings given a node
static void main(java.lang.String[] args)
           
private  org.semanticweb.kaon2.api.rules.Rule makeFresh(org.semanticweb.kaon2.api.rules.Rule r)
          Helper method, makes all exisistential variables fresh variables existential variables are all non distingusiged variables
 void showTree(Node start, int indentLevel)
           
private  java.util.HashMap unify(org.semanticweb.kaon2.api.rules.Literal l1, org.semanticweb.kaon2.api.rules.Literal l2)
          Helper method for unifying two predicates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private GoalNode root

current

private Node current

varList

private java.util.ArrayList<org.semanticweb.kaon2.api.rules.Variable> varList

counter

private int counter

lp

private LAVProcessor lp

rw

private Rewrite rw
Constructor Detail

RuleGoalTree

public RuleGoalTree(GoalNode g)
Constucts a RG tree with a goal node as its root The goal node's label should be the query goal and the rule nodes label should be the query itself.

Method Detail

addRuleNode

public void addRuleNode(GoalNode g,
                        Map m)
Adds a rule node child to goal node

Parameters:
g -
m -

addAndNode

GoalNode addAndNode(GoalNode gn,
                    RuleNode rule)
Adds an andNode (i.e a GAV definitional expansion of a goal node)

Parameters:
gn - Goal node to be expanded
See Also:
Definitional Expansion

addOrNode

GoalNode addOrNode(GoalNode gn,
                   RuleNode rule)
Adds an orNode (i.e Performs a LAV definitional expansion of a goal node)

Parameters:
gn - Goal node to be expanded
rn - Rule that will be applied
See Also:
Inclusion Expansion

getRoot

public GoalNode getRoot()

showTree

public void showTree(Node start,
                     int indentLevel)

getSiblings

public java.util.Vector<Node> getSiblings(Node n)
Gets the siblings given a node

Parameters:
n -
Returns:

main

public static void main(java.lang.String[] args)
                 throws org.semanticweb.kaon2.api.KAON2Exception,
                        java.lang.InterruptedException
Throws:
org.semanticweb.kaon2.api.KAON2Exception
java.lang.InterruptedException

applySubToRule

private org.semanticweb.kaon2.api.rules.Rule applySubToRule(java.util.HashMap theta,
                                                            org.semanticweb.kaon2.api.rules.Rule r)

applySub

private org.semanticweb.kaon2.api.rules.Literal applySub(java.util.HashMap theta,
                                                         org.semanticweb.kaon2.api.rules.Literal l)

unify

private java.util.HashMap unify(org.semanticweb.kaon2.api.rules.Literal l1,
                                org.semanticweb.kaon2.api.rules.Literal l2)
Helper method for unifying two predicates

Parameters:
l1 -
l2 -
Returns:
theta

makeFresh

private org.semanticweb.kaon2.api.rules.Rule makeFresh(org.semanticweb.kaon2.api.rules.Rule r)
Helper method, makes all exisistential variables fresh variables existential variables are all non distingusiged variables

Parameters:
-
Returns:
fresh
See Also:
Fresh Variables

getExistentialVariables

private java.util.List<org.semanticweb.kaon2.api.rules.Variable> getExistentialVariables(org.semanticweb.kaon2.api.rules.Rule r)
Helper function

Parameters:
r -
Returns: