Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Operating/editing the results of a query
Operating/editing the results of a query [message #657833] Fri, 04 March 2011 09:01 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm working on a project for creating an EMF facade to an(y) Java
(legacy) API. The idea is to allow a developer to operate on EMF object,
and automatically sync the corresponding Java (legacy) objects.

To avoid hand-coding, I'm trying to use Modisco to discover various
patterns of get/set/add/remove methods in the Java API, so I can
generate both the EMF facade classes and the mapping strategy. Since the
API is fairly large (in fact it's SWT) I try to "prune" the model, so
I've created queries that retrieve the non-public methods (irrelevant
for the facade). I get a result set, but now I want to remove those
objects from the model. Is this possible? If not directly, what's the
easiest way of doing this?

Hallvard
Re: Operating/editing the results of a query [message #658252 is a reply to message #657833] Mon, 07 March 2011 15:01 Go to previous messageGo to next message
Fabien Giquel is currently offline Fabien GiquelFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

in EMF Java API, you can remove EObjects from Java models with
EcoreUtil.delete(EObject eObject, boolean recursive) service. Indicating
a recursive delete is prefered for deleting references to contained objects.

notice that the java model will be no more valid when some eobjects are
deleted. e.g. if you delete some private method, some MethodInvocation
instances pointing to it from one java statement will be invalid. It may
not be important in your use case if you do not care of Java statements
in method bodies.

F.

Le 04/03/2011 10:01, Hallvard Trætteberg a écrit :
> Hi,
>
> I'm working on a project for creating an EMF facade to an(y) Java
> (legacy) API. The idea is to allow a developer to operate on EMF object,
> and automatically sync the corresponding Java (legacy) objects.
>
> To avoid hand-coding, I'm trying to use Modisco to discover various
> patterns of get/set/add/remove methods in the Java API, so I can
> generate both the EMF facade classes and the mapping strategy. Since the
> API is fairly large (in fact it's SWT) I try to "prune" the model, so
> I've created queries that retrieve the non-public methods (irrelevant
> for the facade). I get a result set, but now I want to remove those
> objects from the model. Is this possible? If not directly, what's the
> easiest way of doing this?
>
> Hallvard


----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
Re: Operating/editing the results of a query [message #658377 is a reply to message #658252] Tue, 08 March 2011 09:27 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 07.03.11 16.01, Fabien wrote:
>
> in EMF Java API, you can remove EObjects from Java models with
> EcoreUtil.delete(EObject eObject, boolean recursive) service. Indicating
> a recursive delete is prefered for deleting references to contained
> objects.

I was mostly wondering if there was possible to execute commands or
queries on the result set in the UI. E.g. first query for objects, then
do something useful on them.

> notice that the java model will be no more valid when some eobjects are
> deleted. e.g. if you delete some private method, some MethodInvocation
> instances pointing to it from one java statement will be invalid. It may
> not be important in your use case if you do not care of Java statements
> in method bodies.

Yes. Another command/query that could be useful is find all references
to an object, so you can analyse dependencies.

BTW, is it possible to execute new queries on a result set (in the UI)?

Hallvard
Re: Operating/editing the results of a query [message #658618 is a reply to message #658377] Wed, 09 March 2011 09:43 Go to previous messageGo to next message
Fabien Giquel is currently offline Fabien GiquelFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

on the Model Query Results table view, it is possible to select one
resulting EObject and execute another query (which may have a
side-effect on model).
Until now, you cannot execute such a request from the result table UI in
one shot on all objects.

Notice that queries implementations may invoke themselves together, so
that a command query may start with a call to another selection query.

Fabien.


----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
Re: Operating/editing the results of a query [message #658809 is a reply to message #658618] Wed, 09 March 2011 21:21 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 09.03.11 10.43, Fabien wrote:
>
> Until now, you cannot execute such a request from the result table UI in
> one shot on all objects.

I solved it by creating a specific deletion query, corresponding to a
selection query. However, if it was possible to execute a query on all
the objects, in the table, i.e. allow multiple selection as is possible
in the main view, I could use a generic deletion query on the result of
the selection.

> Notice that queries implementations may invoke themselves together, so
> that a command query may start with a call to another selection query.

Yes, that makes it possible to avoid duplicating code.

Hallvard
Previous Topic:Integrating support for Javascript
Next Topic:csv is not reachable
Goto Forum:
  


Current Time: Thu Apr 25 13:01:57 GMT 2024

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

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

Back to the top