UNPKG

@shubhamrasal/groundline

Version:
91 lines 2.64 kB
import type { Entity, Relation } from './graph-model.js'; import { IPFSConfig } from './ipfs.js'; import type { ExternalEntity, ExternalRelation } from './kg-adapters/adapter.js'; export interface GraphDBConfig { ipfs?: IPFSConfig; enabledAdapters?: ('wikidata' | 'dbpedia' | 'openalex')[]; } export declare class GraphDB { private config; private ipfsManager; private adapters; constructor(config?: GraphDBConfig); /** * Initialize the GraphDB instance */ initialize(): Promise<void>; /** * Create one or more entities in the graph */ createEntities(entities: Entity | Entity[]): Promise<string[]>; /** * Create one or more relations between entities */ createRelations(relations: Relation | Relation[]): Promise<string[]>; /** * Add observations to an existing entity */ addObservations(entityId: string, observations: string[]): Promise<void>; /** * Delete entities and their associated relations */ deleteEntities(entityIds: string | string[]): Promise<void>; /** * Create a snapshot of the current graph state and store it on IPFS */ snapshotGraph(): Promise<string>; /** * Pin a graph snapshot to ensure persistence */ pinSnapshot(cid: string): Promise<void>; /** * Get the latest version of a graph from IPFS */ resolveLatest(cid: string): Promise<void>; /** * Get the current graph state */ getGraph(): { nodes: [string, unknown][]; edges: [string, unknown][]; provenance: import("./graph-crdt.js").ProvenanceLogEntry[]; }; /** * Get provenance information for the graph */ getProvenance(): any[]; /** * Import entities and relations from an external knowledge graph */ importExternalKG(source: string, query: string): Promise<{ entities: ExternalEntity[]; relations: ExternalRelation[]; }>; /** * Load a graph from IPFS by its CID */ loadGraphByCID(cid: string): Promise<void>; /** * Get an entity by its ID */ private getEntity; /** * Export the current graph as JSON-LD */ exportAsJsonLD(options?: { validate?: boolean; publishToIPFS?: boolean; }): Promise<{ jsonLd: any; ipfsCid?: string; }>; /** * Load a JSON-LD document from IPFS */ loadJsonLDFromIPFS(cid: string): Promise<{ jsonLd: any; provenance?: any[]; }>; } export declare function createGraphDB(config?: GraphDBConfig): GraphDB; //# sourceMappingURL=graph-api.d.ts.map