Package au.csiro.snorocket.core.util

Examples of au.csiro.snorocket.core.util.IConceptSet


        }
        for (int i = 0; i < base.length; i++) {
            if (null == base[i]) {
                continue;
            }
            final IConceptSet set = data[i] = new SparseConceptHashSet();

            set.addAll(base[i]);
            if (null != relationships.data[i]) {
                set.removeAll(relationships.data[i]);
            }
        }
    }
View Full Code Here


            final Set<Integer> keySet = map.keySet();
            for (int r : keySet) {
                final Collection<IConjunctionQueueEntry> entries = map.get(r);

                if (null != entries) {
                    final IConceptSet aPrimes = pred.lookupConcept(r);
                    for (final IntIterator itr = aPrimes.iterator(); itr.hasNext();) {
                        final int aa = itr.next();
                        // Add to queue aa
                        if (concept == aa) {
                            conceptQueue.addAll(entries);
                        } else {
View Full Code Here

        Context bContext = contextIndex.get(b);

        bContext.getPred().store(s, concept);

        // queue(A) := queue(A) u U{B'|B' in S(B)}.O^(s.B')
        final IConceptSet sb = contextIndex.get(b).getS();

        // Computes the minimal set of QueueEntries from s.a [ bb is in O
        for (IntIterator itr = sb.iterator(); itr.hasNext();) {
            final int bb = itr.next();
            final ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> map = ontologyNF3.get(bb);

            if (null != map) {
                final Collection<IConjunctionQueueEntry> entries = map.get(s);
                if (null != entries) {
                    conceptQueue.addAll(entries);
                }
            }
        }

        // Handle reflexive roles
        if (reflexiveRoles.contains(s)) {
            // check for (a,a) in R(s)
            if (!pred.lookupConcept(s).contains(concept)) {
                processNewEdge(s, concept);
            }

            // check for (b,b) in R(s)
            Context tc = contextIndex.get(b);
            if (!tc.getPred().lookupConcept(s).contains(b)) {
                tc.processExternalEdge(s, b);
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        final List<int[]> work = new ArrayList<int[]>();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getS()) {
                final int t = nf5.getR();
                final int u = nf5.getT();
                final IConceptSet aTPrimes = pred.lookupConcept(t);

                // Again in this case there is a dependency with the
                // predecessors of an external context.
                final IConceptSet bUPrimes = contextIndex.get(b).getPred().lookupConcept(u);

                for (final IntIterator itr = aTPrimes.iterator();
                        itr.hasNext();) {
                    final int aa = itr.next();

                    if (!bUPrimes.contains(aa)) {
                        work.add(new int[] { aa, u });
                    }

                }
            }
        }

        for (final int[] pair : work) {
            if (pair[0] == concept) {
                processNewEdge(pair[1], b);
            } else {
                Context tc = contextIndex.get(pair[0]);
                tc.processExternalEdge(pair[1], b);
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        work.clear();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getR()) {
                final int t = nf5.getS();
                final int u = nf5.getT();
                // In this case there is a dependency with the
                // successors of an external context.
                final IConceptSet bTPrimes = contextIndex.get(b).getSucc().lookupConcept(t);
                final IConceptSet aUPrimes = succ.lookupConcept(u);

                for (final IntIterator itr = bTPrimes.iterator();
                        itr.hasNext();) {
                    final int bb = itr.next();

                    if (!aUPrimes.contains(bb)) {
                        work.add(new int[] { u, bb });
                    }

                }
            }
View Full Code Here

            final Set<Integer> keySet = map.keySet();
            for (int r : keySet) {
                final Collection<IConjunctionQueueEntry> entries = map.get(r);

                if (null != entries) {
                    final IConceptSet aPrimes = pred.lookupConcept(r);
                    for (final IntIterator itr = aPrimes.iterator(); itr.hasNext();) {
                        final int aa = itr.next();
                        // Add to queue aa
                        if (concept == aa) {
                            conceptQueue.addAll(entries);
                        } else {
View Full Code Here

        Context bContext = contextIndex.get(b);

        bContext.getPred().store(s, concept);

        // queue(A) := queue(A) u U{B'|B' in S(B)}.O^(s.B')
        final IConceptSet sb = contextIndex.get(b).getS();

        // Computes the minimal set of QueueEntries from s.a [ bb is in O
        for (IntIterator itr = sb.iterator(); itr.hasNext();) {
            final int bb = itr.next();
            final ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> map = ontologyNF3.get(bb);

            if (null != map) {
                final Collection<IConjunctionQueueEntry> entries = map.get(s);
                if (null != entries) {
                    conceptQueue.addAll(entries);
                }
            }
        }

        // Handle reflexive roles
        if (reflexiveRoles.contains(s)) {
            // check for (a,a) in R(s)
            if (!pred.lookupConcept(s).contains(concept)) {
                processNewEdgeTracking(s, concept);
            }

            // check for (b,b) in R(s)
            Context tc = contextIndex.get(b);
            if (!tc.getPred().lookupConcept(s).contains(b)) {
                tc.processExternalEdge(s, b);
                affectedContexts.add(tc);
                tc.startTracking();
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        final List<int[]> work = new ArrayList<int[]>();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getS()) {
                final int t = nf5.getR();
                final int u = nf5.getT();
                final IConceptSet aTPrimes = pred.lookupConcept(t);

                // Again in this case there is a dependency with the
                // predecessors of an external context.
                final IConceptSet bUPrimes =
                        contextIndex.get(b).getPred().lookupConcept(u);

                for (final IntIterator itr = aTPrimes.iterator();
                        itr.hasNext();) {
                    final int aa = itr.next();

                    if (!bUPrimes.contains(aa)) {
                        work.add(new int[] { aa, u });
                    }

                }
            }
        }

        for (final int[] pair : work) {
            if (pair[0] == concept) {
                processNewEdgeTracking(pair[1], b);
            } else {
                Context tc = contextIndex.get(pair[0]);
                tc.processExternalEdge(pair[1], b);
                affectedContexts.add(tc);
                tc.startTracking();
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        work.clear();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getR()) {
                final int t = nf5.getS();
                final int u = nf5.getT();
                // In this case there is a dependency with the
                // successors of an external context.
                final IConceptSet bTPrimes = contextIndex.get(b).getSucc()
                        .lookupConcept(t);
                final IConceptSet aUPrimes = succ.lookupConcept(u);

                for (final IntIterator itr = bTPrimes.iterator();
                        itr.hasNext();) {
                    final int bb = itr.next();

                    if (!aUPrimes.contains(bb)) {
                        work.add(new int[] { u, bb });
                    }

                }
            }
View Full Code Here

            final Set<Integer> keySet = map.keySet();
            for (int r : keySet) {
                final Collection<IConjunctionQueueEntry> entries = map.get(r);

                if (null != entries) {
                    final IConceptSet aPrimes = pred.lookupConcept(r);
                    for (final IntIterator itr = aPrimes.iterator(); itr.hasNext();) {
                        final int aa = itr.next();
                        // Add to queue aa
                        if (concept == aa) {
                            conceptQueue.addAll(entries);
                        } else {
View Full Code Here

        Context bContext = contextIndex.get(b);

        bContext.getPred().store(s, concept);

        // queue(A) := queue(A) u U{B'|B' in S(B)}.O^(s.B')
        final IConceptSet sb = contextIndex.get(b).getS();

        // Computes the minimal set of QueueEntries from s.a [ bb is in O
        for (IntIterator itr = sb.iterator(); itr.hasNext();) {
            final int bb = itr.next();
            final ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> map = ontologyNF3.get(bb);

            if (null != map) {
                final Collection<IConjunctionQueueEntry> entries = map.get(s);
                if (null != entries) {
                    conceptQueue.addAll(entries);
                }
            }
        }

        // Handle reflexive roles
        if (reflexiveRoles.contains(s)) {
            // check for (a,a) in R(s)
            if (!pred.lookupConcept(s).contains(concept)) {
                processNewEdge(s, concept);
            }

            // check for (b,b) in R(s)
            Context tc = contextIndex.get(b);
            if (!tc.getPred().lookupConcept(s).contains(b)) {
                tc.processExternalEdge(s, b);
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        final List<int[]> work = new ArrayList<int[]>();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getS()) {
                final int t = nf5.getR();
                final int u = nf5.getT();
                final IConceptSet aTPrimes = pred.lookupConcept(t);

                // Again in this case there is a dependency with the
                // predecessors of an external context.
                final IConceptSet bUPrimes = contextIndex.get(b).getPred().lookupConcept(u);

                for (final IntIterator itr = aTPrimes.iterator();
                        itr.hasNext();) {
                    final int aa = itr.next();

                    if (!bUPrimes.contains(aa)) {
                        work.add(new int[] { aa, u });
                    }

                }
            }
        }

        for (final int[] pair : work) {
            if (pair[0] == concept) {
                processNewEdge(pair[1], b);
            } else {
                Context tc = contextIndex.get(pair[0]);
                tc.processExternalEdge(pair[1], b);
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        work.clear();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getR()) {
                final int t = nf5.getS();
                final int u = nf5.getT();
                // In this case there is a dependency with the
                // successors of an external context.
                final IConceptSet bTPrimes = contextIndex.get(b).getSucc().lookupConcept(t);
                final IConceptSet aUPrimes = succ.lookupConcept(u);

                for (final IntIterator itr = bTPrimes.iterator();
                        itr.hasNext();) {
                    final int bb = itr.next();

                    if (!aUPrimes.contains(bb)) {
                        work.add(new int[] { u, bb });
                    }

                }
            }
View Full Code Here

            final Set<Integer> keySet = map.keySet();
            for (int r : keySet) {
                final Collection<IConjunctionQueueEntry> entries = map.get(r);

                if (null != entries) {
                    final IConceptSet aPrimes = pred.lookupConcept(r);
                    for (final IntIterator itr = aPrimes.iterator(); itr.hasNext();) {
                        final int aa = itr.next();
                        // Add to queue aa
                        if (concept == aa) {
                            conceptQueue.addAll(entries);
                        } else {
View Full Code Here

        Context bContext = contextIndex.get(b);

        bContext.getPred().store(s, concept);

        // queue(A) := queue(A) u U{B'|B' in S(B)}.O^(s.B')
        final IConceptSet sb = contextIndex.get(b).getS();

        // Computes the minimal set of QueueEntries from s.a [ bb is in O
        for (IntIterator itr = sb.iterator(); itr.hasNext();) {
            final int bb = itr.next();
            final ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> map = ontologyNF3.get(bb);

            if (null != map) {
                final Collection<IConjunctionQueueEntry> entries = map.get(s);
                if (null != entries) {
                    conceptQueue.addAll(entries);
                }
            }
        }

        // Handle reflexive roles
        if (reflexiveRoles.contains(s)) {
            // check for (a,a) in R(s)
            if (!pred.lookupConcept(s).contains(concept)) {
                processNewEdgeTracking(s, concept);
            }

            // check for (b,b) in R(s)
            Context tc = contextIndex.get(b);
            if (!tc.getPred().lookupConcept(s).contains(b)) {
                tc.processExternalEdge(s, b);
                affectedContexts.add(tc);
                tc.startTracking();
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        final List<int[]> work = new ArrayList<int[]>();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getS()) {
                final int t = nf5.getR();
                final int u = nf5.getT();
                final IConceptSet aTPrimes = pred.lookupConcept(t);

                // Again in this case there is a dependency with the
                // predecessors of an external context.
                final IConceptSet bUPrimes =
                        contextIndex.get(b).getPred().lookupConcept(u);

                for (final IntIterator itr = aTPrimes.iterator();
                        itr.hasNext();) {
                    final int aa = itr.next();

                    if (!bUPrimes.contains(aa)) {
                        work.add(new int[] { aa, u });
                    }

                }
            }
        }

        for (final int[] pair : work) {
            if (pair[0] == concept) {
                processNewEdgeTracking(pair[1], b);
            } else {
                Context tc = contextIndex.get(pair[0]);
                tc.processExternalEdge(pair[1], b);
                affectedContexts.add(tc);
                tc.startTracking();
                if (tc.activate()) {
                    parentTodo.add(tc);
                }
            }
        }

        work.clear();
        for (final NF5 nf5 : ontologyNF5) {
            if (s == nf5.getR()) {
                final int t = nf5.getS();
                final int u = nf5.getT();
                // In this case there is a dependency with the
                // successors of an external context.
                final IConceptSet bTPrimes = contextIndex.get(b).getSucc()
                        .lookupConcept(t);
                final IConceptSet aUPrimes = succ.lookupConcept(u);

                for (final IntIterator itr = bTPrimes.iterator();
                        itr.hasNext();) {
                    final int bb = itr.next();

                    if (!aUPrimes.contains(bb)) {
                        work.add(new int[] { u, bb });
                    }

                }
            }
View Full Code Here

        final Context ctx = contextIndex.get(key);
        CR succ = ctx.getSucc();
       
        for(int roleId : succ.getRoles()) {
            NamedRole role = new NamedRole(factory.lookupRoleId(roleId).toString());
            IConceptSet values = getLeaves(succ.lookupConcept(roleId));
            for (IntIterator itr2 = values.iterator(); itr2.hasNext(); ) {
                int valueInt = itr2.next();
                if (!factory.isVirtualConcept(valueInt)) {
                    final String valueId = factory.lookupConceptId(valueInt).toString();
                    result.add(new Existential(role, new NamedConcept(valueId)));
                } else {
View Full Code Here

TOP

Related Classes of au.csiro.snorocket.core.util.IConceptSet

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.