[Pellet-users] Save A-Box and java.lang.UnsupportedOperationException
Michael Grove
mike at clarkparsia.com
Thu Jan 31 18:00:28 UTC 2008
On Jan 31, 2008, at 1:11 PM, Christiane Telöken wrote:
> Dear Pellet-users,
>
> I am using Jena and Pellet 1.5 and I have an OWL-DL-ontology with
> the expressivity ALCHF(D) which you will find in the attachment.
>
> I would like to add a statement to a model and save the model
> separately. Doing this results in a warning and then in an exception.
>
> My statements are contained in this datastructure:
>
> public ArrayList <Statement> statementResources = new ArrayList
> <Statement> ();
>
> The code looks like:
>
> Statement stmt = null;
> Statement newStmt = null;
> Resource res;
> Property prop;
> String obj;
>
> SaveABox newAbox = currentAbox;
>
> for (int i = 0; i < currentAbox.statementResources.size(); i++){
> stmt = newAbox.statementResources.get(i);
>
> if (stmt.getSubject().toString().equals(newElement)){
> prop = stmt.getPredicate();
> obj = stmt.getObject().toString();
> newStmt = ontoModel.createStatement(res, prop, obj);
>
> System.out.println (newStmt);
>
>
> ######################################################################
> ############
> The statement looks fine and correct:
> [http://www.owl-ontologies.com/
> Ontology1200661107.owl#NewInstance_1, http://www.owl-ontologies.com/
> Ontology1200661107.owl#hasGoal, "http://www.owl-ontologies.com/
> Ontology1200661107.owl#InGoalRadium224"]
> ######################################################################
> ############
>
>
> Model model = ontoModel.add(res, prop, obj);
>
> ######################################################################
> ############
> Here, Pellet gives a warning:
> WARN [main] (KnowledgeBase.java:773) - Ignoring literal value
> literal(http://www.owl-ontologies.com/
> Ontology1200661107.owl#InGoalRadium224,(),()) for object property
> http://www.owl-ontologies.com/Ontology1200661107.owl#hasGoal
> ######################################################################
> ############
>
It's been awhile since I've used Jena with any regularity, so I might
just be stabbing in the dark here, especially without seeing how you
create your model (is it an in-mem model?), but I *think* you're
seeing the expected behavior. Any Jena experts can feel free to
correct me =)
>
> try{
> model.commit();
This commits the current transaction in the model. If you're using an
in-mem model, I believe the default is no transaction support (see
SimpleTransactionHandler which is used by GraphBase by default), and
if that is the case, that is the cause of the exception you pasted.
I suspect if you printed the whole stack trace, you'd see it coming
out of the jena code, and not pellet -- it's probably being thrown by
the aforementioned SimpleTransactionHandler. If this is your attempt
to write the model to disk, this is the incorrect way to do this.
Look at the getWriter() function, or any of the write(...) methods on
Model which take an outputstream as an argument.
As always, the jena javadocs are useful:
http://jena.sourceforge.net/javadoc/index.html
Cheers,
Mike
> }
> catch (Exception e){
> System.out.println (e);
> }
>
> ######################################################################
> ############
> Pellet throws this exception:
> java.lang.UnsupportedOperationException: this model does not
> support transactions
> ######################################################################
> ############
> }
> }
> }
>
> The objective of my work is to change the A-Box of the ontology and
> save it separately. As I am a newbie to Pellet and the Jena-
> framework I am not sure if this is the way I should do it.
>
> I would be very glad for any hints why the warning and exception is
> thrown and would be very grateful if somebody could tell me if this
> is the right way to save the A-Box of the ontology.
>
> Thank you for any help in advance,
>
> Christiane
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20080131/113c094b/attachment-0001.htm
More information about the Pellet-users
mailing list