RDF and XLink

[Please copy w3c-xml-linking-ig@w3.org on any followups.]

The XML Linking WG is coming close to finalizing the XLink spec.  Some have 
noticed that there is a lot of similarity between XLink and RDF, in that 
XLink links assert relations between resources.  In fact, some recent 
design tweaks explicitly borrowed some RDF concepts in this area, which has 
raised the question of whether links truly can be harvested and 
automatically converted into RDF statements.

This message summarizes some earlier offline conversations I've had with 
RDFers and proposes such a mapping.  If we can iron out the details, there 
is still time (barely) to add back the XLink spec appendix on the RDF 
mapping, as was originally intended.  All of the following material is 
based on the most recent (members-only) version of the XLink spec, which is at:

   http://www.w3.org/XML/Group/2000/04/WD-xlink-20000418.htm

Many thanks to Sergey Melnick, Stefan Decker, and Ron Daniel for material 
and ideas provided in this message.  And thanks to the Linking and RDF IGs 
in advance for reading and commenting.

			*		*		*

XLink allows you to set up an extended link with as many "local" resources 
as you want (subelements inside the link), as many "remote" resources as 
you want (hrefs to other things outside), and as many "arcs" as you want 
(pairs of resources and a direction, so that you can traverse from one to 
the other with XLink-dictated behavior if you want).

Any resource, local or remote, can have a "role" (indicated by a URI).  A 
role means "this resource has this property," where "property" corresponds 
to the RDF notion.  Similarly, an extended link can have a role, where it 
means "this link has this property."  Any arc can also have a role, which 
means "starting resource X has ending resource Y with property Z"; this is 
equivalent to RDF Property Types (informally known to RDFers as arc labels).

What the spec doesn't say explicitly about the RDF mapping, but I think it 
needs to, is that when a resource has a role, the property that's been 
pointed to should be understood to have its *own* property: that of being a 
"class" in the RDF schema sense.

This RDF-ish stuff is entirely apart from actual traversal; XLink is 
primarily meant for traversal, not description.  But it's perfectly capable 
of being used for pure description, and in fact XLink allows you to leave 
off traversal behavior specifications entirely.

Here's the main example that now appears in the XLink spec (the post-Last 
Call version cited above).  Sample (non-normative) DTD declarations are as 
follows:

<!ELEMENT courseload ((tooltip|person|course|gpa|go)*)>
<!ATTLIST courseload
             xmlns:xlink     CDATA           #FIXED
"http://www.w3.org/1999/xlink"
             xlink:type      (extended)      #FIXED "extended"
             xlink:role      CDATA           #IMPLIED
             xlink:title     CDATA           #IMPLIED>

<!ELEMENT tooltip ANY>
<!ATTLIST tooltip
             xlink:type      (title)         #FIXED "title"
             xml:lang        CDATA           #IMPLIED>

<!ELEMENT person EMPTY>
<!ATTLIST person
             xlink:type      (locator)       #FIXED "locator"
             xlink:href      CDATA           #REQUIRED
             xlink:role      CDATA           #IMPLIED
             xlink:title     CDATA           #IMPLIED
             xlink:label     NMTOKEN         #IMPLIED>

<!ELEMENT course EMPTY>
<!ATTLIST course
             xlink:type      (locator)       #FIXED "locator"
             xlink:href      CDATA           #REQUIRED
             xlink:role      CDATA           #FIXED
"http://www.example.com/linkprops/course"
             xlink:title     CDATA           #IMPLIED
             xlink:label     NMTOKEN         #IMPLIED>

<!ELEMENT gpa ANY>
<!ATTLIST gpa
             xlink:type      (resource)      #FIXED "resource"
             xlink:role      CDATA           #FIXED
"http://www.example.com/linkprops/gpa"
             xlink:title     CDATA           #IMPLIED
             xlink:label     NMTOKEN         #IMPLIED>

<!ELEMENT go EMPTY>
<!ATTLIST go
             xlink:type      (arc)           #FIXED "arc"
             xlink:arcrole   CDATA           #IMPLIED
             xlink:title     CDATA           #IMPLIED
             xlink:show      (new
                             |replace
                             |embed
                             |other
                             |none)          #IMPLIED
             xlink:actuate   (onLoad
                             |onRequest
                             |other
                             |none)          #IMPLIED
             xlink:from      NMTOKEN         #IMPLIED
             xlink:to        NMTOKEN         #IMPLIED>

Here's a sample instance conforming to these declarations:

<courseload xlink:title="Course Load for Pat Jones">

   <person
     xlink:href="students/patjones62.xml"
     xlink:label="student62"
     xlink:role="http://www.example.com/linkprops/student"
     xlink:title="Pat Jones" />

   <person
     xlink:href="profs/jaysmith7.xml"
     xlink:label="prof7"
     xlink:role="http://www.example.com/linkprops/professor"
     xlink:title="Dr. Jay Smith" />
   <!-- more remote resources for professors, TAs, etc. -->

   <course
     xlink:href="courses/cs101.xml"
     xlink:label="CS-101"
     xlink:title="CompSci 101" />
   <!-- more remote resources for courses, seminars, etc. -->

   <gpa xlink:label="PatJonesGPA">3.5</gpa>

   <go
     xlink:from="student62"
     xlink:to="PatJonesGPA"
     xlink:show="new"
     xlink:actuate="onRequest"
     xlink:title="Pat Jones's GPA" />
   <go
     xlink:from="CS-101"
     xlink:arcrole="http://www.example.com/linkprops/auditor"
     xlink:to="student62"
     xlink:show="replace"
     xlink:actuate="onRequest"
     xlink:title="Pat Jones, auditing the course" />
   <go
     xlink:from="student62"
     xlink:arcrole="http://www.example.com/linkprops/advisor"
     xlink:to="prof7"
     xlink:show="replace"
     xlink:actuate="onRequest"
     xlink:title="Dr. Jay Smith, advisor" />

</courseload>

The last two <go> examples above, in pseudo-English, would be read as
follows in order to express their RDF nature:

- "Course CS101 has Pat Jones as an auditor," or "course CS101 has
   auditor Pat Jones," or "Pat Jones is auditing course CS101, or "Pat
   Jones is an auditor of course CS101."  The course resource doesn't
   have an official role set, but software could infer that the <course>
   element has a certain role, or the vocabulary in which <course>
   appears may already have an official role.  But as far as XLink is
   concerned, it's un-roled.  So technically you'd want to take the word
   "course" out of these English statements.

- "Student Pat Jones has professor Dr. Jay Smith as an advisor," or
   "student Pat Jones has advisor professor Dr. Jay Smith," or "Professor
   Dr. Jay Smith is advising Pat Jones," or "Professor Dr. Jay Smith is
   an advisor to Pat Jones."  In this case, the "student" and "professor"
   roles are actually set, such that the relevant instances of <person>
   read "Pat Jones is in the class 'student'" and "Dr. Jay Smith is in
   the class 'professor'".  If there were a role on the whole link, it
   would read "This link is in the class 'courseload'" or similar.

Note that there is nothing that stops you from addressing <go> elements as 
resources in another link, putting roles on them, and making them take part 
in arcs that have arc roles.  So it is possible to make "meta-assertions" 
about XLink "assertions."

I'll save some other issues and comments for a follow-on message.

	Eve
--
Eve Maler                                    +1 781 442 3190
Sun Microsystems XML Technology Center    elm @ east.sun.com

Received on Wednesday, 10 May 2000 16:07:37 UTC