@manta-eu/rdf-lib 0.1.1 → 0.1.3
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/dist/rdf-namespaces.d.ts
CHANGED
|
@@ -1,119 +1,7 @@
|
|
|
1
|
-
export { cs, nfo, sh } from "@manta-eu/ldo/namespaces";
|
|
2
|
-
export { activeRealm, realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
1
|
+
export { cs, namespaces, namespacesForRealm, namespacesForRoot, nfo, sh } from "@manta-eu/ldo/namespaces";
|
|
2
|
+
export { activeRealm, realmVocabBase, realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
3
3
|
export type IRI = string;
|
|
4
4
|
export type CURIE = `${string}:${string}`;
|
|
5
|
-
export declare function realmVocabBase(realm?: string): string;
|
|
6
|
-
export declare function namespacesForRealm(realm?: string): {
|
|
7
|
-
"": string;
|
|
8
|
-
rdf: string;
|
|
9
|
-
rdfs: string;
|
|
10
|
-
schema: string;
|
|
11
|
-
xsd: string;
|
|
12
|
-
brand: string;
|
|
13
|
-
meta: string;
|
|
14
|
-
shopify: string;
|
|
15
|
-
sh: string;
|
|
16
|
-
owl: string;
|
|
17
|
-
dcterms: string;
|
|
18
|
-
google: string;
|
|
19
|
-
ga4: string;
|
|
20
|
-
gmc: string;
|
|
21
|
-
ghc: string;
|
|
22
|
-
time: string;
|
|
23
|
-
rdfox: string;
|
|
24
|
-
snap: string;
|
|
25
|
-
stripe: string;
|
|
26
|
-
attio: string;
|
|
27
|
-
woo: string;
|
|
28
|
-
linkedin: string;
|
|
29
|
-
slack: string;
|
|
30
|
-
prov: string;
|
|
31
|
-
klaviyo: string;
|
|
32
|
-
figma: string;
|
|
33
|
-
dash: string;
|
|
34
|
-
nmo: string;
|
|
35
|
-
nco: string;
|
|
36
|
-
nfo: string;
|
|
37
|
-
coresignal: string;
|
|
38
|
-
infisical: string;
|
|
39
|
-
dpv: string;
|
|
40
|
-
pd: string;
|
|
41
|
-
relay: string;
|
|
42
|
-
};
|
|
43
|
-
export declare function namespacesForRoot(root: string): {
|
|
44
|
-
"": string;
|
|
45
|
-
rdf: string;
|
|
46
|
-
rdfs: string;
|
|
47
|
-
schema: string;
|
|
48
|
-
xsd: string;
|
|
49
|
-
brand: string;
|
|
50
|
-
meta: string;
|
|
51
|
-
shopify: string;
|
|
52
|
-
sh: string;
|
|
53
|
-
owl: string;
|
|
54
|
-
dcterms: string;
|
|
55
|
-
google: string;
|
|
56
|
-
ga4: string;
|
|
57
|
-
gmc: string;
|
|
58
|
-
ghc: string;
|
|
59
|
-
time: string;
|
|
60
|
-
rdfox: string;
|
|
61
|
-
snap: string;
|
|
62
|
-
stripe: string;
|
|
63
|
-
attio: string;
|
|
64
|
-
woo: string;
|
|
65
|
-
linkedin: string;
|
|
66
|
-
slack: string;
|
|
67
|
-
prov: string;
|
|
68
|
-
klaviyo: string;
|
|
69
|
-
figma: string;
|
|
70
|
-
dash: string;
|
|
71
|
-
nmo: string;
|
|
72
|
-
nco: string;
|
|
73
|
-
nfo: string;
|
|
74
|
-
coresignal: string;
|
|
75
|
-
infisical: string;
|
|
76
|
-
dpv: string;
|
|
77
|
-
pd: string;
|
|
78
|
-
relay: string;
|
|
79
|
-
};
|
|
80
|
-
export declare const namespaces: {
|
|
81
|
-
"": string;
|
|
82
|
-
rdf: string;
|
|
83
|
-
rdfs: string;
|
|
84
|
-
schema: string;
|
|
85
|
-
xsd: string;
|
|
86
|
-
brand: string;
|
|
87
|
-
meta: string;
|
|
88
|
-
shopify: string;
|
|
89
|
-
sh: string;
|
|
90
|
-
owl: string;
|
|
91
|
-
dcterms: string;
|
|
92
|
-
google: string;
|
|
93
|
-
ga4: string;
|
|
94
|
-
gmc: string;
|
|
95
|
-
ghc: string;
|
|
96
|
-
time: string;
|
|
97
|
-
rdfox: string;
|
|
98
|
-
snap: string;
|
|
99
|
-
stripe: string;
|
|
100
|
-
attio: string;
|
|
101
|
-
woo: string;
|
|
102
|
-
linkedin: string;
|
|
103
|
-
slack: string;
|
|
104
|
-
prov: string;
|
|
105
|
-
klaviyo: string;
|
|
106
|
-
figma: string;
|
|
107
|
-
dash: string;
|
|
108
|
-
nmo: string;
|
|
109
|
-
nco: string;
|
|
110
|
-
nfo: string;
|
|
111
|
-
coresignal: string;
|
|
112
|
-
infisical: string;
|
|
113
|
-
dpv: string;
|
|
114
|
-
pd: string;
|
|
115
|
-
relay: string;
|
|
116
|
-
};
|
|
117
5
|
export declare const baseIri: string;
|
|
118
6
|
export type NamespaceMeta = {
|
|
119
7
|
iri: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdf-namespaces.d.ts","sourceRoot":"","sources":["../src/rdf-namespaces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rdf-namespaces.d.ts","sourceRoot":"","sources":["../src/rdf-namespaces.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEnF,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AACzB,MAAM,MAAM,KAAK,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE1C,eAAO,MAAM,OAAO,QAAiB,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAI3D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAeoB,CAAC;AAEnD,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAEpE,eAAO,MAAM,wBAAwB,aAWnC,CAAC;AAEH,eAAO,MAAM,mBAAmB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|
|
|
1
|
-
//
|
|
2
|
-
import {
|
|
1
|
+
// The prefix-to-IRI record lives in `@manta-eu/ldo/namespaces` and is re-exported here.
|
|
2
|
+
import { namespaces } from "@manta-eu/ldo/namespaces";
|
|
3
|
+
import { realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
3
4
|
import { createNamespace } from "ldkit/namespaces";
|
|
4
|
-
export { cs, nfo, sh } from "@manta-eu/ldo/namespaces";
|
|
5
|
-
export { activeRealm, realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
6
|
-
export function realmVocabBase(realm = activeRealm()) {
|
|
7
|
-
return `${vocabRoot(realm)}#`;
|
|
8
|
-
}
|
|
9
|
-
export function namespacesForRealm(realm = activeRealm()) {
|
|
10
|
-
return namespacesForRoot(vocabRoot(realm));
|
|
11
|
-
}
|
|
12
|
-
// Takes a vocabulary root rather than a realm, so the canonical authoring space needs no realm entry.
|
|
13
|
-
export function namespacesForRoot(root) {
|
|
14
|
-
const base = `${root}#`;
|
|
15
|
-
const source = (path) => `${root}/${path}#`;
|
|
16
|
-
return {
|
|
17
|
-
"": base,
|
|
18
|
-
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
19
|
-
rdfs: "http://www.w3.org/2000/01/rdf-schema#",
|
|
20
|
-
schema: "https://schema.org/",
|
|
21
|
-
xsd: "http://www.w3.org/2001/XMLSchema#",
|
|
22
|
-
brand: source("brand"),
|
|
23
|
-
meta: source("meta"),
|
|
24
|
-
shopify: source("shopify"),
|
|
25
|
-
sh: "http://www.w3.org/ns/shacl#",
|
|
26
|
-
owl: "http://www.w3.org/2002/07/owl#",
|
|
27
|
-
dcterms: "http://purl.org/dc/terms/",
|
|
28
|
-
google: source("google"),
|
|
29
|
-
ga4: source("google/analytics"),
|
|
30
|
-
gmc: source("google/merchant-center"),
|
|
31
|
-
ghc: source("google/hotel-center"),
|
|
32
|
-
time: "http://www.w3.org/2006/time#",
|
|
33
|
-
rdfox: "https://rdfox.com/vocabulary#",
|
|
34
|
-
snap: source("snap"),
|
|
35
|
-
stripe: source("stripe"),
|
|
36
|
-
attio: source("attio"),
|
|
37
|
-
woo: source("woocommerce"),
|
|
38
|
-
linkedin: source("linkedin"),
|
|
39
|
-
slack: source("slack"),
|
|
40
|
-
prov: "http://www.w3.org/ns/prov#",
|
|
41
|
-
klaviyo: source("klaviyo"),
|
|
42
|
-
figma: source("figma"),
|
|
43
|
-
dash: source("dash"),
|
|
44
|
-
nmo: "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#",
|
|
45
|
-
nco: "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#",
|
|
46
|
-
nfo: "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#",
|
|
47
|
-
coresignal: source("coresignal"),
|
|
48
|
-
infisical: "https://infisical/api/v4/secrets/",
|
|
49
|
-
dpv: "https://w3id.org/dpv#",
|
|
50
|
-
pd: "https://w3id.org/dpv/pd#",
|
|
51
|
-
relay: "https://relay.inferal.com/ontology#",
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export const namespaces = namespacesForRealm();
|
|
5
|
+
export { cs, namespaces, namespacesForRealm, namespacesForRoot, nfo, sh } from "@manta-eu/ldo/namespaces";
|
|
6
|
+
export { activeRealm, realmVocabBase, realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
55
7
|
export const baseIri = namespaces[""];
|
|
56
8
|
// Covers every namespace with typed schemas in @manta-eu/ldo - excluding infrastructure and integrations without schemas yet
|
|
57
|
-
// mcontent uses a literal IRI — not yet in
|
|
9
|
+
// mcontent uses a literal IRI — not yet in any realm's vocab.py prefix dict
|
|
58
10
|
export const labeledNamespaces = {
|
|
59
11
|
m: { iri: namespaces[""], label: realmVocabLabel() },
|
|
60
12
|
meta: { iri: namespaces.meta, label: "Meta" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shacl-shape-query.d.ts","sourceRoot":"","sources":["../src/shacl-shape-query.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU7D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAwBrF;
|
|
1
|
+
{"version":3,"file":"shacl-shape-query.d.ts","sourceRoot":"","sources":["../src/shacl-shape-query.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU7D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAwBrF;AAMD,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAiC1F"}
|
|
@@ -36,12 +36,17 @@ export function buildShaclPropertyQuery(shapeIri, propertyIri) {
|
|
|
36
36
|
}
|
|
37
37
|
`.build();
|
|
38
38
|
}
|
|
39
|
+
// The generated sh namespace carries only the terms the shapes currently use, so naming this
|
|
40
|
+
// one directly keeps the query working whether or not a shape declares a default.
|
|
41
|
+
const shaclDefaultValue = `${namespaces.sh}defaultValue`;
|
|
39
42
|
export function buildShaclShapeSummaryQuery(shapeIri, propertyIri) {
|
|
40
43
|
const shape = dataFactory.namedNode(shapeIri);
|
|
41
44
|
const propertyPath = propertyIri
|
|
42
45
|
? sparql `?propertyShape ${dataFactory.namedNode(sh.path)} ?path . VALUES ?path { ${dataFactory.namedNode(propertyIri)} }`
|
|
43
46
|
: sparql `?propertyShape ${dataFactory.namedNode(sh.path)} ?path .`;
|
|
44
|
-
|
|
47
|
+
const rdfFirst = dataFactory.namedNode(`${namespaces.rdf}first`);
|
|
48
|
+
const rdfRest = dataFactory.namedNode(`${namespaces.rdf}rest`);
|
|
49
|
+
return SELECT `DISTINCT ?targetClass ?propertyShape ?path ?name ?description ?minCount ?maxCount ?datatype ?class ?node ?pattern ?message ?hasValue ?defaultValue ?inValue`
|
|
45
50
|
.WHERE `
|
|
46
51
|
GRAPH ${dataFactory.namedNode(shaclGraphIri)} {
|
|
47
52
|
{
|
|
@@ -58,6 +63,11 @@ export function buildShaclShapeSummaryQuery(shapeIri, propertyIri) {
|
|
|
58
63
|
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.datatype)} ?datatype . }
|
|
59
64
|
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.class)} ?class . }
|
|
60
65
|
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.node)} ?node . }
|
|
66
|
+
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.pattern)} ?pattern . }
|
|
67
|
+
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.message)} ?message . }
|
|
68
|
+
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.hasValue)} ?hasValue . }
|
|
69
|
+
OPTIONAL { ?propertyShape ${dataFactory.namedNode(shaclDefaultValue)} ?defaultValue . }
|
|
70
|
+
OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.in)}/${rdfRest}*/${rdfFirst} ?inValue . }
|
|
61
71
|
}
|
|
62
72
|
}
|
|
63
73
|
`.ORDER_BY `?path`.build();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manta-eu/rdf-lib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Namespace prefixes, CURIE helpers and JSON-LD types for the Manta knowledge graph",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./action-plan-schemas": {
|
|
@@ -35,13 +35,14 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"ldkit": "2.8.0",
|
|
39
|
-
"@manta-eu/ldo": "0.1.
|
|
38
|
+
"ldkit": "^2.8.0",
|
|
39
|
+
"@manta-eu/ldo": "0.1.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"rimraf": "^6.1.3",
|
|
42
43
|
"tsc-alias": "^1.9.5",
|
|
43
|
-
"typescript": "^5.
|
|
44
|
-
"vitest": "^
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"vitest": "^4.1.8"
|
|
45
46
|
},
|
|
46
47
|
"files": [
|
|
47
48
|
"dist"
|
|
@@ -62,6 +63,6 @@
|
|
|
62
63
|
"scripts": {
|
|
63
64
|
"test": "vitest --run",
|
|
64
65
|
"types": "tsc --noEmit",
|
|
65
|
-
"build": "
|
|
66
|
+
"build": "rimraf dist && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json --resolve-full-paths"
|
|
66
67
|
}
|
|
67
68
|
}
|