Skip to content

Commit

Permalink
chore: Declare multiple dataset languages
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Dec 13, 2024
1 parent 8679029 commit 95972a6
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 20 deletions.
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": ["nl", "en"],
"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-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',
['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 95972a6

Please sign in to comment.