ResultSet is exclusively for SELECT result format. If I'm not mistaken,
anything beyond is wrapped in SPARQLResult class [1], so you can simply do

SPARQLResult res = new SPARQLResult(true)

and you're done.


Also, what you did is basically

[] rdf:type true

sounds a bit odd, right?


[1]
https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/sparql/resultset/SPARQLResult.html

On 02.04.20 23:32, Martynas Jusevičius wrote:
> Hi,
>
> I'm trying to create a ResultSet from a boolean using
> ResultSetGraphVocab (as I haven't found a simpler way):
>
>     Model m = ModelFactory.createDefaultModel();
>     m.createResource().
>         addProperty(RDF.type, ResultSetGraphVocab.ResultSet).
>         addLiteral(ResultSetGraphVocab.p_boolean, true);
>
>     ResultSetFormatter.asXMLString(ResultSetFactory.makeResults(m));
>
> What I get is:
>
> <?xml version="1.0"?>
> <sparql xmlns="http://www.w3.org/2005/sparql-results#";>
>   <head>
>   </head>
>   <results>
>   </results>
> </sparql>
>
> What I expect to get is:
>
> <?xml version="1.0"?>
> <sparql xmlns="http://www.w3.org/2005/sparql-results#";>
>   <head></head>
>   <boolean>true</boolean>
> </sparql>
>
> as per
>
> https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#ask
> and
> https://www.w3.org/2001/sw/DataAccess/tests/#spec-10-5
>
> Is there an error or is this a bug?
>
>
> Martynas

Reply via email to