Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a972761
Adds ElasticSearch and first draft of AASQL to ES QueryDSL Converter
FriedJannik Jun 4, 2025
b544039
New Converter
FriedJannik Jun 5, 2025
ee3f1d7
Converts Hits
FriedJannik Jun 5, 2025
6aa494d
Updates Readme
FriedJannik Jun 5, 2025
9445a09
Updates Readme
FriedJannik Jun 5, 2025
2eb0bc5
Refactors Query Core
FriedJannik Jun 12, 2025
b3f9e85
Refactor
FriedJannik Jun 12, 2025
83ef356
Adds field-to-field comparison (WIP)
FriedJannik Jun 12, 2025
eed75a8
Adds missing dependency for ES Client in Component
FriedJannik Jun 16, 2025
bba4d32
Refactors HTTP Controller
FriedJannik Jun 20, 2025
f8e0e5d
Makes QueryResponse explicit
FriedJannik Jun 23, 2025
1b375e3
Revert "Makes QueryResponse explicit"
FriedJannik Jun 23, 2025
8935bbf
Makes indizes Configurable
FriedJannik Jun 23, 2025
2713747
WIP - adds unit tests
FriedJannik Jun 25, 2025
a0aded0
Adds Unit Tests and implements Casting Operators
FriedJannik Jun 25, 2025
d20f9a5
WIP Adds QL for other modules
FriedJannik Jul 1, 2025
1fa1f6e
WIP
FriedJannik Jul 1, 2025
5975596
tries to fix indexing of submodels
aaronzi Jul 1, 2025
c2de6da
WIP Adds QL for other modules
FriedJannik Aug 11, 2025
40bd0e7
Adds Field Renaming
FriedJannik Aug 11, 2025
d43d397
Changes Recursion to Iterative Method
FriedJannik Aug 11, 2025
d542f23
Cahnges CRLF to LF
FriedJannik Aug 11, 2025
4a282e4
Adds Querying for nested SME's
FriedJannik Aug 12, 2025
7c544f8
Adapts SM Repo QL
FriedJannik Aug 12, 2025
0614143
Other Search Components Utilize MongoDB now
FriedJannik Aug 14, 2025
080aaac
Adapts Path Parsing
FriedJannik Aug 14, 2025
2af0568
Adapts Path Parsing
FriedJannik Aug 14, 2025
7cbf097
Adapts QL
FriedJannik Aug 18, 2025
624378f
Adapts QL
FriedJannik Aug 18, 2025
f595007
Intermediate Commit
FriedJannik Aug 18, 2025
376cc62
IC
FriedJannik Aug 19, 2025
e6f6878
AAS Registry IT
FriedJannik Aug 19, 2025
36449ea
Merge remote-tracking branch 'basyx/main' into queryLanguage
FriedJannik Aug 19, 2025
7029952
Adds missing parameter
FriedJannik Aug 19, 2025
5109adf
Fixes docker-compose.yml
FriedJannik Aug 19, 2025
2c87155
Reverts changes in application.properties
FriedJannik Aug 19, 2025
cd8ee88
Adds missing .env entries
FriedJannik Aug 19, 2025
2f43b9f
Adapts output json to new converter format
FriedJannik Aug 19, 2025
f96d7c4
Adapts application.properties
FriedJannik Aug 19, 2025
a038110
Adapts Autoconfiguration
FriedJannik Aug 19, 2025
41d1f56
Adds missing ConditionalOnExpression
FriedJannik Aug 19, 2025
33d6e82
Adapts
FriedJannik Aug 19, 2025
6ef9ba7
Adapts
FriedJannik Aug 19, 2025
e4a7271
Adapts
FriedJannik Aug 19, 2025
e937f63
Fixes some issues with spring
FriedJannik Aug 20, 2025
498b65b
Adds Timeout (TODO)
FriedJannik Aug 20, 2025
5aafcab
Adds missing line
FriedJannik Aug 20, 2025
a2118f3
Removes hard-coded thread.sleep and adds awaitility
FriedJannik Aug 21, 2025
9aba29c
Adapts limit
FriedJannik Aug 21, 2025
e091a09
Adapts test
FriedJannik Aug 21, 2025
32b3b2c
Adapts test
FriedJannik Aug 21, 2025
9e2456d
Adds Thread.sleep for the moment
FriedJannik Aug 21, 2025
25607c6
Review remarks
FriedJannik Aug 21, 2025
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
19 changes: 19 additions & 0 deletions .github/workflows/examples_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,22 @@ jobs:

