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

Re: HTML in RDF

From: Bent Rasmussen <incredibleshrinkingsphere@gmail.com>
Date: Sun, 28 Oct 2007 01:05:30 +0200
Message-ID: <0E8A1B17905F4CB488E07EDD32E1D448@BentPC>
To: "Danny Ayers" <danny.ayers@gmail.com>
Cc: <public-rdf-in-xhtml-tf@w3.org>
Allright, I wasn't quite aware of the Turtle/N3 semantics and made some assumptions, so I'll take a second attempt at the problem after having read up a bit. Hopefully this is more in line with the semantics.

First, the example HTML document.

<html>
<head>
<title>unification</title>
<script>alert('unified, at last')</script>
</head>
<body><p>It has to be possible!</p><p>It just <a href="imperative.html"><em>has</em></a> to be!</p></body>
</html>

Then, the Turtle interpretation

@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix h:      <urn:ns:html#> .

_:html
  rdf:type h:html ;
  rdf:value (
    [ rdf:type h:head ;
      rdf:value (
        [ rdf:type h:htitle ;
          rdf:value (
            "unification"
          )
        ]
        [ rdf:type h:script ;
          rdf:value (
            "alert('unified, at last')"
          )
        ]
      ) .
    ]
    [ rdf:type h:body ;
      rdf:value (
        [ rdf:type h:p ;
          rdf:value (
            "It has to be possible!"
          )
        ]
        [ rdf:type h:p ;
          rdf:value (
            "It just "
            [ rdf:type h:a ;
              h:href "imperative.html" ;
              rdf:value (
                [ rdf:type h:em ;
                  rdf:value "has"
                ]
              )
            ]
            " to be!"
          )
        ]
      ) .
    ]
  ) .

And the raw triples

_:html <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#html> .
_:bnode0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#head> .
_:bnode1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#htitle> .
_:bnode2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "unification" .
_:bnode2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode2 .
_:bnode3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode1 .
_:bnode4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#script> .
_:bnode5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "alert('unified, at last')" .
_:bnode5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode5 .
_:bnode3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:bnode6 .
_:bnode6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode4 .
_:bnode6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode3 .
_:bnode7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode0 .
_:bnode8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#body> .
_:bnode9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#p> .
_:bnode10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "It has to be possible!" .
_:bnode10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode10 .
_:bnode11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode9 .
_:bnode12 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#p> .
_:bnode13 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "It just " .
_:bnode14 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#a> .
_:bnode14 <urn:ns:html#href> "imperative.html" .
_:bnode15 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ns:html#em> .
_:bnode15 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "has" .
_:bnode16 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode15 .
_:bnode16 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode14 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode16 .
_:bnode13 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:bnode17 .
_:bnode17 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode14 .
_:bnode17 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:bnode18 .
_:bnode18 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> " to be!" .
_:bnode18 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode12 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode13 .
_:bnode11 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:bnode19 .
_:bnode19 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode12 .
_:bnode19 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:bnode8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode11 .
_:bnode7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:bnode20 .
_:bnode20 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:bnode8 .
_:bnode20 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:html <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> _:bnode7 .

Thanks to Joshua Tauberer's RDF/XML/N3 validation service.

I'm not so sure how optimal this model is, but at least it appears to me to be a feasible model. The structure being

- rdf:value for element content
- rdf:List for node ordering
- rdf:Property subproperty instances for attributes

Somehow I suspect the mechanism could be generalized for XML.

I'm not sure how easy this is to deal with (query). It's certainly verbose, but I'm not that concerned with verbosity, I'm more interested in expressiveness and how easy it is to query it - lists and such. Next step...

Comments?

Regards

Bent
Received on Saturday, 27 October 2007 23:05:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:15:17 GMT