| java.lang.Object org.ontoware.rdfreactor.generator.java.JModel
JModel | public class JModel (Code) | | A JModel is the result of the translation of a given RDFS/OWL
ontology, and is used as an internal representation of the ontology. This
model of the ontology can then be used to generate the source code through a
Apache Velocity template.
Every JModel consists of one or more JPackage instances, a
root JClass and a Mapping of Java Objects to JClass Objects representing them
in the JModel.
A JModel, which is represented through the classes JModel, JPackage, JClass
and JProperty is much more expressive then the object oriented Model
internaly used by Java. A JModel allows class cycles, multiple inheritance,
properties without a type. Inverse Properties can be explicitly stated for a
property.
This expressiveness is the result of the need to transform the RDF Model into
the the Object Oriented Model of Java. Therefore a JModel must be able to
express both the Java and the RDF Model.
The Transformation from an ontology into a JModel is initiated in
CodeGenerator.generate(...), the Apache Velocity template engine is invoked
in SourceCodeWriter.write(...)
In the future EMF/Ecore of the Eclipse Project might be used instead of
JModel, because Ecore is an UML dialect and has a far superior tool support
over JModel.
author: $Author: xamde $ version: $Id: JModel.java,v 1.9 2006/09/11 10:07:57 xamde Exp $ version: TODO enable anonymous objects as class and property identifiers for OWL support |
classMap | public Map<Resource, JClass> classMap(Code) | | a Map of Java Objects to the JClass representing them in the JModel TODO:
make private
|
JModel | public JModel(JClass root)(Code) | | the only constructor:
Parameters: root - is the root JClass of the new JModel Parameters: writetostore - -if genertaed classes should write to the rdf model |
addInverseProperties | public void addInverseProperties()(Code) | | generates artificial inverse properties, named propertyName + "_Inverse"
TODO read inverse props from OWL, this generates ALL inverse
|
addMapping | public void addMapping(Resource id, JClass jc)(Code) | | Add a mapping to the JModel
Parameters: id - is a Java Object Parameters: jc - is the JClass in this JModel to which the Java Object shouldbe mapped |
flattenInheritanceHierarchy | public void flattenInheritanceHierarchy(JPackage jp)(Code) | | remove self-references and circles. Reducing to a maximally nested
inheritance tree.
circles always are of length two, due to RDFS and OWL sematics
|
getMapping | public JClass getMapping(Resource resource)(Code) | | Parameters: resource - is a Java Object the JClass to which the Java Object is mapped in this JModel |
getRoot | public JClass getRoot()(Code) | | the root JClass of the JModel |
hasMapping | public boolean hasMapping(Object id)(Code) | | Parameters: id - is a Java Object true if the given Java Object has a mapping to a JClass in thisJModel |
isConsistent | public boolean isConsistent()(Code) | | apply consistency checks to this JModel and all instances of JPackage,
JClass and JProperty in it.
true if the JModel and all its parts are consistent |
setRoot | public void setRoot(JClass root)(Code) | | Set the root of this JModel
Parameters: root - is the new root JClass |
toReport | public String toReport()(Code) | | generate a verbose report of this JModel and its parts
|
|
|