Protégé-OWL 3.4.1

edu.stanford.smi.protegex.owl.swrl.bridge.impl
Class AbstractSWRLRuleEngineBridge

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngineBridge
All Implemented Interfaces:
SWRLRuleEngineBridge, SQWRLQueryEngine, SWRLRuleEngine

public abstract class AbstractSWRLRuleEngineBridge
extends Object
implements SWRLRuleEngineBridge

This class provides an implementation of some of the core functionality required by a SWRL rule engine bridge. Implementations for a target rule engine should subclass this class. Detailed documentation for this process can be found here.


Field Summary
protected  OWLModel owlModel
           
 
Constructor Summary
protected AbstractSWRLRuleEngineBridge(OWLModel owlModel)
           
 
Method Summary
 OWLClass createOWLAnonymousClass()
           
 void createOWLAxiom(OWLAxiom axiom)
           
 void createOWLClass(String className)
           
 void createOWLClass(String className, String superclassName)
           
 OWLClassAssertionAxiom createOWLClassAssertionAxiom(OWLIndividual individual, OWLClass description)
           
 void createOWLClassPropertyAssertionAxiom(OWLIndividual subject, OWLProperty property, OWLClass object)
           
 OWLDatatypePropertyAssertionAxiom createOWLDatatypePropertyAssertionAxiom(OWLDatatypePropertyAssertionAxiom axiom)
           
 OWLDatatypePropertyAssertionAxiom createOWLDatatypePropertyAssertionAxiom(OWLIndividual subject, OWLProperty property, OWLDatatypeValue object)
           
 void createOWLDatatypePropertyAssertionAxioms(Set<OWLDatatypePropertyAssertionAxiom> axioms)
           
 OWLIndividual createOWLIndividual()
          Method used to create a bridge individual of type owl:Thing.
 OWLIndividual createOWLIndividual(OWLClass owlClass)
           
 void createOWLIndividual(OWLIndividual owlIndividual)
           
 void createOWLIndividuals(Set<OWLIndividual> individuals)
           
 OWLObjectPropertyAssertionAxiom createOWLObjectPropertyAssertionAxiom(OWLIndividual subject, OWLProperty property, OWLIndividual object)
           
 OWLObjectPropertyAssertionAxiom createOWLObjectPropertyAssertionAxiom(OWLObjectPropertyAssertionAxiom axiom)
           
 void createOWLObjectPropertyAssertionAxioms(Set<OWLObjectPropertyAssertionAxiom> axioms)
           
 void createOWLSubClassAxiom(OWLClass subClass, OWLClass superClass)
           
 Set<OWLAxiom> getImportedAxioms()
           
 Set<OWLClass> getImportedClasses()
           
 Set<OWLIndividual> getImportedIndividuals()
           
 Set<SWRLRule> getImportedSWRLRules()
           
 Set<OWLAxiom> getInferredAxioms()
           
 Set<OWLIndividual> getInferredIndividuals()
           
 Set<OWLClass> getInjectedAnonymousClasses()
           
 Set<OWLAxiom> getInjectedAxioms()
           
 Set<OWLClass> getInjectedClasses()
           
 Set<OWLIndividual> getInjectedIndividuals()
           
 Mapper getMapper()
           
 int getNumberOfImportedAxioms()
           
 int getNumberOfImportedClasses()
           
 int getNumberOfImportedIndividuals()
           
 int getNumberOfImportedSWRLRules()
           
 int getNumberOfInferredAxioms()
           
 int getNumberOfInferredIndividuals()
           
 int getNumberOfInjectedAxioms()
           
 int getNumberOfInjectedClasses()
           
 int getNumberOfInjectedIndividuals()
           
 OWLModel getOWLModel()
          Get the OWL model associated with this bridge.
 SWRLRule getRule(String ruleName)
           
 SQWRLResult getSQWRLResult(String queryName)
          Get the results from a SQWRL query.
 boolean hasMapper()
           
 void importSWRLRulesAndOWLKnowledge()
          Load rules and knowledge from OWL into bridge.
 void importSWRLRulesAndOWLKnowledge(Set<String> ruleGroupNames)
          Load rules from all the named rule groups and associated knowledge from OWL into bridge.
 void importSWRLRulesAndOWLKnowledge(String ruleGroupName)
          Load rules from a particular rule group and associated knowledge from OWL into bridge.
 void infer()
          Load rules and knowledge from OWL into bridge, send them to a rule engine, run the rule engine, and write any inferred knowledge back to OWL.
 void infer(Set<String> ruleGroupNames)
          Load rules and knowledge from OWL into bridge, send them to a rule engine, run the rule engine, and write any inferred knowledge back to OWL.
 void infer(String ruleGroupName)
           
 void inferIndividual(OWLIndividual owlIndividual)
          Assert an OWL individual from a rule engine
 void inferPropertyAssertionAxiom(OWLPropertyAssertionAxiom owlPropertyAssertionAxiom)
          Infer an OWL property assertion axiom from a rule engine
 boolean invokeSWRLBuiltIn(String ruleName, String builtInName, int builtInIndex, boolean isInConsequent, List<BuiltInArgument> arguments)
          Invoke a SWRL built-in from a rule engine.
 boolean isClass(String className)
           
 boolean isIndividual(String individualName)
           
 boolean isInjectedAnonymousClass(String className)
           
 boolean isInjectedAxiom(OWLAxiom axiom)
           
 boolean isInjectedClass(String className)
           
 boolean isInjectedIndividual(String individualName)
           
 boolean isProperty(String propertyName)
           
 void reset()
          Clear all knowledge from bridge.
 void run()
          Run the rule engine.
 void runSQWRLQueries()
          Run all the SWRL rules and SQWRL queries in an ontology.
 void setMapper(Mapper mapper)
           
 void writeInferredKnowledge2OWL()
          Write knowledge inferred by rule engine back to OWL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.stanford.smi.protegex.owl.swrl.bridge.SWRLRuleEngineBridge
defineAxiom, defineClass, defineIndividual, defineRestriction, defineRule, generateBuiltInBinding, resetRuleEngine, runRuleEngine
 

Field Detail

owlModel

protected OWLModel owlModel
Constructor Detail

AbstractSWRLRuleEngineBridge

protected AbstractSWRLRuleEngineBridge(OWLModel owlModel)
                                throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException
Method Detail

importSWRLRulesAndOWLKnowledge

public void importSWRLRulesAndOWLKnowledge()
                                    throws SWRLRuleEngineBridgeException
Load rules and knowledge from OWL into bridge. All existing bridge rules and knowledge will first be cleared and the associated rule engine will be reset.

Specified by:
importSWRLRulesAndOWLKnowledge in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

importSWRLRulesAndOWLKnowledge

public void importSWRLRulesAndOWLKnowledge(String ruleGroupName)
                                    throws SWRLRuleEngineBridgeException
Load rules from a particular rule group and associated knowledge from OWL into bridge. All existing bridge rules and knowledge will first be cleared and the associated rule engine will be reset.

Throws:
SWRLRuleEngineBridgeException

importSWRLRulesAndOWLKnowledge

public void importSWRLRulesAndOWLKnowledge(Set<String> ruleGroupNames)
                                    throws SWRLRuleEngineBridgeException
Load rules from all the named rule groups and associated knowledge from OWL into bridge. All existing bridge rules and knowledge will first be cleared and the associated rule engine will be reset.

Throws:
SWRLRuleEngineBridgeException

run

public void run()
         throws SWRLRuleEngineBridgeException
Run the rule engine.

Specified by:
run in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

writeInferredKnowledge2OWL

public void writeInferredKnowledge2OWL()
                                throws SWRLRuleEngineBridgeException
Write knowledge inferred by rule engine back to OWL.

Specified by:
writeInferredKnowledge2OWL in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

reset

public void reset()
           throws SWRLRuleEngineBridgeException
Clear all knowledge from bridge.

Specified by:
reset in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

infer

public void infer(Set<String> ruleGroupNames)
           throws SWRLRuleEngineBridgeException
Load rules and knowledge from OWL into bridge, send them to a rule engine, run the rule engine, and write any inferred knowledge back to OWL.

Throws:
SWRLRuleEngineBridgeException

infer

public void infer(String ruleGroupName)
           throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

infer

public void infer()
           throws SWRLRuleEngineBridgeException
Description copied from interface: SWRLRuleEngine
Load rules and knowledge from OWL into bridge, send them to a rule engine, run the rule engine, and write any inferred knowledge back to OWL.

Specified by:
infer in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

runSQWRLQueries

public void runSQWRLQueries()
                     throws SQWRLException
Description copied from interface: SQWRLQueryEngine
Run all the SWRL rules and SQWRL queries in an ontology.

Specified by:
runSQWRLQueries in interface SQWRLQueryEngine
Throws:
SQWRLException

getSQWRLResult

public SQWRLResult getSQWRLResult(String queryName)
                           throws SQWRLException
Get the results from a SQWRL query.

Specified by:
getSQWRLResult in interface SQWRLQueryEngine
Throws:
SQWRLException

getRule

public SWRLRule getRule(String ruleName)
                 throws InvalidRuleNameException
Specified by:
getRule in interface SWRLRuleEngine
Throws:
InvalidRuleNameException

getOWLModel

public OWLModel getOWLModel()
Get the OWL model associated with this bridge.

Specified by:
getOWLModel in interface SWRLRuleEngineBridge

getNumberOfImportedSWRLRules

public int getNumberOfImportedSWRLRules()
Specified by:
getNumberOfImportedSWRLRules in interface SWRLRuleEngineBridge

getNumberOfImportedClasses

public int getNumberOfImportedClasses()
Specified by:
getNumberOfImportedClasses in interface SWRLRuleEngineBridge

getNumberOfImportedIndividuals

public int getNumberOfImportedIndividuals()
Specified by:
getNumberOfImportedIndividuals in interface SWRLRuleEngineBridge

getNumberOfImportedAxioms

public int getNumberOfImportedAxioms()
Specified by:
getNumberOfImportedAxioms in interface SWRLRuleEngineBridge
Specified by:
getNumberOfImportedAxioms in interface SWRLRuleEngine

getNumberOfInferredIndividuals

public int getNumberOfInferredIndividuals()
Specified by:
getNumberOfInferredIndividuals in interface SWRLRuleEngineBridge

getNumberOfInferredAxioms

public int getNumberOfInferredAxioms()
Specified by:
getNumberOfInferredAxioms in interface SWRLRuleEngineBridge
Specified by:
getNumberOfInferredAxioms in interface SWRLRuleEngine

getNumberOfInjectedClasses

public int getNumberOfInjectedClasses()
Specified by:
getNumberOfInjectedClasses in interface SWRLRuleEngineBridge

getNumberOfInjectedIndividuals

public int getNumberOfInjectedIndividuals()
Specified by:
getNumberOfInjectedIndividuals in interface SWRLRuleEngineBridge

getNumberOfInjectedAxioms

public int getNumberOfInjectedAxioms()
Specified by:
getNumberOfInjectedAxioms in interface SWRLRuleEngineBridge
Specified by:
getNumberOfInjectedAxioms in interface SWRLRuleEngine

isClass

public boolean isClass(String className)
Specified by:
isClass in interface SWRLRuleEngineBridge

isProperty

public boolean isProperty(String propertyName)

isIndividual

public boolean isIndividual(String individualName)

isInjectedClass

public boolean isInjectedClass(String className)
Specified by:
isInjectedClass in interface SWRLRuleEngineBridge

isInjectedAnonymousClass

public boolean isInjectedAnonymousClass(String className)
Specified by:
isInjectedAnonymousClass in interface SWRLRuleEngineBridge

