moose data analysis exporter (xml or other...)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

moose data analysis exporter (xml or other...)

mpescuma
Hi all,
I'm a developer that needs to produce (starting from a java project) and
import moose data analysis into a own program (written into java or c++).
Exists a api moose library (a .dll or somethings of equivalent) that can be
linked to my program or can the moose data analysis exported into a xml or
equivalent file format ? Can the moose be launched as a command with an
stdout without use a user interface or gui ?
Thanks,
Michele

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3342354.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Tudor Girba-2
Hi Michele,

Could you give us a bit more details about your use case? What kind of information do you need exported?

For example, if you are only interested in a standard model output, you can use the MSE export. If you are interested in the parsed model for Java and C++, you can rely directly on the external parsers such as verveineJ that exports an MSE file.

Cheers,
Doru


On 16 Sep 2011, at 18:09, mpescuma wrote:

> Hi all,
> I'm a developer that needs to produce (starting from a java project) and
> import moose data analysis into a own program (written into java or c++).
> Exists a api moose library (a .dll or somethings of equivalent) that can be
> linked to my program or can the moose data analysis exported into a xml or
> equivalent file format ? Can the moose be launched as a command with an
> stdout without use a user interface or gui ?
> Thanks,
> Michele
>
> --
> View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3342354.html
> Sent from the moose-dev mailing list archive at Nabble.com.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"Not knowing how to do something is not an argument for how it cannot be done."


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

mpescuma
Hi Tudor.... this is my use case... I need to extract from moose analysis of
a java project some software metrics... for example for each java class the
number of methods inerithed, the number of messages send, the number of
comments, the number of LOC etc.
My gool is to build a c++ or java program that starting from a java project
path call the moose suite to produce the project analysis and then analyze
the result to produce same table with class metrics. could you tell me how
to get the analysis directly from moose in a format that I can read from my
C ++ or java program? I thought to call moose directly without using the
graphical interface, but directly from my program by reading then the output
... you could give me instructions to do this? I asked the same thing to
Stefan (I found after the forum, so sorry for the duplicate post) ... and in
his response mail...he wrote that I can call or connect to moose in this
way: "You can script moose by passing a script on the command line. You
could also conect via a socket." ... How can I do ? Can you give me an
example ?
Thanks,
Michele

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3343769.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Tudor Girba-2
Hi,

Ok. For this purpose, you have to write a Smalltalk program, and then call the vm with multiple parameters:
- moose.image (the Moose image)
- a Smalltalk script that executes your desired behavior and then quits the image

For example, the desired behavior will be load the model into Moose, perform some computations, and export the results into a file.

You can get inspiration from AutoMoose:
http://www.themoosebook.org/book/internals/auto-moose

The only problem is that the documentation of AutoMoose mentions the inFusion external parser, and inFusion has recently changed and the instructions are no longer up to date.

Cheers,
Doru


On 17 Sep 2011, at 08:22, mpescuma wrote:

> Hi Tudor.... this is my use case... I need to extract from moose analysis of
> a java project some software metrics... for example for each java class the
> number of methods inerithed, the number of messages send, the number of
> comments, the number of LOC etc.
> My gool is to build a c++ or java program that starting from a java project
> path call the moose suite to produce the project analysis and then analyze
> the result to produce same table with class metrics. could you tell me how
> to get the analysis directly from moose in a format that I can read from my
> C ++ or java program? I thought to call moose directly without using the
> graphical interface, but directly from my program by reading then the output
> ... you could give me instructions to do this? I asked the same thing to
> Stefan (I found after the forum, so sorry for the duplicate post) ... and in
> his response mail...he wrote that I can call or connect to moose in this
> way: "You can script moose by passing a script on the command line. You
> could also conect via a socket." ... How can I do ? Can you give me an
> example ?
> Thanks,
> Michele
>
> --
> View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3343769.html
> Sent from the moose-dev mailing list archive at Nabble.com.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"Obvious things are difficult to teach."




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Stéphane Ducasse
In reply to this post by mpescuma
just a question why don'tt you use simply moose.
Of course this is in Smalltalk but Smalltalk is 1000 simpler than C++ and a good java programmer gets it in two weeks.
So you will lose less time.

You have pharobyexample, pharocasts, profStef to help you for that.

On Sep 17, 2011, at 8:22 AM, mpescuma wrote:

> Hi Tudor.... this is my use case... I need to extract from moose analysis of
> a java project some software metrics... for example for each java class the
> number of methods inerithed, the number of messages send, the number of
> comments, the number of LOC etc.
> My gool is to build a c++ or java program that starting from a java project
> path call the moose suite to produce the project analysis and then analyze
> the result to produce same table with class metrics. could you tell me how
> to get the analysis directly from moose in a format that I can read from my
> C ++ or java program? I thought to call moose directly without using the
> graphical interface, but directly from my program by reading then the output
> ... you could give me instructions to do this? I asked the same thing to
> Stefan (I found after the forum, so sorry for the duplicate post) ... and in
> his response mail...he wrote that I can call or connect to moose in this
> way: "You can script moose by passing a script on the command line. You
> could also conect via a socket." ... How can I do ? Can you give me an
> example ?
> Thanks,
> Michele
>
> --
> View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3343769.html
> Sent from the moose-dev mailing list archive at Nabble.com.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

mpescuma
Thank you for your suggestions. I tried to installa and use automoose,
checked the environment variables into runWithInFusion.bat... but when
launch the script I get this error 'Error: no content to install' where my
to-run.st is this:
wantedMse :=
'C:\mooseTestProject\girba-automoose-c327ff8\builds\moose-system-2011-09-18--11-00\system-2011-09-18--11-00.mse'.
model := MooseModel new importFromMSEStream: (StandardFileStream
readOnlyFileNamed: wantedMse).
model name: (FileDirectory baseNameFor: wantedMse).
MooseModel root add: model.
MooseModel root allModels first inferNamespaceParentsBasedOnNames.
MooseModel root allModels first ensureClassesAndNamespaces.
!
MoosePanel open
!
WorldState addDeferredUIMessage: [SmalltalkImage current snapshot: true
andQuit: true ].
!
is there an error in this script for which the application fails ?
I don't know smalltalk... I studied smalltalk at the university 10 year ago,
but only for storic reasons.
I need a smalltalk script that from a java project extract for each class
his software metric (WMC, DIT, Number of methods Inerithed, NOC, CBO, RFC,
LOCM, Number of messages sent, LOC, Number of comments) and write it into a
text file with a parsable format using mooose... then I  write a C++ or Java
program that would parse that file and reorganize the data into table
format... but I don't know from what point start... which could be the
command to insert into the smalltalk script to obtain this info ?
could you help me ?

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3345941.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Stéphane Ducasse


Smalltalk syntax

        a max: b
       
Java syntax
       
        a.max(b)


On Sep 18, 2011, at 11:35 AM, mpescuma wrote:

> Thank you for your suggestions. I tried to installa and use automoose,
> checked the environment variables into runWithInFusion.bat...

I do not know the bat

Now do you have a file in  
        C:\mooseTestProject\girba-automoose-c327ff8\builds\moose-system-2011-09-18--11-00\

> but when
> launch the script I get this error 'Error: no content to install' where my
> to-run.st is this:
> wantedMse :=
> 'C:\mooseTestProject\girba-automoose-c327ff8\builds\moose-system-2011-09-18--11-00\system-2011-09-18--11-00.mse'.
> model := MooseModel new importFromMSEStream: (StandardFileStream
> readOnlyFileNamed: wantedMse).
> model name: (FileDirectory baseNameFor: wantedMse).
> MooseModel root add: model.
> MooseModel root allModels first inferNamespaceParentsBasedOnNames.
> MooseModel root allModels first ensureClassesAndNamespaces.
> !
> MoosePanel open
> !
> WorldState addDeferredUIMessage: [SmalltalkImage current snapshot: true
> andQuit: true ].
> !
> is there an error in this script for which the application fails ?
> I don't know smalltalk... I studied smalltalk at the university 10 year ago,
> but only for storic reasons.
> I need a smalltalk script that from a java project extract for each class
> his software metric (WMC, DIT, Number of methods Inerithed, NOC, CBO, RFC,
> LOCM, Number of messages sent, LOC, Number of comments) and write it into a
> text file with a parsable format using mooose... then I  write a C++ or Java
> program that would parse that file and reorganize the data into table
> format... but I don't know from what point start... which could be the
> command to insert into the smalltalk script to obtain this info ?

Moose as an exporter: you can specify the metrics that you want to export.
I will ask andre to let us know (tuesday).
I'm not sure that this is integrated into the default Moose.


> could you help me ?
>
> --
> View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3345941.html
> Sent from the moose-dev mailing list archive at Nabble.com.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

mpescuma
Ok, thank you. I hope that andre can help me.

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3347833.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Stéphane Ducasse
I hope too
now I think that not learning smalltalk fast is an error. Because this is simple and would open a lot of doors.
We worked on Moose since 1996 and rewrote it three times and it has really powerful engines.
making moose just a box to produce metrics on a file looks sad to me.


Stef

On Sep 19, 2011, at 8:37 AM, mpescuma wrote:

> Ok, thank you. I hope that andre can help me.
>
> --
> View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3347833.html
> Sent from the moose-dev mailing list archive at Nabble.com.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

mpescuma
Hi, news about andre ?
sorry the insistence, but I have a small time to develop a solution.

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3351636.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Andre Hora
Hello,

Just to clarify, I am returning tomorrow (Wednesday), not today (Tuesday) :)

If you want to try an automatic way to export the properties (metrics) opening the Moose image, run the script below:
Gofer new
    squeaksource: 'HoraExp';
    package: 'FameExportMSE';
    package: 'FameExportProperties';
    load.
Then, right-click on an entity, Utilities -> Export properties, and select the metrics to export. If you export clicking on the MooseModel, several files can be generated, for each group. Export clicking on others entities generates one file.
The results (CSV or XML) are in the directory: Contents/Resources.

If you want to export the metrics using the command line (or a shell script or a Java app..), you can use the attached smalltalk script. You have to open the script and set the metrics to be exported in the line:
- selectors: #(#numberOfLinesOfCode #numberOfMethods #fanIn #fanOut).

The command to run the script is:
./path_vm imageName.image runMetrics.st path_mse outputName.csv

For example, in MacOS, in the folder Contents/Resources of your image, run:
./../MacOS/'Squeak VM Opt' Moose.image runMetrics.st /Users/hora/Downloads/Moose-27.app/Contents/Resources/collection.mse myOutput.csv

If you are in Linux or Windows you should set the correct path_vm: Contents/Linux/squeak or /Contents/Windows/Squeak.exe
The result (outputName.csv) is saved into the folder where your image is stored (normally Contents/Resources).

If you don't have the mse file representing your project, you can easily generate it using VerveineJ or inFusion. See the Moose Book or old emails of this list to do that.

The script is also below:

----------------------------------------------
Gofer new
    squeaksource: 'HoraExp';
    package: 'FameExportMSE';
    package: 'FameExportProperties';
    load.
!
| stream model msePath eContext |

msePath := (CommandLine uniqueInstance allParameters) at: 2.
csvName := (CommandLine uniqueInstance allParameters) at: 3.
model := MooseModel new importFromMSEStream: (StandardFileStream readOnlyFileFullyNamed: msePath).
stream := MultiByteFileStream newFileNamed: csvName.

eContext := PropertyExportingContext new
                separator: $,;
                selectors: #(#numberOfLinesOfCode #numberOfMethods #fanIn #fanOut).

(model allModelClasses) exportPropertyOnStream: stream context: eContext.
stream close.

WorldState addDeferredUIMessage: [
SmalltalkImage current snapshot: false andQuit: true ].
----------------------------------------------
--
Andre Hora



On Tue, Sep 20, 2011 at 12:46 PM, mpescuma <[hidden email]> wrote:
Hi, news about andre ?
sorry the insistence, but I have a small time to develop a solution.

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3351636.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
Andre Hora


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

runMetrics.st (1022 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

mpescuma
Hi Andre...
thank you very much for your support and info... I will test the script as
soon as possible... It is just what I wanted! I will post my questions and
any difficulties... thanks again.

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3354717.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

mpescuma
Hi Andre... the script works very well...might be possible to add to every
class listed into cvs also the superclass name (in addition to the class
properties)? can it done changing the script ? thanks

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3364722.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: moose data analysis exporter (xml or other...)

Andre Hora
Hello Michele,

You can run the same script and it should generate also the superclass name in addition to the class name.

regards,

On Sat, Sep 24, 2011 at 7:08 PM, mpescuma <[hidden email]> wrote:
Hi Andre... the script works very well...might be possible to add to every
class listed into cvs also the superclass name (in addition to the class
properties)? can it done changing the script ? thanks

--
View this message in context: http://moose-dev.97923.n3.nabble.com/moose-data-analysis-exporter-xml-or-other-tp3342354p3364722.html
Sent from the moose-dev mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
Andre Hora


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev