@lde/pipeline-void 0.2.30 → 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.
|
@@ -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",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
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
|
}
|