Hey all

I'm building a web application using Protege API, i'm trying to add new instance to a class i'm using this code

OWLIndividual q2 = question.createOWLIndividual(NS + "q2");
q2.setPropertyValue(key, "key2");

if i look for the individual at run time it's ok but no change in owl file.


asked 24 Nov '12, 20:59

Ibrahim%20Koubeissy's gravatar image

Ibrahim Koub...
accept rate: 0%


Are you saving the ontology to file? Changes in memory are not automatically mapped to the file.

(29 Nov '12, 13:03) Signified ♦ Signified's gravatar image

Actually the owl file is set inside a local webserver folder and i'm accessing it through localhost/~url~/test.owl

(29 Nov '12, 13:09) Ibrahim Koub... Ibrahim%20Koubeissy's gravatar image

As Signified said (+1), most times you'll have to explicitely call a "save" somehow, because otherwise it is only in memory.

(29 Nov '12, 16:32) AKSWMember AKSWMember's gravatar image

see - http://answers.semanticweb.com/questions/19886/commit-changes-to-owl-using-protege-api re saving file


owlModel.save() - http://protege.stanford.edu/protege/3.4/docs/api/owl/edu/stanford/smi/protegex/owl/jena/JenaOWLModel.html#save(java.net.URI)

seeAlso: http://protegewiki.stanford.edu/wiki/ProtegeOWL_API_Advanced_Topics#Loading_and_Saving_Files

String uri = "http://protege.cim3.net/file/pub/ontologies/travel/travel.owl";
JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);
OWLNamedClass destinationClass = owlModel.getOWLNamedClass("Destination");
String fileName = "travel-saved.owl";
Collection errors = new ArrayList();
owlModel.save(new File(fileName).toURI(), FileUtils.langXMLAbbrev, errors);
System.out.println("File saved with " + errors.size() + " errors.");


permanent link

answered 02 Dec '12, 02:03

Sweet%20Burlap's gravatar image

Sweet Burlap
accept rate: 19%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Nov '12, 20:59

question was seen: 9,585 times

last updated: 02 Dec '12, 02:03