com.clarkparsia.modularity
Class AbstractModuleExtractor

java.lang.Object
  extended by com.clarkparsia.modularity.AbstractModuleExtractor
All Implemented Interfaces:
ModuleExtractor
Direct Known Subclasses:
AxiomBasedModuleExtractor

public abstract class AbstractModuleExtractor
extends java.lang.Object
implements ModuleExtractor

Title:

Description:

Copyright: Copyright (c) 2007

Company: Clark & Parsia, LLC.

Author:
Evren Sirin

Field Summary
static java.util.logging.Logger log
           
 
Constructor Summary
AbstractModuleExtractor()
           
AbstractModuleExtractor(com.clarkparsia.owlapi.modularity.locality.LocalityEvaluator localityEvaluator)
           
 
Method Summary
 void addAxiom(org.semanticweb.owlapi.model.OWLAxiom axiom)
          Adds an axiom to the extractor.
 void addOntologies(java.util.Set<org.semanticweb.owlapi.model.OWLOntology> ontologies)
          Adds all the axioms from a set of ontologies to the extractor.
 void addOntology(org.semanticweb.owlapi.model.OWLOntology ontology)
          Adds all the axioms of an ontology to the extractor.
 boolean canUpdate()
          Returns if the extracted modules can be updated.
 void deleteAxiom(org.semanticweb.owlapi.model.OWLAxiom axiom)
          Deletes an axiom from the extractor.
 MultiValueMap<org.semanticweb.owlapi.model.OWLEntity,org.semanticweb.owlapi.model.OWLEntity> extractModules()
          Extract modules from scratch
 org.semanticweb.owlapi.model.OWLOntology getAxiomOntology()
           
 java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> getAxioms()
          Returns all the axioms loaded in the extractor.
 java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> getAxioms(org.semanticweb.owlapi.model.OWLEntity entity)
          Return the axioms which references this entity
 java.util.Set<org.semanticweb.owlapi.model.OWLEntity> getEntities()
          Returns all the entities referenced in loaded axioms.
 org.semanticweb.owlapi.model.OWLOntology getModule(org.semanticweb.owlapi.model.OWLEntity entity)
           
 org.semanticweb.owlapi.model.OWLOntology getModuleFromSignature(java.util.Set<org.semanticweb.owlapi.model.OWLEntity> signature)
          Returns a new ontology that contains the axioms that are in the module for given set of entities
 MultiValueMap<org.semanticweb.owlapi.model.OWLEntity,org.semanticweb.owlapi.model.OWLEntity> getModules()
           
 Timers getTimers()
          Returns the timers used by this extractor to collect statistics about performance.
 boolean isABoxChanged()
          Checks whether there are unapplied changes to the ABox
 boolean isChanged()
          Checks if axioms have been added/removed and modules need to be updated
 boolean isClassificationNeeded(Expressivity expressivity)
          Checks if the changes that has not yet been updated require re-classification
 boolean isRBoxChanged()
          Checks whether there are unapplied changes to the RBox
 boolean isTBoxChanged()
          Checks whether there are unapplied changes to the TBox
 void load(java.util.zip.ZipInputStream inputStream)
          Restores the previously saved state of the ModuleExtractor from a stream.
 void resetModules()
           
 void save(java.util.zip.ZipOutputStream outputStream)
          Save the current state of the ModuleExtractor.
 java.util.Set<org.semanticweb.owlapi.model.OWLEntity> updateModules(Taxonomy<org.semanticweb.owlapi.model.OWLClass> taxonomy, boolean add)
          Update the modules with the changes that have been put into the queue so far.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.clarkparsia.modularity.ModuleExtractor
extractModule
 

Field Detail

log

public static final java.util.logging.Logger log
Constructor Detail

AbstractModuleExtractor

public AbstractModuleExtractor()

AbstractModuleExtractor

public AbstractModuleExtractor(com.clarkparsia.owlapi.modularity.locality.LocalityEvaluator localityEvaluator)
Method Detail

addAxiom

public void addAxiom(org.semanticweb.owlapi.model.OWLAxiom axiom)
Description copied from interface: ModuleExtractor
Adds an axiom to the extractor.

Specified by:
addAxiom in interface ModuleExtractor

canUpdate

public boolean canUpdate()
Returns if the extracted modules can be updated. We can update the modules if we have computed modules and no non-local axiom has been added or deleted.

Specified by:
canUpdate in interface ModuleExtractor
Returns:

deleteAxiom

public void deleteAxiom(org.semanticweb.owlapi.model.OWLAxiom axiom)
Description copied from interface: ModuleExtractor
Deletes an axiom from the extractor.

Specified by:
deleteAxiom in interface ModuleExtractor

getModules

public MultiValueMap<org.semanticweb.owlapi.model.OWLEntity,org.semanticweb.owlapi.model.OWLEntity> getModules()
Specified by:
getModules in interface ModuleExtractor

extractModules

public MultiValueMap<org.semanticweb.owlapi.model.OWLEntity,org.semanticweb.owlapi.model.OWLEntity> extractModules()
Extract modules from scratch

Specified by:
extractModules in interface ModuleExtractor
Returns:

getAxioms

