Use endpoint instead of deltas for live updates
This commit is contained in:
@@ -1,41 +1,19 @@
|
||||
import { uuid, sparqlEscapeUri, sparqlEscapeString } from "mu";
|
||||
import { querySudo as query, updateSudo as update } from '@lblod/mu-auth-sudo';
|
||||
|
||||
export async function isKbo(subject) {
|
||||
export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
const queryStr = `
|
||||
ASK {
|
||||
SELECT DISTINCT ?kbo ?ovo ?kboStructuredId ?ovoStructuredId WHERE {
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
<http://mu.semte.ch/graphs/worship-service>
|
||||
}
|
||||
GRAPH ?g {
|
||||
${sparqlEscapeUri(subject)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
?kboStructuredId a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(kboStructuredIdUuid)} ;
|
||||
<https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?kbo .
|
||||
|
||||
?id <https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ${sparqlEscapeUri(subject)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#notation> ?notation .
|
||||
|
||||
FILTER (?notation IN ("KBO nummer"@nl, "KBO nummer"))
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const result = await query(queryStr);
|
||||
return result.boolean;
|
||||
}
|
||||
|
||||
export async function getIdentifiers(kboStructuredId) {
|
||||
const queryStr = `
|
||||
SELECT DISTINCT ?kbo ?ovo ?ovoStructuredId WHERE {
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
<http://mu.semte.ch/graphs/worship-service>
|
||||
}
|
||||
GRAPH ?g {
|
||||
${sparqlEscapeUri(kboStructuredId)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
<https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?kbo .
|
||||
|
||||
?kboId <https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ${sparqlEscapeUri(kboStructuredId)} ;
|
||||
?kboId <https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ?kboStructuredId ;
|
||||
<http://www.w3.org/2004/02/skos/core#notation> ?kboNotation .
|
||||
|
||||
?bestuurseeheid <http://www.w3.org/ns/adms#identifier> ?kboId .
|
||||
@@ -62,6 +40,7 @@ export async function getIdentifiers(kboStructuredId) {
|
||||
const binding = result.results.bindings[0]; // We should only have one KBO/OVO couple
|
||||
return {
|
||||
kbo: binding.kbo.value,
|
||||
kboStructuredId: binding.kboStructuredId.value,
|
||||
ovo: binding.ovo?.value,
|
||||
ovoStructuredId: binding.ovoStructuredId?.value,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user