Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.RippleValue


    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        RippleValue s = stack.getFirst();
        stack = stack.getRest();

        String result = mc.toString(s).toUpperCase();

        solutions.put(
View Full Code Here


    }

    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleValue x;
        RippleList stack = arg;

        x = stack.getFirst();
        stack = stack.getRest();

        if (x instanceof KeyValueValue) {
            RippleValue result = ((KeyValueValue) x).getValue(key, mc);
            solutions.put(
                    stack.push(result));
        } else {
            throw new RippleException("argument is not a JSON value: " + x);
        }
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        RippleValue a, b, result;

        b = stack.getFirst();
        stack = stack.getRest();
        a = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        RippleValue a, b, result;

        b = stack.getFirst();
        stack = stack.getRest();
        a = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        RippleValue a, b, result;

        b = stack.getFirst();
        stack = stack.getRest();
        a = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        RippleValue v;

        v = stack.getFirst();
        stack = stack.getRest();

        solutions.put(
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        RippleValue a, b, result;

        a = stack.getFirst();
        stack = stack.getRest();
        b = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        RippleValue y, x;

        y = stack.getFirst();
        stack = stack.getRest();
        x = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleValue a, b, result;
        RippleList stack = arg;

        b = stack.getFirst();
        stack = stack.getRest();
        a = stack.getFirst();
View Full Code Here

     * @param stack the stack to print.  May not be a nil list.
     * @throws RippleException if something goes awry
     */
    public void put(final RippleList stack) throws RippleException {
        // Grab the topmost item on the stack.
        RippleValue subject = stack.getFirst();

        // View the list in right-to-left order
        RippleList list = stack.invert();

        String prefix = "  [" + ++index + "]" + INDEX_SEPARATOR;
        String prefixIndent = "                ".substring(0, prefix.length());
        printStream.print(prefix);
        //printStream.print( "" + ++index + " ->" + INDEX_SEPARATOR );
        //printStream.print( "rdf:_" + ++index + INDEX_SEPARATOR );

        if (printEntireStack) {
            list.printTo(printStream, false);
        } else {
            subject.printTo(printStream);
        }

        printStream.print("\n");

        if (showEdges && !stack.isNil()) {
            Collector<RippleValue> predicates = new Collector<RippleValue>();
            helper.findPredicates(subject, predicates);

            int predCount = 0;

            for (Iterator<RippleValue> predIter = predicates.iterator();
                 predIter.hasNext(); ) {
                printStream.print(prefixIndent);
                printStream.print(INDENT);

                // Stop after maxPredicates predicates have been displayed, unless
                // maxPredicates < 0, which indicates an unlimited number of
                // predicates.
                if (maxPredicates >= 0 && ++predCount > maxPredicates) {
                    printStream.print("[...]\n");
                    break;
                }

                RippleValue predicate = predIter.next();
                printStream.print(predicate);
                printStream.print("\n");

                Collector<RippleValue> objects = new Collector<RippleValue>();
                StatementPatternQuery query = new StatementPatternQuery(subject, predicate, null);
                modelConnection.query(query, objects, false);

                int objCount = 0;

                Collection<RippleValue> objColl;
                if (deduplicateObjects) {
                    objColl = new HashSet<RippleValue>();
                    objColl.addAll(objects);
                } else {
                    objColl = objects;
                }

                for (Iterator<RippleValue> objIter = objColl.iterator();
                     objIter.hasNext(); ) {
                    printStream.print(prefixIndent);
                    printStream.print(INDENT);
                    printStream.print(INDENT);

                    // Stop after maxObjects objects have been displayed, unless
                    // maxObjects < 0, which indicates an unlimited number of
                    // objects.
                    if (maxObjects >= 0 && ++objCount > maxObjects) {
                        printStream.print("[...]\n");
                        break;
                    }

                    RippleValue object = objIter.next();
                    printStream.print(object);
                    printStream.print((objIter.hasNext())
                            ? ","
                            : (predIter.hasNext())
                            ? ";" : ".");
View Full Code Here

TOP

Related Classes of net.fortytwo.ripple.model.RippleValue

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.