isInjectedIndividual

public boolean isInjectedIndividual(String individualName)
Specified by:
isInjectedIndividual in interface SWRLRuleEngineBridge

isInjectedAxiom

public boolean isInjectedAxiom(OWLAxiom axiom)
Specified by:
isInjectedAxiom in interface SWRLRuleEngineBridge

getImportedSWRLRules

public Set<SWRLRule> getImportedSWRLRules()
Specified by:
getImportedSWRLRules in interface SWRLRuleEngineBridge

getImportedClasses

public Set<OWLClass> getImportedClasses()
Specified by:
getImportedClasses in interface SWRLRuleEngineBridge

getImportedIndividuals

public Set<OWLIndividual> getImportedIndividuals()
Specified by:
getImportedIndividuals in interface SWRLRuleEngineBridge

getImportedAxioms

public Set<OWLAxiom> getImportedAxioms()
Specified by:
getImportedAxioms in interface SWRLRuleEngineBridge
Specified by:
getImportedAxioms in interface SWRLRuleEngine

getInferredIndividuals

public Set<OWLIndividual> getInferredIndividuals()
Specified by:
getInferredIndividuals in interface SWRLRuleEngineBridge

getInferredAxioms

public Set<OWLAxiom> getInferredAxioms()
Specified by:
getInferredAxioms in interface SWRLRuleEngineBridge
Specified by:
getInferredAxioms in interface SWRLRuleEngine

getInjectedClasses

public Set<OWLClass> getInjectedClasses()
Specified by:
getInjectedClasses in interface SWRLRuleEngineBridge

getInjectedAnonymousClasses

public Set<OWLClass> getInjectedAnonymousClasses()

getInjectedIndividuals

public Set<OWLIndividual> getInjectedIndividuals()
Specified by:
getInjectedIndividuals in interface SWRLRuleEngineBridge

getInjectedAxioms

public Set<OWLAxiom> getInjectedAxioms()
Specified by:
getInjectedAxioms in interface SWRLRuleEngineBridge
Specified by:
getInjectedAxioms in interface SWRLRuleEngine

inferPropertyAssertionAxiom

public void inferPropertyAssertionAxiom(OWLPropertyAssertionAxiom owlPropertyAssertionAxiom)
                                 throws SWRLRuleEngineBridgeException
Infer an OWL property assertion axiom from a rule engine

Specified by:
inferPropertyAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

inferIndividual

public void inferIndividual(OWLIndividual owlIndividual)
                     throws SWRLRuleEngineBridgeException
Assert an OWL individual from a rule engine

Specified by:
inferIndividual in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

invokeSWRLBuiltIn

public boolean invokeSWRLBuiltIn(String ruleName,
                                 String builtInName,
                                 int builtInIndex,
                                 boolean isInConsequent,
                                 List<BuiltInArgument> arguments)
                          throws BuiltInException
Invoke a SWRL built-in from a rule engine.

See here for documentaton.

Specified by:
invokeSWRLBuiltIn in interface SWRLRuleEngineBridge
Throws:
BuiltInException

setMapper

public void setMapper(Mapper mapper)
Specified by:
setMapper in interface SWRLRuleEngineBridge

hasMapper

public boolean hasMapper()
Specified by:
hasMapper in interface SWRLRuleEngineBridge

getMapper

public Mapper getMapper()
Specified by:
getMapper in interface SWRLRuleEngineBridge

createOWLAnonymousClass

public OWLClass createOWLAnonymousClass()
                                 throws SWRLRuleEngineBridgeException
Specified by:
createOWLAnonymousClass in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLClass

public void createOWLClass(String className)
                    throws SWRLRuleEngineBridgeException
Specified by:
createOWLClass in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLClass

public void createOWLClass(String className,
                           String superclassName)
                    throws SWRLRuleEngineBridgeException
Specified by:
createOWLClass in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLIndividual

public OWLIndividual createOWLIndividual()
                                  throws SWRLRuleEngineBridgeException
