[redland-dev] Setting namespace for rdf triples

Marius Erdt marius.erdt at gmx.de
Wed Dec 3 20:55:46 CET 2008


Hi,

I've got a very basic question concerning the building of rdf triples 
with redland:

I'm trying to build a rdf statement like this:

<rdf:Description rdf:about="file:/...">
   <rdf:type rdf:resource="someURL"/>
</rdf:Description>

So I define subject, predicate and object with:

statement = librdf_new_statement_from_nodes(world,
        subject = librdf_new_node_from_uri_string(world, (const unsigned 
char*) "file:/..." ), 
        predicate = librdf_new_node_from_uri_string(world, (const 
unsigned char*) ":type" ),      
        object = librdf_new_node_from_uri_string(world, (const unsigned 
char*)"someURL" )
        );

What I get is this:

<rdf:Description rdf:about="file:/...">
    <ns0:type xmlns:ns0=":" rdf:resource="someURL"/>
  </rdf:Description>

My problem is, that I don't know how to define the predicate that I get: 
<rdf:type rdf:resource="someURL"/> (without the ns0 and xmlns). As far 
as I understand, always the last part of the string that is specified in 
the predicate is set as ns0:lastPartOfString.

I feel that there must be an easy way to get the right result, however I 
did not find any examples that showed triples with the above format. I'm 
also not very familiar with RDF in general, so any hint how to solve the 
problem is very appreciated.

Thanks for any help,
Marius


More information about the redland-dev mailing list