Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions Part2-API-Schemas/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,14 @@ components:
type: string
pattern: "^-?(([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9]))-((0[1-9])|(1[0-2]))-((0[1-9])|([12][0-9])|(3[01]))T(((([01][0-9])|(2[0-3])):[0-5][0-9]:([0-5][0-9])(\\.[0-9]+)?)|24:00:00(\\.0+)?)(Z|\\+00:00|-00:00)$"
type: object
modelStringPattern:
FieldIdentifier:
type: string
pattern: >-
^(?:\$aas#(?:idShort|id|assetInformation\.assetKind|assetInformation\.assetType|assetInformation\.globalAssetId|assetInformation\.specificAssetIds\[[0-9]*\]\.(?:name|value|externalSubjectId(?:\.(?:type|keys\[[0-9]*\]\.(?:type|value)))?)|submodels\[[0-9]*\]\.(?:type|keys\[[0-9]*\]\.(?:type|value)))|\$sm#(?:semanticId(?:\.(?:type|keys\[[0-9]*\]\.(?:type|value)))?|idShort|id)|\$sme(?:\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\[[0-9]*\])*(?:\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\[[0-9]*\])*)*)?#(?:semanticId(?:\.(?:type|keys\[[0-9]*\]\.(?:type|value)))?|idShort|value|valueType|language)|\$cd#(?:idShort|id)|\$aasdesc#(?:idShort|id|assetKind|assetType|globalAssetId|specificAssetIds\[[0-9]*\]\.(?:name|value|externalSubjectId(?:\.(?:type|keys\[[0-9]*\]\.(?:type|value)))?)|endpoints\[[0-9]*\]\.(?:interface|protocolinformation\.href)|submodelDescriptors\[[0-9]*\]\.(?:semanticId(?:\.(?:type|keys\[[0-9]*\]\.(?:type|value)))?|idShort|id|endpoints\[[0-9]*\]\.(?:interface|protocolinformation\.href)))|\$smdesc#(?:semanticId(?:\.(?:type|keys\[[0-9]*\]\.(?:type|value)))?|idShort|id|endpoints\[[0-9]*\]\.(?:interface|protocolinformation\.href)))$
FragmentFieldIdentifier:
type: string
pattern: >-
^(?:\$aas#(?:idShort|assetInformation\.assetType|assetInformation\.globalAssetId|assetInformation\.specificAssetIds\[[0-9]*\](?:\.externalSubjectId(?:\.keys\[[0-9]*\])?)?|submodels\[[0-9]*\](?:\.keys\[[0-9]*\])?)|\$sm#(?:semanticId(?:\.keys\[[0-9]*\])?|idShort|id)|\$sme(?:\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\[[0-9]*\])*(?:\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\[[0-9]*\])*)*)?(?:#(?:semanticId(?:\.keys\[[0-9]*\])?|idShort|value|valueType|language))?|\$cd#idShort|\$aasdesc#(?:idShort|description|displayName|extension|administration|assetKind|assetType|globalAssetId|specificAssetIds\[[0-9]*\](?:\.externalSubjectId(?:\.keys\[[0-9]*\])?)?|endpoints\[[0-9]*\]|submodelDescriptors\[[0-9]*\](?:\.(?:semanticId(?:\.keys\[[0-9]*\])?|idShort|endpoints\[[0-9]*\]))?)|\$smdesc#(?:semanticId(?:\.keys\[[0-9]*\])?|idShort|endpoints\[[0-9]*\]))$
MultiLanguagePropertyMetadata:
allOf:
- $ref: "#/components/schemas/SubmodelElementAttributes"
Expand Down Expand Up @@ -792,7 +796,22 @@ components:
pattern: ^id$
$condition:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting the naming inconsistency as explained in the above comment.

$ref: '#/components/schemas/logicalExpression'
$filters:
type: array
items:
$ref: '#/components/schemas/QueryFilter'
required:
- $condition
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting the naming inconsistency as explained in the above comment.

additionalProperties: false
QueryFilter:
type: object
properties:
$fragment:
$ref: '#/components/schemas/FragmentFieldIdentifier'
$condition:
$ref: '#/components/schemas/logicalExpression'
required:
- $fragment
- $condition
additionalProperties: false
QueryResultAssetAdministrationShell:
Expand Down Expand Up @@ -1054,7 +1073,7 @@ components:
type: object
properties:
$field:
$ref: '#/components/schemas/modelStringPattern'
$ref: '#/components/schemas/FieldIdentifier'
$strVal:
$ref: '#/components/schemas/standardString'
$strCast:
Expand Down Expand Up @@ -1178,7 +1197,7 @@ components:
type: object
properties:
$field:
$ref: '#/components/schemas/modelStringPattern'
$ref: '#/components/schemas/FieldIdentifier'
$strVal:
$ref: '#/components/schemas/standardString'
$numVal:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ enum SelectField {
}

enum FieldIdentifier {
$strModel
$field
}

enum Value {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Major Changes:

* New API operations and profiles for signing, including Asset Administration Shell Repository Service Specification - Signature Profile SSP-004, Submodel Repository Service Specification - Signature Profile SSP-003, and Concept Description Repository Service Specification - Signature Profile SSP-004 (https://github.com/admin-shell-io/aas-specs-api/issues/518[#518])
* Add the asynchronous AASX File Server Service Specification (https://github.com/admin-shell-io/aas-specs-api/issues/347[#347])

* Added: Query Filter and FragmentFieldIdentifiers (https://github.com/admin-shell-io/aas-specs-api/issues/517)

Minor Changes:

Expand All @@ -27,7 +27,6 @@ Minor Changes:
* Removed the `GetAllAssetAdministrationShellDescriptorsByAssetType` operation from the OpenAPI files for the Asset Administration Shell Registry Service Specification, as it was not intended to be included in the first place and is not implemented by any known implementation. (https://github.com/admin-shell-io/aas-specs-api/issues/515[#515])
* Editorial: Remove links to SwaggerHub from the HTTP API section, as the links are maintained in the service specifications and profiles sections. (https://github.com/admin-shell-io/aas-specs-api/issues/475[#475])


=== Operation Changes w.r.t. V3.1.2 to V3.2

[%autowidth,width="100%",cols="40%,15%,45%",options="header",]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"$schema": "../../query-json-schema.json",
"select": "id",
"filter": {
"$and":[
{
"$filters": [
{
"$fragment": "$sme#value",
"$condition": {
"$eq": [
{
"strModel": "$sm.semanticId.keys.value"
"$field": "$sm#semanticId.keys[].value"
},
{
"strVal": "https://example.org/value"
"$strVal": "https://example.org/value"
}
]
},
{}
]
},
}
}
],
"option": {
"sort": {
"id": "asc"
Expand Down
114 changes: 112 additions & 2 deletions documentation/IDTA-01002-3/modules/ROOT/pages/query-language.adoc
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update all JSON examples that use $condition to use $formula. Also, I have noticed that some examples uses condition without a $ prefix, so please consider this also when you search and replace.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather use $condition. I there a reason why you prefer $formula?

Copy link
Copy Markdown

@mdanish98 mdanish98 Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't have any preferences, please use whatever makes sense and aligns with the AAS QL. This remarks is only to make sure whichever we decide, we use it everywhere and not a mix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in Security in ACL it is FORMULA (and CONDITION) whereas in the query language only "condition" is used, there is no $formula, only a $condition in Part 2

Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,113 @@ a|
| Both $match conditions are fulfilled, even though for different SpecificAssetIds. Therefore the OR clause also evaluates to `true` for both items.
|===

== Query Filter

The Query Language supports a `$filters` option that allows clients to reduce the amount of returned data. This can significantly improve response times, as the backend may scan and process fewer data elements. Furthermore, filtering is an important mechanism in the security domain, as it helps restrict access to sensitive information by preventing unnecessary exposure of internal data structures.

`$filters` expressions can be applied to specific metamodel elements of the AAS (e.g., `Submodel`, `Submodel Elements` contained within an `Submodel`, etc.). However, not all elements can be filtered arbitrarily. If a particular metamodel element is mandatory according to the AAS specification, filtering it out would result in invalid or incomplete data structures. Therefore, such filtering operations are prohibited to ensure consistency and correctness of the returned data.
Since a valid Reference requires at least one key, filters that eliminate all keys remain valid but result in the removal of the entire Reference rather than just its keys.

If no `$filters` is specified for a particular metamodel element, that element remains unfiltered. Thus, applying additional filters can only reduce the amount of data returned; it can never increase the amount of data or introduce information that is not already present in the underlying AAS. If multiple filters are specified and apply to overlapping data, they are combined using logical AND semantics.

Filter example with boolean condition
[.table-with-appendix-table]
[width=100%, cols="40%,40%,20%"]
|===
h| Grammar h| JSON Schema h| Comment
a|
[source]
----
$sm#semanticId $eq
"https://admin-shell.io/idta/nameplate/3/0/Nameplate"
$filters
$fragment $sme.AddressInformation.Zipcode
$condition false
----
a|
[source,json]
----
{
"$condition": {
"$eq": [
{
"$field": "$sm#semanticId"
},
{
"$strVal": "https://admin-shell.io/idta/nameplate/3/0/Nameplate"
}
]
},
"$filters": [
{
"$fragment": "$sme.AddressInformation.Zipcode",
"$condition": {
"$boolean": false
}
}
]
}

----
a| Selects Nameplate submodels and filters out `AddressInformation.Zipcode` data.
Comment thread
Martin187187 marked this conversation as resolved.
Comment thread
Martin187187 marked this conversation as resolved.
a|
[source]
----
$sm#semanticId $eq
"https://admin-shell.io/idta/nameplate/3/0/Nameplate"
$filters
$fragment $sme#value
$condition $sm#semanticId.keys[].value $eq "HIDE_VALUE"
$fragment $sm#semanticId.keys[]
$condition $sm#semanticId.keys[].value $eq "HIDE_VALUE"
----
a|
[source,json]
----
{
"$condition": {
"$eq": [
{
"$field": "$sm#semanticId"
Comment thread
Martin187187 marked this conversation as resolved.
},
{
"$strVal": "https://admin-shell.io/idta/nameplate/3/0/Nameplate"
}
]
},
"$filters": [
{
"$fragment": "$sme#value",
"$condition": {
"$eq": [
{
"$field": "$sm#semanticId.keys[].value"
},
{
"$strVal": "HIDE_VALUE"
}
]
}
},
{
"$fragment": "$sm#semanticId.keys[]",
"$condition": {
"$eq": [
{
"$field": "$sm#semanticId.keys[].value"
},
{
"$strVal": "HIDE_VALUE"
}
]
}
}
]
}

----
a| Selects Nameplate submodels and filters out values from all nested submodel elements when the key "HIDE_VALUE" is present in the submodel’s semanticId. Additionally, any "HIDE_VALUE" keys in the submodel’s semanticId are removed from the result.
|===

== Sorting and Pagination

Expand All @@ -530,14 +637,15 @@ The table follows the structure of the JSON schema top to bottom.
[width=100%, cols="25%,25%,50%"]
|===
h| JSON Schema h| Grammar h| Comment
| modelStringPattern | <FieldIdentifier> | AAS model elements are strings which start with a $
| FieldIdentifier | <FieldIdentifier> | AAS model elements are strings which start with a $
| FragmentFieldIdentifier | <FieldIdentifierFragment> | AAS model fragments for query/security filtering
| standardString | | All other value strings
| hexLiteralPattern | <HexLiteral> |
| dateTimeLiteralPattern | <DateTimeLiteral> |
| timeLiteralPattern | <TimeLiteral> |
| Value | <operand> | Comparisons eq, ne, gt, ge, lt, le; explicit properties for automatic code generation: strModel etc.
| stringValue | <stringOperand> | String operations contains, starts-with, ends-with, regex; explicit properties for automatic code generation: strModel etc.
| $field | - | string following the modelStringPattern
| $field | - | string following the FieldIdentifier pattern
| $strVal | - | string following the standardString
| $attribute | - | explained in Security Access Rules; not used for query language
| $numVal | <NumericalLiteral> | Number constant
Expand All @@ -564,7 +672,9 @@ h| JSON Schema h| Grammar h| Comment
| rightsEnum | - | explained in Security Access Rules; not used for query language
| AccessPermissionRule | - | explained in Security Access Rules; not used for query language
| AllAccessPermissionRules | - | explained in Security Access Rules; not used for query language
| QueryFilter | <QueryFilter> | A single filter block with $fragment and $condition
| $condition | <logicalExpression> | Root object for the query condition expression
| $filters | <QueryFilter>* | Optional list of filter blocks evaluated together
| $select | <selectStatement> | Optional expresion to control the returned fields. Only 'id' is possible.
|===

Expand Down
49 changes: 39 additions & 10 deletions documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
....
....
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Common JSON Schema for AAS Queries and Access Rules",
Expand All @@ -8,9 +8,13 @@
"type": "string",
"pattern": "^(?!\\$).*"
},
"modelStringPattern": {
"FieldIdentifier": {
"type": "string",
"pattern": "^(?:\\$aas#(?:idShort|id|assetInformation\\.assetKind|assetInformation\\.assetType|assetInformation\\.globalAssetId|assetInformation\\.specificAssetIds\\[[0-9]*\\]\\.(?:name|value|externalSubjectId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?)|submodels\\[[0-9]*\\]\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))|\\$sm#(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|id)|\\$sme(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*)*)?#(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|value|valueType|language)|\\$cd#(?:idShort|id)|\\$aasdesc#(?:idShort|id|assetKind|assetType|globalAssetId|specificAssetIds\\[[0-9]*\\]\\.(?:name|value|externalSubjectId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?)|endpoints\\[[0-9]*\\]\\.(?:interface|protocolinformation\\.href)|submodelDescriptors\\[[0-9]*\\]\\.(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|id|endpoints\\[[0-9]*\\]\\.(?:interface|protocolinformation\\.href)))|\\$smdesc#(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|id|endpoints\\[[0-9]*\\]\\.(?:interface|protocolinformation\\.href)))$"

Check warning on line 13 in documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc

View workflow job for this annotation

GitHub Actions / qodana

Typo

Typo: In word 'aasdesc'

Check warning

Code scanning / QDJVMC

Typo Warning documentation

Typo: In word 'aasdesc'
},
"FragmentFieldIdentifier": {
"type": "string",
"pattern": "^(?:\\$aas#(?:idShort|id|assetInformation\\.assetKind|assetInformation\\.assetType|assetInformation\\.globalAssetId|assetInformation\\.specificAssetIds\\[[0-9]*\\]\\.(?:name|value|externalSubjectId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?)|submodels\\[[0-9]*\\]\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))|\\$sm#(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|id)|\\$sme(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*)*)?#(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|value|valueType|language)|\\$cd#(?:idShort|id)|\\$aasdesc#(?:idShort|id|assetKind|assetType|globalAssetId|specificAssetIds\\[[0-9]*\\]\\.(?:name|value|externalSubjectId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?)|endpoints\\[[0-9]*\\]\\.(?:interface|protocolinformation\\.href)|submodelDescriptors\\[[0-9]*\\]\\.(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|id|endpoints\\[[0-9]*\\]\\.(?:interface|protocolinformation\\.href)))|\\$smdesc#(?:semanticId(?:\\.(?:type|keys\\[[0-9]*\\]\\.(?:type|value)))?|idShort|id|endpoints\\[[0-9]*\\]\\.(?:interface|protocolinformation\\.href)))$"
"pattern": "^(?:\\$aas#(?:idShort|assetInformation\\.assetType|assetInformation\\.globalAssetId|assetInformation\\.specificAssetIds\\[[0-9]*\\](?:\\.externalSubjectId(?:\\.keys\\[[0-9]*\\])?)?|submodels\\[[0-9]*\\](?:\\.keys\\[[0-9]*\\])?)|\\$sm#(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|id)|\\$sme(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*(?:\\.[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\[[0-9]*\\])*)*)?(?:#(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|value|valueType|language))?|\\$cd#idShort|\\$aasdesc#(?:idShort|description|displayName|extension|administration|assetKind|assetType|globalAssetId|specificAssetIds\\[[0-9]*\\](?:\\.externalSubjectId(?:\\.keys\\[[0-9]*\\])?)?|endpoints\\[[0-9]*\\]|submodelDescriptors\\[[0-9]*\\](?:\\.(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|endpoints\\[[0-9]*\\]))?)|\\$smdesc#(?:semanticId(?:\\.keys\\[[0-9]*\\])?|idShort|endpoints\\[[0-9]*\\]))$"

Check warning on line 17 in documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc

View workflow job for this annotation

GitHub Actions / qodana

Typo

Typo: In word 'smdesc'

Check warning

Code scanning / QDJVMC

Typo Warning documentation

Typo: In word 'smdesc'
},
"hexLiteralPattern": {
"type": "string",
Expand All @@ -28,7 +32,7 @@
"type": "object",
"properties": {
"$field": {
"$ref": "#/definitions/modelStringPattern"
"$ref": "#/definitions/FieldIdentifier"
},
"$strVal": {
"$ref": "#/definitions/standardString"
Expand Down Expand Up @@ -180,7 +184,7 @@
"type": "object",
"properties": {
"$field": {
"$ref": "#/definitions/modelStringPattern"
"$ref": "#/definitions/FieldIdentifier"
},
"$strVal": {
"$ref": "#/definitions/standardString"
Expand Down Expand Up @@ -653,6 +657,12 @@
"FILTER": {
"$ref": "#/definitions/SecurityQueryFilter",
"additionalProperties": false
},
"FILTERLIST": {

Check warning on line 661 in documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc

View workflow job for this annotation

GitHub Actions / qodana

Typo

Typo: In word 'FILTERLIST'
Comment thread Fixed
Comment thread Dismissed
"type": "array",
Comment thread Fixed
"items": {
"$ref": "#/definitions/SecurityQueryFilter"
}
}
},
"allOf": [
Expand Down Expand Up @@ -705,7 +715,7 @@
"type": "object",
"properties": {
"FRAGMENT": {
"type": "string"
"$ref": "#/definitions/FragmentFieldIdentifier"
},
"CONDITION": {
"$ref": "#/definitions/logicalExpression"
Expand All @@ -730,10 +740,23 @@
}
],
"additionalProperties": false
}
},
"type": "object",
"properties": {
},
"QueryFilter": {
"type": "object",
"properties": {
"$fragment": {
"$ref": "#/definitions/FragmentFieldIdentifier"
},
"$condition": {
"$ref": "#/definitions/logicalExpression"
}
},
"required": [
"$fragment",
"$condition"
],
"additionalProperties": false
},
"Query": {
"type": "object",
"properties": {
Expand All @@ -743,6 +766,12 @@
},
"$condition": {
"$ref": "#/definitions/logicalExpression"
},
"$filters": {
"type": "array",
"items": {
"$ref": "#/definitions/QueryFilter"
}
}
},
"required": [
Expand Down
Loading
Loading