@netwerk-digitaal-erfgoed/network-of-terms-catalog 5.9.1 → 5.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,9 +15,12 @@ additions specific to the Network of Terms:
15
15
  - `schema:url` is used for the HTTP URI prefix of terms in the dataset, e.g. `http://vocab.getty.edu/aat/` for Getty
16
16
  resources. This prefix is needed when clients look up terms by their URI in the Network of Terms: the Network then has
17
17
  to know which source to consult to retrieve the term.
18
- - Each distribution has two [`schema:potentialAction`](https://schema.org/potentialAction)s: a
19
- [`schema:SearchAction`](https://schema.org/SearchAction) and a [`schema:FindAction`](https://schema.org/FindAction),
20
- both with a [`schema:query`](https://schema.org/query) property that points to the queries directory.
18
+ - Each distribution has two or more [`schema:potentialAction`](https://schema.org/potentialAction)s:
19
+ - a [`schema:SearchAction`](https://schema.org/SearchAction) and
20
+ a [`schema:FindAction`](https://schema.org/FindAction), both with a [`schema:query`](https://schema.org/query)
21
+ property that points to the queries directory;
22
+ - optionally, a number of [`schema:Action`](https://schema.org/Action)s that configure the features that the Network
23
+ of Terms provides for the distribution, such as [Reconciliation](../network-of-terms-reconciliation).
21
24
 
22
25
  The [queries](catalog/queries) directory contains SPARQL queries for retrieving terms from the datasets. There are
23
26
  two types of queries:
@@ -1,55 +1,28 @@
1
1
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
2
2
  PREFIX justskos: <http://justskos.org/ns/core#>
3
-
4
3
  CONSTRUCT {
5
4
  ?uri a skos:Concept ;
6
5
  skos:prefLabel ?prefLabel ;
7
6
  skos:altLabel ?altLabel ;
8
7
  skos:hiddenLabel ?hiddenLabel ;
9
- skos:scopeNote ?scopeNote ;
10
- skos:broader ?broader_uri ;
11
- skos:narrower ?narrower_uri ;
12
- skos:related ?related_uri .
13
- ?broader_uri skos:prefLabel ?broader_prefLabel .
14
- ?narrower_uri skos:prefLabel ?narrower_prefLabel .
15
- ?related_uri skos:prefLabel ?related_prefLabel .
8
+ skos:scopeNote ?scopeNote .
9
+
16
10
  }
17
11
  WHERE {
18
- {
19
- ?uri skos:inScheme <http://data.beeldengeluid.nl/gtaa/Persoonsnamen> .
20
- ?uri skos:prefLabel|skos:altLabel|skos:hiddenLabel ?label ;
21
- justskos:status ?status .
22
- FILTER(LANG(?label) = "nl")
23
- FILTER(?status IN ('approved', 'candidate'))
12
+ ?uri skos:inScheme <http://data.beeldengeluid.nl/gtaa/Persoonsnamen> .
13
+ ?uri skos:prefLabel|skos:altLabel|skos:hiddenLabel ?label ;
14
+ justskos:status ?status .
15
+
16
+ FILTER(LANG(?label) = "nl")
17
+ FILTER(?status IN ('approved', 'candidate'))
24
18
 
25
- # single word query, match case insensitive
26
- FILTER regex(?query, "^[^ ]+$")
27
- FILTER CONTAINS(LCASE(?label), LCASE(?query))
28
- }
29
- # commented because of timeouts
30
- # UNION
31
- # {
32
- # ?uri skos:inScheme <http://data.beeldengeluid.nl/gtaa/Persoonsnamen> .
33
- # ?uri ?predicate ?label ;
34
- # justskos:status ?status .
35
- # VALUES ?predicate { skos:prefLabel skos:altLabel skos:hiddenLabel }
36
- # FILTER(LANG(?label) = "nl")
37
- # FILTER(?status IN ('approved', 'candidate'))
38
- #
39
- # # double word query, whitespace separator
40
- # FILTER REGEX(?query, "^([^ ]+)[ ]+([^ ]+)$")
41
- #
42
- # BIND(REPLACE(?query, "^([^ ]+)[ ]+([^ ]+)$", "$1") AS ?term1)
43
- # BIND(REPLACE(?query, "^([^ ]+)[ ]+([^ ]+)$", "$2") AS ?term2)
44
- #
45
- # # search case insensitive using an AND construct for the query terms
46
- # FILTER( CONTAINS(LCASE(?label), LCASE(?term1)) && CONTAINS(LCASE(?label), LCASE(?term2)) )
47
- # }
19
+ # single word query
20
+ FILTER regex(?query, "^[^ ]+$")
21
+ FILTER CONTAINS(LCASE(?label), LCASE(?query))
22
+
23
+ ?uri skos:prefLabel ?prefLabel .
24
+ FILTER(LANG(?prefLabel) = "nl" )
48
25
 
49
- OPTIONAL {
50
- ?uri skos:prefLabel ?prefLabel .
51
- FILTER(LANG(?prefLabel) = "nl" )
52
- }
53
26
  OPTIONAL {
54
27
  ?uri skos:altLabel ?altLabel .
55
28
  FILTER(LANG(?altLabel) = "nl")
@@ -62,20 +35,6 @@ WHERE {
62
35
  ?uri skos:scopeNote ?scopeNote .
63
36
  FILTER(LANG(?scopeNote) = "nl")
64
37
  }
65
- OPTIONAL {
66
- ?uri skos:broader ?broader_uri .
67
- ?broader_uri skos:prefLabel ?broader_prefLabel .
68
- FILTER(LANG(?broader_prefLabel) = "nl")
69
- }
70
- OPTIONAL {
71
- ?uri skos:narrower ?narrower_uri .
72
- ?narrower_uri skos:prefLabel ?narrower_prefLabel .
73
- FILTER(LANG(?narrower_prefLabel) = "nl")
74
- }
75
- OPTIONAL {
76
- ?uri skos:related ?related_uri .
77
- ?related_uri skos:prefLabel ?related_prefLabel .
78
- FILTER(LANG(?related_prefLabel) = "nl")
79
- }
80
38
  }
81
- LIMIT 10
39
+ LIMIT 50
40
+
@@ -5,43 +5,37 @@ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
5
5
  PREFIX wikibase: <http://wikiba.se/ontology#>
6
6
  PREFIX wdt: <http://www.wikidata.org/prop/direct/>
7
7
  PREFIX wd: <http://www.wikidata.org/entity/>
8
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
8
9
 
9
10
  CONSTRUCT {
10
- # Wikidata seems to have a problem with the short syntax for construct queries
11
- # so always use full syntax: "?s ?p ?o ." else you end up with an empty result list!
12
- ?item a skos:Concept .
13
- ?item skos:prefLabel ?streetName .
14
- ?item skos:altLabel ?fullName .
15
- ?item skos:altLabel ?altLabel .
16
- ?item skos:scopeNote ?description .
11
+ ?item a skos:Concept ;
12
+ skos:prefLabel ?streetName ;
13
+ skos:altLabel ?altLabel ;
14
+ skos:scopeNote ?description .
17
15
  }
18
16
  WHERE {
19
17
  SERVICE wikibase:mwapi {
20
18
  bd:serviceParam wikibase:endpoint "www.wikidata.org" .
21
- # The search seems to be done with a "starts with" function,
22
- # where by default the English pref and alt labels are searched.
23
- # Setting the required language to something else than "en"
24
- # results in an additional search in the pref and alt labels for this language.
25
- bd:serviceParam wikibase:api "EntitySearch" .
19
+ bd:serviceParam wikibase:api "Search" .
26
20
  bd:serviceParam mwapi:language "nl" .
27
- bd:serviceParam mwapi:search ?query .
28
- ?item wikibase:apiOutputItem mwapi:item .
21
+ bd:serviceParam mwapi:srsearch ?query .
22
+ ?item wikibase:apiOutputItem mwapi:title .
29
23
  }
30
24
  {
31
- # select Streets
32
- ?item wdt:P31 wd:Q79007
25
+ # select Streets
26
+ ?item wdt:P31 wd:Q79007
33
27
  }
34
- UNION
28
+ UNION
35
29
  {
36
- # select Squares
37
- ?item wdt:P31 wd:Q174782
30
+ # select Squares
31
+ ?item wdt:P31 wd:Q174782
38
32
  }
39
33
  ?item wdt:P17 wd:Q55 .
40
34
  ?item wdt:P131 ?administration .
41
35
  OPTIONAL {
42
- ?item wdt:P276 ?location .
43
- ?location rdfs:label ?locationName .
44
- FILTER LANGMATCHES(LANG(?locationName),"nl")
36
+ ?item wdt:P276 ?location .
37
+ ?location rdfs:label ?locationName .
38
+ FILTER LANGMATCHES(LANG(?locationName),"nl")
45
39
  }
46
40
  OPTIONAL {
47
41
  ?item schema:description ?description
@@ -55,14 +49,17 @@ WHERE {
55
49
  ?administration rdfs:label ?administrationName .
56
50
  FILTER LANGMATCHES(LANG(?streetName),"nl")
57
51
  FILTER LANGMATCHES(LANG(?administrationName),"nl")
58
- FILTER (STRSTARTS(LCASE(?streetName),LCASE(?query))||STRSTARTS(LCASE(?altLabel),LCASE(?query)))
52
+
53
+ # Some streets come with altLabel ‘Street name (Place name)’. For those that don’t, construct the altLabel manually.
59
54
  BIND(
60
- IF(
61
- BOUND(?locationName),
62
- CONCAT(?streetName," (",?locationName,")"),
63
- CONCAT(?streetName," (",?administrationName,")")
64
- )
65
- as ?fullName
55
+ COALESCE(
56
+ ?altLabel,
57
+ IF(
58
+ BOUND(?locationName),
59
+ CONCAT(?streetName," (",?locationName,")"),
60
+ CONCAT(?streetName," (",?administrationName,")")
61
+ )
62
+ ) as ?altLabel
66
63
  )
67
64
  }
68
- LIMIT 1000
65
+ LIMIT 1000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netwerk-digitaal-erfgoed/network-of-terms-catalog",
3
- "version": "5.9.1",
3
+ "version": "5.10.2",
4
4
  "type": "module",
5
5
  "description": "Catalog of Network of Terms datasets",
6
6
  "repository": {
@@ -44,7 +44,7 @@
44
44
  "homepage": "https://github.com/netwerk-digitaal-erfgoed/network-of-terms-catalog#readme",
45
45
  "dependencies": {
46
46
  "@comunica/query-sparql-rdfjs": "^2.0.6",
47
- "@netwerk-digitaal-erfgoed/network-of-terms-query": "1.4.0",
47
+ "@netwerk-digitaal-erfgoed/network-of-terms-query": "1.4.1",
48
48
  "globby": "^13.1.1",
49
49
  "rdf-js": "^4.0.2",
50
50
  "rdf-parse": "^2.0.0",