Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDataFactory


        if (m_dataRoleHierarchy!=null && !containsFreshEntities(subDataProperty,superDataProperty)) {
            HierarchyNode<AtomicRole> subroleNode=m_dataRoleHierarchy.getNodeForElement(subrole);
            return subroleNode.isEquivalentElement(superrole) || subroleNode.isAncestorElement(superrole);
        }
        else {
            OWLDataFactory factory=getDataFactory();
            OWLIndividual individual=factory.getOWLAnonymousIndividual("fresh-individual");
            OWLTypedLiteral freshConstant=factory.getOWLTypedLiteral("internal:fresh-constant",factory.getOWLDatatype(IRI.create("internal:anonymous-constants")));
            OWLDataProperty negatedSuperDataProperty=factory.getOWLDataProperty(IRI.create("internal:negated-superproperty"));
            OWLAxiom subpropertyAssertion=factory.getOWLDataPropertyAssertionAxiom(subDataProperty,individual,freshConstant);
            OWLAxiom negatedSuperpropertyAssertion=factory.getOWLDataPropertyAssertionAxiom(negatedSuperDataProperty,individual,freshConstant);
            OWLAxiom superpropertyAxiomatization=factory.getOWLDisjointDataPropertiesAxiom(superDataProperty,negatedSuperDataProperty);
            Tableau tableau=getTableau(subpropertyAssertion,negatedSuperpropertyAssertion,superpropertyAxiomatization);
            return !tableau.isSatisfiable(true,null,null,null,null,null,ReasoningTaskDescription.isRoleSubsumedBy(subrole,superrole,false));
        }
    }
View Full Code Here


            if (result.isEmpty())
                result.add(m_dataRoleHierarchy.getBottomNode());
            return dataPropertyHierarchyNodesToNodeSet(result);
        }
        else {
            OWLDataFactory factory=getDataFactory();
            if (propertyExpression.isOWLTopDataProperty() && isConsistent())
                return new OWLDataPropertyNodeSet(new OWLDataPropertyNode(factory.getOWLBottomDataProperty()));
            else if (propertyExpression.isOWLBottomDataProperty() && isConsistent())
                return new OWLDataPropertyNodeSet(new OWLDataPropertyNode(factory.getOWLTopDataProperty()));
            else
                return new OWLDataPropertyNodeSet();
        }
    }
View Full Code Here

            Individual individual=H(namedIndividual);
            AtomicConcept atomicConcept=H((OWLClass)type);
            return !getTableau().isSatisfiable(true,true,null,Collections.singleton(Atom.create(atomicConcept,individual)),null,null,null,ReasoningTaskDescription.isInstanceOf(individual,atomicConcept));
        }
        else {
            OWLDataFactory factory=getDataFactory();
            OWLAxiom negatedAssertionAxiom=factory.getOWLClassAssertionAxiom(type.getObjectComplementOf(),namedIndividual);
            Tableau tableau=getTableau(negatedAssertionAxiom);
            return !tableau.isSatisfiable(true,true,null,null,null,null,null,ReasoningTaskDescription.isInstanceOf(namedIndividual,type));
        }
    }
