Read RDF(FOAF) from JSP
i have an RDF File with FOAF vocabulary, and i want to display the file with a jsp. What do i need for this??
OK i just got the message from the tutor that i must use JSP and Jena...i can create the file and read with servjet&jena, but now is the problem how to show the rdf file with jsp...for example if i have a picture for a person how can i show this with jsp...i can sparql to find all the friends, but dont know how to show them with jsp...for example how to print the result of ResultSetFormatter.out开发者_开发百科(System.out.r,q) with jsp?? thx in advance for all the tipps
If you want just a readable version of the RDF/XML file one way is to apply and XSLT template.
You could do more sophisticated stuff if you load it with a library like Jena that provides different ways of querying and traversing the data.
In case your file is big and contains thousands or millions of triples then you might want to load it in a triple store like Virtuoso or 4store and use SPARQL to query your data.
If you explain a bit more your scenario we might be able to help better.
is it a static file ? what can of display do you want ? just echoing the XML ? you don't need the JSP. Just place your RDF file in a public place of your deployment folder. e.g: Deploying just HTML, CSS webpage to Tomcat
'''EDIT''': regarding your comment, I would associate a XSLT stylesheet to the RDF/XML file instead of processing the RDF via tomcat. See the source of my FOAF page: http://lindenb.github.com/foaf.xml
Do you really want to just visualize the RDF, or do you want to attach semantics to some other presentation? If the later, you want microformats.
In any case, RDF/XML is a pita, it's unlikely that you'll enjoy using XSLT to map it to any particular visual presentation. Better to write Java code using Jena, and just use JSP to render that as the HTML of your choice. Or turn it into JSON and render a graph with TheJIT.
精彩评论