/**
 * L4 Knowledge Graph - Entity and relationship management
 *
 * Provides graph-based knowledge storage using SQLite entities and
 * relationships tables. Designed for <20ms access per the UAP protocol.
 */
export interface Entity {
    id?: number;
    type: string;
    name: string;
    description?: string;
    firstSeen: string;
    lastSeen: string;
    mentionCount: number;
}
export interface Relationship {
    id?: number;
    sourceId: number;
    targetId: number;
    relation: string;
    strength: number;
    timestamp: string;
}
export interface GraphQueryResult {
    entity: Entity;
    relationships: Array<{
        relation: string;
        direction: 'outgoing' | 'incoming';
        relatedEntity: Entity;
        strength: number;
    }>;
}
export declare class KnowledgeGraph {
    private db;
    constructor(dbPath: string);
    /**
     * Upsert an entity. If (type, name) already exists, updates last_seen
     * and increments mention_count.
     */
    upsertEntity(type: string, name: string, description?: string): Entity;
    /**
     * Get an entity by type and name.
     */
    getEntity(type: string, name: string): Entity | null;
    /**
     * Get an entity by ID.
     */
    getEntityById(id: number): Entity | null;
    /**
     * Search entities by type.
     */
    getEntitiesByType(type: string, limit?: number): Entity[];
    /**
     * Search entities by name pattern (LIKE search).
     */
    searchEntities(query: string, limit?: number): Entity[];
    /**
     * Delete an entity and all its relationships.
     */
    deleteEntity(id: number): boolean;
    /**
     * Add or strengthen a relationship between two entities.
     * If the relationship already exists, increases strength.
     */
    addRelationship(sourceId: number, targetId: number, relation: string, strength?: number): Relationship;
    /**
     * Get all relationships for an entity (both directions).
     */
    getRelationships(entityId: number): Relationship[];
    /**
     * Delete a specific relationship.
     */
    deleteRelationship(id: number): boolean;
    /**
     * Get an entity with all its relationships and related entities.
     * Uses a single JOIN query instead of N+1 individual queries.
     */
    queryEntityGraph(type: string, name: string): GraphQueryResult | null;
    /**
     * Find entities connected to a given entity within N hops.
     * Uses a recursive CTE for efficient graph traversal in a single query.
     */
    traverseGraph(entityId: number, maxDepth?: number): Entity[];
    /**
     * Get graph statistics.
     */
    getStats(): {
        entityCount: number;
        relationshipCount: number;
        entityTypes: string[];
    };
    /**
     * Close the database connection.
     */
    close(): void;
    private rowToEntity;
    private rowToRelationship;
}
//# sourceMappingURL=knowledge-graph.d.ts.map