Pergunta

I need to automatically generate (from a database) an XHTML document marked up with RDFa or some other microformat, it doesn't matter which one. How can I best do this using Java? I have been using Jena to output RDF/XML but it doesn't do RDFa unfortunately.

Foi útil?

Solução

The reason that Jena doesn't provide an RDFa writer is that the whole point of RDFa is to be embedded in some other (human-readable) web page. I think your main option is to use something like Velocity or Freemarker to produce the pages with embedded calls out to Jena to get the appropriate RDF statements. You'll have to handle the RDFa encoding yourself. For testing, you could read your web pages back in using an RDFa reader to see if you get back the right set of triples, but really that's only half the story. You also need to test whether the page expresses the user-intent you want by enabling inline metadata, and that's much harder to test.

Outras dicas

If you are willing to take another step forward, there are also Grails plugins that provide easy methods to produce RDFa from domain classes in views:

http://grails.org/plugin/rdfa

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top