Package org.semanticweb.HermiT.model

Examples of org.semanticweb.HermiT.model.AtomicRole


        }
    }
    protected void loadDLClausesIntoGraph(Set<DLClause> dlClauses,Graph<Role> superRoleGraph,Set<Role> functionalRoles) {
        for (DLClause dlClause : dlClauses) {
            if (dlClause.getClauseType()==ClauseType.OBJECT_PROPERTY_INCLUSION || dlClause.getClauseType()==ClauseType.DATA_PROPERTY_INCLUSION) {
                AtomicRole subrole=(AtomicRole)dlClause.getBodyAtom(0).getDLPredicate();
                AtomicRole superrole=(AtomicRole)dlClause.getHeadAtom(0).getDLPredicate();
                superRoleGraph.addEdge(subrole,superrole);
                superRoleGraph.addEdge(subrole.getInverse(),superrole.getInverse());
            }
            else if (dlClause.getClauseType()==ClauseType.INVERSE_OBJECT_PROPERTY_INCLUSION) {
                AtomicRole subrole=(AtomicRole)dlClause.getBodyAtom(0).getDLPredicate();
                AtomicRole superrole=(AtomicRole)dlClause.getHeadAtom(0).getDLPredicate();
                superRoleGraph.addEdge(subrole,superrole.getInverse());
                superRoleGraph.addEdge(subrole.getInverse(),superrole);
            }
            else if (dlClause.isFunctionalityAxiom()) {
                AtomicRole atomicRole=(AtomicRole)dlClause.getBodyAtom(0).getDLPredicate();
                functionalRoles.add(atomicRole);
            }
            else if (dlClause.isInverseFunctionalityAxiom()) {
                AtomicRole atomicRole=(AtomicRole)dlClause.getBodyAtom(0).getDLPredicate();
                functionalRoles.add(atomicRole.getInverse());
            }
        }
    }
