@piveau/dpi 0.2.0-alpha.58 → 0.2.0-alpha.59

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,99 +1,99 @@
1
1
  import { datasetResolvers as ee, defineJsonldResolver as te, dcatDatasetTransformer as re } from "@piveau/jsonld";
2
2
  import { useAsyncState as ie } from "@vueuse/core";
3
- import { isEmpty as oe } from "lodash-es";
4
- import { toRef as ae, ref as ne, toValue as k, computed as E, watch as N } from "vue";
3
+ import { isEmpty as ae } from "lodash-es";
4
+ import { toRef as oe, ref as ne, toValue as k, computed as E, watch as N } from "vue";
5
5
  function z(e) {
6
6
  return e == null ? [] : Array.isArray(e) ? e : [e];
7
7
  }
8
- function o(e) {
8
+ function a(e) {
9
9
  if (e != null)
10
10
  return Array.isArray(e) ? e[0] : e;
11
11
  }
12
- function u(e) {
12
+ function f(e) {
13
13
  return Array.isArray(e) ? e : e ? [e] : void 0;
14
14
  }
15
15
  function ce(e) {
16
16
  return Object.fromEntries(
17
17
  Object.entries(e).filter(
18
- ([r, t]) => t != null && !oe(t)
18
+ ([t, r]) => r != null && !ae(r)
19
19
  )
20
20
  );
21
21
  }
22
- function De(e, r) {
23
- const { enabled: t, hubSearchUrl: i } = r, n = ae(t), b = [...ee()].filter((s) => s.name !== "licence"), { safeTransform: l } = te({
22
+ function Te(e, t) {
23
+ const { enabled: r, hubSearchUrl: i } = t, o = oe(r), p = [...ee()].filter((s) => s.name !== "licence"), { safeTransform: l } = te({
24
24
  baseUrl: i,
25
- resolvers: b,
25
+ resolvers: p,
26
26
  transformer: re
27
- }), f = ne([]), {
27
+ }), u = ne([]), {
28
28
  state: g,
29
29
  isReady: h,
30
30
  isLoading: y,
31
- error: D,
31
+ error: v,
32
32
  execute: T
33
33
  } = ie(
34
34
  async () => {
35
- var w;
36
- if (!r.preprocess && !r.transform) {
35
+ var P;
36
+ if (!t.preprocess && !t.transform) {
37
37
  const c = await l(k(e));
38
38
  if (c.error)
39
- return f.value.push({
39
+ return u.value.push({
40
40
  code: "transform_failed",
41
41
  message: c.error.message
42
42
  }), null;
43
43
  const R = c.data;
44
- return (!R || !((w = R["dpi:isDPIv3"]) != null && w["@value"])) && f.value.push({
44
+ return (!R || !((P = R["dpi:isDPIv3"]) != null && P["@value"])) && u.value.push({
45
45
  code: "not_dpi_v3",
46
46
  message: `The dataset is not a DPI v3 dataset. ID ${R["@id"]}`
47
47
  }), {
48
- dpiData: ye(R, r.visibility || "public"),
48
+ dpiData: ye(R, t.visibility || "public"),
49
49
  data: R
50
50
  };
51
51
  }
52
- let B;
53
- if (r.preprocess)
52
+ let D;
53
+ if (t.preprocess)
54
54
  try {
55
- const c = await r.preprocess(k(e));
55
+ const c = await t.preprocess(k(e));
56
56
  if (c && typeof c == "object" && "error" in c && c.error)
57
- return f.value.push({
57
+ return u.value.push({
58
58
  code: "preprocess_failed",
59
59
  message: c.error.message || "Preprocess failed"
60
60
  }), null;
61
- B = c && typeof c == "object" && "data" in c ? c.data : c;
61
+ D = c && typeof c == "object" && "data" in c ? c.data : c;
62
62
  } catch (c) {
63
- return f.value.push({
63
+ return u.value.push({
64
64
  code: "preprocess_failed",
65
65
  message: (c == null ? void 0 : c.message) || String(c)
66
66
  }), null;
67
67
  }
68
68
  else
69
- B = k(e);
70
- if (!r.transform)
71
- return f.value.push({
69
+ D = k(e);
70
+ if (!t.transform)
71
+ return u.value.push({
72
72
  code: "missing_transform",
73
73
  message: "No transform function provided. Either supply a transform or omit both preprocess and transform to use the default DCAT dataset path."
74
74
  }), null;
75
- let P;
75
+ let A;
76
76
  try {
77
- const c = r.preprocess ? B : k(e);
78
- P = await r.transform(c);
77
+ const c = t.preprocess ? D : k(e);
78
+ A = await t.transform(c);
79
79
  } catch (c) {
80
- return f.value.push({
80
+ return u.value.push({
81
81
  code: "transform_apply_failed",
82
82
  message: (c == null ? void 0 : c.message) || String(c)
83
83
  }), null;
84
84
  }
85
85
  return {
86
- dpiData: P,
87
- data: B
86
+ dpiData: A,
87
+ data: D
88
88
  };
89
89
  },
90
90
  null,
91
91
  { immediate: !1 }
92
92
  ), L = E(
93
- () => n.value && !y.value && !!h.value
94
- ), v = E(
95
- () => n.value && !!L.value
96
- ), I = E(() => v.value), U = E(() => {
93
+ () => o.value && !y.value && !!h.value
94
+ ), B = E(
95
+ () => o.value && !!L.value
96
+ ), U = E(() => B.value), I = E(() => {
97
97
  var s;
98
98
  return (s = g.value) == null ? void 0 : s.dpiData;
99
99
  }), S = E(() => {
@@ -102,21 +102,21 @@ function De(e, r) {
102
102
  });
103
103
  return N(
104
104
  () => k(e),
105
- (s) => s && n.value ? T() : null
105
+ (s) => s && o.value ? T() : null
106
106
  ), N(S, (s) => {
107
107
  console.log("jsonld resolved result:", s);
108
- }), N(D, (s) => {
108
+ }), N(v, (s) => {
109
109
  console.log("jsonld error:", s);
110
110
  }), {
111
111
  processedInput: g,
112
112
  isProcessedInputReady: L,
113
- result: U,
114
- isMaterialized: v,
115
- isReady: I,
116
- errors: f
113
+ result: I,
114
+ isMaterialized: B,
115
+ isReady: U,
116
+ errors: u
117
117
  };
118
118
  }
119
- function p(e) {
119
+ function m(e) {
120
120
  if (typeof e == "string")
121
121
  return e;
122
122
  if (e && typeof e == "object") {
@@ -127,23 +127,23 @@ function p(e) {
127
127
  }
128
128
  return "";
129
129
  }
130
- function d(e, r = "de") {
130
+ function d(e, t = "de") {
131
131
  if (!e)
132
132
  return "";
133
133
  if (typeof e == "string")
134
134
  return e;
135
135
  if (typeof e == "object" && !Array.isArray(e) && !e["@value"] && !e["@id"])
136
- return e[r] || Object.values(e)[0] || "";
136
+ return e[t] || (e == null ? void 0 : e.en) || Object.values(e)[0] || "";
137
137
  if (Array.isArray(e)) {
138
- const t = e.find(
139
- (n) => n["@language"] === r
138
+ const r = e.find(
139
+ (o) => o["@language"] === t
140
140
  );
141
- if (t)
142
- return t["@value"] || "";
141
+ if (r)
142
+ return r["@value"] || "";
143
143
  const i = e[0];
144
- return (i == null ? void 0 : i["@value"]) || p(i) || "";
144
+ return (i == null ? void 0 : i["@value"]) || m(i) || "";
145
145
  }
146
- return e["@language"] && e["@value"] ? e["@value"] : p(e);
146
+ return e["@language"] && e["@value"] ? e["@value"] : m(e);
147
147
  }
148
148
  function q(e) {
149
149
  return {
@@ -151,11 +151,11 @@ function q(e) {
151
151
  label: e.label
152
152
  };
153
153
  }
154
- function _(e, r) {
155
- const t = e.prefLabel;
154
+ function V(e, t) {
155
+ const r = e.prefLabel;
156
156
  return q({
157
157
  uri: e["@id"] || e["purl:identifier"] || "",
158
- "@value": t ? d(t) : e["purl:identifier"] || ""
158
+ "@value": r ? d(r) : e["purl:identifier"] || ""
159
159
  });
160
160
  }
161
161
  function H(e) {
@@ -163,81 +163,81 @@ function H(e) {
163
163
  "@value": e
164
164
  } : e;
165
165
  }
166
- function F(e, r = !0) {
166
+ function F(e, t = !0) {
167
167
  return {
168
- isValid: r,
168
+ isValid: t,
169
169
  ...e
170
170
  };
171
171
  }
172
- function X(e, r = "de") {
172
+ function X(e, t = "de") {
173
173
  return e ? z(e).map((i) => typeof i == "string" ? F({
174
174
  "@value": i,
175
- "@language": r
175
+ "@language": t
176
176
  }) : i && typeof i == "object" ? i["@language"] && i["@value"] ? F({
177
177
  "@value": i["@value"],
178
178
  "@language": i["@language"]
179
179
  }) : F({
180
- "@value": p(i),
181
- "@language": r
180
+ "@value": m(i),
181
+ "@language": t
182
182
  }) : F({
183
183
  "@value": "",
184
- "@language": r
184
+ "@language": t
185
185
  })) : [];
186
186
  }
187
- function de(e, r) {
187
+ function de(e, t) {
188
188
  return e ? z(e).map(
189
189
  (i) => F({
190
- "@type": r,
191
- "@value": p(i)
190
+ "@type": t,
191
+ "@value": m(i)
192
192
  })
193
193
  ) : [];
194
194
  }
195
- function Y(e, r) {
196
- const t = { isValid: !0 };
197
- for (const [i, n] of Object.entries(r))
198
- t[i] = p(e == null ? void 0 : e[n]);
199
- return t;
195
+ function Y(e, t) {
196
+ const r = { isValid: !0 };
197
+ for (const [i, o] of Object.entries(t))
198
+ r[i] = m(e == null ? void 0 : e[o]);
199
+ return r;
200
200
  }
201
201
  function le(e) {
202
202
  return {
203
203
  happyFlowLandingPage: {}
204
204
  };
205
205
  }
206
- function se(e, r) {
207
- const t = {
206
+ function se(e, t) {
207
+ const r = {
208
208
  discoverabilityPage: [{ isValid: !0 }]
209
209
  };
210
210
  if (e["dcatap:hvdCategory"]) {
211
211
  const i = z(e["dcatap:hvdCategory"]).filter(Boolean);
212
- t.hvdPage = i == null ? void 0 : i.map((n) => ({
212
+ r.hvdPage = i == null ? void 0 : i.map((o) => ({
213
213
  isValid: !0,
214
- uri: n["@id"],
215
- label: d(n.prefLabel)
214
+ uri: o["@id"],
215
+ label: d(o.prefLabel)
216
216
  }));
217
217
  }
218
218
  if (e["dcat:theme"]) {
219
219
  const i = z(e["dcat:theme"]);
220
- t.discoverabilityPage = [
220
+ r.discoverabilityPage = [
221
221
  { isValid: !0 },
222
222
  ...i.map(
223
- (n) => F({
224
- id: p(n).split("/").pop(),
225
- uri: p(n),
226
- label: d(n.prefLabel)
223
+ (o) => F({
224
+ id: m(o).split("/").pop(),
225
+ uri: m(o),
226
+ label: d(o.prefLabel)
227
227
  })
228
228
  )
229
229
  ];
230
230
  }
231
- return r && (t.visibilityPage = [
231
+ return t && (r.visibilityPage = [
232
232
  {
233
233
  isValid: !0,
234
- visibility: r
234
+ visibility: t
235
235
  }
236
- ]), t;
236
+ ]), r;
237
237
  }
238
- function ue(e) {
238
+ function fe(e) {
239
239
  var i;
240
- const t = {
240
+ const r = {
241
241
  datasetID: ((i = e["@id"]) == null ? void 0 : i.split("/").pop()) || "",
242
242
  "dct:title": [],
243
243
  "dct:description": [],
@@ -245,15 +245,15 @@ function ue(e) {
245
245
  "dct:publisher": [],
246
246
  "dcat:contactPoint": []
247
247
  };
248
- if (e["dct:title"] && (t["dct:title"] = X(e["dct:title"])), e["dct:description"] && (t["dct:description"] = X(
248
+ if (e["dct:title"] && (r["dct:title"] = X(e["dct:title"])), e["dct:description"] && (r["dct:description"] = X(
249
249
  e["dct:description"]
250
- )), e["dct:modified"] && (t["dct:modified"] = de(
250
+ )), e["dct:modified"] && (r["dct:modified"] = de(
251
251
  e["dct:modified"],
252
252
  "http://www.w3.org/2001/XMLSchema#date"
253
253
  )), e["dct:publisher"]) {
254
- const n = o(e["dct:publisher"]);
255
- t["dct:publisher"] = [
256
- Y(n, {
254
+ const o = a(e["dct:publisher"]);
255
+ r["dct:publisher"] = [
256
+ Y(o, {
257
257
  "foaf:name": "foaf:name",
258
258
  "foaf:mbox": "foaf:mbox",
259
259
  "foaf:homepage": "foaf:homepage"
@@ -261,23 +261,23 @@ function ue(e) {
261
261
  ];
262
262
  }
263
263
  if (e["dcat:contactPoint"]) {
264
- const n = o(e["dcat:contactPoint"]);
265
- t["dcat:contactPoint"] = [
266
- Y(n, {
264
+ const o = a(e["dcat:contactPoint"]);
265
+ r["dcat:contactPoint"] = [
266
+ Y(o, {
267
267
  "vcard:fn": "vcard:fn",
268
268
  "vcard:hasEmail": "vcard:hasEmail",
269
269
  "vcard:hasTelephone": "vcard:hasTelephone"
270
270
  })
271
271
  ];
272
272
  }
273
- return t;
273
+ return r;
274
274
  }
275
- function fe(e) {
276
- var r, t;
275
+ function ue(e) {
276
+ var t, r;
277
277
  return {
278
- "dcatde:politicalGeocodingURI": (r = e["dcatapde:politicalGeocodingURI"]) == null ? void 0 : r.map((i) => {
279
- var f;
280
- const b = {
278
+ "dcatde:politicalGeocodingURI": (t = e["dcatapde:politicalGeocodingURI"]) == null ? void 0 : t.map((i) => {
279
+ var u;
280
+ const p = {
281
281
  districtKey: "Kreis",
282
282
  governmentDistrictKey: "Bezirk",
283
283
  municipalityKey: "Gemeindeschlüssel",
@@ -286,136 +286,137 @@ function fe(e) {
286
286
  regionalKey: "Regionalschlüssel"
287
287
  };
288
288
  let l = i["@id"].split("/").slice(-2, -1)[0];
289
- return l = b[l] || l, {
289
+ return l = p[l] || l, {
290
290
  isValid: !0,
291
291
  uri: i["@id"],
292
- id: ((f = i.prefLabel) == null ? void 0 : f.de) || i["@id"].split("/").pop(),
292
+ id: ((u = i.prefLabel) == null ? void 0 : u.de) || i["@id"].split("/").pop(),
293
293
  label: d(i.altLabel),
294
294
  inVoc: l
295
295
  };
296
296
  }),
297
- "dcat:temporalResolution": (t = e["dct:temporal"]) == null ? void 0 : t.reduce((i, n) => {
298
- const l = o(n["dcat:startDate"]), f = o(n["dcat:endDate"]), g = p(l) || "", h = p(f) || "", y = typeof l != "string" && (l == null ? void 0 : l["@type"]) === "http://www.w3.org/2001/XMLSchema#dateTime" ? "dateTime" : "date", D = y === "date" ? g : g.split("T")[0], T = y === "date" ? h : h.split("T")[0], L = y === "dateTime" ? g.split("T")[1] : "", v = y === "dateTime" ? h.split("T")[1] : "";
297
+ "dcat:temporalResolution": (r = e["dct:temporal"]) == null ? void 0 : r.reduce((i, o) => {
298
+ const l = a(o["dcat:startDate"]), u = a(o["dcat:endDate"]), g = m(l) || "", h = m(u) || "", y = typeof l != "string" && (l == null ? void 0 : l["@type"]) === "http://www.w3.org/2001/XMLSchema#dateTime" ? "dateTime" : "date", v = y === "date" ? g : g.split("T")[0], T = y === "date" ? h : h.split("T")[0], L = y === "dateTime" ? g.split("T")[1] : "", B = y === "dateTime" ? h.split("T")[1] : "";
299
299
  return {
300
300
  isValid: !0,
301
301
  type: "dct:PeriodOfTime",
302
302
  "dct:temporal": [
303
303
  {
304
304
  dataType: y,
305
- "dcat:startDate": D,
305
+ "dcat:startDate": v,
306
306
  "dcat:endDate": T,
307
307
  startTime: L || "",
308
- endTime: v || ""
308
+ endTime: B || ""
309
309
  }
310
310
  ]
311
311
  };
312
312
  }, {})
313
313
  };
314
314
  }
315
- function pe(e, r) {
316
- var i, n, b, l, f, g, h, y, D, T, L, v, I, U, S, s, B, P, w, c, R, V, M, j, G;
315
+ function pe(e, t) {
316
+ var i, o, p, l, u, g, h, y, v, T, L, B, U, I, S, s, D, A, P, c, R, x, M, j, G;
317
317
  if (!e)
318
318
  return {};
319
- const t = o(e["spdx:checksum"]);
319
+ const r = a(e["spdx:checksum"]);
320
320
  return {
321
321
  isValid: !0,
322
- id: r + 1,
323
- "dcat:accessURL": p(o(e["dcat:accessURL"])) || "",
324
- "dcat:downloadURL": ((i = e["dcat:downloadURL"]) == null ? void 0 : i.map((m) => ({
325
- "@id": p(m)
322
+ id: t + 1,
323
+ "dcat:accessURL": m(a(e["dcat:accessURL"])) || "",
324
+ "dcat:downloadURL": ((i = e["dcat:downloadURL"]) == null ? void 0 : i.map((b) => ({
325
+ "@id": m(b)
326
326
  }))) || [{ "@id": "" }],
327
327
  "dct:format": {
328
328
  // redundancy in label and title for better compatibility
329
- label: ((n = o(e["dct:format"])) == null ? void 0 : n["purl:identifier"]) || "",
330
- title: ((b = o(e["dct:format"])) == null ? void 0 : b["purl:identifier"]) || "",
331
- uri: ((l = o(e["dct:format"])) == null ? void 0 : l["@id"]) || ""
329
+ label: ((o = a(e["dct:format"])) == null ? void 0 : o["purl:identifier"]) || "",
330
+ title: ((p = a(e["dct:format"])) == null ? void 0 : p["purl:identifier"]) || "",
331
+ uri: ((l = a(e["dct:format"])) == null ? void 0 : l["@id"]) || ""
332
332
  },
333
333
  "dct:title": d(e["dct:title"]),
334
334
  "dct:description": d(e["dct:description"]),
335
- "dct:modified": p(o(e["dct:modified"])),
336
- "dct:issued": p(o(e["dct:issued"])),
337
- "dcat:byteSize": p(o(e["dcat:byteSize"])),
335
+ "dct:modified": m(a(e["dct:modified"])),
336
+ "dct:issued": m(a(e["dct:issued"])),
337
+ "dcat:byteSize": m(a(e["dcat:byteSize"])),
338
338
  "dcatde:licenseAttributionByText": d(e["dcatapde:licenseAttributionByText"]) || "",
339
339
  "dct:license": e["dct:license"] ? {
340
340
  isValid: !0,
341
- uri: ((f = o(e["dct:license"])) == null ? void 0 : f["@id"]) || "",
341
+ uri: ((u = a(e["dct:license"])) == null ? void 0 : u["@id"]) || "",
342
342
  "dcterms:license": d(
343
- (g = o(e["dct:license"])) == null ? void 0 : g.altLabel
343
+ (g = a(e["dct:license"])) == null ? void 0 : g.altLabel
344
344
  ) || "",
345
345
  label: d(
346
- (h = o(e["dct:license"])) == null ? void 0 : h.prefLabel
346
+ (h = a(e["dct:license"])) == null ? void 0 : h.prefLabel
347
347
  ) || "",
348
348
  title: d(e["dcatapde:licenseAttributionByText"]) || ""
349
349
  } : {},
350
- "dct:accessRights": e["dct:accessRights"] ? o({
351
- uri: ((y = o(e["dct:accessRights"])) == null ? void 0 : y["@id"]) || "",
352
- label: ((D = o(e["dct:accessRights"])) == null ? void 0 : D.prefLabel) || { de: "" }
350
+ "dct:accessRights": e["dct:accessRights"] ? a({
351
+ uri: ((y = a(e["dct:accessRights"])) == null ? void 0 : y["@id"]) || "",
352
+ label: ((v = a(e["dct:accessRights"])) == null ? void 0 : v.prefLabel) || { de: "" }
353
353
  }) : {},
354
354
  "dcatap:availability": {
355
355
  // Redundant label and title for better compatibility
356
- label: ((T = o(e["dcatap:availability"])) == null ? void 0 : T.prefLabel) || "",
357
- title: ((L = o(e["dcatap:availability"])) == null ? void 0 : L.prefLabel) || "",
358
- uri: ((v = o(e["dcatap:availability"])) == null ? void 0 : v["@id"]) || ""
356
+ label: ((T = a(e["dcatap:availability"])) == null ? void 0 : T.prefLabel) || "",
357
+ title: ((L = a(e["dcatap:availability"])) == null ? void 0 : L.prefLabel) || "",
358
+ uri: ((B = a(e["dcatap:availability"])) == null ? void 0 : B["@id"]) || ""
359
359
  },
360
- "dct:language": ((I = e["dct:language"]) == null ? void 0 : I.map((m) => _(m)).filter(Boolean)) || [],
360
+ "dct:language": ((U = e["dct:language"]) == null ? void 0 : U.map((b) => V(b)).filter(Boolean)) || [],
361
361
  "dcat:mediaType": q({
362
362
  label: d(
363
- (U = o(e["dcat:mediaType"])) == null ? void 0 : U.prefLabel
363
+ (I = a(e["dcat:mediaType"])) == null ? void 0 : I.prefLabel
364
364
  ) || "",
365
- uri: ((S = o(e["dcat:mediaType"])) == null ? void 0 : S["@id"]) || ""
365
+ uri: ((S = a(e["dcat:mediaType"])) == null ? void 0 : S["@id"]) || ""
366
366
  }),
367
367
  "dcat:compressFormat": q({
368
368
  label: d(
369
- (s = o(e["dcat:compressFormat"])) == null ? void 0 : s.prefLabel
369
+ (s = a(e["dcat:compressFormat"])) == null ? void 0 : s.prefLabel
370
370
  ) || "",
371
- uri: ((B = o(e["dcat:compressFormat"])) == null ? void 0 : B["@id"]) || ""
371
+ uri: ((D = a(e["dcat:compressFormat"])) == null ? void 0 : D["@id"]) || ""
372
372
  }),
373
373
  "dcat:packageFormat": q({
374
374
  label: d(
375
- (P = o(e["dcat:packageFormat"])) == null ? void 0 : P.prefLabel
375
+ (A = a(e["dcat:packageFormat"])) == null ? void 0 : A.prefLabel
376
376
  ) || "",
377
- uri: ((w = o(e["dcat:packageFormat"])) == null ? void 0 : w["@id"]) || ""
377
+ uri: ((P = a(e["dcat:packageFormat"])) == null ? void 0 : P["@id"]) || ""
378
378
  }),
379
379
  "adms:status": {
380
- uri: ((c = o(e["adms:status"])) == null ? void 0 : c["@id"]) || "",
381
- "@value": d((R = o(e["adms:status"])) == null ? void 0 : R.prefLabel) || ""
380
+ uri: ((c = a(e["adms:status"])) == null ? void 0 : c["@id"]) || "",
381
+ "@value": d((R = a(e["adms:status"])) == null ? void 0 : R.prefLabel) || ""
382
382
  },
383
383
  checksum: {
384
- title: p(o(t == null ? void 0 : t["spdx:checksumValue"])),
385
- "spdx:checksum": ((V = p(o(t == null ? void 0 : t["spdx:algorithm"]))) == null ? void 0 : V.split("_").pop()) || "",
386
- uri: (M = p(
387
- o(t == null ? void 0 : t["spdx:algorithm"])
384
+ title: m(a(r == null ? void 0 : r["spdx:checksumValue"])),
385
+ "spdx:checksum": ((x = m(a(r == null ? void 0 : r["spdx:algorithm"]))) == null ? void 0 : x.split("_").pop()) || "",
386
+ uri: (M = m(
387
+ a(r == null ? void 0 : r["spdx:algorithm"])
388
388
  )) == null ? void 0 : M.replace("spdx:", "http://spdx.org/rdf/terms#")
389
389
  },
390
390
  accessServices: he(e["dcat:accessService"] || []),
391
- conformsToItems: (j = e["dct:conformsTo"]) == null ? void 0 : j.map((m, x) => ({
391
+ conformsToItems: (j = e["dct:conformsTo"]) == null ? void 0 : j.map((b, _) => ({
392
392
  // for some reason dct:conformsTo is different from the one on dcat:dataset level
393
- id: x + 1,
394
- "dcat:accessURL": m["@id"],
395
- "dct:title": d(m["rdfs:label"]) || "",
396
- "dcat:downloadURL": m["@id"],
393
+ id: _ + 1,
394
+ "dcat:accessURL": b["@id"],
395
+ "dct:title": d(b["rdfs:label"]) || "",
396
+ "dcat:downloadURL": b["@id"],
397
397
  // redundancy to match properties on dcat:dataset level
398
- "rdfs:label": d(m["rdfs:label"]) || "",
399
- uri: m["@id"]
398
+ "rdfs:label": d(b["rdfs:label"]) || "",
399
+ uri: b["@id"]
400
400
  })).filter(Boolean),
401
- policyItems: ((G = e["odrl:hasPolicy"]) == null ? void 0 : G.map((m, x) => ({
401
+ policyItems: ((G = e["odrl:hasPolicy"]) == null ? void 0 : G.map((b, _) => ({
402
402
  // don't ask
403
- id: x + 1,
404
- "dcat:downloadURL": m["@id"],
405
- "dcat:accessURL": m["@id"]
406
- }))) || [{ id: 1, "dcat:downloadURL": "", "dcat:accessURL": "" }]
403
+ id: _ + 1,
404
+ "dcat:downloadURL": b["@id"],
405
+ "dcat:accessURL": b["@id"]
406
+ }))) || [{ id: 1, "dcat:downloadURL": "", "dcat:accessURL": "" }],
407
+ documentations: Re(e["foaf:page"] || [])
407
408
  };
408
409
  }
409
410
  function me(e) {
410
- var t, i;
411
- const r = {
411
+ var r, i;
412
+ const t = {
412
413
  "dcat:distribution": []
413
414
  };
414
- if (r["dct:license"] = [(i = (t = r["dcat:distribution"]) == null ? void 0 : t[0]) == null ? void 0 : i["dct:license"]], e["dcat:distribution"]) {
415
- const n = z(e["dcat:distribution"]);
416
- r["dcat:distribution"] = n.map((b, l) => pe(b, l)).filter((b) => Object.keys(b).length > 0);
415
+ if (t["dct:license"] = [(i = (r = t["dcat:distribution"]) == null ? void 0 : r[0]) == null ? void 0 : i["dct:license"]], e["dcat:distribution"]) {
416
+ const o = z(e["dcat:distribution"]);
417
+ t["dcat:distribution"] = o.map((p, l) => pe(p, l)).filter((p) => Object.keys(p).length > 0);
417
418
  }
418
- return console.log(r), r;
419
+ return console.log(t), t;
419
420
  }
420
421
  function be(e) {
421
422
  return {
@@ -423,28 +424,28 @@ function be(e) {
423
424
  };
424
425
  }
425
426
  function ge(e) {
426
- var t, i, n, b, l, f, g, h, y, D, T, L, v, I, U, S, s, B, P, w, c, R, V, M, j, G, m, x;
427
- const r = {
428
- "dct:language": (t = e["dct:language"]) == null ? void 0 : t.map((a) => _(a)).filter(Boolean),
429
- "dcatde:politicalGeocodingLevelURI": (i = e["dcatapde:politicalGeocodingLevelURI"]) == null ? void 0 : i.map((a) => ({
430
- uri: a["@id"],
431
- "@value": d(a.prefLabel)
427
+ var r, i, o, p, l, u, g, h, y, v, T, L, B, U, I, S, s, D, A, P, c, R, x, M, j, G, b, _;
428
+ const t = {
429
+ "dct:language": (r = e["dct:language"]) == null ? void 0 : r.map((n) => V(n)).filter(Boolean),
430
+ "dcatde:politicalGeocodingLevelURI": (i = e["dcatapde:politicalGeocodingLevelURI"]) == null ? void 0 : i.map((n) => ({
431
+ uri: n["@id"],
432
+ "@value": d(n.prefLabel)
432
433
  })),
433
- "dct:conformsTo": (n = e["dct:conformsTo"]) == null ? void 0 : n.map((a) => ({
434
- "rdfs:label": d(a["rdfs:label"]) || "",
435
- "@id": a["@id"]
434
+ "dct:conformsTo": (o = e["dct:conformsTo"]) == null ? void 0 : o.map((n) => ({
435
+ "rdfs:label": d(n["rdfs:label"]) || "",
436
+ "@id": n["@id"]
436
437
  })).filter(Boolean),
437
- "dct:accessRights": e["dct:accessRights"] ? u(_(e["dct:accessRights"])) : [],
438
+ "dct:accessRights": e["dct:accessRights"] ? f(V(e["dct:accessRights"])) : [],
438
439
  "dct:issued": z(e["dct:issued"]),
439
- "dct:provenance": (b = e["dct:provenance"]) == null ? void 0 : b.map((a) => ({
440
- "rdfs:label": d(a["rdfs:label"]) || "",
441
- uri: a["@id"]
440
+ "dct:provenance": (p = e["dct:provenance"]) == null ? void 0 : p.map((n) => ({
441
+ "rdfs:label": d(n["rdfs:label"]) || "",
442
+ uri: n["@id"]
442
443
  })).filter(Boolean),
443
- "dct:accrualPeriodicity": e["dct:accrualPeriodicity"] ? u(_(e["dct:accrualPeriodicity"])) : [],
444
- "dct:type": (l = e["dct:type"]) == null ? void 0 : l.map((a) => _(a)).filter(Boolean),
445
- "dcat:spatialResolutionInMeters": ((f = e["dcat:spatialResolutionInMeters"]) == null ? void 0 : f.map(H)) || void 0,
446
- "dcat:temporalResolution": e["dcat:temporalResolution"] ? e["dcat:temporalResolution"].map(H).map((a) => {
447
- const O = a["@value"].match(
444
+ "dct:accrualPeriodicity": e["dct:accrualPeriodicity"] ? f(V(e["dct:accrualPeriodicity"])) : [],
445
+ "dct:type": (l = e["dct:type"]) == null ? void 0 : l.map((n) => V(n)).filter(Boolean),
446
+ "dcat:spatialResolutionInMeters": ((u = e["dcat:spatialResolutionInMeters"]) == null ? void 0 : u.map(H)) || void 0,
447
+ "dcat:temporalResolution": e["dcat:temporalResolution"] ? e["dcat:temporalResolution"].map(H).map((n) => {
448
+ const O = n["@value"].match(
448
449
  /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/
449
450
  );
450
451
  if (O) {
@@ -461,105 +462,120 @@ function ge(e) {
461
462
  ];
462
463
  }
463
464
  }).filter(Boolean).flat() : void 0,
464
- "dcat:qualifiedRelation": (g = u(
465
+ "dcat:qualifiedRelation": (g = f(
465
466
  e["dcat:qualifiedRelation"]
466
467
  )) == null ? void 0 : g.filter(Boolean),
467
- "dct:creator": (h = u(e["dct:creator"])) == null ? void 0 : h.filter(Boolean),
468
- "dct:contributor": (y = u(e["dct:contributor"])) == null ? void 0 : y.filter(Boolean),
469
- "dcatde:contributorID": (D = e["dcatapde:contributorID"]) == null ? void 0 : D.map((a) => _(a)).filter(Boolean),
470
- "dcatde:geocodingDescription": (T = u(
468
+ "dct:creator": (h = f(e["dct:creator"])) == null ? void 0 : h.filter(Boolean),
469
+ "dct:contributor": (y = f(e["dct:contributor"])) == null ? void 0 : y.filter(Boolean),
470
+ "dcatde:contributorID": (v = e["dcatapde:contributorID"]) == null ? void 0 : v.map((n) => V(n)).filter(Boolean),
471
+ "dcatde:geocodingDescription": (T = f(
471
472
  e["dcatapde:geocodingDescription"]
472
473
  )) == null ? void 0 : T.filter(Boolean),
473
- "dct:identifier": (L = e["dct:identifier"]) == null ? void 0 : L.map((a) => ({
474
- "@value": a
474
+ "dct:identifier": (L = e["dct:identifier"]) == null ? void 0 : L.map((n) => ({
475
+ "@value": n
475
476
  })),
476
- "adms:identifier": (v = u(e["adms:identifier"])) == null ? void 0 : v.filter(Boolean),
477
- "owl:versionInfo": (I = e["owl:versionInfo"]) == null ? void 0 : I.map((a) => ({
478
- "@value": a
477
+ "adms:identifier": (B = f(e["adms:identifier"])) == null ? void 0 : B.filter(Boolean),
478
+ "owl:versionInfo": (U = e["owl:versionInfo"]) == null ? void 0 : U.map((n) => ({
479
+ "@value": n
479
480
  })),
480
481
  "adms:versionNotes": e["adms:versionNotes"],
481
- "dcatde:legalBasis": (U = u(e["dcatapde:legalBasis"])) == null ? void 0 : U.filter(
482
+ "dcatde:legalBasis": (I = f(e["dcatapde:legalBasis"])) == null ? void 0 : I.filter(
482
483
  Boolean
483
484
  ),
484
- "dct:relation": (S = u(e["dct:relation"])) == null ? void 0 : S.filter(Boolean),
485
- "dcat:landingPage": (s = u(e["dcat:landingPage"])) == null ? void 0 : s.filter(
485
+ "dct:relation": (S = f(e["dct:relation"])) == null ? void 0 : S.filter(Boolean),
486
+ "dcat:landingPage": (s = f(e["dcat:landingPage"])) == null ? void 0 : s.filter(
486
487
  Boolean
487
488
  ),
488
- "prov:wasGeneratedBy": (B = u(e["prov:wasGeneratedBy"])) == null ? void 0 : B.filter(
489
+ "prov:wasGeneratedBy": (D = f(e["prov:wasGeneratedBy"])) == null ? void 0 : D.filter(
489
490
  Boolean
490
491
  ),
491
- "dct:isReferencedBy": (P = u(e["dct:isReferencedBy"])) == null ? void 0 : P.filter(
492
+ "dct:isReferencedBy": (A = f(e["dct:isReferencedBy"])) == null ? void 0 : A.filter(
492
493
  Boolean
493
494
  ),
494
- "dct:source": (w = u(e["dct:source"])) == null ? void 0 : w.filter(Boolean),
495
- "dct:hasVersion": (c = u(e["dct:hasVersion"])) == null ? void 0 : c.filter(Boolean),
496
- "dct:isVersionOf": (R = u(e["dct:isVersionOf"])) == null ? void 0 : R.filter(Boolean),
497
- "prov:qualifiedAttribution": (V = u(
495
+ "dct:source": (P = f(e["dct:source"])) == null ? void 0 : P.filter(Boolean),
496
+ "dct:hasVersion": (c = f(e["dct:hasVersion"])) == null ? void 0 : c.filter(Boolean),
497
+ "dct:isVersionOf": (R = f(e["dct:isVersionOf"])) == null ? void 0 : R.filter(Boolean),
498
+ "prov:qualifiedAttribution": (x = f(
498
499
  e["prov:qualifiedAttribution"]
499
- )) == null ? void 0 : V.filter(Boolean),
500
- "dcat:keyword": (M = u(e["dcat:keyword"])) == null ? void 0 : M.filter(Boolean),
501
- "dct:spatial": (j = u(e["dct:spatial"])) == null ? void 0 : j.filter((a) => a ? !a["@id"].startsWith(
500
+ )) == null ? void 0 : x.filter(Boolean),
501
+ "dcat:keyword": (M = f(e["dcat:keyword"])) == null ? void 0 : M.filter(Boolean),
502
+ "dct:spatial": (j = f(e["dct:spatial"])) == null ? void 0 : j.filter((n) => n ? !n["@id"].startsWith(
502
503
  "http://dcat-ap.de/def/politicalGeocoding/"
503
504
  ) : !1).filter(Boolean),
504
- "dct:references": (G = u(e["dct:references"])) == null ? void 0 : G.filter(Boolean),
505
- "foaf:page": (m = u(e["foaf:page"])) == null ? void 0 : m.filter(Boolean).map((a) => {
506
- if (!a)
505
+ "dct:references": (G = f(e["dct:references"])) == null ? void 0 : G.filter(Boolean),
506
+ "foaf:page": (b = f(e["foaf:page"])) == null ? void 0 : b.filter(Boolean).map((n) => {
507
+ if (!n)
507
508
  return;
508
- const A = o(a["dct:format"]);
509
+ const w = a(n["dct:format"]);
509
510
  return {
510
- "dct:title": o(a["dct:title"]),
511
- "dct:description": o(a["dct:description"]),
512
- "@value": A ? d(A.prefLabel) : "",
513
- uri: A ? A["@id"] : "",
514
- "foaf:homepage": o(a["foaf:homepage"]) || ""
511
+ "dct:title": a(n["dct:title"]),
512
+ "dct:description": a(n["dct:description"]),
513
+ "@value": w ? d(w.prefLabel) : "",
514
+ uri: w ? w["@id"] : "",
515
+ "foaf:homepage": a(n["foaf:homepage"]) || ""
515
516
  };
516
517
  }),
517
- "dcatap:availability": (x = e["dcatap:availability"]) == null ? void 0 : x.map(
518
- (a) => {
519
- var A, O, K, C;
518
+ "dcatap:availability": (_ = e["dcatap:availability"]) == null ? void 0 : _.map(
519
+ (n) => {
520
+ var w, O, K, C;
520
521
  return {
521
522
  // Redundant label and title for better compatibility
522
- label: ((A = o(a)) == null ? void 0 : A.prefLabel) || "",
523
- title: ((O = o(a)) == null ? void 0 : O.prefLabel) || "",
524
- uri: ((K = o(a)) == null ? void 0 : K["@id"]) || "",
525
- "@value": d((C = o(a)) == null ? void 0 : C.prefLabel) || ""
523
+ label: ((w = a(n)) == null ? void 0 : w.prefLabel) || "",
524
+ title: ((O = a(n)) == null ? void 0 : O.prefLabel) || "",
525
+ uri: ((K = a(n)) == null ? void 0 : K["@id"]) || "",
526
+ "@value": d((C = a(n)) == null ? void 0 : C.prefLabel) || ""
526
527
  };
527
528
  }
528
529
  )
529
530
  };
530
- return ce(r);
531
+ return ce(t);
531
532
  }
532
- function ye(e, r) {
533
+ function ye(e, t) {
533
534
  return {
534
535
  Landing: le(),
535
- Discoverability: se(e, r),
536
- BasicInfos: ue(e),
537
- Covering: fe(e),
536
+ Discoverability: se(e, t),
537
+ BasicInfos: fe(e),
538
+ Covering: ue(e),
538
539
  DistributionSimple: me(e),
539
540
  ReviewAndPublish: be(),
540
541
  Additionals: ge(e)
541
542
  };
542
543
  }
543
544
  function he(e) {
544
- return !e || !Array.isArray(e) || e.length === 0 ? [] : e.map((r, t) => {
545
- var i, n;
545
+ return !e || !Array.isArray(e) || e.length === 0 ? [] : e.map((t, r) => {
546
+ var i, o;
547
+ return {
548
+ id: r + 1,
549
+ "dcat:downloadURL": ((i = a(t["dcat:endpointURL"])) == null ? void 0 : i["@id"]) || "",
550
+ "dcat:endpointURL": ((o = a(t["dcat:endpointURL"])) == null ? void 0 : o["@id"]) || "",
551
+ "dct:description": d(t["dct:description"]) || "",
552
+ "dct:title": d(t["dct:title"]) || ""
553
+ };
554
+ });
555
+ }
556
+ function Re(e) {
557
+ return !e || !Array.isArray(e) || e.length === 0 ? [] : e.map((t, r) => {
558
+ var i, o, p;
546
559
  return {
547
- id: t + 1,
548
- "dcat:downloadURL": ((i = o(r["dcat:endpointURL"])) == null ? void 0 : i["@id"]) || "",
549
- "dcat:endpointURL": ((n = o(r["dcat:endpointURL"])) == null ? void 0 : n["@id"]) || "",
550
- "dct:description": d(r["dct:description"]) || "",
551
- "dct:title": d(r["dct:title"]) || ""
560
+ id: r + 1,
561
+ "dcat:downloadURL": ((i = a(t["dcat:accessURL"])) == null ? void 0 : i["@id"]) || "",
562
+ "dcat:accessURL": ((o = a(t["dcat:accessURL"])) == null ? void 0 : o["@id"]) || "",
563
+ "dct:description": d(t["dct:description"]) || "",
564
+ "dct:title": d(t["dct:title"]) || "",
565
+ "dct:format": t["dct:format"] ? d(a(t["dct:format"]).prefLabel) : "",
566
+ formatUri: t["dct:format"] && ((p = V(a(t["dct:format"]))) == null ? void 0 : p.uri) || ""
552
567
  };
553
568
  });
554
569
  }
555
570
  export {
556
- u as asSomeArray,
571
+ f as asSomeArray,
557
572
  d as extractLocalizedString,
558
- p as extractStringValue,
559
- o as getFirstItem,
573
+ m as extractStringValue,
574
+ a as getFirstItem,
560
575
  z as normalizeToArray,
561
576
  ce as purgeNullishAndEmptyProperties,
562
577
  he as toAccessService,
578
+ Re as toDocument,
563
579
  ye as toDpi,
564
- De as useDpiSimpleLoader
580
+ Te as useDpiSimpleLoader
565
581
  };