I am using EasyRdf to create a few nodes in the graph. My problem is that I am trying to create a new blank node and also set an rdf:about
property to it that points to the correct resource.
$rdf = new EasyRdf_Graph();
$datapoint_resource = $rdf->newBNode(
'rdf:Description'
);
The problem with this code is that it creates a new rdf:Description
node but there's no way I can add rdf:about
as a property to it.
<rdf:Description>
<!-- Some resources here -->
</rdf:Description>
What I need is
<rdf:Description rdf:about="http://link.to/my/resource/id">
<!-- Some resources here -->
</rdf:Description>
I've tried adding rdf:about
as a resource but the W3C validator outputs the error "rdf:about is not allowed as an element tag here".
<rdf:Description>
<rdf:about rdf:resource="http://ordex.probook/rdf/datapoint/5813af3dbf552b25ed30fd5c9f1eea0b"/>
</rdf:Description>
So this doesn't work and it probably isn't a good idea either.
How can I add rdf:about
when creating a new blank node or what other things do you suggest?
rdf:about
is used in the RDF/XML serialization of an RDF graph to indicate the URI of a resource. Blank nodes, which you're creating withGraph.newBNode()
don't have URIs. To create a URI resource, you Graph.resource(uri). Thus, you should do this instead:For more about how
rdf:about
is used; see the RDF 1.1 XML Syntax. It includes, for instance, this example: