org.apache.stanbol.reasoners.owlapi
Class AbstractOWLApiReasoningService

java.lang.Object
  extended by org.apache.stanbol.reasoners.owlapi.AbstractOWLApiReasoningService
All Implemented Interfaces:
OWLApiReasoningService, ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>

public abstract class AbstractOWLApiReasoningService
extends java.lang.Object
implements OWLApiReasoningService

This abstract class implements basic methods for a reasoning service based on OWLApi


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.stanbol.reasoners.servicesapi.ReasoningService
ReasoningService.Tasks
 
Field Summary
 
Fields inherited from interface org.apache.stanbol.reasoners.servicesapi.ReasoningService
SERVICE_PATH
 
Constructor Summary
AbstractOWLApiReasoningService()
           
 
Method Summary
protected  java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> classify(org.semanticweb.owlapi.model.OWLOntology ontology)
          Classify, returns only axioms about classes and instances This is the default implementation of task ReasoningService.Tasks.CLASSIFY.
protected  java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> classify(org.semanticweb.owlapi.model.OWLOntology ontology, java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules)
          Classify, merge SWRL rules in the input ontology, before This is the default implementation of task ReasoningService.Tasks.CLASSIFY when rules are given.
protected  org.semanticweb.owlapi.model.OWLOntologyManager createOWLOntologyManager()
          An OWLOntologyManager to be used to place a target ontology.
protected  java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology)
          Enrich, return all inferences.
protected  java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology, boolean filtered)
          Enrich, return all inferences.
protected  java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology, java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules)
          Enrich, merge SWRL rules and return all inferences.
protected  java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology, java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules, boolean filtered)
          Enrich, merge SWRL rules and return all inferences.
protected  java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> getClassifyAxiomGenerators()
          InferredAxiomGenerators to use for the classify() reasoning method.
protected  java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> getEnrichAxiomGenerators()
          InferredAxiomGenerators to use for the enrich() reasoning method.
 java.lang.Class<org.semanticweb.owlapi.model.OWLOntology> getModelType()
          OWLApi based reasoning services have type OWLOntology as input type
protected abstract  org.semanticweb.owlapi.reasoner.OWLReasoner getReasoner(org.semanticweb.owlapi.model.OWLOntology ontology)
          Method to be implemented by subclasses.
 java.lang.Class<org.semanticweb.owlapi.model.SWRLRule> getRuleType()
          OWLApi based reasoning services have type SWRLRule as rule type
 java.lang.Class<org.semanticweb.owlapi.model.OWLAxiom> getStatementType()
          OWLApi based reasoning services have type OWLAxiom as statement type
 java.util.List<java.lang.String> getSupportedTasks()
          The abstract implementation of an OWLApi based reasoning service supports all default ReasoningService.Tasks.
 boolean isConsistent(org.semanticweb.owlapi.model.OWLOntology ontology)
          Only check consistency.
 boolean isConsistent(org.semanticweb.owlapi.model.OWLOntology ontology, java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules)
          Only check consistency.
 java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> run(org.semanticweb.owlapi.model.OWLOntology input, java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> generators)
          Generic method for running the reasoner
 java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> run(org.semanticweb.owlapi.model.OWLOntology ontology, java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules, java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> generators)
          Merges the SWRL rules in the input ontology, then calls run(OWLOntology,List>)
 java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> runTask(java.lang.String taskID, org.semanticweb.owlapi.model.OWLOntology data)
          This method provides the default implementation for executing one of the default tasks with no additional arguments.
 java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> runTask(java.lang.String taskID, org.semanticweb.owlapi.model.OWLOntology data, java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules, boolean filtered, java.util.Map<java.lang.String,java.util.List<java.lang.String>> parameters)
          This method provides the default implementation for executing one of the default tasks.
 boolean supportsTask(java.lang.String taskID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.stanbol.reasoners.servicesapi.ReasoningService
getPath
 

Constructor Detail

AbstractOWLApiReasoningService

public AbstractOWLApiReasoningService()
Method Detail

createOWLOntologyManager

protected org.semanticweb.owlapi.model.OWLOntologyManager createOWLOntologyManager()
An OWLOntologyManager to be used to place a target ontology. We don't want to use the manager bound to the input ontologies for that, we don't want to interfere with it. Other OWLApiReasoningServices may want to change this.

Returns:

getReasoner

protected abstract org.semanticweb.owlapi.reasoner.OWLReasoner getReasoner(org.semanticweb.owlapi.model.OWLOntology ontology)
Method to be implemented by subclasses.

Parameters:
ontology -
Returns:

run

public java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> run(org.semanticweb.owlapi.model.OWLOntology input,
                                                                java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> generators)
                                                         throws ReasoningServiceException,
                                                                InconsistentInputException
Generic method for running the reasoner

Specified by:
run in interface OWLApiReasoningService
Parameters:
input -
generators -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

run

public java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> run(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules,
                                                                java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> generators)
                                                         throws ReasoningServiceException,
                                                                InconsistentInputException
Merges the SWRL rules in the input ontology, then calls run(OWLOntology,List>)

Specified by:
run in interface OWLApiReasoningService
Parameters:
ontology -
rules -
generators -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

runTask

public java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> runTask(java.lang.String taskID,
                                                                    org.semanticweb.owlapi.model.OWLOntology data)
                                                             throws UnsupportedTaskException,
                                                                    ReasoningServiceException,
                                                                    InconsistentInputException
This method provides the default implementation for executing one of the default tasks with no additional arguments. TODO: Add support for the filtered parameter on task 'classify';

Specified by:
runTask in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>
Throws:
UnsupportedTaskException
ReasoningServiceException
InconsistentInputException

runTask

public java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> runTask(java.lang.String taskID,
                                                                    org.semanticweb.owlapi.model.OWLOntology data,
                                                                    java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules,
                                                                    boolean filtered,
                                                                    java.util.Map<java.lang.String,java.util.List<java.lang.String>> parameters)
                                                             throws UnsupportedTaskException,
                                                                    ReasoningServiceException,
                                                                    InconsistentInputException
This method provides the default implementation for executing one of the default tasks. TODO: Add support for the filtered parameter on task 'classify';

Specified by:
runTask in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>
Throws:
UnsupportedTaskException
ReasoningServiceException
InconsistentInputException

getClassifyAxiomGenerators

protected java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> getClassifyAxiomGenerators()
InferredAxiomGenerators to use for the classify() reasoning method. Subclasses may want to change this.

Returns:

getEnrichAxiomGenerators

protected java.util.List<org.semanticweb.owlapi.util.InferredAxiomGenerator<? extends org.semanticweb.owlapi.model.OWLAxiom>> getEnrichAxiomGenerators()
InferredAxiomGenerators to use for the enrich() reasoning method. Subclasses may want to change this.

Returns:

classify

protected java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> classify(org.semanticweb.owlapi.model.OWLOntology ontology)
                                                                 throws ReasoningServiceException,
                                                                        InconsistentInputException
Classify, returns only axioms about classes and instances This is the default implementation of task ReasoningService.Tasks.CLASSIFY. Subclasses may want to change it.

Parameters:
ontology -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

classify

protected java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> classify(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                        java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules)
                                                                 throws ReasoningServiceException,
                                                                        InconsistentInputException
Classify, merge SWRL rules in the input ontology, before This is the default implementation of task ReasoningService.Tasks.CLASSIFY when rules are given. Subclasses may want to change it.

Parameters:
ontology -
rules -
Returns:
Throws:
InconsistentInputException
ReasoningServiceException

enrich

protected java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology)
                                                               throws ReasoningServiceException,
                                                                      InconsistentInputException
