@rdfx/resource 0.0.9 → 0.0.10
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/dist/Identifier.d.ts +1 -7
- package/dist/Identifier.js +1 -15
- package/dist/Resource.d.ts +1 -2
- package/dist/Resource.js +0 -2
- package/dist/Value.js +4 -4
- package/package.json +4 -4
package/dist/Identifier.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type { BlankNode,
|
|
1
|
+
import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
2
2
|
export type Identifier = BlankNode | NamedNode;
|
|
3
|
-
export declare namespace Identifier {
|
|
4
|
-
function fromString({ dataFactory, identifier, }: {
|
|
5
|
-
dataFactory: DataFactory;
|
|
6
|
-
identifier: string;
|
|
7
|
-
}): BlankNode | NamedNode<string>;
|
|
8
|
-
}
|
|
9
3
|
//# sourceMappingURL=Identifier.d.ts.map
|
package/dist/Identifier.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (Identifier) {
|
|
3
|
-
function fromString({ dataFactory, identifier, }) {
|
|
4
|
-
if (identifier.startsWith("_:")) {
|
|
5
|
-
return dataFactory.blankNode(identifier.substring("_:".length));
|
|
6
|
-
}
|
|
7
|
-
if (identifier.startsWith("<") &&
|
|
8
|
-
identifier.endsWith(">") &&
|
|
9
|
-
identifier.length > 2) {
|
|
10
|
-
return dataFactory.namedNode(identifier.substring(1, identifier.length - 1));
|
|
11
|
-
}
|
|
12
|
-
throw new RangeError(identifier);
|
|
13
|
-
}
|
|
14
|
-
Identifier.fromString = fromString;
|
|
15
|
-
})(Identifier || (Identifier = {}));
|
|
1
|
+
export {};
|
|
16
2
|
//# sourceMappingURL=Identifier.js.map
|
package/dist/Resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlankNode, DataFactory, DatasetCore, Literal, NamedNode, Quad_Graph, Variable } from "@rdfjs/types";
|
|
2
2
|
import { Either } from "purify-ts";
|
|
3
|
-
import { Identifier as _Identifier,
|
|
3
|
+
import type { Identifier as _Identifier, Identifier } from "./Identifier.js";
|
|
4
4
|
import { ListStructureError as _ListStructureError } from "./ListStructureError.js";
|
|
5
5
|
import { MistypedTermValueError as _MistypedTermValueError } from "./MistypedTermValueError.js";
|
|
6
6
|
import type { Primitive } from "./Primitive.js";
|
|
@@ -95,7 +95,6 @@ type InversePath = {
|
|
|
95
95
|
readonly termType: "InversePath";
|
|
96
96
|
};
|
|
97
97
|
export declare namespace Resource {
|
|
98
|
-
const Identifier: typeof _Identifier;
|
|
99
98
|
type Identifier = _Identifier;
|
|
100
99
|
const ListStructureError: typeof _ListStructureError;
|
|
101
100
|
type ListStructureError = _ListStructureError;
|
package/dist/Resource.js
CHANGED
|
@@ -3,7 +3,6 @@ import defaultDataFactory from "@rdfx/data-factory";
|
|
|
3
3
|
import { LiteralFactory } from "@rdfx/literal";
|
|
4
4
|
import { Either, Left } from "purify-ts";
|
|
5
5
|
import { DatasetValues } from "./DatasetValues.js";
|
|
6
|
-
import { Identifier as _Identifier } from "./Identifier.js";
|
|
7
6
|
import { ListStructureError as _ListStructureError } from "./ListStructureError.js";
|
|
8
7
|
import { MistypedTermValueError as _MistypedTermValueError } from "./MistypedTermValueError.js";
|
|
9
8
|
import { Value as _Value } from "./Value.js";
|
|
@@ -344,7 +343,6 @@ export class Resource {
|
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
345
|
(function (Resource) {
|
|
347
|
-
Resource.Identifier = _Identifier;
|
|
348
346
|
Resource.ListStructureError = _ListStructureError;
|
|
349
347
|
Resource.MistypedTermValueError = _MistypedTermValueError;
|
|
350
348
|
Resource.ValueError = _ValueError;
|
package/dist/Value.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import toNT from "@rdfjs/to-ntriples";
|
|
2
1
|
import { LiteralDecoder } from "@rdfx/literal";
|
|
2
|
+
import { NTriplesTerm } from "@rdfx/string";
|
|
3
3
|
import { Either, Left } from "purify-ts";
|
|
4
4
|
import { MistypedPrimitiveValueError } from "./MistypedPrimitiveValueError.js";
|
|
5
5
|
import { MistypedTermValueError } from "./MistypedTermValueError.js";
|
|
@@ -85,10 +85,10 @@ export class Value {
|
|
|
85
85
|
*/
|
|
86
86
|
toLiteral(in_) {
|
|
87
87
|
if (this.term.termType !== "Literal") {
|
|
88
|
-
return Left(this.newMistypedTermValueError(in_ ? in_.map(
|
|
88
|
+
return Left(this.newMistypedTermValueError(in_ ? in_.map(NTriplesTerm.stringify).join(" | ") : "Literal"));
|
|
89
89
|
}
|
|
90
90
|
if (in_ && !in_.some((check) => check.equals(this.term))) {
|
|
91
|
-
return Left(this.newMistypedTermValueError(in_ ? in_.map(
|
|
91
|
+
return Left(this.newMistypedTermValueError(in_ ? in_.map(NTriplesTerm.stringify).join(" | ") : "Literal"));
|
|
92
92
|
}
|
|
93
93
|
return Either.of(this.term);
|
|
94
94
|
}
|
|
@@ -154,7 +154,7 @@ export class Value {
|
|
|
154
154
|
if (in_ && !in_.some((check) => value.equals(check))) {
|
|
155
155
|
return Left(new MistypedTermValueError({
|
|
156
156
|
actualValue: value,
|
|
157
|
-
expectedValueType: in_.map(
|
|
157
|
+
expectedValueType: in_.map(NTriplesTerm.stringify).join(" | "),
|
|
158
158
|
focusResource: this.focusResource,
|
|
159
159
|
propertyPath: this.propertyPath,
|
|
160
160
|
}));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@rdfx/data-factory": "0.0.
|
|
4
|
-
"@rdfx/literal": "0.0.
|
|
3
|
+
"@rdfx/data-factory": "0.0.10",
|
|
4
|
+
"@rdfx/literal": "0.0.10",
|
|
5
|
+
"@rdfx/string": "0.0.10",
|
|
5
6
|
"@rdfjs/term-set": "~2.0.3",
|
|
6
|
-
"@rdfjs/to-ntriples": "~3.0.1",
|
|
7
7
|
"@rdfjs/types": "~2.0.1",
|
|
8
8
|
"@types/rdfjs__term-set": "~2.0.9",
|
|
9
9
|
"purify-ts": "~2.1.4"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
},
|
|
41
41
|
"type": "module",
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
|
-
"version": "0.0.
|
|
43
|
+
"version": "0.0.10"
|
|
44
44
|
}
|