EmbeddingRDFinHTML

From W3C Wiki

In the beginning, there was the HTML meta element. Then came PICS, which could be carried inside meta elements. Then came RDF, in some ways a generalization of PICS, written in XML, and XHTML, also written in XML. Whence comes the question...

How do I put RDF in my HTML document?

With the growing number of GrddlImplementations...

in particular...

How do I put bibliographic metadata ala DublinCore in my HTML document?

How do I put rights metadata in my HTML document ala CreativeCommons?

How can I use my HTML document to make FOAF metadata?

How can I make an RSS feed from my HTML page?

How do I connect my web page to a geographic lat/long location?

how about travel schedules?

How do I make a namespace document that works with HTML browsers but formally relates various resources?


Some older ideas and the corresponding drawbacks:

  • appendix B of the 1999 RDF spec suggests sticking RDF in the head of an HTML document (more in Part I of RDF in HTML: Approaches)
    • but the result doesn't conform to the XHTML specs, so
  • wrap the RDF in a <div style="display:none">.
    • looks silly in a browser that can't handle CSS
    • see DTD problems above
  • The initial CreativeCommons deployment involves putting RDF inside comments inside HTML.
  • make a separate RDF file and link to it
    • but
      • It is often easier to add an HTML document than another kind of document (for example in a Wiki...)
      • HTML documents get crawled already, and are better connected than RDF documents
      • We want something readable at the end of a URI without figuring out content negotiation, etc.

references, newest first:


, ProxyTopic of public-rdf-in-xhtml-tf


Comments:

In the HTML 4.01 specs, it is said "The ADDRESS element may be used by authors to supply contact information for a document or a major part of a document such as a form. This element often appears at the beginning or end of a document." But you are putting licence information (CC example) which is not contact information. -- KarlDubost.

  • I guess I owe a comment on the HTML 4.01 spec then; I think the ADDRESS element is where you sign the page; i.e. you show who's responsible for the page. And copyright info is often part of a page's signature. -- DanConnolly

This document is very interesting because it has a lot of links but it's also very hard to read, because you have to go back and forward with the Joe User home page. --KarlDubost

The spec suggests that the rel attribute of the link tag be "transformation" and that's what Joe Lambda's page uses, yet View > Source of the page http://www.w3.org/2003/g/data-view shows it using rel="xslt2rdf". Are both OK? -- SPage

  • "xslt2rdf" was the name used in an old version of the spec; while it's still supported in one of the implementations, "transformation" is the one that must be used; I've updated data-view to use the latter. --DomHazael

If you use a data: URL in a <link>, it's pretty easy, and compatible with many many versions of HTML and HTML-processing agents:

<link rel="meta" type="application/rdf+xml" href="data:application/rdf+xml,%3Crdf%3ARDF%20xmlns%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2F%22%0D%0A%20%20%20%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%0D%0A%20%20%20%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%3E%0D%0A%3CWork%20rdf%3Aabout%3D%22http%3A%2F%2Fexample.org%2Fgnomophone.mp3%22%3E%0D%0A%20%20%3Cdc%3Atitle%3ECompilers%20in%20the%20Key%20of%20C%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3Cdc%3Adescription%3EA%20lovely%20classical%20work%20on%20compiling%20code.%3C%2Fdc%3Adescription%3E%0D%0A%20%20%3Cdc%3Acreator%3E%3CAgent%3E%0D%0A%20%20%20%20%3Cdc%3Atitle%3EYo-Yo%20Dyne%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3C%2FAgent%3E%3C%2Fdc%3Acreator%3E%0D%0A%20%20%3Cdc%3Arights%3E%3CAgent%3E%0D%0A%20%20%20%20%3Cdc%3Atitle%3EGnomophone%3C%2Fdc%3Atitle%3E%0D%0A%20%20%3C%2FAgent%3E%3C%2Fdc%3Arights%3E%0D%0A%20%20%3Cdc%3Adate%3E1842%3C%2Fdc%3Adate%3E%0D%0A%20%20%3Cdc%3Aformat%3Eaudio%2Fmpeg%3C%2Fdc%3Aformat%3E%0D%0A%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Fdcmitype%2FSound%22%20%2F%3E%0D%0A%20%20%3Cdc%3Asource%20rdf%3Aresource%3D%22http%3A%2F%2Fexample.net%2Fgnomovision.mov%22%20%2F%3E%0D%0A%20%20%3Clicense%20rdf%3Aresource%3D%22http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-nd%2F2.0%2F%22%20%2F%3E%0D%0A%20%20%3Clicense%20rdf%3Aresource%3D%22http%3A%2F%2Fwww.eff.org%2FIP%2FOpen_licenses%2Feff_oal.html%22%20%2F%3E%0D%0A%0D%0A%3C%2FWork%3E%0D%0A%0D%0A%3CLicense%20rdf%3Aabout%3D%22http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-nd%2F2.0%2F%22%3E%0D%0A%20%20%3Cpermits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FReproduction%22%20%2F%3E%0D%0A%20%20%3Cpermits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FDistribution%22%20%2F%3E%0D%0A%20%20%3Crequires%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FNotice%22%20%2F%3E%0D%0A%20%20%3Crequires%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FAttribution%22%20%2F%3E%0D%0A%20%20%3Cprohibits%20rdf%3Aresource%3D%22http%3A%2F%2Fweb.resource.org%2Fcc%2FCommercialUse%22%20%2F%3E%0D%0A%0D%0A%3C%2FLicense%3E%0D%0A%3C%2Frdf%3ARDF%3E" />

It's just so deliciously wrong. --EvanProdromou