[redland-dev] querying using bNodes (blank nodes)

Chris Mungall cjm at fruitfly.org
Wed May 23 04:57:13 BST 2007


On May 22, 2007, at 7:19 PM, Richard Newman wrote:

> Chris,
>
>   You cannot reuse blank node identifiers between two queries; if  
> you want a persistent identifier that you can put into a query,  
> *use a URI*, because that's what they are for.

I don't want an identifier that persists across sessions, but I do  
want an identifier that is persistent between queries in the same  
session.

So consider my use case - I am querying OWL layered on RDF. First of  
all, if I'm consuming OWL documents it isn't up to me to use a URI  
rather than bNodes, it's up to the provider, and *nobody* provides  
URIs for anonymous class expressions in OWL.

It's not uncommon for OWL documents to have multiply nested class  
expressions - bnodes to arbitrary depth.

>   You can only reference blank nodes by description (at least in  
> SPARQL). If "by description" is too slow, don't use bnodes.

Note that I said it was using $node->blank_identifier in RDQL that  
was too slow. If I am willing to live with this penalty, should I  
continue to use this method? It worries me because it's undocumented  
behaviour.

If not my only other alternative is to query (?s ?p ?o) into a big  
hash and simply do the graph traversal and matching in perl

Cheers
Chris

>   HTH,
>
> -R
>
>> So it seems that if I want to use SPARQL I can't split my query in  
>> two - I would have to say
>>
>> 	WHERE { ?x1 rdfs:subClassOf [ rdf:type owl:Restriction ; .... ] }
>>
>> And avoid explicitly mentioning bnodes altogether. This isn't my  
>> preferred way of doing things - there are too many combinations of  
>> axioms and descriptions.
>



More information about the redland-dev mailing list