Package org.jrdf.sparql

Examples of org.jrdf.sparql.SparqlConnection


        XMLStreamException, URISyntaxException {
        final Triple triple = person.asTriple(new URI("http://example.org/terms#hasConfirmed"),
            new URI("http://example.org/statement#address1"));
        graph.add(triple);
        print("Graph now contains: ", graph);
        SparqlConnection connection = JRDF_FACTORY.getNewSparqlConnection();
        String query =
                "SELECT ?s ?add \n" +
                "WHERE { \n" +
                "        ?s <http://example.org/terms#hasConfirmed> ?add \n" +
                "        OPTIONAL { ?add <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?o } \n" +
                "        FILTER ( bound(?add) && !bound(?o) ) }";
        SelectAnswer answer = (SelectAnswer) connection.executeQuery(graph, query);
        System.out.println("Query Result:\n" + answer);
        StringWriter writer = new StringWriter();
        SparqlXmlWriter answerXMLWriter = new SparqlSelectXmlWriter(writer, answer.getVariableNames(),
            answer.columnValuesIterator(), answer.numberOfTuples());
        answerXMLWriter.writeFullDocument();
View Full Code Here

TOP

Related Classes of org.jrdf.sparql.SparqlConnection

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.