Search code examples
javaontologyowlowl-api

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)


Solution

  • If I wanted to create a modelling element such as a class without instances from an input string I would do something like:

    OWLEntity entity = factory.getOWLEntity(EntityType.CLASS, IRI.create(input));
    

    The EntityType.CLASS could be changed to other elements such as EntityType.ObjectProperty. This is the way I approach this problem and when I want to add instances I just add a new axiom to the ontology manager.