Skip to content

AASQL: Support Variable Binding and Arithmetic Operations in Query Language #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
mhrimaz opened this issue May 12, 2025 · 1 comment
Open
1 task done
Labels
enhancement New feature or request

Comments

@mhrimaz
Copy link

mhrimaz commented May 12, 2025

What is missing?

The current AAS Query Language does not support variable binding or arithmetic expressions. This makes common comparison scenarios—such as evaluating the difference between two assets—difficult to express in a single query.

For example, to compare the weight of an AAS with manufacturer "X" to another with manufacturer "Y", users must:

  1. Execute two separate queries to fetch each AAS individually.
  2. Perform the comparison logic on the client side.

This breaks query cohesion, increases complexity, and limits server-side optimization.

How should it be fixed?

Introduce variable bindings to allow assignment of query results to identifiers. And allow arithmetic operations. For example:

# Selecting AAS from manufacturer X
$match(
   $sm#idShort $eq "TechnicalData",
   $sme#semanticId $eq "0173-1#02-BAF016#006",
   $sme#value $lt 100,
   $sme#bind :x
)
...
# Selecting AAS from manufacturer Y
$match(
   $sm#idShort $eq "TechnicalData",
   $sme#semanticId $eq "0173-1#02-BAF016#006",
   $sme#value $lt 500,
   $sme#bind :y
)
...
# referencing to the selected attributes and perform cross-comparisions
:val(:x) - :val(:y) > 100

ps: I know, it is complex, but maybe worth the discussion.

  • I have signed the required Developer Certificate of Origin (DCO) already.
@mhrimaz mhrimaz added the enhancement New feature or request label May 12, 2025
@sebbader-sap
Copy link
Contributor

sebbader-sap commented May 15, 2025

Hi @mhrimaz, we explicitly decided to not introduce such features (yet) to ensure a somehow "simple" query approach. No need to say that the current version is already complex enough...
Still, the requirement was to not go the way to fully-fledged query languages (Cypher, SPARQL, GQL etc.). For use cases where this is needed, I'd propose to expose the AAS repo content via query endpoints that fulfil one of these existing standards.

Even if that means that a generic, AAS query language enabled client might not be able to consume this endpoint out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants