Protégé-OWL 3.3.1

edu.stanford.smi.protegex.owl.swrl.bridge
Class SWRLRuleEngineBridge

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

public abstract class SWRLRuleEngineBridge
extends Object
implements SWRLRuleEngine, Serializable

The SWRL Rule Engine Bridge provides a mechanism to incorporate rule engines into Protege-OWL to execute SWRL rules.

Detailed documentation for this class can be found here.

See Also:
Serialized Form

Field Summary
protected  OWLModel owlModel
           
 
Constructor Summary
protected SWRLRuleEngineBridge(OWLModel owlModel)
           
 
Method Summary
protected  void assertIndividual(IndividualInfo individualInfo)
          Assert an OWL individual from a rule engine.
protected  void assertProperty(PropertyInfo propertyInfo)
          Assert an OWL property from a rule engine.
 IndividualInfo createIndividual()
          Method used to create a bridge individual of type owl:Thing.
protected abstract  void defineClass(ClassInfo classInfo)
           
protected abstract  void defineIndividual(IndividualInfo individualInfo)
           
protected abstract  void defineProperty(PropertyInfo propertyInfo)
           
protected abstract  void defineRestriction(RestrictionInfo restrictionInfo)
           
protected abstract  void defineRule(RuleInfo ruleInfo)
           
 void exportOWLKnowledge()
          Send knowledge (excluding SWRL rules) stored in bridge to a rule engine.
 void exportSWRLRule(String ruleName)
           
 void exportSWRLRules()
           
 void exportSWRLRules(Set<String> ruleNames)
           
 void exportSWRLRulesAndOWLKnowledge()
          Send rules and knowledge stored in bridge to a rule engine.
protected abstract  void generateBuiltInBinding(String ruleName, String builtInName, int builtInIndex, List<Argument> arguments)
           
protected  Set<IndividualInfo> getAssertedIndividuals()
           
protected  Set<PropertyInfo> getAssertedProperties()
           
protected  Set<IndividualInfo> getCreatedIndividuals()
           
protected  Set<ClassInfo> getImportedClasses()
           
protected  Set<IndividualInfo> getImportedIndividuals()
           
protected  Set<PropertyInfo> getImportedProperties()
           
protected  Set<RestrictionInfo> getImportedRestrictions()
           
protected  Set<RuleInfo> getImportedSWRLRules()
           
 int getNumberOfAssertedIndividuals()
           
 int getNumberOfAssertedProperties()
           
 int getNumberOfCreatedIndividuals()
           
 int getNumberOfImportedClasses()
           
 int getNumberOfImportedIndividuals()
           
 int getNumberOfImportedProperties()
           
 int getNumberOfImportedRestrictions()
           
 int getNumberOfImportedSWRLRules()
           
 OWLModel getOWLModel()
          Get the OWL model associated with this bridge.
 Result getQueryResult(String ruleName)
          Get the results from a rule containing query built-ins.
 RuleInfo getRuleInfo(String ruleName)
           
 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.
protected abstract  void initializeRuleEngine()
           
protected  boolean invokeSWRLBuiltIn(String ruleName, String builtInName, int builtInIndex, List<Argument> arguments)
          Invoke a SWRL built-in from a rule engine.
 boolean isCreatedIndividual(String individualName)
           
 void resetBridge()
          Clear all knowledge from bridge.
 void resetRuleEngine()
          Clear all knowledge from rule engine, deleted asserted knowledge from the bridge, and leave imported bridge knowledge intact.
 void run()
          Run the rule engine.
abstract  void runRuleEngine()
           
 void writeAssertedIndividualsAndProperties2OWL()
          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
 

Field Detail

owlModel

protected OWLModel owlModel
Constructor Detail

SWRLRuleEngineBridge

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

defineRule

protected abstract void defineRule(RuleInfo ruleInfo)
                            throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

defineClass

protected abstract void defineClass(ClassInfo classInfo)
                             throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

defineProperty

protected abstract void defineProperty(PropertyInfo propertyInfo)
                                throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

defineIndividual

protected abstract void defineIndividual(IndividualInfo individualInfo)
                                  throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

defineRestriction

protected abstract void defineRestriction(RestrictionInfo restrictionInfo)
                                   throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

initializeRuleEngine

protected abstract void initializeRuleEngine()
                                      throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

generateBuiltInBinding

