Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OWL API - create class without instances

I have a requirement to create a class in the Ontology using the OWL-API without adding any instances.

I checked the examples and the documentation but all the places the classes are created along with the individuals/ instances. Is there a way to create classes without any instances (and and them later on)

like image 609
jana Avatar asked May 23 '26 12:05

jana


1 Answers

It is never necessary to add instances to declare and use a class.

For example:

OWLClass c = factory.getOWLClass(IRI.create(cInput));
OWLAxiom declareC = factory.getOWLDeclarationAxiom(c);
// adding declareC to the ontology is necessary to have any output
manager.addAxiom(ontology, declareC);

In order to get any entity outputted when saving an ontology, it must be used in some axiom included in the ontology. In this example, that axiom is the class declaration; it could be a subclass axiom or an assertion (in that case, an instance will be created).

like image 85
Ignazio Avatar answered May 25 '26 18:05

Ignazio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!