Examples of SparqlSelectXmlWriter


Examples of org.jrdf.query.answer.xml.SparqlSelectXmlWriter

    private SparqlWriter createAnswerWriter(Writer writer) throws XMLStreamException {
        final String[] variableNames = answer.getVariableNames();
        final Iterator<TypeValue[]> typeValues = answer.columnValuesIterator();
        final long maxRows = answer.numberOfTuples();
        if (APPLICATION_SPARQL_XML.equals(getMediaType())) {
            return new SparqlSelectXmlWriter(writer, variableNames, typeValues, maxRows);
        } else if (APPLICATION_SPARQL_JSON.equals(getMediaType())) {
            return new SparqlSelectJsonWriter(writer, new String[0], variableNames, typeValues, maxRows);
        } else {
            throw new RuntimeException("Unknown media type: " + getMediaType());
        }
View Full Code Here

Examples of org.jrdf.query.answer.xml.SparqlSelectXmlWriter

                "        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();
        String xmlString = writer.toString();
        System.out.printf("Query result xml:\n" + xmlString);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.