如何在Java中创建本体? [英] How to create an ontology in Java?

查看:148
本文介绍了如何在Java中创建本体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要在某种基本的OWL本体中编写一些数据三元组。我有三元组:

I've some data triplets that I want to write in some sort of basic OWL ontology. I've triplets like:

Delhi is part of India 

India is an Asian country

请注意,我的关系类似于is-a,part-of或related-to。构建本体的最简单方法是什么?任何工作示例或对示例网站的引用都将是很有帮助的!

Note that I've relations like "is-a", "part-of", or "related-to". What's the simplest way to build an ontology? Any working example or a reference to an example website will be great help!

推荐答案

有很多不同的东西混在一起你的问题,我强烈建议你花点时间(远离键盘!)来思考你想要实现的目标。

There are a lot of different things mixed up in your question, I strongly suggest you take a bit of time (away from the keyboard!) to think through what you're trying to achieve here.

首先,地理本体可能变得非常复杂,在这方面已经做了很多工作。显而易见的起点可能是地理名称本体,其中包含地理要素的名称,包括城市像德里和像印度这样的国家。至少应该为应用程序中的位置重复使用这些名称,因为这样可以最大限度地提高数据与其他可用链接数据源成功连接的可能性。

Firstly, geographic ontologies can get quite complex, and a lot of work has already been done in this area. Probably the obvious starting point is the GeoNames ontology, which gives names to geographic features, including cities like Dehli and countries like India. At the very least you should re-use those names for the places in your application, as that will maximise the chances that your data can be successfully joined with other available linked-data sources.

但是,您可能不希望应用程序中存在整个GeoNames(我猜),因此您还需要明确为什么您需要一个本体。解决这个问题的一个好方法是从你的应用程序的外部:而不是担心使用哪种Jena模型,首先考虑完成句子的方法使用本体,我的应用程序的用户将是能够...。然后,这应该引导您建立一些能力问题(例如,参见本指南的第3部分)。一旦你知道你想要代表什么类型的信息,以及你需要应用什么类型的查询,你的技术选择将更加清晰。我意识到这些应用程序通常是迭代开发的,并且您希望尽早尝试使用某些代码,但我仍然主张在您开始编码之前更清楚地了解目的地。

However, you probably don't want the whole of GeoNames in your application (I'm guessing), so you also need to be clear why you need an ontology at all. A good way to approach this is from the outside of your application: rather than worry about which kind of Jena model to use, start by thinking through ways to complete the sentence "using the ontology, a user of my application will be able to ...". That should then lead you on to establishing some competency questions (see, for example, section 3 of this guide) for your ontology. Once you know what kinds of information you want to represent, and what kinds of queries you need to apply to it, your technology choices will be much clearer. I realise that these applications are typically developed iteratively, and you'll want to try some code out fairly early on, but I still advocate getting your destination more clearly in mind before you start your coding journey.

您暗示您想使用Jena来推动网站。这里有很多选择。不要被术语语义网误导 - 这实际上意味着将类似Web的特性带入内联数据集,而不是将语义放入人类可读的网页本身。虽然您可以这样做,而且很多人都这样做,但您的架构中还需要一些额外的层。我们通常使用以下两种方法之一:在servlet容器中使用带有模板引擎的Jena,例如 Velocity ,或使用Ruby Web框架并通过 JRuby 驾驶Jena。还有很多其他方法可以解决这个问题:Jena不直接解决Web发布问题,但可以在任何基于Java的Web框架中使用。

You imply that you want to use Jena to drive a web site. There are many choices here. Don't be mislead by the term semantic web - this actually means bringing web-like qualities to interlined data sets, rather than putting semantics into human readable web pages per se. While you can do so, and many people do, you'll need some additional layers in your architecture. We typically use one of two approaches: using Jena with a templating engine, such as Velocity, in a servlets container, or using a Ruby web framework and driving Jena via JRuby. There are many other ways to solve this particular problem: Jena doesn't address web publishing directly, but it can be used within any Java-based web framework.

最后,关于命名空间,您应该尽可能重用现有的词汇表,从而重用命名空间。不要为已经在某个地方的数据网上有表示的东西组成新名称。使用GeoNames,或 DbPedia ,或任何其他适合的已发布词汇表。如果它们不适合,那么您应该创建一个新名称,而不是以不兼容的方式使用现有名称。在这种情况下,您应该使用应用程序的Web域(例如您的公司或大学)作为命名空间的基础。理想情况下,您应该在命名空间的基本URL上发布本体,但根据本地Web策略,有时很难安排。

Finally, regarding namespaces, you should really re-use existing vocabularies, and hence namespaces, where possible. Don't make up new names for things which already have representations on the web of data somewhere. Use GeoNames, or DbPedia, or any of the many other published vocabularies where they fit. If they don't fit, then you should create a new name rather than use an existing name in a non-compatible way. In this case, you should use the web domain of your application (e.g. your company or university) as the basis for the namespace. Ideally, you should publish your ontology at the base URL of the namespace, but this can sometimes be hard to arrange depending on local web policies.

这篇关于如何在Java中创建本体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