Can I create a new Blank node with a rdf:about property #172

Closed
hydrarulz opened this Issue Feb 27, 2014 · 3 comments

Comments

Projects
None yet
3 participants

Hello I am currently building an API that responds with an RDF.

I have multiple nodes of the same type so I am using newBNode so the properties I add to each of them don't get collected in the same resource.

The problem I face is that I am trying to create a new blank node but I can't specify the rdf:about property of the created node. I validated the RDF of what I am trying to achieve against the W3C validator and everything is ok.

This is what I get

<rdf:Description>
     // Other resources here
</rdf:Description>

This is what I need

<rdf:Description rdf:about="http://link.to/my/resource/id">
     // Other resources here
</rdf:Description>

Is this a limitation of EasyRdf?

Collaborator

indeyets commented Feb 27, 2014

can you post some code here?

Owner

njh commented Feb 28, 2014

Hello @hydrarulz,

A Blank Node cannot have a URI associated with it in RDF. If it did, it wouldn't be 'blank' anymore.

I think this will do what you want:

    $node = $graph->resource('http://link.to/my/resource/id');
    $node->set('foaf:name', 'Foo');

nick.

Thanks, I did not understand the Blank node notion properly.

hydrarulz closed this Mar 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment