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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

aas/src/main/java/**/*.java
ids/src/main/java/de/fraunhofer/iais/eis/*.java
model/src/main/java/**/*.java

visualization/*.plantuml
jsonld-context/context.json
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The project contains several modules:
- `common` Module containing shapes translating RDF into Java classes.
- `util` Module containing some generic utility classes, such as custom annotations.
- `generator` This module loads all data required for the translation process from RDF ontologies to Java classes, including the shapes and the ontology.
- `rdf-sources` contains copies of the source files. Move them to a local folder of your choice, depending on your profile and `<infomodel-sourcebase>` parameter. Originally coming from [aas-core-works](https://github.com/admin-shell-io/aas-specs-metamodel/blob/IDTA-01001-3-2_Working/schemas/rdf).

# How to Contribute

Expand Down
16 changes: 8 additions & 8 deletions aas/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>common</artifactId>
<groupId>io.admin-shell.aas</groupId>
<groupId>org.eclipse.aas4j</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -13,13 +13,13 @@

<properties>
<ontology.title>Asset Administration Shell</ontology.title>
<ontology.namespace>https://admin-shell.io/aas/3/0/RC01/</ontology.namespace>
<ontology.namespace>https://admin-shell.io/aas/3/2/</ontology.namespace>
<ontology.namespace.prefix>aas</ontology.namespace.prefix>
</properties>

<dependencies>
<dependency>
<groupId>io.admin-shell.aas</groupId>
<groupId>org.eclipse.aas4j</groupId>
<artifactId>util</artifactId>
<version>${revision}</version>
</dependency>
Expand All @@ -35,7 +35,7 @@
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>io.admin-shell.aas</groupId>
<groupId>org.eclipse.aas4j</groupId>
<artifactId>generator</artifactId>
<version>${revision}</version>
<optional>true</optional>
Expand Down Expand Up @@ -152,7 +152,7 @@
<configuration>
<filesets>
<fileset>
<directory>${basedir}/src/main/java/io/adminshell</directory>
<directory>${basedir}/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model</directory>
<includes>
<include>**/*.java</include>
</includes>
Expand Down Expand Up @@ -262,9 +262,9 @@
<phase>initialize</phase>
<configuration>
<target>
<mkdir dir="${tmp-path}/io/adminshell/aas/v3/model/impl"/>
<mkdir dir="${tmp-path}/io/adminshell/aas/v3/model/builder"/>
<mkdir dir="${tmp-path}/io/adminshell/aas/v3/model/annotations"/>
<mkdir dir="${tmp-path}/org/eclipse/digitaltwin/aas4j/v3/model/impl"/>
<mkdir dir="${tmp-path}/org/eclipse/digitaltwin/aas4j/v3/model/builder"/>
<mkdir dir="${tmp-path}/org/eclipse/digitaltwin/aas4j/v3/model/annotations"/>
</target>
</configuration>
<goals>
Expand Down
14 changes: 7 additions & 7 deletions aas/src/templates/basic-imports.rq
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
template idstt:basic-imports {

#"\nimport de.fraunhofer.iais.eis.util.*;"
"\nimport io.adminshell.aas.v3.model.*;"
"\nimport io.adminshell.aas.v3.model.impl.*;"
#"\nimport io.adminshell.aas.v3.dataformat.json.mixins.*;"
"\nimport io.adminshell.aas.v3.model.builder.*;"
"\nimport io.adminshell.aas.v3.model.annotations.IRI;"
"\nimport io.adminshell.aas.v3.model.annotations.KnownSubtypes;"
"\nimport org.eclipse.digitaltwin.aas4j.v3.model.*;"
"\nimport org.eclipse.digitaltwin.aas4j.v3.model.impl.*;"
#"\nimport org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins.*;"
"\nimport org.eclipse.digitaltwin.aas4j.v3.model.builder.*;"
"\nimport org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI;"
"\nimport org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes;"
#"\nimport de.fraunhofer.iais.eis.*;"
"\n"
"\nimport javax.xml.datatype.XMLGregorianCalendar;"
"\nimport java.util.Date;"
"\nimport java.lang.String;"
"\nimport java.math.BigInteger;"
"\nimport java.net.URL;"
Expand Down
1 change: 1 addition & 0 deletions aas/src/templates/bean-default-methods.rq
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ template idstt:bean-default-methods (?class) {

# method implementation

st:call-template(idstt:get-class-to-string, ?class, false)
st:call-template(idstt:get-class-to-hash-code, ?class, false)
st:call-template(idstt:get-class-equals, ?class, false)
}
Expand Down
9 changes: 7 additions & 2 deletions aas/src/templates/get-license.rq
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
# Copyright (c) 2026 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
# Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,7 +20,9 @@ prefix idstt: <https://w3id.org/idsa/transformationtemplates/>
template idstt:get-license {

"/*"
"Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V."
"Copyright (c) 2026 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V."
"\n"
"Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved."
"\n\n"
"Licensed under the Apache License, Version 2.0 (the \"License\"); "
"you may not use this file except in compliance with the License. "
Expand All @@ -32,6 +35,8 @@ template idstt:get-license {
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. "
"See the License for the specific language governing permissions and "
"limitations under the License."
"\n\n"
"AI-assisted: This file was generated or updated with assistance from AI tools."
" */\n\n"

}
Expand Down
16 changes: 8 additions & 8 deletions aas/src/templates/get-package.rq
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ prefix idstt: <https://w3id.org/idsa/transformationtemplates/>

template idstt:get-package (?type) {
"package "
if(str(?type) = 'interface', "io.adminshell.aas.v3.model",
if(str(?type) = 'bean', "io.adminshell.aas.v3.model.impl",
if(str(?type) = 'mixin', "io.adminshell.aas.v3.dataformat.json.mixins",
if(str(?type) = 'builder', "io.adminshell.aas.v3.model.builder",
if(str(?type) = 'serialization', "io.adminshell.aas.v3.dataformat",
if(str(?type) = 'enum', "io.adminshell.aas.v3.model",
if(str(?type) = 'annotations', "io.adminshell.aas.v3.model.annotations",
"io.adminshell.aas.v3.model" #default
if(str(?type) = 'interface', "org.eclipse.digitaltwin.aas4j.v3.model",
if(str(?type) = 'bean', "org.eclipse.digitaltwin.aas4j.v3.model.impl",
if(str(?type) = 'mixin', "org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins",
if(str(?type) = 'builder', "org.eclipse.digitaltwin.aas4j.v3.model.builder",
if(str(?type) = 'serialization', "org.eclipse.digitaltwin.aas4j.v3.dataformat",
if(str(?type) = 'enum', "org.eclipse.digitaltwin.aas4j.v3.model",
if(str(?type) = 'annotations', "org.eclipse.digitaltwin.aas4j.v3.model.annotations",
"org.eclipse.digitaltwin.aas4j.v3.model" #default
)))))))
";\n"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ template idstt:setter-method-builder-single-item-signature(?property, ?class, ?r
"\n\t* This function allows adding a value to the List "
st:call-template(idstt:to_java_field_name, ?property, ?class)
"\n\t* @param "
st:call-template(idstt:to_java_property_name, ?property)
st:call-template(idstt:to_singular_form, st:call-template(idstt:to_java_property_name, ?property))
" desired value to be added"
"\n\t* @return Builder object with new value for "
st:call-template(idstt:to_java_field_name, ?property, ?class)
Expand All @@ -36,7 +36,7 @@ template idstt:setter-method-builder-single-item-signature(?property, ?class, ?r
"B ",
concat(st:call-template(idstt:to_builder_name, ?class), " ")
)
st:call-template(idstt:to_java_property_name, ?property) "(" IRI(?range) " " st:call-template(idstt:to_java_property_name, ?property) ")"
st:call-template(idstt:to_singular_form, st:call-template(idstt:to_java_property_name, ?property)) "(" IRI(?range) " " st:call-template(idstt:to_singular_form, st:call-template(idstt:to_java_property_name, ?property)) ")"
}
where {
BIND( st:has-extendable-builder() as ?hasExtendable )
Expand Down
15 changes: 4 additions & 11 deletions aas/src/templates/to_java_field_name.rq
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@ prefix idstt: <https://w3id.org/idsa/transformationtemplates/>


template idstt:to_java_field_name(?property, ?class) {
if (?allowsList,
# then
REPLACE(IRI(st:call-template(idstt:to_plural_form, ?propertyFieldName)), "\"", ""),
# else
REPLACE(IRI(?propertyFieldName), "\"", "")
)

}
WHERE {
BIND( st:call-template(idstt:property-allows-list, ?property, ?class) AS ?allowsList)
BIND( st:call-template(idstt:to_java_property_name, ?property) AS ?propertyFieldName)
# Keep the property name in singular form regardless of whether it's a list
# The list type is indicated by the return type (List<T>), not the method name
REPLACE(IRI(st:call-template(idstt:to_java_property_name, ?property)), "\"", "")
}
WHERE {}
32 changes: 32 additions & 0 deletions aas/src/templates/to_singular_form.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

prefix idstt: <https://w3id.org/idsa/transformationtemplates/>


template idstt:to_singular_form(?name) {
if(strends(str(?name), "ies"),
# name ends with "ies", replace with "y", e.g. queries -> query
concat(substr(str(?name), 1, strlen(?name) - 3), "y"),
if(strends(str(?name), "s") && !strends(str(?name), "ss"),
# name ends with "s" but not "ss", remove the "s", e.g. keys -> key, endpoints -> endpoint
substr(str(?name), 1, strlen(?name) - 1),
# default case: return as is (already singular or special case like "class")
str(?name)
)
)
}
WHERE {}
6 changes: 3 additions & 3 deletions common/java/templates/create-util.rq
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ template idstt:create-util {
"import java.net.URI;\n"
"import java.util.ArrayList;\n"
"import java.util.Arrays;\n"
"import java.util.Date;\n"
"import java.util.List;\n"
"import java.util.Map;\n"
"import java.util.stream.Collectors;\n"
"import javax.xml.datatype.XMLGregorianCalendar;\n"
"import de.fraunhofer.iais.eis.util.RdfResource;\n"
"import de.fraunhofer.iais.eis.util.TypedLiteral;\n"

Expand All @@ -46,8 +46,8 @@ template idstt:create-util {
"\n\t\t\treturn ((List<?>) object).stream().map(Util::clone).collect(Collectors.toList());"
"\n\t\t} else if (object instanceof URI) {"
"\n\t\t\treturn URI.create(object.toString());"
"\n\t\t} else if (object instanceof XMLGregorianCalendar) {"
"\n\t\t\treturn ((XMLGregorianCalendar) object).clone();"
"\n\t\t} else if (object instanceof Date) {"
"\n\t\t\treturn new Date(((Date) object).getTime());"
"\n\t\t} else if (object instanceof byte[]) {"
"\n\t\t\treturn ((byte[]) object).clone();"
"\n\t\t} else if (object instanceof Byte[]) {"
Expand Down
45 changes: 45 additions & 0 deletions common/java/templates/get-class-to-string-body-properties.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

prefix idstt: <https://w3id.org/idsa/transformationtemplates/>

template idstt:get-class-to-string-body-properties(?class) {

group {
format {
"%s='\" + %s + \"',"
?field ?field
}
; separator = "\"\n\t\t\t+ \""
}

}
WHERE {
?class rdfs:subClassOf* ?superClass .
OPTIONAL {
{
?property rdfs:domain ?superClass ;
rdfs:range ?range .
BIND(st:call-template(idstt:to_java_field_name, ?property, ?superClass) as ?field )
}
UNION
{
?property rdfs:domain/owl:unionOf/rdf:rest*/rdf:first ?superClass ;
rdfs:range ?range .
BIND(st:call-template(idstt:to_java_field_name, ?property, ?superClass) as ?field )
}
}
}
36 changes: 36 additions & 0 deletions common/java/templates/get-class-to-string-body.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

prefix idstt: <https://w3id.org/idsa/transformationtemplates/>

template idstt:get-class-to-string-body(?class) {

"{"
"\n\t\treturn \"" st:call-template(idstt:to_bean_name, ?class) "{\""
if (bound(?hasProperties) && strlen(?hasProperties) > 1,
concat(
"\n\t\t\t+ \"",
st:call-template(idstt:get-class-to-string-body-properties, ?class),
"\""
),
""
)
"\n\t\t\t+ \"}\";"
"\n\t}"
}
WHERE {
BIND(st:call-template(idstt:list-class-properties, ?class) AS ?hasProperties)
}
31 changes: 31 additions & 0 deletions common/java/templates/get-class-to-string.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

prefix idstt: <https://w3id.org/idsa/transformationtemplates/>

template idstt:get-class-to-string(?class, ?forInterface) {

"\n\t@Override"
"\n\tpublic String toString()"
if (?forInterface,
# no body for interface
";",
# with body for bean
st:call-template(idstt:get-class-to-string-body, ?class)
)
"\n"
}
WHERE {}
7 changes: 7 additions & 0 deletions common/java/templates/properties-to-bean-methods.rq
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ template idstt:properties-to-bean-methods(?class, ?superClass) {
# method body
st:call-template(idstt:setter-method-body, ?property, ?superClass)

# Add single-element setter for list properties
if(?isArray,
st:call-template(idstt:setter-method-bean-list-single-element, ?property, ?class),
""
)

}
where {
{?property rdfs:domain ?superClass.}
UNION
{?property rdfs:domain/owl:unionOf/rdf:rest*/rdf:first ?superClass.}
BIND( st:call-template(idstt:property-allows-list, ?property, ?class) as ?isArray )
}
Loading