01: package org.ontoware.rdfreactor.generator;
02:
03: import java.io.File;
04:
05: import org.apache.commons.logging.Log;
06: import org.apache.commons.logging.LogFactory;
07:
08: public class GenerateFromSchemas {
09:
10: private static Log log = LogFactory.getLog(CodeGenerator.class);
11:
12: public static final String outdir = "./target/test-gen";
13:
14: public static void main(String[] args) throws Exception {
15: File testGenDir = new File(outdir);
16: testGenDir.mkdirs();
17: // tests
18: //generate("Class Cyles", "./test-data/classCycle.n3", "classcycle", "rdfs", true);
19: ///generate("RDFS Inferencing", "./test-data/InferencingTest.n3", "rdfsinferencing", "rdfs", true);
20: generate("Cardinality", "./test-data/Cardinality.n3",
21: "cardinality", "rdfs", true);
22: // generate("Test for inverse properties", "./test-data/InverseTest.n3",
23: // "inverse", "rdfs",
24: // true);
25:
26: // examples
27: generateExamples();
28: }
29:
30: public static void generateExamples() throws Exception {
31: // generate("RDF Schema itself", "./data/rdf+rdfs.rdf.xml", "rdfrdfs",
32: // "rdfs", false);
33: // generate("OWL Schema itself", "./data/owl.rdf.xml", "owl", "rdfs",
34: // false);
35:
36: generate(
37: "ScutterVocab",
38: "./data/http---www.ldodds.com-projects-slug-scuttervocab.rdfs",
39: "scutter", "RDFS", true);
40: generate("Dublin Core 1.1",
41: "./data/dublin-core11.rdfs.rdf.xml", "dublincore",
42: "RDFS", true);
43: generate("Example", "./data/example.n3", "example", "RDFS",
44: true);
45: generate("MarcOnt", "./data/marcont.xml", "marcont", "OWL",
46: true);
47: generate("SchemaDoc", "./data/schemadoc.n3", "schemadoc",
48: "RDFS", true);
49: generate("SIOC", "./data/sioc.rdfs.xml", "sioc", "RDFS", true);
50: generate("Tag", "./data/tag.n3", "tag", "RDFS", true);
51:
52: generate("Simplified FOAF", "./data/foaf.n3", "foafsimplified",
53: "rdfs", true);
54:
55: generate("Full FOAF", "./data/foaf.rdf.xml", "foaf", "rdfs",
56: true);
57: // generate("Fresnel from http://www.w3.org/2004/09/fresnel",
58: // "./data/fresnel.owl.xml",
59: // "fresnel", "owl", true);
60: // generate("Werner Thiemann", "./test-data/ronny.owl.n3", "ronny",
61: // "owl", true);
62:
63: }
64:
65: public static void generate(String name, String schemaFile,
66: String localPackagename, String semantics,
67: boolean skipbuiltins) throws Exception {
68: log.info("Generating " + name);
69: CodeGenerator.generate(schemaFile, outdir,
70: "org.ontoware.rdfreactor.testgen." + localPackagename,
71: semantics, skipbuiltins, true, "");
72: }
73:
74: }
|