I'm happy to hear you are using JenaBean. I don't know how much raw
Jena programming you've done, but I find it to be much more
enjoyable/simple to get information into and out of the graph using
beans.
This is the expected behavior. I remember when implementing this I
struggled with how much to persist. Shallow ignores plural
properties, but goes ahead and saves singular properties with
values...and it's recursive.
this should not be hard to fix...giving it a look.
Taylor
> --
> You received this message because you are subscribed to the Google Groups "jenabean-dev" group.
> To post to this group, send email to jenabe...@googlegroups.com.
> To unsubscribe from this group, send email to jenabean-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jenabean-dev?hl=en.
>
>
Sent from my Windows Phone From: Zoran Jeremic
Sent: Friday, April 22, 2011 12:58 PM
To: jenabean-dev
Subject: Re: Shallow save
if you don't access a plural property, they are actually empty. Only
once you've called get<Property> is the data pulled from the graph.
Adding a value is a direction relationship, so save() does add the new
information. I think what's needed is a saveShallow() that only saves
properties, literals, but you can see in many of the test
cases...adding values to a plural property and calling save() modifies
the graph.
Taylor
If you want to make very specific changes to the graph, or retrieve
values, there is also a fluet api for accessing Jena.
See:http://www.thewebsemantic.com/2009/03/10/writing-out-sioc-triples-using-jena-jenabean/
and http://jenabean.googlecode.com/svn/trunk/jenabean/src/test/java/test/thing/TestBasic.java
subject.addProperty(property, writer.toRDFNode(obj));
which will if obj is not literal, nor URI, nor thesemanticweb.Resource execute _write method (thewebsemantic.Bean2RDF L210). That will, since the object is not inside the cycle save it to the model. And this can propagate to collections of obj and so on. That means that shallow save is not actually shallow. It saves elements of a collection and also fields which are not Collections.
I think checking whether the object is contained inside the cycle array is not enough. Maybe checking whether a resources is already stored in the model?
But, a more elegant solution to this, I think, would be introducing an annotation where it could be stated that cascading to that resource when saving should be performed. Or this can be an attribute of @RdfProperty annotation. What do you think?
Best,
Nikola