UNPKG

graph-explorer

Version:

Graph Explorer can be used to explore and RDF graphs in SPARQL endpoints or on the web.

1,188 lines (1,171 loc) 124 kB
// Generated by dts-bundle v0.7.3 // Dependencies for this module: // ../../../react declare module 'graph-explorer' { export * from "graph-explorer/customization/props"; export * from "graph-explorer/customization/templates"; export * from "graph-explorer/data/model"; export * from "graph-explorer/data/metadataApi"; export * from "graph-explorer/data/validationApi"; export * from "graph-explorer/data/provider"; export { PLACEHOLDER_ELEMENT_TYPE, PLACEHOLDER_LINK_TYPE } from "graph-explorer/data/schema"; export * from "graph-explorer/data/demo/provider"; export { RdfNode, RdfIri, RdfLiteral, Triple, } from "graph-explorer/data/sparql/sparqlModels"; export * from "graph-explorer/data/sparql/sparqlDataProvider"; export * from "graph-explorer/data/composite/composite"; export * from "graph-explorer/data/sparql/sparqlDataProviderSettings"; export * from "graph-explorer/data/sparql/graphBuilder"; export * from "graph-explorer/data/sparql/sparqlGraphBuilder"; export { DIAGRAM_CONTEXT_URL_V1 } from "graph-explorer/data/schema"; export { RestoreGeometry, setElementExpanded, setElementData, setLinkData, } from "graph-explorer/diagram/commands"; export { Element, ElementEvents, ElementTemplateState, Link, LinkEvents, LinkTemplateState, LinkVertex, Cell, LinkDirection, } from "graph-explorer/diagram/elements"; export { EmbeddedLayer } from "graph-explorer/diagram/embeddedLayer"; export * from "graph-explorer/diagram/geometry"; export * from "graph-explorer/diagram/history"; export { DiagramModel, DiagramModelEvents } from "graph-explorer/diagram/model"; export * from "graph-explorer/diagram/view"; export { PointerEvent, PointerUpEvent, getContentFittingBox, ViewportOptions, ScaleOptions, } from "graph-explorer/diagram/paperArea"; export * from "graph-explorer/editor/asyncModel"; export { AuthoredEntity, AuthoredEntityProps, AuthoredEntityContext, } from "graph-explorer/editor/authoredEntity"; export * from "graph-explorer/editor/authoringState"; export { EditorOptions, EditorEvents, EditorController, PropertyEditor, PropertyEditorOptions, } from "graph-explorer/editor/editorController"; export { ValidationState, ElementValidation, LinkValidation, } from "graph-explorer/editor/validation"; export { LayoutData, LayoutElement, LayoutLink, SerializedDiagram, convertToSerializedDiagram, makeSerializedDiagram, LinkTypeOptions, makeLayoutData, } from "graph-explorer/editor/serializedDiagram"; export { calculateLayout, removeOverlaps, CalculatedLayout, UnzippedCalculatedLayout, LayoutNode, applyLayout, forceLayout, } from "graph-explorer/viewUtils/layout"; export { Cancellation, CancellationToken, CancelledError, } from "graph-explorer/viewUtils/async"; export * from "graph-explorer/viewUtils/events"; export { PropertySuggestionParams, PropertyScore, } from "graph-explorer/widgets/connectionsMenu"; export { DefaultToolbar, ToolbarProps } from "graph-explorer/workspace/toolbar"; export { Workspace, WorkspaceProps, WorkspaceState, WorkspaceLanguage, renderTo, } from "graph-explorer/workspace/workspace"; export { WorkspaceEventHandler, WorkspaceEventKey, } from "graph-explorer/workspace/workspaceContext"; export { DraggableHandle } from "graph-explorer/workspace/draggableHandle"; export * from "graph-explorer/workspace/layout/layout"; import * as InternalApi from "graph-explorer/internalApi"; export { InternalApi }; } declare module 'graph-explorer/customization/props' { import { ComponentClass } from "react"; import { DiagramModel } from "graph-explorer/diagram/model"; import { ElementIri, ElementModel, Dictionary, LocalizedString, Property } from "graph-explorer/data/model"; import { Link } from "graph-explorer/diagram/elements"; export type TypeStyleResolver = (types: string[]) => CustomTypeStyle | undefined; export type LinkTemplateResolver = (linkType: string) => LinkTemplate | undefined; export type TemplateResolver = (types: string[]) => ElementTemplate | undefined; export interface CustomTypeStyle { color?: string; icon?: string; } export type ElementTemplate = ComponentClass<TemplateProps>; export interface TemplateProps { elementId: string; data: ElementModel; iri: ElementIri; types: string; label: string; color: any; iconUrl: string; imgUrl?: string; isExpanded?: boolean; propsAsList?: PropArray; props?: Dictionary<Property>; } export type PropArray = { id: string; name: string; property: Property; }[]; export interface LinkTemplate { markerSource?: LinkMarkerStyle; markerTarget?: LinkMarkerStyle; renderLink?(link: Link): LinkStyle; setLinkLabel?: (link: Link, label: string) => void; } export interface LinkStyle { connection?: { fill?: string; stroke?: string; "stroke-width"?: number; "stroke-dasharray"?: string; }; label?: LinkLabel; properties?: LinkLabel[]; connector?: { name?: string; args?: {}; }; } export interface LinkRouter { route(model: DiagramModel): RoutedLinks; } export type RoutedLinks = Map<string, RoutedLink>; export interface RoutedLink { linkId: string; vertices: readonly Vertex[]; labelTextAnchor?: "start" | "middle" | "end"; } export interface Vertex { x: number; y: number; } export interface LinkMarkerStyle { fill?: string; stroke?: string; strokeWidth?: string; d?: string; width?: number; height?: number; } export interface LinkLabel { position?: number; title?: string; attrs?: { rect?: { fill?: string; stroke?: string; "stroke-width"?: number; }; text?: { fill?: string; stroke?: string; "stroke-width"?: number; "font-family"?: string; "font-size"?: string | number; "font-weight"?: "normal" | "bold" | "lighter" | "bolder" | number; text?: LocalizedString[]; }; }; } } declare module 'graph-explorer/customization/templates' { import { TemplateResolver } from "graph-explorer/customization/props"; export * from "graph-explorer/customization/templates/default"; export * from "graph-explorer/customization/templates/group"; export * from "graph-explorer/customization/templates/standard"; export const DefaultElementTemplateBundle: TemplateResolver; } declare module 'graph-explorer/data/model' { import { RdfIri } from "graph-explorer/data/sparql/sparqlModels"; export type Dictionary<T> = Record<string, T>; export interface LocalizedString { readonly value: string; readonly language: string; /** Equals `xsd:string` if not defined. */ readonly datatype?: { readonly value: string; }; } export interface IriProperty { type: "uri"; values: readonly RdfIri[]; } export interface LiteralProperty { type: "string"; values: readonly LocalizedString[]; } export type Property = IriProperty | LiteralProperty; export function isIriProperty(e: Property): e is IriProperty; export function isLiteralProperty(e: Property): e is LiteralProperty; export type ElementIri = string & { readonly elementBrand: any; }; export type ElementTypeIri = string & { readonly classBrand: any; }; export type LinkTypeIri = string & { readonly linkTypeBrand: any; }; export type PropertyTypeIri = string & { readonly propertyTypeBrand: any; }; export interface ElementModel { id: ElementIri; types: ElementTypeIri[]; label: { values: LocalizedString[]; }; image?: string; properties: Record<string, Property>; sources?: string[]; } export interface LinkModel { linkTypeId: LinkTypeIri; sourceId: ElementIri; targetId: ElementIri; properties?: Record<string, Property>; } export interface ClassModel { id: ElementTypeIri; label: { values: LocalizedString[]; }; count?: number; children: ClassModel[]; } export interface LinkCount { id: LinkTypeIri; inCount: number; outCount: number; } export interface LinkType { id: LinkTypeIri; label: { values: LocalizedString[]; }; count?: number; } export interface PropertyModel { id: PropertyTypeIri; label: { values: LocalizedString[]; }; } export function sameLink(left: LinkModel, right: LinkModel): boolean; export function hashLink(link: LinkModel): number; export function sameElement(left: ElementModel, right: ElementModel): boolean; } declare module 'graph-explorer/data/metadataApi' { import { ElementModel, ElementTypeIri, LinkTypeIri, PropertyTypeIri, LinkModel } from "graph-explorer/data/model"; import { LinkDirection } from "graph-explorer/diagram/elements"; import { CancellationToken } from "graph-explorer/viewUtils/async"; export interface MetadataApi { /** * Can user create element and link from this element? */ canDropOnCanvas(source: ElementModel, ct: CancellationToken): Promise<boolean>; /** * Can we create link between two elements? Maybe it's unnesesary. */ canDropOnElement(source: ElementModel, target: ElementModel, ct: CancellationToken): Promise<boolean>; /** * Links of which types can we create between elements? */ possibleLinkTypes(source: ElementModel, target: ElementModel, ct: CancellationToken): Promise<DirectedLinkType[]>; /** * If new element is created by dragging link from existing element, this should return available element types. */ typesOfElementsDraggedFrom(source: ElementModel, ct: CancellationToken): Promise<ElementTypeIri[]>; /** * List properties for type meant to be edited in-place. */ propertiesForType(type: ElementTypeIri, ct: CancellationToken): Promise<PropertyTypeIri[]>; filterConstructibleTypes(types: ReadonlySet<ElementTypeIri>, ct: CancellationToken): Promise<ReadonlySet<ElementTypeIri>>; canDeleteElement(element: ElementModel, ct: CancellationToken): Promise<boolean>; canEditElement(element: ElementModel, ct: CancellationToken): Promise<boolean>; canLinkElement(element: ElementModel, ct: CancellationToken): Promise<boolean>; canDeleteLink(link: LinkModel, source: ElementModel, target: ElementModel, ct: CancellationToken): Promise<boolean>; canEditLink(link: LinkModel, source: ElementModel, target: ElementModel, ct: CancellationToken): Promise<boolean>; generateNewElement(types: readonly ElementTypeIri[], ct: CancellationToken): Promise<ElementModel>; } export interface DirectedLinkType { readonly linkTypeIri: LinkTypeIri; readonly direction: LinkDirection; } } declare module 'graph-explorer/data/validationApi' { import { DiagramModel } from "graph-explorer/diagram/model"; import { AuthoringState } from "graph-explorer/editor/authoringState"; import { CancellationToken } from "graph-explorer/viewUtils/async"; import { ElementModel, LinkModel, ElementIri, PropertyTypeIri } from "graph-explorer/data/model"; export interface ElementError { readonly type: "element"; readonly target: ElementIri; readonly message: string; readonly propertyType?: PropertyTypeIri; } export interface LinkError { readonly type: "link"; readonly target: LinkModel; readonly message: string; } export interface ValidationEvent { readonly target: ElementModel; readonly outboundLinks: readonly LinkModel[]; readonly model: DiagramModel; readonly state: AuthoringState; readonly cancellation: CancellationToken; } export interface ValidationApi { /** * Validate element and its outbound links. */ validate(e: ValidationEvent): Promise<(ElementError | LinkError)[]>; } } declare module 'graph-explorer/data/provider' { import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel, ElementIri, ElementTypeIri, LinkTypeIri, PropertyTypeIri } from "graph-explorer/data/model"; /** * DataProvider is responsible for getting data into Graph Explorer * * It has three parts: * - Schema extraction - classTree(), linkTypes() * - On-demand schema extraction - classInfo(), propertyInfo(), linkTypeInfo() * - elements and links extraction - elementsInfo() and linksInfo() * - navigation - linkTypesOf(), linkElements() * - filtering - filter * * Schema extraction is executed on initialization and used to display class tree. * * On-demand schema extraction occurs when element with yet unknown type or link type appears any part of Graph Explorer. * * Elements and links extraction is executed when new element is placed on the diagram or diagram is restored from * saved state to get all the data for it * * Navigation functions are called when user brings up navigation menu to display available links * and places chosen elements on the diagram. * * When possible, Graph Explorer will group requests into batches to reduce round-trips and this will reduce calls to * data provider. * */ export interface DataProvider { /** should return start-up class tree. In case of huge class tree some limits should be imposed. * It can contain count of instances for each class if it's possible to get it from source. */ classTree(): Promise<ClassModel[]>; linkTypes(): Promise<LinkType[]>; /** * Class information */ classInfo(params: { classIds: ElementTypeIri[]; }): Promise<ClassModel[]>; /** * Data properties information */ propertyInfo?(params: { propertyIds: PropertyTypeIri[]; }): Promise<Dictionary<PropertyModel>>; /** * Link type information. */ linkTypesInfo(params: { linkTypeIds: LinkTypeIri[]; }): Promise<LinkType[]>; /** * Getting the elements from the data source on diagram initialization and on navigation events */ elementInfo(params: { elementIds: ElementIri[]; }): Promise<Dictionary<ElementModel>>; /** * Should return all links between elements. * linkTypeIds is ignored in current sparql providers and is subject to be removed */ linksInfo(params: { elementIds: ElementIri[]; linkTypeIds: LinkTypeIri[]; }): Promise<LinkModel[]>; /** * Get link types of element to build navigation menu */ linkTypesOf(params: { elementId: ElementIri; }): Promise<LinkCount[]>; /** * returns elements following link for specified element. * Has overlapping functionality with filter, but easier less powerful and easier to implement * linkId could be null, if it's the case method should return all elements from all links from current element. */ linkElements(params: LinkElementsParams): Promise<Dictionary<ElementModel>>; /** * Supports filter functionality with different filters - by type, * by element and it's connection, by full-text search. * Implementation should implement all possible combinations. */ filter(params: FilterParams): Promise<Dictionary<ElementModel>>; } export interface LinkElementsParams { elementId: ElementIri; linkId: LinkTypeIri; limit?: number; offset: number; direction?: "in" | "out"; } export interface FilterParams { /** * element type filter */ elementTypeId?: ElementTypeIri; /** * text search */ text?: string; /** * Reference element id to limit elements accessible through links from this elements only. * Could be used with refElementLinkId to limit link types which to follow. */ refElementId?: ElementIri; /** * Reference element link type id. Is used only when refElementId is set. */ refElementLinkId?: LinkTypeIri; /** * Reference element link type direction ('in' | 'out'). Is used only when refElementLinkId is set. */ linkDirection?: "in" | "out"; /** * Limit number of elements returned. Defaults depend on data provider implementation */ limit?: number; /** * Offset within matched data set to use */ offset: number; /** * Right now this is unused in sparql data provider. * It was introduced to order results by particular language when doing substring match with regexps. * It's subject to be removed. */ languageCode: string; } } declare module 'graph-explorer/data/schema' { import { ElementTypeIri, LinkTypeIri } from "graph-explorer/data/model"; export const DIAGRAM_CONTEXT_URL_V1 = "https://graph-explorer.org/context/v1.json"; export const PLACEHOLDER_ELEMENT_TYPE: ElementTypeIri; export const PLACEHOLDER_LINK_TYPE: LinkTypeIri; export const GenerateID: { forElement(): string; forLink(): string; }; export const TemplateProperties: { PinnedProperties: string; CustomLabel: string; }; } declare module 'graph-explorer/data/demo/provider' { import { DataProvider, LinkElementsParams, FilterParams } from "graph-explorer/data/provider"; import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, ElementIri, ElementTypeIri, LinkTypeIri } from "graph-explorer/data/model"; export class DemoDataProvider implements DataProvider { constructor(allClasses: ClassModel[], allLinkTypes: LinkType[], allElements: Dictionary<ElementModel>, allLinks: LinkModel[]); classTree(): Promise<ClassModel[]>; classInfo(params: { classIds: ElementTypeIri[]; }): Promise<ClassModel[]>; linkTypes(): Promise<LinkType[]>; linkTypesInfo(params: { linkTypeIds: LinkTypeIri[]; }): Promise<LinkType[]>; elementInfo(params: { elementIds: ElementIri[]; }): Promise<Dictionary<ElementModel>>; linksInfo(params: { elementIds: ElementIri[]; linkTypeIds: LinkTypeIri[]; }): Promise<LinkModel[]>; linkTypesOf(params: { elementId: ElementIri; }): Promise<LinkCount[]>; linkElements(params: LinkElementsParams): Promise<Dictionary<ElementModel>>; filter(params: FilterParams): Promise<Dictionary<ElementModel>>; } } declare module 'graph-explorer/data/sparql/sparqlModels' { export type RdfNode = RdfIri | RdfLiteral | RdfBlank; export interface RdfIri { type: "uri"; value: string; } export interface RdfBlank { type: "bnode"; value: string; } export interface RdfLiteral { type: "literal"; value: string; datatype?: string; "xml:lang": string; } export interface Triple { subject: RdfNode; predicate: RdfNode; object: RdfNode; } export function isRdfBlank(e: RdfNode): e is RdfBlank; export function isRdfIri(e: RdfNode): e is RdfIri; export function isRdfLiteral(e: RdfNode): e is RdfLiteral; export interface BlankBinding extends ElementBinding { blankType: { value: "listHead" | "blankNode"; }; blankTrgProp: RdfNode; blankTrg: RdfNode; blankSrc?: RdfNode; blankSrcProp?: RdfNode; newInst?: RdfIri | RdfBlank; } export function isBlankBinding(binding: ElementBinding | BlankBinding): binding is BlankBinding; export interface ElementBinding { inst: RdfIri | RdfBlank; class?: RdfIri; label?: RdfLiteral; propType?: RdfIri; propValue?: RdfIri | RdfLiteral; } export interface ClassBinding { class: RdfIri; instcount?: RdfLiteral; label?: RdfLiteral; parent?: RdfIri; } export interface PropertyBinding { property: RdfIri; label?: RdfLiteral; } export interface LinkBinding { source: RdfIri | RdfBlank; type: RdfIri; target: RdfIri | RdfBlank; propType?: RdfIri; propValue?: RdfLiteral; } export interface LinkCountBinding { link: RdfIri | RdfBlank; inCount: RdfLiteral; outCount: RdfLiteral; } export interface LinkTypeBinding { link: RdfIri; label?: RdfLiteral; instcount?: RdfLiteral; } export interface ElementImageBinding { inst: RdfIri; linkType: RdfIri; image: RdfIri; } export interface ElementTypeBinding { inst: RdfIri; class: RdfIri; } export interface FilterBinding { classAll?: RdfIri; link?: RdfIri; direction?: RdfLiteral; } export interface SparqlResponse<Binding> { head: { vars: string[]; }; results: { bindings: Binding[]; }; } } declare module 'graph-explorer/data/sparql/sparqlDataProvider' { import { DataProvider, LinkElementsParams, FilterParams } from "graph-explorer/data/provider"; import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel, ElementIri, ElementTypeIri, LinkTypeIri, PropertyTypeIri, LocalizedString } from "graph-explorer/data/model"; import { SparqlResponse, Triple } from "graph-explorer/data/sparql/sparqlModels"; import { SparqlDataProviderSettings } from "graph-explorer/data/sparql/sparqlDataProviderSettings"; export enum SparqlQueryMethod { GET = 1, POST = 2 } export type QueryFunction = (params: { url: string; body?: string; headers: Record<string, string>; method: string; }) => Promise<Response>; /** * Runtime settings of SPARQL data provider */ export interface SparqlDataProviderOptions { /** * If it's true then blank nodes will be present on the paper * By default blank nodes wont be shown */ acceptBlankNodes?: boolean; /** * sparql endpoint URL to use */ endpointUrl: string; /** * properties to use as image URLs */ imagePropertyUris?: string[]; /** * Allows to extract/fetch image URLs externally instead of using `imagePropertyUris` option. */ prepareImages?: (elementInfo: Dictionary<ElementModel>) => Promise<Dictionary<string>>; /** * Allows to extract/fetch labels separately from SPARQL query as an alternative or * in addition to `label` output binding. */ prepareLabels?: (resources: Set<string>) => Promise<Map<string, LocalizedString[]>>; /** * wether to use GET (more compatible (Virtuozo), more error-prone due to large request URLs) * or POST(less compatible, better on large data sets) */ queryMethod?: SparqlQueryMethod; queryFunction?: QueryFunction; } export class SparqlDataProvider implements DataProvider { readonly options: SparqlDataProviderOptions; readonly settings: SparqlDataProviderSettings; constructor(options: SparqlDataProviderOptions, settings?: SparqlDataProviderSettings); classTree(): Promise<ClassModel[]>; propertyInfo(params: { propertyIds: PropertyTypeIri[]; }): Promise<Dictionary<PropertyModel>>; classInfo(params: { classIds: ElementTypeIri[]; }): Promise<ClassModel[]>; linkTypesInfo(params: { linkTypeIds: LinkTypeIri[]; }): Promise<LinkType[]>; linkTypes(): Promise<LinkType[]>; elementInfo(params: { elementIds: ElementIri[]; }): Promise<Dictionary<ElementModel>>; linksInfo(params: { elementIds: ElementIri[]; linkTypeIds: LinkTypeIri[]; }): Promise<LinkModel[]>; linkTypesOf(params: { elementId: ElementIri; }): Promise<LinkCount[]>; linkElements(params: LinkElementsParams): Promise<Dictionary<ElementModel>>; filter(baseParams: FilterParams): Promise<Dictionary<ElementModel>>; executeSparqlQuery<Binding>(query: string): Promise<SparqlResponse<Binding>>; executeSparqlConstruct(query: string): Promise<Triple[]>; protected createRefQueryPart(params: { elementId: ElementIri; linkId?: LinkTypeIri; direction?: "in" | "out"; }): string; formatLinkLinks(): string; formatLinkPath(path: string, source: string, target: string): string; formatPropertyInfo(): string; formatPropertyPath(path: string, subject: string, value: string): string; } export function executeSparqlQuery<Binding>(endpoint: string, query: string, method: SparqlQueryMethod, queryFunction: QueryFunction): Promise<SparqlResponse<Binding>>; export function executeSparqlConstruct(endpoint: string, query: string, method: SparqlQueryMethod, queryFunction: QueryFunction): Promise<Triple[]>; } declare module 'graph-explorer/data/composite/composite' { import { DataProvider, LinkElementsParams, FilterParams } from "graph-explorer/data/provider"; import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel, ElementIri, ElementTypeIri, LinkTypeIri, PropertyTypeIri } from "graph-explorer/data/model"; export interface DPDefinition { name: string; dataProvider: DataProvider; useInStats?: boolean; } export type MergeMode = "fetchAll" | "sequentialFetching"; export class CompositeDataProvider implements DataProvider { dataProviders: DPDefinition[]; mergeMode: MergeMode; constructor(dataProviders: (DataProvider | DPDefinition)[], params?: { mergeMode?: MergeMode; }); classTree(): Promise<ClassModel[]>; propertyInfo(params: { propertyIds: PropertyTypeIri[]; }): Promise<Dictionary<PropertyModel>>; classInfo(params: { classIds: ElementTypeIri[]; }): Promise<ClassModel[]>; linkTypesInfo(params: { linkTypeIds: LinkTypeIri[]; }): Promise<LinkType[]>; linkTypes(): Promise<LinkType[]>; elementInfo(params: { elementIds: ElementIri[]; }): Promise<Dictionary<ElementModel>>; linksInfo(params: { elementIds: ElementIri[]; linkTypeIds: LinkTypeIri[]; }): Promise<LinkModel[]>; linkTypesOf(params: { elementId: ElementIri; }): Promise<LinkCount[]>; linkElements(params: LinkElementsParams): Promise<Dictionary<ElementModel>>; filter(params: FilterParams): Promise<Dictionary<ElementModel>>; } } declare module 'graph-explorer/data/sparql/sparqlDataProviderSettings' { /** * Dataset-schema specific settings for SPARQL data provider. */ export interface SparqlDataProviderSettings { /** * Default prefix to be used in every query. */ defaultPrefix: string; /** * Property path for querying schema labels in schema (classes, link types, properties). */ schemaLabelProperty: string; /** * Property path for querying instance data labels (elements, links). */ dataLabelProperty: string; /** * Full-text search settings. */ fullTextSearch: FullTextSearchSettings; /** * SELECT query to retreive class tree. * * Parametrized variables: * - `${schemaLabelProperty}` `schemaLabelProperty` property from the settings * * Expected output bindings: * - `?class` * - `?label` (optional) * - `?parent` (optional) * - `?instcount` (optional) */ classTreeQuery?: string; /** * SELECT query to retrieve data for each class in a set. * * Parametrized variables: * - `${ids}` VALUES clause content with class IRIs * - `${schemaLabelProperty}` `schemaLabelProperty` property from the settings * * Expected output bindings: * - `?class` * - `?label` (optional) * - `?instcount` (optional) */ classInfoQuery?: string; /** * SELECT query to retrieve initial link types. * * Parametrized variables: * - `${linkTypesPattern}` `linkTypesPattern` property from the settings * - `${schemaLabelProperty}` `schemaLabelProperty` property from the settings * * Expected output bindings: * - `?link` * - `?label` (optional) * - `?instcount` (optional) */ linkTypesQuery?: string; /** * Overridable part of `linkTypesQuery` with same output bindings. * * Parametrized variables: none */ linkTypesPattern?: string; /** * SELECT query to retrieve data for each link type in a set. * * Parametrized variables: * - `${ids}` VALUES clause content with link type IRIs * - `${schemaLabelProperty}` `schemaLabelProperty` property from the settings * * Expected output bindings: * - `?link` * - `?label` (optional) * - `?instcount` (optional) */ linkTypesInfoQuery?: string; /** * SELECT query to retrieve data for each datatype property in a set. * * Parametrized variables: * - `${ids}` VALUES clause content with datatype property IRIs * - `${schemaLabelProperty}` `schemaLabelProperty` property from the settings * * Expected output bindings: * - `?property` * - `?label` (optional) */ propertyInfoQuery?: string; /** * CONSTRUCT query to retrieve data for each element (types, labels, properties). * * Parametrized variables: * - `${ids}` VALUES clause content with element IRIs * - `${dataLabelProperty}` `dataLabelProperty` property from the settings * - `${propertyConfigurations}` * * Expected output format for triples: * - `?inst rdf:type ?class` element has type * - `?inst rdfs:label ?label` element has label * - `?inst ?property ?value` element has value for a datatype property */ elementInfoQuery: string; /** * SELECT query to retrieve all links between specified elements. * * Parametrized variables: * - `${ids}` VALUES clause content with element IRIs * - `${linkConfigurations}` * * Expected output bindings: * - `?type` link type * - `?source` link source * - `?target` link target * - `?propType` (optional) link property type * - `?propValue` (optional) link property value */ linksInfoQuery: string; /** * Query pattern to retrieve image URL for an element. * * Expected bindings: * - `?inst` element IRI * - `?linkType` image property IRI * - `?image` result image URL */ imageQueryPattern: string; /** * SELECT query to retrieve incoming/outgoing link types from specified element with statistics. * * Parametrized variables: * - `${elementIri}` * - `${linkConfigurations}` * * Expected bindings: * - `?link` * - `?label` (optional) * - `?instcount` (optional) */ linkTypesOfQuery: string; /** * SELECT query to retrieve statistics of incoming/outgoing link types for specified element. * * Parametrized variables: * - `${linkId}` * - `${elementIri}` * - `${linkConfigurationOut}` * - `${linkConfigurationIn}` * - `${navigateElementFilterOut}` (optional; for blank node support only) * - `${navigateElementFilterIn}` (optional; for blank node support only) * * Expected bindings: * - `?link` link type * - `?inCount` incoming links count * - `?outCount` outgoing links count */ linkTypesStatisticsQuery: string; /** * when fetching all links from element, we could specify additional filter */ filterRefElementLinkPattern: string; /** * SPARQL query pattern to retrieve transitive type sets for elements. * * Expected output bindings: * - `?inst` element IRI * - `?class` element type (there may be multiple or transitive types for an element) */ filterTypePattern: string; /** * how to fetch elements info when fetching data. */ filterElementInfoPattern: string; /** * imposes additional filtering on elements within filter */ filterAdditionalRestriction: string; /** * Abstract links configuration - one could abstract a property path as a link on the diagram. */ linkConfigurations: LinkConfiguration[]; /** * (Experimental) Allows data provider to find links other than specified in `linkConfigurations` * when `linkConfigurations` has at least one value set. * * @default false */ openWorldLinks?: boolean; /** * Abstract property configuration similar to abstract link configuration. Not type-specific yet. */ propertyConfigurations: PropertyConfiguration[]; /** * (Experimental) Allows data provider to find element properties other than specified in * `propertyConfigurations` when `propertyConfigurations` has at least one value set. * * @default false */ openWorldProperties?: boolean; } /** * Full text search settings, * developer could use anything from search extensions of triplestore to regular expressions match * See wikidata and dbpedia examples for reusing full text search capabilities of Blazegraph and Virtuozo */ export interface FullTextSearchSettings { /** * Prefixes to use in full text search queries. */ prefix: string; /** * SPARQL query pattern to search/restrict results by text token. * * Parametrized variables: * - `${text}` text token * - `${dataLabelProperty}` `dataLabelProperty` property from the settings * * Expected bindings: * - `?inst` link type * - `?score` numerical score for ordering search results by relevance * - `?extractedLabel` (optional; if `extractLabel` is enabled) */ queryPattern: string; /** * When enabled, adds SPARQL patterns to try to extract label from IRI and * makes it available as `?extractedLabel` binding in `queryPattern`. */ extractLabel?: boolean; /** * run type filter first? */ elementFirst?: boolean; } /** * Link abstraction configuration. */ export interface LinkConfiguration { /** * IRI of the "virtual" link */ id: string; /** * Optional domain constraint for source element of the link. * If specified checks RDF type of source element to match one from this set. */ domain?: readonly string[]; /** * SPARQL predicate or pattern connecting source element to target element. * * Expected bindings (if it is a pattern): * - `?source` source element * - `?target` target element * * @example * Direct configuration: `ex:relatedToOther` * * Pattern configuration: ` * ?source ex:hasAddress ?addr . * ?addr ex:hasCountry ?target . * OPTIONAL { * BIND(ex:addressType as ?propType) * ?addr ex:addressType ?propValue * } * ` */ path: string; /** * Additional SPARQL patterns can be used for getting properties of the link. * * Expected bindings * - `?source` source element * - `?target` target element * - `?propType` link property type * - `?propValue` link property value */ properties?: string; } /** * Specifies property abstraction configuration */ export interface PropertyConfiguration { /** * IRI of the "virtual" link */ id: string; /** * Optional domain constraint for source element of the property. * If specified checks RDF type of source element to match one from this set. */ domain?: readonly string[]; /** * SPARQL predicate or pattern connecting source element to property value. * * Expected bindings (if it is a pattern): * - `?inst` source element * - `?value` property value * * @example * Direct configuration: `ex:firstName` * * Pattern configuration: ` * ?inst ex:hasAddress ?addr . * ?addr ex:hasApartmentNumber ?value * ` */ path: string; } export const RDFSettings: SparqlDataProviderSettings; export const WikidataSettings: SparqlDataProviderSettings; export const OWLRDFSSettingsOverride: Partial<SparqlDataProviderSettings>; export const OWLRDFSSettings: SparqlDataProviderSettings; export const OWLStatsSettings: SparqlDataProviderSettings; export const DBPediaSettings: SparqlDataProviderSettings; } declare module 'graph-explorer/data/sparql/graphBuilder' { import { SerializedDiagram } from "graph-explorer/editor/serializedDiagram"; import { Dictionary, ElementModel, LinkModel, ElementIri } from "graph-explorer/data/model"; import { DataProvider } from "graph-explorer/data/provider"; import { Triple } from "graph-explorer/data/sparql/sparqlModels"; export class GraphBuilder { dataProvider: DataProvider; constructor(dataProvider: DataProvider); createGraph(graph: { elementIds: ElementIri[]; links: LinkModel[]; }): Promise<{ preloadedElements: Dictionary<ElementModel>; diagram: SerializedDiagram; }>; getGraphFromRDFGraph(graph: Triple[]): Promise<{ preloadedElements: Dictionary<ElementModel>; diagram: SerializedDiagram; }>; getGraphFromTurtleGraph(graph: string): Promise<{ preloadedElements: Dictionary<ElementModel>; diagram: SerializedDiagram; }>; } export function makeGraphItems(response: readonly Triple[]): { elementIds: ElementIri[]; links: LinkModel[]; }; export function makeLayout(elementsIds: readonly ElementIri[], linksInfo: readonly LinkModel[]): SerializedDiagram; } declare module 'graph-explorer/data/sparql/sparqlGraphBuilder' { import { SerializedDiagram } from "graph-explorer/editor/serializedDiagram"; import { Dictionary, ElementModel } from "graph-explorer/data/model"; import { GraphBuilder } from "graph-explorer/data/sparql/graphBuilder"; import { SparqlDataProvider } from "graph-explorer/data/sparql/sparqlDataProvider"; export class SparqlGraphBuilder { dataProvider: SparqlDataProvider; graphBuilder: GraphBuilder; constructor(dataProvider: SparqlDataProvider); getGraphFromConstruct(constructQuery: string): Promise<{ preloadedElements: Dictionary<ElementModel>; diagram: SerializedDiagram; }>; } } declare module 'graph-explorer/diagram/commands' { import { ElementModel, ElementIri, LinkModel } from "graph-explorer/data/model"; import { Element, Link, FatLinkType } from "graph-explorer/diagram/elements"; import { Vector } from "graph-explorer/diagram/geometry"; import { Command } from "graph-explorer/diagram/history"; import { DiagramModel } from "graph-explorer/diagram/model"; export class RestoreGeometry implements Command { readonly title = "Move elements and links"; constructor(elementState: readonly { element: Element; position: Vector; }[], linkState: readonly { link: Link; vertices: readonly Vector[]; }[]); static capture(model: DiagramModel): RestoreGeometry; hasChanges(): boolean; filterOutUnchanged(): RestoreGeometry; invoke(): RestoreGeometry; } export function restoreCapturedLinkGeometry(link: Link): Command; export function setElementExpanded(element: Element, expanded: boolean): Command; export function changeLinkTypeVisibility(params: { linkType: FatLinkType; visible: boolean; showLabel: boolean; preventLoading?: boolean; }): Command; export function setElementData(model: DiagramModel, target: ElementIri, data: ElementModel): Command; export function setLinkData(model: DiagramModel, oldData: LinkModel, newData: LinkModel): Command; } declare module 'graph-explorer/diagram/elements' { import { ElementModel, LinkModel, LocalizedString, ElementIri, ElementTypeIri, LinkTypeIri, PropertyTypeIri } from "graph-explorer/data/model"; import { Events, PropertyChange } from "graph-explorer/viewUtils/events"; import { Vector, Size, Rect } from "graph-explorer/diagram/geometry"; export type Cell = Element | Link | LinkVertex; export enum LinkDirection { in = "in", out = "out" } export interface ElementEvents { changeData: PropertyChange<Element, ElementModel>; changePosition: PropertyChange<Element, Vector>; changeSize: PropertyChange<Element, Size>; changeExpanded: PropertyChange<Element, boolean>; changeGroup: PropertyChange<Element, string>; changeElementState: PropertyChange<Element, ElementTemplateState | undefined>; requestedFocus: { source: Element; }; requestedGroupContent: { source: Element; }; requestedAddToFilter: { source: Element; linkType?: FatLinkType; direction?: "in" | "out"; }; requestedRedraw: { source: Element; }; } export class Element { readonly events: Events<ElementEvents>; readonly id: string; /** All in and out links of the element */ readonly links: Link[]; constructor(props: { id: string; data: ElementModel; position?: Vector; size?: Size; expanded?: boolean; group?: string; elementState?: ElementTemplateState; temporary?: boolean; }); get iri(): ElementIri; get data(): ElementModel; setData(value: ElementModel): void; get position(): Vector; setPosition(value: Vector): void; get size(): Size; setSize(value: Size): void; get isExpanded(): boolean; setExpanded(value: boolean): void; get group(): string | undefined; setGroup(value: string | undefined): void; get elementState(): ElementTemplateState | undefined; setElementState(value: ElementTemplateState | undefined): void; get temporary(): boolean; focus(): void; requestGroupContent(): void; addToFilter(linkType?: FatLinkType, direction?: "in" | "out"): void; redraw(): void; } export type ElementTemplateState = Record<string, any>; export interface AddToFilterRequest { element: Element; linkType?: FatLinkType; direction?: "in" | "out"; } export interface FatClassModelEvents { changeLabel: PropertyChange<FatClassModel, readonly LocalizedString[]>; changeCount: PropertyChange<FatClassModel, number | undefined>; } export class FatClassModel { readonly events: Events<FatClassModelEvents>; readonly id: ElementTypeIri; constructor(props: { id: ElementTypeIri; label?: readonly LocalizedString[]; count?: number; }); get label(): readonly LocalizedString[]; setLabel(value: readonly LocalizedString[]): void; get count(): number; setCount(value: number | undefined): void; } export interface RichPropertyEvents { changeLabel: PropertyChange<RichProperty, readonly LocalizedString[]>; } export class RichProperty { readonly events: Events<RichPropertyEvents>; readonly id: PropertyTypeIri; constructor(p