protected void refillInferred() { getOWLModelManager() .getReasonerPreferences() .executeTask( OptionalInferenceTask.SHOW_INFERRED_EQUIVALENT_OBJECT_PROPERTIES, () -> { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } Node<OWLObjectPropertyExpression> equivalentObjectProperties = getReasoner().getEquivalentObjectProperties(getRootObject()); if (!equivalentObjectProperties.getEntitiesMinus(getRootObject()).isEmpty()) { OWLEquivalentObjectPropertiesAxiom ax = getOWLDataFactory() .getOWLEquivalentObjectPropertiesAxiom( equivalentObjectProperties.getEntities()); if (!added.contains(ax)) { addInferredRowIfNontrivial( new OWLEquivalentObjectPropertiesAxiomFrameSectionRow( getOWLEditorKit(), OWLEquivalentObjectPropertiesAxiomFrameSection.this, null, getRootObject(), ax)); } } }); }
private static void printNode(Node<OWLClass> node) { // Print out a node as a list of class names in curly brackets System.out.print("{"); for (Iterator<OWLClass> it = node.getEntities().iterator(); it.hasNext(); ) { OWLClass cls = it.next(); // User a prefix manager to provide a slightly nicer shorter name System.out.print(pm.getShortForm(cls)); if (it.hasNext()) { System.out.print(" "); } } System.out.println("}"); }
public Set<OWLClass> getEquivalentClasses(String classExpressionString) { if (classExpressionString.trim().length() == 0) { return Collections.emptySet(); } OWLClassExpression classExpression = parser.parseClassExpression(classExpressionString); Node<OWLClass> equivalentClasses = reasoner.getEquivalentClasses(classExpression); Set<OWLClass> result = null; if (classExpression.isAnonymous()) { result = equivalentClasses.getEntities(); } else { result = equivalentClasses.getEntitiesMinus(classExpression.asOWLClass()); } return result; }
@Test public void shouldGetBottomDataPropertyNode() { Node<OWLDataProperty> node = reasoner.getBottomDataPropertyNode(); assertThat(node.getEntities(), is(Collections.singleton(owlBottomDataProperty))); }
@Test public void shouldGetTopObjectPropertyNode() { Node<OWLObjectPropertyExpression> node = reasoner.getTopObjectPropertyNode(); assertThat(node.getEntities(), is(Collections.singleton(owlTopObjectProperty))); }
@Test public void shouldGetBottomClassNode() { Node<OWLClass> node = reasoner.getBottomClassNode(); assertThat(node.getEntities(), is(Collections.singleton(owlNothing))); }