Is it OK to produce valid-but-strange-looking RDF?

phillip_pearson_myelin pp at m...
Thu Dec 5 01:29:13 UTC 2002


Hi,

First: Please excuse me if this is a stupid newbie question or
if this is the wrong place to ask; I'm pretty new to RDF.

I've been messing around creating FOAF RDF using RDFLib in
Python, and tend to end up with output like this:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:n1="http://http://purl.org/dc/elements/1.1/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:n2="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<rdf:Description rdf:about="http://www.myelin.co.nz/">
<n1:creator>
<rdf:Description rdf:nodeID="pearsonp">
<n2:name>Phillip Pearson</n2:name>
<n2:firstName>Phillip</n2:firstName>
<rdf:type>
<rdf:Description 
rdf:about="http://xmlns.com/foaf/0.1/Person"/>
</rdf:type>
<n2:homepage>
<rdf:Description 
rdf:about="http://blogs.salon.com/0000002"/>
</n2:homepage>
<n2:surname>Pearson</n2:surname>
</rdf:Description>
</n1:creator>
</rdf:Description>
</rdf:RDF>

This parses fine, and (apart from the rdf:nodeId becoming an
rdf:ID) gives effectively the same triples as what I would 
have written by hand:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dc="http://http://purl.org/dc/elements/1.1/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://www.myelin.co.nz/">
<dc:creator>
<foaf:Person rdf:ID="pearsonp">
<foaf:name>Phillip Pearson</foaf:name>
<foaf:firstName>Phillip</foaf:firstName>
<foaf:homepage rdf:resource="http://blogs.salon.com/0000002"/>
<foaf:surname>Pearson</foaf:surname>
</foaf:Person>
</dc:creator>
</rdf:Description>
</rdf:RDF>

My question: is it OK to publish valid-but-odd-looking FOAF
RDF like the first listing?

Alternatively: is there a way to make RDFLib make more
normal-looking tags when serialising URIRefs and rdf:types?

i.e.:

<foo:bar>
<foo:baz rdf:resource="url"/>
</foo:bar>

instead of:

<rdf:Description>
<rdf:type>
<rdf:Description rdf:about="full/url/to/foo/bar"/>
</rdf:type>
<foo:baz>
<rdf:Description rdf:about="url"/>
</foo:baz>
</rdf:Description>

... when encoding:

<_:random_id> <rdf:type> <foo:bar>
<_:random_id> <foo:baz> <url>

?

Thanks,
Phil





More information about the foaf-dev mailing list