Package au.csiro.snorocket.core.axioms

Examples of au.csiro.snorocket.core.axioms.IConjunctionQueueEntry


        Collection<NF1b> res = new HashSet<NF1b>();
        for(IntIterator it = ontologyNF1.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            MonotonicCollection<IConjunctionQueueEntry> mc = ontologyNF1.get(a);
            for(Iterator<IConjunctionQueueEntry> it2 = mc.iterator(); it2.hasNext(); ) {
                IConjunctionQueueEntry entry = it2.next();
                if(entry instanceof NF1b) {
                    res.add((NF1b) entry);
                }
            }
        }
View Full Code Here


            return;
        IConceptMap<MonotonicCollection<IConjunctionQueueEntry>> deltaNF1 =
                new SparseConceptMap<MonotonicCollection<IConjunctionQueueEntry>>(
                size);
        for (NF1a nf1a : as.getNf1aAxioms()) {
            IConjunctionQueueEntry qe = nf1a.getQueueEntry();
            addTerms(deltaNF1, nf1a.lhsA(), qe);
        }

        for (NF1b nf1b : as.getNf1bAxioms()) {
            final int a1 = nf1b.lhsA1();
View Full Code Here

        for(IntIterator it = ontologyNF1.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            MonotonicCollection<IConjunctionQueueEntry> mc = ontologyNF1.get(a);
            for(Iterator<IConjunctionQueueEntry> it2 = mc.iterator();
                    it2.hasNext(); ) {
                IConjunctionQueueEntry nf1 = it2.next();
                int bi = nf1.getBi();
                int b = nf1.getB();
                // Build the axiom
                Object oa = factory.lookupConceptId(a);
                Object ob = factory.lookupConceptId(b);
                if(bi == IFactory.TOP_CONCEPT) {
                    res.add(new ConceptInclusion(transform(oa), transform(ob)));
                } else {
                    Object obi = factory.lookupConceptId(bi);
                    res.add(new ConceptInclusion(
                        new au.csiro.ontology.model.Conjunction(
                            new Concept[] {transform(oa), transform(obi)}), transform(ob)
                    ));
                }
            }
        }
       
        // These terms are of the form A [ r.B and are indexed by A.
        for(IntIterator it = ontologyNF2.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            MonotonicCollection<NF2> mc = ontologyNF2.get(a);
            for(Iterator<NF2> it2 = mc.iterator(); it2.hasNext(); ) {
                NF2 nf2 = it2.next();
                Object oa = factory.lookupConceptId(nf2.lhsA);
                String r = factory.lookupRoleId(nf2.rhsR).toString();
                Object ob = factory.lookupConceptId(nf2.rhsB);
                res.add(new ConceptInclusion(
                    transform(oa),
                    new au.csiro.ontology.model.Existential(new NamedRole(r), transform(ob))
                ));
            }
        }
       
        // These terms are of the form r.A [ b and indexed by A.
        for(IntIterator it = ontologyNF3.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> mc =
                    ontologyNF3.get(a);
            Set<Integer> keys = mc.keySet();
            for (int i : keys) {
                Collection<IConjunctionQueueEntry> cc = mc.get(i);
                for(Iterator<IConjunctionQueueEntry> it2 = cc.iterator();
                        it2.hasNext(); ) {
                    IConjunctionQueueEntry nf3 = it2.next();
                    Object oa = factory.lookupConceptId(a);
                    String r = factory.lookupRoleId(i).toString();
                    Object ob = factory.lookupConceptId(nf3.getB());
                    res.add(new ConceptInclusion(
                        new au.csiro.ontology.model.Existential(new NamedRole(r), transform(ob)),
                        transform(oa
                    ));
                }
View Full Code Here

        for(IntIterator it = ontologyNF1.keyIterator(); it.hasNext(); ) {
            int key = it.next();
            MonotonicCollection<IConjunctionQueueEntry> entries = ontologyNF1.get(key);
            Iterator<IConjunctionQueueEntry> it2 = entries.iterator();
            while(it2.hasNext()) {
                IConjunctionQueueEntry entry = it2.next();
               
                Object a = factory.lookupConceptId(key);
                String as = (a instanceof String) ? (String) a : "[" + a.toString() + "]";
                Object bi = factory.lookupConceptId(entry.getBi());
                String bis = (bi instanceof String) ? (String) bi :  "[" + bi.toString() + "]";
                Object b = factory.lookupConceptId(entry.getB());
                String bs = (b instanceof String) ? (String) b :  "[" + b.toString() + "]";
                System.out.println("NF1: " + as + " + " + bis + " [ " + bs);
            }
        }

        for(IntIterator it = ontologyNF2.keyIterator(); it.hasNext(); ) {
            int key = it.next();
            MonotonicCollection<NF2> entries = ontologyNF2.get(key);
            Iterator<NF2> it2 = entries.iterator();
            while(it2.hasNext()) {
                NF2 entry = it2.next();
               
                // These terms are of the form A [ r.B and are indexed by A.
               
                Object a = factory.lookupConceptId(entry.lhsA);
                String as = (a instanceof String) ? (String) a : "[" + a.toString() + "]";
                Object r = factory.lookupRoleId(entry.rhsR);
                String rs = (r instanceof String) ? (String) r :  "[" + r.toString() + "]";
                Object b = factory.lookupConceptId(entry.rhsB);
                String bs = (b instanceof String) ? (String) b :  "[" + b.toString() + "]";
                System.out.println("NF2: " + as + " [ " + rs + "." + bs);
            }
        }
       
        for(IntIterator it = ontologyNF3.keyIterator(); it.hasNext(); ) {
            int aId = it.next();
            ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> entries = ontologyNF3.get(aId);
            for(Integer rId : entries.keySet()) {
               
                // These terms are of the form r.A [ b and indexed by A (and then by r)
               
                for(IConjunctionQueueEntry entry : entries.get(rId)) {
                    int bId = entry.getB();
                    Object r = factory.lookupRoleId(rId.intValue());
                    String rs = (r instanceof String) ? (String) r :  "[" + r.toString() + "]";
                    Object a = factory.lookupConceptId(aId);
                    String as = (a instanceof String) ? (String) a : "[" + a.toString() + "]";
                    Object b = factory.lookupConceptId(bId);
View Full Code Here

           
            // Process concept queue
            if (!conceptQueue.isEmpty()) {
                do {
                    done = false;
                    final IConjunctionQueueEntry entry = conceptQueue.remove();
                    final int b = entry.getB();

                    if (!s.contains(b)) {
                        final int bi = entry.getBi();
                        if (s.contains(bi)) {
                            s.add(b);
                            processNewSubsumption(b);
                        }
                    }
                } while (!conceptQueue.isEmpty());
            }

            // Process feature queue
            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries = ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
                                /**
                                 * Serialisation version.
                                 */
                                private static final long serialVersionUID = 1L;

                                public int getBi() {
                                    return CoreFactory.TOP_CONCEPT;
                                }

                                public int getB() {
                                    return e.rhsB;
                                }
                            });
                        }
                    }

                    addToConceptQueue(res);
                } while (!featureQueue.isEmpty());
            }

            // Process role queue
            if (!roleQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = roleQueue.remove();

                if (!succ.lookupConcept(entry.getR()).contains(entry.getB())) {
                    processNewEdge(entry.getR(), entry.getB());
                }
            }

            if (!externalQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = externalQueue.remove();
                processNewEdge(entry.getR(), entry.getB());
            }

        } while (!done);
    }
