MadMode

Dan Connolly's tinkering lab notebook

Toward better documentation of some schemas for the W3C digital library

In the W3C formalized digital library, we supplement the dublin core with a formal model of the W3C Rec-track process and various other schemas.

They were orginally written in N3, and published as RDF/XML. We've tried using CSS to make the RDF/XML browser-friendly, but in N3, it's a royal pain to make a hypertext link from a description of a class or a property, and I'm not even sure it works at all with RDF/XML+CSS. I pretty much prefer using XHTML as the source of most of the knowledge I record, and now that GRDDL is maturing, I revisited my work on representing RDF schemas in XHTML.

And since converting from N3 to XHTML is something the machine can do for me, I'd hate to do it any other way.

To convert the class relationships to an indented list, I want

  • all the implicit class relationships, not just the stated ones, but
  • only the direct super/subclass relationships, not the indirect/redundant ones

My working solution, classReport.n3, uses this rule to get the class relationships implied by RDFS semantics:

@forAll C, C2, SCHEMA, X, P, V.

{
  SCHEMA a Schema; copy ?SC.
  (?SC.log:semantics
   <http://www.w3.org/2000/10/swap/util/rdfs-rules>.log:semantics
   <classDef.n3>.log:semantics
  ).log:conjunction
    log:conclusion ?F
} => { SCHEMA rdfsClosure ?F }.

... and here are the rules for making the tree:

{
  SCHEMA a Schema; rdfsClosure ?F.
  ?F log:includes { C a rdfs:Class }.
  C log:racine SCHEMA.
  ?F log:notIncludes {
    C rdfs:subClassOf [ rdfs:isDefinedBy SCHEMA].
  }.
} => { SCHEMA root C }.

# direct subclasses
{ ?S a Schema; rdfsClosure ?F.
  ?F log:includes { C rdfs:subClassOf C2 };
     log:notIncludes { C rdfs:subClassOf [ rdfs:subClassOf C2 ] }.
} => { C rdfs:subClassOf C2 }.

I use a utility classDef.n3 to connect classes to schemas:

{ ?C a rdfs:Class.
  ?C log:racine ?DOC
} => { ?C rdfs:isDefinedBy ?DOC }.

Note this only works if you use the HashURI pattern.

I'm pretty happy with the result so far, though I've only got classes, their labels, and the subclass relationships, so far:

  • Advisory Committee representative action
    • A.P. review
    • Org. Joins
    • PR review
    • nomination
  • Notice to AC
    • Activity Creation
    • Activity Proposal
    • CFI
    • CFP
    • Call for Review
    • Rec. dd
  • Activity Statement
  • supersed Work
  • a W3C Technical Report
    • Candidate Recommendation
    • W3C Note
    • W3C Proposed Edited Recommendation
    • W3C Proposed Reccommendation
    • W3C Recommendation
      • first Edition of a Recommendation
    • W3C Rescinded Recommendation
    • W3C Working Draft
      • Last Call WDWD in Last Call
      • WD not longer in development
  • Working Group action
    • CR req.
    • Impl. Evidence
    • Last Call Ann.
    • PR req.
    • WD req.