Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add example demonstrating how Jena class generation works

  • Loading branch information...
commit 3051b18ff66f3b1323b1ec903670d28efcc6b7d9 1 parent 95db123
Bert Belder authored
6,937 resources/demo/industries-application.owl
View
6,937 additions, 0 deletions not shown
29 src/nl/tudelft/tbm/eeni/demo/ClassGenerator.java
View
@@ -0,0 +1,29 @@
+package nl.tudelft.tbm.eeni.demo;
+
+import nl.tudelft.tbm.eeni.owl2java.JenaGenerator;
+import nl.tudelft.tbm.eeni.owlstructure.processor.PropertyRangeSimplifier;
+import nl.tudelft.tbm.eeni.owlstructure.utils.OntologyUtils;
+
+import com.hp.hpl.jena.ontology.OntModel;
+
+class ClassGenerator {
+
+ public static void main(String[] args) {
+ try {
+ // Load example ontology
+ OntModel ontModel = OntologyUtils.loadOntology("file:resources/demo/industries-application.owl");
+
+ // Simplify the definition of property ranges
+ // This is necessary because owl2java chokes on complex range
+ // definitions (i.e. those containing anonymous classes)
+ (new PropertyRangeSimplifier()).process(ontModel);
+
+ // Generate classes that provide access to ontology instances
+ JenaGenerator generator = new JenaGenerator();
+ generator.generate(ontModel, "src", "nl.tudelft.tbm.eeni.demo.ont");
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
2  src/nl/tudelft/tbm/eeni/demo/ont/.gitignore
View
@@ -0,0 +1,2 @@
+*
+!.gitignore
Please sign in to comment.
Something went wrong with that request. Please try again.