W3C home > Mailing lists > Public > public-rdf-in-xhtml-tf@w3.org > April 2008

RDFa functional algorithm

From: Micah Dubinko <mdubinko@yahoo-inc.com>
Date: Sun, 20 Apr 2008 12:00:55 -0700
Message-ID: <480B92E7.3060205@yahoo-inc.com>
To: RDFa <public-rdf-in-xhtml-tf@w3.org>

This is the sort of thing that works well for community development over 
a mailing list. Here is my first rough sketch (definitely buggy and 
incomplete) of a functional specification of RDFa, based on the latest 
editor's draft. If something looks wrong to you, it probably is. And if 
someone wants to run with this, be my guest.

Given an XHTML document as input, define a mapping to a list of triples 
as output.

Terminology:

For the attributes rel, rev, typeof, and property, these may contain a 
whitespace separated list. So the terminology "rel value", "rev value", 
"typeof value", and "property value" refers to a single token in the 
overall attribute value.

"nearest ancestor subject" means ... (TODO)

"nearest ancestor hanging triple" means ... (TODO)

(These might be more precise if it used XPath syntax..)


For each property value:
   if the property value is a valid CURIE:
      generate a triple:
         subject = nearest ancestor subject
         predicate = URL from property value CURIE
         if content attribute is present
            object = value of content attribute
         else
            object = text node value of current element
         if xml:lang attribute is present
            language = language code from langauge attribute
         if datatype is present
             datatype = URL from datatype attribute CURIE

For each rel value:
   if the rel value is a valid CURIE or value from the HTML relation list:
      generate a triple:
         subject = nearest ancestor subject
         predicate = URL from rel value CURIE
         if resource attribute is present:
            object = URL from resource attribute
         else
            object = bnode

For each rev value:
   exactly per the "rel" rules above, except subject and object are 
exchanged when generating the triple

For each typeof value:
   if the typeof value is a valid CURIE:
      generate a triple:
         if nearest ancestor subject is this node:
            subject = URL from nearest ancestor subject rules
         else
            subject = bnode
         predicate = rdf:type
         object = URL from typeof value CURIE

For each about attribute
   if there exists a nearest ancestor hanging triple:
      generate a triple:
         if hanging triple used rel (forward triple):
            subject = URL from hanging triple
            predicate = URL from hanging triple
            object =  URL from about attribute
         else (reverse triple):
            as forward triple, but exchanging subject and object

TODO: this sketch doesn't yet mention src or href attributes...

-m
Received on Sunday, 20 April 2008 19:02:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:27 UTC