Package org.semanticweb.owlapi.util

Examples of org.semanticweb.owlapi.util.OWLEntityCollector


    private void createMap() {
        for (OWLAxiom ax : axioms) {
            OWLAxiomPartExtractor extractor = new OWLAxiomPartExtractor();
            ax.accept(extractor);
            Set<OWLEntity> rhscollected = new HashSet<>();
            OWLEntityCollector rhsCollector = new OWLEntityCollector(
                    rhscollected);
            for (OWLObject rhsObject : extractor.getRHS()) {
                rhsObject.accept(rhsCollector);
            }
            for (OWLEntity rhsEntity : rhscollected) {
                axiomsByRHS.put(rhsEntity, ax);
            }
            Set<OWLEntity> lhscollected = new HashSet<>();
            OWLEntityCollector lhsCollector = new OWLEntityCollector(
                    lhscollected);
            for (OWLObject lhsObject : extractor.getLHS()) {
                lhsObject.accept(lhsCollector);
            }
            for (OWLEntity lhsEntity : lhscollected) {
View Full Code Here


     * @return the entities referenced in the axiom
     */
    @Nonnull
    private static Set<OWLEntity> getSignature(@Nonnull OWLAxiom axiom) {
        Set<OWLEntity> toReturn = new HashSet<>();
        OWLEntityCollector collector = new OWLEntityCollector(toReturn);
        axiom.accept(collector);
        return toReturn;
    }
View Full Code Here

            if (expandedWithDefiningAxioms.contains(ax)) {
                // Skip if already done
                continue;
            }
            // Collect the entities that have been used in the axiom
            OWLEntityCollector collector = new OWLEntityCollector();
            ax.accept(collector);
            for (OWLEntity curObj : collector.getObjects()) {
                if (!objectsExpandedWithDefiningAxioms.contains(curObj)) {
                    int added = expandWithDefiningAxioms(curObj, remainingSpace);
                    axiomsAdded += added;
                    remainingSpace = remainingSpace - added;
                    if (remainingSpace == 0) {
                        expansionLimit *= expansionFactor;
                        return axiomsAdded;
                    }
                    // Flag that we have completely expanded all defining axioms
                    // for this particular entity
                    objectsExpandedWithDefiningAxioms.add(curObj);
                }
            }

            // Flag that we've completely expanded this particular axiom
            expandedWithDefiningAxioms.add(ax);
        }

        if (axiomsAdded > 0) {
            return axiomsAdded;
        }

        // No axioms added at this point. Start adding axioms that reference
        // entities contained in the current set of debugging axioms
        for (OWLAxiom ax : new HashSet<OWLAxiom>(debuggingAxioms)) {
            if (expandedWithReferencingAxioms.contains(ax)) {
                // Skip - already done this one
                continue;
            }
            OWLEntityCollector collector = new OWLEntityCollector();
            ax.accept(collector);
            // Keep track of the number of axioms that have been added
            for (OWLEntity curObj : collector.getObjects()) {
                if (!objectsExpandedWithReferencingAxioms.contains(curObj)) {
                    int added = expandWithReferencingAxioms(curObj, expansionLimit);
                    axiomsAdded += added;
                    remainingSpace -= added;
                    if (remainingSpace == 0) {
View Full Code Here

    private static OWLEntityCollector collector;

    public HSTExplanationGenerator(TransactionAwareSingleExpGen singleExplanationGenerator) {
        this.singleExplanationGenerator = singleExplanationGenerator;
        collector = new OWLEntityCollector();
        collector.setCollectDatatypes(false);
    }
View Full Code Here

        return annotations.equals(other.getAnnotations());
    }


    public Set<OWLEntity> getReferencedEntities() {
        OWLEntityCollector collector = new OWLEntityCollector();
        this.accept(collector);
        return collector.getObjects();
    }
View Full Code Here

        return getIndexedSet(axiom, entitiesByAxiomRHS, true);
    }


    private void indexAxiomsByRHSEntities(OWLObject rhs, OWLAxiom axiom) {
        OWLEntityCollector collector = new OWLEntityCollector();
        rhs.accept(collector);
        getIndexedSet(axiom, entitiesByAxiomRHS, true).addAll(collector.getObjects());
    }
View Full Code Here

     * @return <code>true</code> if the description references entities that
     *         the ontology that contains entailments which are being explained,
     *         otherwise <code>false</code>
     */
    public static boolean containsUnreferencedEntity(OWLOntology ontology, OWLClassExpression desc) {
        OWLEntityCollector entityCollector = new OWLEntityCollector();
        desc.accept(entityCollector);
        for (OWLEntity entity : entityCollector.getObjects()) {
            if (!ontology.containsEntityInSignature(entity)) {
                if (entity instanceof OWLClass && (((OWLClass) entity).isOWLThing() || ((OWLClass) entity).isOWLNothing())) {
                    continue;
                }
                return true;
View Full Code Here


    public Set<OWLEntity> getSignature() {
        if (signature == null) {
            Set<OWLEntity> sig = new HashSet<OWLEntity>();
            OWLEntityCollector collector = new OWLEntityCollector();
            accept(collector);
            sig.addAll(collector.getObjects());
            signature = new HashSet<OWLEntity>(sig);
        }
        return Collections.unmodifiableSet(signature);
    }
View Full Code Here

     * referenced in the axiom contained within this change.
     * @return A <code>Set</code> of entities which are referenced
     * by the axiom contained within this change.
     */
    public Set<OWLEntity> getEntities() {
        OWLEntityCollector collector = new OWLEntityCollector();
        axiom.accept(collector);
        return collector.getObjects();
    }
View Full Code Here

            if (expandedWithDefiningAxioms.contains(ax)) {
                // Skip if already done
                continue;
            }
            // Collect the entities that have been used in the axiom
            OWLEntityCollector collector = new OWLEntityCollector();
            ax.accept(collector);
            for (OWLEntity curObj : collector.getObjects()) {
                if (!objectsExpandedWithDefiningAxioms.contains(curObj)) {
                    int added = expandWithDefiningAxioms(curObj, remainingSpace);
                    axiomsAdded += added;
                    remainingSpace = remainingSpace - added;
                    if (remainingSpace == 0) {
                        expansionLimit *= expansionFactor;
                        return axiomsAdded;
                    }
                    // Flag that we have completely expanded all defining axioms
                    // for this particular entity
                    objectsExpandedWithDefiningAxioms.add(curObj);
                }
            }

            // Flag that we've completely expanded this particular axiom
            expandedWithDefiningAxioms.add(ax);
        }

        if (axiomsAdded > 0) {
            return axiomsAdded;
        }

        // No axioms added at this point.  Start adding axioms that reference
        // entities contained in the current set of debugging axioms
        for (OWLAxiom ax : new HashSet<OWLAxiom>(debuggingAxioms)) {
            if (expandedWithReferencingAxioms.contains(ax)) {
                // Skip - already done this one
                continue;
            }
            OWLEntityCollector collector = new OWLEntityCollector();
            ax.accept(collector);
            // Keep track of the number of axioms that have been added
            for (OWLEntity curObj : collector.getObjects()) {
                if (!objectsExpandedWithReferencingAxioms.contains(curObj)) {
                    int added = expandWithReferencingAxioms(curObj, expansionLimit);
                    axiomsAdded += added;
                    remainingSpace -= added;
                    if (remainingSpace == 0) {
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.util.OWLEntityCollector

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.