Package org.semanticweb.owlapi.reasoner.impl

Examples of org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNode


                            if (getIndividualNodeSetPolicy().equals(
                                    IndividualNodeSetPolicy.BY_SAME_AS)) {
                                result.addNode(getSameIndividuals(individual
                                        .asOWLNamedIndividual()));
                            } else {
                                result.addNode(new OWLNamedIndividualNode(
                                        individual.asOWLNamedIndividual()));
                            }
                        }
                    }
                }
View Full Code Here


                    if (getIndividualNodeSetPolicy().equals(
                            IndividualNodeSetPolicy.BY_SAME_AS)) {
                        result.addNode(getSameIndividuals(axiom.getObject()
                                .asOWLNamedIndividual()));
                    } else {
                        result.addNode(new OWLNamedIndividualNode(axiom
                                .getObject().asOWLNamedIndividual()));
                    }
                }
                // Inverse of pe
                if (axiom.getObject().equals(ind)
                        && !axiom.getSubject().isAnonymous()) {
                    OWLObjectPropertyExpression invPe = axiom.getProperty()
                            .getInverseProperty().getSimplified();
                    if (!invPe.isAnonymous()
                            && inverses.contains(invPe.asOWLObjectProperty())) {
                        if (getIndividualNodeSetPolicy().equals(
                                IndividualNodeSetPolicy.BY_SAME_AS)) {
                            result.addNode(getSameIndividuals(axiom.getObject()
                                    .asOWLNamedIndividual()));
                        } else {
                            result.addNode(new OWLNamedIndividualNode(axiom
                                    .getObject().asOWLNamedIndividual()));
                        }
                    }
                }
            }
View Full Code Here

            }
        }
        if (inds.isEmpty()) {
            inds.add(ind);
        }
        return new OWLNamedIndividualNode(inds);
    }
View Full Code Here

        }
    }
    public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression classExpression,boolean direct) {
        checkPreConditions(classExpression);
        if (!m_isConsistent) {
            Node<OWLNamedIndividual> node=new OWLNamedIndividualNode(getAllNamedIndividuals());
            return new OWLNamedIndividualNodeSet(Collections.singleton(node));
        }
        realise();
        Set<Individual> result=new HashSet<Individual>();
        if (classExpression instanceof OWLClass) {
            AtomicConcept concept=H((OWLClass)classExpression);
            Set<Individual> directInstances=m_realization.get(concept);
            if (directInstances!=null)
                for (Individual instance : directInstances)
                    if (isResultRelevantIndividual(instance))
                        result.add(instance);
            if (!direct) {
                HierarchyNode<AtomicConcept> node=m_atomicConceptHierarchy.getNodeForElement(concept);
                if (node!=null)
                    for (HierarchyNode<AtomicConcept> descendantNode : node.getDescendantNodes())
                        loadIndividualsOfNode(descendantNode,result);
            }
        }
        else {
            HierarchyNode<AtomicConcept> hierarchyNode=getHierarchyNode(classExpression);
            loadIndividualsOfNode(hierarchyNode,result);
            if (!direct)
                for (HierarchyNode<AtomicConcept> descendantNode : hierarchyNode.getDescendantNodes())
                    loadIndividualsOfNode(descendantNode,result);
            OWLDataFactory factory=getDataFactory();
            OWLClass queryClass=factory.getOWLClass(IRI.create("internal:query-concept"));
            OWLAxiom queryClassDefinition=factory.getOWLSubClassOfAxiom(queryClass,classExpression.getObjectComplementOf());
            Tableau tableau=getTableau(queryClassDefinition);
            AtomicConcept queryConcept=AtomicConcept.create("internal:query-concept");
            Set<HierarchyNode<AtomicConcept>> visitedNodes=new HashSet<HierarchyNode<AtomicConcept>>(hierarchyNode.getChildNodes());
            List<HierarchyNode<AtomicConcept>> toVisit=new ArrayList<HierarchyNode<AtomicConcept>>(hierarchyNode.getParentNodes());
            while (!toVisit.isEmpty()) {
                HierarchyNode<AtomicConcept> node=toVisit.remove(toVisit.size()-1);
                if (visitedNodes.add(node)) {
                    AtomicConcept nodeAtomicConcept=node.getRepresentative();
                    Set<Individual> realizationForNodeConcept=m_realization.get(nodeAtomicConcept);
                    if (realizationForNodeConcept!=null)
                        for (Individual individual : realizationForNodeConcept)
                            if (isResultRelevantIndividual(individual))
                                if (!tableau.isSatisfiable(true,true,Collections.singleton(Atom.create(queryConcept,individual)),null,null,null,null,ReasoningTaskDescription.isInstanceOf(individual,classExpression)))
                                    result.add(individual);
                    toVisit.addAll(node.getChildNodes());
                }
            }
        }
        return sortBySameAsIfNecessary(result);
    }
