Package org.semanticweb.HermiT.model

Examples of org.semanticweb.HermiT.model.Individual


    }
    protected Node getNodeForTerm(Map<Term,Node> termsToNodes,Term term,DependencySet dependencySet) {
        Node node=termsToNodes.get(term);
        if (node==null) {
            if (term instanceof Individual) {
                Individual individual=(Individual)term;
                if (individual.isAnonymous())
                    node=createNewNINode(dependencySet);
                else
                    node=createNewNamedNode(dependencySet);
            }
            else {
View Full Code Here


        Set<AtomicRole> atomicDataRoles=new HashSet<AtomicRole>();
        for (OWLClass owlClass : axioms.m_classes)
            atomicConcepts.add(AtomicConcept.create(owlClass.getIRI().toString()));
        Set<Individual> individuals=new HashSet<Individual>();
        for (OWLNamedIndividual owlIndividual : axioms.m_namedIndividuals) {
            Individual individual=Individual.create(owlIndividual.getIRI().toString());
            individuals.add(individual);
            // all named individuals are tagged with a concept, so that keys/rules are
            // only applied to them
            if (!axioms.m_hasKeys.isEmpty() || !axioms.m_rules.isEmpty())
                positiveFacts.add(Atom.create(AtomicConcept.INTERNAL_NAMED,individual));
View Full Code Here

                    Object roleObject=tupleBuffer[0];
                    if (roleObject instanceof AtomicRole) {
                        AtomicRole atomicrole=(AtomicRole)roleObject;
                        Node node2=(Node)tupleBuffer[2];
                        if (node2.isActive() && node2.getNodeType()==NodeType.NAMED_NODE && individualsForNodes.containsKey(node2)) {
                            Individual successor=individualsForNodes.get(node2);
                            Map<AtomicRole,Map<Individual,Set<Individual>>> relevantRelations;
                            if (retrieval.getDependencySet().isEmpty())
                                relevantRelations=knownObjectPropertyRelations;
                            else
                                relevantRelations=possibleObjectPropertyRelations;
                            Map<Individual,Set<Individual>> relationsForRole=relevantRelations.get(atomicrole);
                            if (relationsForRole==null) {
                                relationsForRole=new HashMap<Individual, Set<Individual>>();
                                relevantRelations.put(atomicrole, relationsForRole);
                            }
                            Set<Individual> successors=relationsForRole.get(ind);
                            if (successors==null) {
                                successors=new HashSet<Individual>();
                                relationsForRole.put(ind, successors);
                            }
                            successors.add(successor);
                        }
                    }
                    retrieval.next();
                }
                // add more possible relations for complex properties
                String indIRI=ind.getIRI();
                AtomicConcept conceptForRole;
                for (Role objectRole : complexObjectRoles) {
                    if (objectRole instanceof AtomicRole) {
                        conceptForRole=AtomicConcept.create("internal:individual-concept#"+((AtomicRole)objectRole).getIRI()+"#"+indIRI);
                    } else {
                        conceptForRole=AtomicConcept.create("internal:individual-concept#inv#"+((InverseRole)objectRole).getInverseOf().getIRI()+"#"+indIRI);
                    }
                    retrieval=tableau.getExtensionManager().getBinaryExtensionTable().createRetrieval(new boolean[] { true,false },ExtensionTable.View.TOTAL);
                    retrieval.getBindingsBuffer()[0]=conceptForRole;
                    retrieval.open();
                    tupleBuffer=retrieval.getTupleBuffer();
                    while (!retrieval.afterLast()) {
                        Node node=(Node)tupleBuffer[1];
                        if (node.isActive() && node.getNodeType()==NodeType.NAMED_NODE && individualsForNodes.containsKey(node)) {
                            AtomicRole atomicrole;
                            Individual first=ind;
                            Individual second=individualsForNodes.get(node);
                            if (objectRole instanceof AtomicRole) {
                                atomicrole=(AtomicRole)objectRole;
                            } else {
                                atomicrole=((InverseRole)objectRole).getInverseOf();
                                Individual tmp=second;
                                second=first;
                                first=tmp;
                            }
                            Map<AtomicRole,Map<Individual,Set<Individual>>> relevantRelations;
                            if (retrieval.getDependencySet().isEmpty())
View Full Code Here

        m_elements=elements;
    }
    public Hierarchy<AtomicConcept> classify() {
        if (!m_tableau.isDeterministic())
            throw new IllegalStateException("Internal error: DeterministicClassificationManager can be used only with a deterministic tableau.");
        Individual freshIndividual=Individual.createAnonymous("fresh-individual");
        if (!m_tableau.isSatisfiable(true,Collections.singleton(Atom.create(m_topElement,freshIndividual)),null,null,null,null,ReasoningTaskDescription.isConceptSatisfiable(m_topElement)))
            return Hierarchy.emptyHierarchy(m_elements,m_topElement,m_bottomElement);
        Map<AtomicConcept,GraphNode<AtomicConcept>> allSubsumers=new HashMap<AtomicConcept,GraphNode<AtomicConcept>>();
        for (AtomicConcept element : m_elements) {
            Set<AtomicConcept> subsumers;
View Full Code Here

    public boolean isDefined(OWLClass owlClass) {
        AtomicConcept atomicConcept=AtomicConcept.create(owlClass.getIRI().toString());
        return m_dlOntology.containsAtomicConcept(atomicConcept) || AtomicConcept.THING.equals(atomicConcept) || AtomicConcept.NOTHING.equals(atomicConcept);
    }
    public boolean isDefined(OWLIndividual owlIndividual) {
        Individual individual;
        if (owlIndividual.isAnonymous())
            individual=Individual.createAnonymous(owlIndividual.asOWLAnonymousIndividual().getID().toString());
        else
            individual=Individual.create(owlIndividual.asOWLNamedIndividual().getIRI().toString());
        return m_dlOntology.containsIndividual(individual);
View Full Code Here

                HierarchyNode<AtomicConcept> subconceptNode=m_atomicConceptHierarchy.getNodeForElement(subconcept);
                return subconceptNode.isEquivalentElement(superconcept) || subconceptNode.isAncestorElement(superconcept);
            }
            else {
                Tableau tableau=getTableau();
                Individual freshIndividual=Individual.createAnonymous("fresh-individual");
                Atom subconceptAssertion=Atom.create(subconcept,freshIndividual);
                Atom superconceptAssertion=Atom.create(superconcept,freshIndividual);
                return !tableau.isSatisfiable(true,Collections.singleton(subconceptAssertion),Collections.singleton(superconceptAssertion),null,null,null,ReasoningTaskDescription.isConceptSubsumedBy(subconcept,superconcept));
            }
        }
View Full Code Here

            OWLClass queryConcept=factory.getOWLClass(IRI.create("internal:query-concept"));
            OWLAxiom classDefinitionAxiom=factory.getOWLEquivalentClassesAxiom(queryConcept,classExpression);
            final Tableau tableau=getTableau(classDefinitionAxiom);
            HierarchySearch.Relation<AtomicConcept> hierarchyRelation=new HierarchySearch.Relation<AtomicConcept>() {
                public boolean doesSubsume(AtomicConcept parent,AtomicConcept child) {
                    Individual freshIndividual=Individual.createAnonymous("fresh-individual");
                    return !tableau.isSatisfiable(true,Collections.singleton(Atom.create(child,freshIndividual)),null,null,Collections.singleton(Atom.create(parent,freshIndividual)),null,ReasoningTaskDescription.isConceptSubsumedBy(child,parent));
                }
            };
            return HierarchySearch.findPosition(hierarchyRelation,AtomicConcept.create("internal:query-concept"),m_atomicConceptHierarchy.getTopNode(),m_atomicConceptHierarchy.getBottomNode());
        }
View Full Code Here

        if (!isConsistent())
            return new OWLClassNodeSet(getBottomClassNode());
        final Role role=H(propertyExpression);
        Set<HierarchyNode<AtomicConcept>> nodes=m_directObjectRoleDomains.get(role);
        if (nodes==null) {
            final Individual freshIndividualA=Individual.createAnonymous("fresh-individual-A");
            final Individual freshIndividualB=Individual.createAnonymous("fresh-individual-B");
            final Set<Atom> roleAssertion=Collections.singleton(role.getRoleAssertion(freshIndividualA,freshIndividualB));
            final Tableau tableau=getTableau();
            HierarchySearch.SearchPredicate<HierarchyNode<AtomicConcept>> searchPredicate=new HierarchySearch.SearchPredicate<HierarchyNode<AtomicConcept>>() {
                public Set<HierarchyNode<AtomicConcept>> getSuccessorElements(HierarchyNode<AtomicConcept> u) {
                    return u.getChildNodes();
View Full Code Here

        if (!isConsistent())
            return new OWLClassNodeSet(getBottomClassNode());
        final Role role=H(propertyExpression);
        Set<HierarchyNode<AtomicConcept>> nodes=m_directObjectRoleRanges.get(role);
        if (nodes==null) {
            final Individual freshIndividualA=Individual.createAnonymous("fresh-individual-A");
            final Individual freshIndividualB=Individual.createAnonymous("fresh-individual-B");
            final Set<Atom> roleAssertion=Collections.singleton(role.getRoleAssertion(freshIndividualA,freshIndividualB));
            final Tableau tableau=getTableau();
            HierarchySearch.SearchPredicate<HierarchyNode<AtomicConcept>> searchPredicate=new HierarchySearch.SearchPredicate<HierarchyNode<AtomicConcept>>() {
                public Set<HierarchyNode<AtomicConcept>> getSuccessorElements(HierarchyNode<AtomicConcept> u) {
                    return u.getChildNodes();
View Full Code Here

            if (!direct)
                result.addAll(node.getDescendantNodes());
            return objectPropertyHierarchyNodesToNodeSet(result);
        }
        Role role=H(propertyExpression);
        Individual freshIndividualA=Individual.createAnonymous("fresh-individual-A");
        Individual freshIndividualB=Individual.createAnonymous("fresh-individual-B");
        Atom roleAssertion=role.getRoleAssertion(freshIndividualA,freshIndividualB);
        Tableau tableau=getTableau();
        Set<HierarchyNode<Role>> nodesToTest=new HashSet<HierarchyNode<Role>>();
        nodesToTest.addAll(m_objectRoleHierarchy.getTopNode().getChildNodes());
        while (!nodesToTest.isEmpty()) {
View Full Code Here

TOP

Related Classes of org.semanticweb.HermiT.model.Individual

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.