Protégé-OWL 3.4.8

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

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

public class DefaultSWRLRuleEngine
extends Object
implements SWRLRuleEngine

This class provides an implementation of some of the core functionality required by SWRL rule engine. Detailed documentation for this mechanism can be found here.


Constructor Summary
DefaultSWRLRuleEngine(OWLOntology activeOntology, OWLAxiomProcessor owlAxiomProcessor, TargetSWRLRuleEngine targetRuleEngine, SWRLRuleEngineBridgeController ruleEngineBridgeController, SWRLBuiltInBridgeController builtInBridgeController)
           
 
Method Summary
 void createSQWRLQuery(String queryName, String queryText)
          Create a SQWRL query.
 void deleteSQWRLQuery(String queryURI)
          Delete a SQWRL query.
 Set<OWLAxiomReference> getImportedOWLAxioms()
           
 Set<OWLClassReference> getImportedOWLClasses()
           
 Set<OWLNamedIndividualReference> getImportedOWLIndividuals()
           
 Set<SWRLRuleReference> getImportedSWRLRules()
           
 Set<OWLAxiomReference> getInferredOWLAxioms()
           
 Set<OWLAxiomReference> getInjectedOWLAxioms()
           
 Set<OWLClassReference> getInjectedOWLClasses()
           
 Set<OWLNamedIndividualReference> getInjectedOWLIndividuals()
           
 int getNumberOfImportedOWLAxioms()
           
 int getNumberOfImportedOWLClasses()
           
 int getNumberOfImportedOWLIndividuals()
           
 int getNumberOfImportedSWRLRules()
           
 int getNumberOfInferredOWLAxioms()
           
 int getNumberOfInferredOWLIndividuals()
           
 int getNumberOfInjectedOWLAxioms()
           
 int getNumberOfInjectedOWLClasses()
           
 int getNumberOfInjectedOWLIndividuals()
           
 OWLDataFactory getOWLDataFactory()
           
 OWLDataValueFactory getOWLDataValueFactory()
           
 Set<OWLNamedIndividualReference> getReclassifiedOWLIndividuals()
           
 Set<SWRLRuleReference> getSQWRLQueries()
          Get all the enabled SQWRL queries in the ontology.
 Set<String> getSQWRLQueryNames()
          Get the names of the SQWRL queries in the ontology.
 SQWRLResultImpl getSQWRLResult(String queryURI)
          Get the results of a previously executed SQWRL query.
 SQWRLResultImpl getSQWRLUnpreparedResult(String queryURI)
           
 SWRLRuleReference getSWRLRule(String ruleURI)
           
 String getTargetRuleEngineName()
          Returns the name of the underlying targer rule engine.
 String getTargetRuleEngineVersion()
           
 void importSQWRLQueryAndOWLKnowledge(String queryName)
          Load named query, all enabled rules, and all relevant knowledge from OWL into bridge.
 void importSWRLRulesAndOWLKnowledge()
          Load rules and 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.
 boolean isInjectedOWLAxiom(OWLAxiomReference axiom)
           
 boolean isInjectedOWLClass(String classURI)
           
 boolean isInjectedOWLIndividual(String individualURI)
           
 String name2URI(String prefixedName)
           
 void reset()
          Clear all knowledge from bridge.
 void run()
          Run the rule engine.
 void runSQWRLQueries()
          Run all SQWRL queries.
 SQWRLResult runSQWRLQuery(String queryName)
          Run a named SQWRL query.
 SQWRLResult runSQWRLQuery(String queryName, String queryText)
          Create and run a SQWRL query.
 SQWRLResult runStandaloneSQWRLQuery(String queryName)
          Run a named SQWRL query without executing any SWRL rules in ontology.
 String uri2PrefixedName(String uri)
           
 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
 

Constructor Detail

DefaultSWRLRuleEngine

public DefaultSWRLRuleEngine(OWLOntology activeOntology,
                             OWLAxiomProcessor owlAxiomProcessor,
                             TargetSWRLRuleEngine targetRuleEngine,
                             SWRLRuleEngineBridgeController ruleEngineBridgeController,
                             SWRLBuiltInBridgeController builtInBridgeController)
                      throws SWRLRuleEngineException
Throws:
SWRLRuleEngineException
Method Detail

importSWRLRulesAndOWLKnowledge

