getting more data to create kbo organisation
This commit is contained in:
@@ -3,7 +3,7 @@ import { querySudo as query, updateSudo as update } from '@lblod/mu-auth-sudo';
|
||||
|
||||
export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
const queryStr = `
|
||||
SELECT DISTINCT ?kbo ?ovo ?kboStructuredId ?ovoStructuredId WHERE {
|
||||
SELECT DISTINCT ?kbo ?ovo ?kboStructuredId ?ovoStructuredId ?bestuurseenheid ?kboOrganisation WHERE {
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
<http://mu.semte.ch/graphs/worship-service>
|
||||
@@ -16,7 +16,7 @@ export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
?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 .
|
||||
?bestuurseenheid <http://www.w3.org/ns/adms#identifier> ?kboId .
|
||||
|
||||
FILTER (?kboNotation IN ("KBO nummer"@nl, "KBO nummer"))
|
||||
|
||||
@@ -27,6 +27,8 @@ export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
<http://www.w3.org/2004/02/skos/core#notation> ?ovoNotation .
|
||||
|
||||
OPTIONAL { ?ovoStructuredId <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?ovo . }
|
||||
|
||||
?bestuurseenheid owl:sameAs ?kboOrganisation .
|
||||
|
||||
FILTER (?ovoNotation IN ("OVO-nummer"@nl, "OVO-nummer"))
|
||||
}
|
||||
@@ -43,6 +45,8 @@ export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
kboStructuredId: binding.kboStructuredId.value,
|
||||
ovo: binding.ovo?.value,
|
||||
ovoStructuredId: binding.ovoStructuredId?.value,
|
||||
adminUnit: binding.bestuurseenheid.value,
|
||||
kboUnit: binding.kboOrganisation?.value
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -131,7 +135,7 @@ export async function updateOvoNumberAndUri(ovoStructuredIdUri, wegwijsOvo) {
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
await update(updateStr);
|
||||
}
|
||||
|
||||
@@ -183,4 +187,69 @@ export async function getAllOvoAndKboCouples() {
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function createRechtsVormStructure(){
|
||||
|
||||
}
|
||||
|
||||
export async function createNewKboOrg(kboOrg ,kboNummer){
|
||||
const newKboOrgIdUuId = uuid();
|
||||
const newKboIdUri = `http://data.lblod.info/id/kboBestuurseenheden/${newKboOrgIdUuId}`;
|
||||
|
||||
const contactPointUuidId = uuid();
|
||||
const contactPointUri = `http://data.lblod.info/id/contact-punten/${contactPointUuidId}`;
|
||||
|
||||
|
||||
|
||||
let updateStr = `
|
||||
INSERT {
|
||||
GRAPH ?g {
|
||||
|
||||
${sparqlEscapeUri(contactPointUri)} a <http://schema.org/ContactPoint> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(contactPointUuidId)} ;
|
||||
<http://schema.org/email> ${sparqlEscapeString(kboOrg.email)} ;
|
||||
<http://schema.org/telephone> ${sparqlEscapeString(kboOrg.phone)} ;
|
||||
<http://xmlns.com/foaf/0.1/page> ${sparqlEscapeString(kboOrg.website)}.
|
||||
|
||||
|
||||
|
||||
${sparqlEscapeUri(newKboIdUri)} a <http://mu.semte.ch/vocabularies/ext/KboEenheid> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(newKboOrgIdUuId)} ;
|
||||
<http://mu.semte.ch/vocabularies/ext/rechtsvorm> ${sparqlEscapeString(kboOrg.rechtsvorm)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#prefLabel> ${sparqlEscapeString(kboOrg.organisationName)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#altLabel> ${sparqlEscapeString(kboOrg.formalName)} ;
|
||||
<https://data.lblod.info/vocabularies/generiek/geplandeEindDatum> ${sparqlEscapeString(kboOrg.changeTime)} ;
|
||||
<http://schema.org/contactPoint> ${sparqlEscapeUri(contactPointUri)} .
|
||||
}
|
||||
}WHERE{
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
await update(updateStr);
|
||||
return newKboIdUri;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export async function linkAbbOrgToKboOrg(abbOrgUri ,kboOrgUri){
|
||||
let updateStr = `
|
||||
INSERT {
|
||||
GRAPH ?g {
|
||||
${sparqlEscapeUri(kboOrgUri)} <http://www.w3.org/2002/07/owl#sameAs> ${sparqlEscapeUri(abbOrgUri)} .
|
||||
}
|
||||
}WHERE {
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
await update(updateStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Update queries: via mu-auth if it comes from the frontend ?
|
||||
|
||||
Reference in New Issue
Block a user