From: Ignazio P. <ipa...@gm...> - 2011-09-26 10:07:39
|
On 26 September 2011 10:57, Irlan Grangel <igr...@de...> wrote: > Sorry, this is the complete example. > I get: org.semanticweb.owlapi.model.OWLOntologyRenameException: Could not rename ontology. An ontology with this ID already exists: <http://www.ontologydesignpatterns.org/cp/owl/collectionentity.owl> and that's because you're trying to load the second ontology, which was already imported. Use getOntology instead of loadOntology and it will work. HTH, I. > public class Example12 { > > > > public static void main(String[] args) { > > try { > > > > OWLOntologyManager manager = > OWLManager.createOWLOntologyManager(); > > OWLDataFactory factory = manager.getOWLDataFactory(); > > > manager.loadOntologyFromOntologyDocument(IRI.create("http://ontologydesignpatterns.org/cp/owl/bag.owl")); > > > manager.loadOntologyFromOntologyDocument(IRI.create("http://www.ontologydesignpatterns.org/cp/owl/collectionentity.owl")); > > OWLOntologyMerger merger = new OWLOntologyMerger(manager); > > > > IRI mergedOntologyIRI = > IRI.create("http://www.semanticweb.com/mymergedont"); > > OWLOntology merged = > merger.createMergedOntology(manager,mergedOntologyIRI); > > > > // Print out the axioms in the merged ontology. > > for (OWLAxiom ax : merged.getAxioms()) { > > System.out.println(ax); > > } > > // Save to RDF/XML > > manager.saveOntology(merged, new RDFXMLOntologyFormat(), > IRI.create("file:/F:/TestOnt/merge/mergedont.owl")); > > } > > catch (OWLOntologyCreationException e) { > > System.out.println("Could not load ontology: " + > e.getMessage()); > > } > > catch (OWLOntologyStorageException e) { > > System.out.println("Problem saving ontology: " + > e.getMessage()); > > } > > } > > } > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Owlapi-developer mailing list > Owl...@li... > https://lists.sourceforge.net/lists/listinfo/owlapi-developer > > |