简体   繁体   English

如何处理耶拿中的 class 实例?

[英]How to deal with class instances in Jena?

In an ontology, suppose we have a class named "function" it has two instances "func1" and "func2" and suppose that the class has a data property "d".在本体中,假设我们有一个名为“function”的 class,它有两个实例“func1”和“func2”,并假设 class 有一个数据属性“d”。

My first problem is: how can I create individuals corresponding to either "func1" or "func2"?我的第一个问题是:如何创建对应于“func1”或“func2”的个人?

My second problem is: In the inference, with Jena rules, I want to check if individuals created for "func1" have "d" greater than some value and if individuals created for "func2" have "d" greater than another value.我的第二个问题是:在推论中,使用耶拿规则,我想检查为“func1”创建的个人的“d”是否大于某个值,以及为“func2”创建的个人的“d”是否大于另一个值。

I already know how to work with classes, properties and individuals but when I got to the part having instances I got stuck.我已经知道如何处理类、属性和个体,但是当我谈到有实例的部分时,我就卡住了。

It appears that Jena Library has no support for instances, which means that you can't use getInstance() and create individuals for that instance. Jena Library 似乎不支持实例,这意味着您不能使用getInstance()并为该实例创建个人。

Instead of having instances func1 and func2 , you can make them as subclasses for the class function .除了实例func1func2 ,您可以将它们作为 class function的子类。 This way, you can use getOntClass() and createIndividual() or getIndividual() as usual.这样,您可以照常使用getOntClass()createIndividual()getIndividual()

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

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