Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Loading ontology with imports in java with Protege 3.4.4

aros aros at fotonik.dtu.dk
Fri Jul 30 03:31:20 PDT 2010


Hi,

I found out how to do it :)

here is the code if someone is also interested in doing something like this.

My ontology with the classes (repository):
http://www.simple-ontology.owl
saved in: simple-repos.owl

My ontology with my individuals:
http://www.simple-individuals.owl
saved in: simple-ind.owl

Java code:
JenaOWLModel loadedModel = ProtegeOWL.createJenaOWLModel();
RepositoryFileManager repositoryFileManager = new
RepositoryFileManager(loadedModel);
LocalFileRepository localFileRepository = new LocalFileRepository(new
File("M:/MyJessTest/simple-repos.owl"), true);
RepositoryManager repositoryManager = loadedModel.getRepositoryManager();
repositoryManager.addProjectRepository(localFileRepository);
URI importUri = URIUtilities.createURI("M:/MyJessTest/simple-ind.owl");
repositoryFileManager.saveProjectRepositories(importUri);
loadedModel =
ProtegeOWL.createJenaOWLModelFromURI("file:///M:/MyJessTest/simple-ind.owl"); 


//To save the ontology with the individuals			
File filesave = new File(pathsave);
try {
	JenaOWLModel.save(filesave,loadedModel.getOntModel(),
FileUtils.langXMLAbbrev, "http://www.simple-individuals.owl#" ,
"http://www.simple-individuals.owl");
} catch (IOException e) {
	e.printStackTrace();
}
-- 
View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Loading-ontology-with-imports-in-java-with-Protege-3-4-4-tp2306530p2307824.html
Sent from the Protege OWL mailing list archive at Nabble.com.



More information about the protege-owl mailing list