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 | 40x 25x 25x 25x 25x 25x 13x 12x 7x 8x 8x 8x 1x 7x 1x 6x | import { _SH, SH } from "@faubulous/mentor-rdf";
import { ClassNodeBase } from "../classes/class-node-base";
import { NodeShapeNode, PropertyShapeNode, ParameterNode } from "../shapes/shape-node";
export class ShapeClassNode extends ClassNodeBase {
override getOntologyGraphs(): string[] {
return [_SH, ...this.document.graphs];
}
override *getSubClassIris(): IterableIterator<string> {
const options = this.getQueryOptions();
options.notDefinedBy?.add(_SH);
const uri = this.uri.startsWith('mentor') ? SH.Shape : this.uri;
const classIris = this.vocabulary.getSubClasses(this.getOntologyGraphs(), uri);
for (const c of classIris) {
if (this.vocabulary.hasSubjectsOfType(this.getDocumentGraphs(), c, options)) {
yield c;
}
}
}
override getClassNode(iri: string) {
return this.createChildNode(ShapeClassNode, iri);
}
override getIndividualNode(iri: string) {
const graphs = this.getOntologyGraphs();
const options = this.getQueryOptions({ includeInferred: true });
if (this.vocabulary.hasType(graphs, iri, SH.Parameter, options)) {
return this.createChildNode(ParameterNode, iri);
} else if (this.vocabulary.hasType(graphs, iri, SH.PropertyShape, options)) {
return this.createChildNode(PropertyShapeNode, iri);
} else {
return this.createChildNode(NodeShapeNode, iri);
}
}
} |