public void importSWRLRulesAndOWLKnowledge()
                                    throws SWRLRuleEngineException
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:
SWRLRuleEngineException

importSQWRLQueryAndOWLKnowledge

public void importSQWRLQueryAndOWLKnowledge(String queryName)
                                     throws SWRLRuleEngineException
Load named query, all enabled rules, and all relevant 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:
importSQWRLQueryAndOWLKnowledge in interface SWRLRuleEngine
Throws:
SWRLRuleEngineException

run

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

Specified by:
run in interface SWRLRuleEngine
Throws:
SWRLRuleEngineException

reset

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

Specified by:
reset in interface SWRLRuleEngine
Throws:
SWRLRuleEngineException

writeInferredKnowledge2OWL

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

Specified by:
writeInferredKnowledge2OWL in interface SWRLRuleEngine
Throws:
SWRLRuleEngineException

infer

public void infer()
           throws SWRLRuleEngineException
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:
SWRLRuleEngineException

runSQWRLQuery

public SQWRLResult runSQWRLQuery(String queryName,
                                 String queryText)
                          throws SQWRLException,
                                 SWRLParseException
Description copied from interface: SQWRLQueryEngine
Create and run a SQWRL query. Query will be created and added to ontology.

Specified by:
runSQWRLQuery in interface SQWRLQueryEngine
Throws:
SQWRLException
SWRLParseException

createSQWRLQuery

public void createSQWRLQuery(String queryName,
                             String queryText)
                      throws SQWRLException,
                             SWRLParseException
Description copied from interface: SQWRLQueryEngine
Create a SQWRL query.

Specified by:
createSQWRLQuery in interface SQWRLQueryEngine
Throws:
SQWRLException
SWRLParseException

runSQWRLQuery

public SQWRLResult runSQWRLQuery(String queryName)
                          throws SQWRLException
Run a named SQWRL query. SWRL rules will also be executed and any inferences produced by them will be available in the query.

Specified by:
runSQWRLQuery in interface SQWRLQueryEngine
Throws:
SQWRLException

runStandaloneSQWRLQuery

public SQWRLResult runStandaloneSQWRLQuery(String queryName)
                                    throws SQWRLException
Run a named SQWRL query without executing any SWRL rules in ontology.

Specified by:
runStandaloneSQWRLQuery in interface SQWRLQueryEngine
Throws:
SQWRLException

runSQWRLQueries

public void runSQWRLQueries()
                     throws SQWRLException
Run all SQWRL queries.

Specified by:
runSQWRLQueries in interface SQWRLQueryEngine
Throws:
SQWRLException

getSQWRLResult

public SQWRLResultImpl getSQWRLResult(String queryURI)
                               throws SQWRLException
Get the results of a previously executed SQWRL query.

Specified by:
getSQWRLResult in interface SQWRLQueryEngine
Throws:
SQWRLException

deleteSQWRLQuery

public void deleteSQWRLQuery(String queryURI)
                      throws SQWRLException
Description copied from interface: SQWRLQueryEngine
Delete a SQWRL query.

Specified by:
deleteSQWRLQuery in interface SQWRLQueryEngine
Throws:
SQWRLException

getSQWRLQueries

public Set<SWRLRuleReference> getSQWRLQueries()
                                       throws SQWRLException
Get all the enabled SQWRL queries in the ontology.

Specified by:
getSQWRLQueries in interface SQWRLQueryEngine
Throws:
SQWRLException

getSQWRLQueryNames

public Set<String> getSQWRLQueryNames()
                               throws SQWRLException
Get the names of the SQWRL queries in the ontology.

Specified by:
getSQWRLQueryNames in interface SQWRLQueryEngine
Throws:
SQWRLException

getSQWRLUnpreparedResult

public SQWRLResultImpl getSQWRLUnpreparedResult(String queryURI)
                                         throws SQWRLException
Throws:
SQWRLException

getSWRLRule

public SWRLRuleReference getSWRLRule(String ruleURI)
                              throws SWRLRuleEngineException
Throws:
SWRLRuleEngineException

getNumberOfImportedSWRLRules

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

getNumberOfImportedOWLClasses

public int getNumberOfImportedOWLClasses()
Specified by:
getNumberOfImportedOWLClasses in interface SWRLRuleEngine

getNumberOfImportedOWLIndividuals