View Full Code Here

            // Process concept queue
            if (!conceptQueue.isEmpty()) {
                do {
                    done = false;
                    final IConjunctionQueueEntry entry = conceptQueue.remove();
                    final int b = entry.getB();

                    if (!s.contains(b)) {
                        final int bi = entry.getBi();
                        if (s.contains(bi)) {
                            s.add(b);
                            changed = true;
                            processNewSubsumptionTracking(b);
                        }
                    }
                } while (!conceptQueue.isEmpty());
            }

            // Process feature queue
            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries =
                            ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
                                /**
                                 * Serialisation version.
                                 */
                                private static final long serialVersionUID = 1L;

                                public int getBi() {
                                    return CoreFactory.TOP_CONCEPT;
                                }

                                public int getB() {
                                    return e.rhsB;
                                }
                            });
                        }
                    }

                    addToConceptQueue(res);
                } while (!featureQueue.isEmpty());
            }

            // Process role queue
            if (!roleQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = roleQueue.remove();

                if (!succ.lookupConcept(entry.getR()).contains(entry.getB())) {
                    processNewEdgeTracking(entry.getR(), entry.getB());
                }
            }

            if (!externalQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = externalQueue.remove();
                processNewEdgeTracking(entry.getR(), entry.getB());
            }

        } while (!done);
    }
