- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Fri, 24 Nov 2017 10:49:43 -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: <12289A2C-3764-45F9-A3BD-122ACE4B2F59@greggkellogg.net>
> On Nov 24, 2017, at 7:21 AM, Anthony Durity <a.durity@umail.ucc.ie> wrote: > > One last mail from me for now. > > The alternative is that I avoid Array#include? and use something like > terms.any?{|t| t == n } > > Does anyone have any thoughts on the matter? That’s pretty much what you’re left with, but with a large repository, could be very expensive. As a general rule, when using a SPARQL endpoint, you can use the form Ian suggested using FILTER, such as SELECT ?bn WHERE {?bn ?p ?o . FILTER(?bn == _:foo) } UNION {?s ?p2 ?_bn . FILTER(?bn == _:foo) } When working with an in-memory repository, then terms.any? {|t| t.node? && t.iid == “foo”} is probably reasonable. Gregg > On 24 November 2017 at 12:05, Anthony Durity <a.durity@umail.ucc.ie <mailto: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. > > 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:50:28 UTC