Package org.semanticweb.HermiT.tableau

Examples of org.semanticweb.HermiT.tableau.Node


        }
        return true;
    }
    protected boolean satisfiesDLClauseForBlockedX(DLClauseInfo dlClauseInfo,Node blockedX) {
        assert blockedX.isDirectlyBlocked();
        Node blockedXParent=blockedX.getParent();
        Node blocker=blockedX.getBlocker();
        // Check whether some of the X concepts can be matched to the blocker
        for (AtomicConcept atomicConcept : dlClauseInfo.m_xConcepts)
            if (!m_extensionManager.containsAssertion(atomicConcept,blocker))
                return true; // clause not applicable (trivially satisfied)
        for (AtomicRole atomicRole : dlClauseInfo.m_x2xRoles)
View Full Code Here


            ExtensionTable.Retrieval retrieval=dlClauseInfo.m_zRetrievals[toMatchIndex];
            retrieval.getBindingsBuffer()[0]=zConcepts[0];
            retrieval.open();
            Object[] tupleBuffer=retrieval.getTupleBuffer();
            while (!retrieval.afterLast()) {
                Node nodeZ=(Node)tupleBuffer[1];
                boolean allMatched=true;
                for (int index=1;index<zConcepts.length;index++)
                    if (!m_extensionManager.containsAssertion(zConcepts[index],nodeZ)) {
                        allMatched=false;
                        break;
View Full Code Here

        if (toMatchIndex==parentOfBlockedXIndex)
            return satisfiesDLClauseForBlockedXAnyZAndAnyY(dlClauseInfo,blockedX,parentOfBlockedXIndex,toMatchIndex+1); // assignment already fixed, skip
        else if (toMatchIndex==dlClauseInfo.m_yConstraints.length)
            return satisfiesDLClauseForBlockedXAndMatchedNodes(dlClauseInfo,blockedX,parentOfBlockedXIndex);
        else {
            Node blocker=blockedX.getBlocker();
            Node blockerParent=blocker.getParent();
            YConstraint yConstraint=dlClauseInfo.m_yConstraints[toMatchIndex];
            assert yConstraint.m_x2yRoles.length!=0 || yConstraint.m_y2xRoles.length!=0;
            int yNodeIndex;
            ExtensionTable.Retrieval retrieval;
            if (yConstraint.m_x2yRoles.length!=0) {
                retrieval=dlClauseInfo.m_x2yRetrievals[toMatchIndex];
                retrieval.getBindingsBuffer()[0]=dlClauseInfo.m_x2yRoles[toMatchIndex];
                retrieval.getBindingsBuffer()[1]=blocker;
                yNodeIndex=2;
            }
            else {
                retrieval=dlClauseInfo.m_y2xRetrievals[toMatchIndex];
                retrieval.getBindingsBuffer()[0]=dlClauseInfo.m_y2xRoles[toMatchIndex];
                retrieval.getBindingsBuffer()[2]=blocker;
                yNodeIndex=1;
            }
            retrieval.open();
            Object[] tupleBuffer=retrieval.getTupleBuffer();
            while (!retrieval.afterLast()) {
                Node nodeY=(Node)tupleBuffer[yNodeIndex];
                if (nodeY!=blockerParent && yConstraint.isSatisfiedExplicitly(m_extensionManager,blocker,nodeY)) {
                    dlClauseInfo.m_yNodes[toMatchIndex]=nodeY;
                    boolean result=satisfiesDLClauseForBlockedXAnyZAndAnyY(dlClauseInfo,blockedX,parentOfBlockedXIndex,toMatchIndex+1);
                    dlClauseInfo.m_yNodes[toMatchIndex]=null; // checking done, reset assignment
                    if (!result)
View Full Code Here

        }
        catch (NumberFormatException e) {
            m_debugger.getOutput().println("Invalid ID of the first node.");
            return;
        }
        Node node=m_debugger.getTableau().getNode(nodeID);
        if (node==null) {
            m_debugger.getOutput().println("Node with ID '"+nodeID+"' not found.");
            return;
        }
        CharArrayWriter buffer=new CharArrayWriter();
        PrintWriter writer=new PrintWriter(buffer);
        Printing.printNodeData(m_debugger,node,writer);
        writer.flush();
        showTextInWindow(buffer.toString(),"Node '"+node.getNodeID()+"'");
        selectConsoleWindow();
    }
View Full Code Here

            computePreBlocking();
        }
    }
    public void computePreBlocking() {
        if (m_firstChangedNode!=null) {
            Node node=m_firstChangedNode;
            while (node!=null) {
                m_currentBlockersCache.removeNode(node);
                node=node.getNextTableauNode();
            }
            node=m_firstChangedNode;
            while (node!=null) {
                if (node.isActive() && (m_directBlockingChecker.canBeBlocked(node) || m_directBlockingChecker.canBeBlocker(node))) {
                    if (m_directBlockingChecker.hasBlockingInfoChanged(node) || !node.isDirectlyBlocked() || node.getBlocker().getNodeID()>=m_firstChangedNode.getNodeID()) {
                        Node parent=node.getParent();
                        if (parent==null)
                            node.setBlocked(null,false);
                        else if (parent.isBlocked())
                            node.setBlocked(parent,false);
                        else {
                            Node blocker=null;
                            if (m_lastValidatedUnchangedNode==null)
                                blocker=m_currentBlockersCache.getBlocker(node);
                            else {
                                // after a validation has been done, only re-block if something has been modified
                                Node previousBlocker=node.getBlocker();
                                boolean nodeModified=m_directBlockingChecker.hasChangedSinceValidation(node);
                                for (Node possibleBlocker : m_currentBlockersCache.getPossibleBlockers(node)) {
                                    if (nodeModified || m_directBlockingChecker.hasChangedSinceValidation(possibleBlocker) || previousBlocker==possibleBlocker) {
                                        blocker=possibleBlocker;
                                        break;
View Full Code Here

       
        TableauMonitor monitor=m_tableau.getTableauMonitor();
        if (monitor!=null)
            monitor.blockingValidationStarted();

        Node node;
        node=m_lastValidatedUnchangedNode==null ? m_tableau.getFirstTableauNode() : m_lastValidatedUnchangedNode;
        Node firstValidatedNode=node;
        while (node!=null) {
            m_currentBlockersCache.removeNode(node);
            node=node.getNextTableauNode();
        }
        node=firstValidatedNode;
        if (debuggingMode)
            System.out.print("Model size: "+(m_tableau.getNumberOfNodesInTableau()-m_tableau.getNumberOfMergedOrPrunedNodes())+" Current ID:");
        Node firstInvalidlyBlockedNode=null;
        while (node!=null) {
            if (node.isActive()) {
                if (node.isBlocked() && node.hasUnprocessedExistentials()) {
                    checkedBlocks++;
                    // check whether the block is a correct one
                    if ((node.isDirectlyBlocked() && (m_directBlockingChecker.hasChangedSinceValidation(node) || m_directBlockingChecker.hasChangedSinceValidation(node.getParent()) || m_directBlockingChecker.hasChangedSinceValidation(node.getBlocker()))) || !node.getParent().isBlocked()) {
                        Node validBlocker=null;
                        Node currentBlocker=node.getBlocker();
                        if (node.isDirectlyBlocked() && currentBlocker!=null) {
                            // try the old blocker fist
                            if (isBlockValid(node))
                                validBlocker=currentBlocker;
                        }
View Full Code Here

        updateNodeChange(m_directBlockingChecker.assertionRemoved(atomicRole,nodeFrom,nodeTo,true));
        validationInfoChanged(nodeFrom);
        validationInfoChanged(nodeTo);
    }
    public void nodesMerged(Node mergeFrom,Node mergeInto) {
        Node parent=mergeFrom.getParent();
        if (parent!=null && (m_directBlockingChecker.canBeBlocker(parent) || m_directBlockingChecker.canBeBlocked(parent)))
            validationInfoChanged(parent);
    }
View Full Code Here

        Node parent=mergeFrom.getParent();
        if (parent!=null && (m_directBlockingChecker.canBeBlocker(parent) || m_directBlockingChecker.canBeBlocked(parent)))
            validationInfoChanged(parent);
    }
    public void nodesUnmerged(Node mergeFrom,Node mergeInto) {
        Node parent=mergeFrom.getParent();
        if (parent!=null && (m_directBlockingChecker.canBeBlocker(parent) || m_directBlockingChecker.canBeBlocked(parent)))
            validationInfoChanged(parent);
    }
View Full Code Here

            m_coreVariables=coreVariables;
        }
        public void clear() {
        }
        public int execute(int programCounter) {
            Node potentialNonCore=null;
            // find the root of the subtree induced by the mapped nodes that node cannot be core
            for (int variableIndex=m_coreVariables.length-1;variableIndex>=0;--variableIndex) {
                Node node=(Node)m_valuesBuffer[variableIndex];
                if (node.getNodeType()==NodeType.TREE_NODE && (potentialNonCore==null || node.getTreeDepth()<potentialNonCore.getTreeDepth())) {
                    potentialNonCore=node;
                }
            }
            if (potentialNonCore!=null) {
                for (int variableIndex=m_coreVariables.length-1;variableIndex>=0;--variableIndex) {
                    Node node=(Node)m_valuesBuffer[variableIndex];
                    if (!node.isRootNode() && potentialNonCore!=node && potentialNonCore.getTreeDepth()<node.getTreeDepth())
                        m_coreVariables[variableIndex]=true;
                }
            }
            return programCounter+1;
        }
View Full Code Here

        }
        retrieval.open();
        Object[] tupleBuffer=retrieval.getTupleBuffer();
        List<Node> possiblyInvalidlyBlocked=new ArrayList<Node>();
        while (!retrieval.afterLast()&&suitableSuccessors<requiredSuccessors) {
            Node rSuccessor=(Node)tupleBuffer[position];
            if (rSuccessor.isBlocked()&&!((ValidatedBlockingObject)rSuccessor.getBlockingObject()).blockViolatesParentConstraints()) {
                if (m_extensionManager.containsConceptAssertion(c,rSuccessor.getBlocker()))
                    suitableSuccessors++;
                else
                    possiblyInvalidlyBlocked.add(rSuccessor);
            } else if (m_extensionManager.containsConceptAssertion(c,rSuccessor))
                suitableSuccessors++;
            retrieval.next();
        }
        // unblock nodes until we have enough suitable successors
        for (int i=0;i<possiblyInvalidlyBlocked.size()&&suitableSuccessors<requiredSuccessors;i++) {
            Node blocked=possiblyInvalidlyBlocked.get(i);
            if (m_extensionManager.containsConceptAssertion(c,blocked)) {
                ((ValidatedBlockingObject)blocked.getBlockingObject()).setBlockViolatesParentConstraints(true);
                if (debuggingMode) inValidAtleastForBlockedParent.put(atleast,blocked);
                suitableSuccessors++;
            }
        }
    }
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.