UNPKG

@aaswe/codebase-ai

Version:

AI-Assisted Software Engineering (AASWE) - Rich codebase context for IDE LLMs

136 lines 4.23 kB
/** * Knowledge Graph Populator * * Automatic knowledge graph population system that ingests TTL files * into Neo4j database with intelligent entity creation and relationship mapping. */ import { EventEmitter } from 'events'; export interface KnowledgeGraphConfig { neo4jUri: string; neo4jUsername: string; neo4jPassword: string; neo4jDatabase?: string; batchSize: number; enableIndexCreation: boolean; enableConstraintCreation: boolean; preserveExistingData: boolean; conflictResolution: 'merge' | 'replace' | 'skip'; } export interface PopulationResult { success: boolean; totalTTLFiles: number; processedFiles: number; failedFiles: number; totalNodesCreated: number; totalRelationshipsCreated: number; totalPropertiesSet: number; processingTime: number; errors: PopulationError[]; warnings: string[]; statistics: PopulationStatistics; } export interface PopulationError { type: 'CONNECTION_ERROR' | 'INGESTION_ERROR' | 'SCHEMA_ERROR' | 'VALIDATION_ERROR'; message: string; sourceFile?: string; details?: any; } export interface PopulationStatistics { moduleNodes: number; classNodes: number; methodNodes: number; functionNodes: number; dependencyRelationships: number; inheritanceRelationships: number; containmentRelationships: number; businessContextNodes: number; } export interface ModuleEntity { id: string; name: string; filePath: string; language: string; businessDomain?: string; architecturalPatterns: string[]; qualityMetrics: { complexity: number; maintainability: number; testCoverage: number; documentation: number; }; lastUpdated: Date; } export interface CodeEntity { id: string; name: string; type: 'class' | 'method' | 'function' | 'interface' | 'enum'; moduleId: string; signature?: string; visibility?: 'public' | 'private' | 'protected'; isAbstract?: boolean; parameters?: string[]; returnType?: string; businessContext?: string; technicalContext?: string; } export interface EntityRelationship { sourceId: string; targetId: string; type: 'DEPENDS_ON' | 'EXTENDS' | 'IMPLEMENTS' | 'CONTAINS' | 'CALLS' | 'USES' | 'PART_OF'; properties?: Record<string, any>; } /** * Knowledge Graph Populator * * Orchestrates automatic population of Neo4j knowledge graph from TTL files * with intelligent entity extraction, relationship mapping, and conflict resolution. */ export declare class KnowledgeGraphPopulator extends EventEmitter { private config; private neo4jService; private isInitialized; constructor(config?: Partial<KnowledgeGraphConfig>); /** * Initialize the knowledge graph populator */ initialize(): Promise<void>; /** * Populate knowledge graph from TTL files */ populateFromTTLFiles(ttlFilePaths: string[]): Promise<PopulationResult>; /** * Populate knowledge graph from TTL content map */ populateFromTTLContent(ttlContentMap: Map<string, any>): Promise<PopulationResult>; /** * Update knowledge graph incrementally for specific modules */ updateModules(moduleUpdates: Map<string, any>): Promise<PopulationResult>; /** * Get knowledge graph health status */ getHealthStatus(): Promise<any>; /** * Shutdown the knowledge graph populator */ shutdown(): Promise<void>; private initializeStats; private createBatches; private processTTLBatch; private extractEntitiesFromTTL; private createKnowledgeGraphEntities; private createKnowledgeGraphSchema; private createKnowledgeGraphIndexes; private calculatePopulationStatistics; private removeModuleFromGraph; private extractModuleIdFromTTL; private extractLanguageFromTTL; private extractBusinessDomainFromTTL; private extractArchitecturalPatternsFromTTL; private extractQualityMetricsFromTTL; private extractEntityBusinessContext; private extractEntityTechnicalContext; private extractMethodSignature; private extractFunctionSignature; } //# sourceMappingURL=KnowledgeGraphPopulator.d.ts.map