Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Creating a new discoverer
Creating a new discoverer [message #789809] Fri, 03 February 2012 12:35 Go to next message
porchrat Missing name is currently offline porchrat Missing nameFriend
Messages: 11
Registered: July 2010
Junior Member
What I am trying to do is create a new Discoverer to attach a parser I have built previously onto it. I then want to get it to output some sort of standard model format I can look at like KDM or something (I am not that worried about what it outputs any of those standard modelling systems would do as this is just an initial test to give me an idea of how Modisco works).

I've found the API and a basic guide to creating a new Discoverer but I find myself confused. I have created this thread to add problems to as I encounter them in hopes that some of the experts using Modisco could maybe shed some light on them and speed me along.

Please forgive me if my questions are stupid questions. I am very new to Modisco and OSGI so I'm finding this all quite confusing.

OK so to my initial questions:

1) Why do I need Parameters in my Discoverer? What is their purpose?

I have read the API documentation on them and I am still confused. At first I thought things like this:
private String myParamIn;

@Parameter(name="PARAM_IN")
public void setMyParamIn(final String value) {
	this.myParamIn = value;
}

were just there to help set the source file up to be discovered but that doesn't make sense because the basicDiscoverElement(IFile source, IProgressMonitor monitor) method has a "source" parameter right there.


2) Is there a separate class dealing with output formatting so that as I identify the various statements (e.g. 'if' statements) in my source I can add those elements to the model or do I have to build a class for this myself?
Re: Creating a new discoverer [message #789962 is a reply to message #789809] Fri, 03 February 2012 16:17 Go to previous messageGo to next message
Fabien Giquel is currently offline Fabien GiquelFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

thank you for your interest in MoDisco and Eclipse components. I will try to help you :

1)
the framework makes the assumption that a discovery process has always one main source represented as an IFile instance.
Annotations @Parameter are here only for additional parameters if needed. You may ignore them.

2)
I am not sure to understand when you say "...dealing with output formatting...I can add those elements to the model". Can you explain a little more ? The usual way to complete your output model is to create model element instances using org.eclipse.emf.ecore.EFactory/EPackage subclasses instances associated to your metamodel.

Regards,
Fabien.




----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
Re: Creating a new discoverer [message #791781 is a reply to message #789962] Mon, 06 February 2012 08:54 Go to previous messageGo to next message
porchrat Missing name is currently offline porchrat Missing nameFriend
Messages: 11
Registered: July 2010
Junior Member
Hi Fabien.

Thank you for the response.

Fabien Giquel wrote on Fri, 03 February 2012 11:17
Hi,

thank you for your interest in MoDisco and Eclipse components. I will try to help you :

1)
the framework makes the assumption that a discovery process has always one main source represented as an IFile instance.
Annotations @Parameter are here only for additional parameters if needed. You may ignore them.

Ah excellent that makes perfect sense.


Quote:
2)
I am not sure to understand when you say "...dealing with output formatting...I can add those elements to the model". Can you explain a little more ? The usual way to complete your output model is to create model element instances using org.eclipse.emf.ecore.EFactory/EPackage subclasses instances associated to your metamodel.

Regards,
Fabien.



Sorry I am clearly not doing a great job of explaining myself here. Embarrassed

If I have this right a Discoverer runs through a source (in this case an IFile instance) and extracts key phrases and other structures that have meaning to it. It parses it basically. Then those key phrases need to be stored in the form of some sort of model (for example a KDM source model as an xmi file).

My question is this: If we are outputting to some sort of standard KDM source model format is there some sort of class that facilitates that? Presumably it would have some methods for adding elements to the KDM source model, creating associations between elements, handling ownership and group behaviours etc.







Basically this is what I am trying to do:
I have a parser that I use for a specific language (a form of BASIC). I want to create a Discoverer that uses this parser to find keywords in the language and then take those keywords and create a KDM source model (or something similar).

I would actually prefer it if that KDM source model weren't stored in an xmi file but instead were stored in some sort of RDBMS such as MySQL. Scale is an issue and if the entire model were stored in xmi I doubt it would be manageable.

Is this sort of thing possible at the moment using Modisco?

[Updated on: Mon, 06 February 2012 09:01]

Report message to a moderator

