Skip to content

Commit

Permalink
chore: Declare multiple dataset languages (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer authored Dec 13, 2024
1 parent 8679029 commit 644acf1
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default {
],
coverageThreshold: {
global: {
lines: 91.39,
statements: 91.39,
lines: 91.41,
statements: 91.41,
branches: 92.62,
functions: 90.9,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@value": "Selectie van AAT termen voor het beschrijven van materialen in architectuur-, kunst- en cultuurhistorische collecties"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "http://vocab.getty.edu/aat/sparql/materials",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@value": "Selectie van AAT termen voor het beschrijven van processen en technieken in architectuur-, kunst- en cultuurhistorische collecties"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "http://vocab.getty.edu/aat/sparql/processes-and-techniques",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@value": "Selectie van AAT termen voor het beschrijven van stijlen en periodes in architectuur-, kunst- en cultuurhistorische collecties"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "http://vocab.getty.edu/aat/sparql/styles-and-periods",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@value": "Onderwerpen voor het beschrijven van architectuur-, kunst- en cultuurhistorische collecties"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "http://vocab.getty.edu/aat/sparql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@value": "Onderwerpen over alle gebieden waarop de Europese Unie actief is. De nadruk ligt op de parlementaire activiteiten van de EU"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "http://publications.europa.eu/webapi/rdf/sparql#eurovoc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@value": "Biografische gegevens van Nederlandse en buitenlandse kunstenaars van de middeleeuwen tot heden"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "https://api.rkd.triply.cc/datasets/rkd/RKD-SDO-Knowledge-Graph/sparql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@value": "Termen voor het beschrijven van muziekinstrumenten, zangstemmen en ensembles (in enkelvoudige en meervoudige bezetting)"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "https://data.muziekschatten.nl/sparql/#uitvoeringsmedium",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@value": "Alle entiteiten in Wikidata, zoals beroepen, films of kunstwerken"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "https://query.wikidata.org/sparql#entities-all",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@value": "Personen"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "https://query.wikidata.org/sparql#entities-persons",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@value": "Plaatsen in Nederland en België"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "https://query.wikidata.org/sparql#entities-places",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@value": "Straten in Nederland"
}
],
"inLanguage": "nl",
"inLanguage": ["en", "nl"],
"distribution": [
{
"@id": "https://query.wikidata.org/sparql#entities-streets",
Expand Down
10 changes: 7 additions & 3 deletions packages/network-of-terms-catalog/src/getCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ export async function getCatalog(path?: string): Promise<Catalog> {
export async function fromStore(store: RDF.Store): Promise<Catalog> {
// Collect all properties for SELECT and GROUP BY so we can flatten the schema:url values into a single value.
const properties =
'?dataset ?name ?description ?creator ?creatorName ?creatorAlternateName ?distribution ?endpointUrl ?searchQuery ?lookupQuery ?reconciliationUrlTemplate ?alternateName ?mainEntityOfPage ?inLanguage';
'?dataset ?name ?description ?creator ?creatorName ?creatorAlternateName ?distribution ?endpointUrl ?searchQuery ?lookupQuery ?reconciliationUrlTemplate ?alternateName ?mainEntityOfPage';
const query = `
PREFIX schema: <http://schema.org/>
SELECT ${properties} (GROUP_CONCAT(?genre) as ?genre) (GROUP_CONCAT(DISTINCT ?url) as ?url) WHERE {
SELECT ${properties}
(GROUP_CONCAT(?genre) as ?genre)
(GROUP_CONCAT(DISTINCT ?url) as ?url)
(GROUP_CONCAT(DISTINCT ?inLanguage) as ?inLanguage)
WHERE {
?dataset a schema:Dataset ;
schema:name ?name ;
schema:description ?description ;
Expand Down Expand Up @@ -83,7 +87,7 @@ export async function fromStore(store: RDF.Store): Promise<Catalog> {
.value.split(' ') // The single value is space-delineated.
.map((url: string) => new IRI(url)),
bindings.get('mainEntityOfPage')!.value,
bindings.get('inLanguage')!.value,
bindings.get('inLanguage')!.value.split(' '), // The single value is space-delineated.
[
new Organization(
new IRI(bindings.get('creator')!.value),
Expand Down
2 changes: 1 addition & 1 deletion packages/network-of-terms-catalog/test/catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Catalog', () => {
new IRI('https://data.cultureelerfgoed.nl/term/id/cht/'),
]);
expect(cht.alternateName).toEqual('CHT');
expect(cht.inLanguage).toEqual('nl');
expect(cht.inLanguage).toEqual(['nl']);
expect(cht.creators[0].name).toEqual(
'Rijksdienst voor het Cultureel Erfgoed'
);
Expand Down
2 changes: 1 addition & 1 deletion packages/network-of-terms-graphql/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async function source(distribution: Distribution, dataset: Dataset) {
alternateName: dataset.alternateName,
description: dataset.description,
mainEntityOfPage: [dataset.mainEntityOfPage],
inLanguage: [dataset.inLanguage],
inLanguage: dataset.inLanguage,
creators: dataset.creators.map(creator => ({
uri: creator.iri,
name: creator.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/network-of-terms-graphql/test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('Server', () => {
expect(body.data.terms[0].source.uri).toEqual(
'https://data.rkd.nl/rkdartists'
);
expect(body.data.terms[0].source.inLanguage).toEqual(['nl']);
expect(body.data.terms[0].source.inLanguage).toEqual(['en', 'nl']);
expect(body.data.terms[0].result.__typename).toEqual('Terms');
expect(body.data.terms[0].result.terms).toHaveLength(5); // Terms found.
expect(body.data.terms[0].responseTimeMs).toBeGreaterThan(0);
Expand Down
2 changes: 1 addition & 1 deletion packages/network-of-terms-query/src/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class Dataset {
readonly genres: IRI[],
readonly termsPrefixes: IRI[],
readonly mainEntityOfPage: string,
readonly inLanguage: string,
readonly inLanguage: string[],
readonly creators: [Organization],
readonly distributions: [Distribution],
readonly alternateName?: string
Expand Down
8 changes: 4 additions & 4 deletions packages/network-of-terms-query/src/server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const testCatalog = (port: number) =>
],
[new IRI('https://example.com/resources/')],
'https://example.com/rkdartists',
'nl',
['en', 'nl'],
[
new Organization(
new IRI('https://rkd.nl'),
Expand Down Expand Up @@ -109,7 +109,7 @@ export const testCatalog = (port: number) =>
],
[new IRI('https://data.cultureelerfgoed.nl/term/id/cht/')],
'https://example.com/cht',
'nl',
['nl'],
[
new Organization(
new IRI('https://www.cultureelerfgoed.nl'),
Expand Down Expand Up @@ -143,7 +143,7 @@ export const testCatalog = (port: number) =>
],
[new IRI('http://vocab.getty.edu/aat/')],
'https://example.com/aat',
'nl',
['nl'],
[
new Organization(
new IRI('http://www.getty.edu/research/'),
Expand Down Expand Up @@ -171,7 +171,7 @@ export const testCatalog = (port: number) =>
],
[new IRI('http://data.beeldengeluid.nl/gtaa/')],
'https://example.com/gtaa',
'nl',
['nl'],
[
new Organization(
new IRI('https://www.beeldengeluid.nl/'),
Expand Down

0 comments on commit 644acf1

Please sign in to comment.