Empty <bnode/> and validating SPARQL XML results

Hi,

I'm getting some SPARQL XML results from Dydra with empty
<bnode></bnode> elements.

This is something I hadn't encountered before, and also impractical if
the nodes do not have the labels ready.

I looked at the spec but found only
"<binding><bnode>I</bnode></binding>" which kind of suggests there
should be a label.

To be sure, I decided to try validating the XML results against the
schema. I downloaded both
https://www.w3.org/2007/SPARQL/result.xsd
https://www.w3.org/2007/SPARQL/result.rng

and a random test file sq02.srx and attempted to validate against the
RNG and the XSD, but both failed inexplicably:

$ xmlstarlet val -r result.rng -e sq02.srx
sq02.srx:12.10: Did not expect element sparql there
sq02.srx:12.10: Did not expect element head there
sq02.srx:12.10: Did not expect element variable there
sq02.srx:12.10: Did not expect element variable there
sq02.srx:12.10: Did not expect element results there
sq02.srx:12.10: Did not expect element result there
sq02.srx:12.10: Did not expect element binding there
sq02.srx:12.10: Did not expect element uri there
sq02.srx:12.10: Did not expect text in element  TODO  content
sq02.srx:12.10: Did not expect element binding there
sq02.srx:12.10: Did not expect element uri there
sq02.srx:12.10: Did not expect text in element  TODO  content
sq02.srx - invalid

$ xmlstarlet val -s result.xsd -e sq02.srx
sq02.srx:1.55: Element
'{http://www.w3.org/2005/sparql-results#}sparql': No matching global
declaration available for the validation root.
sq02.srx - invalid

So the questions:
- is <bnode/> allowed?
- how does one validate? What are the schemas for if they don't work
-- or is it xmlstarlet?


Martynas

Received on Wednesday, 7 October 2020 10:45:34 UTC