Hi every one. I created my ontology by Protege. my ontology has some classes and instances. Now i'm going to add other classes and instances by jena that's why i write the below code to create a new class and one instance in this class. the name of new class is "person" and the name of new instance is "base". when i run this code in java it works without any error and create the class and instance. but when i back to protege i can not see the new class and also the new instance. do you have any idea to help me. thanks
public void create_model(){
modelMem = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
ModelMaker modelMaker = ModelFactory.createFileModelMaker("Ontologies/VBnet.owl");
Model modeltmp = modelMaker.createDefaultModel();
modelMem = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, modeltmp);
System.out.println("Model has been Successfully Built");
}
public void addFile() {
System.out.println("Loading from FOAF instance File");
InputStream inFoafInstance =FileManager.get().open("Ontologies/VBnet.owl");
modelMem.read(inFoafInstance, defaultNameSpace);
//inFoafInstance.close();
System.out.println(modelMem.toString());
}
public void adddata() {
OntClass person = modelMem.createClass(defaultNameSpace + "Person");
Individual l1 = modelMem.createIndividual( defaultNameSpace + "base", person );
for (Iterator i = l1.listRDFTypes(true); i.hasNext(); )
System.out.println( l1.getURI() + " is asserted in class " + i.next() );
}
public static void main(String[] args) {
AddInfo add=new AddInfo();
add.create_model();
add.addFile();
add.adddata();
}