An Introduction to Embedded RDF
Platform Programme Manager
What is it?
- A way of embedding a subset of RDF into XHTML documents
- Uses idiomatic XHTML - no new elements
- CSS-friendly
Some History
- 1996 - W3C
- A Proposed Convention for Embedding Metadata in HTML
- http://tinyurl.com/f7r5g
<META NAME="DC.title" CONTENT="HTML 2.0 Specification">
<LINK REL = SCHEMA.dc HREF = "http://purl.org/metadata/dublin_core">
- 2003 - Dublin Core
Principles
- Visible metadata
- Don't repeat yourself
- Reuse not reinvention
Visible Metadata
- Easier to trust
- Easier to spot stale metadata
Don't repeat yourself
- Easier to keep in synch
- Express once for both humans and machines
Reuse not reinvention
- Reuse existing formats
- Can use existing tools to author and read
- Reuse people's experience
How?
- Profile
- Schema declarations
- Metadata in Head
- Metadata in Body
Schema Declarations Abbreviate Properties
- Schema prefix helps encode property URIs
- Encoded by concatenating...
- schema prefix
- hyphen (-) or dot (.)
- local name of property
- foaf.name might represent
- http://xmlns.com/foaf/0.1/name
Schema Declarations Compatibility
- Use dot (.) notation in <head>
- Backwards compatible with Dublin Core
- Use dash (-) notation in <body>
- Forwards compatible with CSS
- But both are valid
Metadata in Head
- Represents metadata about the current document
- <meta> used to represent triples with literal values
- <link> used to represent triples with resource values
Metadata in Head - Literal Values
Metadata in Head - Resource Values
Metadata in Head - Multiple Rel
Metadata in Body
- Triples can describe
- current document
- resources named with id attributes
- Literal values embedded using elements with class attribute
- Resource values embedded using anchor elements
Metadata in Body - Literal Values
- Use class attribute to encode property
- Value is either
- title attribute if present
- string value of element (as xslt function)
Metadata in Body - Simple Example
Metadata in Body - Title Example
Metadata in Body - Resources
Inferred Labels from Anchors
Metadata About Other Things
Combinations
- Elements with both class and id attributes
- Anchors with class and rel attributes
- Anchors with rel and rev attributes
- Anchors with rel and id attributes
- Anchors with rel, rev, class and id attributes
- Anchors with rel or rev but no href attribute
- See the wiki!
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
<http://example.org/about> foaf:maker <http://example.org/about#anna> .
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
<http://example.org/about#anna> foaf:homepage <http://example.org/about> .
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
<http://example.org/about#anna> foaf:made <http://example.org/about> .
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
<http://example.org/about#anna> foaf:firstName "Anna" .
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
<http://example.org/about#anna> foaf:surname "Wilder" .
Worked Example
<html>
<head profile="http://purl.org/NET/erdf/profile">
<base href="http://example.org/about" />
<title>Anna's Homepage</title>
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
<link rel="foaf-maker" rev="foaf-homepage foaf-made" href="#anna" />
</head>
<body>
<h2>About me...</h2>
<p id="anna">
I'm <span class="foaf-name"><span class="foaf-firstName">Anna</span>
<span class="foaf-surname">Wilder</span></span>.
You might know me from IRC as <span class="foaf-nick">wildling</span>!
</p>
</body>
</html>
<http://example.org/about#anna> foaf:name "Anna Wilder" .
Limitations
- Blank nodes - every node must be identified by a URI or literal text
- Containers - rdf:Bag, rdf:Seq and rdf:Alt are all omitted
- XML Literals, Datatyped literals - all literals are assumed to be plain
- Subjects must be within document if object is resource
- 80% solution
What About RDFa?
- Not compatible
- Partial convergence, allow colon as prefix/name separator
- RDFa requires new role and property attributes
- RDFa more explicit but is new dialect of XHTML
Next Steps
- Test suite!
- Implementation experiences
- Enable migration to RDFa if possible