import * as wasm from './sophia_wasm_bg.wasm';

const heap = new Array(32).fill(undefined);

heap.push(undefined, null, true, false);

function getObject(idx) { return heap[idx]; }

let heap_next = heap.length;

function dropObject(idx) {
    if (idx < 36) return;
    heap[idx] = heap_next;
    heap_next = idx;
}

function takeObject(idx) {
    const ret = getObject(idx);
    dropObject(idx);
    return ret;
}

function addHeapObject(obj) {
    if (heap_next === heap.length) heap.push(heap.length + 1);
    const idx = heap_next;
    heap_next = heap[idx];

    heap[idx] = obj;
    return idx;
}

const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;

let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });

cachedTextDecoder.decode();

let cachegetUint8Memory0 = null;
function getUint8Memory0() {
    if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
        cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
    }
    return cachegetUint8Memory0;
}

function getStringFromWasm0(ptr, len) {
    return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}

function isLikeNone(x) {
    return x === undefined || x === null;
}

let cachegetFloat64Memory0 = null;
function getFloat64Memory0() {
    if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
        cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
    }
    return cachegetFloat64Memory0;
}

let cachegetInt32Memory0 = null;
function getInt32Memory0() {
    if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
        cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
    }
    return cachegetInt32Memory0;
}

let WASM_VECTOR_LEN = 0;

const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;

let cachedTextEncoder = new lTextEncoder('utf-8');

const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
    ? function (arg, view) {
    return cachedTextEncoder.encodeInto(arg, view);
}
    : function (arg, view) {
    const buf = cachedTextEncoder.encode(arg);
    view.set(buf);
    return {
        read: arg.length,
        written: buf.length
    };
});

function passStringToWasm0(arg, malloc, realloc) {

    if (realloc === undefined) {
        const buf = cachedTextEncoder.encode(arg);
        const ptr = malloc(buf.length);
        getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
        WASM_VECTOR_LEN = buf.length;
        return ptr;
    }

    let len = arg.length;
    let ptr = malloc(len);

    const mem = getUint8Memory0();

    let offset = 0;

    for (; offset < len; offset++) {
        const code = arg.charCodeAt(offset);
        if (code > 0x7F) break;
        mem[ptr + offset] = code;
    }

    if (offset !== len) {
        if (offset !== 0) {
            arg = arg.slice(offset);
        }
        ptr = realloc(ptr, len, len = offset + arg.length * 3);
        const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
        const ret = encodeString(arg, view);

        offset += ret.written;
    }

    WASM_VECTOR_LEN = offset;
    return ptr;
}

function debugString(val) {
    // primitive types
    const type = typeof val;
    if (type == 'number' || type == 'boolean' || val == null) {
        return  `${val}`;
    }
    if (type == 'string') {
        return `"${val}"`;
    }
    if (type == 'symbol') {
        const description = val.description;
        if (description == null) {
            return 'Symbol';
        } else {
            return `Symbol(${description})`;
        }
    }
    if (type == 'function') {
        const name = val.name;
        if (typeof name == 'string' && name.length > 0) {
            return `Function(${name})`;
        } else {
            return 'Function';
        }
    }
    // objects
    if (Array.isArray(val)) {
        const length = val.length;
        let debug = '[';
        if (length > 0) {
            debug += debugString(val[0]);
        }
        for(let i = 1; i < length; i++) {
            debug += ', ' + debugString(val[i]);
        }
        debug += ']';
        return debug;
    }
    // Test for built-in
    const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
    let className;
    if (builtInMatches.length > 1) {
        className = builtInMatches[1];
    } else {
        // Failed to match the standard '[object ClassName]'
        return toString.call(val);
    }
    if (className == 'Object') {
        // we're a user defined class or Object
        // JSON.stringify avoids problems with cycles, and is generally much
        // easier than looping through ownProperties of `val`.
        try {
            return 'Object(' + JSON.stringify(val) + ')';
        } catch (_) {
            return 'Object';
        }
    }
    // errors
    if (val instanceof Error) {
        return `${val.name}: ${val.message}\n${val.stack}`;
    }
    // TODO we could test for more things here, like `Set`s and `Map`s.
    return className;
}

let stack_pointer = 32;

function addBorrowedObject(obj) {
    if (stack_pointer == 1) throw new Error('out of js stack');
    heap[--stack_pointer] = obj;
    return stack_pointer;
}

function handleError(f) {
    return function () {
        try {
            return f.apply(this, arguments);

        } catch (e) {
            wasm.__wbindgen_exn_store(addHeapObject(e));
        }
    };
}

function getArrayU8FromWasm0(ptr, len) {
    return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
*/
export class AntiTreeDataset {

    static __wrap(ptr) {
        const obj = Object.create(AntiTreeDataset.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_antitreedataset_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.antitreedataset_new();
        return AntiTreeDataset.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.antitreedataset_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.antitreedataset_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.antitreedataset_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.antitreedataset_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {AntiTreeDataset}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.antitreedataset_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return AntiTreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {AntiTreeDataset}
    */
    difference(imported) {
        try {
            var ret = wasm.antitreedataset_difference(this.ptr, addBorrowedObject(imported));
            return AntiTreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {AntiTreeDataset}
    */
    intersection(imported) {
        try {
            var ret = wasm.antitreedataset_intersection(this.ptr, addBorrowedObject(imported));
            return AntiTreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {AntiTreeDataset}
    */
    union(imported) {
        try {
            var ret = wasm.antitreedataset_union(this.ptr, addBorrowedObject(imported));
            return AntiTreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.antitreedataset_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.antitreedataset_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.antitreedataset_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {AntiTreeDataset}
    */
    filter(filter_function) {
        try {
            var ret = wasm.antitreedataset_filter(this.ptr, addBorrowedObject(filter_function));
            return AntiTreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {AntiTreeDataset}
    */
    map(map_function) {
        try {
            var ret = wasm.antitreedataset_map(this.ptr, addBorrowedObject(map_function));
            return AntiTreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.antitreedataset_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.antitreedataset_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.antitreedataset_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.antitreedataset_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.antitreedataset_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.antitreedataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.antitreedataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.antitreedataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.antitreedataset_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.antitreedataset_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.antitreedataset_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.antitreedataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class ArrayDataset {

    static __wrap(ptr) {
        const obj = Object.create(ArrayDataset.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_arraydataset_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.arraydataset_new();
        return ArrayDataset.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.arraydataset_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.arraydataset_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.arraydataset_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.arraydataset_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {ArrayDataset}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.arraydataset_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return ArrayDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {ArrayDataset}
    */
    difference(imported) {
        try {
            var ret = wasm.arraydataset_difference(this.ptr, addBorrowedObject(imported));
            return ArrayDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {ArrayDataset}
    */
    intersection(imported) {
        try {
            var ret = wasm.arraydataset_intersection(this.ptr, addBorrowedObject(imported));
            return ArrayDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {ArrayDataset}
    */
    union(imported) {
        try {
            var ret = wasm.arraydataset_union(this.ptr, addBorrowedObject(imported));
            return ArrayDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.arraydataset_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.arraydataset_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.arraydataset_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {ArrayDataset}
    */
    filter(filter_function) {
        try {
            var ret = wasm.arraydataset_filter(this.ptr, addBorrowedObject(filter_function));
            return ArrayDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {ArrayDataset}
    */
    map(map_function) {
        try {
            var ret = wasm.arraydataset_map(this.ptr, addBorrowedObject(map_function));
            return ArrayDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.arraydataset_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.arraydataset_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.arraydataset_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.arraydataset_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.arraydataset_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.arraydataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.arraydataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.arraydataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.arraydataset_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.arraydataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.arraydataset_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.arraydataset_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.arraydataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
* Wrapper struct for every data factory function
*/
export class DataFactory {

    static __wrap(ptr) {
        const obj = Object.create(DataFactory.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_datafactory_free(ptr);
    }
    /**
    * Builds an instance of a factory that builds RDF.JS compliant objects
    * managed by Sophia
    */
    constructor() {
        var ret = wasm.datafactory_new();
        return DataFactory.__wrap(ret);
    }
    /**
    * Returns a named node that concerns the given URL
    * @param {string} value
    * @returns {Term}
    */
    static namedNode(value) {
        var ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        var ret = wasm.datafactory_namedNode(ptr0, len0);
        return Term.__wrap(ret);
    }
    /**
    * Returns a blank node that either contains the given URL or a randomly
    * generated ID using Uuid v4
    * @param {string | undefined} value
    * @returns {Term}
    */
    static blankNode(value) {
        var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        var ret = wasm.datafactory_blankNode(ptr0, len0);
        return Term.__wrap(ret);
    }
    /**
    * Returns a new ltieral. If `language_or_data` is a Named Node, it will
    * be used as the datatype. If it is a string formatted using the BCP 47
    * spefification il will be used as the language. If undefined, it will be
    * string.
    * @param {string | undefined} value_string
    * @param {any} language_or_datatype
    * @returns {Term}
    */
    static literal(value_string, language_or_datatype) {
        try {
            var ptr0 = isLikeNone(value_string) ? 0 : passStringToWasm0(value_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
            var len0 = WASM_VECTOR_LEN;
            var ret = wasm.datafactory_literal(ptr0, len0, addBorrowedObject(language_or_datatype));
            return Term.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Builds a literal using the passed BCP 47 formatted language
    * @param {string} value
    * @param {string} language
    * @returns {Term}
    */
    static literalFromString(value, language) {
        var ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        var ptr1 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len1 = WASM_VECTOR_LEN;
        var ret = wasm.datafactory_literalFromString(ptr0, len0, ptr1, len1);
        return Term.__wrap(ret);
    }
    /**
    * Builds a literal of passed the datatype
    * @param {string} value
    * @param {any} named_node
    * @returns {Term}
    */
    static literalFromNamedNode(value, named_node) {
        try {
            var ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
            var len0 = WASM_VECTOR_LEN;
            var ret = wasm.datafactory_literalFromNamedNode(ptr0, len0, addBorrowedObject(named_node));
            return Term.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Builds a new variable
    * @param {string | undefined} optional_value
    * @returns {Term}
    */
    static variable(optional_value) {
        var ptr0 = isLikeNone(optional_value) ? 0 : passStringToWasm0(optional_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        var ret = wasm.datafactory_variable(ptr0, len0);
        return Term.__wrap(ret);
    }
    /**
    * Returns a term that represents the default graph
    * @returns {Term}
    */
    static defaultGraph() {
        var ret = wasm.datafactory_defaultGraph();
        return Term.__wrap(ret);
    }
    /**
    * Retuns a quad managed by Sophia's back end with the given subject,
    * predicate, object and graph. If no graph is passed, the default graph
    * will be used.
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {Quad}
    */
    static quad(subject, predicate, object, graph) {
        try {
            var ret = wasm.datafactory_quad(addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return Quad.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns a quad managed by Sophia's back end with the given subject,
    * predicate and object. The assigned graph will be the default graph.
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @returns {Quad}
    */
    static triple(subject, predicate, object) {
        try {
            var ret = wasm.datafactory_triple(addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object));
            return Quad.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns a new term managed by Sophia's back end that is identical wrt
    * RDF.JS specification
    * @param {any} original
    * @returns {Term}
    */
    static fromTerm(original) {
        try {
            var ret = wasm.datafactory_fromTerm(addBorrowedObject(original));
            return Term.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns a new quad managed by Sophia's back end that is identical wrt
    * RDF.JS specification
    * @param {any} original
    * @returns {Quad}
    */
    static fromQuad(original) {
        try {
            var ret = wasm.datafactory_fromQuad(addBorrowedObject(original));
            return Quad.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns a dataset managed by Sophia's back end. `parameter` can either
    * be undefined, another dataset or a sequence of quads. If `parameter`
    * isn't undefined, the returned dataset will contain every quad in the
    * given argument.
    * @param {any} parameter
    * @returns {TreeDataset}
    */
    static dataset(parameter) {
        try {
            var ret = wasm.datafactory_dataset(addBorrowedObject(parameter));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
}
/**
*/
export class FastDataset {

    static __wrap(ptr) {
        const obj = Object.create(FastDataset.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_fastdataset_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.fastdataset_new();
        return FastDataset.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.fastdataset_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.fastdataset_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.fastdataset_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.fastdataset_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {FastDataset}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.fastdataset_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return FastDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FastDataset}
    */
    difference(imported) {
        try {
            var ret = wasm.fastdataset_difference(this.ptr, addBorrowedObject(imported));
            return FastDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FastDataset}
    */
    intersection(imported) {
        try {
            var ret = wasm.fastdataset_intersection(this.ptr, addBorrowedObject(imported));
            return FastDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FastDataset}
    */
    union(imported) {
        try {
            var ret = wasm.fastdataset_union(this.ptr, addBorrowedObject(imported));
            return FastDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.fastdataset_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.fastdataset_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.fastdataset_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {FastDataset}
    */
    filter(filter_function) {
        try {
            var ret = wasm.fastdataset_filter(this.ptr, addBorrowedObject(filter_function));
            return FastDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {FastDataset}
    */
    map(map_function) {
        try {
            var ret = wasm.fastdataset_map(this.ptr, addBorrowedObject(map_function));
            return FastDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.fastdataset_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.fastdataset_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.fastdataset_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.fastdataset_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.fastdataset_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.fastdataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.fastdataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.fastdataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.fastdataset_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fastdataset_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fastdataset_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.fastdataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class FastDatasetToA {

    static __wrap(ptr) {
        const obj = Object.create(FastDatasetToA.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_fastdatasettoa_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.fastdatasettoa_new();
        return FastDatasetToA.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.fastdatasettoa_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.fastdatasettoa_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.fastdatasettoa_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.fastdatasettoa_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {FastDatasetToA}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.fastdatasettoa_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return FastDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FastDatasetToA}
    */
    difference(imported) {
        try {
            var ret = wasm.fastdatasettoa_difference(this.ptr, addBorrowedObject(imported));
            return FastDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FastDatasetToA}
    */
    intersection(imported) {
        try {
            var ret = wasm.fastdatasettoa_intersection(this.ptr, addBorrowedObject(imported));
            return FastDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FastDatasetToA}
    */
    union(imported) {
        try {
            var ret = wasm.fastdatasettoa_union(this.ptr, addBorrowedObject(imported));
            return FastDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.fastdatasettoa_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.fastdatasettoa_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.fastdatasettoa_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {FastDatasetToA}
    */
    filter(filter_function) {
        try {
            var ret = wasm.fastdatasettoa_filter(this.ptr, addBorrowedObject(filter_function));
            return FastDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {FastDatasetToA}
    */
    map(map_function) {
        try {
            var ret = wasm.fastdatasettoa_map(this.ptr, addBorrowedObject(map_function));
            return FastDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.fastdatasettoa_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.fastdatasettoa_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.fastdatasettoa_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.fastdatasettoa_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.fastdatasettoa_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.fastdatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.fastdatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.fastdatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.fastdatasettoa_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fastdatasettoa_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fastdatasettoa_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.fastdatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class FullDataset {

    static __wrap(ptr) {
        const obj = Object.create(FullDataset.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_fulldataset_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.fulldataset_new();
        return FullDataset.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.fulldataset_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.fulldataset_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.fulldataset_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.fulldataset_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {FullDataset}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.fulldataset_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return FullDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FullDataset}
    */
    difference(imported) {
        try {
            var ret = wasm.fulldataset_difference(this.ptr, addBorrowedObject(imported));
            return FullDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FullDataset}
    */
    intersection(imported) {
        try {
            var ret = wasm.fulldataset_intersection(this.ptr, addBorrowedObject(imported));
            return FullDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FullDataset}
    */
    union(imported) {
        try {
            var ret = wasm.fulldataset_union(this.ptr, addBorrowedObject(imported));
            return FullDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.fulldataset_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.fulldataset_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.fulldataset_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {FullDataset}
    */
    filter(filter_function) {
        try {
            var ret = wasm.fulldataset_filter(this.ptr, addBorrowedObject(filter_function));
            return FullDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {FullDataset}
    */
    map(map_function) {
        try {
            var ret = wasm.fulldataset_map(this.ptr, addBorrowedObject(map_function));
            return FullDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.fulldataset_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.fulldataset_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.fulldataset_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.fulldataset_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.fulldataset_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.fulldataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.fulldataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.fulldataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.fulldataset_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fulldataset_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fulldataset_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.fulldataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class FullDatasetToA {

    static __wrap(ptr) {
        const obj = Object.create(FullDatasetToA.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_fulldatasettoa_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.fulldatasettoa_new();
        return FullDatasetToA.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.fulldatasettoa_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.fulldatasettoa_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.fulldatasettoa_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.fulldatasettoa_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {FullDatasetToA}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.fulldatasettoa_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return FullDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FullDatasetToA}
    */
    difference(imported) {
        try {
            var ret = wasm.fulldatasettoa_difference(this.ptr, addBorrowedObject(imported));
            return FullDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FullDatasetToA}
    */
    intersection(imported) {
        try {
            var ret = wasm.fulldatasettoa_intersection(this.ptr, addBorrowedObject(imported));
            return FullDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {FullDatasetToA}
    */
    union(imported) {
        try {
            var ret = wasm.fulldatasettoa_union(this.ptr, addBorrowedObject(imported));
            return FullDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.fulldatasettoa_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.fulldatasettoa_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.fulldatasettoa_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {FullDatasetToA}
    */
    filter(filter_function) {
        try {
            var ret = wasm.fulldatasettoa_filter(this.ptr, addBorrowedObject(filter_function));
            return FullDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {FullDatasetToA}
    */
    map(map_function) {
        try {
            var ret = wasm.fulldatasettoa_map(this.ptr, addBorrowedObject(map_function));
            return FullDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.fulldatasettoa_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.fulldatasettoa_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.fulldatasettoa_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.fulldatasettoa_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.fulldatasettoa_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.fulldatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.fulldatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.fulldatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.fulldatasettoa_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fulldatasettoa_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.fulldatasettoa_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.fulldatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class LightDataset {

    static __wrap(ptr) {
        const obj = Object.create(LightDataset.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_lightdataset_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.lightdataset_new();
        return LightDataset.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.lightdataset_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.lightdataset_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.lightdataset_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.lightdataset_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {LightDataset}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.lightdataset_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return LightDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {LightDataset}
    */
    difference(imported) {
        try {
            var ret = wasm.lightdataset_difference(this.ptr, addBorrowedObject(imported));
            return LightDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {LightDataset}
    */
    intersection(imported) {
        try {
            var ret = wasm.lightdataset_intersection(this.ptr, addBorrowedObject(imported));
            return LightDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {LightDataset}
    */
    union(imported) {
        try {
            var ret = wasm.lightdataset_union(this.ptr, addBorrowedObject(imported));
            return LightDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.lightdataset_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.lightdataset_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.lightdataset_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {LightDataset}
    */
    filter(filter_function) {
        try {
            var ret = wasm.lightdataset_filter(this.ptr, addBorrowedObject(filter_function));
            return LightDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {LightDataset}
    */
    map(map_function) {
        try {
            var ret = wasm.lightdataset_map(this.ptr, addBorrowedObject(map_function));
            return LightDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.lightdataset_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.lightdataset_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.lightdataset_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.lightdataset_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.lightdataset_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.lightdataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.lightdataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.lightdataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.lightdataset_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.lightdataset_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.lightdataset_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.lightdataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class LightDatasetToA {

    static __wrap(ptr) {
        const obj = Object.create(LightDatasetToA.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_lightdatasettoa_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.lightdatasettoa_new();
        return LightDatasetToA.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.lightdatasettoa_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.lightdatasettoa_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.lightdatasettoa_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.lightdatasettoa_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {LightDatasetToA}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.lightdatasettoa_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return LightDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {LightDatasetToA}
    */
    difference(imported) {
        try {
            var ret = wasm.lightdatasettoa_difference(this.ptr, addBorrowedObject(imported));
            return LightDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {LightDatasetToA}
    */
    intersection(imported) {
        try {
            var ret = wasm.lightdatasettoa_intersection(this.ptr, addBorrowedObject(imported));
            return LightDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {LightDatasetToA}
    */
    union(imported) {
        try {
            var ret = wasm.lightdatasettoa_union(this.ptr, addBorrowedObject(imported));
            return LightDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.lightdatasettoa_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.lightdatasettoa_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.lightdatasettoa_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {LightDatasetToA}
    */
    filter(filter_function) {
        try {
            var ret = wasm.lightdatasettoa_filter(this.ptr, addBorrowedObject(filter_function));
            return LightDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {LightDatasetToA}
    */
    map(map_function) {
        try {
            var ret = wasm.lightdatasettoa_map(this.ptr, addBorrowedObject(map_function));
            return LightDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.lightdatasettoa_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.lightdatasettoa_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.lightdatasettoa_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.lightdatasettoa_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.lightdatasettoa_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.lightdatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.lightdatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.lightdatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.lightdatasettoa_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.lightdatasettoa_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.lightdatasettoa_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.lightdatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
* A SophiaExportQuad owns its data in the form of four RcTerms.
*/
export class Quad {

    static __wrap(ptr) {
        const obj = Object.create(Quad.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_quad_free(ptr);
    }
    /**
    * Returns the subject of the quad
    * @returns {Term}
    */
    get subject() {
        var ret = wasm.quad_subject(this.ptr);
        return Term.__wrap(ret);
    }
    /**
    * Returns the predicate of the quad
    * @returns {Term}
    */
    get predicate() {
        var ret = wasm.quad_predicate(this.ptr);
        return Term.__wrap(ret);
    }
    /**
    * Returns the object of the quad
    * @returns {Term}
    */
    get object() {
        var ret = wasm.quad_object(this.ptr);
        return Term.__wrap(ret);
    }
    /**
    * Returns the graph of the quad
    * @returns {Term}
    */
    get graph() {
        var ret = wasm.quad_graph(this.ptr);
        return Term.__wrap(ret);
    }
    /**
    * Returns a N-Quad representation of the quad
    * @returns {string}
    */
    toString() {
        try {
            wasm.quad_toString(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * Returns true if the passed quad is identical to this quad according to
    * RDF.JS specification ie the subject, predicate, object and graph are
    * the same.
    * @param {any} other
    * @returns {boolean}
    */
    equals(other) {
        try {
            var ret = wasm.quad_equals(this.ptr, addBorrowedObject(other));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Modifies the subject of this quad
    * @param {any} other
    */
    set subject(other) {
        try {
            wasm.quad_set_subject(this.ptr, addBorrowedObject(other));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Modifies the predicate of this quad
    * @param {any} other
    */
    set predicate(other) {
        try {
            wasm.quad_set_predicate(this.ptr, addBorrowedObject(other));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Modifies the object of this quad
    * @param {any} other
    */
    set object(other) {
        try {
            wasm.quad_set_object(this.ptr, addBorrowedObject(other));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Modifies the graph of this quad
    * @param {any} other
    */
    set graph(other) {
        try {
            wasm.quad_set_graph(this.ptr, addBorrowedObject(other));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns a pointer to this quad.
    *
    * This is mainly used to be able to detect a Rust managed quad from an
    * imported quad (as wasm_bindgen doesn't let us use polymorphism).
    *
    * Using this method can be very unsafe because it supposes only this
    * object has a method called getRustPtr in the Javascript world.
    * @returns {number}
    */
    get getRustPtr() {
        var ret = wasm.quad_quads_get_rust_ptr(this.ptr);
        return ret;
    }
}
/**
* An exportable iterator on that keeps an array of every elements that needs
* to be iterated on
*/
export class RustExportIterator {

    static __wrap(ptr) {
        const obj = Object.create(RustExportIterator.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_rustexportiterator_free(ptr);
    }
    /**
    * Returns an `RustExportIteratorNext` that contains to the next element.
    * This corresponds to the next function in Javascript iterators.
    * @returns {RustExportIteratorNext}
    */
    next() {
        var ret = wasm.rustexportiterator_next(this.ptr);
        return RustExportIteratorNext.__wrap(ret);
    }
}
/**
* An object that contains an element returned by `RustExportIterator::next`
*
* It follows the Javascript specification, having a `done` attribute that tells if the iterator is empty and a
* `value` attribute that contains the eventual value. They are modelized with an optional `JsValue`.
*/
export class RustExportIteratorNext {

    static __wrap(ptr) {
        const obj = Object.create(RustExportIteratorNext.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_rustexportiteratornext_free(ptr);
    }
    /**
    * Return true if the iterator is empty
    * @returns {boolean}
    */
    get done() {
        var ret = wasm.rustexportiteratornext_done(this.ptr);
        return ret !== 0;
    }
    /**
    * Return the possessed `JsValue`
    * @returns {any}
    */
    get value() {
        var ret = wasm.rustexportiteratornext_value(this.ptr);
        return takeObject(ret);
    }
}
/**
* Exportation of rust terms using an adapter that owns the term
*/
export class Term {

    static __wrap(ptr) {
        const obj = Object.create(Term.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_term_free(ptr);
    }
    /**
    * Returns the term type of this term.
    *
    * The returned value can either be NamedNode, BlankNode, Literal,
    * Variable or DefaultGraph.
    * @returns {string}
    */
    get termType() {
        try {
            wasm.term_term_type(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * Returns the value of this term
    * @returns {string}
    */
    get value() {
        try {
            wasm.term_value(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * Modifies the value of this term
    * @param {string} new_value
    */
    set value(new_value) {
        var ptr0 = passStringToWasm0(new_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.term_set_value(this.ptr, ptr0, len0);
    }
    /**
    * Returns the language of this term or an empty string if not applicable
    * @returns {string}
    */
    get language() {
        try {
            wasm.term_language(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * Modifies the language of this term if applicable
    * @param {string} language
    */
    set language(language) {
        var ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.term_set_language(this.ptr, ptr0, len0);
    }
    /**
    * Returns the datatype of this term if applicable
    * @returns {Term | undefined}
    */
    get datatype() {
        var ret = wasm.term_datatype(this.ptr);
        return ret === 0 ? undefined : Term.__wrap(ret);
    }
    /**
    * Modifies the dataset of this literal if applicable
    * @param {any} named_node
    */
    set datatype(named_node) {
        try {
            wasm.term_set_datatype(this.ptr, addBorrowedObject(named_node));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns true if this term and the given term are equals according to
    * RDF.JS specification.
    *
    * Two terms are identical if their termType, value and eventual language
    * or datatype are the same.
    * @param {any} other
    * @returns {boolean}
    */
    equals(other) {
        try {
            var ret = wasm.term_equals(this.ptr, addBorrowedObject(other));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * Returns the n3 representation of this term
    * @returns {string}
    */
    toString() {
        try {
            wasm.term_toString(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}
/**
*/
export class TreeDataset {

    static __wrap(ptr) {
        const obj = Object.create(TreeDataset.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_treedataset_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.antitreedataset_new();
        return TreeDataset.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.treedataset_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.treedataset_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.treedataset_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.treedataset_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {TreeDataset}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.treedataset_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {TreeDataset}
    */
    difference(imported) {
        try {
            var ret = wasm.treedataset_difference(this.ptr, addBorrowedObject(imported));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {TreeDataset}
    */
    intersection(imported) {
        try {
            var ret = wasm.treedataset_intersection(this.ptr, addBorrowedObject(imported));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {TreeDataset}
    */
    union(imported) {
        try {
            var ret = wasm.treedataset_union(this.ptr, addBorrowedObject(imported));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.treedataset_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.treedataset_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.treedataset_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {TreeDataset}
    */
    filter(filter_function) {
        try {
            var ret = wasm.treedataset_filter(this.ptr, addBorrowedObject(filter_function));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {TreeDataset}
    */
    map(map_function) {
        try {
            var ret = wasm.treedataset_map(this.ptr, addBorrowedObject(map_function));
            return TreeDataset.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.treedataset_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.treedataset_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.treedataset_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.treedataset_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.treedataset_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.treedataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.treedataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.treedataset_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.treedataset_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.treedataset_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.treedataset_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.treedataset_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {number}
    */
    getNumberOfLivingTrees() {
        var ret = wasm.treedataset_getNumberOfLivingTrees(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {boolean} s
    * @param {boolean} p
    * @param {boolean} o
    * @param {boolean} g
    */
    ensureHasIndexFor(s, p, o, g) {
        wasm.treedataset_ensureHasIndexFor(this.ptr, s, p, o, g);
    }
}
/**
*/
export class TreeDatasetToA {

    static __wrap(ptr) {
        const obj = Object.create(TreeDatasetToA.prototype);
        obj.ptr = ptr;

        return obj;
    }

    free() {
        const ptr = this.ptr;
        this.ptr = 0;

        wasm.__wbg_treedatasettoa_free(ptr);
    }
    /**
    */
    constructor() {
        var ret = wasm.treedatasettoa_new();
        return TreeDatasetToA.__wrap(ret);
    }
    /**
    * @param {any} quad
    */
    add(quad) {
        try {
            wasm.treedatasettoa_add(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    */
    delete(quad) {
        try {
            wasm.treedatasettoa_delete(this.ptr, addBorrowedObject(quad));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quad
    * @returns {boolean}
    */
    has(quad) {
        try {
            var ret = wasm.treedatasettoa_has(this.ptr, addBorrowedObject(quad));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {number}
    */
    get size() {
        var ret = wasm.treedatasettoa_size(this.ptr);
        return ret >>> 0;
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    * @returns {TreeDatasetToA}
    */
    match(subject, predicate, object, graph) {
        try {
            var ret = wasm.treedatasettoa_match(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
            return TreeDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {TreeDatasetToA}
    */
    difference(imported) {
        try {
            var ret = wasm.treedatasettoa_difference(this.ptr, addBorrowedObject(imported));
            return TreeDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {TreeDatasetToA}
    */
    intersection(imported) {
        try {
            var ret = wasm.treedatasettoa_intersection(this.ptr, addBorrowedObject(imported));
            return TreeDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {TreeDatasetToA}
    */
    union(imported) {
        try {
            var ret = wasm.treedatasettoa_union(this.ptr, addBorrowedObject(imported));
            return TreeDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    equals(imported) {
        try {
            var ret = wasm.treedatasettoa_equals(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    some(filter_function) {
        try {
            var ret = wasm.treedatasettoa_some(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {boolean}
    */
    every(filter_function) {
        try {
            var ret = wasm.treedatasettoa_every(this.ptr, addBorrowedObject(filter_function));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} filter_function
    * @returns {TreeDatasetToA}
    */
    filter(filter_function) {
        try {
            var ret = wasm.treedatasettoa_filter(this.ptr, addBorrowedObject(filter_function));
            return TreeDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} map_function
    * @returns {TreeDatasetToA}
    */
    map(map_function) {
        try {
            var ret = wasm.treedatasettoa_map(this.ptr, addBorrowedObject(map_function));
            return TreeDatasetToA.__wrap(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} imported
    * @returns {boolean}
    */
    contains(imported) {
        try {
            var ret = wasm.treedatasettoa_contains(this.ptr, addBorrowedObject(imported));
            return ret !== 0;
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} reducer
    * @param {any} initial_value
    * @returns {any}
    */
    reduce(reducer, initial_value) {
        try {
            var ret = wasm.treedatasettoa_reduce(this.ptr, addHeapObject(reducer), addBorrowedObject(initial_value));
            return takeObject(ret);
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} quads_as_jsvalue
    */
    addAll(quads_as_jsvalue) {
        try {
            wasm.treedatasettoa_addAll(this.ptr, addBorrowedObject(quads_as_jsvalue));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {any} subject
    * @param {any} predicate
    * @param {any} object
    * @param {any} graph
    */
    deleteMatches(subject, predicate, object, graph) {
        try {
            wasm.treedatasettoa_deleteMatches(this.ptr, addBorrowedObject(subject), addBorrowedObject(predicate), addBorrowedObject(object), addBorrowedObject(graph));
        } finally {
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @param {Function} quad_run_iteratee
    */
    forEach(quad_run_iteratee) {
        try {
            wasm.treedatasettoa_forEach(this.ptr, addBorrowedObject(quad_run_iteratee));
        } finally {
            heap[stack_pointer++] = undefined;
        }
    }
    /**
    * @returns {Array<any>}
    */
    toArray() {
        var ret = wasm.treedatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {string}
    */
    toString() {
        try {
            wasm.treedatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
    /**
    * @returns {Array<any>}
    */
    quads() {
        var ret = wasm.treedatasettoa_quads(this.ptr);
        return takeObject(ret);
    }
    /**
    * @returns {RustExportIterator}
    */
    getIterator() {
        var ret = wasm.treedatasettoa_getIterator(this.ptr);
        return RustExportIterator.__wrap(ret);
    }
    /**
    * @returns {number}
    */
    get rust_managed() {
        var ret = wasm.antitreedataset_rust_managed(this.ptr);
        return ret;
    }
    /**
    * @param {string} nquads
    */
    addNQuads(nquads) {
        var ptr0 = passStringToWasm0(nquads, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.treedatasettoa_addNQuads(this.ptr, ptr0, len0);
    }
    /**
    * @param {string} text
    */
    addTriG(text) {
        var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.treedatasettoa_addTriG(this.ptr, ptr0, len0);
    }
    /**
    * @returns {string}
    */
    toNQuads() {
        try {
            wasm.treedatasettoa_toNQuads(8, this.ptr);
            var r0 = getInt32Memory0()[8 / 4 + 0];
            var r1 = getInt32Memory0()[8 / 4 + 1];
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_free(r0, r1);
        }
    }
}

export const __wbindgen_object_drop_ref = function(arg0) {
    takeObject(arg0);
};

export const __wbg_subject_8e5854f40d24ae40 = function(arg0) {
    var ret = getObject(arg0).subject;
    return addHeapObject(ret);
};

export const __wbg_predicate_e00ab02ff592c625 = function(arg0) {
    var ret = getObject(arg0).predicate;
    return addHeapObject(ret);
};

export const __wbg_object_62423e6a8ee476e7 = function(arg0) {
    var ret = getObject(arg0).object;
    return addHeapObject(ret);
};

export const __wbg_graph_67bfa96d88581690 = function(arg0) {
    var ret = getObject(arg0).graph;
    return addHeapObject(ret);
};

export const __wbindgen_is_null = function(arg0) {
    var ret = getObject(arg0) === null;
    return ret;
};

export const __wbindgen_is_undefined = function(arg0) {
    var ret = getObject(arg0) === undefined;
    return ret;
};

export const __wbg_log_8119198f71597aeb = function(arg0, arg1) {
    console.log(getStringFromWasm0(arg0, arg1));
};

export const __wbg_quad_new = function(arg0) {
    var ret = Quad.__wrap(arg0);
    return addHeapObject(ret);
};

export const __wbindgen_is_falsy = function(arg0) {
    var ret = !getObject(arg0);
    return ret;
};

export const __wbindgen_object_clone_ref = function(arg0) {
    var ret = getObject(arg0);
    return addHeapObject(ret);
};

export const __wbindgen_string_new = function(arg0, arg1) {
    var ret = getStringFromWasm0(arg0, arg1);
    return addHeapObject(ret);
};

export const __wbg_termtype_00faffc57fc4909a = function(arg0, arg1) {
    var ret = getObject(arg1).termType;
    var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len0 = WASM_VECTOR_LEN;
    getInt32Memory0()[arg0 / 4 + 1] = len0;
    getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};

export const __wbg_quadsgetrustptr_111c4a4f176d28ec = function(arg0) {
    var ret = getObject(arg0).getRustPtr;
    return addHeapObject(ret);
};

export const __wbg_value_8091d3b17c6abe30 = function(arg0, arg1) {
    var ret = getObject(arg1).value;
    var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len0 = WASM_VECTOR_LEN;
    getInt32Memory0()[arg0 / 4 + 1] = len0;
    getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};

export const __wbg_language_2768e8e30600d471 = function(arg0, arg1) {
    var ret = getObject(arg1).language;
    var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len0 = WASM_VECTOR_LEN;
    getInt32Memory0()[arg0 / 4 + 1] = len0;
    getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};

export const __wbg_datatype_331de4ff7361d063 = function(arg0) {
    var ret = getObject(arg0).datatype;
    return addHeapObject(ret);
};

export const __wbg_get_f5f75a85b3c573d3 = function(arg0, arg1) {
    var ret = getObject(arg0)[arg1 >>> 0];
    return addHeapObject(ret);
};

export const __wbg_length_b6f1989cb582d53f = function(arg0) {
    var ret = getObject(arg0).length;
    return ret;
};

export const __wbindgen_is_function = function(arg0) {
    var ret = typeof(getObject(arg0)) === 'function';
    return ret;
};

export const __wbindgen_is_object = function(arg0) {
    const val = getObject(arg0);
    var ret = typeof(val) === 'object' && val !== null;
    return ret;
};

export const __wbg_next_a5e2b0997b86e2bd = function(arg0) {
    var ret = getObject(arg0).next;
    return addHeapObject(ret);
};

export const __wbg_next_e030af76ecee0845 = handleError(function(arg0) {
    var ret = getObject(arg0).next();
    return addHeapObject(ret);
});

export const __wbg_done_de5d8d9e2bd53827 = function(arg0) {
    var ret = getObject(arg0).done;
    return ret;
};

export const __wbg_value_78cc1e08158c2a75 = function(arg0) {
    var ret = getObject(arg0).value;
    return addHeapObject(ret);
};

export const __wbg_iterator_a4f28df7fe8b902c = function() {
    var ret = Symbol.iterator;
    return addHeapObject(ret);
};

export const __wbg_get_38f68ddea9e54820 = handleError(function(arg0, arg1) {
    var ret = Reflect.get(getObject(arg0), getObject(arg1));
    return addHeapObject(ret);
});

export const __wbg_call_79ca0d435495a83a = handleError(function(arg0, arg1) {
    var ret = getObject(arg0).call(getObject(arg1));
    return addHeapObject(ret);
});

export const __wbg_new_6b6f346b4912cdae = function() {
    var ret = new Array();
    return addHeapObject(ret);
};

export const __wbg_pop_098ddd9e060e571d = function(arg0) {
    var ret = getObject(arg0).pop();
    return addHeapObject(ret);
};

export const __wbg_push_f353108e20ec67a0 = function(arg0, arg1) {
    var ret = getObject(arg0).push(getObject(arg1));
    return ret;
};

export const __wbg_reverse_4027f99747b8d97d = function(arg0) {
    var ret = getObject(arg0).reverse();
    return addHeapObject(ret);
};

export const __wbg_call_122c1a957507a0d7 = handleError(function(arg0, arg1, arg2) {
    var ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
    return addHeapObject(ret);
});

export const __wbg_call_646f9f3c6af62d21 = handleError(function(arg0, arg1, arg2, arg3) {
    var ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
    return addHeapObject(ret);
});

export const __wbg_self_1c83eb4471d9eb9b = handleError(function() {
    var ret = self.self;
    return addHeapObject(ret);
});

export const __wbg_static_accessor_MODULE_abf5ae284bffdf45 = function() {
    var ret = module;
    return addHeapObject(ret);
};

export const __wbg_require_5b2b5b594d809d9f = function(arg0, arg1, arg2) {
    var ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
    return addHeapObject(ret);
};

export const __wbg_crypto_c12f14e810edcaa2 = function(arg0) {
    var ret = getObject(arg0).crypto;
    return addHeapObject(ret);
};

export const __wbg_msCrypto_679be765111ba775 = function(arg0) {
    var ret = getObject(arg0).msCrypto;
    return addHeapObject(ret);
};

export const __wbg_getRandomValues_05a60bf171bfc2be = function(arg0) {
    var ret = getObject(arg0).getRandomValues;
    return addHeapObject(ret);
};

export const __wbg_getRandomValues_3ac1b33c90b52596 = function(arg0, arg1, arg2) {
    getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
};

export const __wbg_randomFillSync_6f956029658662ec = function(arg0, arg1, arg2) {
    getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
};

export const __wbindgen_number_get = function(arg0, arg1) {
    const obj = getObject(arg1);
    var ret = typeof(obj) === 'number' ? obj : undefined;
    getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
    getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};

export const __wbindgen_string_get = function(arg0, arg1) {
    const obj = getObject(arg1);
    var ret = typeof(obj) === 'string' ? obj : undefined;
    var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len0 = WASM_VECTOR_LEN;
    getInt32Memory0()[arg0 / 4 + 1] = len0;
    getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};

export const __wbindgen_debug_string = function(arg0, arg1) {
    var ret = debugString(getObject(arg1));
    var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len0 = WASM_VECTOR_LEN;
    getInt32Memory0()[arg0 / 4 + 1] = len0;
    getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};

export const __wbindgen_throw = function(arg0, arg1) {
    throw new Error(getStringFromWasm0(arg0, arg1));
};

