The section of a SPARQL SELECT XML result looks like:
...
<results>
<result>
<binding name="x"> ... </binding>
<binding name="hpage"> ... </binding>
</result>
...
An ASK result looks like:
...
<boolean>true</boolean>
...
The with the value inside the boolean either true or false (or possibly fred - depending on how you parse it - it would be nice to have an XSD). One set of results live in a results/result/binding and the other in a boolean. A simpler way to do it is just to use the absence or presence of a binding within the results/result.
For true:
<results>
<result>
<binding/>
</result>
</results>
For false:
...
<results>
<result/>
</results>
...
The JSON looks pretty much the same:
{
...
bindings : [{}] // true
bindings : [] // false
}
No parsing of true or false or having special cases for code producing or consuming SPARQL different kinds of answers.
No comments:
Post a Comment