Package net.fortytwo.ripple.query

Examples of net.fortytwo.ripple.query.LazyEvaluatingIterator


                stack = stack.push(modelConnection.canonicalValue(
                        new RDFValue(valueFactory.nativize(predicate)))).push(Operator.OP);
                //System.out.println("\t\tstack (new) = " + stack);

                CloseableIteration<RippleList, RippleException> solutions
                        = new LazyEvaluatingIterator(stack, modelConnection);
                /*
                Collector<StackContext, RippleException> solutions = new Collector<StackContext, RippleException>();
                evaluator.apply(new StackContext(stack, modelConnection), solutions);

                Collection<RippleList> stacks = new LinkedList<RippleList>();
                for (StackContext c : solutions) {
                    //System.out.println("\tsolution: " + c);
                    RippleList s = c.getStack();
                    if (!s.isNil()) {
                        stacks.add(s);
                    }
                }

                return new SolutionIteration(stacks.iterator(), false, subject, predicate, object, contexts);
                */

                return new SolutionIteration(solutions, false, subject, predicate, object, contexts);
            }

            // Backward traversal
            else if (null == subject) {
                if (!(object instanceof RippleSesameValue)) {
                    object = valueFactory.nativize(object);
                }
                RippleList stack = ((RippleSesameValue) object).getStack();
                if (null == stack) {
                    stack = modelConnection.list().push(modelConnection.canonicalValue(new RDFValue(object)));

                    // Note: this may or may not be worth the extra CPU cycles.
                    ((RippleSesameValue) object).setStack(stack);
                }

                stack = stack.push(modelConnection.canonicalValue(new RDFValue(predicate)))
                        .push(ControlLibrary.getInverseValue())
                        .push(Operator.OP)
                        .push(Operator.OP);
                //System.out.println("stack = " + stack);

                CloseableIteration<RippleList, RippleException> solutions
                        = new LazyEvaluatingIterator(stack, modelConnection);
                /*
                Collector<StackContext, RippleException> solutions = new Collector<StackContext, RippleException>();
                evaluator.apply(new StackContext(stack, modelConnection), solutions);

                Collection<RippleList> stacks = new LinkedList<RippleList>();
View Full Code Here

TOP

Related Classes of net.fortytwo.ripple.query.LazyEvaluatingIterator

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.