- name: Stop BaSyx Node-RED Example
run: docker compose -f examples/BaSyxNodeRED/docker-compose.yml down

test-basyx-query-language:
runs-on: ubuntu-latest
name: Test BaSyx Query Language Example
steps:
- uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven

- name: Start BaSyx Query Language Example
run: docker compose -f examples/BaSyxQueryLanguage/docker-compose.yml up -d

- name: Stop BaSyx Query Language Example
run: docker compose -f examples/BaSyxQueryLanguage/docker-compose.yml down
12 changes: 12 additions & 0 deletions .run/AasRegistryLogMongoDB.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="AasRegistryLogMongoDB" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="logEvents,mongoDbStorage" />
<option name="ALTERNATIVE_JRE_PATH" value="21" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<module name="basyx.aasregistry-service-release-log-mongodb" />
<option name="SPRING_BOOT_MAIN_CLASS" value="org.eclipse.digitaltwin.basyx.aasregistry.service.OpenApiGeneratorApplication" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/SubmodelRegistryLogMongoDB.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SubmodelRegistryLogMongoDB" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="logEvents,mongoDbStorage" />
<option name="ALTERNATIVE_JRE_PATH" value="21" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<module name="basyx.submodelregistry-service-release-log-mongodb" />
<option name="SPRING_BOOT_MAIN_CLASS" value="org.eclipse.digitaltwin.basyx.submodelregistry.service.OpenApiGeneratorApplication" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions basyx.aasenvironment/basyx.aasenvironment.component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasrepository-feature-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasrepository-feature-search</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.submodelrepository-feature-search</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.conceptdescriptionrepository-feature-search</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.submodelrepository-feature-kafka</artifactId>
Expand Down Expand Up @@ -174,6 +186,15 @@
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.mongodbcore</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.querycore</artifactId>
</dependency>
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>9.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@ basyx.backend = InMemory
####################################################################################
#springdoc.swagger-ui.enabled=false
#springdoc.api-docs.enabled=false


# basyx.aasrepository.feature.search.enabled=true
# basyx.aasrepository.feature.search.indexname=aas-index-test
# basyx.cdrepository.feature.search.enabled=true
# basyx.cdrepository.feature.search.indexname=cd-index-test
# basyx.submodelrepository.feature.search.enabled=true
# basyx.submodelrepository.feature.search.indexname=sm-index-test
# spring.elasticsearch.uris=http://localhost:9200
# spring.elasticsearch.username=elastic
# spring.elasticsearch.password=vtzJFt1b
65 changes: 65 additions & 0 deletions basyx.aasregistry/basyx.aasregistry-feature-search/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasregistry</artifactId>
<version>${revision}</version>
</parent>
<artifactId>basyx.aasregistry-feature-search</artifactId>
<name>BaSyx AAS Registry Feature Search</name>
<description>Feature Search for the BaSyx AAS Registry</description>

<dependencies>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasregistry-service</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.querycore</artifactId>
</dependency>
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>9.0.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasregistry-service-basemodel</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasregistry-service-mongodb-storage</artifactId>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*******************************************************************************
* Copyright (C) 2025 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.aasregistry.feature.search;

import org.springframework.boot.actuate.autoconfigure.data.elasticsearch.ElasticsearchReactiveHealthContributorAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.export.elastic.ElasticMetricsExportAutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ReactiveElasticsearchClientAutoConfiguration;
import org.springframework.context.annotation.Configuration;

