[redland-dev] Blank nodes

Dave Beckett dave.beckett at bristol.ac.uk
Wed Jun 9 23:50:30 BST 2004


On Wed, 9 Jun 2004, Jasper van de Gronde wrote:
> When I try parsing the following N-Triples "document" (the same is true 
> for similar Turtle and RDF/XML):
> <item> <prop> _:a .
> _:a <prop> <value> .
> The parser reports the anonymous node to be a, to me this seems strange 
> as at least in RDF/XML the rdf:nodeID property is said to be "scoped to 
> the containing XML Information Set document information item", which to 
> me implies that it should handled as such. I could understand this if 
> automatically generated blank node id's would be similar, but they ARE 
> prefixed by the filename (I use raptor_set_default_generate_id_parameters).
> 
> So my question is: Is this a bug or a feature? And if it's a feature, 
> would I be able to change this behaviour by using a generate_id_handler 
> callback?

It's a feature.  One unix design principle is to avoid hard coding policy.
The generate_id_handler allows the application (you) to decide the
policy on naming blank node IDs.  It gives you the user-specified name -
here "a" - if available and lets you decide.  However, as you point
out, they should be document scoped names.  There are still a variety
of ways to make that happen.

> Also, according to this:
> http://www.ilrt.bris.ac.uk/discovery/2004/01/turtle/
> Turtle should support the following construct:
>    ex:editor [
>      ex:fullname "Dave Beckett";
>      ex:homePage <http://purl.org/net/dajobe/>
>    ] .
> Currently it simply seems to ignore this (at least in my - limited - 
> tests). 

works for me, if I add:
@prefix ex: <http://example.org#> .
and a blank node _:a to give:

@prefix ex: <http://example.org#> .                    
_:a ex:editor [
      ex:fullname "Dave Beckett";
      ex:homePage <http://purl.org/net/dajobe/>
    ] .

> ... I used the following test document:
> <item> <prop> [
>    <prop> value ;
>    <prop> value
> ] .
> This results in no triples being found at all, ...

That's a syntax error.  You need to use "value" for string values.
It works with that.

> while the following does 
> (should be equivalent, except perhaps for the naming of the blank node, 
> but that shouldn't matter):
> <item> <prop> _:a .
> _:a
>    <prop> <value> ;
>    <prop> <value> .

Dave



More information about the redland-dev mailing list