0

I need to generate DL expression from OWLObject in OWL API. For now, I am using DLSyntaxObjectRenderer like:

DLSyntaxObjectRenderer obj = new DLSyntaxObjectRenderer();

The problem is that the DL expressions that are generated only contain the labels of the resources (e.g. Awning ⊔ Door ⊔ Gate ⊔ Shutter ⊔ Window). While these are syntactically valid DL expressions, for implementation sake, I need the IRIs of the atomic entities so that I can load the expression using OWL API after without having to load the entire ontology.

How can I achieve this ?

Noor
  • 19,638
  • 38
  • 136
  • 254
  • 1
    Which OWL-API version? What did you try? Did you try to set an overridden `ShortFormProvider` into this `OWLObjectRenderer` (both classes are since 2.2.0)? Are you sure it prints labels, not IRI local name ? – ssz Apr 30 '19 at 17:01
  • Sorry for delay in replying, i'm current using OWL API 5.1.10. I didn't know about `OWLObjectRenderer`. As mentioned above, i'm using `DLSyntaxObjectRenderer` and rendering the expression using its `render` method – Noor May 08 '19 at 11:38
  • thanks for the hints, managed to do it – Noor May 08 '19 at 11:58

1 Answers1

0

The ShortFormProvider determines the rendering of entities. It has several implementation such as ManchesterOWLSyntaxPrefixNameShortFormProvider, QNameShortFormProvider, SimpleShortFormProvider. For example, the following code use the DLSyntaxObjectRenderer and make it render DL expressions using the IRI of entities,

obj = new DLSyntaxObjectRenderer();
ShortFormProvider shortFormProvider = new ShortFormProvider() {
                @Override
                public String getShortForm(OWLEntity owlEntity) {
                    return owlEntity.getIRI().getIRIString();
                }
            };
obj.setShortFormProvider(shortFormProvider);

To render an expression exp, simply use obj.render(exp)

Noor
  • 19,638
  • 38
  • 136
  • 254