protected abstract void generateBuiltInBinding(String ruleName,
                                               String builtInName,
                                               int builtInIndex,
                                               List<Argument> arguments)
                                        throws BuiltInException
Throws:
BuiltInException

runRuleEngine

public abstract void runRuleEngine()
                            throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

infer

public void infer()
           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.

Specified by:
infer in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

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.

Specified by:
importSWRLRulesAndOWLKnowledge in interface SWRLRuleEngine
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.

Specified by:
importSWRLRulesAndOWLKnowledge in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

exportSWRLRulesAndOWLKnowledge

public void exportSWRLRulesAndOWLKnowledge()
                                    throws SWRLRuleEngineBridgeException
Send rules and knowledge stored in bridge to a rule engine.

Specified by:
exportSWRLRulesAndOWLKnowledge in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

exportOWLKnowledge

public void exportOWLKnowledge()
                        throws SWRLRuleEngineBridgeException
Send knowledge (excluding SWRL rules) stored in bridge to a rule engine.

Specified by:
exportOWLKnowledge in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

run

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

Specified by:
run in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

writeAssertedIndividualsAndProperties2OWL

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

Specified by:
writeAssertedIndividualsAndProperties2OWL in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

resetBridge

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

Throws:
SWRLRuleEngineBridgeException

resetRuleEngine

public void resetRuleEngine()
                     throws SWRLRuleEngineBridgeException
Clear all knowledge from rule engine, deleted asserted knowledge from the bridge, and leave imported bridge knowledge intact.

Specified by:
resetRuleEngine in interface SWRLRuleEngine
Throws:
SWRLRuleEngineBridgeException

getQueryResult

public Result getQueryResult(String ruleName)
                      throws ResultException
Get the results from a rule containing query built-ins. Null is retured if there are no results or if the query subsystem is not activated.

Specified by:
getQueryResult in interface SWRLRuleEngine
Throws:
ResultException

getOWLModel

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


getNumberOfImportedSWRLRules

public int getNumberOfImportedSWRLRules()

getNumberOfImportedClasses

public int getNumberOfImportedClasses()

getNumberOfImportedIndividuals

public int getNumberOfImportedIndividuals()

getNumberOfImportedProperties

public int getNumberOfImportedProperties()

getNumberOfImportedRestrictions

public int getNumberOfImportedRestrictions()

getNumberOfAssertedIndividuals

public int getNumberOfAssertedIndividuals()

getNumberOfAssertedProperties

public int getNumberOfAssertedProperties()

getNumberOfCreatedIndividuals

public int getNumberOfCreatedIndividuals()

isCreatedIndividual

public boolean isCreatedIndividual(String individualName)

getImportedSWRLRules

protected Set<RuleInfo> getImportedSWRLRules()

getImportedClasses

protected Set<ClassInfo> getImportedClasses()

getImportedIndividuals

protected Set<IndividualInfo> getImportedIndividuals()

getImportedProperties

protected Set<PropertyInfo> getImportedProperties()

getImportedRestrictions

protected Set<RestrictionInfo> getImportedRestrictions()

getAssertedIndividuals

protected Set<IndividualInfo> getAssertedIndividuals()

getAssertedProperties

protected Set<PropertyInfo> getAssertedProperties()

getCreatedIndividuals

protected Set<IndividualInfo> getCreatedIndividuals()

assertProperty

protected void assertProperty(PropertyInfo propertyInfo)
                       throws SWRLRuleEngineBridgeException
Assert an OWL property from a rule engine.

Throws:
SWRLRuleEngineBridgeException

assertIndividual

protected void assertIndividual(IndividualInfo individualInfo)
                         throws SWRLRuleEngineBridgeException
Assert an OWL individual from a rule engine.

Throws:
SWRLRuleEngineBridgeException

invokeSWRLBuiltIn

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

See here for documentaton.

Throws:
BuiltInException

createIndividual

public IndividualInfo createIndividual()
                                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 created at this point - instead an info 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 created for it.

Throws:
SWRLRuleEngineBridgeException

exportSWRLRules

public void exportSWRLRules()
                     throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

exportSWRLRules

public void exportSWRLRules(Set<String> ruleNames)
                     throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

exportSWRLRule

public void exportSWRLRule(String ruleName)
                    throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

getRuleInfo

public RuleInfo getRuleInfo(String ruleName)
                     throws SWRLRuleEngineBridgeException
Throws:
SWRLRuleEngineBridgeException

Protégé-OWL 3.3.1

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