Skip to content

Commit c2a0e2f

Browse files
author
Jean-Baptiste RUDANT
committed
Filter lang to keep labels in english only
1 parent 836ac33 commit c2a0e2f

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/js/sparql/queries.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const classifications = () => `
66
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
77
SELECT ?classification ?code ?label WHERE {
88
?classification rdf:type skos:ConceptScheme ; skos:notation ?code ; skos:prefLabel ?label .
9+
FILTER ( langMatches(lang(?label), "EN"))
910
} ORDER BY ?code
11+
1012
`
1113

1214
/**
@@ -18,6 +20,7 @@ const classificationDetails = uri => `
1820
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
1921
SELECT ?code ?label ?issued WHERE {
2022
<${uri}> skos:notation ?code ; skos:prefLabel ?label ; dcterms:issued ?issued .
23+
FILTER ( langMatches(lang(?label), "EN"))
2124
}
2225
`
2326

@@ -33,7 +36,7 @@ const classificationLevels = uri => `
3336
WHERE {
3437
<${uri}> xkos:levels/rdf:rest*/rdf:first ?level .
3538
?level xkos:depth ?depth ; skos:prefLabel ?label .
36-
FILTER ( langMatches(lang(?label), "EN"))
39+
FILTER (langMatches(lang(?label), "EN"))
3740
} ORDER BY ?depth
3841
`
3942
/**
@@ -51,7 +54,7 @@ const classificationCorrespondences = uri => `
5154
?table skos:notation ?code
5255
}
5356
# We miss somme correspondences where there is no definition in english
54-
FILTER ( langMatches(lang(?definition), "EN") || lang(?definition)="")
57+
FILTER (langMatches(lang(?definition), "EN") || lang(?definition)="")
5558
}
5659
`
5760

@@ -65,7 +68,10 @@ const correspondences = uri => `
6568
PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
6669
SELECT ?table ?label WHERE {
6770
?table rdf:type xkos:Corresponce .
68-
OPTIONAL { ?table skos:prefLabel ?label }
71+
OPTIONAL {
72+
?table skos:prefLabel ?label
73+
FILTER (langMatches(lang(?label), "EN"))
74+
}
6975
}
7076
`
7177

@@ -78,7 +84,7 @@ const levelItems = uri => `
7884
SELECT ?item ?code ?label WHERE {
7985
<${uri}> skos:member ?item .
8086
?item skos:notation ?code ; skos:prefLabel ?label .
81-
FILTER ( langMatches(lang(?label), "EN"))
87+
FILTER (langMatches(lang(?label), "EN"))
8288
} ORDER BY ?code
8389
`
8490

@@ -88,10 +94,11 @@ const levelItems = uri => `
8894
const classificationItems = uri => `
8995
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
9096
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
91-
SELECT DISTINCT ?item ?code ?label WHERE {
97+
SELECT ?item ?code ?label WHERE {
9298
<${uri}> xkos:levels/rdf:rest*/rdf:first ?level .
9399
?level skos:member ?item .
94100
?item skos:notation ?code ; skos:prefLabel ?label .
101+
FILTER ( langMatches(lang(?label), "EN"))
95102
} ORDER BY ?code LIMIT 25
96103
`
97104

@@ -122,6 +129,7 @@ const itemDetails = item => `
122129
OPTIONAL {
123130
<${item}> xkos:coreContentNote ?content .
124131
?content xkos:plainText ?text .
132+
FILTER ( langMatches(lang(?content), "EN"))
125133
}
126134
FILTER (
127135
langMatches(lang(?label), "EN") &&

0 commit comments

Comments
 (0)