-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathallowedqualifiers.mjs
More file actions
31 lines (29 loc) · 842 Bytes
/
Copy pathallowedqualifiers.mjs
File metadata and controls
31 lines (29 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import exception from "./exception.mjs";
function check(statement, entity, p, constraintData) {
return new Promise((resolve, reject) => {
if (!exception.check(entity, constraintData) && "qualifiers" in statement) {
let allowedQualifiers = [];
if ("P2306" in constraintData) {
for (let statement of constraintData["P2306"]) {
if ("datavalue" in statement) {
allowedQualifiers.push(statement.datavalue.value.id);
}
}
}
let qualifiers = Object.keys(statement.qualifiers);
let res = !qualifiers.every(val => allowedQualifiers.includes(val));
resolve({
constraint: "Q21510851",
answer: res,
});
} else {
resolve({
constraint: "Q21510851",
answer: false,
});
}
});
}
export default {
check,
};