@lde/pipeline-void 0.2.29 → 0.2.31
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perClassAnalyzer.d.ts","sourceRoot":"","sources":["../src/perClassAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"perClassAnalyzer.d.ts","sourceRoot":"","sources":["../src/perClassAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAKN,MAAM,eAAe,CAAC;AA4CvB,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,KAAK,CAAC,CAEpD;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,KAAK,CAAC,CAEpD;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,KAAK,CAAC,CAEvD"}
|
package/dist/perClassAnalyzer.js
CHANGED
|
@@ -5,16 +5,12 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a Stage that first selects classes from the endpoint,
|
|
7
7
|
* then runs a per-class CONSTRUCT query with `?class` bound via VALUES.
|
|
8
|
-
*
|
|
9
|
-
* The selector is a factory that receives the runtime distribution,
|
|
10
|
-
* so no distribution is needed at construction time.
|
|
11
8
|
*/
|
|
12
9
|
async function createPerClassStage(queryFilename) {
|
|
13
10
|
const rawQuery = await readQueryFile(resolve(__dirname, 'queries', queryFilename));
|
|
14
11
|
const executor = new SparqlConstructExecutor({ query: rawQuery });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
itemSelector: (distribution) => {
|
|
12
|
+
const itemSelector = {
|
|
13
|
+
select: (distribution) => {
|
|
18
14
|
const subjectFilter = distribution.subjectFilter ?? '';
|
|
19
15
|
const fromClause = distribution.namedGraph
|
|
20
16
|
? `FROM <${distribution.namedGraph}>`
|
|
@@ -27,10 +23,13 @@ async function createPerClassStage(queryFilename) {
|
|
|
27
23
|
].join('\n');
|
|
28
24
|
return new SparqlItemSelector({
|
|
29
25
|
query: selectorQuery,
|
|
30
|
-
endpoint: distribution.accessUrl,
|
|
31
26
|
pageSize: 1000,
|
|
32
|
-
});
|
|
27
|
+
}).select(distribution);
|
|
33
28
|
},
|
|
29
|
+
};
|
|
30
|
+
return new Stage({
|
|
31
|
+
name: queryFilename,
|
|
32
|
+
itemSelector,
|
|
34
33
|
executors: executor,
|
|
35
34
|
});
|
|
36
35
|
}
|
|
@@ -7,5 +7,5 @@ import type { Quad } from '@rdfjs/types';
|
|
|
7
7
|
* namespace prefixes, then yields the corresponding `void:vocabulary` quads
|
|
8
8
|
* after all input quads have been consumed.
|
|
9
9
|
*/
|
|
10
|
-
export declare function withVocabularies(quads: AsyncIterable<Quad>, datasetIri: string): AsyncIterable<Quad>;
|
|
10
|
+
export declare function withVocabularies(quads: AsyncIterable<Quad>, datasetIri: string, vocabularies?: readonly string[]): AsyncIterable<Quad>;
|
|
11
11
|
//# sourceMappingURL=vocabularyAnalyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabularyAnalyzer.d.ts","sourceRoot":"","sources":["../src/vocabularyAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"vocabularyAnalyzer.d.ts","sourceRoot":"","sources":["../src/vocabularyAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAczC;;;;;;;GAOG;AACH,wBAAuB,gBAAgB,CACrC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,EAC1B,UAAU,EAAE,MAAM,EAClB,YAAY,GAAE,SAAS,MAAM,EAAwB,GACpD,aAAa,CAAC,IAAI,CAAC,CAqBrB"}
|
|
@@ -1,32 +1,12 @@
|
|
|
1
|
+
import prefixes from '@zazuko/prefixes';
|
|
1
2
|
import { DataFactory } from 'n3';
|
|
2
3
|
const { namedNode, quad } = DataFactory;
|
|
3
4
|
const VOID = 'http://rdfs.org/ns/void#';
|
|
4
5
|
const voidProperty = namedNode(`${VOID}property`);
|
|
5
6
|
const voidVocabulary = namedNode(`${VOID}vocabulary`);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const vocabularyPrefixes = new Map([
|
|
10
|
-
['http://schema.org/', 'http://schema.org/'],
|
|
11
|
-
['https://schema.org/', 'https://schema.org/'],
|
|
12
|
-
[
|
|
13
|
-
'https://www.ica.org/standards/RiC/ontology#',
|
|
14
|
-
'https://www.ica.org/standards/RiC/ontology#',
|
|
15
|
-
],
|
|
16
|
-
[
|
|
17
|
-
'http://www.cidoc-crm.org/cidoc-crm/',
|
|
18
|
-
'http://www.cidoc-crm.org/cidoc-crm/',
|
|
19
|
-
],
|
|
20
|
-
['http://purl.org/ontology/bibo/', 'http://purl.org/ontology/bibo/'],
|
|
21
|
-
['http://purl.org/dc/elements/1.1/', 'http://purl.org/dc/elements/1.1/'],
|
|
22
|
-
['http://purl.org/dc/terms/', 'http://purl.org/dc/terms/'],
|
|
23
|
-
['http://purl.org/dc/dcmitype/', 'http://purl.org/dc/dcmitype/'],
|
|
24
|
-
[
|
|
25
|
-
'http://www.w3.org/2004/02/skos/core#',
|
|
26
|
-
'http://www.w3.org/2004/02/skos/core#',
|
|
27
|
-
],
|
|
28
|
-
['http://xmlns.com/foaf/0.1/', 'http://xmlns.com/foaf/0.1/'],
|
|
29
|
-
]);
|
|
7
|
+
const defaultVocabularies = [
|
|
8
|
+
...new Set(Object.values(prefixes)),
|
|
9
|
+
];
|
|
30
10
|
/**
|
|
31
11
|
* Streaming transformer that passes through all quads and appends
|
|
32
12
|
* `void:vocabulary` triples for detected vocabulary prefixes.
|
|
@@ -35,15 +15,15 @@ const vocabularyPrefixes = new Map([
|
|
|
35
15
|
* namespace prefixes, then yields the corresponding `void:vocabulary` quads
|
|
36
16
|
* after all input quads have been consumed.
|
|
37
17
|
*/
|
|
38
|
-
export async function* withVocabularies(quads, datasetIri) {
|
|
18
|
+
export async function* withVocabularies(quads, datasetIri, vocabularies = defaultVocabularies) {
|
|
39
19
|
const detectedVocabularies = new Set();
|
|
40
20
|
for await (const q of quads) {
|
|
41
21
|
yield q;
|
|
42
22
|
if (q.predicate.equals(voidProperty)) {
|
|
43
23
|
const propertyUri = q.object.value;
|
|
44
|
-
for (const
|
|
45
|
-
if (propertyUri.startsWith(
|
|
46
|
-
detectedVocabularies.add(
|
|
24
|
+
for (const ns of vocabularies) {
|
|
25
|
+
if (propertyUri.startsWith(ns)) {
|
|
26
|
+
detectedVocabularies.add(ns);
|
|
47
27
|
break;
|
|
48
28
|
}
|
|
49
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/pipeline-void",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.31",
|
|
4
4
|
"description": "VOiD (Vocabulary of Interlinked Datasets) statistical analysis for RDF datasets",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/ldengine/lde",
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"!**/*.tsbuildinfo"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lde/pipeline": "0.6.
|
|
27
|
+
"@lde/pipeline": "0.6.28",
|
|
28
28
|
"@rdfjs/types": "^2.0.1",
|
|
29
|
+
"@zazuko/prefixes": "^2.6.1",
|
|
29
30
|
"n3": "^1.17.0",
|
|
30
31
|
"tslib": "^2.3.0"
|
|
31
32
|
}
|