Search Mailing List Archives
[protege-discussion] owldatatypeproperty
Fahd Amjad
fahd.amjad at gmail.com
Mon Jan 23 09:35:21 PST 2012
Hi,
I am using protege-owl-api to programatically populate my owl ontology with
individuals and then assigning data values to the added individuals. I can
populate the ontology with individual with i am having problems in
assigning RDFProperty values to the addPropertyValue method. Can any one
help me. The snippet below loads the ontology , loads the individual s from
excel and populates then in Production-Schedule class and in the end
assigns datatype values to the newly populted individuals(here i am have
deficulties)
Reader inputFileForOntologyCore = new InputStreamReader(new
FileInputStream("C:/Users/saturn/Desktop/Ontology TEST
Folder/OntologyCore1.owl"));
JenaOWLModel loadedOntologyCore = ProtegeOWL.createJenaOWLModel();
//CREATE ONTOLOGY MANAGER
RepositoryManager manager =
loadedOntologyCore.getRepositoryManager();
File systemontologyFileFolder= new File("C:\\Program
Files\\Protege_3.4.4\\plugins\\edu.stanford.smi.protegex.owl");
LocalFolderRepository systemRepository = new
LocalFolderRepository(systemontologyFileFolder);
manager.addGlobalRepository(systemRepository);
loadedOntologyCore.load(inputFileForOntologyCore,
FileUtils.langXMLAbbrev);
System.out.println("OntologyCore Loaded");
// Input to the individuals of the class Production Schedule and
corresponding assignment of data-type properties.
OWLNamedClass productionSchedule =
(loadedOntologyCore).getOWLNamedClass("Production_Schedule");
OWLDatatypeProperty productionScheduleID =
(loadedOntologyCore).getOWLDatatypeProperty("has_Production_Schedule_ID");
OWLDatatypeProperty productSegmentID =
(loadedOntologyCore).getOWLDatatypeProperty("has_Product_Segment_ID");
for (int i=0; i<sheet.getRows()-1; i++){
//GETTING THE VALUES OF THE CELL FROM EXCEL WORKSHEET AND
ASSIGNING THEM TO VARIABLES
Cell cellProductionScheduleName = sheet.getCell(0, i+1);
Cell cellProductionScheduleID = sheet.getCell(1,i+1);
Cell cellProductSegmentID = sheet.getCell(2, i+1);
Cell cellProductInformationDemandDate = sheet.getCell(3,i+1);
//CONVERTING THE CELL VALUES TO CORRESPONDING DATA TYPES
//CONVERTING INTO STRING
String productionScheduleinstance =
cellProductionScheduleName.getContents();
* //CONVERTING INTO INTEGER
NumberCell ProdSchID1=(NumberCell)cellProductionScheduleID;
Object ProdSchID = (int) ProdSchID1.getValue();
NumberCell ProdSegID1= (NumberCell)cellProductSegmentID;
Object ProdSegID = (int) ProdSegID1.getValue();
//CREATING INSTANCE IN ONTOLOGY
productionSchedule.createOWLIndividual(productionScheduleinstance);
productionSchedule.addPropertyValue((RDFProperty)(productionScheduleID),ProdSchID);
productionSchedule.addPropertyValue((RDFProperty)(productionScheduleID),ProdSegID);
*
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-discussion/attachments/20120123/b6b3ea48/attachment.html>
More information about the protege-discussion
mailing list