Hi all rdf/sparql developpers. Here a question that have been nagging me for a while now but it seems nobody has answered it accurately since the rdf and sparql specifications have been released.
To state the case, RDF defines several ways to deal with multi-valued properties for resources; from creating as many triples with same subjet-predicate uris to collections or containers. That's all good since each pattern has its own characteristics.
But seen from the SPARQL point-of-view, it seems to me that querying those structures leads to overly complicated queries that (that's worse) are unable to transcribe into a sensible resultset: you cannot use variables to query arbitrary-length and propertyPath does not preserve "natural" order.
In a naïve way, in many SELECT or ASK queries, if I want to query or filter on the container's or list's values, I won't most of the time care what the underlying pattern really is (if any). So for instance:
<rdf:Description rdf:about="urn:1">
<rdfs:label>
<rdf:Alt>
<rdf:li xml:lang="fr">Exemple n°1</rdf:li>
<rdf:li xml:lang="en">Example #1</rdf:li>
</rdf:Alt>
</rdfs:label>
<my:release>
<rdf:Seq>
<rdf:li>10.0</rdf:li>
<rdf:li>2.4</rdf:li>
<rdf:li>1.1.2</rdf:li>
<rdf:li>0.9</rdf:li>
</rdf:Seq>
</my:release>
</rdf:Description>
<rdf:Description rdf:about="urn:2">
<rdfs:label xml:lang="en">Example #2</rdfs:label>
</rdf:Description>
Obviously I would expect both resource to answer the query:
SELECT ?res WHERE { ?res rdfs:label ?label . FILTER ( contains(?label, 'Example'@en) }
I would also expect the query :
SELECT ?ver WHERE { <urn:1> my:release ?ver }
to return the rdf:Seq elements (or any rdf:Alt's for that matter) in original order (for the other patterns, it wouldn't matter if original order is preserved or not so why not keep it anyway ?) - unless explicitely specified through an ORDER BY clause.
Of course, it would be necessary to preserve compatibility with the old way, so perhaps a possibility would be to extend the propertyPath syntax with a new operator?
I feel it would simplify a lot the day-to-day SPARQL use-case.
Does it make sense to you? Moreover, do you see any reason why not to try implementing this?
EDIT corrected the example's urn:2 rdfs:label value that was incorrect