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 and Saving Ontology

Fahd Amjad fahd.amjad at gmail.com
Wed Feb 8 23:50:54 PST 2012


Hi,

As a new commer to ontology the first problem i encountered was to load and
save ontology from and to local machine. I am sure it is discussed before
on the this group but if some one reqiures to load an save ontology
throught eclipse

//Ontology Loading Location
Reader inputFileForOntologyCore = new InputStreamReader( new
FileInputStream("C:/Users/saturn/Desktop/OntologyTESTFolder/OntologyCore.owl"));

//Ontology Save Location
OutputStream outputFileForOntologyCore = new
FileOutputStream("C:\\Users\\saturn\\Desktop\\OntologyTESTFolder\\savedOntologiesWithRepositoryFiles\\savedOntology.owl");

//Initializing Ontology Model
JenaOWLModel loadedOntologyCore = ProtegeOWL.createJenaOWLModel();

//Setting Up Project Repository
File systemontologyFileFolder= new File("C:\\Program
Files\\Protege_3.4.4\\plugins\\edu.stanford.smi.protegex.owl");
LocalFolderRepository systemRepository = new
LocalFolderRepository(systemontologyFileFolder);
loadedOntologyCore.getRepositoryManager().addGlobalRepository(systemRepository);

//Loading Ontology
loadedOntologyCore.load(inputFileForOntologyCore, FileUtils.langXMLAbbrev);
System.out.println("OntologyCore Loaded");

//Saving Ontology
ArrayList error = new ArrayList();
loadedOntologyCore.save(outputFileForOntologyCore,
FileUtils.langXMLAbbrev,error);
System.out.println("File Saved with "+error.size()+" errors");


-- 
Fahd Amjad
LGIPM Metz
Université Paul Verlaine
Tél: 00(33)-0611811038
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20120209/54821e2b/attachment.html>


More information about the protege-owl mailing list