- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Fri, 24 Nov 2017 10:40:40 -0500
- To: Anthony Durity <a.durity@umail.ucc.ie>
- Cc: Ian Dickinson <i.j.dickinson@gmail.com>, W3C Ruby RDF mailing list <public-rdf-ruby@w3.org>
- Message-Id: <FAFC5A7B-98D8-407F-A5DD-A37146346168@greggkellogg.net>
> On Nov 24, 2017, at 7:05 AM, Anthony Durity <a.durity@umail.ucc.ie> wrote: > > Ok, having looked at the code for RDF::Node I guess my question is. Why is #eql? different to #== for RDF::Node ? That gives me the situation where terms.last == n is true but terms.include?(n) gives me false. This is because, unless they’re defined in the same document, _:foo.eql?(_:foo). Blank Nodes are simple place holders, and the names have no meaning. The only reason they have labels, is so that, within a serialization, the same node can be referenced. If we were to change the sense of #eql? to allow for this, a lot of code (e.g., SPARQL and BGP matching) would break. Node#== (and Node#===) do allow equivalence on Blank Node label, and the specific semantics derive from SPARQL::Algebra::Operator::Equal, including the ability to raise an exception if the node types are not the same. The differences are where you might have two graphs both using _:foo, and a pattern (_:foo <p> “bar”) that needs these to be treated as separate statements, and not the same statement. Node#== comes into play for a query such as SELECT ?x WHERE { ?x1 :p ?v1 . ?x2 :p ?v2 . FILTER ( ?v1 = ?v2 ) . } Working with Blank Nodes is complicated, and best to avoid because of the nature of Blank Nodes not being independently identifiable, by design. Gregg > On 24 November 2017 at 09:14, Ian Dickinson <i.j.dickinson@gmail.com <mailto:i.j.dickinson@gmail.com>> wrote: > Hi Anthony, > On Thu, Nov 23, 2017 at 10:13 PM, Anthony Durity <a.durity@umail.ucc.ie <mailto:a.durity@umail.ucc.ie>> wrote: > > I was working under the impression that 'local scope' meant local to the > > repo. > > > > Given that I have: > > [ > > #<RDF::URI:0x2ac3bff25014 URI:https://dh.ucc.ie/entity/α54 <https://dh.ucc.ie/entity/%CE%B154>>, > > #<RDF::URI:0x2ac3be8bc444 URI:http://www.wikidata.org/prop/direct/P31 <http://www.wikidata.org/prop/direct/P31>>, > > #<RDF::URI:0x2ac3bff2c5d0 URI:http://www.wikidata.org/entity/Q187685 <http://www.wikidata.org/entity/Q187685>>, > > #<RDF::URI:0x2ac3bff32b60 URI:https://dh.ucc.ie/entity/α55 <https://dh.ucc.ie/entity/%CE%B155>>, > > #<RDF::URI:0x2ac3bff3f9f0 URI:https://dh.ucc.ie/entity/α56 <https://dh.ucc.ie/entity/%CE%B156>>, > > #<RDF::URI:0x2ac3be892504 URI:https://dh.ucc.ie/entity/α57 <https://dh.ucc.ie/entity/%CE%B157>>, > > #<RDF::Node:0x2ac3c025570c(_:g47253167721100)>, > > #<RDF::Node:0x2ac3bf67d7b8(_:59)>, > > #<RDF::Node:0x2ac3c0265d50(_:α60)> > > ] > > what's the best way to match the blank node 'α60' ? I tried “intern” just > > there and it didn't work :/ > > I think it would be easier to offer advice if you could back up a bit > and say what you're > trying to achieve? As Gregg said, bNodes can be funny things, so the 'best > way' to handle them tends to be a bit "well, it depends ..."! > > Ian >
Received on Friday, 24 November 2017 15:41:08 UTC