[foaf-dev] js RDF help wanted! integrating FOAF++ RDF into Firefox Contacts

Dan Brickley danbri at danbri.org
Sat Jun 12 19:36:00 CEST 2010

+cc: TimBL ( ... Tim, can you pass this along to tabulator folks?)

Hi folks

I have made a rough start at integrating FOAF into the (rather cool)
Firefox 'contacts in the browser' Mozilla Labs codebase.

Step 1: RDF/XML (since there is vastly more FOAF out there in RDF/XML
than RDFa; of course we need both...)


I took the (also cool) hCard extractor, and changed it so that instead
of looking up a person and taking hcard from the page at their url, it
looks in the page for <link rel="meta" ...> and feeds anything it
finds to an RDF parser.

For a Javascript parser I chose the one from Tabulator,
http://dig.csail.mit.edu/breadcrumbs/node/149 and also documented here

Alternatives would have been to fight with Mozilla's ancient built-in
RDF/XML parser, to use Jim Ley's older Javascript one
(http://www.jibbering.com/rdf-parser/) , or to use Jeni Tennison's,
since apparently her rdfquery .js library
http://code.google.com/p/rdfquery/ has recently acquired RDF/XML

Currently the Tabulator parser is *not* working. The situation is as
follows: I followed the brondsema.net howto. The parser requires you
to pass it a 'store' as an argument, and I tried the TestStore from
Tabulator's tests, but had to add setPrefixForURI to the store since
that was called by the parser. My implementation of that method
follows other tabulator code I found, just stashing prefix/uri pairs
in a hash called 'namespaces'. However we still get ""No namespace for
rdf:resource"" errors, so something is wrong. The parser has a good
reputation so I'd love to get this fixed. See wiki link below for more
status. I have figured out most of the glue/skeleton code so all we
need now is the parser :)

Options: continue with Tabulator .js; however since we want RDFa also,
moving to Jeni's rdfquery is appealing. I'm not sure what the
situation is regarding the use of Jquery in Firefox addons; as far as
I can see it is not yet bundled (except within Ubiquity). Not sure how
Labs folk feel about having a dependency on it. I could probably hack
Jim's parser in more quickly, but it's less up to date, and won't
address the RDFa problemtunity. Suggestions and hacking help welcomed!

This is the first time I've RTFM'd about Mercurial. I have made a
snapshot patch of my repo available plus a reasonable collection of
'how to make it all work' clues, see


I'd love to get basic functionality working (and contrib'd) so we can
look at more interesting pieces, like SQL-storing all these triples
(including nice exotic ones like DOAP that won't be found in other
formats, or using foaf:Group info to help create filtered views of the
rest of the addressbook)

Thanks for any help :)



ps. do feel free to keep notes in the foaf wiki

More information about the foaf-dev mailing list