ldkit 0.0.1 → 0.0.2
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/esm/_dnt.shims.js +70 -0
- package/esm/library/comunica/bundle.js +82389 -0
- package/esm/library/comunica/mod.js +1 -0
- package/esm/library/context.js +13 -0
- package/esm/library/decoder.js +203 -0
- package/esm/library/encoder.js +116 -0
- package/esm/library/engine.js +9 -0
- package/esm/library/namespaces/dcterms.js +105 -0
- package/esm/library/namespaces/ldkit.js +6 -0
- package/esm/library/namespaces/mod.js +7 -0
- package/esm/library/namespaces/namespace.js +11 -0
- package/esm/library/namespaces/rdf.js +29 -0
- package/esm/library/namespaces/schema.js +2698 -0
- package/esm/library/namespaces/skos.js +39 -0
- package/esm/library/namespaces/xsd.js +57 -0
- package/esm/library/rdf.js +19 -0
- package/esm/library/resource/mod.js +1 -0
- package/esm/library/resource/query_builder.js +147 -0
- package/esm/library/resource/query_helper.js +102 -0
- package/esm/library/resource/resource.js +102 -0
- package/esm/library/resource/types.js +1 -0
- package/esm/library/rxjs.js +2 -0
- package/esm/library/schema/data_types.js +37 -0
- package/esm/library/schema/interface.js +1 -0
- package/esm/library/schema/mod.js +1 -0
- package/esm/library/schema/schema.js +1 -0
- package/esm/library/schema/utils.js +58 -0
- package/esm/library/sparql.js +2 -0
- package/esm/mod.js +3 -0
- package/package.json +16 -5
- package/script/_dnt.shims.js +80 -0
- package/script/library/comunica/bundle.js +82415 -0
- package/script/library/comunica/mod.js +5 -0
- package/script/library/context.js +19 -0
- package/script/library/decoder.js +207 -0
- package/script/library/encoder.js +120 -0
- package/script/library/engine.js +16 -0
- package/script/library/namespaces/dcterms.js +107 -0
- package/script/library/namespaces/ldkit.js +8 -0
- package/script/library/namespaces/mod.js +20 -0
- package/script/library/namespaces/namespace.js +15 -0
- package/script/library/namespaces/rdf.js +31 -0
- package/script/library/namespaces/schema.js +2700 -0
- package/script/library/namespaces/skos.js +41 -0
- package/script/library/namespaces/xsd.js +59 -0
- package/script/library/rdf.js +54 -0
- package/script/library/resource/mod.js +6 -0
- package/script/library/resource/query_builder.js +151 -0
- package/script/library/resource/query_helper.js +106 -0
- package/script/library/resource/resource.js +107 -0
- package/script/{npm.js → library/resource/types.js} +0 -2
- package/script/library/rxjs.js +11 -0
- package/script/library/schema/data_types.js +39 -0
- package/script/library/schema/interface.js +2 -0
- package/script/library/schema/mod.js +6 -0
- package/script/library/schema/schema.js +2 -0
- package/script/library/schema/utils.js +63 -0
- package/script/library/sparql.js +13 -0
- package/script/mod.js +10 -0
- package/esm/npm.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryEngine = void 0;
|
|
4
|
+
var bundle_js_1 = require("./bundle.js");
|
|
5
|
+
Object.defineProperty(exports, "QueryEngine", { enumerable: true, get: function () { return bundle_js_1.QueryEngine; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveContext = exports.createDefaultContext = exports.createContext = void 0;
|
|
4
|
+
let defaultContext = undefined;
|
|
5
|
+
const createContext = (context) => {
|
|
6
|
+
return context;
|
|
7
|
+
};
|
|
8
|
+
exports.createContext = createContext;
|
|
9
|
+
const createDefaultContext = (context) => {
|
|
10
|
+
defaultContext = (0, exports.createContext)(context);
|
|
11
|
+
};
|
|
12
|
+
exports.createDefaultContext = createDefaultContext;
|
|
13
|
+
const resolveContext = (context) => {
|
|
14
|
+
if (!context && !defaultContext) {
|
|
15
|
+
throw new Error("No context found. Please create a default context or pass one to createResource function");
|
|
16
|
+
}
|
|
17
|
+
return context || defaultContext;
|
|
18
|
+
};
|
|
19
|
+
exports.resolveContext = resolveContext;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decode = void 0;
|
|
4
|
+
const rdf_js_1 = require("./rdf.js");
|
|
5
|
+
const mod_js_1 = require("./namespaces/mod.js");
|
|
6
|
+
class Decoder {
|
|
7
|
+
constructor(graph, schema, context) {
|
|
8
|
+
Object.defineProperty(this, "graph", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "schema", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "context", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "cache", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: new Map()
|
|
31
|
+
});
|
|
32
|
+
this.graph = graph;
|
|
33
|
+
this.schema = schema;
|
|
34
|
+
this.context = context;
|
|
35
|
+
}
|
|
36
|
+
static decode(graph, schema, context) {
|
|
37
|
+
return new Decoder(graph, schema, context).decode();
|
|
38
|
+
}
|
|
39
|
+
getCachedNode(nodeIri, schema) {
|
|
40
|
+
if (!this.cache.has(schema)) {
|
|
41
|
+
this.cache.set(schema, new Map());
|
|
42
|
+
}
|
|
43
|
+
return this.cache.get(schema).get(nodeIri);
|
|
44
|
+
}
|
|
45
|
+
setCachedNode(nodeIri, schema, decodedNode) {
|
|
46
|
+
if (!this.cache.has(schema)) {
|
|
47
|
+
this.cache.set(schema, new Map());
|
|
48
|
+
}
|
|
49
|
+
this.cache.get(schema).set(nodeIri, decodedNode);
|
|
50
|
+
}
|
|
51
|
+
decode() {
|
|
52
|
+
const output = [];
|
|
53
|
+
for (const [iri, properties] of this.graph) {
|
|
54
|
+
if (properties.has(mod_js_1.rdf.type)) {
|
|
55
|
+
const types = properties.get(mod_js_1.rdf.type);
|
|
56
|
+
for (const type of types) {
|
|
57
|
+
if (type.termType === "NamedNode" && type.value === mod_js_1.ldkit.Resource) {
|
|
58
|
+
output.push(this.decodeNode(iri, this.schema));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (this.graph.size > 0 && output.length < 1) {
|
|
64
|
+
throw new Error(`Unable to decode graph - no resources with type <${mod_js_1.ldkit.Resource}> found`);
|
|
65
|
+
}
|
|
66
|
+
return output;
|
|
67
|
+
}
|
|
68
|
+
decodeNode(nodeIri, schema) {
|
|
69
|
+
const cachedNode = this.getCachedNode(nodeIri, schema);
|
|
70
|
+
if (cachedNode) {
|
|
71
|
+
return cachedNode;
|
|
72
|
+
}
|
|
73
|
+
const output = {
|
|
74
|
+
$id: nodeIri,
|
|
75
|
+
};
|
|
76
|
+
const node = this.graph.get(nodeIri);
|
|
77
|
+
if (!node) {
|
|
78
|
+
throw new Error(`Error decoding graph, <${nodeIri}> node not found.`);
|
|
79
|
+
}
|
|
80
|
+
output.$type = this.decodeNodeType(node);
|
|
81
|
+
Object.keys(schema).forEach((key) => {
|
|
82
|
+
if (key === "@type") {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const result = this.decodeNodeProperty(nodeIri, node, key, schema[key]);
|
|
86
|
+
if (result !== undefined) {
|
|
87
|
+
output[key] = result;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
this.setCachedNode(nodeIri, schema, output);
|
|
91
|
+
return output;
|
|
92
|
+
}
|
|
93
|
+
decodeNodeType(node) {
|
|
94
|
+
const typeTerms = node.get(mod_js_1.rdf.type);
|
|
95
|
+
if (!typeTerms) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
return typeTerms.reduce((acc, term) => {
|
|
99
|
+
if (term.value !== mod_js_1.ldkit.Resource) {
|
|
100
|
+
acc.push(term.value);
|
|
101
|
+
}
|
|
102
|
+
return acc;
|
|
103
|
+
}, []);
|
|
104
|
+
}
|
|
105
|
+
decodeNodeProperty(nodeIri, node, propertyKey, property) {
|
|
106
|
+
const terms = node.get(property["@id"]);
|
|
107
|
+
if (!terms) {
|
|
108
|
+
if (!property["@optional"]) {
|
|
109
|
+
// No data, required property
|
|
110
|
+
throw new Error(`Required property "${propertyKey}" of type <${property["@id"]}> not found on resource <${nodeIri}>`);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// No data, optional property
|
|
114
|
+
return property["@array"] ? [] : undefined;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (property["@multilang"]) {
|
|
118
|
+
if (property["@array"]) {
|
|
119
|
+
return terms.reduce((acc, term) => {
|
|
120
|
+
if (term.termType !== "Literal") {
|
|
121
|
+
throw new Error(`Property "${propertyKey}" data type mismatch - expected a literal, but received ${term.termType} instead on resource <${nodeIri}>`);
|
|
122
|
+
}
|
|
123
|
+
const language = term.language;
|
|
124
|
+
if (!acc[language]) {
|
|
125
|
+
acc[language] = [];
|
|
126
|
+
}
|
|
127
|
+
acc[language].push(this.decodeTerm(term));
|
|
128
|
+
return acc;
|
|
129
|
+
}, {});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return terms.reduce((acc, term) => {
|
|
133
|
+
if (term.termType !== "Literal") {
|
|
134
|
+
throw new Error(`Property "${propertyKey}" data type mismatch - expected a literal, but received ${term.termType} instead on resource <${nodeIri}>`);
|
|
135
|
+
}
|
|
136
|
+
const language = term.language;
|
|
137
|
+
if (!acc[language]) {
|
|
138
|
+
// If there are multiple strings with the same language detected, selecting only the first one
|
|
139
|
+
acc[language] = this.decodeTerm(term);
|
|
140
|
+
}
|
|
141
|
+
return acc;
|
|
142
|
+
}, {});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (property["@array"]) {
|
|
146
|
+
if (property["@context"]) {
|
|
147
|
+
// Collection of resources specified by sub schema
|
|
148
|
+
return terms.map((term) => {
|
|
149
|
+
if (term.termType !== "NamedNode" && term.termType !== "BlankNode") {
|
|
150
|
+
throw new Error(`Property "${propertyKey}" data type mismatch - expected a node, but received ${term.termType} instead on resource <${nodeIri}>`);
|
|
151
|
+
}
|
|
152
|
+
return this.decodeNode(term.value, property["@context"]);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
// Collection of literals or named nodes
|
|
157
|
+
return terms.map((term) => {
|
|
158
|
+
if (term.termType !== "Literal" && term.termType !== "NamedNode") {
|
|
159
|
+
throw new Error(`Property "${propertyKey}" data type mismatch - expected a literal or named node, but received ${term.termType} instead on resource <${nodeIri}>`);
|
|
160
|
+
}
|
|
161
|
+
return this.decodeTerm(term);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Single return value expected from this point on
|
|
166
|
+
if (property["@context"]) {
|
|
167
|
+
for (const term of terms) {
|
|
168
|
+
if (term.termType === "NamedNode" || term.termType === "BlankNode") {
|
|
169
|
+
return this.decodeNode(term.value, property["@context"]);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
throw new Error(`Property "${propertyKey}" data type mismatch - expected a named node for context on resource <${nodeIri}>`);
|
|
173
|
+
}
|
|
174
|
+
const preferredLanguage = this.context.language;
|
|
175
|
+
if (preferredLanguage) {
|
|
176
|
+
// Try to find a term that corresponds to the preferred language
|
|
177
|
+
for (const term of terms) {
|
|
178
|
+
if (term.termType === "Literal" &&
|
|
179
|
+
term.language === preferredLanguage) {
|
|
180
|
+
return this.decodeTerm(term);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// All options exhausted - return first namedNode or literal if there are multiple
|
|
185
|
+
for (const term of terms) {
|
|
186
|
+
if (term.termType === "Literal" || term.termType === "NamedNode") {
|
|
187
|
+
return this.decodeTerm(term);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
throw new Error(`Property "${propertyKey}" data type mismatch - expected a literal or named node instead on resource <${nodeIri}>`);
|
|
191
|
+
}
|
|
192
|
+
decodeTerm(term) {
|
|
193
|
+
if (term.termType === "NamedNode") {
|
|
194
|
+
return term.value;
|
|
195
|
+
}
|
|
196
|
+
else if (term.termType === "Literal") {
|
|
197
|
+
return (0, rdf_js_1.fromRdf)(term);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
throw new Error(`Unsupported term type to resolve: ${term.termType}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const decode = (graph, schema, context) => {
|
|
205
|
+
return Decoder.decode(graph, schema, context);
|
|
206
|
+
};
|
|
207
|
+
exports.decode = decode;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encode = void 0;
|
|
4
|
+
const rdf_js_1 = require("./rdf.js");
|
|
5
|
+
const mod_js_1 = require("./namespaces/mod.js");
|
|
6
|
+
const encode = (node, schema, context, variableInitCounter = 0) => {
|
|
7
|
+
return Encoder.encode(node, schema, context, variableInitCounter);
|
|
8
|
+
};
|
|
9
|
+
exports.encode = encode;
|
|
10
|
+
class Encoder {
|
|
11
|
+
constructor(context, variableInitCounter) {
|
|
12
|
+
Object.defineProperty(this, "context", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "df", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: new rdf_js_1.DataFactory({
|
|
23
|
+
blankNodePrefix: "b",
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "variableCounter", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "output", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: []
|
|
37
|
+
});
|
|
38
|
+
this.context = context;
|
|
39
|
+
this.variableCounter = variableInitCounter;
|
|
40
|
+
}
|
|
41
|
+
static encode(node, schema, context, variableInitCounter) {
|
|
42
|
+
return new Encoder(context, variableInitCounter).encode(node, schema);
|
|
43
|
+
}
|
|
44
|
+
encode(node, schema) {
|
|
45
|
+
const nodeId = this.getNodeId(node);
|
|
46
|
+
this.encodeNode(node, schema, nodeId);
|
|
47
|
+
return this.output;
|
|
48
|
+
}
|
|
49
|
+
push(s, p, o) {
|
|
50
|
+
this.output.push(this.df.quad(s, p, o));
|
|
51
|
+
}
|
|
52
|
+
getNodeId(node) {
|
|
53
|
+
return node.$id
|
|
54
|
+
? this.df.namedNode(node.$id)
|
|
55
|
+
: this.df.blankNode();
|
|
56
|
+
}
|
|
57
|
+
getNodeTypes(node) {
|
|
58
|
+
if (Array.isArray(node.$type)) {
|
|
59
|
+
return node.$type;
|
|
60
|
+
}
|
|
61
|
+
return node.$type ? [node.$type] : [];
|
|
62
|
+
}
|
|
63
|
+
encodeNode(node, schema, nodeId) {
|
|
64
|
+
this.encodeNodeType(node, schema["@type"], nodeId);
|
|
65
|
+
Object.keys(schema).forEach((key) => {
|
|
66
|
+
if (key === "@type") {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.encodeNodeProperty(node[key], schema[key], nodeId);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
encodeNodeType(node, requiredTypes, nodeId) {
|
|
73
|
+
const finalTypes = new Set([...this.getNodeTypes(node), ...requiredTypes]);
|
|
74
|
+
finalTypes.forEach((type) => {
|
|
75
|
+
this.push(nodeId, this.df.namedNode(mod_js_1.rdf.type), this.df.namedNode(type));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
encodeNodeProperty(value, property, nodeId) {
|
|
79
|
+
if (value === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const propertyId = this.df.namedNode(property["@id"]);
|
|
83
|
+
if (value === null) {
|
|
84
|
+
// TODO
|
|
85
|
+
this.push(nodeId, propertyId, this.df.variable(`v${this.variableCounter++}`));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (property["@multilang"]) {
|
|
89
|
+
Object.keys(value).forEach((language) => {
|
|
90
|
+
const languageValue = Array.isArray(value[language])
|
|
91
|
+
? value[language]
|
|
92
|
+
: [value[language]];
|
|
93
|
+
languageValue.forEach((singleValue) => {
|
|
94
|
+
this.push(nodeId, propertyId, (0, rdf_js_1.literal)(singleValue, language.length > 0 ? language : undefined));
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const values = Array.isArray(value) ? value : [value];
|
|
100
|
+
values.forEach((val) => {
|
|
101
|
+
if (property["@context"]) {
|
|
102
|
+
const subNodeId = this.getNodeId(val);
|
|
103
|
+
this.encodeNode(val, property["@context"], subNodeId);
|
|
104
|
+
this.push(nodeId, propertyId, subNodeId);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const propertyType = property["@type"] ?? mod_js_1.xsd.string;
|
|
108
|
+
if (typeof val === "string" && this.context.language) {
|
|
109
|
+
if (propertyType === mod_js_1.xsd.string || propertyType === mod_js_1.rdf.langString) {
|
|
110
|
+
this.push(nodeId, propertyId, (0, rdf_js_1.literal)(val, this.context.language));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const rdfValue = (0, rdf_js_1.toRdf)(val, {
|
|
115
|
+
datatype: this.df.namedNode(property["@type"] ?? mod_js_1.xsd.string),
|
|
116
|
+
});
|
|
117
|
+
this.push(nodeId, propertyId, rdfValue);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateQuery = exports.quadsQuery = exports.bindingsQuery = exports.booleanQuery = void 0;
|
|
4
|
+
const mod_js_1 = require("./comunica/mod.js");
|
|
5
|
+
const rxjs_js_1 = require("./rxjs.js");
|
|
6
|
+
const context_js_1 = require("./context.js");
|
|
7
|
+
const rdf_js_1 = require("./rdf.js");
|
|
8
|
+
const engine = new mod_js_1.QueryEngine();
|
|
9
|
+
const booleanQuery = (query, context) => (0, rxjs_js_1.from)(engine.queryBoolean(query, (0, context_js_1.resolveContext)(context)));
|
|
10
|
+
exports.booleanQuery = booleanQuery;
|
|
11
|
+
const bindingsQuery = (query, context) => (0, rxjs_js_1.from)(engine.queryBindings(query, (0, context_js_1.resolveContext)(context))).pipe((0, rxjs_js_1.switchMap)((stream) => (0, rxjs_js_1.from)(stream.toArray())));
|
|
12
|
+
exports.bindingsQuery = bindingsQuery;
|
|
13
|
+
const quadsQuery = (query, context) => (0, rxjs_js_1.from)(engine.queryQuads(query, (0, context_js_1.resolveContext)(context))).pipe((0, rxjs_js_1.switchMap)((stream) => (0, rxjs_js_1.from)(stream.toArray())), (0, rxjs_js_1.map)((quads) => (0, rdf_js_1.quadsToGraph)(quads)));
|
|
14
|
+
exports.quadsQuery = quadsQuery;
|
|
15
|
+
const updateQuery = (query, context) => (0, rxjs_js_1.from)(engine.queryVoid(query, (0, context_js_1.resolveContext)(context)));
|
|
16
|
+
exports.updateQuery = updateQuery;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const namespace_js_1 = require("./namespace.js");
|
|
4
|
+
exports.default = (0, namespace_js_1.createNamespace)({
|
|
5
|
+
iri: "http://purl.org/dc/terms/",
|
|
6
|
+
prefix: "dcterms:",
|
|
7
|
+
terms: [
|
|
8
|
+
"Agent",
|
|
9
|
+
"AgentClass",
|
|
10
|
+
"BibliographicResource",
|
|
11
|
+
"Box",
|
|
12
|
+
"DCMIType",
|
|
13
|
+
"DDC",
|
|
14
|
+
"FileFormat",
|
|
15
|
+
"Frequency",
|
|
16
|
+
"IMT",
|
|
17
|
+
"ISO3166",
|
|
18
|
+
"ISO639-2",
|
|
19
|
+
"ISO639-3",
|
|
20
|
+
"Jurisdiction",
|
|
21
|
+
"LCC",
|
|
22
|
+
"LCSH",
|
|
23
|
+
"LicenseDocument",
|
|
24
|
+
"LinguisticSystem",
|
|
25
|
+
"Location",
|
|
26
|
+
"LocationPeriodOrJurisdiction",
|
|
27
|
+
"MESH",
|
|
28
|
+
"MediaType",
|
|
29
|
+
"MediaTypeOrExtent",
|
|
30
|
+
"MethodOfAccrual",
|
|
31
|
+
"MethodOfInstruction",
|
|
32
|
+
"NLM",
|
|
33
|
+
"Period",
|
|
34
|
+
"PeriodOfTime",
|
|
35
|
+
"PhysicalMedium",
|
|
36
|
+
"PhysicalResource",
|
|
37
|
+
"Point",
|
|
38
|
+
"Policy",
|
|
39
|
+
"ProvenanceStatement",
|
|
40
|
+
"RFC1766",
|
|
41
|
+
"RFC3066",
|
|
42
|
+
"RFC4646",
|
|
43
|
+
"RFC5646",
|
|
44
|
+
"RightsStatement",
|
|
45
|
+
"SizeOrDuration",
|
|
46
|
+
"Standard",
|
|
47
|
+
"TGN",
|
|
48
|
+
"UDC",
|
|
49
|
+
"URI",
|
|
50
|
+
"W3CDTF",
|
|
51
|
+
"abstract",
|
|
52
|
+
"accessRights",
|
|
53
|
+
"accrualMethod",
|
|
54
|
+
"accrualPeriodicity",
|
|
55
|
+
"accrualPolicy",
|
|
56
|
+
"alternative",
|
|
57
|
+
"audience",
|
|
58
|
+
"available",
|
|
59
|
+
"bibliographicCitation",
|
|
60
|
+
"conformsTo",
|
|
61
|
+
"contributor",
|
|
62
|
+
"coverage",
|
|
63
|
+
"created",
|
|
64
|
+
"creator",
|
|
65
|
+
"date",
|
|
66
|
+
"dateAccepted",
|
|
67
|
+
"dateCopyrighted",
|
|
68
|
+
"dateSubmitted",
|
|
69
|
+
"description",
|
|
70
|
+
"educationLevel",
|
|
71
|
+
"extent",
|
|
72
|
+
"format",
|
|
73
|
+
"hasFormat",
|
|
74
|
+
"hasPart",
|
|
75
|
+
"hasVersion",
|
|
76
|
+
"identifier",
|
|
77
|
+
"instructionalMethod",
|
|
78
|
+
"isFormatOf",
|
|
79
|
+
"isPartOf",
|
|
80
|
+
"isReferencedBy",
|
|
81
|
+
"isReplacedBy",
|
|
82
|
+
"isRequiredBy",
|
|
83
|
+
"isVersionOf",
|
|
84
|
+
"issued",
|
|
85
|
+
"language",
|
|
86
|
+
"license",
|
|
87
|
+
"mediator",
|
|
88
|
+
"medium",
|
|
89
|
+
"modified",
|
|
90
|
+
"provenance",
|
|
91
|
+
"publisher",
|
|
92
|
+
"references",
|
|
93
|
+
"relation",
|
|
94
|
+
"replaces",
|
|
95
|
+
"requires",
|
|
96
|
+
"rights",
|
|
97
|
+
"rightsHolder",
|
|
98
|
+
"source",
|
|
99
|
+
"spatial",
|
|
100
|
+
"subject",
|
|
101
|
+
"tableOfContents",
|
|
102
|
+
"temporal",
|
|
103
|
+
"title",
|
|
104
|
+
"type",
|
|
105
|
+
"valid",
|
|
106
|
+
],
|
|
107
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createNamespace = exports.xsd = exports.skos = exports.schema = exports.ldkit = exports.dcterms = exports.rdf = void 0;
|
|
7
|
+
var rdf_js_1 = require("./rdf.js");
|
|
8
|
+
Object.defineProperty(exports, "rdf", { enumerable: true, get: function () { return __importDefault(rdf_js_1).default; } });
|
|
9
|
+
var dcterms_js_1 = require("./dcterms.js");
|
|
10
|
+
Object.defineProperty(exports, "dcterms", { enumerable: true, get: function () { return __importDefault(dcterms_js_1).default; } });
|
|
11
|
+
var ldkit_js_1 = require("./ldkit.js");
|
|
12
|
+
Object.defineProperty(exports, "ldkit", { enumerable: true, get: function () { return __importDefault(ldkit_js_1).default; } });
|
|
13
|
+
var schema_js_1 = require("./schema.js");
|
|
14
|
+
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return __importDefault(schema_js_1).default; } });
|
|
15
|
+
var skos_js_1 = require("./skos.js");
|
|
16
|
+
Object.defineProperty(exports, "skos", { enumerable: true, get: function () { return __importDefault(skos_js_1).default; } });
|
|
17
|
+
var xsd_js_1 = require("./xsd.js");
|
|
18
|
+
Object.defineProperty(exports, "xsd", { enumerable: true, get: function () { return __importDefault(xsd_js_1).default; } });
|
|
19
|
+
var namespace_js_1 = require("./namespace.js");
|
|
20
|
+
Object.defineProperty(exports, "createNamespace", { enumerable: true, get: function () { return namespace_js_1.createNamespace; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNamespace = void 0;
|
|
4
|
+
const createNamespace = (namespaceSpec) => Object.assign(
|
|
5
|
+
//<X extends I>(f: [X]) =>
|
|
6
|
+
// `${namespaceSpec.prefix}:${f}` as `${string & P}${string & X}`,
|
|
7
|
+
namespaceSpec.terms.reduce((acc, term) => {
|
|
8
|
+
//acc[term] = `${namespaceSpec.prefix}${term}`
|
|
9
|
+
acc[term] = `${namespaceSpec.iri}${term}`;
|
|
10
|
+
return acc;
|
|
11
|
+
}, {}), {
|
|
12
|
+
$prefix: namespaceSpec["prefix"],
|
|
13
|
+
$iri: namespaceSpec["iri"],
|
|
14
|
+
});
|
|
15
|
+
exports.createNamespace = createNamespace;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const namespace_js_1 = require("./namespace.js");
|
|
4
|
+
exports.default = (0, namespace_js_1.createNamespace)({
|
|
5
|
+
iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
6
|
+
prefix: "rdf:",
|
|
7
|
+
terms: [
|
|
8
|
+
"Alt",
|
|
9
|
+
"Bag",
|
|
10
|
+
"CompoundLiteral",
|
|
11
|
+
"HTML",
|
|
12
|
+
"JSON",
|
|
13
|
+
"List",
|
|
14
|
+
"PlainLiteral",
|
|
15
|
+
"Property",
|
|
16
|
+
"Seq",
|
|
17
|
+
"Statement",
|
|
18
|
+
"XMLLiteral",
|
|
19
|
+
"direction",
|
|
20
|
+
"first",
|
|
21
|
+
"langString",
|
|
22
|
+
"language",
|
|
23
|
+
"nil",
|
|
24
|
+
"object",
|
|
25
|
+
"predicate",
|
|
26
|
+
"rest",
|
|
27
|
+
"subject",
|
|
28
|
+
"type",
|
|
29
|
+
"value",
|
|
30
|
+
],
|
|
31
|
+
});
|