[Activerdf] Finding resources: blank nodes, find_all

Eyal Oren eyal.oren at deri.org
Sun Apr 22 14:52:08 IST 2007


On 04/22/07/04/07 15:32 +0200, Arne Handt wrote:
>I began playing with ActiveRDF last week and encountered some 
>strange/unexpected behaviour, I would be very happy if some of you could 
>help me with this.
great, let's see how far we get.

>My context: I'm developing a Rails-based web application using Sesame 2beta as
>triple store (mainly FoaF data) and ActiveRDF (1.6.1) and its SPARQL-adapter
>(1.3) for accessing the data. I'm a newbie to both Sesame and ActiveRDF, so
>please bear with me.
sure.

>Three of the foaf:Persons in my repository have URIs, the rest are blank nodes.
>When querying the repository by FOAF::Person.find_all, I get an array with four
>elements: the three resources and a nil element, the blank nodes are missing. Is
>this intended, a bug, a missing feature -- or is it my fault? 
This is a known behaviour, which one might call a missing feature. In 
short: all blank nodes are ignored. See the FAQ [1] for more info. I may 
have found a way to solve it properly though (triggered by mails on this 
list by Benno Blumenthal) but haven't yet gotten around implementing it. 

Hopefully you can use the following short-term solution: rename all your 
blank nodes to a unique URI (for example by prepending their internal bnode 
identifier with http://your.application.uri/bnode/...).

My personal opinion (and I'm not alone in this) is that blank nodes are 
very hard to use properly and should simply be avoided. 

>understand, handling blank nodes is a known issue with ActiveRDF. Does 
>this mean it's impossible to find blank nodes by using e.g.  
>FOAF::Person.find_all, or ist there a way to make this work (without 
>patching the ActiveRDF code first, of course)? And why do I get the nil 
>element?
I'm not sure about the nil element, it shouldn't be there. Is your Sesame 
SPARQL endpoint public? It would help us debug what's going on.

>Another issue is finding resources by the generic RDFS::Resource.find_all. When
>using a RDFS::Resource.find_all on my repository, I get an empty array. Again I
>wonder: Is this intended, a bug, a missing feature, or my fault?
RDFS::Resource.find_all finds all resources of rdf:type rdfs:Resource.  By 
themselves, your foaf:Persons aren't rdfs:Resources. They become that only 
with RDFS reasoning turned on. Could it be that you do not have RDFS 
reasoning configured in your Sesame?

>By the way, ActiveRDF is great stuff -- keep up the good work.
thanks.

 -eyal

[1] http://wiki.activerdf.org/FrequentlyAskedQuestions


More information about the ActiveRDF mailing list