General guidance on using AQL to query taxonomies #1464
-
|
Hi all, I'm playing around talking to SysON via its GraphQL API and using AQL queries to access the model's contents. I'm a noob with EMF and OCL in general, so this might be super easy and I just missed it. I want to do something like the following, to get all model elements which subtype from a given supertype: aql:self.eResource().getContents().eAllContents(sysml::PartDefinition)
->select(c | c.oclIsKindOf( MySuperAmazingSupertype ))which works when the argument of I've also tried navigating aql:self.eResource().getContents().eAllContents(sysml::Subclassification)
->select(s | s.target.name = 'The Name of my super amazing supertype')
->collect(s | s.source)but this doesn't seem to work due to reasons that escape me. It's weird since ...
->collect(s | s.target)
->collect (t | t.name)shows me the correct name I want to select by, but then I can't dereference the source element. Has anybody had success with something similar? I appreciate any and all help. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Hi, Thank you for using SysON! SysON does not consider your own As a workaround, you can select the Looking at your second query, the key here is that You can get the result you want by updating your query as follows: Note that the query view in SysON indicates whether a result is a collection or not, but I have to admit it is not easy to spot at first sight.
As a side note, you can check the AQL documentation if you need some additional information on the language. |
Beta Was this translation helpful? Give feedback.
-
|
I don't think it is doable indeed. It would be easier to create and register a service you can call from your query instead of relying on pure AQL: This can be achieved by implementing |
Beta Was this translation helpful? Give feedback.
-
|
For the record, I found a pure AQL way to achieve what you want. It relies on the I put below the query, I extracted the key parameters so you can easily tune it to your needs. Note that while in this special case it was possible to create a pure AQL implementation of this query, I still don't think there is a way to compute transitive closure in AQL, and as such I'd recommend to use a Java service to handle such queries. |
Beta Was this translation helpful? Give feedback.


I don't think it is doable indeed.
There are maybe some ways to compute a transitive closure in AQL but I don't see how at first sight.
It would be easier to create and register a service you can call from your query instead of relying on pure AQL:
This can be achieved by implementing
IInterpreterJavaServiceProvider