Skip to content

Commit

Permalink
Closes #75
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhorridge committed Sep 24, 2014
1 parent 15aa674 commit ed27bb9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyChange;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.reasoner.OWLReasoner;


/**
Expand Down Expand Up @@ -74,7 +75,11 @@ public void run() {
}

private void refillInferredDoIt() {
if (!getOWLModelManager().getReasoner().isConsistent()) {
OWLReasoner reasoner = getOWLModelManager().getReasoner();
if (!reasoner.isConsistent()) {
return;
}
if(!reasoner.isSatisfiable(getRootObject())) {
return;
}
Set<OWLClass> clses = getReasoner().getSuperClasses(getRootObject(), true).getFlattened();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyChange;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.util.CollectionFactory;


Expand Down Expand Up @@ -85,20 +86,23 @@ protected void refillInferred() {
new Runnable() {

public void run() {
if (!getOWLModelManager().getReasoner().isConsistent()) {
final OWLReasoner reasoner = getOWLModelManager().getReasoner();
if (!reasoner.isConsistent()) {
return;
}
OWLClass nothing = getOWLModelManager().getOWLDataFactory().getOWLNothing();
if (!getOWLModelManager().getReasoner().isSatisfiable(getRootObject()) && !nothing.equals(getRootObject())) {
addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(),
OWLEquivalentClassesAxiomFrameSection.this,
null,
getRootObject(),
getOWLDataFactory().getOWLEquivalentClassesAxiom(CollectionFactory.createSet(getRootObject(),
nothing))));
if (!reasoner.isSatisfiable(getRootObject())) {
if (!getRootObject().isOWLNothing()) {
OWLClass nothing = getOWLModelManager().getOWLDataFactory().getOWLNothing();
addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(),
OWLEquivalentClassesAxiomFrameSection.this,
null,
getRootObject(),
getOWLDataFactory().getOWLEquivalentClassesAxiom(CollectionFactory.createSet(getRootObject(),
nothing))));
}
}
else{
for (OWLClassExpression cls : getOWLModelManager().getReasoner().getEquivalentClasses(getRootObject())) {
for (OWLClassExpression cls : reasoner.getEquivalentClasses(getRootObject())) {
if (!added.contains(cls) && !cls.equals(getRootObject())) {
addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(),
OWLEquivalentClassesAxiomFrameSection.this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.semanticweb.owlapi.model.OWLOntologyChange;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.reasoner.Node;
import org.semanticweb.owlapi.reasoner.OWLReasoner;


/**
Expand Down Expand Up @@ -70,25 +71,31 @@ protected Set<OWLSubClassOfAxiom> getClassAxioms(OWLClassExpression descr, OWLOn


protected void refillInferred() {
getOWLModelManager().getReasonerPreferences().executeTask(OptionalInferenceTask.SHOW_INFERRED_SUPER_CLASSES, new Runnable() {
final OWLReasoner reasoner = getOWLModelManager().getReasoner();
if(!reasoner.isConsistent()) {
return;
}
if(!reasoner.isSatisfiable(getRootObject())) {
return;
}
getOWLModelManager().getReasonerPreferences().executeTask(OptionalInferenceTask.SHOW_INFERRED_SUPER_CLASSES, new Runnable() {
public void run() {
if (getOWLModelManager().getReasoner().isConsistent()) {
for (Node<OWLClass> inferredSuperClasses : getOWLModelManager().getReasoner().getSuperClasses(getRootObject(), true)) {
for (Node<OWLClass> inferredSuperClasses : reasoner.getSuperClasses(getRootObject(), true)) {
for (OWLClassExpression inferredSuperClass : inferredSuperClasses) {
if (!added.contains(inferredSuperClass)) {
addInferredRowIfNontrivial(new OWLSubClassAxiomFrameSectionRow(getOWLEditorKit(),
OWLSubClassAxiomFrameSection.this,
null,
getRootObject(),
getOWLModelManager().getOWLDataFactory().getOWLSubClassOfAxiom(getRootObject(),
inferredSuperClass)));
OWLSubClassAxiomFrameSection.this,
null,
getRootObject(),
getOWLModelManager().getOWLDataFactory().getOWLSubClassOfAxiom(getRootObject(),
inferredSuperClass)));
added.add(inferredSuperClass);
}
}
}
}
}
});

}


Expand All @@ -98,7 +105,7 @@ protected OWLSubClassOfAxiom createAxiom(OWLClassExpression object) {


public OWLObjectEditor<OWLClassExpression> getObjectEditor() {
return getOWLEditorKit().getWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null, AxiomType.SUBCLASS_OF);
return getOWLEditorKit().getWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null, AxiomType.SUBCLASS_OF);
}


Expand Down

0 comments on commit ed27bb9

Please sign in to comment.