[rdfweb-dev] NEEDED: SIMPLE FOAF->Javabeans conversion
danbri at w3.org
Tue May 4 23:34:03 UTC 2004
Marc Canter wrote:
> My good friend Danny Ayers turned us (Tribe in this context) onto this
> entire system for converting rdf to Java.
> But we don’t need all that. That’s overkill. It’ll take more time to
> just deal with all that, then to…
Yup, sounds like overkill I agree. Java and RDF have somewhat different
object models, I'm not sure a mapping really makes sense.
> Anyway – here’s what the Tribe is looking for:
> - their whole world if Javabeans
> - they want to convert FOAF to and from their world
> - this will lead to a demo showing Ecademy (thank you jUlian –
> in advance) connecting FOAF files with Tribe.net.
> - that then leads to a formal chartering of a FOAFnet fo
> commercial FOAF based systems
> - but first things first we need aworking demo
> - and that requires moving FOAF into and out of Javabeans
> - J
> The statement was “isn’t there somebody out there who’s converted FOAF
> into Javabeans?”
> So I ask you – dear mail list – is there?
A couple of perspectives:
i) if you are only working with a super-constrained subset of FOAF, and
have no need to represent properties and relationships from other
namespaces, you could create Java classes that exposed FOAF data as
ii) if you want more of the flexibility and squiggly flexibility of FOAF
and general RDF, it is probably best to use a full Java RDF API such as
Jena. I'm not up on the state of play re exposing Jena's RDF graph API
in a Javabean-oriented example, but some pointers...
(from Leigh Dodds, who can perhaps comment further). His technique is a
hybrid of these two options,
The responses from the web service are made available in two
formats: as "raw" RDF (actually Jena 2 Model instances) or via
some simple JavaBeans (Artist, Album, Track, TrackSummary).
These JavaBeans are instantiated by a factory class
(BeanPopulator) which is capable of navigating the RDF graph
returned by different MusicBrainz queries and pulling out the
I suggest pointing the Tribe folks at that, to get an idea of the two
styles, and also perhaps at the Jena tutorial c/o
http://www.hpl.hp.com/semweb/doc/tutorial/ (including RDQL tutorial,
http://jena.sourceforge.net/tutorial/RDQL/) to give an idea of what
using the RDF API might look like. The examples there often use vCard
but the principles are similar
(http://www.semanticplanet.com/2003/05/parsingFOAFWithPHP.html has more
FOAF-specific RDF API examples, but using PHP).
http://www.hpl.hp.com/personal/bwm/rdf/jena/rssinjena.htm are a couple
of older pieces, which also give a feel for the way Jena works (but
which might not be up to date). Note also the above tutorial is for Jena
1.x not 2.0. It should give Java hackers some sense for how to work with
RDF in Java though. Regarding Beans, it would be good to hear a bit more
about what exactly they need to do. For eg., Javabeans offers a bunch of
functionality for serializing objects into various kinds of long-term
state (to file, to databases, etc.). It also offers "getters and
setters" to expose data to application code and to templating engines
such as Velocity. My hunch and http://weblog.tribe.net/mt/paul/ suggests
that Tribe are using Velocity, ie http://jakarta.apache.org/velocity/ so
if that's the case, we could narrow down our research and go looking
for folk with experience exposing RDF data (via Jena I'd expect, but
maybe Sesame or Redland) into a Velocity templating environment.
Nosing around, the Simile project and some other work at HP Labs is
doing this. Worth investigating further?
Hope this helps,
More information about the foaf-dev