UNPKG

graphzep

Version:

GraphZep: A temporal knowledge graph memory system for AI agents based on the Zep paper

88 lines (87 loc) 2.82 kB
/** * RDF Namespace management for GraphZep * Provides standardized URIs for Zep ontology and common RDF vocabularies */ export interface NamespaceMap { [prefix: string]: string; } export declare const ZEP_NAMESPACES: NamespaceMap; export declare class NamespaceManager { private namespaces; constructor(customNamespaces?: NamespaceMap); /** * Expand a prefixed URI to full URI * @param prefixed - URI in prefix:localName format * @returns Full URI */ expand(prefixed: string): string; /** * Contract a full URI to prefixed form if possible * @param fullUri - Full URI * @returns Prefixed URI or original if no matching namespace */ contract(fullUri: string): string; /** * Generate SPARQL prefix declarations * @param prefixesUsed - Optional array of prefixes to include, defaults to all * @returns SPARQL prefix declarations */ getSparqlPrefixes(prefixesUsed?: string[]): string; /** * Generate Turtle prefix declarations * @param prefixesUsed - Optional array of prefixes to include, defaults to all * @returns Turtle prefix declarations */ getTurtlePrefixes(prefixesUsed?: string[]): string; /** * Add or update a namespace * @param prefix - Namespace prefix * @param uri - Namespace URI */ addNamespace(prefix: string, uri: string): void; /** * Get all registered namespaces * @returns Copy of namespace map */ getAllNamespaces(): NamespaceMap; /** * Check if a prefix is registered * @param prefix - Namespace prefix to check * @returns True if prefix exists */ hasPrefix(prefix: string): boolean; /** * Get namespace URI for a prefix * @param prefix - Namespace prefix * @returns Namespace URI or undefined if not found */ getNamespaceUri(prefix: string): string | undefined; } /** * Default namespace manager instance */ export declare const defaultNamespaceManager: NamespaceManager; /** * Helper function to create URIs in the Zep namespace * @param localName - Local name within the zep namespace * @returns Full URI */ export declare function zepUri(localName: string): string; /** * Helper function to create memory URIs * @param localName - Local name within the zepmem namespace * @returns Full URI */ export declare function zepMemoryUri(localName: string): string; /** * Helper function to create entity URIs * @param localName - Local name within the zepent namespace * @returns Full URI */ export declare function zepEntityUri(localName: string): string; /** * Helper function to create temporal URIs * @param localName - Local name within the zeptime namespace * @returns Full URI */ export declare function zepTimeUri(localName: string): string;