简体   繁体   English

在Eclipse中使用Java访问我的Protege OWL本体

[英]Accessing my Protege OWL Ontology using Java in Eclipse

I've just built a new OWL ontology in protege (classes, properties and individuals). 我刚刚用protege(类,属性和个人)构建了一个新的OWL本体。 My problem is: How can I access (query) the individuals to use it in a program written in Java under Eclipse. 我的问题是:如何在Eclipse下用Java编写的程序中访问(查询)个人以使用它。

I've tried the following: 我尝试了以下方法:

  1. Generate the ontology java code and try to load it using Jena in Eclipse but that requires programming using jena and Im not sure if I need this. 生成本体论Java代码并尝试在Eclipse中使用Jena进行加载,但这需要使用jena和Im进行编程,不确定是否需要此代码。
  2. Add protege plugin in Eclipse and try to access the OWL file to read from the file but that also didn't work. 在Eclipse中添加protege插件,然后尝试访问OWL文件以从文件中读取内容,但这也没有用。

Thus what is the proper method for accessing (Querying) the OWL individuals from protege in a Java program written under Eclipse. 因此,什么是从Eclipse下编写的Java程序中访问(查询)OWL个人的正确方法是什么。

You should use a Java library for RDF. 您应该将Java库用于RDF。 You mention Jena, but there's also Sesame . 您提到耶拿(Jena),但还有芝麻(Sesame) Or if you want something OWL specific, you could try the OWLAPI . 或者,如果您需要特定于OWL的内容,则可以尝试OWLAPI

There's nothing fancy you need to do to use your ontology in an application. 在应用程序中使用本体没有任何花哨的事情。 Any of the aforementioned libraries can read it in, it's just RDF after all, and provide programmatic access directly such as iterating over the triples, or via queries or other lookup mechanisms. 前面提到的任何一个库都可以读取它,毕竟它只是RDF,并且可以直接提供编程访问,例如遍历三元组,或者通过查询或其他查找机制。

All three libraries have good documentation to get you started on how you'd read in and use your ontology. 这三个库都有很好的文档,可帮助您开始阅读如何使用和使用本体。 You might stick with the OWLAPI if you want to use a reasoner, or want to do OWL-specific manipulations of the data. 如果要使用推理程序,或者想要对OWL进行特定于数据的操作,则可以坚持使用OWLAPI。

http://www.slideshare.net/rajighawi/java-and-sparql#我认为该链接对您有帮助,我使用耶拿代码在Eclipse中访问了我的本体,并且它起作用了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM