Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the RDF-Query CPAN distribution.

Report information
The Basics
Id: 63155
Status: open
Priority: 0/
Queue: RDF-Query

People
Owner: gwilliams [...] cpan.org
Requestors: ONEGRAY [...] cpan.org
oneingray [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Ivan Shmakov <oneingray [...] gmail.com>
Subject: the handling of a template with a blank node is seemingly incorrect
Date: Sat, 20 Nov 2010 02:14:57 +0600
To: bug-RDF-Query [...] rt.cpan.org
From: Ivan Shmakov <ivan [...] main.uusia.org>
Download (untitled) / with headers
text/plain 1.2k
I'm trying to execute an example query from [1]: $ cat data.ttl @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:givenname "Alice" . _:a foaf:family_name "Hacker" . _:b foaf:firstname "Bob" . _:b foaf:surname "Hacker" . $ cat query.sparql PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> CONSTRUCT { ?x vcard:N _:v . _:v vcard:givenName ?gname . _:v vcard:familyName ?fname . } WHERE { { ?x foaf:firstname ?gname } UNION { ?x foaf:givenname ?gname } . { ?x foaf:surname ?fname } UNION { ?x foaf:family_name ?fname } . } $ Contrary to what the specification says, only a single node seems to be produced for _:v (with /two/ vcard:N arcs pointing at it): $ rdf-query-2010-11-19 \ data.ttl "$(cat < query.sparql)" _:rad698bec6861467e87b15dbf8dbeda12r1 <http://www.w3.org/2001/vcard-rdf/3.0#N> _:r1290196899r0 . _:r1290196899r0 <http://www.w3.org/2001/vcard-rdf/3.0#givenName> "Bob" ; <http://www.w3.org/2001/vcard-rdf/3.0#familyName> "Hacker" . _:rad698bec6861467e87b15dbf8dbeda12r0 <http://www.w3.org/2001/vcard-rdf/3.0#N> _:r1290196899r0 . $ [1] http://www.w3.org/TR/sparql11-query/#tempatesWithBNodes -- FSF associate member #7257
### rdf-query-2010-11-19.pl -*- Perl -*- use strict; use warnings; require RDF::Query; require RDF::Trine::Model; require RDF::Trine::Serializer::Turtle; require RDF::Trine::Store::Memory; sub show_graph { my ($iter) = @_; my $s = new RDF::Trine::Serializer::Turtle (); print ($s->serialize_iterator_to_string ($iter), "\n"); } sub show_results { my ($iterator) = @_; for ( ; my $row = $iterator->next (); ) { foreach my $k (keys (%$row)) { print (" ", $k, " ", $row->{$k}); } print ("\n"); } } die ("Usage: rdf-query-2010-11-19 TURTLE-FILE QUERY") unless (1 + $#ARGV == 2); my ($file, $sparql) = @ARGV; my $store = RDF::Trine::Store->new_with_config ({ "storetype" => "Memory", "sources" => [ { "file" => $file, "syntax" => "turtle", "base_uri" => "x-dummy:uri" } ] }); my $model = new RDF::Trine::Model ($store); my $query = new RDF::Query ($sparql) or die ("Cannot create RDF:Query: ", $!, ": "); my $iterator = $query->execute ($model); if ($iterator->isa ('RDF::Trine::Iterator::Graph')) { show_graph ($iterator); } else { show_results ($iterator); } ## Local variables: ## fill-column: 72 ## indent-tabs-mode: nil ## End: ### rdf-query-2010-11-19.pl ends here
Download (untitled)
application/pgp-signature 196b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 277b
Ivan, Thanks for the bug report. Another good catch. This seems to be a regression in the 2.9xx line of releases (I'm not sure exactly when it broke, but I know what code did it). I'll get a fix committed and try to get a new release out this week to fix it. thanks, .greg


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.