/**
* Configuration to prevent Elasticsearch from being injected by Spring
*
*/
@Configuration
@ConditionalOnExpression("!(${" + SearchAasRegistryFeature.FEATURENAME + ".enabled:false} || ${basyx.feature.search.enabled:false})")
@EnableAutoConfiguration(exclude = {
ElasticsearchClientAutoConfiguration.class,
ElasticsearchRepositoriesAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class,
ElasticsearchRestClientAutoConfiguration.class,
ElasticsearchReactiveHealthContributorAutoConfiguration.class,
ElasticMetricsExportAutoConfiguration.class,
ReactiveElasticsearchClientAutoConfiguration.class,
ReactiveElasticsearchRepositoriesAutoConfiguration.class
})
public class DisableSearchAasRegistryConfiguration {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*******************************************************************************
* Copyright (C) 2025 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.aasregistry.feature.search;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor;
import org.eclipse.digitaltwin.basyx.aasregistry.service.storage.AasRegistryStorage;
import org.eclipse.digitaltwin.basyx.http.pagination.Base64UrlEncodedCursor;
import org.eclipse.digitaltwin.basyx.querycore.query.model.AASQuery;
import org.eclipse.digitaltwin.basyx.querycore.query.model.QueryResponse;
import org.eclipse.digitaltwin.basyx.querycore.query.executor.ESQueryExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2025-06-18T09:42:17.580283867Z[GMT]")
@ConditionalOnExpression("#{${" + SearchAasRegistryFeature.FEATURENAME + ".enabled:false} or ${basyx.feature.search.enabled:false}}")
@RestController
public class SearchAasRegistryApiHTTPController implements SearchAasRegistryHTTPApi {

private static final Logger log = LoggerFactory.getLogger(SearchAasRegistryApiHTTPController.class);

private final ElasticsearchClient client;
private final AasRegistryStorage backend;

@Value("${" + SearchAasRegistryFeature.FEATURENAME + ".indexname:" + SearchAasRegistryFeature.DEFAULT_INDEX + "}")
private String indexName;

@Autowired
public SearchAasRegistryApiHTTPController(ElasticsearchClient client, AasRegistryStorage backend) {
this.client = client;
this.backend = backend;
}

public ResponseEntity<QueryResponse> queryAssetAdministrationShellDescriptors(Integer limit, Base64UrlEncodedCursor cursor, AASQuery query) {
QueryResponse queryResponse;
try {
if (query.get$select() != null && query.get$select().equals("id")) {
queryResponse = getQueryResponse(query, limit, cursor);
} else {
// Hard Code to only retrieve ids -> Fetching the actual AAS Descs from MongoDB
query.set$select("id");
queryResponse = getQueryResponse(query, limit, cursor);
queryResponse.paging_metadata.resulType = "AssetAdministrationShellDescriptor";
List<AssetAdministrationShellDescriptor> aasDescs = new ArrayList<>();
for (Object id : queryResponse.result) {
String identifier = ((ObjectNode) id).get("id").asText();
AssetAdministrationShellDescriptor aasDesc = backend.getAasDescriptor(identifier);
aasDescs.add(aasDesc);

}
queryResponse.result = aasDescs.stream()
.map(aasDesc -> (Object) aasDesc)
.toList();
}
} catch (IOException e) {
throw new RuntimeException(e);
}

return new ResponseEntity<>(queryResponse, HttpStatus.OK);
}

private QueryResponse getQueryResponse(AASQuery query, Integer limit, Base64UrlEncodedCursor cursor) throws IOException {
QueryResponse queryResponse;
ESQueryExecutor executor = new ESQueryExecutor(client, indexName, "AssetAdministrationShellDescriptor");
queryResponse = executor.executeQueryAndGetResponse(query, limit, cursor);
return queryResponse;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (C) 2025 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.aasregistry.feature.search;

import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Configuration;

@ConditionalOnExpression("#{${" + SearchAasRegistryFeature.FEATURENAME + ".enabled:false} or ${basyx.feature.search.enabled:false}}")
@Configuration
public class SearchAasRegistryConfiguration {

}
Loading
Loading