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

Check of semanticId #260

Merged
merged 4 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Usage of "for...of loop" (instead Array.prototype.forEach()) to break…
… out of the loop
  • Loading branch information
seicke committed Aug 29, 2024
commit 3810cc7f664da42e183fca53355fad7006753328
Original file line number Diff line number Diff line change
@@ -109,32 +109,31 @@ export default defineComponent({
|| !submodelElement.semanticId.keys
|| submodelElement.semanticId.keys.length == 0) return false;

let result = false;
submodelElement.semanticId.keys.forEach((key: any) => {
for (const key of submodelElement.semanticId.keys) {

if (key.value.startsWith('http://') || 'https://') {
// e.g. IDTA IRI like
if (new RegExp('\/\d\/\d\/{0,1}' + '$').test(semanticId)) {
if (key.value === semanticId) result = true;
if (key.value === semanticId) return true;
} else {
if (key.value.startsWith(semanticId)) result = true;
if (key.value.startsWith(semanticId)) return true;
}
} else if (key.value.startsWith('0173-1')) {
// ECLASS IRDI like 0173-1#01-AHF578#001 resp. 0173-1-01-AHF578-001
if (new RegExp('[#-]{1}\d{3}$').test(semanticId)) {
// ECLASS IRDI with version (like 0173-1#01-AHF578#001 resp. 0173-1-01-AHF578-001)
if (key.value === semanticId) result = true;
if (key.value === semanticId) return true;
} else {
// ECLASS IRDI without version (like 0173-1#01-AHF578 resp. 0173-1-01-AHF578)
if (key.value.startsWith(semanticId)) result = true;
if (key.value.startsWith(semanticId)) return true;
}
} else {
if (key.value === semanticId) result = true;
if (key.value === semanticId) return true;
}


});
return result;
}
return false;
},

// Function to check if the valueType is a number