" 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);
}