@piveau/dpi 0.2.0-alpha.64 → 0.2.0-alpha.65
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,90 +1,89 @@
|
|
|
1
|
-
import { pipe as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { schemaProject as
|
|
5
|
-
import { getFirstItem as
|
|
6
|
-
import { isNonNullable as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (!r)
|
|
1
|
+
import { pipe as N } from "effect";
|
|
2
|
+
import * as u from "effect/Option";
|
|
3
|
+
import * as H from "jsonld";
|
|
4
|
+
import { schemaProject as _ } from "../../schema/projectLdSchema.js";
|
|
5
|
+
import { getFirstItem as z, extractStringValue as t, extractLocalizedString as G } from "../useDpiSimpleLoader.js";
|
|
6
|
+
import { isNonNullable as m } from "./encodeProject.js";
|
|
7
|
+
import { PREFIXES as M, nonEmpty as S } from "./shared.js";
|
|
8
|
+
function E(n) {
|
|
9
|
+
const i = (n || "").trim();
|
|
10
|
+
if (!i)
|
|
12
11
|
return "";
|
|
13
12
|
try {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
13
|
+
const r = new URL(i).pathname.split("/").filter(Boolean);
|
|
14
|
+
return r[r.length - 1] || "";
|
|
16
15
|
} catch {
|
|
17
|
-
return
|
|
16
|
+
return i;
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
async function
|
|
21
|
-
const
|
|
22
|
-
"@context":
|
|
19
|
+
async function $(n) {
|
|
20
|
+
const i = {
|
|
21
|
+
"@context": M,
|
|
23
22
|
"@type": "schema:Project"
|
|
24
|
-
},
|
|
23
|
+
}, a = await H.frame(n, i, {
|
|
25
24
|
embed: "@always",
|
|
26
25
|
omitGraph: !0
|
|
27
|
-
}),
|
|
26
|
+
}), r = await H.compact(a, M, {
|
|
28
27
|
compactArrays: !1,
|
|
29
28
|
graph: !1
|
|
30
|
-
}),
|
|
31
|
-
if (!
|
|
29
|
+
}), c = _.safeParse(z(r == null ? void 0 : r["@graph"]));
|
|
30
|
+
if (!c.success)
|
|
32
31
|
throw new Error(`Failed to parse project
|
|
33
32
|
|
|
34
|
-
${
|
|
35
|
-
return
|
|
33
|
+
${c.error.message}`);
|
|
34
|
+
return c.data;
|
|
36
35
|
}
|
|
37
|
-
function
|
|
38
|
-
return S(
|
|
36
|
+
function q(n) {
|
|
37
|
+
return S(z(n["@id"]));
|
|
39
38
|
}
|
|
40
|
-
function
|
|
41
|
-
var
|
|
42
|
-
const { visibility:
|
|
39
|
+
function U(n, i) {
|
|
40
|
+
var r, c;
|
|
41
|
+
const { visibility: a } = i;
|
|
43
42
|
return {
|
|
44
43
|
"Auffindbarkeit/Sichtbarkeit": {
|
|
45
|
-
visibility:
|
|
44
|
+
visibility: a
|
|
46
45
|
},
|
|
47
46
|
"Auffindbarkeit/Kategorien": {
|
|
48
|
-
categories: ((
|
|
47
|
+
categories: ((r = n["dcat:theme"]) == null ? void 0 : r.map(q).filter(m)) || []
|
|
49
48
|
},
|
|
50
49
|
"Auffindbarkeit/Anwendungsbereiche": {
|
|
51
|
-
applications: ((
|
|
50
|
+
applications: ((c = n["schema:application"]) == null ? void 0 : c.filter(m)) || []
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
|
-
function
|
|
56
|
-
var
|
|
57
|
-
const
|
|
58
|
-
name: S(t(
|
|
59
|
-
mail: S(t(
|
|
60
|
-
phone: S(t(
|
|
61
|
-
})).filter(
|
|
54
|
+
function R(n) {
|
|
55
|
+
var a;
|
|
56
|
+
const i = (a = n["dcat:contactPoint"]) == null ? void 0 : a.map((r) => ({
|
|
57
|
+
name: S(t(r["vcard:fn"])),
|
|
58
|
+
mail: S(t(r["vcard:hasEmail"])),
|
|
59
|
+
phone: S(t(r["vcard:hasTelephone"]))
|
|
60
|
+
})).filter(m);
|
|
62
61
|
return {
|
|
63
62
|
"Grundlegende Informationen/Name": {
|
|
64
|
-
projectName:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
projectName: N(
|
|
64
|
+
u.fromNullable(G(n["dct:title"], "de")),
|
|
65
|
+
u.flatMap((r) => S(r) ? u.some(r) : u.none()),
|
|
66
|
+
u.getOrThrowWith(() => new Error("Project name is missing"))
|
|
68
67
|
)
|
|
69
68
|
},
|
|
70
69
|
"Grundlegende Informationen/Beschreibung": {
|
|
71
|
-
projectDescription:
|
|
72
|
-
|
|
70
|
+
projectDescription: N(
|
|
71
|
+
u.fromNullable(G(n["dct:description"], "de")),
|
|
73
72
|
// O.flatMap(s => nonEmpty(s) ? O.some(s) : O.none()),
|
|
74
73
|
// O.getOrThrowWith(() => new Error('Project description is missing')),
|
|
75
|
-
|
|
74
|
+
u.getOrElse(() => "")
|
|
76
75
|
)
|
|
77
76
|
},
|
|
78
77
|
"Grundlegende Informationen/Projektstatus": {
|
|
79
|
-
projectName:
|
|
80
|
-
|
|
78
|
+
projectName: N(
|
|
79
|
+
u.fromNullable(n["schema:status"]),
|
|
81
80
|
// O.flatMap(s => nonEmpty(s) ? O.some(s) : O.none()),
|
|
82
81
|
// O.getOrThrowWith(() => new Error('Project status is missing')),
|
|
83
|
-
|
|
82
|
+
u.getOrElse(() => "")
|
|
84
83
|
)
|
|
85
84
|
},
|
|
86
85
|
"Grundlegende Informationen/Organisation": {
|
|
87
|
-
contact:
|
|
86
|
+
contact: z(i || []) || {
|
|
88
87
|
name: "",
|
|
89
88
|
mail: "",
|
|
90
89
|
phone: ""
|
|
@@ -92,66 +91,62 @@ function X(n) {
|
|
|
92
91
|
}
|
|
93
92
|
};
|
|
94
93
|
}
|
|
95
|
-
function
|
|
96
|
-
var
|
|
94
|
+
function V(n) {
|
|
95
|
+
var i, a, r, c, h, P, v, o;
|
|
97
96
|
return {
|
|
98
97
|
"Optionale Daten": {
|
|
99
|
-
partners: ((
|
|
100
|
-
name: t(
|
|
101
|
-
url: t(
|
|
102
|
-
})).filter(
|
|
103
|
-
requiredExpertise: ((
|
|
104
|
-
references: ((
|
|
105
|
-
homepage: t(
|
|
106
|
-
})).filter(
|
|
98
|
+
partners: ((i = n["dct:contributor"]) == null ? void 0 : i.map((l) => ({
|
|
99
|
+
name: t(l["foaf:name"]),
|
|
100
|
+
url: t(l["foaf:homepage"])
|
|
101
|
+
})).filter(m)) || [],
|
|
102
|
+
requiredExpertise: ((a = n["schema:skills"]) == null ? void 0 : a.map(t).filter(m)) || [],
|
|
103
|
+
references: ((c = (r = n["dct:references"]) == null ? void 0 : r.filter((l) => l["dct:type"] === "image")) == null ? void 0 : c.map((l) => ({
|
|
104
|
+
homepage: t(l["schema:url"])
|
|
105
|
+
})).filter(m)) || [],
|
|
107
106
|
startDate: t(n["schema:startDate"] || ""),
|
|
108
107
|
endDate: t(n["schema:endDate"] || ""),
|
|
109
|
-
budget: t(((
|
|
110
|
-
budgetDescription: t(((
|
|
108
|
+
budget: t(((h = n["schema:amount"]) == null ? void 0 : h["schema:value"]) || ""),
|
|
109
|
+
budgetDescription: t(((P = n["schema:amount"]) == null ? void 0 : P["schema:description"]) || ""),
|
|
111
110
|
// todo:
|
|
112
|
-
links: ((
|
|
113
|
-
name: t(
|
|
114
|
-
url: t(
|
|
115
|
-
description: t(
|
|
116
|
-
})).filter(
|
|
111
|
+
links: ((o = (v = n["dct:references"]) == null ? void 0 : v.filter((l) => l["dct:type"] === "documentation")) == null ? void 0 : o.map((l) => ({
|
|
112
|
+
name: t(l["dct:title"]),
|
|
113
|
+
url: t(l["schema:url"]),
|
|
114
|
+
description: t(l["dct:description"])
|
|
115
|
+
})).filter(m)) || []
|
|
117
116
|
}
|
|
118
117
|
};
|
|
119
118
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
var
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
for (const e of k) {
|
|
128
|
-
const l = (h = e["schema:text"]) == null ? void 0 : h.trim(), b = (D = e["schema:acceptedAnswer"]) == null ? void 0 : D.trim();
|
|
129
|
-
l && b && u.set(l, b);
|
|
119
|
+
function W(n) {
|
|
120
|
+
const i = n["schema:hasPart"] ?? [], a = (d) => i.find((f) => f["dct:type"] === d), r = (d) => {
|
|
121
|
+
var b;
|
|
122
|
+
const f = /* @__PURE__ */ new Map(), D = (d == null ? void 0 : d["schema:question"]) ?? [];
|
|
123
|
+
for (const p of D) {
|
|
124
|
+
const w = Number.parseInt(t(p["schema:position"])), e = (b = p["schema:acceptedAnswer"]) == null ? void 0 : b.trim();
|
|
125
|
+
!Number.isNaN(w) && e && f.set(w, e);
|
|
130
126
|
}
|
|
131
|
-
return
|
|
132
|
-
},
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
}, c = i("Initiieren", d), y = i("Planen", g), N = i("Umsetzen", w), I = i("Weiterdenken", P);
|
|
127
|
+
return f;
|
|
128
|
+
}, c = (d, f) => {
|
|
129
|
+
const D = a(d), b = r(D), p = {};
|
|
130
|
+
return f.forEach((w, e) => {
|
|
131
|
+
const g = e + 1, j = b.get(g);
|
|
132
|
+
j && (p[w] = j);
|
|
133
|
+
}), p;
|
|
134
|
+
}, h = ["projectTriggers", "involvedStakeholders", "dataCollectionMethod", "budgetPlanning"], P = ["requirementsGatherings", "tenderFormat", "tenderTips", "resourcePlanning"], v = ["projectTriggers", "involvedStakeholders", "dataCollectionMethod", "budgetPlanning"], o = ["projectTriggers", "involvedStakeholders", "dataCollectionMethod", "budgetPlanning"], l = c("Initiieren", h), y = c("Planen", P), I = c("Umsetzen", v), k = c("Weiterdenken", o);
|
|
140
135
|
return {
|
|
141
136
|
"Projektphasen (optional)": {},
|
|
142
|
-
"Projektphasen (optional)/Initiieren":
|
|
137
|
+
"Projektphasen (optional)/Initiieren": l,
|
|
143
138
|
"Projektphasen (optional)/Planen": y,
|
|
144
|
-
"Projektphasen (optional)/Umsetzen":
|
|
145
|
-
"Projektphasen (optional)/Weiterdenken":
|
|
139
|
+
"Projektphasen (optional)/Umsetzen": I,
|
|
140
|
+
"Projektphasen (optional)/Weiterdenken": k
|
|
146
141
|
};
|
|
147
142
|
}
|
|
148
|
-
function
|
|
149
|
-
const
|
|
143
|
+
function X(n) {
|
|
144
|
+
const i = n["p-plan:hasStep"] ?? [], a = {
|
|
150
145
|
datenerfassung: "1. Datenerfassung",
|
|
151
146
|
datenverarbeitung: "2. Datenverarbeitung",
|
|
152
147
|
datensimulation: "3. Datensimulation",
|
|
153
148
|
datenvisualisierung: "4. Datenvisualisierung"
|
|
154
|
-
},
|
|
149
|
+
}, r = {
|
|
155
150
|
"Technische Prozessschritte": {},
|
|
156
151
|
"1. Datenerfassung/Grundlegende Informationen": {},
|
|
157
152
|
"1. Datenerfassung/Software": {},
|
|
@@ -169,76 +164,76 @@ function L(n) {
|
|
|
169
164
|
"4. Datenvisualisierung/Software": {},
|
|
170
165
|
"4. Datenvisualisierung/Datensätze": {},
|
|
171
166
|
"4. Datenvisualisierung/Hardware": {}
|
|
172
|
-
},
|
|
173
|
-
for (const
|
|
174
|
-
const
|
|
167
|
+
}, c = (o) => `${o}/Grundlegende Informationen`, h = (o) => `${o}/Software`, P = (o) => `${o}/Datensätze`, v = (o) => `${o}/Hardware`;
|
|
168
|
+
for (const o of i) {
|
|
169
|
+
const l = (t(o["p-plan:Activity"] || "") || "").trim().toLowerCase(), y = a[l];
|
|
175
170
|
if (!y)
|
|
176
171
|
continue;
|
|
177
|
-
const
|
|
172
|
+
const I = G(o["dct:description"], "de") || "", k = I === "__EMPTY__" ? "" : I, d = (o["prov:used"] || []).map((e) => ({
|
|
178
173
|
name: t(e["dct:title"]) || ""
|
|
179
174
|
// description: extractStringValue(m['dct:description']) || undefined,
|
|
180
|
-
})).filter((e) => (e.name ?? "").length > 0),
|
|
175
|
+
})).filter((e) => (e.name ?? "").length > 0), f = (o["dct:references"] || []).filter((e) => t(e["dct:type"]) === "documentation").map((e) => ({
|
|
181
176
|
name: t(e["dct:title"]) || "",
|
|
182
177
|
url: t(e["schema:url"]) || "",
|
|
183
178
|
description: t(e["dct:description"]) || void 0
|
|
184
179
|
})).filter((e) => e.url.length > 0 && e.name.length > 0);
|
|
185
|
-
(
|
|
186
|
-
...
|
|
187
|
-
...
|
|
188
|
-
...
|
|
180
|
+
(k || d.length > 0 || f.length > 0) && (r[c(y)] = {
|
|
181
|
+
...k ? { description: k } : {},
|
|
182
|
+
...d.length > 0 ? { methods: d } : {},
|
|
183
|
+
...f.length > 0 ? { links: f } : {}
|
|
189
184
|
});
|
|
190
|
-
const
|
|
191
|
-
id:
|
|
192
|
-
functionalities: (e["schema:featureList"] || []).map((
|
|
185
|
+
const D = o["p-plan:hasInputVar"] || [], b = D.filter((e) => t(e["@type"]) === "schema:SoftwareApplication").map((e) => ({
|
|
186
|
+
id: E(t(e["dct:identifier"]) || ""),
|
|
187
|
+
functionalities: (e["schema:featureList"] || []).map((g) => t(g)).filter(m)
|
|
193
188
|
})).filter((e) => e.id.length > 0);
|
|
194
|
-
|
|
195
|
-
selected:
|
|
189
|
+
b.length > 0 && (r[h(y)] = {
|
|
190
|
+
selected: b
|
|
196
191
|
});
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
selected:
|
|
192
|
+
const p = D.filter((e) => t(e["@type"]) === "dcat:Dataset").map((e) => ({ id: E(t(e["dct:identifier"]) || "") })).filter((e) => e.id.length > 0);
|
|
193
|
+
p.length > 0 && (r[P(y)] = {
|
|
194
|
+
selected: p
|
|
200
195
|
});
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
name: t(
|
|
204
|
-
url: t(
|
|
205
|
-
description: t(
|
|
206
|
-
})).filter((
|
|
196
|
+
const w = D.filter((e) => t(e["@type"]) === "ssn:System").map((e) => {
|
|
197
|
+
const g = e["ssn:deployedSystem"], j = E(t(e["dct:identifier"]) || ""), C = g && typeof g == "object" ? E(t(g["@id"]) || g["@id"]) : "", K = j || C, A = G(e["dct:description"], "de") || void 0, F = (e["ssn:forProperty"] || []).map((s) => t(s)).filter(m), O = (e["sosa:hasLocation"] || []).map((s) => ({ lat: t(s["geo:lat"]) || "", lng: t(s["geo:long"]) || "" })).filter((s) => s.lat.length > 0 && s.lng.length > 0), T = (e["foaf:depiction"] || []).map((s) => q(s)).filter(m), B = (e["dct:references"] || []).filter((s) => t(s["dct:type"]) === "documentation").map((s) => ({
|
|
198
|
+
name: t(s["dct:title"]) || "",
|
|
199
|
+
url: t(s["schema:url"]) || "",
|
|
200
|
+
description: t(s["dct:description"]) || void 0
|
|
201
|
+
})).filter((s) => s.url.length > 0), x = (e["ssn-system:hasSystemCapability"] || []).map((s) => t(s)).filter(m);
|
|
207
202
|
return {
|
|
208
|
-
id:
|
|
209
|
-
...
|
|
210
|
-
...
|
|
211
|
-
...
|
|
212
|
-
...
|
|
213
|
-
...
|
|
214
|
-
...
|
|
203
|
+
id: K,
|
|
204
|
+
...A ? { description: A } : {},
|
|
205
|
+
...F.length > 0 ? { forProperty: F } : {},
|
|
206
|
+
...O.length > 0 ? { locations: O } : {},
|
|
207
|
+
...T.length > 0 ? { depictions: T } : {},
|
|
208
|
+
...B.length > 0 ? { references: B } : {},
|
|
209
|
+
...x.length > 0 ? { functionalities: x } : {},
|
|
215
210
|
isHostedBy: e["sosa:isHostedBy"] || [],
|
|
216
211
|
hosts: []
|
|
217
212
|
};
|
|
218
213
|
}).filter((e) => (e.id ?? "").length > 0);
|
|
219
|
-
|
|
220
|
-
selected:
|
|
214
|
+
w.length > 0 && (r[v(y)] = {
|
|
215
|
+
selected: w
|
|
221
216
|
});
|
|
222
217
|
}
|
|
223
|
-
return
|
|
218
|
+
return r;
|
|
224
219
|
}
|
|
225
|
-
async function
|
|
226
|
-
const
|
|
220
|
+
async function ee(n, i) {
|
|
221
|
+
const a = await $(n);
|
|
227
222
|
return {
|
|
228
223
|
Landing: {},
|
|
229
|
-
...
|
|
230
|
-
...
|
|
231
|
-
...
|
|
232
|
-
...
|
|
233
|
-
...
|
|
224
|
+
...U(a, { visibility: (i == null ? void 0 : i.visibility) || "public" }),
|
|
225
|
+
...R(a),
|
|
226
|
+
...V(a),
|
|
227
|
+
...W(a),
|
|
228
|
+
...X(a),
|
|
234
229
|
Vorschau: {}
|
|
235
230
|
};
|
|
236
231
|
}
|
|
237
232
|
export {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
233
|
+
ee as decodeProject,
|
|
234
|
+
U as toAuffindbarkeit,
|
|
235
|
+
R as toGrundlegendeInformationen,
|
|
236
|
+
V as toOptionaleDaten,
|
|
237
|
+
W as toProjektphasen,
|
|
238
|
+
X as toTechnicalProcessSteps
|
|
244
239
|
};
|