ldkit 0.4.1 → 0.4.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.
@@ -1,4 +1,4 @@
1
- import { toRdf, DataFactory, literal, } from "./rdf.js";
1
+ import { DataFactory, literal, toRdf, } from "./rdf.js";
2
2
  import { rdf, xsd } from "./namespaces/mod.js";
3
3
  export const encode = (node, schema, context, variableInitCounter = 0) => {
4
4
  return Encoder.encode(node, schema, context, variableInitCounter);
@@ -100,7 +100,7 @@ class Encoder {
100
100
  this.push(nodeId, propertyId, subNodeId);
101
101
  return;
102
102
  }
103
- const propertyType = property["@type"] ?? xsd.string;
103
+ const propertyType = property["@type"] ? property["@type"] : xsd.string;
104
104
  if (typeof val === "string" && this.context.language) {
105
105
  if (propertyType === xsd.string || propertyType === rdf.langString) {
106
106
  this.push(nodeId, propertyId, literal(val, this.context.language));
@@ -108,7 +108,7 @@ class Encoder {
108
108
  }
109
109
  }
110
110
  const rdfValue = toRdf(val, {
111
- datatype: this.df.namedNode(property["@type"] ?? xsd.string),
111
+ datatype: this.df.namedNode(propertyType),
112
112
  });
113
113
  this.push(nodeId, propertyId, rdfValue);
114
114
  });
@@ -0,0 +1 @@
1
+ {"main":"../script/namespaces.js","module":"../esm/namespaces.js","types":"../types/namespaces.d.ts"}
package/package.json CHANGED
@@ -3,11 +3,13 @@
3
3
  "main": "./script/mod.js",
4
4
  "types": "./types/mod.d.ts",
5
5
  "name": "ldkit",
6
- "version": "0.4.1",
6
+ "version": "0.4.2",
7
7
  "description": "LDkit, a Linked Data query toolkit for TypeScript developers",
8
8
  "homepage": "https://ldkit.io",
9
9
  "author": "Karel Klima <karelklima@gmail.com> (https://karelklima.com)",
10
- "keywords": ["linked data, rdf, sparql"],
10
+ "keywords": [
11
+ "linked data, rdf, sparql"
12
+ ],
11
13
  "license": "MIT",
12
14
  "repository": {
13
15
  "type": "git",
@@ -48,4 +50,4 @@
48
50
  "rdf-literal": "1.3.0",
49
51
  "rxjs": "7.5.6"
50
52
  }
51
- }
53
+ }
@@ -0,0 +1 @@
1
+ {"main":"../script/rdf.js","module":"../esm/rdf.js","types":"../types/rdf.d.ts"}
@@ -104,7 +104,7 @@ class Encoder {
104
104
  this.push(nodeId, propertyId, subNodeId);
105
105
  return;
106
106
  }
107
- const propertyType = property["@type"] ?? mod_js_1.xsd.string;
107
+ const propertyType = property["@type"] ? property["@type"] : mod_js_1.xsd.string;
108
108
  if (typeof val === "string" && this.context.language) {
109
109
  if (propertyType === mod_js_1.xsd.string || propertyType === mod_js_1.rdf.langString) {
110
110
  this.push(nodeId, propertyId, (0, rdf_js_1.literal)(val, this.context.language));
@@ -112,7 +112,7 @@ class Encoder {
112
112
  }
113
113
  }
114
114
  const rdfValue = (0, rdf_js_1.toRdf)(val, {
115
- datatype: this.df.namedNode(property["@type"] ?? mod_js_1.xsd.string),
115
+ datatype: this.df.namedNode(propertyType),
116
116
  });
117
117
  this.push(nodeId, propertyId, rdfValue);
118
118
  });
@@ -0,0 +1 @@
1
+ {"main":"../script/sparql.js","module":"../esm/sparql.js","types":"../types/sparql.d.ts"}