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.

thanks

asked 24 Nov '12, 20:59

Ibrahim%20Koubeissy's gravatar image

Ibrahim Koub...
313
accept rate: 0%

1

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
2.7k38
accept rate: 18%

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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:

×632
×216

question asked: 24 Nov '12, 20:59

question was seen: 7,565 times

last updated: 02 Dec '12, 02:03