@faubulous/mentor-rdf 1.2.0 → 1.2.1

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/index.js CHANGED
@@ -7491,6 +7491,28 @@ var ShapeRepository = class extends IndividualRepository {
7491
7491
  };
7492
7492
  return parse(subject, 0);
7493
7493
  }
7494
+ /**
7495
+ * Get the first discovered path from a given shape class to the sh:Shape root.
7496
+ * @param graphUris URIs of the graphs to search (should include the SHACL ontology graph).
7497
+ * @param subjectUri URI of a shape class.
7498
+ * @param options Optional query parameters.
7499
+ * @returns An iterator containing the path from the given class up to sh:Shape.
7500
+ */
7501
+ *getRootShapePath(graphUris, subjectUri, options) {
7502
+ yield* this._getRootShapePath(graphUris, subjectUri, [], /* @__PURE__ */ new Set(), options);
7503
+ }
7504
+ _getRootShapePath(graphUris, subjectUri, path, backtrack, options) {
7505
+ for (let o of this.getSuperClasses(graphUris, subjectUri, options)) {
7506
+ if (o === SH.Shape) {
7507
+ return path;
7508
+ }
7509
+ if (!backtrack.has(o)) {
7510
+ backtrack.add(o);
7511
+ return this._getRootShapePath(graphUris, o, [...path, o], backtrack, options);
7512
+ }
7513
+ }
7514
+ return path;
7515
+ }
7494
7516
  };
7495
7517
 
7496
7518
  // src/rdf/vocabulary-repository.ts