@manta-eu/rdf-lib 0.1.0
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/LICENSE +21 -0
- package/dist/action-plan-schemas.d.ts +305 -0
- package/dist/action-plan-schemas.d.ts.map +1 -0
- package/dist/action-plan-schemas.js +45 -0
- package/dist/detail-view-types.d.ts +5 -0
- package/dist/detail-view-types.d.ts.map +1 -0
- package/dist/detail-view-types.js +19 -0
- package/dist/jsonld-types.d.ts +33 -0
- package/dist/jsonld-types.d.ts.map +1 -0
- package/dist/jsonld-types.js +190 -0
- package/dist/rdf-namespaces.d.ts +321 -0
- package/dist/rdf-namespaces.d.ts.map +1 -0
- package/dist/rdf-namespaces.js +310 -0
- package/dist/shacl-shape-query.d.ts +4 -0
- package/dist/shacl-shape-query.d.ts.map +1 -0
- package/dist/shacl-shape-query.js +64 -0
- package/dist/sparql-literal-escape.d.ts +2 -0
- package/dist/sparql-literal-escape.d.ts.map +1 -0
- package/dist/sparql-literal-escape.js +14 -0
- package/package.json +67 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
export { cs, nfo, sh } from "@manta-eu/ldo/namespaces";
|
|
2
|
+
export { activeRealm, realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
3
|
+
export type IRI = string;
|
|
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
|
+
export declare const baseIri: string;
|
|
118
|
+
export type NamespaceMeta = {
|
|
119
|
+
iri: string;
|
|
120
|
+
label: string;
|
|
121
|
+
};
|
|
122
|
+
export declare const labeledNamespaces: {
|
|
123
|
+
readonly m: {
|
|
124
|
+
readonly iri: string;
|
|
125
|
+
readonly label: string;
|
|
126
|
+
};
|
|
127
|
+
readonly meta: {
|
|
128
|
+
readonly iri: string;
|
|
129
|
+
readonly label: "Meta";
|
|
130
|
+
};
|
|
131
|
+
readonly google: {
|
|
132
|
+
readonly iri: string;
|
|
133
|
+
readonly label: "Google";
|
|
134
|
+
};
|
|
135
|
+
readonly ga4: {
|
|
136
|
+
readonly iri: string;
|
|
137
|
+
readonly label: "Google Analytics";
|
|
138
|
+
};
|
|
139
|
+
readonly ghc: {
|
|
140
|
+
readonly iri: string;
|
|
141
|
+
readonly label: "Google Hotel Center";
|
|
142
|
+
};
|
|
143
|
+
readonly shopify: {
|
|
144
|
+
readonly iri: string;
|
|
145
|
+
readonly label: "Shopify";
|
|
146
|
+
};
|
|
147
|
+
readonly snap: {
|
|
148
|
+
readonly iri: string;
|
|
149
|
+
readonly label: "Snap";
|
|
150
|
+
};
|
|
151
|
+
readonly attio: {
|
|
152
|
+
readonly iri: string;
|
|
153
|
+
readonly label: "Attio";
|
|
154
|
+
};
|
|
155
|
+
readonly klaviyo: {
|
|
156
|
+
readonly iri: string;
|
|
157
|
+
readonly label: "Klaviyo";
|
|
158
|
+
};
|
|
159
|
+
readonly figma: {
|
|
160
|
+
readonly iri: string;
|
|
161
|
+
readonly label: "Figma";
|
|
162
|
+
};
|
|
163
|
+
readonly schema: {
|
|
164
|
+
readonly iri: string;
|
|
165
|
+
readonly label: "Schema.org";
|
|
166
|
+
};
|
|
167
|
+
readonly mcontent: {
|
|
168
|
+
readonly iri: `${string}shapes/content-service#`;
|
|
169
|
+
readonly label: "Mcontent";
|
|
170
|
+
};
|
|
171
|
+
readonly brand: {
|
|
172
|
+
readonly iri: string;
|
|
173
|
+
readonly label: "Brand";
|
|
174
|
+
};
|
|
175
|
+
readonly coresignal: {
|
|
176
|
+
readonly iri: string;
|
|
177
|
+
readonly label: "Coresignal";
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export type LabeledNamespacePrefix = keyof typeof labeledNamespaces;
|
|
181
|
+
export declare const infrastructureNamespaces: Set<string>;
|
|
182
|
+
export declare const wellKnownPredicates: {
|
|
183
|
+
readonly actionShape: `${string}actionShape`;
|
|
184
|
+
readonly label: `${string}label`;
|
|
185
|
+
readonly type: `${string}type`;
|
|
186
|
+
readonly name: `${string}name`;
|
|
187
|
+
};
|
|
188
|
+
export declare function prependMissingSparqlPrefixes(query: string): string;
|
|
189
|
+
export declare function toTurtlePrefixes(): string;
|
|
190
|
+
export declare function isFullIri(value: string): boolean;
|
|
191
|
+
export declare function isPrefixedIri(value: string): boolean;
|
|
192
|
+
export declare function isIri(value: string): boolean;
|
|
193
|
+
export declare function validateFullIri(iri: string): void;
|
|
194
|
+
export declare function encodeIriUnsafeChars(value: string): string;
|
|
195
|
+
export declare function encodeIriLocalName(value: string): string;
|
|
196
|
+
export declare function decodeIriLocalName(value: string): string;
|
|
197
|
+
export declare function isValidFullIri(iri: string): boolean;
|
|
198
|
+
export declare function isIsoDatetime(value: string): boolean;
|
|
199
|
+
export declare function getNamespaceValues(): string[];
|
|
200
|
+
export declare function expandPrefix(prefixed: string): string;
|
|
201
|
+
export declare function compactUri(uri: string): string;
|
|
202
|
+
export declare const owlNothingIri = "http://www.w3.org/2002/07/owl#Nothing";
|
|
203
|
+
export declare function isOwlNothing(value: string): boolean;
|
|
204
|
+
export declare function iriLocalName(iri: string): string;
|
|
205
|
+
export declare function iriNamespace(iri: string): string;
|
|
206
|
+
export declare const rdfoxDefaultBaseIri = "https://rdfox.com/default-base-iri/";
|
|
207
|
+
export declare const shaclGraphIri = "https://rdfox.com/default-base-iri/shacl";
|
|
208
|
+
export declare function isActionPlanGraphIri(value: string): boolean;
|
|
209
|
+
export declare function formatIriForRdfox(iri: string): string;
|
|
210
|
+
export type EntityParts = {
|
|
211
|
+
prefix: string;
|
|
212
|
+
name: string;
|
|
213
|
+
};
|
|
214
|
+
export declare function parseEntityUri(entityUri: string): EntityParts;
|
|
215
|
+
export declare function formatEntityName(entityUri: string): string;
|
|
216
|
+
export declare const m: import("ldkit").NamespaceInterface<{
|
|
217
|
+
readonly iri: string;
|
|
218
|
+
readonly prefix: ":";
|
|
219
|
+
readonly terms: readonly ["BlendedPerformanceDaily", "CampaignChannelBenchmark", "CampaignPerformanceSummary", "CompanyKPISnapshot", "ConversationStarter", "MetaAd", "MetaAdSet", "MetaCampaign", "Product", "ProductProfitability", "ProductSalesRanking", "ProductVariant", "assignee", "budgetIncreaseFactor", "changeSet", "currentRoas", "dailyBudget", "integration", "isManualAction", "pauseReason", "previousDailyBudget", "priority", "scaleReason", "status", "wastedSpend"];
|
|
220
|
+
}>;
|
|
221
|
+
export declare const rdf: import("ldkit").NamespaceInterface<{
|
|
222
|
+
readonly iri: string;
|
|
223
|
+
readonly prefix: "rdf:";
|
|
224
|
+
readonly terms: readonly ["object", "predicate", "subject", "type"];
|
|
225
|
+
}>;
|
|
226
|
+
export declare const rdfs: import("ldkit").NamespaceInterface<{
|
|
227
|
+
readonly iri: string;
|
|
228
|
+
readonly prefix: "rdfs:";
|
|
229
|
+
readonly terms: readonly [];
|
|
230
|
+
}>;
|
|
231
|
+
export declare const schema: import("ldkit").NamespaceInterface<{
|
|
232
|
+
readonly iri: string;
|
|
233
|
+
readonly prefix: "schema:";
|
|
234
|
+
readonly terms: readonly [];
|
|
235
|
+
}>;
|
|
236
|
+
export declare const xsd: import("ldkit").NamespaceInterface<{
|
|
237
|
+
readonly iri: string;
|
|
238
|
+
readonly prefix: "xsd:";
|
|
239
|
+
readonly terms: readonly [];
|
|
240
|
+
}>;
|
|
241
|
+
export declare const meta: import("ldkit").NamespaceInterface<{
|
|
242
|
+
readonly iri: string;
|
|
243
|
+
readonly prefix: "meta:";
|
|
244
|
+
readonly terms: readonly ["Campaign", "CampaignDailyCumulativeInsights"];
|
|
245
|
+
}>;
|
|
246
|
+
export declare const shopify: import("ldkit").NamespaceInterface<{
|
|
247
|
+
readonly iri: string;
|
|
248
|
+
readonly prefix: "shopify:";
|
|
249
|
+
readonly terms: readonly [];
|
|
250
|
+
}>;
|
|
251
|
+
export declare const google: import("ldkit").NamespaceInterface<{
|
|
252
|
+
readonly iri: string;
|
|
253
|
+
readonly prefix: "google:";
|
|
254
|
+
readonly terms: readonly [];
|
|
255
|
+
}>;
|
|
256
|
+
export declare const ga4: import("ldkit").NamespaceInterface<{
|
|
257
|
+
readonly iri: string;
|
|
258
|
+
readonly prefix: "ga4:";
|
|
259
|
+
readonly terms: readonly [];
|
|
260
|
+
}>;
|
|
261
|
+
export declare const gmc: import("ldkit").NamespaceInterface<{
|
|
262
|
+
readonly iri: string;
|
|
263
|
+
readonly prefix: "gmc:";
|
|
264
|
+
readonly terms: readonly [];
|
|
265
|
+
}>;
|
|
266
|
+
export declare const ghc: import("ldkit").NamespaceInterface<{
|
|
267
|
+
readonly iri: string;
|
|
268
|
+
readonly prefix: "ghc:";
|
|
269
|
+
readonly terms: readonly [];
|
|
270
|
+
}>;
|
|
271
|
+
export declare const time: import("ldkit").NamespaceInterface<{
|
|
272
|
+
readonly iri: string;
|
|
273
|
+
readonly prefix: "time:";
|
|
274
|
+
readonly terms: readonly [];
|
|
275
|
+
}>;
|
|
276
|
+
export declare const rdfox: import("ldkit").NamespaceInterface<{
|
|
277
|
+
readonly iri: string;
|
|
278
|
+
readonly prefix: "rdfox:";
|
|
279
|
+
readonly terms: readonly [];
|
|
280
|
+
}>;
|
|
281
|
+
export declare const snap: import("ldkit").NamespaceInterface<{
|
|
282
|
+
readonly iri: string;
|
|
283
|
+
readonly prefix: "snap:";
|
|
284
|
+
readonly terms: readonly [];
|
|
285
|
+
}>;
|
|
286
|
+
export declare const stripe: import("ldkit").NamespaceInterface<{
|
|
287
|
+
readonly iri: string;
|
|
288
|
+
readonly prefix: "stripe:";
|
|
289
|
+
readonly terms: readonly [];
|
|
290
|
+
}>;
|
|
291
|
+
export declare const attio: import("ldkit").NamespaceInterface<{
|
|
292
|
+
readonly iri: string;
|
|
293
|
+
readonly prefix: "attio:";
|
|
294
|
+
readonly terms: readonly [];
|
|
295
|
+
}>;
|
|
296
|
+
export declare const woo: import("ldkit").NamespaceInterface<{
|
|
297
|
+
readonly iri: string;
|
|
298
|
+
readonly prefix: "woo:";
|
|
299
|
+
readonly terms: readonly [];
|
|
300
|
+
}>;
|
|
301
|
+
export declare const linkedin: import("ldkit").NamespaceInterface<{
|
|
302
|
+
readonly iri: string;
|
|
303
|
+
readonly prefix: "linkedin:";
|
|
304
|
+
readonly terms: readonly [];
|
|
305
|
+
}>;
|
|
306
|
+
export declare const slack: import("ldkit").NamespaceInterface<{
|
|
307
|
+
readonly iri: string;
|
|
308
|
+
readonly prefix: "slack:";
|
|
309
|
+
readonly terms: readonly [];
|
|
310
|
+
}>;
|
|
311
|
+
export declare const prov: import("ldkit").NamespaceInterface<{
|
|
312
|
+
readonly iri: string;
|
|
313
|
+
readonly prefix: "prov:";
|
|
314
|
+
readonly terms: readonly ["Person", "SoftwareAgent"];
|
|
315
|
+
}>;
|
|
316
|
+
export declare const klaviyo: import("ldkit").NamespaceInterface<{
|
|
317
|
+
readonly iri: string;
|
|
318
|
+
readonly prefix: "klaviyo:";
|
|
319
|
+
readonly terms: readonly [];
|
|
320
|
+
}>;
|
|
321
|
+
//# sourceMappingURL=rdf-namespaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdf-namespaces.d.ts","sourceRoot":"","sources":["../src/rdf-namespaces.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEnE,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AACzB,MAAM,MAAM,KAAK,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE1C,wBAAgB,cAAc,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,CAEpE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,GAAE,MAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE/D;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC7C;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAuB,CAAC;AAE/C,eAAO,MAAM,OAAO,QAAiB,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA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EAAuB,CAAC;AACxC,eAAO,MAAM,QAAQ;;;;EAA4B,CAAC;AAClD,eAAO,MAAM,KAAK;;;;EAAyB,CAAC;AAC5C,eAAO,MAAM,IAAI;;;;EAA8D,CAAC;AAChF,eAAO,MAAM,OAAO;;;;EAA2B,CAAC"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// In sync with `kgc/mappings/prefixes.yml`
|
|
2
|
+
import { activeRealm, realmVocabLabel, vocabRoot } from "@manta-eu/ldo/realm";
|
|
3
|
+
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();
|
|
55
|
+
export const baseIri = namespaces[""];
|
|
56
|
+
// 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 kgc/mappings/prefixes.yml
|
|
58
|
+
export const labeledNamespaces = {
|
|
59
|
+
m: { iri: namespaces[""], label: realmVocabLabel() },
|
|
60
|
+
meta: { iri: namespaces.meta, label: "Meta" },
|
|
61
|
+
google: { iri: namespaces.google, label: "Google" },
|
|
62
|
+
ga4: { iri: namespaces.ga4, label: "Google Analytics" },
|
|
63
|
+
ghc: { iri: namespaces.ghc, label: "Google Hotel Center" },
|
|
64
|
+
shopify: { iri: namespaces.shopify, label: "Shopify" },
|
|
65
|
+
snap: { iri: namespaces.snap, label: "Snap" },
|
|
66
|
+
attio: { iri: namespaces.attio, label: "Attio" },
|
|
67
|
+
klaviyo: { iri: namespaces.klaviyo, label: "Klaviyo" },
|
|
68
|
+
figma: { iri: namespaces.figma, label: "Figma" },
|
|
69
|
+
schema: { iri: namespaces.schema, label: "Schema.org" },
|
|
70
|
+
mcontent: { iri: `${baseIri.replace(/#$/, "/")}shapes/content-service#`, label: "Mcontent" },
|
|
71
|
+
brand: { iri: namespaces.brand, label: "Brand" },
|
|
72
|
+
coresignal: { iri: namespaces.coresignal, label: "Coresignal" },
|
|
73
|
+
};
|
|
74
|
+
export const infrastructureNamespaces = new Set([
|
|
75
|
+
"",
|
|
76
|
+
"rdf",
|
|
77
|
+
"rdfs",
|
|
78
|
+
"xsd",
|
|
79
|
+
"sh",
|
|
80
|
+
"owl",
|
|
81
|
+
"dcterms",
|
|
82
|
+
"time",
|
|
83
|
+
"rdfox",
|
|
84
|
+
"infisical",
|
|
85
|
+
]);
|
|
86
|
+
export const wellKnownPredicates = {
|
|
87
|
+
actionShape: `${namespaces[""]}actionShape`,
|
|
88
|
+
label: `${namespaces.rdfs}label`,
|
|
89
|
+
type: `${namespaces.rdf}type`,
|
|
90
|
+
name: `${namespaces.schema}name`,
|
|
91
|
+
};
|
|
92
|
+
// Both SPARQL routes AST-parse before RDFox is contacted, so an undeclared prefix is a grammar error
|
|
93
|
+
// at PrefixedName and RDFox's own bound prefixes never get a say. Adds only what the caller omitted,
|
|
94
|
+
// so an explicit declaration always wins.
|
|
95
|
+
export function prependMissingSparqlPrefixes(query) {
|
|
96
|
+
const declaredPrefixes = new Set();
|
|
97
|
+
const prefixDeclarationPattern = /^\s*PREFIX\s+([A-Za-z][\w-]*|):\s*<[^>]+>/gim;
|
|
98
|
+
for (const match of query.matchAll(prefixDeclarationPattern)) {
|
|
99
|
+
const prefixToken = match[1];
|
|
100
|
+
if (typeof prefixToken === "string") {
|
|
101
|
+
declaredPrefixes.add(prefixToken === ":" ? "" : prefixToken);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const missingPrefixDeclarations = Object.entries(namespaces)
|
|
105
|
+
.filter(([prefix]) => !declaredPrefixes.has(prefix))
|
|
106
|
+
.map(([prefix, namespace]) => `PREFIX ${prefix}: <${namespace}>`);
|
|
107
|
+
if (missingPrefixDeclarations.length === 0) {
|
|
108
|
+
return query;
|
|
109
|
+
}
|
|
110
|
+
return `${missingPrefixDeclarations.join("\n")}\n\n${query}`;
|
|
111
|
+
}
|
|
112
|
+
export function toTurtlePrefixes() {
|
|
113
|
+
return Object.entries(namespaces)
|
|
114
|
+
.map(([prefix, uri]) => `@prefix ${prefix}: <${uri}> .`)
|
|
115
|
+
.join("\n");
|
|
116
|
+
}
|
|
117
|
+
export function isFullIri(value) {
|
|
118
|
+
return value.startsWith("http://") || value.startsWith("https://");
|
|
119
|
+
}
|
|
120
|
+
export function isPrefixedIri(value) {
|
|
121
|
+
const colonIndex = value.indexOf(":");
|
|
122
|
+
if (colonIndex === -1)
|
|
123
|
+
return false;
|
|
124
|
+
const localName = value.substring(colonIndex + 1);
|
|
125
|
+
return Boolean(localName) && !localName.includes("/") && !localName.includes("#");
|
|
126
|
+
}
|
|
127
|
+
export function isIri(value) {
|
|
128
|
+
return isFullIri(value) || isPrefixedIri(value);
|
|
129
|
+
}
|
|
130
|
+
export function validateFullIri(iri) {
|
|
131
|
+
if (!isFullIri(iri)) {
|
|
132
|
+
throw new Error(`Invalid IRI: must start with http:// or https:// - got "${iri}"`);
|
|
133
|
+
}
|
|
134
|
+
if (/\s/.test(iri)) {
|
|
135
|
+
throw new Error(`Invalid IRI: contains whitespace - got "${iri}"`);
|
|
136
|
+
}
|
|
137
|
+
const dangerousChars = /[<>"{}|\\^`]/;
|
|
138
|
+
if (dangerousChars.test(iri)) {
|
|
139
|
+
throw new Error(`Invalid IRI: contains disallowed characters - got "${iri}"`);
|
|
140
|
+
}
|
|
141
|
+
for (let i = 0; i < iri.length; i++) {
|
|
142
|
+
const code = iri.charCodeAt(i);
|
|
143
|
+
if (code <= 0x1f) {
|
|
144
|
+
throw new Error(`Invalid IRI: contains control characters - got "${iri}"`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
new URL(iri);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
throw new Error(`Invalid IRI: malformed URL - got "${iri}"`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const iriUnsafeCharPattern = /[\s<>"{}|\\^`\x00-\x1f]/g;
|
|
155
|
+
export function encodeIriUnsafeChars(value) {
|
|
156
|
+
return value.replace(iriUnsafeCharPattern, (char) => encodeURIComponent(char));
|
|
157
|
+
}
|
|
158
|
+
// Escapes '%' as well, so a local name survives the round trip
|
|
159
|
+
const localNameUnsafeCharPattern = /[%#?/\s<>"{}|\\^`\x00-\x1f]/g;
|
|
160
|
+
export function encodeIriLocalName(value) {
|
|
161
|
+
return value.replace(localNameUnsafeCharPattern, (char) => encodeURIComponent(char));
|
|
162
|
+
}
|
|
163
|
+
export function decodeIriLocalName(value) {
|
|
164
|
+
try {
|
|
165
|
+
return decodeURIComponent(value);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return value;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function isValidFullIri(iri) {
|
|
172
|
+
if (!iri)
|
|
173
|
+
return false;
|
|
174
|
+
try {
|
|
175
|
+
validateFullIri(iri);
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export function isIsoDatetime(value) {
|
|
183
|
+
if (!value.includes("T"))
|
|
184
|
+
return false;
|
|
185
|
+
const date = new Date(value);
|
|
186
|
+
return !Number.isNaN(date.getTime());
|
|
187
|
+
}
|
|
188
|
+
export function getNamespaceValues() {
|
|
189
|
+
return Object.values(namespaces);
|
|
190
|
+
}
|
|
191
|
+
export function expandPrefix(prefixed) {
|
|
192
|
+
if (isFullIri(prefixed)) {
|
|
193
|
+
return prefixed;
|
|
194
|
+
}
|
|
195
|
+
if (prefixed.startsWith(":")) {
|
|
196
|
+
return baseIri + prefixed.slice(1);
|
|
197
|
+
}
|
|
198
|
+
const colonIndex = prefixed.indexOf(":");
|
|
199
|
+
if (colonIndex > 0) {
|
|
200
|
+
const prefix = prefixed.substring(0, colonIndex);
|
|
201
|
+
const local = prefixed.substring(colonIndex + 1);
|
|
202
|
+
const expanded = namespaces[prefix];
|
|
203
|
+
return expanded ? expanded + local : prefixed;
|
|
204
|
+
}
|
|
205
|
+
return prefixed;
|
|
206
|
+
}
|
|
207
|
+
export function compactUri(uri) {
|
|
208
|
+
for (const [prefix, namespace] of Object.entries(namespaces)) {
|
|
209
|
+
if (uri.startsWith(namespace)) {
|
|
210
|
+
const local = uri.substring(namespace.length);
|
|
211
|
+
if (namespace === baseIri) {
|
|
212
|
+
return `:${local}`;
|
|
213
|
+
}
|
|
214
|
+
return `${prefix}:${local}`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return uri;
|
|
218
|
+
}
|
|
219
|
+
export const owlNothingIri = "http://www.w3.org/2002/07/owl#Nothing";
|
|
220
|
+
export function isOwlNothing(value) {
|
|
221
|
+
return value === "owl:Nothing" || value === owlNothingIri;
|
|
222
|
+
}
|
|
223
|
+
export function iriLocalName(iri) {
|
|
224
|
+
return iri.split(/[#/]/).pop() || iri;
|
|
225
|
+
}
|
|
226
|
+
export function iriNamespace(iri) {
|
|
227
|
+
return iri.replace(/[^#/]*$/, "") || iri.replace(/:[^:]*$/, "");
|
|
228
|
+
}
|
|
229
|
+
export const rdfoxDefaultBaseIri = "https://rdfox.com/default-base-iri/";
|
|
230
|
+
export const shaclGraphIri = `${rdfoxDefaultBaseIri}shacl`;
|
|
231
|
+
export function isActionPlanGraphIri(value) {
|
|
232
|
+
const trimmed = value.trim();
|
|
233
|
+
const withoutAngles = trimmed.startsWith("<") && trimmed.endsWith(">") ? trimmed.slice(1, -1) : trimmed;
|
|
234
|
+
const localName = withoutAngles.split(/[#/:]/).pop() ?? withoutAngles;
|
|
235
|
+
return localName.startsWith("ActionPlan_");
|
|
236
|
+
}
|
|
237
|
+
export function formatIriForRdfox(iri) {
|
|
238
|
+
if (iri.startsWith("<") && iri.endsWith(">")) {
|
|
239
|
+
return iri;
|
|
240
|
+
}
|
|
241
|
+
const expandedIri = expandPrefix(iri);
|
|
242
|
+
return `<${expandedIri}>`;
|
|
243
|
+
}
|
|
244
|
+
export function parseEntityUri(entityUri) {
|
|
245
|
+
const compactedUri = compactUri(entityUri);
|
|
246
|
+
if (!compactedUri.includes(":")) {
|
|
247
|
+
return { prefix: "", name: compactedUri };
|
|
248
|
+
}
|
|
249
|
+
const [prefix, name] = compactedUri.split(":", 2);
|
|
250
|
+
return {
|
|
251
|
+
prefix: prefix || "manta",
|
|
252
|
+
name: name ?? compactedUri,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
export function formatEntityName(entityUri) {
|
|
256
|
+
const { name } = parseEntityUri(entityUri);
|
|
257
|
+
return name;
|
|
258
|
+
}
|
|
259
|
+
const makeNamespace = (prefix, terms) => createNamespace({
|
|
260
|
+
iri: namespaces[prefix],
|
|
261
|
+
prefix: `${prefix}:`,
|
|
262
|
+
terms: (terms ?? []),
|
|
263
|
+
});
|
|
264
|
+
export const m = makeNamespace("", [
|
|
265
|
+
"BlendedPerformanceDaily",
|
|
266
|
+
"CampaignChannelBenchmark",
|
|
267
|
+
"CampaignPerformanceSummary",
|
|
268
|
+
"CompanyKPISnapshot",
|
|
269
|
+
"ConversationStarter",
|
|
270
|
+
"MetaAd",
|
|
271
|
+
"MetaAdSet",
|
|
272
|
+
"MetaCampaign",
|
|
273
|
+
"Product",
|
|
274
|
+
"ProductProfitability",
|
|
275
|
+
"ProductSalesRanking",
|
|
276
|
+
"ProductVariant",
|
|
277
|
+
"assignee",
|
|
278
|
+
"budgetIncreaseFactor",
|
|
279
|
+
"changeSet",
|
|
280
|
+
"currentRoas",
|
|
281
|
+
"dailyBudget",
|
|
282
|
+
"integration",
|
|
283
|
+
"isManualAction",
|
|
284
|
+
"pauseReason",
|
|
285
|
+
"previousDailyBudget",
|
|
286
|
+
"priority",
|
|
287
|
+
"scaleReason",
|
|
288
|
+
"status",
|
|
289
|
+
"wastedSpend",
|
|
290
|
+
]);
|
|
291
|
+
export const rdf = makeNamespace("rdf", ["object", "predicate", "subject", "type"]);
|
|
292
|
+
export const rdfs = makeNamespace("rdfs");
|
|
293
|
+
export const schema = makeNamespace("schema");
|
|
294
|
+
export const xsd = makeNamespace("xsd");
|
|
295
|
+
export const meta = makeNamespace("meta", ["Campaign", "CampaignDailyCumulativeInsights"]);
|
|
296
|
+
export const shopify = makeNamespace("shopify");
|
|
297
|
+
export const google = makeNamespace("google");
|
|
298
|
+
export const ga4 = makeNamespace("ga4");
|
|
299
|
+
export const gmc = makeNamespace("gmc");
|
|
300
|
+
export const ghc = makeNamespace("ghc");
|
|
301
|
+
export const time = makeNamespace("time");
|
|
302
|
+
export const rdfox = makeNamespace("rdfox");
|
|
303
|
+
export const snap = makeNamespace("snap");
|
|
304
|
+
export const stripe = makeNamespace("stripe");
|
|
305
|
+
export const attio = makeNamespace("attio");
|
|
306
|
+
export const woo = makeNamespace("woo");
|
|
307
|
+
export const linkedin = makeNamespace("linkedin");
|
|
308
|
+
export const slack = makeNamespace("slack");
|
|
309
|
+
export const prov = makeNamespace("prov", ["Person", "SoftwareAgent"]);
|
|
310
|
+
export const klaviyo = makeNamespace("klaviyo");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function buildShaclShapeQuery(shapeIri: string): string;
|
|
2
|
+
export declare function buildShaclPropertyQuery(shapeIri: string, propertyIri: string): string;
|
|
3
|
+
export declare function buildShaclShapeSummaryQuery(shapeIri: string, propertyIri?: string): string;
|
|
4
|
+
//# sourceMappingURL=shacl-shape-query.d.ts.map
|
|
@@ -0,0 +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;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA0B1F"}
|