Method used to create a bridge individual of type owl:Thing. This method will typically be invoked from within a built-in. An OWL individual is not injected at this point - instead an object is generated for the individual in the bridge and the individual is exported to the rule engine. The individual is given a unique name that can be used later if an OWL individual is injected for it.

Specified by:
createOWLIndividual in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLIndividual

public void createOWLIndividual(OWLIndividual owlIndividual)
                         throws SWRLRuleEngineBridgeException
Specified by:
createOWLIndividual in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLIndividual

public OWLIndividual createOWLIndividual(OWLClass owlClass)
                                  throws SWRLRuleEngineBridgeException
Specified by:
createOWLIndividual in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLIndividuals

public void createOWLIndividuals(Set<OWLIndividual> individuals)
                          throws SWRLRuleEngineBridgeException
Specified by:
createOWLIndividuals in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLDatatypePropertyAssertionAxiom

public OWLDatatypePropertyAssertionAxiom createOWLDatatypePropertyAssertionAxiom(OWLIndividual subject,
                                                                                 OWLProperty property,
                                                                                 OWLDatatypeValue object)
                                                                          throws SWRLRuleEngineBridgeException
Specified by:
createOWLDatatypePropertyAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLDatatypePropertyAssertionAxiom

public OWLDatatypePropertyAssertionAxiom createOWLDatatypePropertyAssertionAxiom(OWLDatatypePropertyAssertionAxiom axiom)
                                                                          throws SWRLRuleEngineBridgeException
Specified by:
createOWLDatatypePropertyAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLDatatypePropertyAssertionAxioms

public void createOWLDatatypePropertyAssertionAxioms(Set<OWLDatatypePropertyAssertionAxiom> axioms)
                                              throws SWRLRuleEngineBridgeException
Specified by:
createOWLDatatypePropertyAssertionAxioms in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLObjectPropertyAssertionAxiom

public OWLObjectPropertyAssertionAxiom createOWLObjectPropertyAssertionAxiom(OWLIndividual subject,
                                                                             OWLProperty property,
                                                                             OWLIndividual object)
                                                                      throws SWRLRuleEngineBridgeException
Specified by:
createOWLObjectPropertyAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLClassAssertionAxiom

public OWLClassAssertionAxiom createOWLClassAssertionAxiom(OWLIndividual individual,
                                                           OWLClass description)
                                                    throws SWRLRuleEngineBridgeException
Specified by:
createOWLClassAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLClassPropertyAssertionAxiom

public void createOWLClassPropertyAssertionAxiom(OWLIndividual subject,
                                                 OWLProperty property,
                                                 OWLClass object)
                                          throws SWRLRuleEngineBridgeException
Specified by:
createOWLClassPropertyAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLSubClassAxiom

public void createOWLSubClassAxiom(OWLClass subClass,
                                   OWLClass superClass)
                            throws SWRLRuleEngineBridgeException
Specified by:
createOWLSubClassAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLObjectPropertyAssertionAxiom

public OWLObjectPropertyAssertionAxiom createOWLObjectPropertyAssertionAxiom(OWLObjectPropertyAssertionAxiom axiom)
                                                                      throws SWRLRuleEngineBridgeException
Specified by:
createOWLObjectPropertyAssertionAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLAxiom

public void createOWLAxiom(OWLAxiom axiom)
                    throws SWRLRuleEngineBridgeException
Specified by:
createOWLAxiom in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

createOWLObjectPropertyAssertionAxioms

public void createOWLObjectPropertyAssertionAxioms(Set<OWLObjectPropertyAssertionAxiom> axioms)
                                            throws SWRLRuleEngineBridgeException
Specified by:
createOWLObjectPropertyAssertionAxioms in interface SWRLRuleEngineBridge
Throws:
SWRLRuleEngineBridgeException

Protégé-OWL 3.4.1

Submit a bug report or feature request
Copyright (c) 1998-2009 Stanford University.