Jena supports RDFa

HP’s Jena framework for building semantic web applications in Java now supports RDFa. Jeremy Carroll provides sample code for reading any RDFa in any HTML document:

Model m = createMemModel();
RDFReader r = m.getReader("GRDDL");
r.setProperty("grddl.rdfa", "true");
r.read(m,  "http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html");
Model m2 = createMemModel();
m2.read(
   "http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-output.rdf",
   "http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html",
   "RDF/XML");
assertIsoModels(m2, m);

It’s always important to note the difference between RDFa and some other approaches to HTML-embedded structured data: the above code is all you need for any vocabulary, even ones that haven’t been invented yet.


One Response to “Jena supports RDFa”

  1. /me smirks discretely at “some other approaches…”


Leave a Reply

You must be logged in to post a comment.