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?
I ask because it would make the code much easier.
thanks
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
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
On Thu, May 31, 2012 at 9:10 AM, Tudor Girba tudor@tudorgirba.com wrote:
Hi Mariano,
The current FuelMooseExtensions is in fact a FuelFameExtension.
Actually, we have two packages, FuelMooseExtensions and 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.
But wait. One the one hand, we have the FLFameCluster that knows how to serialize objects based on Fame descriptions, following the attributes, etc. That is in FuelFameExtensions. Now, what I want to change is FuelMooseExtension, to change the "if" to see when to use the FLFameCluster. And that is what could be simplified a lot. Just saying that *only for Moose* all MooseEntities should use FLFameCluster simplifies things a lot. I am not changing the FuelFameExtension at all. Just saying when Moose should use it. Instead of checking each object of the graph in the MooseModel meta descriptionOf: I just know that if it is a MooseEntity, it should use the Fame description. But still, the Fame extension is there if later there is another users.
does it make sense?
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
-- www.tudorgirba.com
"Every thing has its own flow"
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev