从 JSP 读取 RDF(FOAF)
我有一个带有 FOAF 词汇的 RDF 文件,我想用 jsp 显示该文件。我需要什么?
好的,我刚刚收到导师的消息,我必须使用 JSP 和 Jena...我可以创建文件并使用 servjet&jena 读取,但现在的问题是如何使用 jsp 显示 rdf 文件...例如,如果我有一个人的图片,我如何用jsp显示它...我可以sparql找到所有朋友,但不知道如何用jsp显示他们...例如如何打印ResultSetFormatter的结果.out(System.out.r,q) 与 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您只需要 RDF/XML 文件的可读版本,一种方法是应用 XSLT模板。
如果您使用像 Jena 这样提供不同方式查询和遍历数据的库加载它,您可以做更复杂的事情。
如果您的文件很大并且包含数千或数百万个三元组,那么您可能需要将其加载到 Virtuoso 或 4store 等三元组存储中,并使用 SPARQL 来查询数据。
如果您进一步解释一下您的情况,我们也许能够提供更好的帮助。
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.
它是静态文件吗?您想要什么显示器?只是回显 XML 吗?你不需要 JSP。只需将 RDF 文件放在部署文件夹的公共位置即可。例如: 仅将 HTML、CSS 网页部署到 Tomcat
'''< strong>编辑''':关于您的评论,我会将 XSLT 样式表关联到 RDF/XML 文件,而不是通过 tomcat 处理 RDF。请参阅我的 FOAF 页面的来源:http://lindenb.github.com /foaf.xml
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
您真的想要只是可视化 RDF,还是想将语义附加到其他表示中?如果是后者,您需要微格式。
无论如何,RDF/XML 都是一个皮塔饼,您不太可能喜欢使用 XSLT 将其映射到任何特定的视觉呈现。最好使用 Jena 编写 Java 代码,然后使用 JSP 将其呈现为您选择的 HTML。或者将其转换为 JSON 并使用 TheJIT 渲染图形。
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.