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 a = stack.getFirst();
        stack = stack.getRest();

        String result = StringUtils.sha1SumOf(mc.toString(a));
        solutions.put(
                stack.push(StringLibrary.value(result, mc, a)));
View Full Code Here


        boolean x;

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

        RippleValue result = mc.valueOf(!x);

        solutions.put(
                stack.push(result));
    }
View Full Code Here

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

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

        String result = StringUtils.percentDecode(mc.toString(a));
        solutions.put(
                stack.push(StringLibrary.value(result, mc, a)));
View Full Code Here

        x = mc.toBoolean(stack.getFirst());
        stack = stack.getRest();
        y = mc.toBoolean(stack.getFirst());
        stack = stack.getRest();

        RippleValue result = mc.valueOf((x && !y) || (!x && y));

        solutions.put(
                stack.push(result));
    }
View Full Code Here

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

                if (x) {
                    RippleValue t = mc.valueOf(true);
                    RippleValue f = mc.valueOf(false);
                    solutions.put(stack.push(t).push(f));
                    solutions.put(stack.push(f).push(t));
                } else {
                    RippleValue f = mc.valueOf(false);
                    solutions.put(stack.push(f).push(f));
                }
            }
        };
    }
View Full Code Here

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

        RippleList stack = arg;

        RippleValue subj, pred, obj, ctx;

        ctx = stack.getFirst();
        stack = stack.getRest();
        obj = 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 l;

        l = arg.getFirst();
        final RippleList rest = arg.getRest();

        Sink<RippleList> listSink = new Sink<RippleList>() {
            public void put(RippleList list) throws RippleException {
                RippleValue result = null;
                while (!list.isNil()) {
                    RippleValue v = list.getFirst();

                    if (null == result || mc.getComparator().compare(v, result) > 0) {
                        result = v;
                    }
View Full Code Here

        Model model = mc.getModel();
        if (model instanceof SesameModel) {
            RippleList stack = arg;

            RippleValue head = stack.getFirst();
            final RippleList rest = stack.getRest();

            final Sink<RippleValue> pushSink = new Sink<RippleValue>() {
                public void put(final RippleValue v) throws RippleException {
                    solutions.put(rest.push(v));
                }
            };

            Sink<Statement> stSink = new Sink<Statement>() {
                public void put(final Statement st) throws RippleException {
                    if ('_' == st.getPredicate().getLocalName().charAt(0)) {
                        pushSink.put(new RDFValue(st.getObject()));
                    }
                }
            };

            mc.getStatements(head.toRDF(mc), null, null, stSink);

            /*
            int i = 1;
            while (true) { // Break out when there are no more members to produce
                Collector<RippleValue, RippleException> results = new Collector<RippleValue, RippleException>();
View Full Code Here

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

        RippleValue l;

        l = stack.getFirst();
        final RippleList rest = stack.getRest();

        Sink<RippleList> listSink = new Sink<RippleList>() {
View Full Code Here

        Model model = mc.getModel();
        if (model instanceof SesameModel) {
            final RippleList stack = arg;

            final RippleValue obj = stack.getFirst();
            final RippleList rest = stack.getRest();

            Sink<Statement> stSink = new Sink<Statement>() {
                public void put(final Statement st) throws RippleException {
                    Resource context = st.getContext();

                    RippleValue subj = mc.canonicalValue(new RDFValue(st.getSubject()));
                    RippleValue pred = mc.canonicalValue(new RDFValue(st.getPredicate()));
                    RippleValue ctx = (null == context) ? mc.list() : mc.canonicalValue(new RDFValue(context));

                    solutions.put(rest.push(subj).push(pred).push(obj).push(ctx));
                }
            };
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.