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.
Files changed (60) hide show
  1. package/esm/_dnt.shims.js +70 -0
  2. package/esm/library/comunica/bundle.js +82389 -0
  3. package/esm/library/comunica/mod.js +1 -0
  4. package/esm/library/context.js +13 -0
  5. package/esm/library/decoder.js +203 -0
  6. package/esm/library/encoder.js +116 -0
  7. package/esm/library/engine.js +9 -0
  8. package/esm/library/namespaces/dcterms.js +105 -0
  9. package/esm/library/namespaces/ldkit.js +6 -0
  10. package/esm/library/namespaces/mod.js +7 -0
  11. package/esm/library/namespaces/namespace.js +11 -0
  12. package/esm/library/namespaces/rdf.js +29 -0
  13. package/esm/library/namespaces/schema.js +2698 -0
  14. package/esm/library/namespaces/skos.js +39 -0
  15. package/esm/library/namespaces/xsd.js +57 -0
  16. package/esm/library/rdf.js +19 -0
  17. package/esm/library/resource/mod.js +1 -0
  18. package/esm/library/resource/query_builder.js +147 -0
  19. package/esm/library/resource/query_helper.js +102 -0
  20. package/esm/library/resource/resource.js +102 -0
  21. package/esm/library/resource/types.js +1 -0
  22. package/esm/library/rxjs.js +2 -0
  23. package/esm/library/schema/data_types.js +37 -0
  24. package/esm/library/schema/interface.js +1 -0
  25. package/esm/library/schema/mod.js +1 -0
  26. package/esm/library/schema/schema.js +1 -0
  27. package/esm/library/schema/utils.js +58 -0
  28. package/esm/library/sparql.js +2 -0
  29. package/esm/mod.js +3 -0
  30. package/package.json +16 -5
  31. package/script/_dnt.shims.js +80 -0
  32. package/script/library/comunica/bundle.js +82415 -0
  33. package/script/library/comunica/mod.js +5 -0
  34. package/script/library/context.js +19 -0
  35. package/script/library/decoder.js +207 -0
  36. package/script/library/encoder.js +120 -0
  37. package/script/library/engine.js +16 -0
  38. package/script/library/namespaces/dcterms.js +107 -0
  39. package/script/library/namespaces/ldkit.js +8 -0
  40. package/script/library/namespaces/mod.js +20 -0
  41. package/script/library/namespaces/namespace.js +15 -0
  42. package/script/library/namespaces/rdf.js +31 -0
  43. package/script/library/namespaces/schema.js +2700 -0
  44. package/script/library/namespaces/skos.js +41 -0
  45. package/script/library/namespaces/xsd.js +59 -0
  46. package/script/library/rdf.js +54 -0
  47. package/script/library/resource/mod.js +6 -0
  48. package/script/library/resource/query_builder.js +151 -0
  49. package/script/library/resource/query_helper.js +106 -0
  50. package/script/library/resource/resource.js +107 -0
  51. package/script/{npm.js → library/resource/types.js} +0 -2
  52. package/script/library/rxjs.js +11 -0
  53. package/script/library/schema/data_types.js +39 -0
  54. package/script/library/schema/interface.js +2 -0
  55. package/script/library/schema/mod.js +6 -0
  56. package/script/library/schema/schema.js +2 -0
  57. package/script/library/schema/utils.js +63 -0
  58. package/script/library/sparql.js +13 -0
  59. package/script/mod.js +10 -0
  60. package/esm/npm.js +0 -1
