import { Criteria, EuiCardProps } from '@elastic/eui';
import { Action } from '@elastic/eui/src/components/basic_table/action_types';
import { EuiComboBoxProps } from '@elastic/eui/src/components/combo_box/combo_box';
import { EuiLinkColor } from '@elastic/eui/src/components/link/link';
import { EuiTextProps } from '@elastic/eui/src/components/text/text';
import { EntityValue } from '../components/widgets/AutocompleteWidget/AutocompleteWidget';
import { Entity, Individual, Ontologies, Ontology, Thing } from '../model/interfaces';
import { BuildHierarchyProps, HierarchyIriProp } from '../model/interfaces/HierarchyBuilder';
import { EntityTypeName, ThingTypeName } from '../model/ModelTypeCheck';
import { default as Reified } from '../model/Reified';
type ParameterObj = {
parameter?: string;
};
type TermParameterObj = {
/**
* Additional parameters to pass to the API.
*
* Each parameter can be combined via
* the special character &. The values of a parameter key can be combined with a comma sign
* ,. The following keys could be used:
*
* | Parameter | Description |
* | lang | Set the language for the response e.g. en, de, fr. The default value is en. |
* | collection | Restrict a search to a terminology subset e.g. collection=nfdi4health |
* | database | Restrict a search via the API Gateway to specific terminology software stacks, choose from ols, ontoportal, or skosmos |
*
*/
parameter?: string;
};
type ApiObj = {
/**
* The API instance for the API call.
*/
api: string;
};
type UseLegacyObj = {
/**
* Toggle between OLS3 (legacy) and OLS4 API versions.
*/
useLegacy?: boolean;
};
type OptionalThingTypeObj = {
/**
* Sets the type of the thing whose information you want to fetch.
*/
thingType?: ThingTypeName;
};
type OptionalEntityTypeObj = {
/**
* Sets the type of the entity whose information you want to fetch.
*/
entityType?: EntityTypeName;
};
type OptionalOntologyIdObj = {
/**
* Select a specific ontology by id
*/
ontologyId?: string;
};
type ForcedOntologyIdObj = {
/**
* Select a specific ontology by id
*/
ontologyId: string;
};
type OptionalIriObj = {
/**
* Entity IRI whose information you want to fetch.
*/
iri?: string;
};
type ForcedIriObj = {
/**
* Entity IRI whose information you want to fetch.
*/
iri: string;
};
type HasTitleObj = {
/**
* Show title, default is true
*/
hasTitle?: boolean;
};
type ShowBadgesObj = {
/**
* If true (default), entity badges linking to their defining ontologies are shown.
*/
showBadges?: boolean;
};
type TargetLinkObj = {
/**
* Possible hyperlink to a corresponding terminology in a Resource Name cell. Set this if you want
* a hyperlink to the terminology overview of your terminology service. Leave it blank if your application
* isn't a terminology service.
*/
targetLink?: string;
};
type ContainerWidthObj = {
/**
* The container width for a target widget render function. Example: EuiCard for OntologyInfoWidget
*/
width?: number;
};
export type CssClassNameObj = {
/**
* CSS class for styling
*/
className?: string;
};
type TabList = {
/**
* It is possible to show and hide the Alternative Names tab. **True** shows the tab. **False** hides the tab.
*/
altNamesTab?: boolean;
/**
* It is possible to show and hide the Hierarchy tab. **True** shows the tab. **False** hides the tab.
*/
hierarchyTab?: boolean;
/**
* It is possible to show and hide the Cross-references tab. **True** shows the tab. **False** hides the tab.
*/
crossRefTab?: boolean;
/**
* It is possible to show and hide the About Terminology Info tab. **True** shows the tab. **False** hides the tab.
*/
terminologyInfoTab?: boolean;
/**
* It is possible to show and hide the Graph view tab. **True** shows the tab. **False** hides the tab.
* */
graphViewTab?: boolean;
/**
* It is possible to show and hide the TermDepiction tab. **True** shows the tab. **False** hides the tab.
* */
termDepictionTab?: boolean;
/**
* It is possible to show and hide the EntityInfo tab. **True** shows the tab. **False** hides the tab.
* */
entityInfoTab?: boolean;
/**
* It is possible to show and hide the EntityRelations tab. **True** shows the tab. **False** hides the tab.
* */
entityRelationTab?: boolean;
/**
* This argument can be used to define active/open tab by initialisation. The following values can be used:
* "synonyms" | "hierarchy" | "crossref" | "ontology" | "graphview" | "depiction" | "entityinfo" |
* "entityrelations"
* */
initialSelectedTab?: string;
};
export type AutocompleteWidgetProps = Partial> & ParameterObj & ApiObj & CssClassNameObj & UseLegacyObj & OnNavigateToOntology & {
/**
* A method that is called once the set of selection changes
*/
selectionChangedEvent: (selectedOptions: EntityValue[]) => void;
/**
* Pass pre-selected values. If `singleSelection == true`, only the first one is displayed.
*/
preselected?: EntityValue[];
/**
* Placeholder to show if no user input nor selection is performed.
*/
placeholder?: string;
/**
* If true, only the selected label of the entity is displayed. If false, the ontology and the entity short form is displayed behind the label. Default is true.
*/
hasShortSelectedLabel?: boolean;
/**
* If true, custom terms that are not found in any ontology can be added.
*/
allowCustomTerms?: boolean;
/**
* If true, only one concept can be selected at once.
*/
singleSelection?: boolean;
/**
* Display options in a compact format without descriptions - when this mode is activated, not all information is shown in order to save space.
*/
singleSuggestionRow?: boolean;
/**
* Whether to show the api source in the result list or not. Default is true. Only when the API Gateway is selected.
*/
showApiSource?: boolean;
/**
* Initial search value to show results on first render.
*/
initialSearchQuery?: string;
/**
* Show a button to open the search request.
*/
showApiRequestButton?: boolean;
};
export type DataContentWidgetProps = {
/**
* The API instance for the API call.
*/
api?: string;
} & ParameterObj & {
/**
* The id of a TS4NFDI API Gateway collection. If set, the statistics of
* that collection are shown instead of the OLS ontologies data.
*/
collectionId?: string;
};
export type DataContentPresentationProps = EuiTextProps & {
ontologiesData?: Ontologies;
isLoading?: boolean;
isError?: boolean;
dataUpdatedAt?: number;
};
export type EntityInfoWidgetProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & HasTitleObj & ShowBadgesObj & ParameterObj & UseLegacyObj & OnNavigates;
export type EntityInfoPresentationProps = ApiObj & ForcedIriObj & OptionalEntityTypeObj & HasTitleObj & ShowBadgesObj & UseLegacyObj & OnNavigates & EuiTextProps & {
/**
* The already resolved entity whose information is shown.
*/
entity?: Entity;
/**
* Shows a loading spinner instead of the information.
*/
isLoading?: boolean;
/**
* Error of a lookup performed by the caller, shown instead of the information.
*/
error?: string | unknown;
};
export type EntityRelationsWidgetProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & HasTitleObj & ShowBadgesObj & ParameterObj & OnNavigates;
export type EntityRelationsPresentationProps = OptionalEntityTypeObj & HasTitleObj & ShowBadgesObj & OnNavigates & EuiTextProps & {
/**
* The already resolved entity whose relations are shown.
*/
entity?: Entity;
/**
* Instances of the entity, shown in the instances section of a class.
*/
instances?: Individual[];
/**
* Shows a loading spinner instead of the relations.
*/
isLoading?: boolean;
/**
* True when a lookup performed by the caller failed. A message is shown
* instead of the relations.
*/
isError?: boolean;
};
export type JsonApiWidgetProps = {
/**
* The API query whose response JSON should be displayed on click.
*/
apiQuery: string;
/**
* The text displayed on the button.
*/
buttonText: string;
/**
* Size of the button.
*/
buttonSize?: "s" | "m";
};
export type ColorObj = {
/**
* Color object, can be primary, accent, success, warning, danger, ghost, text, subdued or a hex / rgb value
*/
color?: EuiLinkColor | string;
};
export type ColorFirstObj = {
/**
* Color of the first breadcrumb badge, can be primary, accent, success, warning, danger, ghost, text, subdued or a hex / rgb value
*/
colorFirst?: EuiLinkColor | string;
};
export type ColorSecondObj = {
/**
* Color of the second breadcrumb badge, can be primary, accent, success, warning, danger, ghost, text, subdued or a hex / rgb value
*/
colorSecond?: EuiLinkColor | string;
};
export type BreadcrumbWidgetProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & ParameterObj & UseLegacyObj & ColorFirstObj & ColorSecondObj & OnNavigateToOntology & CssClassNameObj;
export type BreadcrumbPresentationProps = OptionalOntologyIdObj & ColorFirstObj & ColorSecondObj & CssClassNameObj & OnNavigateToOntology & {
ontologyId?: string;
shortForm?: string;
entity?: {
properties: {
ontologyId: string;
shortForm: string;
[key: string]: any;
};
};
};
export type DescTextObj = {
/**
* Set your own description text manually that overwrites the text fetched from the API
*/
descText?: string;
};
export type DescriptionWidgetProps = EuiTextProps & ApiObj & OptionalThingTypeObj & OptionalOntologyIdObj & OptionalIriObj & ParameterObj & UseLegacyObj & DescTextObj & CssClassNameObj & {
/**
* Color of the text, names, hex or rgb
*/
color?: EuiLinkColor | string;
};
export type DescriptionPresentationProps = DescTextObj & CssClassNameObj & {
description: string;
isLoading?: boolean;
error?: string | unknown;
};
export type MathFormulaWidgetProps = OptionalIriObj & ApiObj & OptionalOntologyIdObj & {
/**
* The math property URI to render for the target term.
* Required when mathML is not provided.
*/
mathProperty?: string;
/**
* Inline MathML string to render directly.
* When provided, iri, ontologyId, and mathProperty are not required.
*/
mathML?: string;
};
export type IriWidgetProps = ForcedIriObj & CssClassNameObj & {
/**
* Set your own text manually, which will show as a clickable link instead of the IRI.
*/
iriText?: string;
/**
* Color of the text: "text", "accent", "primary", "success", "warning", "danger"
*/
color?: EuiLinkColor;
/**
* Indicates that the target is external and needs an icon.
*/
externalIcon?: boolean;
/**
* The iri should get appended to the urlPrefix or not. When provided, the iri gets encoded and appended to the urlPrefix.
*/
urlPrefix?: string;
/**
* Position a copy to clipboard button for the iri link. 'none' or not providing the option means hiding the button.
* left/right means showing the button on the left or right side of the iri link.
*/
copyButton?: "right" | "left" | "none";
};
export type TabSubwidgetsProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & TermParameterObj & UseLegacyObj & CssClassNameObj;
export type TabWidgetProps = TabSubwidgetsProps & TabList & OnNavigates & CssClassNameObj & {
hierarchyPreferredRoots?: boolean;
hierarchyKeepExpansionStates?: boolean;
hierarchyShowSiblingsOnInit?: boolean;
hierarchyWrap?: boolean;
/**
* When true, the graph will show the tree hierarchy for the target node in form of a graph.
*/
rootWalk?: boolean;
/**
* When true, the graph shows the nodes in their hierarchy based on their position in the tree. It should be used with the rootWalk mode to true.
*/
graphHierarchy?: boolean;
/**
* The edge label in the graph. Default is "is a". Only for sub-class predicators.
*/
edgeLabel?: string;
/**
* Callback function for double-clicking on a node in graph. The default behaviour is to expand the node.
* */
onNodeClick?: (iri: string) => void;
showHeader?: boolean;
showComparisonTitleInHeader?: boolean;
/**
* Prevent the graph to be rendered with full width (CSS width 100%).
* */
stopFullWidth?: boolean;
/**
* Show the input field for the targetIri in comparison mode.
*/
enableComparisonMode?: boolean;
/**
* Hide the graph legend. Default is false/undefined
*/
hideLegend?: boolean;
className?: string;
targetIri?: string;
};
export type TabPresentationProps = TabWidgetProps & {
data: Thing;
isLoading?: boolean;
error?: string | unknown;
onTargetIriChange?: (iri: string | undefined) => void;
};
export type EntityOntoListWidgetProps = TabSubwidgetsProps & ForcedOntologyIdObj & OnNavigateToOntology & CssClassNameObj;
export type NavigateToOntologyProps = OnNavigateToOntology & OptionalEntityTypeObj & OptionalIriObj & {
label?: string;
};
export type OntologyBadgeProps = NavigateToOntologyProps & OptionalOntologyIdObj & CssClassNameObj & ColorObj;
export type ExpandableOntologyBadgeListProps = NavigateToOntologyProps & {
ontolist: any[];
} & CssClassNameObj & ColorObj;
export type EntityOntoListPresentationProps = ExpandableOntologyBadgeListProps;
export type EntityDefinedByPresentationProps = ExpandableOntologyBadgeListProps;
export type EntityDefinedByWidgetProps = EntityOntoListWidgetProps;
export type AlternativeNameTabWidgetProps = TabSubwidgetsProps;
export type AlternativeNameTabWidgetPresentationProps = CssClassNameObj & {
synonyms: any[];
isLoading?: boolean;
error?: string | unknown;
};
export type CrossRefWidgetProps = TabSubwidgetsProps;
export type CrossRefPresentationProps = CssClassNameObj & {
crossrefs: any[];
isLoading?: boolean;
error?: string | unknown;
};
export type EntityData = {
iri: string;
label?: string;
definedBy?: string[];
/**
* should be present for use with hierarchy
*/
hasChildren?: boolean;
numDescendants?: number;
/**
* should be present for use with hierarchy
*/
parents?: Reified[];
color?: string;
};
export type OnNavigateToEntity = {
/**
* This function is called every time an entity link is clicked
* @param ontologyId obtains the ontologyId of the current ontology
* @param entityType obtains the entityType of the clicked entity
* @param entity.iri obtains the iri of the clicked entity
* @param entity.label obtains the label of the clicked entity
* @param entity.definedBy obtains the list of ontologies the clicked entity is defined in (only OLS)
* @param entity.hasChildren obtains a boolean indicating whether the clicked entity has child entities
* @param entity.numDescendants obtains the number of hierarchical descendants of the clicked entity (only OLS)
* @param entity.parents obtains the list of parent entities of the clicked entity (only OLS, Skosmos)
*/
onNavigateToEntity?: ((ontologyId: string, entityType?: string, entity?: EntityData) => void) | string;
};
export type OnNavigateToOntology = {
/**
* This function is called every time an entity link is clicked
* @param ontologyId obtains the ontologyId of the clicked badge
* @param entityType obtains the entityType of the clicked badge
* @param entity.iri obtains the iri of the clicked badge (can be empty)
* @param entity.label obtains the label of the clicked badge
* @param entity.definedBy obtains the list of ontologies the clicked entity is defined in (only OLS)
* @param entity.hasChildren obtains a boolean indicating whether the clicked entity has child entities
* @param entity.numDescendants obtains the number of hierarchical descendants of the clicked entity (only OLS)
* @param entity.parents obtains the list of parent entities of the clicked entity (only OLS, Skosmos)
*/
onNavigateToOntology?: ((ontologyId: string, entityType?: string, entity?: EntityData) => void) | string;
};
export type OnNavigateToSearchResult = {
/**
* This function is called when a search result title is clicked.
*/
OnNavigateToSearchResult?: ((result: SearchResultProps) => void) | string;
};
export type OnNavigateToDisambiguate = {
/**
* This function is called every time a disambiguation badge is clicked
* @param entityType obtains the entityType of the clicked badge
* @param entity.iri obtains the iri of the clicked badge (can be empty)
* @param entity.label obtains the label of the clicked badge
* @param entity.definedBy obtains the list of ontologies the clicked entity is defined in (only OLS)
* @param entity.hasChildren obtains a boolean indicating whether the clicked entity has child entities
* @param entity.numDescendants obtains the number of hierarchical descendants of the clicked entity (only OLS)
* @param entity.parents obtains the list of parent entities of the clicked entity (only OLS, Skosmos)
*/
onNavigateToDisambiguate?: ((entityType: string, entity?: EntityData) => void) | string;
};
export type OnNavigates = OnNavigateToEntity & OnNavigateToOntology & OnNavigateToDisambiguate;
export type HierarchyWidgetProps = CssClassNameObj & {
apiUrl: string;
apiKey?: string;
backendType?: string;
hierarchyWrap?: boolean;
/**
* If provided, a view comparing the hierarchies of iri and targetIri is shown.
*/
targetIri?: string;
showHeader?: boolean;
showComparisonTitleInHeader?: boolean;
} & BuildHierarchyProps & HierarchyIriProp & OnNavigateToEntity & OnNavigateToOntology & ParameterObj;
export type TitleTextObj = {
/**
* Set your own title text manually that overwrites the text fetched from the API
*/
titleText?: string;
};
export type TitleWidgetProps = ApiObj & OptionalThingTypeObj & OptionalOntologyIdObj & OptionalIriObj & ParameterObj & UseLegacyObj & TitleTextObj & CssClassNameObj & {
/**
* Set the default title text shown if the API fails to retrieve one.
*/
defaultValue?: string;
/**
* If this function is defined, the title becomes a link. The function is called every time the link is clicked.
*/
onNavigateTo?: (iri: string, ontologyId: string, thingType: string) => void;
/**
* A hyperlink directly passed to the component.
*/
href?: string;
};
export type TitlePresentationProps = TitleTextObj & CssClassNameObj & OptionalThingTypeObj & OptionalOntologyIdObj & {
iri?: string | null;
title?: string | null;
defaultValue?: string;
isLoading?: boolean;
error?: string | unknown;
onNavigateTo?: (iri: string, ontologyId: string, thingType: string) => void;
href?: string;
};
export type MetadataPresentationProps = ForcedIriObj & OptionalOntologyIdObj & OptionalEntityTypeObj & OnNavigateToOntology & CssClassNameObj & ColorFirstObj & ColorSecondObj & DescTextObj & {
/**
* Label of the already resolved entity, shown as the title.
*/
label?: string;
/**
* Short form of the already resolved entity, e.g. "format_2332". Shown in the breadcrumb.
*/
shortForm?: string;
/**
* Description of the already resolved entity.
*/
description?: string;
/**
* Other ontologies the entity appears in.
*/
ontoList?: string[];
/**
* Ontologies the entity is defined by.
*/
definedBy?: string[];
/**
* Show a loading state instead of the passed values, for example while the caller resolves them.
*/
isLoading?: boolean;
/**
* Error of a lookup performed by the caller, shown instead of the passed values.
*/
error?: string | unknown;
/**
* The term backlink. User can use this to make the term's label a link. For example, a link to the term page on a terminology service.
*/
termLink?: string;
/**
* Set your own text manually, which will show as a clickable link instead of the IRI.
*/
iriText?: string;
/**
* Indicates that the target iri is external and needs an icon.
*/
externalIcon?: boolean;
/**
* The iri should get appended to the urlPrefix or not. When provided, the iri gets encoded and appended to the urlPrefix.
*/
urlPrefix?: string;
/**
* Position a copy to clipboard button for the iri link. 'none' or not providing the option means hiding the button.
* left/right means showing the button on the left or right side of the iri link.
*/
copyButton?: "right" | "left" | "none";
/**
* Props of the tab section. Tabs fetch their own data, so when this is not provided no tabs are rendered
* and the component performs no request at all.
*/
tabProps?: TabWidgetProps;
};
export type MetadataWidgetProps = TabWidgetProps & CssClassNameObj & ColorFirstObj & ColorSecondObj & DescTextObj & TitleTextObj & {
/**
* The term backlink. User can use this to make the term's label a link. For example, a link to the term page on a terminology service.
*/
termLink?: string;
/**
* Set the default title text shown if the API fails to retrieve one.
*/
defaultValue?: string;
/**
* Set your own text manually, which will show as a clickable link instead of the IRI.
*/
iriText?: string;
/**
* Indicates that the target iri is external and needs an icon.
*/
externalIcon?: boolean;
/**
* The iri should get appended to the urlPrefix or not. When provided, the iri gets encoded and appended to the urlPrefix.
*/
urlPrefix?: string;
/**
* Position a copy to clipboard button for the iri link. 'none' or not providing the option means hiding the button.
* left/right means showing the button on the left or right side of the iri link.
*/
copyButton?: "right" | "left" | "none";
/**
* Show the input field for the targetIri in comparison mode.
*/
enableComparisonMode?: boolean;
showHeader?: boolean;
showComparisonTitleInHeader?: boolean;
};
export type OntologyInfoPresentationProps = HasTitleObj & ShowBadgesObj & ContainerWidthObj & OnNavigates & CssClassNameObj & {
ontology?: Ontology;
isLoading?: boolean;
error?: string | unknown;
};
export type OntologyInfoWidgetProps = ApiObj & ForcedOntologyIdObj & HasTitleObj & ShowBadgesObj & ParameterObj & UseLegacyObj & ContainerWidthObj & OnNavigates & CssClassNameObj;
export type ResourcesWidgetProps = ApiObj & ParameterObj & UseLegacyObj & CssClassNameObj & {
/**
* Initial number of entries displayed per page.
*/
initialEntriesPerPage?: number;
/**
* Possible values for number of entries displayed per page.
*/
pageSizeOptions?: number[];
/**
* Column the table is sorted by initially.
*/
initialSortField?: string;
/**
* Initial sorting direction.
*/
initialSortDir?: "asc" | "desc";
/**
* Pass actions to each item in the table.
*/
actions?: Array>;
/**
* This function is called every time an ontology link is clicked.
*/
onNavigate?: ((ontologyId: string) => void) | string;
};
export type ResourcesPresentationProps = UseLegacyObj & CssClassNameObj & {
/**
* The already resolved resources shown in the table.
*/
resources: OlsResource[];
/**
* Shows the table in its loading state.
*/
isLoading?: boolean;
/**
* True when a lookup performed by the caller failed. The license notice and
* the resource count are then hidden.
*/
isError?: boolean;
/**
* Initial number of entries displayed per page.
*/
initialEntriesPerPage?: number;
/**
* Possible values for number of entries displayed per page.
*/
pageSizeOptions?: number[];
/**
* Column the table is sorted by initially.
*/
initialSortField?: string;
/**
* Initial sorting direction.
*/
initialSortDir?: "asc" | "desc";
/**
* Pass actions to each item in the table.
*/
actions?: Array>;
/**
* This function is called every time an ontology link is clicked.
*/
onNavigate?: ((ontologyId: string) => void) | string;
};
export type OlsResource = ForcedOntologyIdObj & {
loaded: string;
numberOfTerms: number;
numberOfProperties: number;
numberOfIndividuals: number;
config: {
logo?: string;
title: string;
description: string;
preferredPrefix: string;
allowDownload: boolean;
fileLocation: string;
version?: string;
[otherFields: string]: unknown;
};
[otherFields: string]: unknown;
};
export type SearchBarWidgetProps = ApiObj & ParameterObj & {
/**
* The search term to receive suggestions for.
*/
query: string;
/**
* A method that is called once the set of selection changes
* @param selectedOptions The selected items
*/
selectionChangedEvent: (selectedOptions: {
label: string;
iri?: string;
ontology_name?: string;
type?: string;
}[]) => void;
};
export type SearchResultsListWidgetProps = Partial> & ApiObj & TargetLinkObj & ParameterObj & UseLegacyObj & OnNavigateToOntology & OnNavigateToSearchResult & CssClassNameObj & {
/**
* The terms to search. By default, the search is performed over term labels, synonyms, descriptions, identifiers and annotation properties.
*/
query: string;
/**
* Initial number of items displayed per page.
*/
initialItemsPerPage?: number;
/**
* Possible values for number of items displayed per page.
*/
itemsPerPageOptions?: number[];
/**
* Pass pre-selected values. If `singleSelection == true`, only the first one is displayed.
*/
preselected?: {
label?: string;
iri?: string;
}[];
};
export type SearchResultProps = {
description: string[];
id: string;
iri: string;
is_defining_ontology: boolean;
label: string;
ontology_name: string;
ontology_prefix: string;
short_form: string;
type: ThingTypeName;
};
export type MetadataCompactProps = Partial> & ApiObj & TargetLinkObj & ParameterObj & CssClassNameObj & OptionalEntityTypeObj & OnNavigateToOntology & {
OnNavigateToSearchResult?: ((result: SearchResultProps) => void) | string;
result: SearchResultProps;
iri: string;
ontologyId: string;
useLegacy: boolean;
};
export type TermDepictionWidgetProps = ApiObj & ForcedIriObj & ForcedOntologyIdObj & UseLegacyObj;
export type TermDepictionPresentationProps = {
/**
* Urls of the already resolved depictions. A url ending in .glb is shown as a
* 3D model, every other one as an image.
*/
depictionUrls?: string[];
/**
* Shows a loading spinner instead of the depictions.
*/
isLoading?: boolean;
/**
* Error of a lookup performed by the caller, shown instead of the depictions.
*/
error?: string | unknown;
};
export type GraphViewWidgetProps = ApiObj & ForcedIriObj & ForcedOntologyIdObj & CssClassNameObj & ParameterObj & {
/**
* The target iri. used in the hierarchy mode to compare two terms in one graph.
*/
targetIri?: string;
/**
* When true, the graph will show the tree hierarchy for the target node in form of a graph.
*/
rootWalk?: boolean;
/**
* When true, the graph shows the nodes in their hierarchy based on their position in the tree. It should be used with the rootWalk mode to true.
*/
hierarchy?: boolean;
/**
* The edge label in the graph. Default is "is a". Only for sub-class predicators.
*/
edgeLabel?: string;
/**
* Callback function for double-clicking on a node in graph. The default behaviour is to expand the node.
* */
onNodeClick?: (iri: string) => void;
/**
* Prevent the graph to be rendered with full width (CSS width 100%).
* */
stopFullWidth?: boolean;
/**
* Hide the graph legend. Default is false/undefined
*/
hideLegend?: boolean;
/**
* This function is called if navigation should be handled externally.
*/
onNavigateTo?: (target: string) => void;
};
export type GraphViewPresentationProps = CssClassNameObj & {
downloadGraphData: () => void;
reset: () => void;
isLoading: boolean;
isError: boolean;
error?: string | unknown;
removeNodeFromGraph: () => void;
hideLegend?: boolean;
sourceNodeBgColor: string;
sourceLabel: string;
targetIri: string;
commonNodesBgColor: string;
targetNodeBgColor: string;
targetLabel: string;
exclusiveToTargetIriColor: string;
stopFullWidth?: boolean;
showNothingToAddMessage: boolean;
showNodeNotSelectedMessage: boolean;
container: React.RefObject;
};
export type OlsGraphNode = {
/**
* Used in the GraphView widget for rendering a graph's node
*/
iri?: string;
label?: string;
level?: number;
};
export type OlsGraphEdge = {
/**
* Used in the GraphView widget for rendering a graph's edge
*/
uri?: string;
label?: string;
source?: string;
target?: string;
};
export type ComparisonInputProps = {
entityLabel?: string;
onTargetIriChange: (iri: string | undefined) => void;
initialTargetIri?: string;
className?: string;
};
export type EntityListPresentationProps = {
isLoading?: boolean;
isFetching?: boolean;
totalItemCount: number;
searchText: string;
onSearchTextChange: (searchText: string) => void;
onTableChange: (criteria: Criteria) => void;
pageIndex: number;
pageSize: number;
sortField: keyof EntityRow;
sortDirection: "asc" | "desc";
entityType?: EntityTypeName;
error?: string | unknown;
rows: EntityRow[];
};
export type EntityRow = {
name: string;
id: string;
rowIndex: number;
domain?: string;
range?: string;
type?: string;
};
export type EntityListWidgetProps = {
api: string;
ontologyId: string;
entityType: EntityTypeName;
parameter?: string;
};
export type MappingListWidgetProps = {
api: string;
source: string;
rowColor?: string;
MappingDetailBackgroundColor?: string;
};
export type MappingDetailWidgetProps = {
api: string;
source: string;
target: string;
MappingDetailBackgroundColor?: string;
};
/**
* Information about the terminology backend that actually served an entity.
*
* The TS4NFDI API Gateway federates several terminology software stacks (OLS,
* OntoPortal, Skosmos) and reports the responsible one per entity in a
* `provider` block. Plain (non-gateway) OLS instances do not return it, in
* which case no provider can be resolved.
*/
export type EntityProvider = {
/**
* Name of the providing terminology service, e.g. `"tib"`, `"agrovoc"`.
* Taken from `provider_name`.
*/
name?: string;
/**
* Software stack behind the provider, e.g. `"ols2"`, `"ontoportal"`,
* `"skosmos"`. Taken from `provider_type`.
*/
type?: string;
/**
* Base URL of the provider's own API, e.g.
* `"https://api.terminology.tib.eu/api"`. Taken from `provider_api`.
*/
api?: string;
/**
* Id of the ontology this provider was reported for. Relevant when an IRI
* resolves in several ontologies, since each may have a different provider.
*/
ontologyId?: string;
/**
* The unmodified `provider` block from the API response, so that fields
* added by future gateway versions stay accessible.
*/
raw: Record;
};
export type EntityProviderWidgetProps = OptionalIriObj & OptionalOntologyIdObj & {
/**
* The API instance for the API call. Defaults to the TS4NFDI API Gateway
* OLS endpoint, as the provider information is specific to the gateway.
*/
api?: string;
/**
* Additional parameters in URL format, e.g.
* `collectionId=dc45621d-7e40-47ce-9616-4133f0b54edf`, passed on to the
* API. With a `collectionId`, the TS4NFDI API Gateway only returns
* providers of the terminologies configured in that collection.
*/
parameter?: string;
/**
* If false, no request is made and the result stays empty. Useful to defer
* fetching until an IRI is known. Default is true.
*/
enabled?: boolean;
};
export type UseEntityProviderResult = {
/**
* Provider of the entity in its defining ontology, or of the first
* occurrence if none is marked as defining. Undefined while loading, on
* error, or if the entity could not be resolved.
*/
provider?: EntityProvider;
/**
* Providers of all ontologies the IRI resolves in. Contains at most one
* element if `ontologyId` was provided, and is empty if the entity could not
* be resolved.
*/
providers: EntityProvider[];
isLoading: boolean;
isSuccess: boolean;
isError: boolean;
/**
* The error that made the request fail, if any.
*/
error?: Error;
};
export type UseCollectionStatisticsProps = {
/**
* The API instance for the API call. Defaults to the TS4NFDI API Gateway.
*/
api?: string;
/**
* The id of the collection whose statistics are shown.
*/
collectionId?: string;
/**
* If false, no request is made and the result stays empty. Default is true.
*/
enabled?: boolean;
};
export type UseCollectionStatisticsResult = {
/**
* The latest statistics of the collection, in the shape expected by the
* DataContentPresentation.
*/
ontologiesData?: Ontologies;
isLoading: boolean;
isError: boolean;
dataUpdatedAt?: number;
};
export {};