@rdfx/resource 0.0.19 → 0.0.20
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/Value.d.ts +4 -0
- package/dist/Value.js +15 -0
- package/dist/vocabularies.d.ts +1 -0
- package/dist/vocabularies.js +1 -0
- package/package.json +4 -4
package/dist/Value.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ export declare class Value<TermT extends Term = Term> {
|
|
|
59
59
|
*/
|
|
60
60
|
toIri(): Either<Error, NamedNode>;
|
|
61
61
|
toIri<T extends NamedNode>(in_: readonly T[]): Either<Error, T>;
|
|
62
|
+
/**
|
|
63
|
+
* Try to convert this term to an rdf:langString Literal.
|
|
64
|
+
*/
|
|
65
|
+
toLangString(in_?: readonly Literal[]): Either<Error, Literal>;
|
|
62
66
|
/**
|
|
63
67
|
* Try to convert this term to an RDF list.
|
|
64
68
|
*/
|
package/dist/Value.js
CHANGED
|
@@ -5,6 +5,7 @@ import { MistypedPrimitiveValueError } from "./MistypedPrimitiveValueError.js";
|
|
|
5
5
|
import { MistypedTermValueError } from "./MistypedTermValueError.js";
|
|
6
6
|
import { Resource } from "./Resource.js";
|
|
7
7
|
import { Values } from "./Values.js";
|
|
8
|
+
import { rdf } from "./vocabularies.js";
|
|
8
9
|
export class Value {
|
|
9
10
|
dataFactory;
|
|
10
11
|
focusResource;
|
|
@@ -78,6 +79,20 @@ export class Value {
|
|
|
78
79
|
}
|
|
79
80
|
return this.constrainTerm(this.term, in_);
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Try to convert this term to an rdf:langString Literal.
|
|
84
|
+
*/
|
|
85
|
+
toLangString(in_) {
|
|
86
|
+
return this.toLiteral(in_).chain((literal) => {
|
|
87
|
+
if (!literal.datatype.equals(rdf.langString)) {
|
|
88
|
+
return Left(this.newMistypedTermValueError("rdf:langString"));
|
|
89
|
+
}
|
|
90
|
+
if (literal.language.length === 0) {
|
|
91
|
+
return Left(this.newMistypedTermValueError("rdf:langString"));
|
|
92
|
+
}
|
|
93
|
+
return Either.of(literal);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
81
96
|
/**
|
|
82
97
|
* Try to convert this term to an RDF list.
|
|
83
98
|
*/
|
package/dist/vocabularies.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare namespace rdf {
|
|
2
2
|
const first: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/1999/02/22-rdf-syntax-ns#first">;
|
|
3
|
+
const langString: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString">;
|
|
3
4
|
const nil: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil">;
|
|
4
5
|
const rest: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest">;
|
|
5
6
|
const type: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/1999/02/22-rdf-syntax-ns#type">;
|
package/dist/vocabularies.js
CHANGED
|
@@ -2,6 +2,7 @@ import dataFactory from "@rdfx/data-factory";
|
|
|
2
2
|
export var rdf;
|
|
3
3
|
(function (rdf) {
|
|
4
4
|
rdf.first = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
|
|
5
|
+
rdf.langString = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
|
|
5
6
|
rdf.nil = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
|
|
6
7
|
rdf.rest = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
|
|
7
8
|
rdf.type = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@rdfx/literal": "0.0.
|
|
4
|
-
"@rdfx/string": "0.0.
|
|
3
|
+
"@rdfx/literal": "0.0.20",
|
|
4
|
+
"@rdfx/string": "0.0.20",
|
|
5
5
|
"@rdfjs/term-set": "~2.0.3",
|
|
6
6
|
"@rdfjs/types": "~2.0.1",
|
|
7
7
|
"@types/rdfjs__term-set": "~2.0.9",
|
|
8
8
|
"purify-ts": "~2.1.4"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@rdfx/data-factory": "0.0.
|
|
11
|
+
"@rdfx/data-factory": "0.0.20",
|
|
12
12
|
"@rdfjs/dataset": "~2.0.2",
|
|
13
13
|
"@tpluscode/rdf-ns-builders": "~4.3.0",
|
|
14
14
|
"@types/rdfjs__dataset": "~2.0.7",
|
|
@@ -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.20"
|
|
44
44
|
}
|