rdfjs-resource 3.0.4 → 3.0.5
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/PropertyPath.d.ts +1 -0
- package/dist/PropertyPath.js +28 -0
- package/package.json +1 -1
package/dist/PropertyPath.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface ZeroOrOnePath {
|
|
|
32
32
|
*/
|
|
33
33
|
export type PropertyPath = AlternativePath | InversePath | OneOrMorePath | PredicatePath | SequencePath | ZeroOrMorePath | ZeroOrOnePath;
|
|
34
34
|
export declare namespace PropertyPath {
|
|
35
|
+
function equals(left: PropertyPath, right: PropertyPath): boolean;
|
|
35
36
|
function $fromRdf(resource: Resource, options?: {
|
|
36
37
|
[index: string]: unknown;
|
|
37
38
|
graph?: Exclude<Quad_Graph, Variable>;
|
package/dist/PropertyPath.js
CHANGED
|
@@ -6,6 +6,34 @@ import { ResourceSet } from "./ResourceSet.js";
|
|
|
6
6
|
import { sh } from "./vocabularies.js";
|
|
7
7
|
export var PropertyPath;
|
|
8
8
|
(function (PropertyPath) {
|
|
9
|
+
function equals(left, right) {
|
|
10
|
+
if (left.termType !== right.termType) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
switch (left.termType) {
|
|
14
|
+
case "AlternativePath":
|
|
15
|
+
case "SequencePath": {
|
|
16
|
+
const right_ = right;
|
|
17
|
+
if (left.members.length !== right_.members.length) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
for (let memberI = 0; memberI < left.members.length; memberI++) {
|
|
21
|
+
if (!PropertyPath.equals(left.members[memberI], right_.members[memberI])) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
case "NamedNode":
|
|
28
|
+
return left.equals(right);
|
|
29
|
+
case "InversePath":
|
|
30
|
+
case "OneOrMorePath":
|
|
31
|
+
case "ZeroOrMorePath":
|
|
32
|
+
case "ZeroOrOnePath":
|
|
33
|
+
return PropertyPath.equals(left.path, right.path);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
PropertyPath.equals = equals;
|
|
9
37
|
function $fromRdf(resource, options) {
|
|
10
38
|
// Predicate path
|
|
11
39
|
// sh:path ex:parent
|
package/package.json
CHANGED