Comments (3)
I think this is a case where the documentation is out of sync with the intended implementation. The fact that a variable does not match against the default graph stems from SPARQL semantics, where querying using an unbound graph name variable will not match the default graph. See 13.3.1 Accessing Graph Names:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?src ?bobNick
FROM NAMED <http://example.org/foaf/aliceFoaf>
FROM NAMED <http://example.org/foaf/bobFoaf>
WHERE
{
GRAPH ?src
{ ?x foaf:mbox <mailto:[email protected]> .
?x foaf:nick ?bobNick
}
}
Within RDF.rb, this happens because RDF::Query::Variable#eql?(false)
always returns false
, which it needs to do to be able to effectively do SPARQL queries. You can see how this is explicitly defined for RDF::Repository#query_pattern
:
Lines 405 to 412 in a889ba9
Of course, a different Repository implementation could do this differently, but I believe it would fail various SPARQL tests.
I believe the corrective action here is to update the method signatures in RDF::Query
to match this behavior. I'm afraid I don't have an easy solution to query against both the default and named graphs and get back the bound graph name. If you query a repository without using a variable for the graph_name position, you will get back all solutions, but you will not know what graph the solution came from.
from rdf.
Ok, that makes sense. Thank you for the write-up!
I guess I'm also confused by the fact that I use the SPARQL gem to build queries, and the way it handles the default graph differs from the way our usual triple store handles it.
I'll leave the issue open for that adjustment in the documentation, but other than that, it's good for me.
from rdf.
Ok, that makes sense. Thank you for the write-up!
I guess I'm also confused by the fact that I use the SPARQL gem to build queries, and the way it handles the default graph differs from the way our usual triple store handles it.
I'll leave the issue open for that adjustment in the documentation, but other than that, it's good for me.
Some triple stores treat the default graph as the union of all graphs in the dataset, but this is not a normative requirement. You can likely use the MergeGraph
class from https://github.com/ruby-rdf/rdf-aggregate-repo/blob/3.3.0/lib/rdf/aggregate_repo/merge_graph.rb to simulate this behavior, but it could also be a pretty trivial wrapper around an RDF::Dataset/Repository as well.
from rdf.
Related Issues (20)
- RDF::NTriples::Reader does not `require 'strscan'` HOT 3
- Ruby 2.7.1, URI.decode is obsolete
- bad behaviour in RDF::List HOT 7
- blank nodes reuse memory addresses, causing problems for persistent stores HOT 3
- Is there a "prettier" HOT 1
- Is there a more 'elegant' way to do this? HOT 3
- Strange "file missing" error with 3.1.14 release HOT 6
- Comparing two repositories HOT 2
- Verbose warnings on 2.7+ Ruby HOT 2
- 3.2.1 removes `RDF::Repository::Implementation::SerializedTransaction` HOT 5
- Is it possible to change the standard prefixes? HOT 7
- docmentation: how to create new vocabs, and langage-tagged strings in vocabs HOT 3
- Weird `require 'enumerator'` issue caused by this gem HOT 5
- change from DateTime < Literal to DateTime < Temporal breaks downstream customization HOT 5
- Invalid argument @ rb_sysopen - (Errno:EINVAL) when using local files on Windows HOT 10
- RDF::Vocabulary.find on RDF vocab returns RDF class HOT 5
- Ruby regexp warning: character class has duplicated range HOT 10
- Errno::EINVAL using `each_statement` with a LARGE, local NTriples file HOT 1
- Error when using local files on Windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdf.