Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.RDFValue


        stSink = new Sink<Statement>() {
            public void put(final Statement st) throws RippleException {
//System.out.println( "adding statement: " + st );
                if (0 == contexts.length) {
                    mc.add(new RDFValue(st.getSubject()),
                            new RDFValue(st.getPredicate()),
                            new RDFValue(st.getObject()));
                } else {
                    for (Resource c : contexts) {
                        mc.add(new RDFValue(st.getSubject()),
                                new RDFValue(st.getPredicate()),
                                new RDFValue(st.getObject()),
                                new RDFValue(c));
                    }
                }
            }
        };
View Full Code Here


        if (v instanceof Literal) {
            URI type = ((Literal) v).getDatatype();

            if (null != type) {
                solutions.put(
                        stack.push(new RDFValue(type)));
            }
        }
    }
View Full Code Here

        URI s;

        s = URI.create(mc.toString(stack.getFirst()));
        stack = stack.getRest();

        RDFValue uri = mc.valueOf(s);

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

    public void evaluate(final Sink<RippleList> sink,
                         final QueryEngine qe,
                         final ModelConnection mc)
            throws RippleException {
        RDFValue v = mc.valueOf(value);
        sink.put(mc.list().push(mc.canonicalValue(v)));
    }
View Full Code Here

    public void findPredicates(final RippleValue subject,
                               final Sink<RippleValue> sink)
            throws RippleException {
        final Sink<Value> valueSink = new Sink<Value>() {
            public void put(final Value v) throws RippleException {
                sink.put(connection.canonicalValue(new RDFValue(v)));
            }
        };

        Sink<Statement> predSelector = new Sink<Statement>() {
            Sink<Value> predSink = new DistinctFilter<Value>(valueSink);

            public void put(final Statement st) throws RippleException {
                //TODO: don't create a new RdfValue before checking for uniqueness
                predSink.put(st.getPredicate());
            }
        };

        RDFValue v = subject.toRDF(connection);
        // Not all RippleValues have an RDF identity.
        if (null != v) {
            connection.getStatements(v, null, null, predSelector);
        }
    }
View Full Code Here

        if (null == rdfEquivalent) {
            switch (type) {
                case INTEGER:
                    // Don't use ValueFactory.creatLiteral(int), which (at
                    // least in this case) produces xsd:int instead of xsd:integer
                    rdfEquivalent = new RDFValue(
                            smc.getValueFactory().createLiteral("" + number.intValue(), XMLSchema.INTEGER));
                    break;
                case LONG:
                    rdfEquivalent = new RDFValue(
                            smc.getValueFactory().createLiteral(number.longValue()));
                    break;
                case DOUBLE:
                    rdfEquivalent = new RDFValue(
                            smc.getValueFactory().createLiteral(number.doubleValue()));
                    break;
                case FLOAT:
                    rdfEquivalent = new RDFValue(
                            smc.getValueFactory().createLiteral(number.floatValue()));
                    break;
                case DECIMAL:
                    rdfEquivalent = new RDFValue(
                            smc.getValueFactory().createLiteral(number.toString(), XMLSchema.DECIMAL));
                    break;
            }
        }
View Full Code Here

        String b = mc.toString(stack.getFirst());
        stack = stack.getRest();
        String a = mc.toString(stack.getFirst());
        stack = stack.getRest();

        RDFValue result = mc.valueOf(a.contains(b));

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

        this.term = term;
    }

    public void execute(final QueryEngine qe, final ModelConnection mc)
            throws RippleException {
        RDFValue uri = mc.valueOf(java.net.URI.create(qe.getLexicon().getDefaultNamespace() + term));
//System.out.println("uri = " + uri);
        mc.remove(uri, null, null);
        mc.commit();
        mc.getModel().getSpecialValues().remove(uri.sesameValue());
    }
View Full Code Here

        } else {
            // Note: the first element of the list will also be a list
            RippleList expr = (RippleList) expressions.iterator().next().getFirst();
//System.out.println( "exprList = " + exprList );

            RDFValue id = mc.valueOf(java.net.URI.create(qe.getLexicon().getDefaultNamespace() + name));
            expr.setRDF(id);
            mc.internalize(expr);
            mc.commit();

            qe.getLexicon().addURI((URI) id.sesameValue());
            mc.getModel().getSpecialValues().put(id.sesameValue(), expr);
        }
    }
View Full Code Here

            };

            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);
View Full Code Here

TOP

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

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.