instancejenaontologyjena-rules

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".

My first problem is: how can I create individuals corresponding to either "func1" or "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.

I already know how to work with classes, properties and individuals but when I got to the part having instances I got stuck.


Solution

  • It appears that Jena Library has no support for instances, which means that you can't use getInstance() and create individuals for that instance.

    Instead of having instances func1 and func2, you can make them as subclasses for the class function. This way, you can use getOntClass() and createIndividual() or getIndividual() as usual.