View Full Code Here


                    m_consequencesForBlockedX[i]=new SimpleConsequenceAtom(predicate,new ArgumentType[] { ArgumentType.YVAR,ArgumentType.YVAR,ArgumentType.XVAR },new int[] { var1Index,var2Index,0 });
                    m_consequencesForNonblockedX[i]=m_consequencesForBlockedX[i];
                } else if (predicate instanceof AtomicRole) {
                    // R(x, x), R(x,yi), R(yi,x), R(x,zj), R(zj,x)
                    assert predicate instanceof AtomicRole;
                    AtomicRole role=(AtomicRole)predicate;
                    if (X==var1 && X==var2) {
                        m_consequencesForBlockedX[i]=new SimpleConsequenceAtom(predicate,new ArgumentType[] { ArgumentType.XVAR,ArgumentType.XVAR },new int[] { 0,0 });
                        m_consequencesForNonblockedX[i]=m_consequencesForBlockedX[i];
                    } else {
                        assert var1==X || var2==X;
View Full Code Here

        retrieval.getBindingsBuffer()[1]=node;
        retrieval.open();
        while (!retrieval.afterLast()) {
            Object atomicRoleObject=retrieval.getTupleBuffer()[0];
            if (atomicRoleObject instanceof AtomicRole) {
                AtomicRole atomicRole=(AtomicRole)retrieval.getTupleBuffer()[0];
                Node toNode=(Node)retrieval.getTupleBuffer()[2];
                Set<AtomicRole> set=outgoingEdges.get(toNode);
                if (set==null) {
                    set=new TreeSet<AtomicRole>(RoleComparator.INSTANCE);
                    outgoingEdges.put(toNode,set);
                }
                set.add(atomicRole);
            }
            retrieval.next();
        }
        if (!outgoingEdges.isEmpty()) {
            writer.println("-- Outgoing edges --------------------------------");
            printEdgeMap(debugger,outgoingEdges,writer);
        }
        Map<Node,Set<AtomicRole>> incomingEdges=new TreeMap<Node,Set<AtomicRole>>(NodeComparator.INSTANCE);
        retrieval=debugger.getTableau().getExtensionManager().getTernaryExtensionTable().createRetrieval(new boolean[] { false,false,true },ExtensionTable.View.TOTAL);
        retrieval.getBindingsBuffer()[2]=node;
        retrieval.open();
        while (!retrieval.afterLast()) {
            Object atomicRoleObject=retrieval.getTupleBuffer()[0];
            if (atomicRoleObject instanceof AtomicRole) {
                AtomicRole atomicRole=(AtomicRole)retrieval.getTupleBuffer()[0];
                Node fromNode=(Node)retrieval.getTupleBuffer()[1];
                Set<AtomicRole> set=incomingEdges.get(fromNode);
                if (set==null) {
                    set=new TreeSet<AtomicRole>(RoleComparator.INSTANCE);
                    incomingEdges.put(fromNode,set);
View Full Code Here

        return AtomicRole.create(((OWLDataProperty)dataPropertyExpression).getIRI().toString());
    }
    protected static Atom getRoleAtom(OWLObjectPropertyExpression objectProperty,Term first,Term second) {
        objectProperty=objectProperty.getSimplified();
        if (!objectProperty.isAnonymous()) {
            AtomicRole role=AtomicRole.create(objectProperty.asOWLObjectProperty().getIRI().toString());
            return Atom.create(role,first,second);
        }
        else if (objectProperty.isAnonymous()) {
            OWLObjectProperty internalObjectProperty=objectProperty.getNamedProperty();
            AtomicRole role=AtomicRole.create(internalObjectProperty.getIRI().toString());
            return Atom.create(role,second,first);
        }
        else
            throw new IllegalStateException("Internal error: unsupported type of object property!");
    }
View Full Code Here

        else
            throw new IllegalStateException("Internal error: unsupported type of object property!");
    }
    protected static Atom getRoleAtom(OWLDataPropertyExpression dataProperty,Term first,Term second) {
        if (dataProperty instanceof OWLDataProperty) {
            AtomicRole property=AtomicRole.create(((OWLDataProperty)dataProperty).getIRI().toString());
            return Atom.create(property,first,second);
        }
        else
            throw new IllegalStateException("Internal error: unsupported type of data property!");
    }
View Full Code Here

                retrieval.open();
                Object[] tupleBuffer=retrieval.getTupleBuffer();
                while (!retrieval.afterLast()) {
                    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 {
View Full Code Here

        for (DLClause dlClause : dlClauses) {
            if (dlClause.getHeadLength()==1 && dlClause.getBodyLength()==1) {
                DLPredicate headPredicate=dlClause.getHeadAtom(0).getDLPredicate();
                DLPredicate bodyPredicate=dlClause.getBodyAtom(0).getDLPredicate();
                if (headPredicate instanceof AtomicRole && m_conceptsForRoles.containsKey(headPredicate) && bodyPredicate instanceof AtomicRole && m_conceptsForRoles.containsKey(bodyPredicate)) {
                    AtomicRole headRole=(AtomicRole)headPredicate;
                    AtomicRole bodyRole=(AtomicRole)bodyPredicate;
                    AtomicConcept conceptForHeadRole=m_conceptsForRoles.get(headRole);
                    AtomicConcept conceptForBodyRole=m_conceptsForRoles.get(bodyRole);
                    assert conceptForBodyRole!=null;
                    assert conceptForHeadRole!=null;
                    if (dlClause.getBodyAtom(0).getArgument(0)!=dlClause.getHeadAtom(0).getArgument(0)) {
                        // r -> s^- and r^- -> s
                        AtomicConcept conceptForBodyInvRole=m_conceptsForRoles.get(bodyRole.getInverse());
                        addKnownSubsumption(conceptForBodyInvRole,conceptForHeadRole);
                    }
                    else {
                        // r-> s and r^- -> s^-
                        addKnownSubsumption(conceptForBodyRole,conceptForHeadRole);
View Full Code Here

        else
            individual=Individual.create(owlIndividual.asOWLNamedIndividual().getIRI().toString());
        return m_dlOntology.containsIndividual(individual);
    }
    public boolean isDefined(OWLObjectProperty owlObjectProperty) {
        AtomicRole atomicRole=AtomicRole.create(owlObjectProperty.getIRI().toString());
        return m_dlOntology.containsObjectRole(atomicRole) || AtomicRole.TOP_OBJECT_ROLE.equals(owlObjectProperty) || AtomicRole.BOTTOM_OBJECT_ROLE.equals(owlObjectProperty);
    }
View Full Code Here

    public boolean isDefined(OWLObjectProperty owlObjectProperty) {
        AtomicRole atomicRole=AtomicRole.create(owlObjectProperty.getIRI().toString());
        return m_dlOntology.containsObjectRole(atomicRole) || AtomicRole.TOP_OBJECT_ROLE.equals(owlObjectProperty) || AtomicRole.BOTTOM_OBJECT_ROLE.equals(owlObjectProperty);
    }
    public boolean isDefined(OWLDataProperty owlDataProperty) {
        AtomicRole atomicRole=AtomicRole.create(owlDataProperty.getIRI().toString());
        return m_dlOntology.containsDataRole(atomicRole) || AtomicRole.TOP_DATA_ROLE.equals(atomicRole) || AtomicRole.BOTTOM_DATA_ROLE.equals(atomicRole);
    }
View Full Code Here

    }
    public boolean isSubDataPropertyOf(OWLDataProperty subDataProperty,OWLDataProperty superDataProperty) {
        checkPreConditions(subDataProperty,superDataProperty);
        if (!m_isConsistent || subDataProperty.isOWLBottomDataProperty() || superDataProperty.isOWLTopDataProperty())
            return true;
        AtomicRole subrole=H(subDataProperty);
        AtomicRole superrole=H(superDataProperty);
        if (m_dataRoleHierarchy!=null && !containsFreshEntities(subDataProperty,superDataProperty)) {
            HierarchyNode<AtomicRole> subroleNode=m_dataRoleHierarchy.getNodeForElement(subrole);
            return subroleNode.isEquivalentElement(superrole) || subroleNode.isAncestorElement(superrole);
        }
        else {
View Full Code Here

TOP

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

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.