All files / views/trees/definition-tree/nodes/validators validator-class-node.ts

100% Statements 10/10
100% Branches 4/4
100% Functions 4/4
100% Lines 10/10

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            27x       20x 20x   20x 20x   20x 12x 11x           7x       5x    
import { _SH, SH } from "@faubulous/mentor-rdf";
import { ClassNodeBase } from "../classes/class-node-base";
import { ValidatorNode } from "./validator-node";
 
export class ValidatorClassNode 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.Validator : 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(ValidatorClassNode, iri);
	}
 
	override getIndividualNode(iri: string) {
		return this.createChildNode(ValidatorNode, iri);
	}
}