View Full Code Here

           
            // Process concept queue
            if (!conceptQueue.isEmpty()) {
                do {
                    done = false;
                    final IConjunctionQueueEntry entry = conceptQueue.remove();
                    final int b = entry.getB();

                    if (!s.contains(b)) {
                        final int bi = entry.getBi();
                        if (s.contains(bi)) {
                            s.add(b);
                            processNewSubsumption(b);
                        }
                    }
                } while (!conceptQueue.isEmpty());
            }

            // Process feature queue
            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries = ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
                                /**
                                 * Serialisation version.
                                 */
                                private static final long serialVersionUID = 1L;

                                public int getBi() {
                                    return CoreFactory.TOP_CONCEPT;
                                }

                                public int getB() {
                                    return e.rhsB;
                                }
                            });
                        }
                    }

                    addToConceptQueue(res);
                } while (!featureQueue.isEmpty());
            }

            // Process role queue
            if (!roleQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = roleQueue.remove();

                if (!succ.lookupConcept(entry.getR()).contains(entry.getB())) {
                    processNewEdge(entry.getR(), entry.getB());
                }
            }

            if (!externalQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = externalQueue.remove();
                processNewEdge(entry.getR(), entry.getB());
            }

        } while (!done);
    }
View Full Code Here

            // Process concept queue
            if (!conceptQueue.isEmpty()) {
                do {
                    done = false;
                    final IConjunctionQueueEntry entry = conceptQueue.remove();
                    final int b = entry.getB();

                    if (!s.contains(b)) {
                        final int bi = entry.getBi();
                        if (s.contains(bi)) {
                            s.add(b);
                            changed = true;
                            processNewSubsumptionTracking(b);
                        }
                    }
                } while (!conceptQueue.isEmpty());
            }

            // Process feature queue
            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries =
                            ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
                                /**
                                 * Serialisation version.
                                 */
                                private static final long serialVersionUID = 1L;

                                public int getBi() {
                                    return CoreFactory.TOP_CONCEPT;
                                }

                                public int getB() {
                                    return e.rhsB;
                                }
                            });
                        }
                    }

                    addToConceptQueue(res);
                } while (!featureQueue.isEmpty());
            }

            // Process role queue
            if (!roleQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = roleQueue.remove();

                if (!succ.lookupConcept(entry.getR()).contains(entry.getB())) {
                    processNewEdgeTracking(entry.getR(), entry.getB());
                }
            }

            if (!externalQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = externalQueue.remove();
                processNewEdgeTracking(entry.getR(), entry.getB());
            }

        } while (!done);
    }
View Full Code Here

           
            // Process concept queue
            if (!conceptQueue.isEmpty()) {
                do {
                    done = false;
                    final IConjunctionQueueEntry entry = conceptQueue.remove();
                    final int b = entry.getB();

                    if (!s.contains(b)) {
                        final int bi = entry.getBi();
                        if (s.contains(bi)) {
                            s.add(b);
                            processNewSubsumption(b);
                        }
                    }
                } while (!conceptQueue.isEmpty());
            }

            // Process feature queue
            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries = ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
                                /**
                                 * Serialisation version.
                                 */
                                private static final long serialVersionUID = 1L;

                                public int getBi() {
                                    return CoreFactory.TOP_CONCEPT;
                                }

                                public int getB() {
                                    return e.rhsB;
                                }
                            });
                        }
                    }

                    addToConceptQueue(res);
                } while (!featureQueue.isEmpty());
            }

            // Process role queue
            if (!roleQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = roleQueue.remove();

                if (!succ.lookupConcept(entry.getR()).contains(entry.getB())) {
                    processNewEdge(entry.getR(), entry.getB());
                }
            }

            if (!externalQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = externalQueue.remove();
                processNewEdge(entry.getR(), entry.getB());
            }

        } while (!done);
    }
View Full Code Here

            // Process concept queue
            if (!conceptQueue.isEmpty()) {
                do {
                    done = false;
                    final IConjunctionQueueEntry entry = conceptQueue.remove();
                    final int b = entry.getB();

                    if (!s.contains(b)) {
                        final int bi = entry.getBi();
                        if (s.contains(bi)) {
                            s.add(b);
                            changed = true;
                            processNewSubsumptionTracking(b);
                        }
                    }
                } while (!conceptQueue.isEmpty());
            }

            // Process feature queue
            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries =
                            ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
                                /**
                                 * Serialisation version.
                                 */
                                private static final long serialVersionUID = 1L;

                                public int getBi() {
                                    return CoreFactory.TOP_CONCEPT;
                                }

                                public int getB() {
                                    return e.rhsB;
                                }
                            });
                        }
                    }

                    addToConceptQueue(res);
                } while (!featureQueue.isEmpty());
            }

            // Process role queue
            if (!roleQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = roleQueue.remove();

                if (!succ.lookupConcept(entry.getR()).contains(entry.getB())) {
                    processNewEdgeTracking(entry.getR(), entry.getB());
                }
            }

            if (!externalQueue.isEmpty()) {
                done = false;
                final IRoleQueueEntry entry = externalQueue.remove();
                processNewEdgeTracking(entry.getR(), entry.getB());
            }

        } while (!done);
    }
View Full Code Here

TOP

Related Classes of au.csiro.snorocket.core.axioms.IConjunctionQueueEntry

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.