Re: Storing/Retrieving RDF URIs
<"neil.stansbury () redbacksystems ! com"@lists.mozilla.org> Fri, 31 Aug 2007 01:35:05 +0100
| Newsgroups | gmane.comp.mozilla.devel.rdf |
|---|---|
| Message-ID | <[email protected]> |
Axel Hecht wrote:
>
> Something like
>
> var dc =
> new Vocabulary("http://purl.org/dc/elements/1.1/",
> ['title', 'creator', 'subject', 'description',
> 'publisher', 'contributor', 'date', 'type', 'format',
> 'identifier', 'source', 'language', 'relation',
> 'coverage',
> 'rights']);
>
>
> with
>
> function Vocabulary(basepath, leafs) {
> for each (leaf in leafs) {
> this[leaf] = RDFS.GetResource(basepath + leaf);
> };
> this.__contains__ = function(url) {
> var bpl = basepath.length;
> if (url.substr(0, bpl) != basepath) {
> return false;
> }
> return url.substr(bpl) in this;
> };
> this.toString = function() {
> return basepath;
> };
> };
> Vocabulary.prototype = {};
Oh cool, cheers Axel and now I can access it directly as 'dc.title',
that's slick - perfect thanks!
Neil