diff --git a/src/sparql/catalog.ts b/src/sparql/catalog.ts index 1eb219e252c1a7a95b59b46528bef32531e59262..7ecb484082ce09a849fbeea2b14b6f394bfdff0b 100644 --- a/src/sparql/catalog.ts +++ b/src/sparql/catalog.ts @@ -246,7 +246,7 @@ export async function updateCatalog(catalog: OcCatalog, profile: OcPerson, auth? OPTIONAL { <${catalog['@id']}> dct:temporal ?temporal. ?temporal ?p2 ?o2. - filter isblank(?temporal) + FILTER isblank(?temporal) } <${catalog['@id']}> ?p ?o. }; @@ -388,8 +388,8 @@ export async function getCatalog(identifier: string, auth?: Credentials): Promis } WHERE { <${catalogUri}> dct:creator ?creator. + VALUES ?p1 { rdf:type foaf:familyName foaf:name foaf:givenName foaf:firstName foaf:lastName foaf:mbox } ?creator ?p1 ?o1. - FILTER (?p1 IN (rdf:type, foaf:familyName, foaf:name, foaf:givenName, foaf:firstName, foaf:lastName, foaf:mbox)) } `, { @@ -407,8 +407,8 @@ export async function getCatalog(identifier: string, auth?: Credentials): Promis } WHERE { <${catalogUri}> dcat:contactPoint ?contactPoint. + VALUES ?p1 { rdf:type foaf:familyName foaf:name foaf:givenName foaf:firstName foaf:lastName foaf:mbox } ?contactPoint ?p1 ?o1. - FILTER (?p1 IN (rdf:type, foaf:familyName, foaf:name, foaf:givenName, foaf:firstName, foaf:lastName, foaf:mbox)) } `, { @@ -551,6 +551,26 @@ export async function getCatalog(identifier: string, auth?: Credentials): Promis } ) + /** + * Publisher + */ + const catalogPublisherPromise = executeSparqlConstruct<OcOrganization>( + ` + CONSTRUCT { + ?publisher ?p ?o. + } + WHERE { + <${catalogUri}> dct:publisher ?publisher. + VALUES ?p { dct:identifier rdf:type dct:title dct:description foaf:name } + ?publisher ?p ?o. + } + `, + { + auth, + context: resourceContext + } + ) + const catalogResponse = await Promise.all([ catalogTemporalPromise, // 0 catalogStatusPromise, // 1 @@ -561,7 +581,8 @@ export async function getCatalog(identifier: string, auth?: Credentials): Promis catalogLanguagePromise, // 6 catalogTypePromise, // 7 catalogSubsPromise, // 8 - catalogDatasetsPromise // 9 + catalogDatasetsPromise, // 9 + catalogPublisherPromise // 10 ]) catalog.temporal = catalogResponse[0].map<[Date, Date]>((temporal) => [ @@ -577,6 +598,7 @@ export async function getCatalog(identifier: string, auth?: Credentials): Promis catalog.type = catalogResponse[7][0] catalog.catalogs = catalogResponse[8] catalog.datasets = catalogResponse[9] + catalog.publisher = catalogResponse[10][0] return catalog }