Tag Archives: XML

Modelling RDF

> reading: Chapter 3 "Modelling Information", Semantic Web Programming, J. Hebeler et al.

Very briefly: there are three ways of writing information in RDF-style. Most likely there are much more ways of writing, or better representing, infortmation with RDF. But the following three are the most popular ones. The first one is RDF/XML, which is a XML presentation of RDF. Second is the Terse RDF Triple Language (aka Turtle ... why Turtle!?). And the third on is N-Tripel.

The XML notation is obvious. It's specialised XML for RDF. In the entry to the RDF Primer are some little examples. A snippet from a full RDF/XML could look like this:

  <rdf:Description rdf:about="http://.../people#Paul">
     <ext:worksWith rdf:resource="http://.../people#John/>
<!-- More -->

Well, it's XML. Not pretty, but it's interpretable for software.

The second one, Turtle, is supposed to be more human-friendly:

@prefix rdf:    <http://www.w3.org/rdf>
@prefix ext:    <http://example.org/ext>
@prefix foaf:   <http://xmlns.com/foaf>
@prefix people: <http://example.org/people> 

people:Paul ext:worksWith people:John .
people:Matt foaf:knows people:John .
     foaf:knows people:Matt ;
     foaf:surname "Lopez" .

But I must say it is not that easier to read. Maybe a bit, because it has less brackets, obviously. The biggest benefit from this one is I think, that it has much less overhead (well the bracket-stuff). So file sizes would be much smaller, especially because with RDF you  can produce incredibly huge files.

And thirdly the N-Triples, which is a "simplified version of Turtle":

<urn:http://example.com/peoples:Paul> <urn:http://xmlns.com/foaf:worksWith> <urn:http://example.com/peoples:John>

So N-Triples are expressed in one line. Each entry is filled up with one line. There is no such thing as @prefix as in Turtle, which is stupid I think. Imagine: There is the full URL to a certain namespace for each subject, predicate and object. Of course this can be considered a "simplified version of Turtle", but I don't see this as practicable. If there would be a possibility to define QNames for the namespaces, this would be great. It would be so compact.