updating/cron job fixed
This commit is contained in:
352
lib/queries.js
352
lib/queries.js
@@ -1,5 +1,5 @@
|
||||
import { uuid, sparqlEscapeUri, sparqlEscapeString } from "mu";
|
||||
import { querySudo as query, updateSudo as update } from '@lblod/mu-auth-sudo';
|
||||
import { querySudo as query, updateSudo as update } from "@lblod/mu-auth-sudo";
|
||||
|
||||
export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
const queryStr = `
|
||||
@@ -10,7 +10,9 @@ export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
}
|
||||
GRAPH ?g {
|
||||
?kboStructuredId a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(kboStructuredIdUuid)} ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(
|
||||
kboStructuredIdUuid
|
||||
)} ;
|
||||
<https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?kbo .
|
||||
|
||||
?kboId <https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ?kboStructuredId ;
|
||||
@@ -46,13 +48,13 @@ export async function getIdentifiers(kboStructuredIdUuid) {
|
||||
ovoStructuredId: binding.ovoStructuredId?.value,
|
||||
kboId: binding.kboId?.value,
|
||||
adminUnit: binding.bestuurseenheid.value,
|
||||
kboUnit: binding.kboOrganisation?.value
|
||||
}
|
||||
kboUnit: binding.kboOrganisation?.value,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function getKboIdentifiers(administrativeUnit, changeTime) {
|
||||
export async function getKboIdentifiers(administrativeUnit) {
|
||||
const queryStr = `
|
||||
SELECT DISTINCT ?kboUnit ?abbUnit ?changeTime ?contactPointUri ?addressUri WHERE {
|
||||
VALUES ?g {
|
||||
@@ -67,7 +69,7 @@ export async function getKboIdentifiers(administrativeUnit, changeTime) {
|
||||
|
||||
?contactPointUri <http://www.w3.org/ns/locn#address> ?addressUri .
|
||||
|
||||
?kboUnit owl:sameAs ?abbUnit
|
||||
?kboUnit <http://www.w3.org/2002/07/owl#sameAs> ?abbUnit
|
||||
|
||||
FILTER(?abbUnit = ${sparqlEscapeUri(administrativeUnit)})
|
||||
}
|
||||
@@ -84,29 +86,39 @@ export async function getKboIdentifiers(administrativeUnit, changeTime) {
|
||||
changeTime: binding.changeTime?.value,
|
||||
contactPointUri: binding.contactPointUri?.value,
|
||||
addressUri: binding.addressUri?.value,
|
||||
}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function constructOvoStructure(kboStructuredId) {
|
||||
const idUuid = uuid();
|
||||
const idUri = `http://data.lblod.info/id/identificatoren/${idUuid}`
|
||||
const idUri = `http://data.lblod.info/id/identificatoren/${idUuid}`;
|
||||
const structuredIdUuid = uuid();
|
||||
const structuredIdUri = `http://data.lblod.info/id/gestructureerdeIdentificatoren/${structuredIdUuid}`
|
||||
const structuredIdUri = `http://data.lblod.info/id/gestructureerdeIdentificatoren/${structuredIdUuid}`;
|
||||
|
||||
const updateStr = `
|
||||
INSERT {
|
||||
GRAPH ?g {
|
||||
?bestuurseenheid <http://www.w3.org/ns/adms#identifier> ${sparqlEscapeUri(idUri)} .
|
||||
?bestuurseenheid <http://www.w3.org/ns/adms#identifier> ${sparqlEscapeUri(
|
||||
idUri
|
||||
)} .
|
||||
|
||||
${sparqlEscapeUri(idUri)} a <http://www.w3.org/ns/adms#Identifier> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(idUuid)} ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(
|
||||
idUuid
|
||||
)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#notation> "OVO-nummer" ;
|
||||
<https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ${sparqlEscapeUri(structuredIdUri)} .
|
||||
<https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ${sparqlEscapeUri(
|
||||
structuredIdUri
|
||||
)} .
|
||||
|
||||
${sparqlEscapeUri(structuredIdUri)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(structuredIdUuid)} .
|
||||
${sparqlEscapeUri(
|
||||
structuredIdUri
|
||||
)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(
|
||||
structuredIdUuid
|
||||
)} .
|
||||
}
|
||||
} WHERE {
|
||||
VALUES ?g {
|
||||
@@ -114,10 +126,14 @@ export async function constructOvoStructure(kboStructuredId) {
|
||||
<http://mu.semte.ch/graphs/worship-service>
|
||||
}
|
||||
GRAPH ?g {
|
||||
${sparqlEscapeUri(kboStructuredId)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
${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> ${sparqlEscapeUri(
|
||||
kboStructuredId
|
||||
)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#notation> ?notation .
|
||||
|
||||
?bestuurseenheid <http://www.w3.org/ns/adms#identifier> ?kboId .
|
||||
@@ -136,7 +152,9 @@ export async function updateOvoNumberAndUri(ovoStructuredIdUri, wegwijsOvo) {
|
||||
DELETE {
|
||||
GRAPH ?g {
|
||||
?bestuureseenheid <http://www.w3.org/2002/07/owl#sameAs> ?ovoUri .
|
||||
${sparqlEscapeUri(ovoStructuredIdUri)} <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?ovo .
|
||||
${sparqlEscapeUri(
|
||||
ovoStructuredIdUri
|
||||
)} <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?ovo .
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -145,8 +163,14 @@ export async function updateOvoNumberAndUri(ovoStructuredIdUri, wegwijsOvo) {
|
||||
updateStr += `
|
||||
INSERT {
|
||||
GRAPH ?g {
|
||||
?bestuureseenheid <http://www.w3.org/2002/07/owl#sameAs> ${sparqlEscapeUri(`http://data.vlaanderen.be/id/organisatie/${wegwijsOvo}`)} .
|
||||
${sparqlEscapeUri(ovoStructuredIdUri)} <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ${sparqlEscapeString(wegwijsOvo)} .
|
||||
?bestuureseenheid <http://www.w3.org/2002/07/owl#sameAs> ${sparqlEscapeUri(
|
||||
`http://data.vlaanderen.be/id/organisatie/${wegwijsOvo}`
|
||||
)} .
|
||||
${sparqlEscapeUri(
|
||||
ovoStructuredIdUri
|
||||
)} <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ${sparqlEscapeString(
|
||||
wegwijsOvo
|
||||
)} .
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -160,19 +184,25 @@ export async function updateOvoNumberAndUri(ovoStructuredIdUri, wegwijsOvo) {
|
||||
}
|
||||
GRAPH ?g {
|
||||
|
||||
${sparqlEscapeUri(ovoStructuredIdUri)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> .
|
||||
${sparqlEscapeUri(
|
||||
ovoStructuredIdUri
|
||||
)} a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> .
|
||||
|
||||
OPTIONAL {
|
||||
?bestuureseenheid
|
||||
<http://www.w3.org/ns/adms#identifier>/<https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ${sparqlEscapeUri(ovoStructuredIdUri)} ;
|
||||
<http://www.w3.org/ns/adms#identifier>/<https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ${sparqlEscapeUri(
|
||||
ovoStructuredIdUri
|
||||
)} ;
|
||||
<http://www.w3.org/2002/07/owl#sameAs> ?ovoUri .
|
||||
}
|
||||
|
||||
OPTIONAL { ${sparqlEscapeUri(ovoStructuredIdUri)} <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?ovo . }
|
||||
OPTIONAL { ${sparqlEscapeUri(
|
||||
ovoStructuredIdUri
|
||||
)} <https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?ovo . }
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
await update(updateStr);
|
||||
}
|
||||
|
||||
@@ -212,19 +242,60 @@ export async function getAllOvoAndKboCouples() {
|
||||
|
||||
if (result.results.bindings.length) {
|
||||
const bindings = result.results.bindings;
|
||||
return bindings.map(binding => {
|
||||
return bindings.map((binding) => {
|
||||
return {
|
||||
kbo: binding.kbo.value,
|
||||
kboStructuredId: binding.kboStructuredId.value,
|
||||
ovo: binding.ovo?.value,
|
||||
ovoStructuredId: binding.ovoStructuredId?.value,
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function createNewKboOrg(kboOrg, kboId, isUpdate, oldKbo){
|
||||
export async function getAllAbbKboOrganizations(){
|
||||
let queryStr = `
|
||||
SELECT ?kbo ?abbOrg ?kboOrg ?changeTime ?kboId where {
|
||||
GRAPH ?g {
|
||||
?kboId <https://data.vlaanderen.be/ns/generiek#gestructureerdeIdentificator> ?kboStructuredId ;
|
||||
<http://www.w3.org/2004/02/skos/core#notation> ?kboNotation .
|
||||
|
||||
?kboStructuredId a <https://data.vlaanderen.be/ns/generiek#GestructureerdeIdentificator> ;
|
||||
<https://data.vlaanderen.be/ns/generiek#lokaleIdentificator> ?kbo .
|
||||
|
||||
?abbOrg <http://www.w3.org/ns/adms#identifier> ?kboId .
|
||||
|
||||
FILTER (?kboNotation IN ("KBO nummer"@nl, "KBO nummer"))
|
||||
|
||||
OPTIONAL{
|
||||
?kboOrg owl:sameAs ?abbOrg .
|
||||
?kboOrg <https://data.lblod.info/vocabularies/generiek/geplandeEindDatum> ?changeTime .
|
||||
}
|
||||
}
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
}
|
||||
`
|
||||
const result = await query(queryStr);
|
||||
|
||||
if (result.results.bindings.length) {
|
||||
const bindings = result.results.bindings;
|
||||
return bindings.map((binding) => {
|
||||
return {
|
||||
kbo: binding.kbo.value,
|
||||
abbOrg: binding.abbOrg.value,
|
||||
kboOrg: binding.kboOrg?.value,
|
||||
kboId: binding.kboId?.value,
|
||||
changeTime: binding.changeTime?.value,
|
||||
};
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function createNewKboOrg(kboOrg, kboId) {
|
||||
const newKboOrgIdUuId = uuid();
|
||||
const newKboIdUri = `http://data.lblod.info/id/kboBestuurseenheden/${newKboOrgIdUuId}`;
|
||||
|
||||
@@ -234,69 +305,238 @@ export async function createNewKboOrg(kboOrg, kboId, isUpdate, oldKbo){
|
||||
const adressUuidId = uuid();
|
||||
const adressUri = `http://data.lblod.info/id/adressen/${adressUuidId}`;
|
||||
|
||||
let updateStr = "";
|
||||
|
||||
|
||||
updateStr += `
|
||||
console.log("creating:" + kboOrg);
|
||||
console.log("with:" + kboId);
|
||||
|
||||
let updateStr = `
|
||||
INSERT {
|
||||
GRAPH ?g {
|
||||
${sparqlEscapeUri(adressUri)} a <http://www.w3.org/ns/locn#Address> ;
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(adressUuidId)} ;
|
||||
<http://www.w3.org/ns/locn#fullAddress> ${sparqlEscapeString(kboOrg.formattedAddress)} .
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(
|
||||
adressUuidId
|
||||
)} ;
|
||||
<http://www.w3.org/ns/locn#fullAddress> ${sparqlEscapeString(
|
||||
kboOrg.formattedAddress
|
||||
)} .
|
||||
|
||||
${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://schema.org/contactType> ${sparqlEscapeString("Kbocontact")} ;
|
||||
<http://xmlns.com/foaf/0.1/page> ${sparqlEscapeString(kboOrg.website)} ;
|
||||
<http://www.w3.org/ns/locn#address> ${sparqlEscapeUri(adressUri)}.
|
||||
<http://mu.semte.ch/vocabularies/core/uuid> ${sparqlEscapeString(
|
||||
contactPointUuidId
|
||||
)} ;
|
||||
<http://schema.org/email> ${sparqlEscapeString(
|
||||
kboOrg.email
|
||||
)} ;
|
||||
<http://schema.org/telephone> ${sparqlEscapeString(
|
||||
kboOrg.phone
|
||||
)} ;
|
||||
<http://schema.org/contactType> ${sparqlEscapeString(
|
||||
"Kbocontact"
|
||||
)} ;
|
||||
<http://xmlns.com/foaf/0.1/page> ${sparqlEscapeString(
|
||||
kboOrg.website
|
||||
)} ;
|
||||
<http://www.w3.org/ns/locn#address> ${sparqlEscapeUri(
|
||||
adressUri
|
||||
)}.
|
||||
|
||||
|
||||
|
||||
${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://mu.semte.ch/vocabularies/ext/shortName> ${sparqlEscapeString(kboOrg.shortName)} ;
|
||||
<http://mu.semte.ch/vocabularies/ext/startDate> ${sparqlEscapeString(kboOrg.startDate)} ;
|
||||
<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://www.w3.org/ns/adms#identifier> ${sparqlEscapeUri(kboId)} ;
|
||||
<http://www.w3.org/ns/regorg#orgStatus> ${sparqlEscapeUri(kboOrg.activeState)} ;
|
||||
<http://schema.org/contactPoint> ${sparqlEscapeUri(contactPointUri)} .
|
||||
${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://mu.semte.ch/vocabularies/ext/shortName> ${sparqlEscapeString(
|
||||
kboOrg.shortName
|
||||
)} ;
|
||||
<http://mu.semte.ch/vocabularies/ext/startDate> ${sparqlEscapeString(
|
||||
kboOrg.startDate
|
||||
)} ;
|
||||
<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://www.w3.org/ns/adms#identifier> ${sparqlEscapeUri(
|
||||
kboId
|
||||
)} ;
|
||||
<http://www.w3.org/ns/regorg#orgStatus> ${sparqlEscapeUri(
|
||||
kboOrg.activeState
|
||||
)} ;
|
||||
<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){
|
||||
export async function updateKboOrg(newKboInfo, identifiers) {
|
||||
//update Adress
|
||||
let updateStr = `
|
||||
DELETE{
|
||||
GRAPH ?g{
|
||||
?adressUri a <http://www.w3.org/ns/locn#Address> ;
|
||||
<http://www.w3.org/ns/locn#fullAddress> ?fulladdress .
|
||||
}
|
||||
}
|
||||
INSERT{
|
||||
graph ?g{
|
||||
?adressUri a <http://www.w3.org/ns/locn#Address> ;
|
||||
<http://www.w3.org/ns/locn#fullAddress> ${sparqlEscapeString(newKboInfo.formattedAddress)} .
|
||||
}
|
||||
}
|
||||
WHERE{
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
GRAPH ?g {
|
||||
?adressUri a <http://www.w3.org/ns/locn#Address> ;
|
||||
<http://www.w3.org/ns/locn#fullAddress> ?fulladdress .
|
||||
|
||||
FILTER(?adressUri = ${sparqlEscapeUri(identifiers.addressUri)})
|
||||
}
|
||||
}
|
||||
`;
|
||||
await update(updateStr);
|
||||
|
||||
//update ContactPoint
|
||||
updateStr = `
|
||||
DELETE{
|
||||
GRAPH ?g{
|
||||
?contact a <http://schema.org/ContactPoint> ;
|
||||
<http://schema.org/email> ?email ;
|
||||
<http://schema.org/telephone> ?phone ;
|
||||
<http://xmlns.com/foaf/0.1/page> ?website .
|
||||
}
|
||||
}
|
||||
INSERT{
|
||||
graph ?g{
|
||||
?contact a <http://schema.org/ContactPoint> ;
|
||||
<http://schema.org/email> ${sparqlEscapeString(
|
||||
newKboInfo.email
|
||||
)} ;
|
||||
<http://schema.org/telephone> ${sparqlEscapeString(
|
||||
newKboInfo.phone
|
||||
)} ;
|
||||
<http://xmlns.com/foaf/0.1/page> ${sparqlEscapeString(
|
||||
newKboInfo.website
|
||||
)} .
|
||||
}
|
||||
}
|
||||
WHERE{
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
GRAPH ?g {
|
||||
?contact a <http://schema.org/ContactPoint> ;
|
||||
<http://schema.org/email> ?email ;
|
||||
<http://schema.org/telephone> ?phone ;
|
||||
<http://xmlns.com/foaf/0.1/page> ?website .
|
||||
|
||||
FILTER(?contact = ${sparqlEscapeUri(identifiers.contactPointUri)})
|
||||
}
|
||||
}
|
||||
`;
|
||||
await update(updateStr);
|
||||
|
||||
//update kboUnit
|
||||
updateStr = `
|
||||
DELETE{
|
||||
GRAPH ?g{
|
||||
?kboUnit a <http://mu.semte.ch/vocabularies/ext/KboEenheid> ;
|
||||
<http://mu.semte.ch/vocabularies/ext/rechtsvorm> ?rechtsVorm ;
|
||||
<http://mu.semte.ch/vocabularies/ext/shortName> ?shortName ;
|
||||
<http://mu.semte.ch/vocabularies/ext/startDate> ?startDate ;
|
||||
<http://www.w3.org/2004/02/skos/core#prefLabel> ?orgName ;
|
||||
<http://www.w3.org/2004/02/skos/core#altLabel> ?commercialName ;
|
||||
<https://data.lblod.info/vocabularies/generiek/geplandeEindDatum> ?changeTime ;
|
||||
<http://www.w3.org/ns/regorg#orgStatus> ?activeState .
|
||||
}
|
||||
}INSERT{
|
||||
graph ?g{
|
||||
?kboUnit a <http://mu.semte.ch/vocabularies/ext/KboEenheid> ;
|
||||
<http://mu.semte.ch/vocabularies/ext/rechtsvorm> ${sparqlEscapeString(
|
||||
newKboInfo.rechtsvorm
|
||||
)} ;
|
||||
<http://mu.semte.ch/vocabularies/ext/shortName> ${sparqlEscapeString(
|
||||
newKboInfo.shortName
|
||||
)} ;
|
||||
<http://mu.semte.ch/vocabularies/ext/startDate> ${sparqlEscapeString(
|
||||
newKboInfo.startDate
|
||||
)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#prefLabel> ${sparqlEscapeString(
|
||||
newKboInfo.organisationName
|
||||
)} ;
|
||||
<http://www.w3.org/2004/02/skos/core#altLabel> ${sparqlEscapeString(
|
||||
newKboInfo.formalName
|
||||
)} ;
|
||||
<https://data.lblod.info/vocabularies/generiek/geplandeEindDatum> ${sparqlEscapeString(
|
||||
newKboInfo.changeTime
|
||||
)} ;
|
||||
<http://www.w3.org/ns/regorg#orgStatus> ${sparqlEscapeUri(
|
||||
newKboInfo.activeState
|
||||
)} .
|
||||
}
|
||||
}
|
||||
WHERE{
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
GRAPH ?g {
|
||||
?kboUnit a <http://mu.semte.ch/vocabularies/ext/KboEenheid> ;
|
||||
<http://mu.semte.ch/vocabularies/ext/rechtsvorm> ?rechtsVorm ;
|
||||
<http://mu.semte.ch/vocabularies/ext/shortName> ?shortName ;
|
||||
<http://mu.semte.ch/vocabularies/ext/startDate> ?startDate ;
|
||||
<http://www.w3.org/2004/02/skos/core#prefLabel> ?orgName ;
|
||||
<http://www.w3.org/2004/02/skos/core#altLabel> ?commercialName ;
|
||||
<https://data.lblod.info/vocabularies/generiek/geplandeEindDatum> ?changeTime ;
|
||||
<http://www.w3.org/ns/regorg#orgStatus> ?activeState .
|
||||
|
||||
FILTER(?kboUnit = ${sparqlEscapeUri(identifiers.kboUnit)})
|
||||
}
|
||||
}
|
||||
`;
|
||||
await update(updateStr);
|
||||
}
|
||||
|
||||
export async function linkAbbOrgToKboOrg(abbOrgUri, kboOrgUri) {
|
||||
let updateStr = `
|
||||
INSERT {
|
||||
GRAPH ?g {
|
||||
${sparqlEscapeUri(kboOrgUri)} <http://www.w3.org/2002/07/owl#sameAs> ${sparqlEscapeUri(abbOrgUri)} .
|
||||
${sparqlEscapeUri(
|
||||
kboOrgUri
|
||||
)} <http://www.w3.org/2002/07/owl#sameAs> ${sparqlEscapeUri(abbOrgUri)} .
|
||||
}
|
||||
}WHERE {
|
||||
VALUES ?g {
|
||||
<http://mu.semte.ch/graphs/administrative-unit>
|
||||
}
|
||||
|
||||
${sparqlEscapeUri(kboOrgUri)} a <http://mu.semte.ch/vocabularies/ext/KboEenheid> .
|
||||
${sparqlEscapeUri(
|
||||
kboOrgUri
|
||||
)} a <http://mu.semte.ch/vocabularies/ext/KboEenheid> .
|
||||
|
||||
}
|
||||
`
|
||||
`;
|
||||
|
||||
await update(updateStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Update queries: via mu-auth if it comes from the frontend ?
|
||||
|
||||
Reference in New Issue
Block a user