edu.lehigh.swat.obione
Class Reformulator

java.lang.Object
  extended by edu.lehigh.swat.obione.KAON2AbstractConnection
      extended by edu.lehigh.swat.obione.Reformulator

public class Reformulator
extends KAON2AbstractConnection

Uses extended PDMS to reformulate a query

Author:
abirqasem

Field Summary
private  int counter
           
private  LAVProcessor lp
           
private  MapKB mapKB
           
private  RGT rgt
           
private  java.util.ArrayList<org.semanticweb.kaon2.api.rules.Variable> varList
           
 
Fields inherited from class edu.lehigh.swat.obione.KAON2AbstractConnection
m_connection
 
Constructor Summary
Reformulator(MapKB mapKB)
          Intializes the Reformulator's Knoweledgebase with the Map Knowledgebase read in from the Source Processor
 
Method Summary
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)
           
 void buildTree(OBI1Query q)
          Builds the rule goal tree
(package private)  void expand(GoalNode n, java.lang.String ont)
          Recursively expands a goal node to populate the rule goal tree
private  java.util.HashSet<org.semanticweb.kaon2.api.owl.elements.DataProperty> getAllSubDataProps(org.semanticweb.kaon2.api.Ontology ont, org.semanticweb.kaon2.api.owl.elements.DataProperty dp)
          Utility to get all the sub data properties
private  java.util.HashSet<org.semanticweb.kaon2.api.owl.elements.Description> getAllSubDescriptions(org.semanticweb.kaon2.api.Ontology ont, org.semanticweb.kaon2.api.owl.elements.OWLClass oc)
          Utility to get all the sub class
private  java.util.HashSet<org.semanticweb.kaon2.api.owl.elements.ObjectProperty> getAllSubObjectProps(org.semanticweb.kaon2.api.Ontology ont, org.semanticweb.kaon2.api.owl.elements.ObjectProperty dp)
          Utility to get all the sub object property
private  java.util.List<org.semanticweb.kaon2.api.rules.Variable> getExistentialVariables(org.semanticweb.kaon2.api.rules.Rule r)
          Helper function
 java.util.Vector<org.semanticweb.kaon2.api.rules.Predicate> getSubPreds(MapAtom ma)
          implementaion of subPreds
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
 boolean match(MapAtom atom1, java.util.Vector<org.semanticweb.kaon2.api.rules.Predicate> goalNodeSubPreds, MapAtom atom2, java.util.HashMap subst)
          A modified unify that considers taxonomic reasoning instead of a single atom it attempts to match all the sub predicates Returns true with the substitution if the match is found
private  void performGAVExpansion(GoalNode n, GAVMapView gmv)
          GAV definitional expansion of a goal node
private  void performLAVExpansion(GoalNode n, LAVMapView lmv)
          Performs a LAV definitional expansion of a goal node
private  void showSubst(java.util.HashMap subst)
          Utitility to show the value of a substitution
 void showTree()
          Utility to show the current RGT
 
Methods inherited from class edu.lehigh.swat.obione.KAON2AbstractConnection
createOntology, endConnection, loadOntology, makeConnection, showOntologyAxioms, showOntologyEntities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rgt

private RGT rgt

mapKB

private MapKB mapKB

lp

private LAVProcessor lp

counter

private int counter

varList

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

Reformulator

public Reformulator(MapKB mapKB)
Intializes the Reformulator's Knoweledgebase with the Map Knowledgebase read in from the Source Processor

Method Detail

match

public boolean match(MapAtom atom1,
                     java.util.Vector<org.semanticweb.kaon2.api.rules.Predicate> goalNodeSubPreds,
                     MapAtom atom2,
                     java.util.HashMap subst)
A modified unify that considers taxonomic reasoning instead of a single atom it attempts to match all the sub predicates Returns true with the substitution if the match is found

Parameters:
atom1 -
goalNodeSubPreds -
atom2 -
subst -
Returns:

getSubPreds

public java.util.Vector<org.semanticweb.kaon2.api.rules.Predicate> getSubPreds(MapAtom ma)
implementaion of subPreds

Parameters:
ma -
Returns:

expand

void expand(GoalNode n,
            java.lang.String ont)
Recursively expands a goal node to populate the rule goal tree

Parameters:
n -

buildTree

public void buildTree(OBI1Query q)
Builds the rule goal tree


showTree

public void showTree()
Utility to show the current RGT


main

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

performLAVExpansion

private void performLAVExpansion(GoalNode n,
                                 LAVMapView lmv)
Performs a LAV definitional expansion of a goal node

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

performGAVExpansion

private void performGAVExpansion(GoalNode n,
                                 GAVMapView gmv)
GAV definitional expansion of a goal node

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

getAllSubDescriptions

private java.util.HashSet<org.semanticweb.kaon2.api.owl.elements.Description> getAllSubDescriptions(org.semanticweb.kaon2.api.Ontology ont,
                                                                                                    org.semanticweb.kaon2.api.owl.elements.OWLClass oc)
                                                                                             throws org.semanticweb.kaon2.api.KAON2Exception
Utility to get all the sub class

Parameters:
ont -
oc -
Returns:
Throws:
org.semanticweb.kaon2.api.KAON2Exception

getAllSubObjectProps

private java.util.HashSet<org.semanticweb.kaon2.api.owl.elements.ObjectProperty> getAllSubObjectProps(org.semanticweb.kaon2.api.Ontology ont,
                                                                                                      org.semanticweb.kaon2.api.owl.elements.ObjectProperty dp)
                                                                                               throws org.semanticweb.kaon2.api.KAON2Exception
Utility to get all the sub object property

Parameters:
ont -
dp -
Returns:
Throws:
org.semanticweb.kaon2.api.KAON2Exception

getAllSubDataProps

private java.util.HashSet<org.semanticweb.kaon2.api.owl.elements.DataProperty> getAllSubDataProps(org.semanticweb.kaon2.api.Ontology ont,
                                                                                                  org.semanticweb.kaon2.api.owl.elements.DataProperty dp)
                                                                                           throws org.semanticweb.kaon2.api.KAON2Exception
Utility to get all the sub data properties

Parameters:
ont -
dp -
Returns:
Throws:
org.semanticweb.kaon2.api.KAON2Exception

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)

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:

showSubst

private void showSubst(java.util.HashMap subst)
Utitility to show the value of a substitution

Parameters:
subst -