On 03.04.20 09:35, Martynas Jusevičius wrote:
> Lorenz,
>
> I think what I did is
>
> []  rdf:type    rs:ResultSet ;
>     rs:boolean  "true"^^xsd:boolean .
right, I'm dumb ... sorry, should read more carefully, then think, then
reply :D
>
> which is what this ASK test result shows:
> https://www.w3.org/2001/sw/DataAccess/tests/data/extracted-examples/true.ttl
>
>
> I realise I had basically the same question already a few years ago:
> https://mail-archives.apache.org/mod_mbox/jena-users/201803.mbox/%3cCAE35Vmyd=a4goxbkufmxij-jdesp1wbz6zde26zey1mu15q...@mail.gmail.com%3e
> Not having ResultSet for ASK results breaks the media type/class
> mapping, which our JAX-RS code relies on.
>
> Andy's suggestion was to use ResultsReader:
> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/resultset/rw/ResultsReader.html
Well, that is correct. It's called **Results**Reader not
**ResultSet**Reader. But, as you can see, you'd have to call |readAny()
and the return type is a SPARQLResult. At least that's how I understand
the docs.|||
>
> But since you write "ResultSet is exclusively for SELECT result
> format", I don't suppose it helps to create an ASK result either?

Well, at least what I stated is also mentioned in the Javadoc of
SPARQLResult [1]:

> The class "ResultSet" is reserved for the SELECT result format. This
> class can hold a ResultSet, a boolean or a Model.


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

>
> On Fri, Apr 3, 2020 at 8:42 AM Lorenz Buehmann
> <[email protected]> wrote:
>> 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