I am generating RDF triples from XML and am using Jena Generic Reasoner to infer some new relations and am able to query on the newly inferred triples. I want to be able to present the sparql output in a presentable format and not as a table. Say for a particular subject I have so many inferences made I want to be able to present them all together for that subject. How exactly do I do that? Using ResultFormatter class in Jena I can get output as XML. Can I get output as an HTML.
|
2
|
|
|
|
|
2
|
One way is to transform XML - the first SPARQL WG produced an example: http://www.w3.org/2001/sw/DataAccess/rf1/result2-to-html.xsl to show how this can be done. ResultFormatter can include a reference to the stylesheet (and then a web browser will apply it) and then a web browser will apply it (e.g. see sparql.org and the query [1] - do a "view source") but you may want to apply a template in your code, and so you need to call the XSLT transform engine yourself. [1] http://www.sparql.org/books?query=PREFIX+books%3A+++%3Chttp%3A%2F%2Fexample.org%2Fbook%2F%3E%0D%0APREFIX+dc%3A++++++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0ASELECT+%3Fbook+%3Ftitle%0D%0AWHERE+%0D%0A++{+%3Fbook+dc%3Atitle+%3Ftitle+}&output=xml&stylesheet=%2Fxml-to-html.xsl |
||
|
|
|
-1
|
check this talk |
|||
|