Package org.swrlapi.core
Interface SWRLRuleEngine
-
- All Known Subinterfaces:
SQWRLQueryEngine
public interface SWRLRuleEngine
This interface defines methods that must be provided by a SWRL rule engine in the SWRLAPI.A native rule engine implementation must also implement the
TargetSWRLRuleEngine
interface.- See Also:
SWRLAPIRule
,TargetSWRLRuleEngine
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull SWRLAutoCompleter
createSWRLAutoCompleter()
@NonNull SWRLParser
createSWRLParser()
@NonNull SWRLAPIRule
createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule)
Create a SWRL rule@NonNull SWRLAPIRule
createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule, @NonNull java.lang.String comment, boolean isActive)
Create a SWRL rule and associate a comment and active state with it.@NonNull SWRLRuleRenderer
createSWRLRuleRenderer()
void
deleteSWRLRule(@NonNull java.lang.String ruleName)
void
exportInferredOWLAxioms()
Write OWL axioms inferred by rule engine back to the source OWL ontology.@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom>
getAssertedOWLAxioms()
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom>
getInferredOWLAxioms()
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom>
getInjectedOWLAxioms()
int
getNumberOfAssertedOWLAxioms()
int
getNumberOfAssertedOWLClassDeclarationAxioms()
int
getNumberOfAssertedOWLDataPropertyDeclarationAxioms()
int
getNumberOfAssertedOWLIndividualDeclarationsAxioms()
int
getNumberOfAssertedOWLObjectPropertyDeclarationAxioms()
int
getNumberOfImportedSWRLRules()
int
getNumberOfInferredOWLAxioms()
int
getNumberOfInjectedOWLAxioms()
@NonNull OWL2RLEngine
getOWL2RLEngine()
Get the underlying OWL 2 RL reasoner used by the rule and query engine@NonNull org.semanticweb.owlapi.model.OWLOntology
getOWLOntology()
@NonNull org.semanticweb.owlapi.reasoner.OWLReasoner
getOWLReasoner()
A rule engine must also define anOWLReasoner
.@NonNull javax.swing.Icon
getRuleEngineIcon()
@NonNull java.lang.String
getRuleEngineName()
Get the name of this SWRL rule engine.@NonNull java.lang.String
getRuleEngineVersion()
Get the version of the native rule engine implementing this SWRL rule engine@NonNull SWRLAPIOWLOntology
getSWRLAPIOWLOntology()
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.IRI>
getSWRLBuiltInIRIs()
java.util.Optional<@NonNull SWRLAPIRule>
getSWRLRule(@NonNull java.lang.String ruleName)
@NonNull java.util.Set<@NonNull SWRLAPIRule>
getSWRLRules()
void
importAssertedOWLAxioms()
Load asserted OWL axioms (which include SWRL rules) from a source OWL ontology.void
infer()
Load rules and knowledge from OWL, send them to the rule engine, run the rule engine, and write any inferred knowledge back to OWL.boolean
isSWRLBuiltIn(@NonNull java.lang.String shortName)
boolean
isSWRLBuiltInIRI(@NonNull org.semanticweb.owlapi.model.IRI iri)
void
loadExternalSWRLBuiltInLibraries(@NonNull java.io.File swrlBuiltInLibraryDirectory)
Load user-defined SWRL built-in libraries See here for documentation on defining these libraries.void
replaceSWRLRule(@NonNull java.lang.String originalRuleName, @NonNull java.lang.String ruleName, @NonNull java.lang.String rule, @NonNull java.lang.String comment, boolean isActive)
void
run()
Run the rule engine.
-
-
-
Method Detail
-
infer
void infer() throws SWRLRuleEngineException
Load rules and knowledge from OWL, send them to the rule engine, run the rule engine, and write any inferred knowledge back to OWL.- Throws:
SWRLRuleEngineException
- If an error occurs during inference
-
importAssertedOWLAxioms
void importAssertedOWLAxioms() throws SWRLRuleEngineException
Load asserted OWL axioms (which include SWRL rules) from a source OWL ontology.- Throws:
SWRLRuleEngineException
- If an error occurs during inference
-
run
void run() throws SWRLRuleEngineException
Run the rule engine.- Throws:
SWRLRuleEngineException
- If an error occurs during inference
-
exportInferredOWLAxioms
void exportInferredOWLAxioms() throws SWRLRuleEngineException
Write OWL axioms inferred by rule engine back to the source OWL ontology.- Throws:
SWRLRuleEngineException
- If an error occurs during the export process
-
createSWRLRule
@NonNull SWRLAPIRule createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule) throws SWRLParseException, SWRLBuiltInException
Create a SWRL rule- Parameters:
ruleName
- The name of the rulerule
- The rule text- Returns:
- A SWRL rule
- Throws:
SWRLParseException
- If an error occurs during parsingSWRLBuiltInException
-
createSWRLRule
@NonNull SWRLAPIRule createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule, @NonNull java.lang.String comment, boolean isActive) throws SWRLParseException, SWRLBuiltInException
Create a SWRL rule and associate a comment and active state with it.- Parameters:
ruleName
- The name of the rulerule
- The rule textcomment
- A comment associated with the ruleisActive
- Is the rule active- Returns:
- A SWRL rule
- Throws:
SWRLParseException
- If an error occurs during parsingSWRLBuiltInException
-
replaceSWRLRule
void replaceSWRLRule(@NonNull java.lang.String originalRuleName, @NonNull java.lang.String ruleName, @NonNull java.lang.String rule, @NonNull java.lang.String comment, boolean isActive) throws SWRLParseException, SWRLBuiltInException
- Parameters:
originalRuleName
- The original name of the ruleruleName
- The new name of the rulerule
- The rule textcomment
- A comment associated with the ruleisActive
- Is the rule active- Throws:
SWRLParseException
- If a parse error occursSWRLBuiltInException
- If an error occurs during processing
-
getSWRLRules
@NonNull java.util.Set<@NonNull SWRLAPIRule> getSWRLRules()
- Returns:
- A collection of SWRL rules
-
getSWRLRule
java.util.Optional<@NonNull SWRLAPIRule> getSWRLRule(@NonNull java.lang.String ruleName) throws SWRLRuleException
- Parameters:
ruleName
- The name of the rule- Returns:
- A SWRL rule
- Throws:
SWRLRuleException
- If an error occurs
-
deleteSWRLRule
void deleteSWRLRule(@NonNull java.lang.String ruleName)
- Parameters:
ruleName
- The name of a rule
-
isSWRLBuiltInIRI
boolean isSWRLBuiltInIRI(@NonNull org.semanticweb.owlapi.model.IRI iri)
- Parameters:
iri
- An IRI- Returns:
- True if the IRI is a built-in
-
isSWRLBuiltIn
boolean isSWRLBuiltIn(@NonNull java.lang.String shortName)
- Parameters:
shortName
- An short name- Returns:
- True if the short name is a built-in
-
getSWRLBuiltInIRIs
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.IRI> getSWRLBuiltInIRIs()
- Returns:
- The IRIs of all SWRL built-ins
-
createSWRLParser
@NonNull SWRLParser createSWRLParser()
- Returns:
- A SWRL parser
-
createSWRLAutoCompleter
@NonNull SWRLAutoCompleter createSWRLAutoCompleter()
- Returns:
- A SWRL rule auto-completer
-
createSWRLRuleRenderer
@NonNull SWRLRuleRenderer createSWRLRuleRenderer()
- Returns:
- A SWRL rule renderer
-
getRuleEngineName
@NonNull java.lang.String getRuleEngineName()
Get the name of this SWRL rule engine.- Returns:
- A rule engine name
-
getRuleEngineVersion
@NonNull java.lang.String getRuleEngineVersion()
Get the version of the native rule engine implementing this SWRL rule engine- Returns:
- A rule engine version
-
getOWLOntology
@NonNull org.semanticweb.owlapi.model.OWLOntology getOWLOntology()
- Returns:
- The underlying OWL ontology
-
getOWL2RLEngine
@NonNull OWL2RLEngine getOWL2RLEngine()
Get the underlying OWL 2 RL reasoner used by the rule and query engine- Returns:
- An OWL 2 RL engine
-
getOWLReasoner
@NonNull org.semanticweb.owlapi.reasoner.OWLReasoner getOWLReasoner()
A rule engine must also define anOWLReasoner
.- Returns:
- An OWL reasoner
-
loadExternalSWRLBuiltInLibraries
void loadExternalSWRLBuiltInLibraries(@NonNull java.io.File swrlBuiltInLibraryDirectory)
Load user-defined SWRL built-in libraries See here for documentation on defining these libraries.- Parameters:
swrlBuiltInLibraryDirectory
- The directory containing the libraries
-
getRuleEngineIcon
@NonNull javax.swing.Icon getRuleEngineIcon()
- Returns:
- The rule engine's icon
-
getAssertedOWLAxioms
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom> getAssertedOWLAxioms()
- Returns:
- A collection of OWL axioms
-
getInferredOWLAxioms
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom> getInferredOWLAxioms()
- Returns:
- A collection of OWL axioms
-
getInjectedOWLAxioms
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom> getInjectedOWLAxioms()
- Returns:
- A collection of OWL axioms
-
getNumberOfImportedSWRLRules
int getNumberOfImportedSWRLRules()
- Returns:
- The number of imported SWRL rules
-
getNumberOfAssertedOWLAxioms
int getNumberOfAssertedOWLAxioms()
- Returns:
- The number of asserted OWL axioms
-
getNumberOfInferredOWLAxioms
int getNumberOfInferredOWLAxioms()
- Returns:
- The number of inferred OWL axioms
-
getNumberOfInjectedOWLAxioms
int getNumberOfInjectedOWLAxioms()
- Returns:
- The number of injected OWL axioms
-
getNumberOfAssertedOWLClassDeclarationAxioms
int getNumberOfAssertedOWLClassDeclarationAxioms()
- Returns:
- The number of asserted OWL class declaration axioms
-
getNumberOfAssertedOWLIndividualDeclarationsAxioms
int getNumberOfAssertedOWLIndividualDeclarationsAxioms()
- Returns:
- The number of asserted OWL individual declaration axioms
-
getNumberOfAssertedOWLObjectPropertyDeclarationAxioms
int getNumberOfAssertedOWLObjectPropertyDeclarationAxioms()
- Returns:
- The number of asserted OWL object property declaration axioms
-
getNumberOfAssertedOWLDataPropertyDeclarationAxioms
int getNumberOfAssertedOWLDataPropertyDeclarationAxioms()
- Returns:
- The number of asserted OWL data property declaration axioms
-
getSWRLAPIOWLOntology
@NonNull SWRLAPIOWLOntology getSWRLAPIOWLOntology()
- Returns:
- The underlying OWL ontology
-
-