Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 12x 12x 18x 1x 17x 18x 17x 12x | import { rdf, sh, SH, Store } from '@faubulous/mentor-rdf';
import { InferenceUri } from '@src/providers/inference-uri';
/**
* Returns the human-readable label of a SHACL severity IRI (`Violation`,
* `Warning`, `Info`), or the IRI itself when it is not a known severity.
*/
export function getSeverityLabel(severity: string): string {
switch (severity) {
case SH.Violation: return 'Violation';
case SH.Warning: return 'Warning';
case SH.Info: return 'Info';
default: return severity;
}
}
/**
* Returns the sorted URIs of all graphs in the store that contain SHACL shape
* definitions (`sh:NodeShape` or `sh:PropertyShape`), skipping inference graphs.
*/
export function getShapeGraphCandidates(store: Store): string[] {
const result: string[] = [];
for (const graphUri of store.getGraphs().sort()) {
if (InferenceUri.isInferenceUri(graphUri)) {
continue;
}
const hasShapes =
store.any(graphUri, null, rdf.type, sh.NodeShape) ||
store.any(graphUri, null, rdf.type, sh.PropertyShape);
if (hasShapes) {
result.push(graphUri);
}
}
return result;
}
|