Re: Creating a new discoverer [message #792118 is a reply to message #791781] Mon, 06 February 2012 16:33 Go to previous messageGo to next message
Fabien Giquel is currently offline Fabien GiquelFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

MoDisco does not provide particular helper for creating KDM model instances, or other. You should use the EMFgenerated EPackage and EFactory implementations related to the metamodel.

Note : KDM has many subpackages for several domains. "KDM.Source" deals with files representation. "KDM.Code" deals with code artefacts & types.... May be "KDM.Source" will not be the one that fits your target.





MoDisco relies on EMF for model management and does not provide particular mechanism for saving step. What you need to know in your case is :
- your discoverer impl should extend "AbstractModelDiscoverer"
- you should override "saveTargetModel()" which has some XMI/URI specific code.
- it would be logical also to override "createTargetModel()" for creating a Resource instance other than a XMIResourceImpl one. An idea would be to write some RDBMSResourceImpl with related load/save method. Another idea is to rely on Eclipse CDO framework for targetting scalibility.


Regards,
Fabien.


----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
Re: Creating a new discoverer [message #794367 is a reply to message #792118] Thu, 09 February 2012 07:49 Go to previous messageGo to next message
porchrat Missing name is currently offline porchrat Missing nameFriend
Messages: 11
Registered: July 2010
Junior Member
I've looked around and found this KDM metamodel that looks like it is sitting inside Modisco:

https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.gmt.modisco.omg.kdm

What I'm saying is surely if Modisco Discoverers are generating a KDM metamodel there must be a standard set of classes used to generate that metamodel. You can't just have everyone implementing their own version surely?

Otherwise how could that be regarded as a true representation of KDM at that point.

Maybe I am not understanding you correctly here...?
Re: Creating a new discoverer [message #795275 is a reply to message #794367] Fri, 10 February 2012 09:21 Go to previous messageGo to next message
porchrat Missing name is currently offline porchrat Missing nameFriend
Messages: 11
Registered: July 2010
Junior Member
OK so I see what you were talking about Fabien. The source and code subpackages are there in the kdm metamodel and it seems at first glance that these are the sort of thing I am looking for.

Do you know of any API for these?
Re: Creating a new discoverer [message #797248 is a reply to message #795275] Mon, 13 February 2012 08:24 Go to previous messageGo to next message
Fabien Giquel is currently offline Fabien GiquelFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

may be i did not say the essential thing about kdm metamodel implementation :
the "org.eclipse.gmt.modisco.omg.kdm" plugin contains the Java implementation for kdm metamodel and its subpackages.

If you set it as a required plugin of your new discoverer plugin project, you will have access to public Java API for creating KDM models (among them the org.eclipse.gmt.modisco.omg.kdm.code.CodeFactory class for code subpackage).

Hoping that is the information you are looking for.
Fabien.


----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
Re: Creating a new discoverer [message #799094 is a reply to message #797248] Wed, 15 February 2012 12:42 Go to previous messageGo to next message
porchrat Missing name is currently offline porchrat Missing nameFriend
Messages: 11
Registered: July 2010
Junior Member
Ah excellent.

Sorry for requiring the spoon-feeding.

I will take a look at that when I next get a chance.

Thank you so much for your help so far Fabien Smile
Re: Creating a new discoverer [message #1266575 is a reply to message #789809] Fri, 07 March 2014 17:09 Go to previous messageGo to next message
Wenceslao Sanchez is currently offline Wenceslao SanchezFriend
Messages: 3
Registered: March 2014
Junior Member
After looking for my problem in the MoDisco forums for this, I have decided to post my reply here and reopen this topic.

My problem relies in my impossibility of execute any discoverer of my own creation. The others' discoverers work fine.

I have followed the instructions of the Official Eclipse Documentation and I have copy its same basic discoverer example but with no success.
No matter if I create the discoverer in a MoDisco Project or if I declare it in a general project and change its nature after to a MoDisco Project.

More concretely, I cannot find my discoverer in the "MoDisco Discovery Configuration Menu" when I click in "Run Configurations..." firstly (I show you in the file empty-menu.jpg). And when I select the menu, it only gives me the discoverers showed in the below image: menu-without-own-discoverers.jpg (my unwanted menu).
But my discoverers don't appear.

index.php/fa/17675/0/

I followed the instructions of the Documentation and I modified the Manifest.mf adding the correct extension points in the plugin.xml attached. But the problem persists.

Furthermore, I have viewed and checkout through SVN the source code of all the discoverers in "svnroot/modelling/org.eclipse.mdt.modisco/" and they do appear in the menu in the image. I have already compare my discoverers with them and although both have the same identical plugin.xml structure and implement (and extend) the same interfaces (and classes) I still can't execute them.

In addition, I have built several discoverers, more and less complex, but with the same result. I used Eclipse Kepler and Juno. Indigo and Helios gave me problems when I installed MoDisco. I used MoDisco 0.8 to 0.10. I am unable to download 11 or 12.

If you wanted, you can see how my plugin.xml is correct as I attached it.

I will be very thankful of any little help.

Thanks in advance,
Re: Creating a new discoverer [message #1274485 is a reply to message #1266575] Fri, 21 March 2014 14:43 Go to previous messageGo to next message
Wenceslao Sanchez is currently offline Wenceslao SanchezFriend
Messages: 3
Registered: March 2014
Junior Member
Please, I strongly need the solution to this problem.

I just need it to my final project in June!

Any reply will be of enormous help to me!

Thanks in advance,
Re: Creating a new discoverer [message #1432692 is a reply to message #1274485] Sat, 27 September 2014 15:01 Go to previous message
Wenceslao Sanchez is currently offline Wenceslao SanchezFriend
Messages: 3
Registered: March 2014
Junior Member
I am writing this just because if anyone has to face to the same problem, in order I could help him.

The workaround is:
Right click on the discoverer project name on the explorer window view
Chose the option run as...
Go to Eclipse Application (or similar)

And now all the discoverers are in the running Eclipse application
Previous Topic:Running modisco discover on save action
Next Topic:Enumeration in an extended gastm
Goto Forum:
  


Current Time: Fri Mar 29 13:10:52 GMT 2024

Powered by FUDForum. Page generated in 0.02745 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top