LibreCat / Catmandu-RDF

Catmandu modules for working with RDF data
https://metacpan.org/release/Catmandu-RDF
Other
5 stars 6 forks source link

Problem with variable bindings in TPF query #30

Closed cKlee closed 8 years ago

cKlee commented 8 years ago

Hi!

With the command

catmandu convert RDF --url http://data.linkeddatafragments.org/viaf --sparql 'SELECT DISTINCT ?id WHERE {?id a <http://schema.org/Person> . ?id ?p  "Schoen, E." .  }'

(Get me the IRI of the LDF with type schema:Person and "Schoen, E." as a literal object value).

I get the result

[
  {"id":"(triplePattern)"},
  {"id":"http://viaf.org/viaf/251001189"},
  {"id":"http://viaf.org/viaf/80469151"},
  {"id":"http://viaf.org/viaf/sourceID/DNB%7C1023695367#skos:Concept"}
]

What I would expect is

[
  {"id":"(triplePattern)"},
  {"id":"http://viaf.org/viaf/251001189"},
  {"id":"http://viaf.org/viaf/80469151"}
]

since http://viaf.org/viaf/sourceID/DNB%7C1023695367#skos:Concept is a skos:Concept and not a schema:Person. See comparison of fragments:

With some minor changes to the query:

catmandu convert RDF --url http://data.linkeddatafragments.org/viaf --sparql 'SELECT DISTINCT ?id WHERE {?id a <http://schema.org/Person> . ?id ?p  "Schoen, E." .  ?id a ?type . }'

I now get the result

[
  {"id":"http://viaf.org/viaf/251001189"},
  {"id":"http://viaf.org/viaf/80469151"}
]

http://viaf.org/viaf/sourceID/DNB%7C1023695367#skos:Concept is gone now. But (triplePattern) also?

Seems like in the first query the variable bindings are not working correctly and in the second query the (triplePattern) graph vanishes.

We have a local LDF server with the GND data. Here's the same effect.

cKlee commented 8 years ago

See also the query with the LDF client

phochste commented 8 years ago

Yes this is more an issue for RDF::LDF. This (triplePattern) and "http://viaf.org/viaf/sourceID/DNB%7C1023695367#skos:Concept" are statements that are part of the LDF envolope that aren't removed from the final response.

The issues is fixed in RDF::LDF 0.22 which is on its way to CPAN now

cKlee commented 8 years ago

Wow, very fast response. Thanks Patrick! It's working now.