View Full Code Here

        }
        return sortBySameAsIfNecessary(result);
    }
    public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual namedIndividual) {
        checkPreConditions(namedIndividual);
        if (!m_isConsistent) return new OWLNamedIndividualNode(getAllNamedIndividuals());
        Set<Individual> sameIndividuals=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);
    }
View Full Code Here

        return new OWLNamedIndividualNode(result);
    }
    public NodeSet<OWLNamedIndividual> getDifferentIndividuals(OWLNamedIndividual namedIndividual) {
        checkPreConditions(namedIndividual);
        if (!m_isConsistent) {
            Node<OWLNamedIndividual> node=new OWLNamedIndividualNode(getAllNamedIndividuals());
            return new OWLNamedIndividualNodeSet(Collections.singleton(node));
        }
        Individual individual=H(namedIndividual);
        Tableau tableau=getTableau();
        Set<Individual> result=new HashSet<Individual>();
View Full Code Here

        return sortBySameAsIfNecessary(result);
    }
    public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual namedIndividual,OWLObjectPropertyExpression propertyExpression) {
        checkPreConditions(namedIndividual,propertyExpression);
        if (!m_isConsistent) {
            Node<OWLNamedIndividual> node=new OWLNamedIndividualNode(getAllNamedIndividuals());
            return new OWLNamedIndividualNodeSet(Collections.singleton(node));
        }
        OWLDataFactory factory=getDataFactory();
        return getInstances(factory.getOWLObjectHasValue(propertyExpression.getInverseProperty(),namedIndividual),false);
    }
View Full Code Here

                sameNamedIndividuals.add(factory.getOWLNamedIndividual(IRI.create(individual.getIRI())));
                for (Individual sameIndividual : sameIndividuals) {
                    individuals.remove(sameIndividual);
                    sameNamedIndividuals.add(factory.getOWLNamedIndividual(IRI.create(sameIndividual.getIRI())));
                }
                result.add(new OWLNamedIndividualNode(sameNamedIndividuals));
            }
        }
        else {
            for (Individual individual : individuals)
                result.add(new OWLNamedIndividualNode(factory.getOWLNamedIndividual(IRI.create(individual.getIRI()))));
        }
        return new OWLNamedIndividualNodeSet(result);
    }
View Full Code Here

                        if (!individual.isAnonymous()) {
                            if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                                result.addNode(getSameIndividuals(individual.asOWLNamedIndividual()));
                            }
                            else {
                                result.addNode(new OWLNamedIndividualNode(individual.asOWLNamedIndividual()));
                            }
                        }
                    }
                }
            }
View Full Code Here

                    if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) {
                        if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                            result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
                        }
                        else {
                            result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
                        }
                    }
                }
                // Inverse of pe
                if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) {
                    OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified();
                    if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) {
                        if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                            result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
                        }
                        else {
                            result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
                        }
                    }
                }

            }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.