Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Querying KDM model
Querying KDM model [message #984725] Wed, 14 November 2012 23:12 Go to next message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
Hi,

I would like to do some querys with the KDM model generated programmatically.

//Get KDM Segment
Segment kdmSegment =  (Segment) javaResource.getContents().get(0);
listKdmModel = kdmSegment.getModel();

//Get Models
kdmModel = listKdmModel.get(0);


For example, get all classes. Which tool is most appropriate to do that?. I was thinking in Quey2 or OCL. Do you have some examples?

Thanks,

Daniel.
Re: Querying KDM model [message #985279 is a reply to message #984725] Thu, 15 November 2012 09:24 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

I encourage you to take a look to the Infrastructure/Query Manager section of the MoDisco reference documentation.
It is describing how to declare model queries in different languages (including OCL and Java), store and execute them within the MoDisco infrastructure.

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: Querying KDM model [message #985891 is a reply to message #985279] Fri, 16 November 2012 15:16 Go to previous messageGo to next message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
Hi Hugo,

Thanks for the answer, but I have a new question.

In "How to programmatically use the MoDisco query set catalog" example code we have this:

 // Get the query set named "My".
    ModelQuerySet modelQuerySet = catalog.getModelQuerySet("My");


Where "My" is a query set.

Do you have an example of how is constructed this catalog? Is it a file and then passed to a String?. How is the structure?.

Thanks,

Daniel.
Re: Querying KDM model [message #986297 is a reply to message #985891] Mon, 19 November 2012 18:52 Go to previous messageGo to next message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
Well, regarding to the last question i think is solved.


There is an example how to execute a query programmatically?.


Thanks,

Daniel
Re: Querying KDM model [message #986382 is a reply to message #986297] Tue, 20 November 2012 10:00 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

In the Infrastructure/Query Manager/Developer Documentation section of the MoDisco reference documentation (cf. my previous post), you will find an example class showing how to launch programmatically a query (and get the corresponding result) registered within a MoDisco query set.
Of course, the actual type of the query result will depend on the type of element returned by the query (cf. the MoDisco ModelQuery generic interface and given concrete query implementations).

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: Querying KDM model [message #987175 is a reply to message #986382] Sat, 24 November 2012 02:50 Go to previous message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
Hello Hugo,

Thanks, now I understand how to do some queries but with a new doubt.


I am trying to do a query with JXPath. I would like to get the name of the classes (file attached), in this case it must be A, L and B.


The properties of a JXPath Model query are the following:

Scope: KDMModel, ModelElement, Element.
Query: //codeElement//@name
Return: EEList<E> [org.eclipse.emf.common.util.EList]

I think it must retrieve all the names of CodeElement type but I just get the first element, the name of the package "br". What am I doing wrong?

Thanks,

Daniel








Previous Topic:Migration from EJB 2.1 to EJB 3.0
Next Topic:Question about ATL
Goto Forum:
  


Current Time: Thu Apr 25 07:55:36 GMT 2024

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

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

Back to the top