View Full Code Here

            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()) {
View Full Code Here

    }
    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

        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

    }
    public Set<OWLLiteral> getDataPropertyValues(OWLNamedIndividual namedIndividual,OWLDataProperty property) {
        checkPreConditions(namedIndividual,property);
        Set<OWLLiteral> result=new HashSet<OWLLiteral>();
        if (m_dlOntology.hasDatatypes()) {
            OWLDataFactory factory=getDataFactory();
            Individual individual=H(namedIndividual);
            for (OWLDataProperty dataProperty : getDescendantDataProperties(property).getFlattened()) {
                AtomicRole atomicRole=H(dataProperty);
                Map<Individual,Set<Constant>> dataPropertyAssertions=m_dlOntology.getDataPropertyAssertions().get(atomicRole);
                if (dataPropertyAssertions!=null) {
                    if (dataPropertyAssertions.containsKey(individual)) {
                        for (Constant constant : dataPropertyAssertions.get(individual)) {
                            String lexicalForm=constant.getLexicalForm();
                            String datatypeURI=constant.getDatatypeURI();
                            OWLLiteral literal;
                            if ((Prefixes.s_semanticWebPrefixes.get("xsd")+"string").equals(datatypeURI))
                                literal=factory.getOWLStringLiteral(lexicalForm);
                            else if ((Prefixes.s_semanticWebPrefixes.get("rdf")+"PlainLiteral").equals(datatypeURI)) {
                                int atPosition=lexicalForm.lastIndexOf('@');
                                literal=factory.getOWLStringLiteral(lexicalForm.substring(0,atPosition),lexicalForm.substring(atPosition+1));
                            }
                            else
                                literal=factory.getOWLTypedLiteral(lexicalForm,factory.getOWLDatatype(IRI.create(datatypeURI)));
                            result.add(literal);
                        }
                    }
                }
            }
View Full Code Here

            for (OWLNamedIndividual ind : getAllNamedIndividuals()) {
                result.put(ind, getAllNamedIndividuals());
            }
            return result;
        }
        OWLDataFactory factory=getDataFactory();
        AtomicRole role=H(property);
        initializeKnownAndPossibleRelations();
        // If an individual is declared, but not used in a logical axiom, it can still be related
        // e.g., {ReflexiveObjectProperty(r)} entails r(a,a) even if a if not used in a logical axiom
        Map<Individual,Set<Individual>> relations=m_possibleObjectPropertyRelations.get(role);
        if (relations!=null) {
            Set<Individual> toTest=relations.keySet();
            for (Individual individual : toTest) {
                Set<Individual> toTestSuccessors=relations.get(individual);
                for (Individual successorIndividual : toTestSuccessors) {               
                    OWLClass pseudoNominal=factory.getOWLClass(IRI.create("internal:pseudo-nominal"));
                    OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(property,pseudoNominal.getObjectComplementOf());
                    OWLAxiom allNotPseudoNominalAssertion=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,factory.getOWLNamedIndividual(IRI.create(individual.getIRI())));
                    OWLAxiom pseudoNominalAssertion=factory.getOWLClassAssertionAxiom(pseudoNominal,factory.getOWLNamedIndividual(IRI.create(successorIndividual.getIRI())));
                    Tableau tableau=getTableau(allNotPseudoNominalAssertion,pseudoNominalAssertion);
                    if (!tableau.isSatisfiable(true,true,null,null,null,null,null,new ReasoningTaskDescription(true,"is {0} connected to {1} via {2}",individual,successorIndividual,property))) {
                        Map<Individual,Set<Individual>> newKnownRelations=m_knownObjectPropertyRelations.get(role);
                        if (newKnownRelations==null) {
                            newKnownRelations=new HashMap<Individual, Set<Individual>>();
                            m_knownObjectPropertyRelations.put(role,newKnownRelations);
                        }
                        Set<Individual> successors=newKnownRelations.get(individual);
                        if (successors==null) {
                            successors=new HashSet<Individual>();
                            newKnownRelations.put(individual,successors);
                        }
                        successors.add(successorIndividual);
                    }
                }
            }
            // remove from possibles, all tested now
            m_possibleObjectPropertyRelations.remove(role);
        }
        relations=m_knownObjectPropertyRelations.get(role);
        if (relations!=null) {
            for (Individual individual : relations.keySet()) {
                Set<OWLNamedIndividual> successors=new HashSet<OWLNamedIndividual>();
                result.put(factory.getOWLNamedIndividual(IRI.create(individual.getIRI())), successors);
                for (Individual successorIndividual : relations.get(individual)) {
                    successors.add(factory.getOWLNamedIndividual(IRI.create(successorIndividual.getIRI())));
                }
            }
        }
        return result;
    }
View Full Code Here

        if (propertyExpression.getSimplified().isAnonymous()) {
            OWLNamedIndividual tmp=subject;
            subject=object;
            object=tmp;
        }
        OWLDataFactory factory=getDataFactory();
        AtomicRole role=H(property);
        Individual subj=H(subject);
        Individual obj=H(object);
        boolean testEvenIfNotPossible=false;
        Map<Individual,Set<Individual>> relations=null;
        if (!getAllNamedIndividuals().contains(subject) || !getAllNamedIndividuals().contains(object)) {
            // e.g. {ReflexiveObjectProperty(r)} entails {r(a,a)} even for unknown a
            testEvenIfNotPossible=true;
        } else {
            initializeKnownAndPossibleRelations();
            relations=m_possibleObjectPropertyRelations.get(role);
        }
        if (testEvenIfNotPossible || relations!=null) {
            if (testEvenIfNotPossible || relations.containsKey(subj)) {
                Set<Individual> possibleSuccessors=relations.get(subj);
                if (testEvenIfNotPossible || possibleSuccessors.contains(obj)) {
                    OWLClass pseudoNominal=factory.getOWLClass(IRI.create("internal:pseudo-nominal"));
                    OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(property,pseudoNominal.getObjectComplementOf());
                    OWLAxiom allNotPseudoNominalAssertion=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,subject);
                    OWLAxiom pseudoNominalAssertion=factory.getOWLClassAssertionAxiom(pseudoNominal,object);
                    Tableau tableau=getTableau(allNotPseudoNominalAssertion,pseudoNominalAssertion);
                    if (!tableau.isSatisfiable(true,true,null,null,null,null,null,new ReasoningTaskDescription(true,"is {0} connected to {1} via {2}",subj,obj,property))) {
                        if (testEvenIfNotPossible) {
                            return true;
                        } else {
View Full Code Here

        else return false;
    }
    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);
        return !tableau.isSatisfiable(true,true,null,null,null,null,null,new ReasoningTaskDescription(true,"is {0} connected to {1} via {2}",H(subject),object,H(property)));
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLDataFactory

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.