Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
6,937 additions, 0 deletions not shown
29 src/nl/tudelft/tbm/eeni/demo/ClassGenerator.java
... ... @@ -0,0 +1,29 @@
  1 +package nl.tudelft.tbm.eeni.demo;
  2 +
  3 +import nl.tudelft.tbm.eeni.owl2java.JenaGenerator;
  4 +import nl.tudelft.tbm.eeni.owlstructure.processor.PropertyRangeSimplifier;
  5 +import nl.tudelft.tbm.eeni.owlstructure.utils.OntologyUtils;
  6 +
  7 +import com.hp.hpl.jena.ontology.OntModel;
  8 +
  9 +class ClassGenerator {
  10 +
  11 + public static void main(String[] args) {
  12 + try {
  13 + // Load example ontology
  14 + OntModel ontModel = OntologyUtils.loadOntology("file:resources/demo/industries-application.owl");
  15 +
  16 + // Simplify the definition of property ranges
  17 + // This is necessary because owl2java chokes on complex range
  18 + // definitions (i.e. those containing anonymous classes)
  19 + (new PropertyRangeSimplifier()).process(ontModel);
  20 +
  21 + // Generate classes that provide access to ontology instances
  22 + JenaGenerator generator = new JenaGenerator();
  23 + generator.generate(ontModel, "src", "nl.tudelft.tbm.eeni.demo.ont");
  24 +
  25 + } catch (Exception e) {
  26 + throw new RuntimeException(e);
  27 + }
  28 + }
  29 +}
2  src/nl/tudelft/tbm/eeni/demo/ont/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore

0 comments on commit 3051b18

Please sign in to comment.
Something went wrong with that request. Please try again.