Interface SWRLAPIOWLOntology
-
public interface SWRLAPIOWLOntology
Wraps the OWLAPI'sOWLOntology
class with additional functionality used by the SWRLAPI. Primarily it provides methods for dealing with SWRL rules and SQWRL queries.The
SWRLAPIRule
class provides an equivalent wrapping of the OWLAPI'sSWRLRule
. The SWRLAPI also provides a range of types extending the OWLAPI'sSWRLDArgument
interface to define arguments to built-in atoms. This extension point is defined by theSWRLBuiltInArgument
interface, which extends the OWLAPI'sSWRLDArgument
interface. ASWRLAPIOWLOntology
will construct SWRLAPI rules from the SWRL rules in an OWLAPI-based ontology to contain these additional built-in argument types.The
startEventFreezeMode()
,finishEventFreezeMode()
,hasOntologyChanged()
, andresetOntologyChanged()
methods can be used for optimization purposes. For example, in the Protege-OWL API thestartEventFreezeMode()
method turns off listener notification so that bulk transfer of OWL axioms can be performed more efficiently. ThehasOntologyChanged()
method can be used by rule engines to avoid unnecessary regeneration of knowledge.- See Also:
SWRLAPIRule
,SQWRLQuery
,OWLOntology
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull SQWRLQuery
createSQWRLQuery(@NonNull java.lang.String queryName, @NonNull java.lang.String query)
@NonNull SQWRLQuery
createSQWRLQuery(@NonNull java.lang.String queryName, @NonNull java.lang.String query, @NonNull java.lang.String comment, boolean isActive)
@NonNull SQWRLQueryRenderer
createSQWRLQueryRenderer()
@NonNull SQWRLResultGenerator
createSQWRLResultGenerator()
@NonNull SWRLAutoCompleter
createSWRLAutoCompleter()
@NonNull SWRLParser
createSWRLParser()
@NonNull SWRLAPIRule
createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule)
@NonNull SWRLAPIRule
createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule, @NonNull java.lang.String comment, boolean isActive)
@NonNull SWRLRuleRenderer
createSWRLRuleRenderer()
void
deleteSWRLRule(@NonNull java.lang.String ruleName)
void
finishEventFreezeMode()
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAnnotation>
generateRuleAnnotations(@NonNull java.lang.String ruleName, @NonNull java.lang.String comment, boolean isRuleEnabled)
@NonNull IRIResolver
getIRIResolver()
@NonNull java.util.Optional<java.lang.String>
getNextRuleName()
int
getNumberOfOWLAxioms()
int
getNumberOfOWLClassDeclarationAxioms()
int
getNumberOfOWLDataPropertyDeclarationAxioms()
int
getNumberOfOWLIndividualDeclarationAxioms()
int
getNumberOfOWLObjectPropertyDeclarationAxioms()
int
getNumberOfSWRLRules()
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom>
getOWLAxioms()
@NonNull org.semanticweb.owlapi.model.OWLDataFactory
getOWLDataFactory()
@NonNull org.semanticweb.owlapi.model.OWLOntology
getOWLOntology()
@NonNull org.semanticweb.owlapi.model.OWLOntologyManager
getOWLOntologyManager()
@NonNull java.util.Set<@NonNull SQWRLQuery>
getSQWRLQueries()
@NonNull java.util.Set<@NonNull java.lang.String>
getSQWRLQueryNames()
@NonNull SQWRLResult
getSQWRLResult(@NonNull java.lang.String queryName)
@NonNull SQWRLResultGenerator
getSQWRLResultGenerator(@NonNull java.lang.String queryName)
@NonNull SWRLAPIOWLDataFactory
getSWRLAPIOWLDataFactory()
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.IRI>
getSWRLBuiltInIRIs()
@NonNull SWRLBuiltInLibraryManager
getSWRLBuiltInLibraryManager()
@NonNull java.util.Optional<@NonNull SWRLAPIRule>
getSWRLRule(@NonNull java.lang.String ruleName)
@NonNull java.util.Set<@NonNull SWRLAPIRule>
getSWRLRules()
boolean
hasAssertedOWLAxiom(org.semanticweb.owlapi.model.OWLAxiom axiom)
boolean
hasOntologyChanged()
boolean
isSWRLBuiltIn(@NonNull java.lang.String prefixedName)
boolean
isSWRLBuiltInIRI(@NonNull org.semanticweb.owlapi.model.IRI iri)
void
processOntology()
void
registerRuleEngineModel(SWRLRuleEngineModel swrlRuleEngineModel)
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
reset()
void
resetOntologyChanged()
void
startEventFreezeMode()
java.util.Optional<@NonNull org.semanticweb.owlapi.model.IRI>
swrlBuiltInPrefixedName2IRI(@NonNull java.lang.String prefixedName)
void
unregisterRuleEngineModel(SWRLRuleEngineModel swrlRuleEngineModel)
-
-
-
Method Detail
-
registerRuleEngineModel
void registerRuleEngineModel(SWRLRuleEngineModel swrlRuleEngineModel)
- Parameters:
swrlRuleEngineModel
- A SWRL rule engine model
-
unregisterRuleEngineModel
void unregisterRuleEngineModel(SWRLRuleEngineModel swrlRuleEngineModel)
- Parameters:
swrlRuleEngineModel
- A SWRL rule engine model
-
getSWRLRules
@NonNull java.util.Set<@NonNull SWRLAPIRule> getSWRLRules()
-
getSWRLRule
@NonNull java.util.Optional<@NonNull SWRLAPIRule> getSWRLRule(@NonNull java.lang.String ruleName) throws SWRLRuleException
- Throws:
SWRLRuleException
-
createSWRLRule
@NonNull SWRLAPIRule createSWRLRule(@NonNull java.lang.String ruleName, @NonNull java.lang.String rule) throws SWRLParseException, SWRLBuiltInException
- Parameters:
ruleName
- The name of the rulerule
- Rule text- Returns:
- The rule representation
- 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
- Parameters:
ruleName
- The name of the rulerule
- Rule textcomment
- A comment associated with the ruleisActive
- Is the rule active- Returns:
- The rule representation
- 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
-
deleteSWRLRule
void deleteSWRLRule(@NonNull java.lang.String ruleName)
-
generateRuleAnnotations
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAnnotation> generateRuleAnnotations(@NonNull java.lang.String ruleName, @NonNull java.lang.String comment, boolean isRuleEnabled)
- Parameters:
ruleName
- The name of the rulecomment
- A comment for the ruleisRuleEnabled
- Is the rule enabled- Returns:
- A set of rule annotations
-
isSWRLBuiltInIRI
boolean isSWRLBuiltInIRI(@NonNull org.semanticweb.owlapi.model.IRI iri)
-
isSWRLBuiltIn
boolean isSWRLBuiltIn(@NonNull java.lang.String prefixedName)
-
getSWRLBuiltInIRIs
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.IRI> getSWRLBuiltInIRIs()
-
swrlBuiltInPrefixedName2IRI
java.util.Optional<@NonNull org.semanticweb.owlapi.model.IRI> swrlBuiltInPrefixedName2IRI(@NonNull java.lang.String prefixedName)
-
createSWRLParser
@NonNull SWRLParser createSWRLParser()
-
createSWRLAutoCompleter
@NonNull SWRLAutoCompleter createSWRLAutoCompleter()
-
createSWRLRuleRenderer
@NonNull SWRLRuleRenderer createSWRLRuleRenderer()
-
getSWRLBuiltInLibraryManager
@NonNull SWRLBuiltInLibraryManager getSWRLBuiltInLibraryManager()
-
getNextRuleName
@NonNull java.util.Optional<java.lang.String> getNextRuleName()
- Returns:
- A rule name
-
createSQWRLQuery
@NonNull SQWRLQuery createSQWRLQuery(@NonNull java.lang.String queryName, @NonNull java.lang.String query) throws SWRLParseException, SWRLBuiltInException
-
createSQWRLQuery
@NonNull SQWRLQuery createSQWRLQuery(@NonNull java.lang.String queryName, @NonNull java.lang.String query, @NonNull java.lang.String comment, boolean isActive) throws SWRLParseException, SWRLBuiltInException
-
getSQWRLResult
@NonNull SQWRLResult getSQWRLResult(@NonNull java.lang.String queryName) throws SQWRLException
- Throws:
SQWRLException
-
getSQWRLQueryNames
@NonNull java.util.Set<@NonNull java.lang.String> getSQWRLQueryNames()
-
getSQWRLQueries
@NonNull java.util.Set<@NonNull SQWRLQuery> getSQWRLQueries()
-
getSQWRLResultGenerator
@NonNull SQWRLResultGenerator getSQWRLResultGenerator(@NonNull java.lang.String queryName) throws SQWRLException
- Throws:
SQWRLException
-
createSQWRLResultGenerator
@NonNull SQWRLResultGenerator createSQWRLResultGenerator()
-
createSQWRLQueryRenderer
@NonNull SQWRLQueryRenderer createSQWRLQueryRenderer()
-
reset
void reset()
-
processOntology
void processOntology() throws SWRLBuiltInException
- Throws:
SWRLBuiltInException
-
startEventFreezeMode
void startEventFreezeMode()
-
finishEventFreezeMode
void finishEventFreezeMode()
-
hasOntologyChanged
boolean hasOntologyChanged()
-
resetOntologyChanged
void resetOntologyChanged()
-
hasAssertedOWLAxiom
boolean hasAssertedOWLAxiom(org.semanticweb.owlapi.model.OWLAxiom axiom)
-
getOWLAxioms
@NonNull java.util.Set<@NonNull org.semanticweb.owlapi.model.OWLAxiom> getOWLAxioms()
-
getNumberOfSWRLRules
int getNumberOfSWRLRules()
-
getNumberOfOWLAxioms
int getNumberOfOWLAxioms()
-
getNumberOfOWLClassDeclarationAxioms
int getNumberOfOWLClassDeclarationAxioms()
-
getNumberOfOWLIndividualDeclarationAxioms
int getNumberOfOWLIndividualDeclarationAxioms()
-
getNumberOfOWLObjectPropertyDeclarationAxioms
int getNumberOfOWLObjectPropertyDeclarationAxioms()
-
getNumberOfOWLDataPropertyDeclarationAxioms
int getNumberOfOWLDataPropertyDeclarationAxioms()
-
getSWRLAPIOWLDataFactory
@NonNull SWRLAPIOWLDataFactory getSWRLAPIOWLDataFactory()
-
getIRIResolver
@NonNull IRIResolver getIRIResolver()
-
getOWLOntologyManager
@NonNull org.semanticweb.owlapi.model.OWLOntologyManager getOWLOntologyManager()
-
getOWLOntology
@NonNull org.semanticweb.owlapi.model.OWLOntology getOWLOntology()
-
getOWLDataFactory
@NonNull org.semanticweb.owlapi.model.OWLDataFactory getOWLDataFactory()
-
-