| Querying KDM model [message #984725] |
Wed, 14 November 2012 18:12  |
Daniel San Martín Messages: 8 Registered: October 2012 |
Junior 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 04:24   |
Hugo Bruneliere Messages: 560 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 - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
|
|
|
|
|
| Re: Querying KDM model [message #986382 is a reply to message #986297] |
Tue, 20 November 2012 05:00   |
Hugo Bruneliere Messages: 560 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 - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
|
|
|
| Re: Querying KDM model [message #987175 is a reply to message #986382] |
Fri, 23 November 2012 21:50  |
Daniel San Martín Messages: 8 Registered: October 2012 |
Junior 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
|
|
|
Powered by
FUDForum. Page generated in 0.01674 seconds