I thought I could use the same: Source=capella_query_by_name(CP_py, "Source Port")
→ I obtain an empty list.
Question: How do you figure which string to put inside (capella_query_by_name)?
The metamodel shows “allocatedFunctionalExchanges” as being an operation/function I guess, whereas “sourcePort” was only an attribute? That’s why it did not work? Any method to call that attribute without getting a javaMember? I don’t see eInverse being used here is it?
There is a function that should get you the components ports:
Hi Kabe,
(just to mention that at the beginning of your message, what you got is a Component Exchange, not a port, just a typo I suppose)
1 - If you see sourcePort in the Interpreter view, the method in Java will be getSourcePort (same for target)
2 - to know what query you can call on an object, select your element in the project explorer and send it to the Semantic Browser. There you will see the queries you can make on this element… and the results you will get.
So for ANY paramater/attribute i see in the interpreter, let’s say “attributeAttribute”, i can assume that a method similar to the following exists:
.getAttributeAttribute() ?
As for methods shown on the interpreter, let’s say “methodMethodMethod” you can use the capella querry by inserting a string similar to the following:
“Method Method Method” (assuming that “methodMethodMethod” is the name of the method) → adding spaces and capitalizing the first letter.
Sending to the semantic browser, what do you mean exaclty by that?
Are you talking about this:
I am asking because when i selected this, i got a view that would not show any queries, instead it showed: current element, referenced elements and referencing elements. Maybe I missed one step.
Thanks! It seems we are doing the same work haha
as for the first typo, you are right I meant component exchange.
Thanks again it works.
Final note, I am thinking I could have found that method by going to CS maybe and making a component exchange variable then CTRL+SPACE maybe…
1 - “So for ANY paramater/attribute i see in the interpreter, let’s say “attributeAttribute”, i can assume that a method similar to the following exists: .getAttributeAttribute() ?” → Yes that’s how it works. And Yes because what you displayed in your image is the eClass of the current object. That works for all the attributes and properties on your object.
If instead, you use the completion on “self.” in the interpreted view, the completion is giving you more method like “siblings”, “eResource”… For these ones, rules are a little bit different I think, eResource would be eResource() in java (not adding the get in front)
"As for methods shown on the interpreter, let’s say “methodMethodMethod” you can use the capella querry by inserting a string similar to the following: “Method Method Method” (assuming that “methodMethodMethod” is the name of the method) → adding spaces and capitalizing the first letter." → Absolutely not. I am not even sure what you mean by “method” here, but the only thing you can call with a query are the queries in from the semantic Browser - this is what capella_query_by_name is done for
2 - Yes I am talking about “Show in Sematic Browser”. For example, these are the queries you can call on a PC Behavior:
Note that this may not be exhaustive, as queries that do not give any result are not displayed in the semantic browser view (for example, if I don’t have any function allocated on my component, then I would not see the query “Allocated Physical Functions”).
You mentioned self. offering more results, such as siblings or eRessources.
Are ‘siblings’ linked somehow to super types on the class diagram / ecore… of the metamodel?
Just for the sake of curiosity/mastery, could you give me an example of a sibling for a component exchange (or in your case a physical component)? If there are any.
Same for an eResource, if there are any.
I meant “operation” or “function”,
I assumed that all these (eReferences?) were functions:
And when I saw the Capella API having a function that makes use “capella_query” with the following string: “Allocated Functional Exchanges”, I assumed wrongfully we could do the same with all the elements in the picture above:
“I was quite happy to get that ” → Did not see that, awesome!! And thanks for helping on the forum!!
siblings/eResource: I do not really know/I am unsure, maybe Yvan can provide some insights here
“There is no other method to “know” what are all the strings accepted in capella_query_by_name, other than the semantic browser?” → There probably is, one would be to look into the Capella code, but again maybe Yvan has some insights on that.
Some services offered by the completion comes from the runtime library of AQL. Some of them directly expose EMF methods to AQL users, but some other are specific to AQL. For the specific ones you will need to make your own implementation.
siblings are all objects in the same container as the current object:
O
O1
O11
O2
O3
O2.siblings() will return a collection with O1 and O2 and O2.followingSiblings() will return a collection containing O3.
the resource is an object containing a model in EMF. If can be an XMI file but it can also be a resource in a CDO server or … Its URI give a way to access it from a ResourceSet.
EMF generate Java classes from a metamodel (.ecore file) and those classes declares methods corresponding to EStructuralFeatures of the EClass. The generation use a naming pattern:
getFeatureName : for all features
setFeatureName : for single value features
All methods starting with “e” are EMF specific features that mainly allows:
navigating from the model to its metamodel to query its structure
navigating the modele without knowning its structure
The capella_query_by_name() allows to launch queries from the semantic browser of Capella, using the section name displayed in it.
To know all the possible names, you will need to check plugin.xml files (of Capella and addons) for the following extension contribution:
There is an utility class that does that in the M2Doc Capella extensions. It produce the code form the semantic browser services. You can use this class to see a list of available queries. But the name is only available in the plugin.xml (see this example).
Quite poweful responses in this forum thread! Thanks a lot
I will investigate it, check the function, but also check that contentProviderCategory thing when I can.
.
I am grateful for the explanation, dont get me wrong , but: are all complexe programs like that? It seems Capella contain SO MANY java files that are connected with so many classes from so many components, I remember reading about description of Capella, it has a image showing Kitalpha(/sirius?) and other things. Then I later heard of GMF, oh and let’s not forget EMF for eclipse based programs, and Extended Editing Framework (EEF ) .
Hello,
Sorry could not watch the webinar today, maybe someone is still here today,
here my follow up question:
Is there a reason “capella querry by name” uses syntaxes with “S” and sometimes without?
Let me illustrate:
Here we have these 2 features ending with “S”,
But when using the function capella query, I found that “S” had to be removed from the first one but not from the second one: