diff --git a/jest.config.js b/jest.config.js index 4bc8fc45f..fed61f04b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,6 @@ export default { preset: 'ts-jest/presets/default-esm', - testTimeout: 30000, + testTimeout: 60000, extensionsToTreatAsEsm: ['.ts'], globals: { 'ts-jest': { diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-classificatie.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-classificatie.jsonld new file mode 100644 index 000000000..7bb46263b --- /dev/null +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-classificatie.jsonld @@ -0,0 +1,37 @@ +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/Classificatie", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: classificatie" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa/" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0027", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-genres.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-genres.jsonld index 71fabda4a..1eb404c4d 100644 --- a/packages/network-of-terms-catalog/catalog/datasets/gtaa-genres.jsonld +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-genres.jsonld @@ -1,37 +1,37 @@ -{ - "@context": "https://schema.org/docs/jsonldcontext.jsonld", - "@id": "http://data.beeldengeluid.nl/gtaa#genres", - "@type": "Dataset", - "name": [ - { - "@language": "nl", - "@value": "GTAA: genres" - } - ], - "creator": [ - { - "@id": "https://www.beeldengeluid.nl/" - } - ], - "url": [ - "http://data.beeldengeluid.nl/gtaa/" - ], - "distribution": [ - { - "@id": "https://data.netwerkdigitaalerfgoed.nl/beeldengeluid/gtaa-genres/sparql", - "@type": "DataDownload", - "contentUrl": "https://api.data.netwerkdigitaalerfgoed.nl/datasets/beeldengeluid/gtaa-genres/services/gtaa-genres/sparql", - "encodingFormat": "application/sparql-query", - "potentialAction": [ - { - "@type": "SearchAction", - "query": "file://catalog/queries/search/gtaa.rq" - }, - { - "@type": "FindAction", - "query": "file://catalog/queries/lookup/gtaa.rq" - } - ] - } - ] -} +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/Genre", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: genres" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa/" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0028", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-geografische-namen.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-geografische-namen.jsonld index e8f98a0dd..d8bbb8bf1 100644 --- a/packages/network-of-terms-catalog/catalog/datasets/gtaa-geografische-namen.jsonld +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-geografische-namen.jsonld @@ -1,37 +1,37 @@ -{ - "@context": "https://schema.org/docs/jsonldcontext.jsonld", - "@id": "http://data.beeldengeluid.nl/gtaa#geografische-namen", - "@type": "Dataset", - "name": [ - { - "@language": "nl", - "@value": "GTAA: geografische namen" - } - ], - "creator": [ - { - "@id": "https://www.beeldengeluid.nl/" - } - ], - "url": [ - "http://data.beeldengeluid.nl/gtaa/" - ], - "distribution": [ - { - "@id": "https://data.netwerkdigitaalerfgoed.nl/beeldengeluid/gtaa-geografischenamen/sparql", - "@type": "DataDownload", - "contentUrl": "https://api.data.netwerkdigitaalerfgoed.nl/datasets/beeldengeluid/gtaa-geografischenamen/services/gtaa-geografischenamen/sparql", - "encodingFormat": "application/sparql-query", - "potentialAction": [ - { - "@type": "SearchAction", - "query": "file://catalog/queries/search/gtaa.rq" - }, - { - "@type": "FindAction", - "query": "file://catalog/queries/lookup/gtaa.rq" - } - ] - } - ] -} +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/GeografischeNamen", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: geografische namen" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa/" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0029", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-namen.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-namen.jsonld new file mode 100644 index 000000000..af631cbab --- /dev/null +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-namen.jsonld @@ -0,0 +1,37 @@ +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/Namen", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: namen" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0030", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen-beng.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen-beng.jsonld new file mode 100644 index 000000000..5f4b08942 --- /dev/null +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen-beng.jsonld @@ -0,0 +1,37 @@ +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/OnderwerpenBenG", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: onderwerpen beeld-geluid" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa/" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0032", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen.jsonld index 344a28619..378bb29e0 100644 --- a/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen.jsonld +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-onderwerpen.jsonld @@ -1,37 +1,37 @@ -{ - "@context": "https://schema.org/docs/jsonldcontext.jsonld", - "@id": "http://data.beeldengeluid.nl/gtaa#onderwerpen", - "@type": "Dataset", - "name": [ - { - "@language": "nl", - "@value": "GTAA: onderwerpen" - } - ], - "creator": [ - { - "@id": "https://www.beeldengeluid.nl/" - } - ], - "url": [ - "http://data.beeldengeluid.nl/gtaa/" - ], - "distribution": [ - { - "@id": "https://data.netwerkdigitaalerfgoed.nl/beeldengeluid/gtaa-onderwerpen/sparql", - "@type": "DataDownload", - "contentUrl": "https://api.data.netwerkdigitaalerfgoed.nl/datasets/beeldengeluid/gtaa-onderwerpen/services/gtaa-onderwerpen/sparql", - "encodingFormat": "application/sparql-query", - "potentialAction": [ - { - "@type": "SearchAction", - "query": "file://catalog/queries/search/gtaa.rq" - }, - { - "@type": "FindAction", - "query": "file://catalog/queries/lookup/gtaa.rq" - } - ] - } - ] -} +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/Onderwerpen", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: onderwerpen" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa/" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0031", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/datasets/gtaa-persoonsnamen.jsonld b/packages/network-of-terms-catalog/catalog/datasets/gtaa-persoonsnamen.jsonld new file mode 100644 index 000000000..484bfb4de --- /dev/null +++ b/packages/network-of-terms-catalog/catalog/datasets/gtaa-persoonsnamen.jsonld @@ -0,0 +1,37 @@ +{ + "@context": "https://schema.org/docs/jsonldcontext.jsonld", + "@id": "http://data.beeldengeluid.nl/gtaa/Persoonsnamen", + "@type": "Dataset", + "name": [ + { + "@language": "nl", + "@value": "GTAA: persoonsnamen" + } + ], + "creator": [ + { + "@id": "https://www.beeldengeluid.nl/" + } + ], + "url": [ + "http://data.beeldengeluid.nl/gtaa/" + ], + "distribution": [ + { + "@id": "https://data.beeldengeluid.nl/id/datadownload/0026", + "@type": "DataDownload", + "contentUrl": "https://gtaa.apis.beeldengeluid.nl/sparql", + "encodingFormat": "application/sparql-query", + "potentialAction": [ + { + "@type": "SearchAction", + "query": "file://catalog/queries/search/gtaa-persoonsnamen.rq" + }, + { + "@type": "FindAction", + "query": "file://catalog/queries/lookup/gtaa.rq" + } + ] + } + ] +} diff --git a/packages/network-of-terms-catalog/catalog/queries/lookup/gtaa.rq b/packages/network-of-terms-catalog/catalog/queries/lookup/gtaa.rq index 86ee0a51f..fa02d8ca2 100644 --- a/packages/network-of-terms-catalog/catalog/queries/lookup/gtaa.rq +++ b/packages/network-of-terms-catalog/catalog/queries/lookup/gtaa.rq @@ -14,10 +14,7 @@ CONSTRUCT { ?related_uri skos:prefLabel ?related_prefLabel . } WHERE { - # For example: - # Concept: - # Geographical name: - # Genre: + VALUES ?uri { ?uris } ?uri a skos:Concept . diff --git a/packages/network-of-terms-catalog/catalog/queries/search/gtaa-persoonsnamen.rq b/packages/network-of-terms-catalog/catalog/queries/search/gtaa-persoonsnamen.rq new file mode 100644 index 000000000..f8993f660 --- /dev/null +++ b/packages/network-of-terms-catalog/catalog/queries/search/gtaa-persoonsnamen.rq @@ -0,0 +1,81 @@ +PREFIX skos: +PREFIX justskos: + +CONSTRUCT { + ?uri a skos:Concept ; + skos:prefLabel ?prefLabel ; + skos:altLabel ?altLabel ; + skos:hiddenLabel ?hiddenLabel ; + skos:scopeNote ?scopeNote ; + skos:broader ?broader_uri ; + skos:narrower ?narrower_uri ; + skos:related ?related_uri . + ?broader_uri skos:prefLabel ?broader_prefLabel . + ?narrower_uri skos:prefLabel ?narrower_prefLabel . + ?related_uri skos:prefLabel ?related_prefLabel . +} +WHERE { + { + ?uri skos:inScheme . + ?uri skos:prefLabel|skos:altLabel|skos:hiddenLabel ?label ; + justskos:status ?status . + FILTER(LANG(?label) = "nl") + FILTER(?status IN ('approved', 'candidate')) + + # single word query, match case insensitive + FILTER regex(?query, "^[^ ]+$") + FILTER CONTAINS(LCASE(?label), LCASE(?query)) + } +# commented because of timeouts +# UNION +# { +# ?uri skos:inScheme . +# ?uri ?predicate ?label ; +# justskos:status ?status . +# VALUES ?predicate { skos:prefLabel skos:altLabel skos:hiddenLabel } +# FILTER(LANG(?label) = "nl") +# FILTER(?status IN ('approved', 'candidate')) +# +# # double word query, whitespace separator +# FILTER REGEX(?query, "^([^ ]+)[ ]+([^ ]+)$") +# +# BIND(REPLACE(?query, "^([^ ]+)[ ]+([^ ]+)$", "$1") AS ?term1) +# BIND(REPLACE(?query, "^([^ ]+)[ ]+([^ ]+)$", "$2") AS ?term2) +# +# # search case insensitive using an AND construct for the query terms +# FILTER( CONTAINS(LCASE(?label), LCASE(?term1)) && CONTAINS(LCASE(?label), LCASE(?term2)) ) +# } + + OPTIONAL { + ?uri skos:prefLabel ?prefLabel . + FILTER(LANG(?prefLabel) = "nl" ) + } + OPTIONAL { + ?uri skos:altLabel ?altLabel . + FILTER(LANG(?altLabel) = "nl") + } + OPTIONAL { + ?uri skos:hiddenLabel ?hiddenLabel . + FILTER(LANG(?hiddenLabel) = "nl") + } + OPTIONAL { + ?uri skos:scopeNote ?scopeNote . + FILTER(LANG(?scopeNote) = "nl") + } + OPTIONAL { + ?uri skos:broader ?broader_uri . + ?broader_uri skos:prefLabel ?broader_prefLabel . + FILTER(LANG(?broader_prefLabel) = "nl") + } + OPTIONAL { + ?uri skos:narrower ?narrower_uri . + ?narrower_uri skos:prefLabel ?narrower_prefLabel . + FILTER(LANG(?narrower_prefLabel) = "nl") + } + OPTIONAL { + ?uri skos:related ?related_uri . + ?related_uri skos:prefLabel ?related_prefLabel . + FILTER(LANG(?related_prefLabel) = "nl") + } +} +LIMIT 10 diff --git a/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq b/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq index c6e043e37..58bac4d3d 100644 --- a/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq +++ b/packages/network-of-terms-catalog/catalog/queries/search/gtaa.rq @@ -1,4 +1,5 @@ PREFIX skos: +PREFIX justskos: CONSTRUCT { ?uri a skos:Concept ; @@ -14,21 +15,35 @@ CONSTRUCT { ?related_uri skos:prefLabel ?related_prefLabel . } WHERE { - ?uri ?predicate ?label . - VALUES ?predicate { skos:prefLabel skos:altLabel } - FILTER(LANG(?label) = "nl") + { + ?uri skos:inScheme ?datasetUri . + ?uri ?predicate ?label ; + justskos:status ?status . + VALUES ?predicate { skos:prefLabel skos:altLabel skos:hiddenLabel } + FILTER(LANG(?label) = "nl") + FILTER(?status IN ('approved', 'candidate')) + # single word query, match case insensitive + FILTER regex(?query, "^[^ ]+$") + FILTER CONTAINS(LCASE(?label), LCASE(?query)) + } + UNION { - FILTER(?virtuosoQuery) - ?uri ?predicate ?label . - ?label ?virtuosoQuery . - } UNION { - # BC support. - BIND(?virtuosoQuery as ?b) - FILTER(!BOUND(?b)) - ?uri ?predicate ?label . - # Replace query "A B" with "A AND B", leaving queries "A AND B" or "A OR B" unchanged. - FILTER ( (?label, REPLACE(?query, "(?