public java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> getAxioms(org.semanticweb.owlapi.model.OWLEntity entity)
Return the axioms which references this entity

Specified by:
getAxioms in interface ModuleExtractor
Parameters:
entity -
Returns:

getModule

public org.semanticweb.owlapi.model.OWLOntology getModule(org.semanticweb.owlapi.model.OWLEntity entity)
Specified by:
getModule in interface ModuleExtractor

getModuleFromSignature

public org.semanticweb.owlapi.model.OWLOntology getModuleFromSignature(java.util.Set<org.semanticweb.owlapi.model.OWLEntity> signature)
Returns a new ontology that contains the axioms that are in the module for given set of entities

Specified by:
getModuleFromSignature in interface ModuleExtractor
Parameters:
signature -
Returns:
Throws:
org.semanticweb.owlapi.model.OWLException

isChanged

public boolean isChanged()
Checks if axioms have been added/removed and modules need to be updated

Specified by:
isChanged in interface ModuleExtractor
Returns:
true if axioms have been added/removed

addOntologies

public void addOntologies(java.util.Set<org.semanticweb.owlapi.model.OWLOntology> ontologies)
Description copied from interface: ModuleExtractor
Adds all the axioms from a set of ontologies to the extractor.

Specified by:
addOntologies in interface ModuleExtractor

addOntology

public void addOntology(org.semanticweb.owlapi.model.OWLOntology ontology)
Description copied from interface: ModuleExtractor
Adds all the axioms of an ontology to the extractor.

Specified by:
addOntology in interface ModuleExtractor

updateModules

public java.util.Set<org.semanticweb.owlapi.model.OWLEntity> updateModules(Taxonomy<org.semanticweb.owlapi.model.OWLClass> taxonomy,
                                                                           boolean add)
                                                                    throws java.lang.UnsupportedOperationException
Update the modules with the changes that have been put into the queue so far.

Specified by:
updateModules in interface ModuleExtractor
Parameters:
add - If true apply only addition changes, otherwise apply deletions
Returns:
The set of entities whose modules are affected by the changes
Throws:
java.lang.UnsupportedOperationException - if modules cannot be updated as reported by canUpdate() function

getTimers

public Timers getTimers()
Description copied from interface: ModuleExtractor
Returns the timers used by this extractor to collect statistics about performance.

Specified by:
getTimers in interface ModuleExtractor
Returns:

getAxioms

public java.util.Set<org.semanticweb.owlapi.model.OWLAxiom> getAxioms()
Description copied from interface: ModuleExtractor
Returns all the axioms loaded in the extractor.

Specified by:
getAxioms in interface ModuleExtractor
Returns:
an unmodifiable set of axioms

getAxiomOntology

public org.semanticweb.owlapi.model.OWLOntology getAxiomOntology()
Specified by:
getAxiomOntology in interface ModuleExtractor

getEntities

public java.util.Set<org.semanticweb.owlapi.model.OWLEntity> getEntities()
Description copied from interface: ModuleExtractor
Returns all the entities referenced in loaded axioms.

Specified by:
getEntities in interface ModuleExtractor
Returns:
an unmodifiable set of entities

resetModules

public void resetModules()

isClassificationNeeded

public boolean isClassificationNeeded(Expressivity expressivity)
Description copied from interface: ModuleExtractor
Checks if the changes that has not yet been updated require re-classification

Specified by:
isClassificationNeeded in interface ModuleExtractor
Returns:
true if classification is needed, false otherwise

isTBoxChanged

public boolean isTBoxChanged()
Checks whether there are unapplied changes to the TBox

Returns:
true if there are unapplied changes to TBox

isRBoxChanged

public boolean isRBoxChanged()
Checks whether there are unapplied changes to the RBox

Returns:
true if there are unapplied changes to RBox

isABoxChanged

public boolean isABoxChanged()
Checks whether there are unapplied changes to the ABox

Returns:
true if there are unapplied changes to ABox

save

public void save(java.util.zip.ZipOutputStream outputStream)
          throws java.io.IOException,
                 java.lang.IllegalStateException
Description copied from interface: ModuleExtractor
Save the current state of the ModuleExtractor. The output is saved to a ZipOutputStream to allow storage in multiple files in one stream.

Specified by:
save in interface ModuleExtractor
Parameters:
outputStream - the zip output stream where the data should be stored
Throws:
java.io.IOException - if an I/O error occurs during the saving
java.lang.IllegalStateException - if there are outstanding changes that have not yet been applied to the modules (e.g., via updateModules())

load

public void load(java.util.zip.ZipInputStream inputStream)
          throws java.io.IOException,
                 java.lang.IllegalArgumentException
Description copied from interface: ModuleExtractor
Restores the previously saved state of the ModuleExtractor from a stream. The input is read from a ZipInputStream because the data may potentially span multiple files. The method assumes that the zip file entries saved by the save() method are the immediately next ones in the stream.

Specified by:
load in interface ModuleExtractor
Parameters:
inputStream - the zip input stream from which the data should be read
Throws:
java.io.IOException - if an I/O error occurs during the read
java.lang.IllegalArgumentException - if the next zip file entry in the stream was not saved by a compatible ModuleExtractor


Copyright © 2004 Evren Sirin. All Rights Reserved.