Hi Mariano,
The current FuelMooseExtensions is in fact a FuelFameExtension. Fame is at a higher level than MooseEntity, and it can be used to describe any object (just like Magritte). To serialize objects based on the Fame descriptions, you have to go through those descriptions. So, the current implementation is quite valuable as it is.
Your observation is correct for FAMIX models (but remember that Moose is more than that): all the relevant objects inherit from MooseEntity. But, if we go to the Smalltalk level, we can use a much simpler heuristic: We serialize everything that is referenced by the MooseModel object :). However, this strategy should be separate from the existing one, because that one is valuable the way it is.
Cheers, Doru
On Wed, May 30, 2012 at 11:20 PM, Mariano Martinez Peck marianopeck@gmail.com wrote:
On Wed, May 30, 2012 at 6:50 PM, Mariano Martinez Peck marianopeck@gmail.com wrote:
Hi guys. Right now, our extension to export Moose models does the following:
accepts: anObject MooseModel meta descriptionOf: anObject class ifAbsent: [ ^ false ]. ^ true
so....if an object is NOT found in the #descriptionOf: then we use the normal Fuel serialization. If it WAS found, then we do something like:
FLFameCluster >> referencesOf: anObject do: aBlock
self attributes do: [ :anAttribute | | values | values := anAttribute getFrom: anObject. (self shouldIgnore: anAttribute withAll: values) ifTrue: [ aBlock value: 0 ] ifFalse: [ aBlock value: values size. values do: [ :aValue | aBlock value: aValue ] ] ]
and
shouldIgnore: attribute withAll: values "Copied from FMRepositoryVisitor>>ignoreProperty:withAll:"
^ values isEmpty or: [ attribute isDerived or: [ attribute type == FM3MetaDescription boolean and: [ values size == 1 and: [ values first == false ]]]]
so...basically we follow all attributes.
Now...my question is (actually, Martin), instead of doing the "if" to see whether I should do that or the normal fuel procedure, instead of being MooseModel meta descriptionOf: anObject class ifAbsent: can be: "object kindOf: MooseEntity" ?
would that be the same? in other words, all what is included in descriptionOf: are MooseEntities? all MooseEntities (whether they are included in descriptionOf: or not should be ne serialized that way?
Well I noticed that all objects found in descriptionOf: are MooseEntities. So this is cool. The only missing part is that if ALL MooseEntities should be serialized with this special way (our extension) intead of the normal one, or only those which are present in MooseModel descriptionOf ... so do you know?
In either case, we can simplify our extension quite a lot.
I ask because it would make the code much easier.
thanks
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev