Package org.semanticweb.HermiT.monitor

Examples of org.semanticweb.HermiT.monitor.TableauMonitor


        // statistics for debugging:
        boolean debuggingMode=false;
        int checkedBlocks=0;
        int invalidBlocks=0;
       
        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;
                        }
                        if (validBlocker==null) {
                            for (Node possibleBlocker : m_currentBlockersCache.getPossibleBlockers(node)) {
                                if (possibleBlocker!=currentBlocker) {
                                    node.setBlocked(possibleBlocker,true);
                                    m_permanentBlockingValidator.blockerChanged(node); // invalidate cache
                                    if (m_additionalBlockingValidator!=null)
                                        m_additionalBlockingValidator.blockerChanged(node);
                                    if (isBlockValid(node)) {
                                        validBlocker=possibleBlocker;
                                        break;
                                    }
                                }
                            }
                        }
                        if (validBlocker==null && node.hasUnprocessedExistentials()) {
                            invalidBlocks++;
                            if (firstInvalidlyBlockedNode==null)
                                firstInvalidlyBlockedNode=node;
                        }
                        node.setBlocked(validBlocker,validBlocker!=null);
                    }
                }
                m_lastValidatedUnchangedNode=node;
                if (!node.isBlocked() && m_directBlockingChecker.canBeBlocker(node))
                    m_currentBlockersCache.addNode(node);
            }
            node=node.getNextTableauNode();
        }

        node=firstValidatedNode;
        while (node!=null) {
            if (node.isActive()) {
                m_directBlockingChecker.setHasChangedSinceValidation(node,false);
                ValidatedBlockingObject blockingObject=(ValidatedBlockingObject)node.getBlockingObject();
                blockingObject.setBlockViolatesParentConstraints(false);
                blockingObject.setHasAlreadyBeenChecked(false);
            }
            node=node.getNextTableauNode();
        }
        // if set to some node, then computePreblocking will be asked to check from that node onwards in case of invalid blocks
        m_firstChangedNode=firstInvalidlyBlockedNode;
        if (monitor!=null)
            monitor.blockingValidationFinished(invalidBlocks);

        if (debuggingMode) {
            System.out.println("");
            System.out.println("Checked "+checkedBlocks+" blocked nodes of which "+invalidBlocks+" were invalid.");
        }
View Full Code Here


        }

        boolean hasInverseRoles=(permanentDLOntology.hasInverseRoles() || (additionalDLOntology!=null && additionalDLOntology.hasInverseRoles()));
        boolean hasNominals=(permanentDLOntology.hasNominals() || (additionalDLOntology!=null && additionalDLOntology.hasNominals()));

        TableauMonitor wellKnownTableauMonitor=null;
        switch (config.tableauMonitorType) {
        case NONE:
            wellKnownTableauMonitor=null;
            break;
        case TIMING:
            wellKnownTableauMonitor=new Timer();
            break;
        case TIMING_WITH_PAUSE:
            wellKnownTableauMonitor=new TimerWithPause();
            break;
        case DEBUGGER_HISTORY_ON:
            wellKnownTableauMonitor=new Debugger(prefixes,true);
            break;
        case DEBUGGER_NO_HISTORY:
            wellKnownTableauMonitor=new Debugger(prefixes,false);
            break;
        default:
            throw new IllegalArgumentException("Unknown monitor type");
        }

        TableauMonitor tableauMonitor=null;
        if (config.monitor==null)
            tableauMonitor=wellKnownTableauMonitor;
        else if (wellKnownTableauMonitor==null)
            tableauMonitor=config.monitor;
        else
View Full Code Here

        m_processedExistentials.clear();
        m_ternaryExtensionTableSearch01Bound.clear();
        m_ternaryExtensionTableSearch02Bound.clear();
    }
    public boolean expandExistentials(boolean finalChance) {
        TableauMonitor monitor=m_tableau.getTableauMonitor();
        m_blockingStrategy.computeBlocking(finalChance);
        boolean extensionsChanged=false;
        Node node=m_tableau.getFirstTableauNode();
        while (node!=null && (!extensionsChanged || !m_expandNodeAtATime)) {
            if (node.isActive() && !node.isBlocked() && node.hasUnprocessedExistentials()) {
                // The node's set of unprocessed existentials may be changed during operation, so make a local copy to loop over.
                m_processedExistentials.clear();
                m_processedExistentials.addAll(node.getUnprocessedExistentials());
                for (int index=m_processedExistentials.size()-1;index>=0;index--) {
                    ExistentialConcept existentialConcept=m_processedExistentials.get(index);
                    if (existentialConcept instanceof AtLeastConcept) {
                        AtLeastConcept atLeastConcept=(AtLeastConcept)existentialConcept;
                        switch (isSatisfied(atLeastConcept,node)) {
                        case NOT_SATISFIED:
                            expandExistential(atLeastConcept,node);
                            extensionsChanged=true;
                            break;
                        case PERMANENTLY_SATISFIED: // not satisfied by a nominal so that the NN/NI rule can break the existential
                            m_existentialExpansionManager.markExistentialProcessed(existentialConcept,node);
                            if (monitor!=null)
                                monitor.existentialSatisfied(atLeastConcept,node);
                            break;
                        case CURRENTLY_SATISFIED: // satisfied until the NN/NI rule is applied and after which the existential might no longer be satisfied
                            // do nothing
                            if (monitor!=null)
                                monitor.existentialSatisfied(atLeastConcept,node);
                            break;
                        }
                    }
                    else if (existentialConcept instanceof ExistsDescriptionGraph) {
                        ExistsDescriptionGraph existsDescriptionGraph=(ExistsDescriptionGraph)existentialConcept;
                        if (!m_descriptionGraphManager.isSatisfied(existsDescriptionGraph,node)) {
                            m_descriptionGraphManager.expand(existsDescriptionGraph,node);
                            extensionsChanged=true;
                        }
                        else {
                            if (monitor!=null)
                                monitor.existentialSatisfied(existsDescriptionGraph,node);
                        }
                        m_existentialExpansionManager.markExistentialProcessed(existentialConcept,node);
                    }
                    else
                        throw new IllegalStateException("Unsupported type of existential.");
View Full Code Here

TOP

Related Classes of org.semanticweb.HermiT.monitor.TableauMonitor

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.