///
import { OntologyNode, Ontology } from '../Utils/OntologyUtils';
import { Question, RecordClass } from '../Utils/WdkModel';
export declare type Dict = {
[key: string]: T;
};
export declare type TargetType = 'search' | 'attribute' | 'table';
export declare type Scope = 'record' | 'record-internal' | 'results' | 'results-internal' | 'download' | 'download-internal';
export interface CategoryNodeProperties {
targetType?: [TargetType];
scope?: [Scope];
label?: string[];
name?: string[];
'EuPathDB alternative term'?: string[];
hasDefinition?: string[];
hasNarrowSynonym?: string[];
hasExactSynonym?: string[];
recordClassName?: string[];
recordClassUrlSegment?: string[];
}
export declare type CategoryNode = OntologyNode<{
children: CategoryTreeNode[];
properties: CategoryNodeProperties;
}>;
export declare type IndividualNode = OntologyNode<{
children: CategoryTreeNode[];
properties: CategoryNodeProperties;
wdkReference: {
name: string;
displayName: string;
help?: string;
summary?: string;
description?: string;
};
}>;
export declare type CategoryTreeNode = CategoryNode | IndividualNode;
export declare type CategoryOntology = Ontology;
export declare const EMPTY_CATEGORY_TREE_NODE: CategoryTreeNode;
export declare function getId(node: CategoryTreeNode): string;
export declare function getLabel(node: CategoryTreeNode): string;
export declare function getTargetType(node: CategoryTreeNode): string;
export declare function getScopes(node: CategoryTreeNode): string[];
export declare function getRefName(node: CategoryTreeNode): string;
export declare function getRecordClassName(node: CategoryTreeNode): string;
export declare function getRecordClassUrlSegment(node: CategoryTreeNode): string;
export declare function getDisplayName(node: CategoryTreeNode): string;
export declare function getDescription(node: CategoryTreeNode): string | undefined;
export declare function getTooltipContent(node: CategoryTreeNode): string | undefined;
export declare function getFormattedTooltipContent(node: CategoryTreeNode): JSX.Element | undefined;
export declare function getSynonyms(node: CategoryTreeNode): string[];
export declare function getChildren(node: CategoryTreeNode): (CategoryTreeNode[] & import("./TreeUtils").Node<{
children: CategoryTreeNode[];
properties: CategoryNodeProperties;
} & {
properties: {
[key: string]: string[];
};
}>[]) | (CategoryTreeNode[] & import("./TreeUtils").Node<{
children: CategoryTreeNode[];
properties: CategoryNodeProperties;
wdkReference: {
name: string;
displayName: string;
help?: string | undefined;
summary?: string | undefined;
description?: string | undefined;
};
} & {
properties: {
[key: string]: string[];
};
}>[]);
/**
* Returns a JSON object representing a simplified category tree node that will be properly interpreted
* by the checkboxTreeController
* @param id - name or id of the node
* @param displayName - name to be displayed
* @param description - tooltip
* @returns {{properties: {targetType: string[], name: *[]}, wdkReference: {displayName: *, help: *}, children: Array}}
*/
export declare function createNode(id: string, displayName: string, description?: string, children?: CategoryTreeNode[]): CategoryTreeNode;
/**
* Creates and adds a subtree to the given category tree containing the
* question-specific (i.e. dynamic) attributes associated with the given
* question. The subtree is added as the first child.
*
* @param question question whose dynamic attributes should be added
* @param categoryTree root node of a categories ontology tree to modify
*/
export declare function addSearchSpecificSubtree(question: Question, categoryTree: CategoryTreeNode): CategoryTreeNode;
/**
* Callback to provide the value/id of the node (i.e. checkbox value). Using 'name' for
* leaves and processed 'label' for branches
* @param node - given id
* @returns {*} - id/value of node
*/
export declare function getNodeId(node: CategoryTreeNode): string;
declare type QualifyingSpec = {
[K in keyof CategoryNodeProperties]: string;
};
/**
* Create a predicate function to filter out of the Categories ontology tree those items appropriate for the given
* scope that identify attributes for the current record class. In the case of the Transcript Record Class, a
* distinction is made depending on whether the summary view applies to transcripts or genes.
*/
export declare function isQualifying(spec: QualifyingSpec): (node: CategoryTreeNode) => boolean;
export declare function isIndividual(node: CategoryTreeNode): node is IndividualNode;
/**
* Callback to provide a React element holding the display name and description for the node
* @param node - given node
* @returns {React.Element} - React element
*/
export declare function BasicNodeComponent(props: {
node: CategoryTreeNode;
}): JSX.Element;
/**
* Returns whether the passed node 'matches' the passed node's display name
* or description.
*
* @param node node to test
* @param searchText search text to match against
* @returns true if node 'matches' the passed search text
*/
export declare function nodeSearchPredicate(node: CategoryTreeNode, searchQueryTerms: string[]): boolean;
/**
* Finds the "left-most" leaf in the tree and returns its ID using getNodeId()
*/
export declare function findFirstLeafId(ontologyTreeRoot: CategoryTreeNode): string;
/**
* Returns an array of all the IDs of the leaf nodes in the passed tree. If the
* root has no children, this function assumes a "null" tree, and returns an empty array.
*/
export declare function getAllLeafIds(ontologyTreeRoot: CategoryTreeNode): string[];
export declare function getAllBranchIds(categoryTree: CategoryTreeNode): string[];
/**
* Removed paths from tree that refer to unknown Wdk Model entities.
*/
export declare function pruneUnknownPaths(recordClasses: Dict, questions: Dict, ontology: CategoryOntology): CategoryOntology & {
tree: import("./TreeUtils").Node;
};
export declare function isIndividualKnownWith(recordClasses: Dict, questions: Dict): (node: OntologyNode<{}>) => boolean;
/**
* Adds the related WDK reference to each node. This function mutates the
* ontology tree, which is ok since we are doing this before we cache the
* result. It might be useful for this to return a new copy of the ontology
* in the future, but for now this saves some performance.
*/
export declare function resolveWdkReferences(recordClasses: Dict, questions: Dict, ontology: CategoryOntology): CategoryOntology;
/**
* Sort ontology node siblings. This function mutates the tree, so should
* only be used before caching the ontology.
*/
export declare function sortOntology(recordClasses: Dict, questions: Dict, ontology: CategoryOntology): CategoryOntology;
export {};
//# sourceMappingURL=CategoryUtils.d.ts.map