-
Notifications
You must be signed in to change notification settings - Fork 9
AASQL: Unnecessary mandatory whitespace #450
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
Comments
The grammar is only a logical representation, nothing more. The actual endpoints use a more formal serialisation, e.g. JSON. Therefore, the mandatory whitespace does not appear at runtime at all, and therefore I don't regard it as a bug. |
I disagree with you. You can use the grammar to build a parser (Using ANTLR or LARK or ...), consume the compact syntax, build a parse tree, and then transform the parse tree to the target query language. JSON serialization here is too much verbose and the grammar is already good enough. so instead of having this query {
"$condition": {
"$match": [
{
"$eq": [
{ "$field": "$aas#assetInformation.globalAssetId" },
{ "$strVal": "2487a22c-fe20-44c7-acb7-9300a89bd739" }
]
}
]
}
} I prefer to support the compact query
use a parser to build the parse tree: and then process the parse tree to generate the query: PREFIX aas: <https://admin-shell.io/aas/3/0/>
SELECT ?aas WHERE {
?aas a aas:AssetAdministrationShell .
?aas <https://admin-shell.io/aas/3/0/AssetAdministrationShell/assetInformation> ?assetInformation .
?assetInformation <https://admin-shell.io/aas/3/0/AssetInformation/globalAssetId> "2487a22c-fe20-44c7-acb7-9300a89bd739".
}
Yes, having an optional whitespace is necessary. This would allow people to format their queries in a readable way. but having a mandatory whitespace is also not necessary :) So here a mandatory whitespace makes this query invalid:
|
You are of course free to implement an endpoint for it like that (you are not the only one for sure), however, just be aware that the AAS OpenAPI Query endpoint only describes the JSON serialisation of AAS Queries. Exposing a query endpoint with the "BNF-encoded" serialisation is not covered by the V3.1 specification anymore. |
What happens?
This mean
$match (
is valid but$match(
is not valid. in some other places it makes sense to have whitespace mandatory (however, I don't like it).Either change the ws definition and always make it optional or introduce optional whitespace as well. something like
The text was updated successfully, but these errors were encountered: