saving moose model with voyage-mongo

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

saving moose model with voyage-mongo

Usman Bhatti
Hello,

I started to have a look to understand if Voyage can be used to save a moose model into a Mongo db. 

This script saves the model, which can be retrieved, modified and saved.

|importer model1 |
importer := MoosePharoImporterTask new.
importer importingContext: (MooseImportingContext new
importClass; importMethod; importAccess; importInvocation; importInheritance; mergeClassAndMetaclass; yourself). 
importer candidateClass: CandidateListOperator.
importer importerClass: SmalltalkImporter.
importer model: MooseModel new; addFromPackagesNamed: #(#'XML-Writer-Tests'); run.
model1 :=  importer model.
model1 name: 'a persistent model'.
model1 privateState flush.
model1 save


MooseModel selectAll.
To see the MooseModel instance that you just saved. 

Or you can see other objects:
FAMIXClass selectAll

If you want to try it:

1/ Install Mongo

2/ Gofer it
  package: 'ConfigurationOfVoyageMongo';
  load.

(ConfigurationOfVoyageMongo project version: '1.2-baseline') load: 'Mongo'.

3/ Gofer it
  package: 'MooseVoyageMongo';
  load.
(The package contains a few necessary extension methods to tell voyage to persist moose model and famix entities).

4/ repository := VOMongoRepository
host: VOMongoRepository defaultHost
database: 'moosedb'.
repository enableSingleton.
========================

There are some issues though:
- It takes a lot of time even to store even ordinary models.
- I don't know yet how to serialize MooseGroups.

I'll try to resolve them in my free time.

Improvements will come from the new algorithm by Esteban to automatically break circular references in complex Graphs and he'll soon integrate and release it with Voyage 2 :). I hope this improves performance issues.


Please feel free to try/improve.

regards,

Usmanf

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