Enhancing Embedded RDF

I've been thinking more about embedded RDF, prompted by the many people at the conference who have been grilling me about it. There's a real desire to get more of RDF embeddable and there are two key areas I'm going to focus on: (1) assertions about external URIs and (2) classes (at Eric Miller's very vocal insistance!).

Issue one is easiest I think. The embedded RDF rules state that class attributes on tags inside anchor elements represent properties of the target of that anchor. Because you can't nest anchor elements in HTML, this limits the embedded triples to having literal values.

As an illustration, the following HTML shows an embedded assertion that the Dublin Core title of http://example.com/physics is the literal "My physics page":

It would be useful to be able to embed assertions with URI values, e.g. the FOAF topic of the page. For example:

<http://example.com/physics> foaf:topic <http://en.wikipedia.org/wiki/Physics> .

At the moment you'd have to nest anchors to achieve this in embedded RDF. A way around this would be to utilise the cite attribute. The HTML 4.01 specification says this about cite: The value of this attribute is a URI that designates a source document or message. This attribute is intended to give information about the source from which the quotation was borrowed.

So, possibly, it would be reasonable to use cite attributes to specify the subject of a series of triples almost as though we were quoting some metadata from that URI. So, my example could be rewritten as:

<blockquote cite="http://example.com/physics">
  <p>
    <span class="dc-title">My physics page</span> which is about
    physics
  </p>
</blockquote>

which would represent the following two triples:

<http://example.com/physics> dic:title "My physics page" .
<http://example.com/physics> foaf:topic <http://en.wikipedia.org/wiki/Physics> .

The cite attribute can be used on q, blockquote, ins and del tags which collectively allow all kinds of markup to be contained within them, certainly enough for our needs.

The second problem, that of embedded classes, is harder. Eric wants this for better Piggy Bank integration and has promised me mucho lucre as an incentive (well mucho more than zero, mucho less than $2).

There are a number of approaches. The first is actually already supported. You can just embed an rdf:typelink in the HTML:

<p id="ian">I am a person</p>

I don't think this is what Eric needs because the usage is likely to be low - it's extraneous information for humans. Besides, who's going to be linking to RDF property definitions in their prose? (RDF geeks excluded of course).

An alternative is to do something funky in the XSLT that extracts the RDF from the HTML. It could dereference each schema referenced in the head of the document and extract all the domains and ranges. This is possible but how would it deal with domains or ranges that have blank nodes as their value? Probably simply by ignoring them. A more serious problem is that often the author knows more than the schema. I might be using the foaf:depiction property to relate me to my picture. The FOAF schema declares the domain of foaf:depiction to be owl:Thing but obviously I know that I'm describing the property of a foaf:Person and it would be nice to be able to explicitly state this.

Another approach is to continue using the class attribute but lexically separate types, perhaps by prefixing with a special character. The CSS grammar doesn't allow much wiggle room: basically it's a hypen or nothing! Perhaps a class name prefixed with a hyphen should be interpreted as the name of a type like this:

<p id="ian" class="-foaf-Person">I am a person</p>

which would infer an additional triple:

<#ian> rdf:type foaf:Person .

I could live with this since I believe the number of type declarations in a document will be a small compared to the use of properties. What do you think? I'm casting around for other suggestions here too. If you have a good idea let me know and help me win Eric's dollar.

Permalink: http://blog.iandavis.com/2005/11/enhancing-embedded-rdf/


Other posts tagged as erdf, rdf

Earlier Posts