import {QueryService, TlnQueryParametrizer} from '../services/query.service';
import * as N3 from "node_modules/n3/src";
import {RdfEditorData, RdfStoredData} from './rdf-editor-DataSets';
/**
* Class for Handling all statements
**/
export class StatementHandler {
protected _agentStatements: Map<string, TlnStatementCollection>; // all the statements of a given thing as agent, e.g. subject
protected _agentListStatements: Map<string, string>; // For Resources/Subjects: Contains all connected lists
protected _agentListsAsStatements: Map<string, TlnStatementCollection>; // all the lists converted to real spo
protected _patientStatements: Map<string, TlnStatementCollection>; // all the statements containing the thing as patient, e.g. as object
protected _patientListStatements: Map<string, string>; // all the lists containing a given thing
protected _patientListsAsStatements: Map<string, TlnStatementCollection>; // all the s p to lists in which a given thing is listed
protected _editorDef: ChangeMgmntDef;
constructor(editorDef?: ChangeMgmntDef) {
this._agentStatements = new Map<string, TlnStatementCollection>();
this._agentListStatements = new Map<string, string>();
this._agentListsAsStatements = new Map<string, TlnStatementCollection>();
this._patientStatements = new Map<string, TlnStatementCollection>();
this._patientListStatements = new Map<string, string>();
this._patientListsAsStatements = new Map<string, TlnStatementCollection>();
if (editorDef) {this._editorDef = editorDef} else { this._editorDef = new ChangeMgmntDef()}
}
// async builder
// gets all statements from store for each given predicate
// listPatient: if patient === true, also all patient statements are loaded from store, i.e. all staments where the given iri acts as a object. This will take
// some time and there might even result in a server side timeout.
public static async buildFromStoreAsync(qService: QueryService,