Skip to content
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

Work on checkSemanticId() #136

Merged
merged 7 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
39 changes: 35 additions & 4 deletions aas-web-ui/src/mixins/SubmodelElementHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,22 @@ export default defineComponent({
return false;

for (const key of submodelElement.semanticId.keys) {
if (key.value.startsWith('0173-1#')) {
if (key.value.startsWith('0112/')) {
// IEC CDD like 0112/2///61987#ABN590#002
// console.log('key.value', '0112/...');
// console.log('key.value', key.value);
if (new RegExp(/[#-]{1}\d{3}$/).test(semanticId)) {
// IEC CDD with version; like 0112/2///61987#ABN590#002
if (key.value === semanticId) {
return true;
}
} else {
// IEC CDD without version; like 0112/2///61987#ABN590
if (key.value.startsWith(semanticId)) {
return true;
}
}
} else if (key.value.startsWith('0173-1#')) {
// Eclass IRDI like 0173-1#01-AHF578#001
// console.log('key.value', '0173-1#...');
// console.log('key.value', key.value);
Expand All @@ -154,6 +169,7 @@ export default defineComponent({
// );
if (new RegExp(/\*\d{2}$/).test(key.value)) {
key.value = key.value.slice(0, -3);
semanticId = semanticId.slice(0, -3);
}
if (new RegExp(/[#-]{1}\d{3}$/).test(semanticId)) {
// Eclass IRDI with version; like 0173-1#01-AHF578#001
Expand Down Expand Up @@ -282,11 +298,19 @@ export default defineComponent({
}
}
} else if (key.value.startsWith('http://') || key.value.startsWith('https://')) {
// e.g. IDTA IRI like
if (new RegExp(/\/\d\/\d\/{1}/).test(semanticId)) {
// IRI like https://admin-shell.io/idta/CarbonFootprint/ProductCarbonFootprint/0/9/
// console.log('key.value', 'http...');
// console.log('key.value', key.value);
if (key.value.endsWith('/')) key.value = key.value.substring(0, key.value.length - 1);
if (semanticId.endsWith('/')) semanticId = semanticId.substring(0, semanticId.length - 1);
if (new RegExp(/\/\d{1,}\/\d{1,}$/).test(semanticId)) {
// IRI with version like https://admin-shell.io/idta/CarbonFootprint/ProductCarbonFootprint/0/9/
// console.log('semanticId --> with version', semanticId);
if (key.value === semanticId) return true;
} else {
if (semanticId.startsWith(key.value)) return true;
// IRI without version like https://admin-shell.io/idta/CarbonFootprint/ProductCarbonFootprint/
// console.log('semanticId --> without version', semanticId);
if (key.value.startsWith(semanticId)) return true;
}
} else {
if (key.value === semanticId) return true;
Expand Down Expand Up @@ -672,6 +696,13 @@ export default defineComponent({
.replace(/-1-(\d{2})-/, '/1///$1#')
.replace(/-(\d{3})$/, '#$1') // https://api.eclass-cdp.com/0173-1-01-AHF578-001 --> 0173/1///01#AHF578#001
);
} else if (semanticId.startsWith('http://') || semanticId.startsWith('https://')) {
// e.g. IRI
if (semanticId.endsWith('/')) {
semanticIdsToFetch.push(semanticId.substring(0, semanticId.length - 1));
} else {
semanticIdsToFetch.push(semanticId + '/');
}
}
});

Expand Down
Loading
Loading