Enrich, return all inferences. This is the same as enrich(ontology,false); This is the default implementation of task ReasoningService.Tasks.ENRICH. Subclasses may want to change it.

Parameters:
ontology -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

enrich

protected java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                      boolean filtered)
                                                               throws ReasoningServiceException,
                                                                      InconsistentInputException
Enrich, return all inferences. If filtered = false, then merge the inferences with the input This is the default implementation of task ReasoningService.Tasks.ENRICH. Subclasses may want to change it.

Parameters:
ontology -
filtered -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

enrich

protected java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                      java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules)
                                                               throws ReasoningServiceException,
                                                                      InconsistentInputException
Enrich, merge SWRL rules and return all inferences. This is the same as enrich(ontology,rules,false) This is the default implementation of task ReasoningService.Tasks.ENRICH. Subclasses may want to change it.

Parameters:
ontology -
rules -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

enrich

protected java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> enrich(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                      java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules,
                                                                      boolean filtered)
                                                               throws ReasoningServiceException,
                                                                      InconsistentInputException
Enrich, merge SWRL rules and return all inferences. If filtered = false, then merge the inferences with the input. This is the default implementation of task ReasoningService.Tasks.ENRICH. Subclasses may want to change it.

Parameters:
ontology -
rules -
filtered -
Returns:
Throws:
ReasoningServiceException
InconsistentInputException

isConsistent

public boolean isConsistent(org.semanticweb.owlapi.model.OWLOntology ontology)
                     throws ReasoningServiceException
Only check consistency. Subclasses may want to change how.

Specified by:
isConsistent in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>
Parameters:
ontology -
Returns:
Throws:
ReasoningServiceException

isConsistent

public boolean isConsistent(org.semanticweb.owlapi.model.OWLOntology ontology,
                            java.util.List<org.semanticweb.owlapi.model.SWRLRule> rules)
                     throws ReasoningServiceException
Only check consistency. Subclasses may want to change how.

Specified by:
isConsistent in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>
Parameters:
ontology -
rules -
Returns:
Throws:
ReasoningServiceException

getSupportedTasks

public java.util.List<java.lang.String> getSupportedTasks()
The abstract implementation of an OWLApi based reasoning service supports all default ReasoningService.Tasks. Subclasses may want to extend this.

Specified by:
getSupportedTasks in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>

supportsTask

public boolean supportsTask(java.lang.String taskID)
Specified by:
supportsTask in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>

getModelType

public java.lang.Class<org.semanticweb.owlapi.model.OWLOntology> getModelType()
OWLApi based reasoning services have type OWLOntology as input type

Specified by:
getModelType in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>

getRuleType

public java.lang.Class<org.semanticweb.owlapi.model.SWRLRule> getRuleType()
OWLApi based reasoning services have type SWRLRule as rule type

Specified by:
getRuleType in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>

getStatementType

public java.lang.Class<org.semanticweb.owlapi.model.OWLAxiom> getStatementType()
OWLApi based reasoning services have type OWLAxiom as statement type

Specified by:
getStatementType in interface ReasoningService<org.semanticweb.owlapi.model.OWLOntology,org.semanticweb.owlapi.model.SWRLRule,org.semanticweb.owlapi.model.OWLAxiom>


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.