- From: Toby Inkster <tai@g5n.co.uk>
- Date: Tue, 27 Apr 2010 09:23:04 +0100
- To: public-rdfa-wg@w3.org
This is a proposal to create a superclass of blank nodes and URI
references; and provide some extra methods and attributes on this
superclass to make the current Projection interface unneeded.
For want of a better term, I'll call this superclass "Resource" as
it's analogous to an rdfs:Resource.
interface Resource {
readonly attribute DOMString value;
readonly attribute Node element;
readonly attribute Sequence[URI] properties;
[NameGetter] Sequence[any] get (in DOMString name);
}
The rdfa.extractObject/rdfa.project method would no longer be needed.
Given a page containing:
<a vocab="http://xmlns.com/foaf/0.1/"
about="#me" typeof="Person"
rel="homepage" href="http://example.net/"
property="name" content="Joe Bloggs">
<span property="http://purl.org/dc/terms/title"
>Joe's World of Fun</span>
</a>
A script could do something like this:
>>> joe = new URI("#me");
>>> joe = new Resource("#me"); /* either works */
>>> name = joe['http://xmlns.com/foaf/0.1/name'][0];
>>> /* name is a PlainLiteral object */
>>> print(name);
Joe Bloggs
>>> page = joe['http://xmlns.com/foaf/0.1/homepage'][0];
>>> /* page is a URI object, hence also a Resource object */
>>> title = page['http://purl.org/dc/terms/title'][0];
>>> print(title);
Joe's World of Fun
--
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>
Received on Tuesday, 27 April 2010 08:24:51 UTC