@Override public boolean isEntailed(Set<? extends OWLAxiom> axioms) { checkPreConditions(axioms.toArray(new OWLObject[0])); if (!m_isConsistent.booleanValue()) return true; EntailmentChecker checker=new EntailmentChecker(this,getDataFactory()); return checker.entails(axioms); }
public boolean isEntailed(Set<? extends OWLAxiom> axioms) { checkPreConditions(axioms.toArray(new OWLObject[0])); if (!m_isConsistent) return true; EntailmentChecker checker=new EntailmentChecker(this,getDataFactory()); return checker.entails(axioms); }
protected Node<OWLDataProperty> dataPropertyHierarchyNodeToNode(HierarchyNode<AtomicRole> hierarchyNode) { Set<OWLDataProperty> result=new HashSet<>(); OWLDataFactory factory=getDataFactory(); for (AtomicRole atomicRole : hierarchyNode.getEquivalentElements()) result.add(factory.getOWLDataProperty(IRI.create(atomicRole.getIRI()))); return new OWLDataPropertyNode(result); } protected NodeSet<OWLDataProperty> dataPropertyHierarchyNodesToNodeSet(Collection<HierarchyNode<AtomicRole>> hierarchyNodes) {
protected Set<OWLNamedIndividual> getAllNamedIndividuals() { Set<OWLNamedIndividual> result=new HashSet<>(); OWLDataFactory factory=getDataFactory(); for (Individual individual : m_dlOntology.getAllIndividuals()) if (isResultRelevantIndividual(individual)) result.add(factory.getOWLNamedIndividual(IRI.create(individual.getIRI()))); return result; } protected static boolean isResultRelevantIndividual(Individual individual) {
protected Set<OWLNamedIndividual> getAllNamedIndividuals() { Set<OWLNamedIndividual> result=new HashSet<OWLNamedIndividual>(); OWLDataFactory factory=getDataFactory(); for (Individual individual : m_dlOntology.getAllIndividuals()) if (isResultRelevantIndividual(individual)) result.add(factory.getOWLNamedIndividual(IRI.create(individual.getIRI()))); return result; } protected static boolean isResultRelevantIndividual(Individual individual) {
protected Node<OWLDataProperty> dataPropertyHierarchyNodeToNode(HierarchyNode<AtomicRole> hierarchyNode) { Set<OWLDataProperty> result=new HashSet<OWLDataProperty>(); OWLDataFactory factory=getDataFactory(); for (AtomicRole atomicRole : hierarchyNode.getEquivalentElements()) result.add(factory.getOWLDataProperty(IRI.create(atomicRole.getIRI()))); return new OWLDataPropertyNode(result); } protected NodeSet<OWLDataProperty> dataPropertyHierarchyNodesToNodeSet(Collection<HierarchyNode<AtomicRole>> hierarchyNodes) {
@Override public boolean isEntailed(OWLAxiom axiom) { checkPreConditions(axiom); if (!isConsistent()) return true; EntailmentChecker checker=new EntailmentChecker(this,getDataFactory()); return checker.entails(axiom); } @Override
protected Node<OWLClass> atomicConceptHierarchyNodeToNode(HierarchyNode<AtomicConcept> hierarchyNode) { Set<OWLClass> result=new HashSet<>(); OWLDataFactory factory=getDataFactory(); for (AtomicConcept concept : hierarchyNode.getEquivalentElements()) if (!Prefixes.isInternalIRI(concept.getIRI())) result.add(factory.getOWLClass(IRI.create(concept.getIRI()))); return new OWLClassNode(result); } protected NodeSet<OWLClass> atomicConceptHierarchyNodesToNodeSet(Collection<HierarchyNode<AtomicConcept>> hierarchyNodes) {
protected Node<OWLClass> atomicConceptHierarchyNodeToNode(HierarchyNode<AtomicConcept> hierarchyNode) { Set<OWLClass> result=new HashSet<OWLClass>(); OWLDataFactory factory=getDataFactory(); for (AtomicConcept concept : hierarchyNode.getEquivalentElements()) if (!Prefixes.isInternalIRI(concept.getIRI())) result.add(factory.getOWLClass(IRI.create(concept.getIRI()))); return new OWLClassNode(result); } protected NodeSet<OWLClass> atomicConceptHierarchyNodesToNodeSet(Collection<HierarchyNode<AtomicConcept>> hierarchyNodes) {
public boolean isEntailed(OWLAxiom axiom) { checkPreConditions(axiom); if (!isConsistent()) return true; EntailmentChecker checker=new EntailmentChecker(this,getDataFactory()); return checker.entails(axiom); } public boolean isEntailed(Set<? extends OWLAxiom> axioms) {
protected Node<OWLObjectPropertyExpression> objectPropertyHierarchyNodeToNode(HierarchyNode<Role> hierarchyNode) { Set<OWLObjectPropertyExpression> result=new HashSet<>(); OWLDataFactory factory=getDataFactory(); for (Role role : hierarchyNode.getEquivalentElements()) { if (role instanceof AtomicRole) result.add(factory.getOWLObjectProperty(IRI.create(((AtomicRole)role).getIRI()))); else { OWLObjectProperty ope=factory.getOWLObjectProperty(IRI.create(((InverseRole)role).getInverseOf().getIRI())); result.add(factory.getOWLObjectInverseOf(ope)); } } return new OWLObjectPropertyNode(result); } protected NodeSet<OWLObjectPropertyExpression> objectPropertyHierarchyNodesToNodeSet(Collection<HierarchyNode<Role>> hierarchyNodes) {
protected Node<OWLObjectPropertyExpression> objectPropertyHierarchyNodeToNode(HierarchyNode<Role> hierarchyNode) { Set<OWLObjectPropertyExpression> result=new HashSet<OWLObjectPropertyExpression>(); OWLDataFactory factory=getDataFactory(); for (Role role : hierarchyNode.getEquivalentElements()) { if (role instanceof AtomicRole) result.add(factory.getOWLObjectProperty(IRI.create(((AtomicRole)role).getIRI()))); else { OWLObjectPropertyExpression ope=factory.getOWLObjectProperty(IRI.create(((InverseRole)role).getInverseOf().getIRI())); result.add(factory.getOWLObjectInverseOf(ope)); } } return new OWLObjectPropertyNode(result); } protected NodeSet<OWLObjectPropertyExpression> objectPropertyHierarchyNodesToNodeSet(Collection<HierarchyNode<Role>> hierarchyNodes) {
@Override public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual namedIndividual) { checkPreConditions(namedIndividual); if (!m_isConsistent.booleanValue()) return new OWLNamedIndividualNode(getAllNamedIndividuals()); if (m_dlOntology.getAllIndividuals().isEmpty() || !m_dlOntology.containsIndividual(H(namedIndividual))) return new OWLNamedIndividualNode(namedIndividual); else { initialiseClassInstanceManager(); Set<Individual> sameIndividuals=m_instanceManager.getSameAsIndividuals(H(namedIndividual)); OWLDataFactory factory=getDataFactory(); Set<OWLNamedIndividual> result=new HashSet<>(); for (Individual individual : sameIndividuals) result.add(factory.getOWLNamedIndividual(IRI.create(individual.getIRI()))); return new OWLNamedIndividualNode(result); } } @Override
public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual namedIndividual) { checkPreConditions(namedIndividual); if (!m_isConsistent) return new OWLNamedIndividualNode(getAllNamedIndividuals()); if (m_dlOntology.getAllIndividuals().size()==0 || !m_dlOntology.containsIndividual(H(namedIndividual))) return new OWLNamedIndividualNode(namedIndividual); else { initialiseClassInstanceManager(); Set<Individual> sameIndividuals=m_instanceManager.getSameAsIndividuals(H(namedIndividual)); OWLDataFactory factory=getDataFactory(); Set<OWLNamedIndividual> result=new HashSet<OWLNamedIndividual>(); for (Individual individual : sameIndividuals) result.add(factory.getOWLNamedIndividual(IRI.create(individual.getIRI()))); return new OWLNamedIndividualNode(result); } } public NodeSet<OWLNamedIndividual> getDifferentIndividuals(OWLNamedIndividual namedIndividual) {
public boolean hasDataPropertyRelationship(OWLNamedIndividual subject,OWLDataProperty property,OWLLiteral object) { checkPreConditions(subject,property); if (!m_isConsistent) return true; OWLDataFactory factory=getDataFactory(); OWLAxiom notAssertion=factory.getOWLNegativeDataPropertyAssertionAxiom(property,subject,object); Tableau tableau=getTableau(notAssertion); boolean result=tableau.isSatisfiable(true,true,null,null,null,null,null,new ReasoningTaskDescription(true,"is {0} connected to {1} via {2}",H(subject),object,H(property))); tableau.clearAdditionalDLOntology(); return !result; } protected Set<HierarchyNode<AtomicConcept>> getDirectSuperConceptNodes(final Individual individual) {
protected boolean isAsymmetric(OWLObjectPropertyExpression propertyExpression) { checkPreConditions(propertyExpression); if (!m_isConsistent.booleanValue()) return true; OWLDataFactory factory=getDataFactory(); OWLIndividual freshIndividualA=factory.getOWLAnonymousIndividual("fresh-individual-A"); OWLIndividual freshIndividualB=factory.getOWLAnonymousIndividual("fresh-individual-B"); OWLAxiom assertion1=factory.getOWLObjectPropertyAssertionAxiom(propertyExpression,freshIndividualA,freshIndividualB); OWLAxiom assertion2=factory.getOWLObjectPropertyAssertionAxiom(propertyExpression.getInverseProperty(),freshIndividualA,freshIndividualB); Tableau tableau=getTableau(assertion1,assertion2); boolean result=tableau.isSatisfiable(true,null,null,null,null,null,new ReasoningTaskDescription(true,"asymmetry of {0}",H(propertyExpression))); tableau.clearAdditionalDLOntology(); return !result; } protected boolean isSymmetric(OWLObjectPropertyExpression propertyExpression) {
protected boolean isReflexive(OWLObjectPropertyExpression propertyExpression) { checkPreConditions(propertyExpression); if (!m_isConsistent.booleanValue()) return true; OWLDataFactory factory=getDataFactory(); OWLClass pseudoNominal=factory.getOWLClass(PSEUDO_NOMINAL); OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(propertyExpression,pseudoNominal.getObjectComplementOf()); OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual"); OWLAxiom pseudoNominalAssertion=factory.getOWLClassAssertionAxiom(pseudoNominal,freshIndividual); OWLAxiom allNotPseudoNominalAssertion=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,freshIndividual); Tableau tableau=getTableau(pseudoNominalAssertion,allNotPseudoNominalAssertion); boolean result=tableau.isSatisfiable(true,null,null,null,null,null,new ReasoningTaskDescription(true,"symmetry of {0}",H(propertyExpression))); tableau.clearAdditionalDLOntology(); return !result; } protected boolean isAsymmetric(OWLObjectPropertyExpression propertyExpression) {
protected boolean isSymmetric(OWLObjectPropertyExpression propertyExpression) { checkPreConditions(propertyExpression); if (!m_isConsistent.booleanValue() || propertyExpression.getNamedProperty().isOWLTopObjectProperty()) return true; OWLDataFactory factory=getDataFactory(); OWLClass pseudoNominal=factory.getOWLClass(PSEUDO_NOMINAL); OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(propertyExpression,pseudoNominal.getObjectComplementOf()); OWLIndividual freshIndividualA=factory.getOWLAnonymousIndividual("fresh-individual-A"); OWLIndividual freshIndividualB=factory.getOWLAnonymousIndividual("fresh-individual-B"); OWLAxiom assertion1=factory.getOWLObjectPropertyAssertionAxiom(propertyExpression,freshIndividualA,freshIndividualB); OWLAxiom assertion2=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,freshIndividualB); OWLAxiom assertion3=factory.getOWLClassAssertionAxiom(pseudoNominal,freshIndividualA); Tableau tableau=getTableau(assertion1,assertion2,assertion3); boolean result=tableau.isSatisfiable(true,null,null,null,null,null,new ReasoningTaskDescription(true,"symmetry of {0}",propertyExpression)); tableau.clearAdditionalDLOntology(); return !result; } protected boolean isTransitive(OWLObjectPropertyExpression propertyExpression) {
protected boolean isAsymmetric(OWLObjectPropertyExpression propertyExpression) { checkPreConditions(propertyExpression); if (!m_isConsistent) return true; OWLDataFactory factory=getDataFactory(); OWLIndividual freshIndividualA=factory.getOWLAnonymousIndividual("fresh-individual-A"); OWLIndividual freshIndividualB=factory.getOWLAnonymousIndividual("fresh-individual-B"); OWLAxiom assertion1=factory.getOWLObjectPropertyAssertionAxiom(propertyExpression,freshIndividualA,freshIndividualB); OWLAxiom assertion2=factory.getOWLObjectPropertyAssertionAxiom(propertyExpression.getInverseProperty(),freshIndividualA,freshIndividualB); Tableau tableau=getTableau(assertion1,assertion2); boolean result=tableau.isSatisfiable(true,null,null,null,null,null,new ReasoningTaskDescription(true,"asymmetry of {0}",H(propertyExpression))); tableau.clearAdditionalDLOntology(); return !result; } protected boolean isSymmetric(OWLObjectPropertyExpression propertyExpression) {
protected boolean isReflexive(OWLObjectPropertyExpression propertyExpression) { checkPreConditions(propertyExpression); if (!m_isConsistent) return true; OWLDataFactory factory=getDataFactory(); OWLClass pseudoNominal=factory.getOWLClass(IRI.create("internal:pseudo-nominal")); OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(propertyExpression,pseudoNominal.getObjectComplementOf()); OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual"); OWLAxiom pseudoNominalAssertion=factory.getOWLClassAssertionAxiom(pseudoNominal,freshIndividual); OWLAxiom allNotPseudoNominalAssertion=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,freshIndividual); Tableau tableau=getTableau(pseudoNominalAssertion,allNotPseudoNominalAssertion); boolean result=tableau.isSatisfiable(true,null,null,null,null,null,new ReasoningTaskDescription(true,"symmetry of {0}",H(propertyExpression))); tableau.clearAdditionalDLOntology(); return !result; } protected boolean isAsymmetric(OWLObjectPropertyExpression propertyExpression) {