@lde/pipeline-void 0.35.8 → 0.35.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-void",
3
- "version": "0.35.8",
3
+ "version": "0.35.10",
4
4
  "description": "VOiD (Vocabulary of Interlinked Datasets) statistical analysis for RDF datasets",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -29,11 +29,11 @@
29
29
  "@rdfjs/types": "^2.0.1",
30
30
  "@tpluscode/rdf-ns-builders": "^5.0.0",
31
31
  "@zazuko/prefixes": "^2.6.1",
32
- "n3": "^2.4.0",
32
+ "n3": "^2.7.12",
33
33
  "tslib": "^2.3.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@lde/dataset": "^0.7.9",
37
- "@lde/pipeline": "^0.36.7"
36
+ "@lde/dataset": "^0.7.10",
37
+ "@lde/pipeline": "^0.36.9"
38
38
  }
39
39
  }
@@ -8,17 +8,33 @@ CONSTRUCT {
8
8
  }
9
9
  WHERE {
10
10
  {
11
- # Pre-group distinct subjects before computing namespace to avoid regex on every triple.
12
- SELECT ?uriSpace (COUNT(*) AS ?count) {
11
+ SELECT ?uriSpace (SUM(?groupCount) AS ?count) {
13
12
  {
14
- SELECT DISTINCT ?s {
15
- #subjectFilter#
16
- ?s ?p ?o .
17
- FILTER(ISIRI(?s))
13
+ # Group subjects by the directory of their document (the IRI without fragment),
14
+ # keeping hash IRIs apart. MIN = MAX tells whether a hash group holds a single
15
+ # document, without the cost of COUNT(DISTINCT ?document).
16
+ SELECT ?directory ?isHash (COUNT(*) AS ?groupCount)
17
+ (MIN(?document) AS ?firstDocument) (MAX(?document) AS ?lastDocument) {
18
+ {
19
+ # Pre-group distinct subjects before computing namespace to avoid regex on every triple.
20
+ SELECT DISTINCT ?s {
21
+ #subjectFilter#
22
+ ?s ?p ?o .
23
+ FILTER(ISIRI(?s))
24
+ }
25
+ }
26
+ BIND(STR(?s) AS ?iri)
27
+ BIND(CONTAINS(?iri, "#") AS ?isHash)
28
+ BIND(IF(?isHash, STRBEFORE(?iri, "#"), ?iri) AS ?document)
29
+ BIND(REPLACE(?document, "[^/]*$", "") AS ?prefix)
30
+ # A document without path (http://host, urn:…) is its own directory.
31
+ BIND(IF(?prefix = "" || STRENDS(?prefix, "//"), ?document, ?prefix) AS ?directory)
18
32
  }
33
+ GROUP BY ?directory ?isHash
19
34
  }
20
- # Extract namespace by removing the local name (everything after the last / or #)
21
- BIND(REPLACE(STR(?s), "[^/#]+$", "") AS ?uriSpace)
35
+ # A hash vocabulary (…/skos/core#) keeps its document as namespace; hash IRIs spread
36
+ # over several documents (…/record1#media, …/record2#media) share their directory.
37
+ BIND(IF(?isHash && ?firstDocument = ?lastDocument, CONCAT(?firstDocument, "#"), ?directory) AS ?uriSpace)
22
38
  }
23
39
  GROUP BY ?uriSpace
24
40
  ORDER BY DESC(?count)