Package org.semanticweb.HermiT.tableau

Examples of org.semanticweb.HermiT.tableau.Node


    }
    public void clear() {
        m_directBlockingChecker.clear();
    }
    public void computeBlocking(boolean finalChance) {
        Node node=m_tableau.getFirstTableauNode();
        while (node!=null) {
            if (node.isActive()) {
                Node parent=node.getParent();
                if (parent==null)
                    node.setBlocked(null,false);
                else if (parent.isBlocked())
                    node.setBlocked(parent,false);
                else if (m_useBlockingSignatureCache && m_blockingSignatureCache!=null && m_blockingSignatureCache.containsSignature(node))
                    node.setBlocked(Node.SIGNATURE_CACHE_BLOCKER,true);
                else
                    checkParentBlocking(node);
View Full Code Here


    }
    public boolean computeIsBlocked(Node node) {
        throw new UnsupportedOperationException("Unsupported operation: Ancestor blocking cannot be used with a lazy expansion strategy. ");
    }
    protected final void checkParentBlocking(Node node) {
        Node blocker=node.getParent();
        while (blocker!=null) {
            if (m_directBlockingChecker.isBlockedBy(blocker,node)) {
                node.setBlocked(blocker,true);
                break;
            }
            blocker=blocker.getParent();
        }
    }
View Full Code Here

        try {
            atomicConcept=AtomicConcept.create(m_debugger.getPrefixes().expandAbbreviatedIRI(conceptName));
            writer.println("Nodes for '"+conceptName+"'");
            writer.println("====================================================================");
            int index=0;
            Node node=m_debugger.getTableau().getFirstTableauNode();
            while (node!=null) {
                Debugger.NodeCreationInfo nodeCreationInfo=m_debugger.getNodeCreationInfo(node);
                ExistentialConcept existentialConcept=nodeCreationInfo.m_createdByExistential;
                if (existentialConcept instanceof AtLeastConcept) {
                    if (((AtLeastConcept)existentialConcept).getToConcept().equals(atomicConcept)) {
                        if (index!=0) {
                            writer.print(",");
                            if (index%5==0)
                                writer.println();
                            else
                                writer.print("  ");
                        }
                        Printing.printPadded(writer,node.getNodeID()+(node.isActive() ? "" : "*"),8);
                        index++;
                    }
                }
                node=node.getNextTableauNode();
            }
            writer.println();
            writer.println("====================================================================");
        } catch (IllegalArgumentException e) {
            writer.println(conceptName+" is invalid: "+e.getMessage());
View Full Code Here

        m_directBlockingChecker.nodeDestroyed(node);
    }
    public void modelFound() {
        if (m_useBlockingSignatureCache && m_blockingSignatureCache!=null) {
            // Since we've found a model, we know what is blocked and what is not, so we don't need to update the blocking status.
            Node node=m_tableau.getFirstTableauNode();
            while (node!=null) {
                if (node.isActive() && !node.isBlocked() && m_directBlockingChecker.canBeBlocker(node))
                    m_blockingSignatureCache.addNode(node);
                node=node.getNextTableauNode();
            }
        }
    }
View Full Code Here

        writer.println("usage: originStats");
        writer.println("    Prints origin information for the nodes in the current model.");
    }
    public void execute(String[] args) {
        Map<Concept,OriginInfo> originInfos=new HashMap<Concept,OriginInfo>();
        Node node=m_debugger.getTableau().getFirstTableauNode();
        while (node!=null) {
            Debugger.NodeCreationInfo nodeCreationInfo=m_debugger.getNodeCreationInfo(node);
            ExistentialConcept existentialConcept=nodeCreationInfo.m_createdByExistential;
            if (existentialConcept instanceof AtLeastConcept) {
                Concept toConcept=((AtLeastConcept)existentialConcept).getToConcept();
                OriginInfo originInfo=originInfos.get(toConcept);
                if (originInfo==null) {
                    originInfo=new OriginInfo(toConcept);
                    originInfos.put(toConcept,originInfo);
                }
                originInfo.m_nodes.add(node);
                if (!node.isActive())
                    originInfo.m_numberOfNonactiveOccurrences++;
            }
            node=node.getNextTableauNode();
        }
        OriginInfo[] originInfosArray=new OriginInfo[originInfos.size()];
        originInfos.values().toArray(originInfosArray);
        Arrays.sort(originInfosArray,OriginInfoComparator.INSTANCE);
        CharArrayWriter buffer=new CharArrayWriter();
        PrintWriter writer=new PrintWriter(buffer);
        writer.println("Statistics of node origins");
        writer.println("====================================");
        writer.println("  Occurrence    Nonactive   Concept");
        writer.println("====================================");
        for (OriginInfo originInfo : originInfosArray) {
            writer.print("  ");
            Printing.printPadded(writer,originInfo.m_nodes.size(),8);
            writer.print("    ");
            Printing.printPadded(writer,originInfo.m_numberOfNonactiveOccurrences,8);
            writer.print("    ");
            writer.print(originInfo.m_concept.toString(m_debugger.getPrefixes()));
            if (originInfo.m_nodes.size()<=5) {
                writer.print("  [ ");
                for (int index=0;index<originInfo.m_nodes.size();index++) {
                    if (index!=0)
                        writer.print(", ");
                    node=originInfo.m_nodes.get(index);
                    writer.print(node.getNodeID());
                    if (!node.isActive())
                        writer.print('*');
                }
                writer.print(" ]");
            }
            writer.println();
View Full Code Here

    }
    public boolean hasViolation() {
        return (!inValidAtleastForBlocker.isEmpty() || !inValidClausesForBlocker.isEmpty() || !inValidAtleastForBlockedParent.isEmpty() || !inValidClausesForBlockedParent.isEmpty());
    }
    public void blockerChanged(Node node) {
        Node parent=node.getParent();
        ((ValidatedBlockingObject)parent.getBlockingObject()).setHasAlreadyBeenChecked(false);
    }
View Full Code Here

    public void blockerChanged(Node node) {
        Node parent=node.getParent();
        ((ValidatedBlockingObject)parent.getBlockingObject()).setHasAlreadyBeenChecked(false);
    }
    public boolean isBlockValid(Node blocked) {
        Node blockedParent=blocked.getParent();
        if (!((ValidatedBlockingObject)blockedParent.getBlockingObject()).hasAlreadyBeenChecked()) {
            resetChildFlags(blockedParent);

            // if the parent has not been checked yet, check the parent's constraints and mark all its
            // blocked successors that would invalidate the parent constraints in the model construction
            checkConstraintsForNonblockedX(blockedParent);
            ((ValidatedBlockingObject)blockedParent.getBlockingObject()).setHasAlreadyBeenChecked(true);
        }
        // from previous check on the parent we know whether the block is invalid
        if (((ValidatedBlockingObject)blocked.getBlockingObject()).blockViolatesParentConstraints())
            return false;
        if (!satisfiesConstraintsForBlockedX(blocked))
View Full Code Here

    protected void resetChildFlags(Node parent) {
        m_ternaryRetrieval1Bound.getBindingsBuffer()[1]=parent;
        m_ternaryRetrieval1Bound.open();
        Object[] tupleBuffer=m_ternaryRetrieval1Bound.getTupleBuffer();
        while (!m_ternaryRetrieval1Bound.afterLast()) {
            Node node=(Node)tupleBuffer[2];
            if (!node.isAncestorOf(parent)) {
                ((ValidatedBlockingObject)node.getBlockingObject()).setBlockViolatesParentConstraints(false);
            }
            m_ternaryRetrieval1Bound.next();
        }
        m_ternaryRetrieval2Bound.getBindingsBuffer()[2]=parent;
        m_ternaryRetrieval2Bound.open();
        tupleBuffer=m_ternaryRetrieval2Bound.getTupleBuffer();
        while (!m_ternaryRetrieval2Bound.afterLast()) {
            Node node=(Node)tupleBuffer[1];
            if (!node.isAncestorOf(parent)) {
                ((ValidatedBlockingObject)node.getBlockingObject()).setBlockViolatesParentConstraints(false);
            }
            m_ternaryRetrieval2Bound.next();
        }
    }
View Full Code Here

            m_ternaryRetrieval2Bound.next();
        }
    }
    // These methods check the constraint satisfaction for the case when X is matched to a blocked node
    protected boolean satisfiesConstraintsForBlockedX(Node blockedX) {
        Node blocker=blockedX.getBlocker();
        Node blockerParent=blocker.getParent();
        m_binaryRetrieval1Bound.getBindingsBuffer()[1]=blocker;
        m_binaryRetrieval1Bound.open();
        Object[] tupleBuffer=m_binaryRetrieval1Bound.getTupleBuffer();
        while (!m_binaryRetrieval1Bound.afterLast()) {
            if (tupleBuffer[0] instanceof AtomicConcept) {
View Full Code Here

        return true;
    }
    protected boolean isSatisfiedAtLeastForBlocked(AtLeastConcept atleast,Node blockedX, Node blocker,Node blockerParent) {
        Role r=atleast.getOnRole();
        LiteralConcept c=atleast.getToConcept();
        Node blockedXParent=blockedX.getParent();
        if (m_extensionManager.containsRoleAssertion(r,blockedX,blockedXParent)
                && m_extensionManager.containsConceptAssertion(c,blockedXParent))
            return true;
        // blockerParent cannot be used to satisfy the existential, so check whether the blocker has enough suitable children
        Retrieval retrieval;
        int position;
        if (r instanceof AtomicRole) {
            retrieval=m_ternaryRetrieval01Bound;
            retrieval.getBindingsBuffer()[0]=r;
            retrieval.getBindingsBuffer()[1]=blocker;
            position=2;
        } else {
            retrieval=m_ternaryRetrieval02Bound;
            retrieval.getBindingsBuffer()[0]=((InverseRole)r).getInverseOf();
            retrieval.getBindingsBuffer()[2]=blocker;
            position=1;
        }
        retrieval.open();
        Object[] tupleBuffer=retrieval.getTupleBuffer();
        int suitableSuccessors=0;
        int requiredSuccessors=atleast.getNumber();
        while (!retrieval.afterLast()&&suitableSuccessors<requiredSuccessors) {
            Node rSuccessor=(Node)tupleBuffer[position];
            if (rSuccessor!=blockerParent && m_extensionManager.containsConceptAssertion(c,rSuccessor))
               suitableSuccessors++;
            retrieval.next();
        }
        if (suitableSuccessors<requiredSuccessors) {
View Full Code Here

TOP

Related Classes of org.semanticweb.HermiT.tableau.Node

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.