Skip to main content



      Home
Home » Modeling » MoDisco » Querying KDM model
Querying KDM model [message #984725] Wed, 14 November 2012 18:12 Go to next message
Eclipse UserFriend
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 04:24 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Querying KDM model [message #985891 is a reply to message #985279] Fri, 16 November 2012 10:16 Go to previous messageGo to next message
Eclipse UserFriend
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 13:52 Go to previous messageGo to next message
Eclipse UserFriend
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 05:00 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Querying KDM model [message #987175 is a reply to message #986382] Fri, 23 November 2012 21:50 Go to previous message
Eclipse UserFriend
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 May 15 06:43:12 EDT 2025

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

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

Back to the top