On Tue, 2008-10-21 at 11:37 +0100, Hugh Williams wrote:
> Hi Sergio,
Hi Hugh,
> I would expect "DISTINCT" to work as I used it quite often in SPARQL
> queries against Virtuoso.
Me too. Works fine with a DISTINCT for whole elements in a SELECT.
> Can you provide a test case for us to see this problem first hand,
> either a server instance we can access online or a dataset we can load
> locally to recreate.
It's just a set of people (sorry, in an instance of Virtuoso in our
intranet).
> The Virtuoso explain function [1] can be used to obtain the query
> execution plan for the query and can be run from isql or the conductor
> isql interface as follows:
>
>
> explain('SPARQL SELECT DISTINCT(?name) ?person ?mail WHERE { ?person
> rdf:type foaf:Person . ?person foaf:name ?name . ?person
> foaf:mbox_sha1sum ?mail}')
>
>
> If you can provide this output it would be useful for analysis if we
> cannot access the server ourselves.
Yes, sure. Please, find it attached.
> What is the version of the Virtuoso Server you are using ?
Latest one, 5.0.9rc6.
Best regards,
--
Sergio Fernández - [email protected]
Departamento I+D+i
Fundación CTIC - www.fundacionctic.org
Tlfn: +34 984 29 12 12
Fax: +34 984 39 06 12
Edificio Centros Tecnológicos
Parque Científico Tecnológico
33203 Cabueñes - Gijón - Asturias - Spain
SQL> explain('SPARQL SELECT DISTINCT(?name) ?person ?mail FROM
<http://ctic.info/geek/merged> WHERE { ?person
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://xmlns.com/foaf/0.1/Person> . ?person <http://xmlns.com/foaf/0.1/name>
?name . ?person <http://xmlns.com/foaf/0.1/mbox_sha1sum> ?mail}');
REPORT
VARCHAR
_______________________________________________________________________________
{
Precode:
0: $26 "nfo/geek/merged" := Call __i2idn (<constant
(http://ctic.info/geek/merged)>)
5: $27 "-ns#type" := Call __i2idn (<constant
(http://www.w3.org/1999/02/22-rdf-syntax-ns#type)>)
10: $28 "com/foaf/0.1/Person" := Call __i2idn (<constant
(http://xmlns.com/foaf/0.1/Person)>)
15: $29 "com/foaf/0.1/mbox_sha1sum" := Call __i2idn (<constant
(http://xmlns.com/foaf/0.1/mbox_sha1sum)>)
20: $30 "com/foaf/0.1/name" := Call __i2idn (<constant
(http://xmlns.com/foaf/0.1/name)>)
25: BReturn 0
from DB.DBA.RDF_QUAD by RDF_QUAD_OGPS 3.8e+04 rows
Key RDF_QUAD_OGPS ASC ($32 "s-1-1-t0.S")
<col=415 O = $28 "com/foaf/0.1/Person"> , <col=412 G = $26 "nfo/geek/merged"> ,
<col=414 P = $27 "-ns#type">
row specs: <col=415 O LIKE <constant (T�)>>
Current of: <$34 "<DB.DBA.RDF_QUAD s-1-1-t0>" spec 5>
Precode:
0: $35 "person" := Call __id2i ($32 "s-1-1-t0.S")
5: BReturn 0
from DB.DBA.RDF_QUAD by RDF_QUAD 0.5 rows
Key RDF_QUAD ASC ($38 "s-1-1-t2.S", $37 "s-1-1-t2.O")
inlined <col=412 G = $26 "nfo/geek/merged"> , <col=413 S = $32 "s-1-1-t0.S"> ,
<col=414 P = $29 "com/foaf/0.1/mbox_sha1sum">
Current of: <$40 "<DB.DBA.RDF_QUAD s-1-1-t2>" spec 5>
Precode:
0: $41 "mail" := Call __ro2sq ($37 "s-1-1-t2.O")
5: BReturn 0
from DB.DBA.RDF_QUAD by RDF_QUAD 0.5 rows
Key RDF_QUAD ASC ($43 "s-1-1-t1.O")
inlined <col=412 G = $26 "nfo/geek/merged"> , <col=413 S = $32 "s-1-1-t0.S"> ,
<col=414 P = $30 "com/foaf/0.1/name">
Current of: <$45 "<DB.DBA.RDF_QUAD s-1-1-t1>" spec 5>
After code:
0: $46 "name" := Call __ro2sq ($43 "s-1-1-t1.O")
5: BReturn 0
Distinct (HASH) ($46 "name", $35 "person", $41 "mail")
Select ($46 "name", $35 "person", $41 "mail", <$45 "<DB.DBA.RDF_QUAD s-1-1-t1>"
spec 5>, <$40 "<DB.DBA.RDF_QUAD s-1-1-t2>" spec 5>, <$34 "<DB.DBA.RDF_QUAD
s-1-1-t0>" spec 5>)
}
40 Rows. -- 16 msec.