@@ -0,0 +1,39 @@
1
+ import { createNamespace } from "./namespace.js";
2
+ export default createNamespace({
3
+ iri: "http://www.w3.org/2004/02/skos/core#",
4
+ prefix: "skos:",
5
+ terms: [
6
+ "Collection",
7
+ "Concept",
8
+ "ConceptScheme",
9
+ "OrderedCollection",
10
+ "altLabel",
11
+ "broadMatch",
12
+ "broader",
13
+ "broaderTransitive",
14
+ "changeNote",
15
+ "closeMatch",
16
+ "definition",
17
+ "editorialNote",
18
+ "exactMatch",
19
+ "example",
20
+ "hasTopConcept",
21
+ "hiddenLabel",
22
+ "historyNote",
23
+ "inScheme",
24
+ "mappingRelation",
25
+ "member",
26
+ "memberList",
27
+ "narrowMatch",
28
+ "narrower",
29
+ "narrowerTransitive",
30
+ "notation",
31
+ "note",
32
+ "prefLabel",
33
+ "related",
34
+ "relatedMatch",
35
+ "scopeNote",
36
+ "semanticRelation",
37
+ "topConceptOf",
38
+ ],
39
+ });
@@ -0,0 +1,57 @@
1
+ import { createNamespace } from "./namespace.js";
2
+ export default createNamespace({
3
+ iri: "http://www.w3.org/2001/XMLSchema#",
4
+ prefix: "xsd:",
5
+ terms: [
6
+ "ENTITIES",
7
+ "ENTITY",
8
+ "ID",
9
+ "IDREF",
10
+ "IDREFS",
11
+ "NCName",
12
+ "NMTOKEN",
13
+ "NMTOKENS",
14
+ "NOTATION",
15
+ "Name",
16
+ "QName",
17
+ "anyAtomicType",
18
+ "anySimpleType",
19
+ "anyType",
20
+ "anyURI",
21
+ "base64Binary",
22
+ "boolean",
23
+ "byte",
24
+ "date",
25
+ "dateTime",
26
+ "dateTimeStamp",
27
+ "dayTimeDuration",
28
+ "decimal",
29
+ "double",
30
+ "duration",
31
+ "float",
32
+ "gDay",
33
+ "gMonth",
34
+ "gMonthDay",
35
+ "gYear",
36
+ "gYearMonth",
37
+ "hexBinary",
38
+ "int",
39
+ "integer",
40
+ "language",
41
+ "long",
42
+ "negativeInteger",
43
+ "nonNegativeInteger",
44
+ "nonPositiveInteger",
45
+ "normalizedString",
46
+ "positiveInteger",
47
+ "short",
48
+ "string",
49
+ "time",
50
+ "token",
51
+ "unsignedByte",
52
+ "unsignedInt",
53
+ "unsignedLong",
54
+ "unsignedShort",
55
+ "yearMonthDuration",
56
+ ],
57
+ });
@@ -0,0 +1,19 @@
1
+ export { fromRdf, toRdf } from "rdf-literal";
2
+ import * as DataFactory from "rdf-data-factory";
3
+ export { DataFactory } from "rdf-data-factory";
4
+ export const namedNode = (value) => new DataFactory.NamedNode(value);
5
+ export const blankNode = (value) => new DataFactory.BlankNode(value);
6
+ export const literal = (value, languageOrDatatype) => new DataFactory.Literal(value, languageOrDatatype);
7
+ export const quad = (subject, predicate, object, graph) => new DataFactory.Quad(subject, predicate, object, graph || DataFactory.DefaultGraph.INSTANCE);
8
+ export const variable = (value) => new DataFactory.Variable(value);
9
+ export const quadsToGraph = (quads) => {
10
+ const graph = new Map();
11
+ for (const quad of quads) {
12
+ const s = quad.subject.value;
13
+ const p = quad.predicate.value;
14
+ const predicateMap = graph.get(s) || graph.set(s, new Map()).get(s);
15
+ const termArray = predicateMap.get(p) || predicateMap.set(p, []).get(p);
16
+ termArray.push(quad.object);
17
+ }
18
+ return graph;
19
+ };
@@ -0,0 +1 @@
1
+ export { createResource, Resource } from "./resource.js";
@@ -0,0 +1,147 @@
1
+ import { getSchemaProperties } from "../schema/mod.js";
2
+ import { $, CONSTRUCT, SELECT, INSERT, DELETE } from "../sparql.js";
3
+ import { variable, namedNode, quad } from "../rdf.js";
4
+ import { rdf, ldkit } from "../namespaces/mod.js";
5
+ import { encode } from "../encoder.js";
6
+ import { QueryHelper } from "./query_helper.js";
7
+ export class QueryBuilder {
8
+ constructor(schema, context) {
9
+ Object.defineProperty(this, "schema", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: void 0
14
+ });
15
+ Object.defineProperty(this, "schemaProperties", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ Object.defineProperty(this, "context", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ Object.defineProperty(this, "deleteQuery", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: (iris) => {
32
+ return DELETE `
33
+ ?s ?p ?o
34
+ `.WHERE `
35
+ ?s ?p ?o .
36
+ VALUES ?s { ${iris.map(namedNode)} }
37
+ `.build();
38
+ }
39
+ });
40
+ this.schema = schema;
41
+ this.schemaProperties = getSchemaProperties(this.schema);
42
+ this.context = context;
43
+ }
44
+ getResourceSignature() {
45
+ return quad(variable("iri"), namedNode(rdf.type), namedNode(ldkit.Resource));
46
+ }
47
+ getTypesSignature() {
48
+ return quad(variable("iri"), namedNode(rdf.type), variable("iri_type"));
49
+ }
50
+ entitiesToQuads(entities) {
51
+ const quadArrays = entities.map((entity) => encode(entity, this.schema, this.context));
52
+ return [].concat(...quadArrays);
53
+ }
54
+ getShape(includeOptional = false, wrapOptional = true, omitRootTypes = false) {
55
+ const mainVar = "iri";
56
+ const conditions = [];
57
+ const populateConditionsRecursive = (s, varPrefix) => {
58
+ const rdfType = s["@type"];
59
+ const properties = getSchemaProperties(s);
60
+ if (varPrefix !== "iri" || !omitRootTypes) {
61
+ rdfType.forEach((type) => {
62
+ conditions.push(quad(variable(varPrefix), namedNode(rdf.type), namedNode(type)));
63
+ });
64
+ }
65
+ Object.keys(properties).forEach((prop, index) => {
66
+ const property = properties[prop];
67
+ const isOptional = property["@optional"];
68
+ if (!includeOptional && isOptional) {
69
+ return;
70
+ }
71
+ if (wrapOptional && isOptional) {
72
+ conditions.push($ `\nOPTIONAL {`);
73
+ }
74
+ conditions.push(quad(variable(varPrefix), namedNode(property["@id"]), variable(`${varPrefix}_${index}`)));
75
+ if (typeof property["@context"] === "object") {
76
+ populateConditionsRecursive(property["@context"], `${varPrefix}_${index}`);
77
+ }
78
+ if (wrapOptional && isOptional) {
79
+ conditions.push($ `\n}\n`);
80
+ }
81
+ });
82
+ };
83
+ populateConditionsRecursive(this.schema, mainVar);
84
+ return conditions;
85
+ }
86
+ countQuery() {
87
+ const quads = this.getShape();
88
+ return SELECT `(count(?iri) as ?count)`.WHERE `${quads}`.build();
89
+ }
90
+ getQuery(where, limit = 1000) {
91
+ const selectSubQuery = SELECT `
92
+ ${variable("iri")}
93
+ `.WHERE `
94
+ ${this.getShape(false, true)}
95
+ ${where}
96
+ `.LIMIT(limit);
97
+ const query = CONSTRUCT `
98
+ ${this.getResourceSignature()}
99
+ ${this.getTypesSignature()}
100
+ ${this.getShape(true, false, true)}
101
+ `.WHERE `
102
+ ${this.getTypesSignature()}
103
+ ${this.getShape(true, true, true)}
104
+ {
105
+ ${selectSubQuery}
106
+ }
107
+ `.build();
108
+ return query;
109
+ }
110
+ getByIrisQuery(iris) {
111
+ const query = CONSTRUCT `
112
+ ${this.getResourceSignature()}
113
+ ${this.getTypesSignature()}
114
+ ${this.getShape(true, false, true)}
115
+ `.WHERE `
116
+ ${this.getTypesSignature()}
117
+ ${this.getShape(true, true, true)}
118
+ VALUES ?iri {
119
+ ${iris.map(namedNode)}
120
+ }
121
+ `.build();
122
+ return query;
123
+ }
124
+ insertQuery(entities) {
125
+ const quads = this.entitiesToQuads(entities);
126
+ return this.insertDataQuery(quads);
127
+ }
128
+ insertDataQuery(quads) {
129
+ return INSERT.DATA `${quads}`.build();
130
+ }
131
+ deleteDataQuery(quads) {
132
+ return $ `DELETE DATA { ${quads} }`.toString();
133
+ }
134
+ updateQuery(entities) {
135
+ const deleteQuads = [];
136
+ const insertQuads = [];
137
+ const whereQuads = [];
138
+ entities.forEach((entity, index) => {
139
+ const helper = new QueryHelper(entity, this.schema, this.context, 1000 * index);
140
+ deleteQuads.push(...helper.getDeleteQuads());
141
+ insertQuads.push(...helper.getInsertQuads());
142
+ whereQuads.push(...helper.getWhereQuads());
143
+ });
144
+ return DELETE `${deleteQuads}`.INSERT `${insertQuads}`
145
+ .WHERE `${deleteQuads}`.build();
146
+ }
147
+ }
@@ -0,0 +1,102 @@
1
+ import { encode } from "../encoder.js";
2
+ export class QueryHelper {
3
+ constructor(entity, schema, context, variableInitCounter = 0) {
4
+ Object.defineProperty(this, "entity", {
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true,
8
+ value: void 0
9
+ });
10
+ Object.defineProperty(this, "schema", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ Object.defineProperty(this, "context", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ Object.defineProperty(this, "variableInitCounter", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: void 0
27
+ });
28
+ Object.defineProperty(this, "quads", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ Object.defineProperty(this, "variableQuads", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
40
+ this.entity = entity;
41
+ this.schema = schema;
42
+ this.context = context;
43
+ this.variableInitCounter = variableInitCounter;
44
+ }
45
+ getQuads() {
46
+ if (!this.quads) {
47
+ this.quads = encode(this.entity, this.schema, this.context, this.variableInitCounter);
48
+ }
49
+ return this.quads;
50
+ }
51
+ getVariableQuads() {
52
+ if (!this.variableQuads) {
53
+ this.variableQuads = encode(this.getEntityWithReplacedVariables(), this.schema, this.context, this.variableInitCounter);
54
+ }
55
+ return this.variableQuads;
56
+ }
57
+ getDeleteQuads() {
58
+ return this.getVariableQuads().filter((quad) => quad.object.termType === "Variable");
59
+ }
60
+ getInsertQuads() {
61
+ return this.getQuads();
62
+ }
63
+ getWhereQuads() {
64
+ return this.getVariableQuads();
65
+ }
66
+ getEntityWithReplacedVariables() {
67
+ return this.replaceVariables(this.entity, this.schema);
68
+ }
69
+ replaceVariables(entity, schema) {
70
+ return Object.keys(entity).reduce((output, key) => {
71
+ const value = entity[key];
72
+ if (key === "$id") {
73
+ output.$id = value;
74
+ return output;
75
+ }
76
+ if (key === "$type") {
77
+ output.$type = value;
78
+ return output;
79
+ }
80
+ const property = schema[key];
81
+ if (!property) {
82
+ throw new Error("Unknown field '${key}' detected in entity");
83
+ }
84
+ if (!property["@context"]) {
85
+ output[key] = null;
86
+ return output;
87
+ }
88
+ if (property["@array"]) {
89
+ if (value.length === 0) {
90
+ output[key] = null;
91
+ }
92
+ else {
93
+ output[key] = value.map((subEntity) => this.replaceVariables(subEntity, property["@context"]));
94
+ }
95
+ }
96
+ else {
97
+ output[key] = this.replaceVariables(value, property["@context"]);
98
+ }
99
+ return output;
100
+ }, {});
101
+ }
102
+ }
@@ -0,0 +1,102 @@
1
+ import { map, switchMap, tap, share, BehaviorSubject } from "../rxjs.js";
2
+ import { bindingsQuery, quadsQuery, updateQuery } from "../engine.js";
3
+ import { resolveContext } from "../context.js";
4
+ import { expandSchema, } from "../schema/mod.js";
5
+ import { decode } from "../decoder.js";
6
+ import { QueryBuilder } from "./query_builder.js";
7
+ export const createResource = (spec, context) => new Resource(spec, context);
8
+ export class Resource {
9
+ constructor(schema, context) {
10
+ Object.defineProperty(this, "schema", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ Object.defineProperty(this, "context", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ Object.defineProperty(this, "queryBuilder", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: void 0
27
+ });
28
+ Object.defineProperty(this, "$trigger", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: new BehaviorSubject(null)
33
+ });
34
+ this.schema = expandSchema(schema);
35
+ this.context = resolveContext(context);
36
+ this.queryBuilder = new QueryBuilder(this.schema, this.context);
37
+ }
38
+ decode(graph) {
39
+ return decode(graph, this.schema, this.context);
40
+ }
41
+ count() {
42
+ const q = this.queryBuilder.countQuery();
43
+ console.log(q);
44
+ return this.$trigger.pipe(switchMap(() => bindingsQuery(q, this.context)), map((bindings) => {
45
+ console.warn("BINDINGS", bindings);
46
+ return parseInt(bindings[0].get("count").value);
47
+ }));
48
+ }
49
+ //exists(entity: Identity) {}
50
+ query(sparqlConstructQuery) {
51
+ console.log(sparqlConstructQuery);
52
+ return quadsQuery(sparqlConstructQuery, this.context).pipe(map((graph) => {
53
+ return this.decode(graph);
54
+ }));
55
+ }
56
+ find(where, limit) {
57
+ const q = this.queryBuilder.getQuery(where, limit);
58
+ console.log(q);
59
+ return this.$trigger.pipe(switchMap(() => quadsQuery(q, this.context)), map((graph) => {
60
+ return this.decode(graph);
61
+ }));
62
+ }
63
+ findByIri(iri) {
64
+ return this.findByIris([iri]).pipe(map((result) => (result.length > 0 ? result[0] : undefined)));
65
+ }
66
+ findByIris(iris) {
67
+ const q = this.queryBuilder.getByIrisQuery(iris);
68
+ console.log(q);
69
+ return this.$trigger.pipe(switchMap(() => quadsQuery(q, this.context)), map((graph) => {
70
+ return this.decode(graph);
71
+ }));
72
+ }
73
+ updateQuery(query) {
74
+ console.log(query);
75
+ const result = updateQuery(query, this.context).pipe(tap(() => this.$trigger.next(null)), share());
76
+ result.subscribe();
77
+ return result;
78
+ }
79
+ insert(...entities) {
80
+ const q = this.queryBuilder.insertQuery(entities);
81
+ return this.updateQuery(q);
82
+ }
83
+ insertData(...quads) {
84
+ const q = this.queryBuilder.insertDataQuery(quads);
85
+ return this.updateQuery(q);
86
+ }
87
+ update(...entities) {
88
+ const q = this.queryBuilder.updateQuery(entities);
89
+ return this.updateQuery(q);
90
+ }
91
+ delete(...identities) {
92
+ const iris = identities.map((identity) => {
93
+ return typeof identity === "string" ? identity : identity.$id;
94
+ });
95
+ const q = this.queryBuilder.deleteQuery(iris);
96
+ return this.updateQuery(q);
97
+ }
98
+ deleteData(...quads) {
99
+ const q = this.queryBuilder.deleteDataQuery(quads);
100
+ return this.updateQuery(q);
101
+ }
102
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { from, BehaviorSubject, } from "rxjs";
2
+ export { map, switchMap, tap, share, } from "rxjs/operators";
@@ -0,0 +1,37 @@
1
+ import { rdf, xsd } from "../namespaces/mod.js";
2
+ const SupportedDataTypesPrototype = {
3
+ [xsd.dateTime]: new Date(),
4
+ [xsd.date]: new Date(),
5
+ [xsd.gDay]: new Date(),
6
+ [xsd.gMonthDay]: new Date(),
7
+ [xsd.gYear]: new Date(),
8
+ [xsd.gYearMonth]: new Date(),
9
+ [xsd.boolean]: true,
10
+ [xsd.double]: 0.0,
11
+ [xsd.decimal]: 0.0,
12
+ [xsd.float]: 0.0,
13
+ [xsd.integer]: 0,
14
+ [xsd.long]: 0,
15
+ [xsd.int]: 0,
16
+ [xsd.byte]: 0,
17
+ [xsd.short]: 0,
18
+ [xsd.negativeInteger]: 0,
19
+ [xsd.nonNegativeInteger]: 0,
20
+ [xsd.nonPositiveInteger]: 0,
21
+ [xsd.positiveInteger]: 0,
22
+ [xsd.unsignedByte]: 0,
23
+ [xsd.unsignedInt]: 0,
24
+ [xsd.unsignedLong]: 0,
25
+ [xsd.unsignedShort]: 0,
26
+ [xsd.string]: "",
27
+ [xsd.normalizedString]: "",
28
+ [xsd.anyURI]: "",
29
+ [xsd.base64Binary]: "",
30
+ [xsd.language]: "",
31
+ [xsd.Name]: "",
32
+ [xsd.NCName]: "",
33
+ [xsd.NMTOKEN]: "",
34
+ [xsd.token]: "",
35
+ [xsd.hexBinary]: "",
36
+ [rdf.langString]: "",
37
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { expandSchema, getSchemaProperties } from "./utils.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ import { xsd } from "../namespaces/mod.js";
2
+ export const expandSchema = (schemaPrototype) => {
3
+ const expandArray = (stringOrStrings) => {
4
+ return Array.isArray(stringOrStrings) ? stringOrStrings : [stringOrStrings];
5
+ };
6
+ const expandSchemaProperty = (stringOrProperty) => {
7
+ if (typeof stringOrProperty === "string") {
8
+ return {
9
+ "@id": stringOrProperty,
10
+ "@type": xsd.string,
11
+ };
12
+ }
13
+ const property = stringOrProperty;
14
+ if (!property["@id"]) {
15
+ throw new Error(`Invalid schema, "@id" key for property missing`);
16
+ }
17
+ const validKeys = [
18
+ "@context",
19
+ "@id",
20
+ "@type",
21
+ "@array",
22
+ "@optional",
23
+ "@multilang",
24
+ ];
25
+ const baseProperty = {
26
+ "@id": "",
27
+ };
28
+ const expandedProperty = Object.keys(property).reduce((acc, key) => {
29
+ if (key === "@context") {
30
+ acc[key] = expandSchema(property[key]);
31
+ }
32
+ else if (validKeys.includes(key)) {
33
+ acc[key] = property[key];
34
+ }
35
+ return acc;
36
+ }, baseProperty);
37
+ if (!baseProperty["@type"] && !baseProperty["@context"]) {
38
+ baseProperty["@type"] = xsd.string;
39
+ }
40
+ return expandedProperty;
41
+ };
42
+ const baseSchema = {
43
+ "@type": [],
44
+ };
45
+ return Object.keys(schemaPrototype).reduce((acc, key) => {
46
+ if (key === "@type") {
47
+ acc[key] = expandArray(schemaPrototype[key]);
48
+ }
49
+ else {
50
+ acc[key] = expandSchemaProperty(schemaPrototype[key]);
51
+ }
52
+ return acc;
53
+ }, baseSchema);
54
+ };
55
+ export const getSchemaProperties = (schema) => {
56
+ const { "@type": _ommitedType, ...properties } = schema;
57
+ return properties;
58
+ };
@@ -0,0 +1,2 @@
1
+ export { sparql as $, } from "@tpluscode/rdf-string";
2
+ export { DELETE, INSERT, ASK, DESCRIBE, CONSTRUCT, SELECT, WITH, } from "@tpluscode/sparql-builder";
package/esm/mod.js ADDED
@@ -0,0 +1,3 @@
1
+ export { createResource } from "./library/resource/mod.js";
2
+ export { createNamespace } from "./library/namespaces/namespace.js";
3
+ export { createDefaultContext, createContext } from "./library/context.js";
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "module": "./esm/npm.js",
3
- "main": "./script/npm.js",
2
+ "module": "./esm/mod.js",
3
+ "main": "./script/mod.js",
4
4
  "name": "ldkit",
5
- "version": "0.0.1",
6
5
  "description": "LDKit",
7
6
  "license": "MIT",
7
+ "version": "0.0.2",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/karelklima/ldkit.git"
@@ -14,10 +14,21 @@
14
14
  },
15
15
  "exports": {
16
16
  ".": {
17
- "import": "./esm/npm.js",
18
- "require": "./script/npm.js"
17
+ "import": "./esm/mod.js",
18
+ "require": "./script/mod.js"
19
19
  }
20
20
  },
21
+ "dependencies": {
22
+ "@comunica/types": "2.4.0",
23
+ "@tpluscode/rdf-string": "0.2.26",
24
+ "@tpluscode/sparql-builder": "0.3.23",
25
+ "rdf-data-factory": "1.1.1",
26
+ "rdf-js": "4.0.2",
27
+ "rdf-literal": "1.3.0",
28
+ "rxjs": "7.5.6",
29
+ "@deno/shim-deno": "~0.9.0",
30
+ "undici": "^5.8.0"
31
+ },
21
32
  "devDependencies": {
22
33
  "@types/node": "16.11.37"
23
34
  }