/** * Specify an ontology to generate * @param ontGraph A Jena INamedGraph containing the ontology * @param ontologyURI The URI of the ontology * @param packagename The Java package that generate classes should be in. */ public void addOntologyToGenerate(INamedGraph ontGraph, String ontologyURI, String packagename) { GraphUtils.addGraph(this.ontGraph, ontGraph); registerOntology(ontGraph, ontologyURI, packagename, true); }
/** * Specify an ontology to generate * @param ontGraph A Jena INamedGraph containing the ontology * @param ontlang The Ontology Language, owl or rdfs. * @param ontologyURI The URI of the ontology * @param packagename The Java package that generate classes should be in. */ public void addOntologyToGenerate(INamedGraph ontGraph, String ontlang, String ontologyURI, String packagename) { if (ontlang != null && ontlang.equals(ONT_LANG_RDFS)) ontGraph = Rdfs2Owl.convertToOwl(ontGraph, ontologyURI); GraphUtils.addGraph(this.ontGraph, ontGraph); registerOntology(ontGraph, ontologyURI, packagename, true); }
/** * Specify an ontology needed by one of the generation ontologies. One of these * entreis should be added for every import in every ontology to generate. * We have this call because imports in Jena don't work all that well. * @param ontologyFile The InputStream containing the ontology document * @param ontlang The Ontology Language, owl or rdfs. * @param rdflang The seriazation format of the ontology file (N3,RDF/XM,...all Jena formats) * @param ontologyURI The URI of the ontology * @param packagename The Java package that generate classes should be in. */ public void addOntologyDependency(InputStream ontologyFile, String ontLang, String rdflang, String ontologyURI, String packagename) { try { INamedGraph temp = createOntGraph(false, ontLang); if (rdflang != null) GraphUtils.loadGraph(temp, ontologyFile, RDFFormat.valueOf(rdflang),ontologyURI); else GraphUtils.loadGraph(temp, ontologyFile, RDFFormat.RDFXML,ontologyURI); if (ontLang != null && ontLang.equals(ONT_LANG_RDFS)) { temp = Rdfs2Owl.convertToOwl(temp, ontologyURI); } GraphUtils.addGraph(ontGraph, temp); registerOntology(temp, ontologyURI, packagename, false); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Specify an ontology to generate * @param ontologyFile The InputStream containing the ontology document * @param ontlang The Ontology Language, owl or rdfs. * @param rdflang The seriazation format of the ontology file (N3,RDF/XM,...all Jena formats) * @param ontologyURI The URI of the ontology * @param packagename The Java package that generate classes should be in. */ public void addOntologyToGenerate(InputStream ontologyFile, String ontLang, String rdflang, String ontologyURI, String packagename) { try { INamedGraph temp = createOntGraph(false, ontLang); if (rdflang != null) GraphUtils.loadGraph(temp, ontologyFile, RDFFormat.valueOf(rdflang),ontologyURI); else GraphUtils.loadGraph(temp, ontologyFile, RDFFormat.RDFXML,ontologyURI); if (ontLang != null && ontLang.equals(ONT_LANG_RDFS)) { temp = Rdfs2Owl.convertToOwl(temp, ontologyURI); } addConcreteEnumClasses(temp); GraphUtils.addGraph(ontGraph, temp); //GraphUtils.writeGraph(temp, System.err); registerOntology(temp, ontologyURI, packagename, true); } catch (Exception e) { throw new RuntimeException(e); } }