I am using OWL API and Jena API.
I need to convert a primitive class to a defined class.
I'm using Protege, I want to do this:
(I'm new in stackoverflow and I can not post pictures, but I put the links.)
I have a class "TestClassInstan" that is a subclass of "TestClass" and has a restriction "hasURL" as shown in Fig [one]:
[one]https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-ash3/1526873_1383572248568109_2144507550_n.jpg
I want to convert this class and this properties to defined class. And then have this result, a defined class with the propertis equivalent, as shown in Fig [two]:
[two] https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash3/1488649_1383580128567321_1363049007_n.jpg
Thank you for your help.
The pictures in the question are a bit hard to head, so to be clear, in the first, there are two axioms
You're looking to remove these two axioms and replace them with a single axiom
Ignazio's answer has already shown how you can do this using the OWLAPI. This answer will show how to do it using Jena. The OntClass and OntModel interfaces actually provide just about all the methods that you'll need. The only tricky bit might be constructing the RDFList of classes that make up the intersection, though it's not hard in this example (it's just the list of the original superclasses of TestClassInstan). Here's Java code that accomplishes the conversion. This also include reconstructing the ontology in code, since you didn't provide actual ontology code. It's not necessary for the answer, but it might be helpful, and it makes this code stand on its own.
The original ontology is:
And the converted ontology is: