Declarative Representation of Programming Access to Ontologies

Stefan Scheglmann, Ansgar Scherp, Steffen Staab

Introduction: The Semantic-Pragmatic Chasm

The integration of logic-based ontologies into object-oriented programming (OOP) environments frequently encounters a fundamental "impedance mismatch." While ontologies focus on formal semantics—defining what concepts mean through logic—software applications prioritize pragmatics—how classes are used to achieve specific tasks. Traditional tools often perform a naive 1-to-1 mapping from OWL to Java, resulting in APIs cluttered with internal structural concepts and boilerplate code.

The M3O ontology structure (a) and its class hierarchy (b), illustrating the complex logical relationships that often lead to 'leaky abstractions' in standard APIs.

This paper addresses three primary issues: boilerplate overload, leaky abstractions where internal logic patterns clutter the API, and rigidity in the face of ontological changes.

Methodology: The OntoMDE Framework

To bridge this gap, the authors propose OntoMDE, a model-driven engineering toolkit. OntoMDE introduces two declarative layers between the raw OWL ontology and the final Java code:

  1. MoOn (Model of Ontologies): An ECore-based representation where developers distinguish between "Content Concepts" (application-relevant data like Image) and "Structure Concepts" (logical plumbing like AnnotationSituation).
  2. OAM (Ontology API Model): A UML-based layer defining the pragmatic behavior of the API. This allows for the encapsulation of complex ontological details into "Pragmatic Units" and facilitates integration with legacy libraries.

The semi-automatic pipeline follows a structured flow: OWL → MoOn → OAM → Java Code.

Evaluation and Key Results

The framework was evaluated using several ontologies, including the primary running example, the Multimedia Metadata Ontology (M3O), alongside standard benchmarks like the Pizza and Wine ontologies and domain-specific models like CURIO and EMF.

Comparison of two distinct API versions (API 2 and API 3) generated from the same M3O ontology, demonstrating the flexibility of the OntoMDE approach.

Key findings include:

  • Flexibility: The ability to generate multiple, distinct API versions for the same ontology, tailored to specific application needs.
  • Decoupling: The OAM layer allows the underlying persistence backend to be swapped with minimal effort. In one instance, changing the RDF layer took only an hour of reconfiguration rather than days of refactoring.
  • Legacy Integration: Successful mapping of ontology concepts to standard Java packages (e.g., java.awt).

Conclusion and Future Directions

OntoMDE demonstrates that shifting from structure-driven to responsibility-driven API design significantly improves the maintainability and usability of semantic software. Future work aims to integrate real-time reasoners to enforce ontological constraints during API operations and to expand support for more complex OWL 2 DL constructs.

Summary updated

BibTeX
@inproceedings{scheglmann2012declarative,
  author = {Stefan Scheglmann and Ansgar Scherp and Steffen Staab},
  title = {{Declarative Representation of Programming Access to Ontologies}},
  booktitle = {ESWC},
  year = {2012},
  doi = {10.1007/978-3-642-30284-8\_51},
}
Figure