This note is intended as a 1-page introduction to RDF, aimed at software developers and technically oriented people having a some familiarity with XML and data structures in computer programs.
Broadly, RDF maps a Directed Labelled Graph (DLG) data model onto XML. The graph contains nodes, and arcs that connect the nodes. The graph nodes and arcs are labelled using URIs . It also turns out that a relational data model is also easily mapped onto this form, with a node corresponding to a table row or primitive value, and an arc corresponding to a column identifier. (For comparison, the data model that underlies XML is an annotated tree, with XML elements corresponding to nodes of the tree, and XML attributes being annotations applied to some node.)
This graph based model for RDG data is very flexible, deriving indirectly from a long history of research into knowledge representation (Semantic Nets, Conceptual Graphs, etc.) It allows arbitrarily complex data to be represented in a form with a very simnple, uniform ujnderlying structure, making it potentially accessible to a range of general purpose RDF processing tools. It can also be easily applied to much more prosaic purposes.
The RDF syntax defines a number of forms for XML that are easily mapped onto the DLG structure. The basic RDF syntax can be rather cumbersome, but if one assumes schema-aware RDF processing (or a special-purpose processor), it is possible to design a reasonably neat RDF-compatible form of XML for a typical application.
RDF does allow XML attributes to be used for arc names, but the syntax can get very confusing. I'd suggest designing the format with just XML elements initially, then mapping that to an attributes-as-arcs form later. Hopefully, the result will be very close to an XML format one might design for a specific application, with the possible benefit of a more regular structure and usability by generic RDF processing software.
RDF XML syntax can use XML elements to name both graph nodes and arcs: one tends to end up with an alternating nesting structure:
<Node-type-1 about="Node-name-1"> <arc-label-1> <Node-type-2 about="Node-name-2"> <arc-label-2> value </arc-label-2> : </Node-type-2> </arc-label-1> <arc-label-3> <Node-type-3 about="Node-name-3"> : </Node-type-3> </arc-label-3> : </Node-type-1>
[Node-name-1] | +--rdf:type-----> [Node-type-1] +--arc-label-1--> [Node-name-2] | | | +--rdf:type-----> [Node-type-2] | +--arc-label-2--> "value" | : | +--arc-label-3--> [Node-name-3] | | | +--rdf:type-----> [Node-type-3] | : :
denotes a literal value (e.g. a column value in a row), and
(This relates to a proposal for representing RFC822 email messages in XML .)
Applying this apporach to representing an email message, I view the headers of a message as providing the arcs of an RDF graph:
[<Message>] | +--subject---> "(subject)" +--date------> "(date)" +--comments--> "(description)" +--to--------> [<Address>] | | | +--adrs-->"(email adrs)" | +--name-->"(formal name)" | +--to--------> [<Address>] :
The nodes are either resources (typed and identified objects) or literal strings. The above graph codes into RDF+XML thus:
<rdf:RDF xmlns:rdf="..."> <Message> <subject>(subject)</subject> <date>(date)</date> <comments>(comments)</comments> <to> <Address> <adrs>(email adrs)</adrs> <name>(formal name)</name> </Address> </to> <to> <Address> : </Address> </to> : </Message> </rdf:RDF>
Note the informal convention of using lowercase initial letter for properties, and uppercase for node type names.
RDF allows some alternative XML coding forms, which can be intermixed; I've used the example form above as I think it's a reasonably obvious way of using XML for messages when not using RDF.