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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1x 4x 6x 2x 2x 2x 2x 61x 61x 61x 9x 52x 12x 12x 12x 12x 13x 12x 1x 6x 6x 2x 4x 4x 4x | import * as vscode from "vscode";
import { TreeNode, sortByLabel } from "@src/views/trees/tree-node";
import { DefinitionTreeNode } from "../../definition-tree-node";
import { CollectionClassNode } from "./collection-class-node";
export class CollectionsNode extends CollectionClassNode {
override getContextValue(): string {
return 'collections';
}
override getIcon(): vscode.ThemeIcon | undefined {
return undefined;
}
override getLabel(): vscode.TreeItemLabel {
return { label: 'Collections' };
}
override getDescription(): string {
const graphs = this.getDocumentGraphs();
const options = this.getQueryOptions();
// Note: The description shows the total number of collections, not only the root collections.
const collections = [...this.vocabulary.getCollections(graphs, options)];
return collections.length.toString();
}
override hasChildren(): boolean {
const graphs = this.getDocumentGraphs();
const options = this.getQueryOptions();
for (const _ of this.vocabulary.getRootCollections(graphs, options)) {
return true;
}
return false;
}
override getChildren(): TreeNode[] {
const result = [];
const graphs = this.getDocumentGraphs();
const options = this.getQueryOptions();
// Note: Only the collections that are not nested in another collection are listed here.
// The nested collections are provided by their parent collection nodes.
for (const c of this.vocabulary.getRootCollections(graphs, options)) {
result.push(this.createChildNode(CollectionClassNode, c));
}
return sortByLabel(result);
}
override getTooltip(): vscode.MarkdownString | undefined {
return undefined;
}
override resolveNodeForUri(iri: string): DefinitionTreeNode | undefined {
const graphs = this.getDocumentGraphs();
if (!this.vocabulary.isCollection(graphs, iri)) {
return undefined;
}
// The path goes from the collection to its root collection, so it needs to be reversed.
const rootToNode = this.vocabulary.getRootCollectionPath(graphs, iri).reverse();
rootToNode.push(iri);
return this.walkHierarchyPath(rootToNode);
}
}
|