Bernhard Haslhofer wrote:
> Hi,
>
> for research purposes I have imported DBpedia dumps into a local Virtuoso
> 06.00.3123 instance using the following command:
>
> ttlp_mt (file_to_string_output ('$f'), '', '$g', 255);
>
> I am using the 255 flag cause I need all triples in the store, also the
> erroneous ones.
>
> Now, when executing the following query against the local SPARQL endpoint...
>
> select ?x where {?x ?y ?z} LIMIT 5
>
> ...everything is fine. I get the following result (in RDF/XML)
>
> <rdf:RDF xmlns:res="http://www.w3.org/2005/sparql-results#"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:nodeID="rset">
> <rdf:type rdf:resource="http://www.w3.org/2005/sparql-results#ResultSet" />
> <res:resultVariable>x</res:resultVariable>
> <res:solution rdf:nodeID="r0">
> <res:binding rdf:nodeID="r0c0"><res:variable>x</res:variable><res:value
> rdf:resource="http://dbpedia33.mminf.univie.ac.at/resource/%22S%22_Bridge_II"/></res:binding>
> </res:solution>
> ...
> </rdf:Description>
> </rdf:RDF>
>
> ...but if execute the same query using DISTINCT I get the following result
>
> <rdf:RDF xmlns:res="http://www.w3.org/2005/sparql-results#"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:nodeID="rset">
> <rdf:type rdf:resource="http://www.w3.org/2005/sparql-results#ResultSet" />
> <res:resultVariable>x</res:resultVariable>
> <res:solution rdf:nodeID="r0">
> <res:binding
> rdf:nodeID="r0c0"><res:variable>x</res:variable><res:value>http://dbpedia33.mminf.univie.ac.at/resource/%22S%22_Bridge_II</res:value></res:binding>
> </res:solution>
> ...
> </rdf:Description>
> </rdf:RDF>
>
> so the binding for ?x is interpreted as a literal and not a resource. When
> using client APIs such as Jena, the results are then converted into Literal
> objects which causes some troubles in the application I am currently working
> on.
>
> Did I miss anything or is this a known issue? Is there a way to fix that?
>
> Thanks a lot,
>
> Bernhard
>
Just a quick note to say I get the same as well, sometimes URI's come
back as Literals when using distinct;
further using distinct + group by prevents "order by" from working in
most cases ( apart from order by on a count() )
to replicate you can run these two on dbpedia sparql endpoint (or any
virtuoso 5/6)
correct: select ?p ?o where { <http://dbpedia.org/resource/HaXe> ?p ?o }
group by ?p order by desc(?o)
wrong: select distinct ?p ?o where { <http://dbpedia.org/resource/HaXe>
?p ?o } group by ?p order by desc(?o)
regards!