public int getNumberOfImportedOWLIndividuals()
Specified by:
getNumberOfImportedOWLIndividuals in interface SWRLRuleEngine

getNumberOfImportedOWLAxioms

public int getNumberOfImportedOWLAxioms()
Specified by:
getNumberOfImportedOWLAxioms in interface SWRLRuleEngine

getNumberOfInferredOWLIndividuals

public int getNumberOfInferredOWLIndividuals()
Specified by:
getNumberOfInferredOWLIndividuals in interface SWRLRuleEngine

getNumberOfInferredOWLAxioms

public int getNumberOfInferredOWLAxioms()
Specified by:
getNumberOfInferredOWLAxioms in interface SWRLRuleEngine

getNumberOfInjectedOWLClasses

public int getNumberOfInjectedOWLClasses()
Specified by:
getNumberOfInjectedOWLClasses in interface SWRLRuleEngine

getNumberOfInjectedOWLIndividuals

public int getNumberOfInjectedOWLIndividuals()
Specified by:
getNumberOfInjectedOWLIndividuals in interface SWRLRuleEngine

getNumberOfInjectedOWLAxioms

public int getNumberOfInjectedOWLAxioms()
Specified by:
getNumberOfInjectedOWLAxioms in interface SWRLRuleEngine

isInjectedOWLClass

public boolean isInjectedOWLClass(String classURI)

isInjectedOWLIndividual

public boolean isInjectedOWLIndividual(String individualURI)

isInjectedOWLAxiom

public boolean isInjectedOWLAxiom(OWLAxiomReference axiom)

getImportedSWRLRules

public Set<SWRLRuleReference> getImportedSWRLRules()
Specified by:
getImportedSWRLRules in interface SWRLRuleEngine

getImportedOWLClasses

public Set<OWLClassReference> getImportedOWLClasses()
Specified by:
getImportedOWLClasses in interface SWRLRuleEngine

getImportedOWLIndividuals

public Set<OWLNamedIndividualReference> getImportedOWLIndividuals()
Specified by:
getImportedOWLIndividuals in interface SWRLRuleEngine

getImportedOWLAxioms

public Set<OWLAxiomReference> getImportedOWLAxioms()
Specified by:
getImportedOWLAxioms in interface SWRLRuleEngine

getReclassifiedOWLIndividuals

public Set<OWLNamedIndividualReference> getReclassifiedOWLIndividuals()
Specified by:
getReclassifiedOWLIndividuals in interface SWRLRuleEngine

getInferredOWLAxioms

public Set<OWLAxiomReference> getInferredOWLAxioms()
Specified by:
getInferredOWLAxioms in interface SWRLRuleEngine

getInjectedOWLAxioms

public Set<OWLAxiomReference> getInjectedOWLAxioms()
Specified by:
getInjectedOWLAxioms in interface SWRLRuleEngine

getInjectedOWLClasses

public Set<OWLClassReference> getInjectedOWLClasses()
Specified by:
getInjectedOWLClasses in interface SWRLRuleEngine

getInjectedOWLIndividuals

public Set<OWLNamedIndividualReference> getInjectedOWLIndividuals()
Specified by:
getInjectedOWLIndividuals in interface SWRLRuleEngine

uri2PrefixedName

public String uri2PrefixedName(String uri)
Specified by:
uri2PrefixedName in interface SQWRLQueryEngine
Specified by:
uri2PrefixedName in interface SWRLRuleEngine

name2URI

public String name2URI(String prefixedName)
Specified by:
name2URI in interface SQWRLQueryEngine
Specified by:
name2URI in interface SWRLRuleEngine

getOWLDataFactory

public OWLDataFactory getOWLDataFactory()

getOWLDataValueFactory

public OWLDataValueFactory getOWLDataValueFactory()
Specified by:
getOWLDataValueFactory in interface SWRLRuleEngine

getTargetRuleEngineName

public String getTargetRuleEngineName()
Description copied from interface: SQWRLQueryEngine
Returns the name of the underlying targer rule engine.

Specified by:
getTargetRuleEngineName in interface SQWRLQueryEngine
Specified by:
getTargetRuleEngineName in interface SWRLRuleEngine

getTargetRuleEngineVersion

public String getTargetRuleEngineVersion()
Specified by:
getTargetRuleEngineVersion in interface SWRLRuleEngine

Protégé-OWL 3.4.8

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