I omitted a detail that seems to be important.

                        //OntModel m = ModelFactory.createOntologyModel();
                        OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
                        String uri = "http://ex.org/A";;
                        OntClass cls = m.createClass(uri);
                        cls.createIndividual(uri);
                        System.out.println("Test model " + uri);
                        m.write(System.out, "Turtle");

If I run the version without an OntModelSpec, it works.  If I run the version with OntModelSpec.OWL_DL_MEM, then I get a ConversionException.  I am running Jena 3.17.  The Javadoc says the default is a "weak reasoner."  I may be able to work around this in this one app, but I'm wondering what will happen when the model is later loaded with another choice of reasoner such as OWL_DL_MEM or Openllet.

On 10/20/2021 5:30 AM, Lorenz Buehmann wrote:
OntModel m = ModelFactory.createOntologyModel();
String uri = "http://ex.org/A";;
OntClass cls = m.createClass(uri);
cls.createIndividual(uri);
m.write(System.out, "Turtle");

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to