import { Readable } from 'stream'; import type { Quad } from '@rdfjs/types'; import { RepresentationMetadata } from '@solid/community-server'; import type { Representation, ResourceIdentifier, Guarded, DataAccessor, FileIdentifierMapper } from '@solid/community-server'; import { type RdfAccessScope } from '../rdf/RdfAccessScope'; import type { RdfSourceInput, RdfTextChunkInput, RdfTextSourceInput, RdfTermRewriteInput, RdfTermRewriteResult, RdfVectorChunkInput, RdfVectorSourceInput } from '../rdf/types'; import type { SparqlVoidOptions } from '../sparql/SubgraphQueryEngine'; import type { SolidFsChange, SolidFsManifest } from '../../solidfs/types'; import type { RdfSearchReconciliationIntentSink } from '../../search/RdfSearchIntentSink'; export interface LocalRdfDocument { data: Guarded; metadata: RepresentationMetadata; } export interface LocalRdfReadableAccessor { getLocalRdfDocument(identifier: ResourceIdentifier): Promise; } export interface LocalRdfIndexAccessor { syncLocalRdfDocument(identifier: ResourceIdentifier, data?: Guarded, contentType?: string, options?: LocalRdfSyncOptions): Promise; deleteLocalRdfIndex(identifier: ResourceIdentifier): Promise; moveLocalRdfIndex?(previousIdentifier: ResourceIdentifier, nextIdentifier: ResourceIdentifier, options?: LocalRdfMoveOptions): Promise; rewriteTerms?(input: RdfTermRewriteInput): Promise | RdfTermRewriteResult; } export interface LocalRdfSyncOptions { source?: string; workspace?: string; localPath?: string; sourceVersion?: string; } export interface LocalRdfMoveOptions extends LocalRdfSyncOptions { previousSource?: string; } export interface SourceScopedStructuredRdfAccessor { writeRdfSourceDocument(identifier: ResourceIdentifier, quads: Quad[], metadata: RepresentationMetadata, source: RdfSourceInput): Promise; deleteRdfSourceDocument(identifier: ResourceIdentifier): Promise; moveRdfSourceDocument?(oldSource: string, next: RdfSourceInput): Promise; indexTextSource?(source: RdfTextSourceInput, text: string, chunks?: RdfTextChunkInput[]): Promise; moveTextSource?(oldSource: string, next: RdfTextSourceInput): Promise; deleteTextSource?(source: string): Promise; indexVectorSource?(source: RdfVectorSourceInput, chunks: RdfVectorChunkInput[]): Promise; moveVectorSource?(oldSource: string, next: RdfVectorSourceInput): Promise; deleteVectorSource?(source: string): Promise; } export interface LocalRdfAuthorityJournalOperation { id: string; } export interface LocalRdfAuthorityJournal { recordLocalCommitted(change: SolidFsChange, workspace: SolidFsManifest, txId?: string): Promise; markDone(id: string): Promise; markRetryableFailure(id: string, error: unknown): Promise; markReconcileRequired(id: string, reason: string): Promise; markFailedPermanent(id: string, error: unknown): Promise; } /** * MixDataAccessor - Routes data to appropriate storage based on content type * * - RDF data (internal/quads) -> structuredDataAccessor (Solid RDF engine by default) * - RDF file mirrors (.ttl/.jsonld) -> rdfFileDataAccessor (local FileSystem) * - Other data (binary, text, etc.) -> unstructuredDataAccessor (FileSystem, Minio, etc.) * * This uses composition instead of inheritance, allowing any DataAccessor * to be used as the RDF storage backend. */ export declare class MixDataAccessor implements DataAccessor, LocalRdfIndexAccessor { protected readonly logger: import("global-logger-factory").Logger; private readonly structuredDataAccessor; private readonly unstructuredDataAccessor; private readonly rdfFileDataAccessor; private readonly rdfFileMapper?; private readonly localRdfAuthorityJournal?; private readonly presignedRedirectEnabled; private readonly mirrorContainersToUnstructured; private readonly textSearchIndexingEnabled; private readonly rdfSearchIntentSink?; constructor(structuredDataAccessor: DataAccessor, unstructuredDataAccessor: DataAccessor, presignedRedirectEnabled?: boolean, mirrorContainersToUnstructured?: boolean, rdfFileDataAccessor?: DataAccessor, textSearchIndexingEnabled?: boolean, rdfFileMapper?: FileIdentifierMapper, localRdfAuthorityJournal?: LocalRdfAuthorityJournal, rdfSearchIntentSink?: RdfSearchReconciliationIntentSink); /** * This accessor supports all types of data. */ canHandle(representation: Representation): Promise; /** * Checks if the given representation is unstructured (non-RDF). */ private isUnstructured; getData(identifier: ResourceIdentifier): Promise>; /** * Read the local RDF file mirror used by SolidFS/local-first HTTP reads. * * `getData()` intentionally keeps returning the structured quad stream for * CSS internals. This method is the explicit file-content path for callers * that need a real Turtle/JSON-LD byte stream. */ getLocalRdfDocument(identifier: ResourceIdentifier): Promise; getMetadata(identifier: ResourceIdentifier): Promise; getChildren(identifier: ResourceIdentifier): AsyncIterableIterator; writeContainer(identifier: ResourceIdentifier, metadata: RepresentationMetadata): Promise; writeDocument(identifier: ResourceIdentifier, data: Guarded, metadata: RepresentationMetadata): Promise; writeMetadata(identifier: ResourceIdentifier, metadata: RepresentationMetadata): Promise; deleteResource(identifier: ResourceIdentifier): Promise; /** * Execute SPARQL UPDATE. * * Native QLever prepares an exact graph delta. The accessor validates its * write scope, patches the local RDF authority files, and rebuilds the index. */ executeSparqlUpdate(query: string, baseIri?: string, accessScope?: RdfAccessScope, options?: SparqlVoidOptions): Promise; private prepareNativeRdfSparqlUpdate; private executePreparedRdfSparqlUpdate; private assertPreparedDeltaQuadGraph; private readLocalRdfState; private writeLocalRdfAuthority; private writeLocalRdfAuthorityPatches; private prepareLocalRdfAuthorityJournalPatches; private recordLocalRdfAuthorityJournalPatch; private markLocalRdfAuthorityJournalFailure; private markLocalRdfAuthorityRollbackComplete; private localRdfPatchWorkspace; private localRdfPatchRelativePath; private rollbackLocalRdfAuthorityPatches; private toDefaultGraphQuad; private toGraphQuad; private quadKey; /** * Rebuild the structured RDF index from an already-written local RDF file. * * SolidFS uses this after tools edit `.ttl`/`.jsonld` files directly. The * local file remains the content authority; the structured accessor is only * refreshed as query/index state. */ syncLocalRdfDocument(identifier: ResourceIdentifier, data?: Guarded, contentType?: string, options?: LocalRdfSyncOptions): Promise; deleteLocalRdfIndex(identifier: ResourceIdentifier): Promise; moveLocalRdfIndex(previousIdentifier: ResourceIdentifier, nextIdentifier: ResourceIdentifier, options?: LocalRdfMoveOptions): Promise; private writeRdfDocument; private writeStructuredRdfIndex; private refreshLocalRdfMirror; private getLocalRdfMetadata; private getExistingLocalRdfMetadata; private createLocalRdfMetadata; private localRdfContentType; private sourceScopedStructuredAccessor; private syncTextSearchIndex; private syncUnstructuredTextSearchIndex; private deleteSearchIndexes; private moveSearchIndexes; private moveVectorIndexIfPresent; private deleteVectorIndexIfPresent; private rdfSourceInput; private rdfTextSourceInput; private relativePathFromWorkspace; private isByLineRdfIdentifier; private isRdfDocumentIdentifier; private isSearchableUnstructuredText; private isLocalMirroredRdf; private serializeQuadsForLocalFile; private serializeNQuads; private parseLocalRdf; private readStreamText; /** * Write unstructured document: store data in unstructured accessor, * then save metadata in structured accessor. */ private writeUnstructuredDocument; private deleteUnstructuredResourceIfPresent; private deleteRdfFileResourceIfPresent; private ensureUnstructuredParentContainers; private ensureRdfFileParentContainers; private ensureParentContainers; private writeContainerIfMissing; private sameIdentifier; private parentContainer; private invalidateMetadataCache; }