and Situations pattern from the DOLCE foundational ontology, the domain level entities do, however, not directly correspond to single individuals, and their re-.
Winter : Mapping RDF to POJOs revisited Carsten Saathoff, Stefan Scheglmann, and Simon Schenk ISWeb, University of Koblenz-Landau, http://isweb.uni-koblenz.de/ {saathoff, schegi, sschenk}@uni-koblenz.de
1
Motivation
In Semantic Web applications, RDF and domain ontologies are the means to represent domain knowledge and data. When writing an application, however, one usually also wants to use classes representing domain level entitites in the programming language, in our case POJOs – Plain Old Java Objects. Traditionally, one manually has to write a lot of low level, repetitive code to deal with URIs, RDF statements, or repository connections, instead of focusing on domain level objects such as events or participants. A solution to this problem are frameworks that automatically map between RDF and Java. An example for such a mapping framework is So(m)mer1 . In So(m)mer, the mapping is defined using Java Annotations. Classes can be annotated with concepts of an ontology, and objects of that class refer to individuals of that concept. Member variables of the Java class might be annotated with property URIs. The value of the member variables are the individuals connected the current individual with the property in the annotation. An example for FOAF could look like the following: @rdf { " h t t p : / / x m l n s . c o m / f o a f / 0 . 1 / P e r s o n " } public c l a s s P e r s o n { @rdf { " h t t p : / / x m l n s . c o m / f o a f / 0 . 1 / n a m e " } public S t r i n g name ; }
So(m)mer creates getters and setters that are specific to the employed RDF backend for accessing the member variables and creating or retrieving POJOs from the store. A drawback of current frameworks is that they only allow for mappings of Java classes to individuals and members to properties. In complex ontologies, e.g. ontologies built using Ontology Design Patterns2 , such as the Descriptions and Situations pattern from the DOLCE foundational ontology, the domain level entities do, however, not directly correspond to single individuals, and their relations not to simple statements. Instead, complex patterns are required to represent entities and their relations. Examples for such ontologies are the event ontology F [1] or the multimedia ontology COMM [2]. In the following, we introduce Winter , an extension of So(m)mer, that allows for such a mapping of complex patterns to Java classes. 1 2
https://sommer.dev.java.net/ http://ontologydesignpatterns.org/
2
Winter
In Winter we allow for annotating Java classes with complete SPARQL graph patterns. These patterns require one variable called ?subj, whose bindings are treated as objects of the Java class. For members, the graph patterns need to contain the variables ?subj and ?obj. The former will be bound to the URI of the current Java object (determined by the ?subj variable of the class annotation), and the latter determines the values of the member variable. We give a short (and simplified) example based on F. F consists of several patterns that allow for the representation of domain and situation specific views on events. The central pattern is Participation, which can be used to describe the participants of an event and their roles within it. An event participation is defined by a ParticipationSituation that satisfies a ParticipationDescription. The event that is described must be included in the situation, and classified as the DescribedEvent, where the latter is definedBy the description. In Winter we would write this as follows3 : @complex { "? subj a f: ParticipationSituation . ? pardes a f: ParticipationDescription . ? subj dul : satisfies ? pardes . "} public c l a s s P a r t i c i p a t i o n { @complex { " ? subj dul : satisfies ? pardes . ? pardes a f : ParticipationDescription . ? pardes dul : defines ? desev . ? desev a f : DescribedEvent . ? obj a dul : Event ; dul : isEventIncludedIn ? subj . ? desev dul : classifies ? obj . "} private Event e v e n t . }
Getters and setters are created by Winter . One can already supply empty getters and setters in order to have compiling code for IDEs. Winter uses a post-compilation step, in which it rewrites the Java bytecode to implement the repository access for the annotated classes and members. This functionality has been reused from So(m)mer. Winter will be made available as Open Source, and is currently employed to implement the APIs to several complex upper level ontologies, such as F and COMM. Acknowledgements. We would like to thank Henry Story, who developed So(m)mer and supported us throughout our work on Winter . This paper has partly be funded by the EU in the FP6 projects X-Media (FP6-26978) and NeOn (IST-2005-027595).
References 1. Scherp, A., Franz, T., Saathoff, C., Staab, S.: A model of events based on a foundational ontology. Technical Report 02/2009, Department of Computer Science, University of Koblenz-Landau (2009) 2. Arndt, R., Troncy, R., Staab, S., Hardman, L., Vacura, M.: COMM: designing a well-founded multimedia ontology for the web. In: ISWC 2007 + ASWC 2007. (2007) 30–43 3
Using f as the prefix for the event ontology, and dul for DOLCE.