export = WOQLQuery; declare class WOQLQuery extends WOQLCore { /** * defines the internal functions of the woql query object - the * language API is defined in WOQLQuery * @module WOQLQuery * @constructor * @param {object} [query] json-ld query for initialisation * @returns {WOQLQuery} */ /** * Update a pattern matching rule for the triple (Subject, Predicate, oldObjValue) with the * new one (Subject, Predicate, newObjValue) * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} newObjValue - The value to update or a literal * @param {string|Var} oldObjValue - The old value of the object * @returns {WOQLQuery} A WOQLQuery which contains the a Update Triple Statement */ update_triple(subject: string | Var, predicate: string | Var, newObjValue: string | Var, oldObjValue: string | Var): WOQLQuery; /** * Generates a query that by default matches all triples in a graph identified by "graph" * or in all the current terminusDB's graph * @param {string | boolean} [graph] - false or the resource identifier of a graph possible * value are schema/{main - myschema - *} | instance/{main - myschema - *} | * inference/{main - myschema - *} * @param {string|Var} [subject] - The IRI of a triple’s subject or a variable, * default value "v:Subject" * @param {string|Var} [predicate] - The IRI of a property or a variable, * default value "v:Predicate" * @param {string|Var} [object] - The IRI of a node or a variable, or a literal, * default value "v:Object" * @returns {WOQLQuery} A WOQLQuery which contains the pattern matching expression */ star(graph?: string | boolean, subject?: string | Var, predicate?: string | Var, object?: string | Var): WOQLQuery; /** * Update a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, Object, Graph) * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} newObject - The value to update or a literal * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string * @returns {WOQLQuery} A WOQLQuery which contains the a Update Quad Statement */ update_quad(subject: string | Var, predicate: string | Var, newObject: string | Var, graphRef: typedef.GraphRef): WOQLQuery; /** * @param {string|Var} id - IRI string or variable containing * @param {string|Var} type - IRI string or variable containing the IRI of the * @param {typedef.GraphRef} [refGraph] - Optional Graph resource identifier * @returns {WOQLQuery} A WOQLQuery which contains the insert expression */ insert(id: string | Var, type: string | Var, refGraph?: typedef.GraphRef): WOQLQuery; /** * Sets the graph resource ID that will be used for subsequent chained function calls * @param {typedef.GraphRef} [graphRef] Resource String identifying the graph which will * be used for subsequent chained schema calls * @returns {WOQLQuery} A WOQLQuery which contains the partial Graph pattern matching expression * @example */ graph(graphRef?: typedef.GraphRef): WOQLQuery; /** * Specifies the identity of a node that can then be used in subsequent builder functions. * Note that node() requires subsequent chained functions to complete the triples / quads * that it produces - by itself it only generates the subject. * @param {string|Var} nodeid - The IRI of a node or a variable containing an IRI which will * be the subject of the builder functions * @param {typedef.FuntionType} [chainType] - Optional type of builder function to build * (default is triple) * @returns {WOQLQuery} - A WOQLQuery which contains the partial Node pattern matching expression */ node(nodeid: string | Var, chainType?: typedef.FuntionType): WOQLQuery; /** * Deletes all triples in the passed graph (defaults to instance/main) * @param {typedef.GraphRef} [graphRef] - Resource String identifying the graph from * which all triples will be removed * @returns {WOQLQuery} - A WOQLQuery which contains the deletion expression * @example * nuke("schema/main") * //will delete everything from the schema/main graph */ nuke(graphRef?: typedef.GraphRef): WOQLQuery; /** * @param {string|Var} [Subj] - The IRI of a triple’s subject or a variable * @param {string|Var} [Pred] - The IRI of a property or a variable * @param {string|Var} [Obj] - The IRI of a node or a variable, or a literal * @param {typedef.GraphRef} [Graph] - the resource identifier of a graph possible * @returns {WOQLQuery} - A WOQLQuery which contains the pattern matching expression */ all(Subj?: string | Var, Pred?: string | Var, Obj?: string | Var, Graph?: typedef.GraphRef): WOQLQuery; /** * @param {boolean} tf * @returns {object} * @example */ boolean(tf: boolean): object; /** * @param {string} s * @returns {object} * @example */ string(s: string): object; /** * @param {any} s * @param {string} t * @returns {object} * @example */ literal(s: any, t: string): object; /** * @param {string} s * @returns {object} * @example */ iri(s: string): object; _set_context(ctxt: any): WOQLQuery; /** * @param {WOQLQuery} Subq * @returns {WOQLQuery} */ addSubQuery(Subq: WOQLQuery): WOQLQuery; /** * @param {string} msg * @returns {WOQLQuery} */ parameterError(msg: string): WOQLQuery; /** * @returns {WOQLQuery} */ updated(): WOQLQuery; /** * Read a node identified by an IRI as a JSON-LD document * @param {string} IRI - The document id or a variable to read * @param {string} output - Variable which will be bound to the document. * @return {WOQLQuery} WOQLQuery */ read_document(IRI: string, output: string): WOQLQuery; /** * Insert a document in the graph. * @param {object} docjson - The document to insert. Must either have an '@id' or * have a class specified key. * @param {string} [IRI] - An optional identifier specifying the document location. * @return {WOQLQuery} WOQLQuery */ insert_document(docjson: any, IRI?: string): WOQLQuery; /** * Update a document identified by an IRI * @param {object} docjson - The document to update. Must either have an '@id' or * have a class specified key. * @param {string} [IRI] - An optional identifier specifying the document location. * @return {WOQLQuery} WOQLQuery */ update_document(docjson: any, IRI?: string): WOQLQuery; /** * Delete a document from the graph. * @param {string} IRI - The document id or a variable * @return {WOQLQuery} WOQLQuery */ delete_document(IRI: string): WOQLQuery; /** * Contains definitions of the WOQL functions which map directly to JSON-LD types * All other calls and queries can be composed from these */ wrapCursorWithAnd(): void; /** * Query running against any specific commit Id * @param {string} refPath - path to specific reference Id or commit Id * @param {WOQLQuery} [subquery] - subquery for the specific commit point * @returns {WOQLQuery} */ using(refPath: string, subquery?: WOQLQuery): WOQLQuery; /** * Adds a text comment to a query - can also be used to wrap any part of a query to turn it off * @param {string} comment - text comment * @param {WOQLQuery} [subquery] - query that is "commented out" * @returns {WOQLQuery} */ comment(comment: string, subquery?: WOQLQuery): WOQLQuery; /** * Filters the query so that only the variables included in [V1...Vn] are returned in the bindings * @param {...string|...Var} varNames - only these variables are returned * @returns {WOQLQuery} */ select(...varNames: any[]): WOQLQuery; /** * Filter the query to return only results that are distinct in the given variables * @param {...string|...Var} varNames - these variables are guaranteed to be unique as a tuple * @returns {WOQLQuery} */ distinct(...varNames: any[]): WOQLQuery; /** * Logical conjunction of the contained queries - all queries must match or the entire clause fails * @param {...WOQLQuery} subqueries - A list of one or more woql queries to execute as a conjunction * @returns {WOQLQuery} - A WOQLQuery object containing the conjunction of queries */ and(...subqueries: WOQLQuery[]): WOQLQuery; /** * Creates a logical OR of the arguments * @param {...WOQLQuery} subqueries - A list of one or more woql queries * to execute as alternatives * @returns {WOQLQuery} - A WOQLQuery object containing the logical Or of the subqueries */ or(...subqueries: WOQLQuery[]): WOQLQuery; /** * Specifies the database URL that will be the default database for the enclosed query * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string * @param {WOQLQuery} [query] - The query * @returns {WOQLQuery} A WOQLQuery object containing the from expression */ /** * Specifies the database URL that will be the default database for the enclosed query * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string * @param {WOQLQuery} [query] - The query * @returns {WOQLQuery} A WOQLQuery object containing the from expression */ from(graphRef: any, query?: WOQLQuery): WOQLQuery; /** * Specifies the graph resource to write the contained query into * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string * @param {WOQLQuery} [subquery] - The query which will be written into the graph * @returns {WOQLQuery} A WOQLQuery which will be written into the graph in question */ into(graphRef: any, subquery?: WOQLQuery): WOQLQuery; /** * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate, Object) * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @returns {WOQLQuery} */ triple(subject: string | Var, predicate: string | Var, object: string | Var): WOQLQuery; /** * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate, * Object) added in the current layer * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @returns {WOQLQuery} */ added_triple(subject: string | Var, predicate: string | Var, object: string | Var): WOQLQuery; /** * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate, * Object) added in the current commit * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @returns {WOQLQuery} */ removed_triple(subject: string | Var, predicate: string | Var, object: string | Var): WOQLQuery; /** * Creates a pattern matching rule for triple [Subject, Predicate, Object] * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @returns {WOQLQuery} A WOQLQuery which contains the a quad or a triple Statement */ link(subject: string | Var, predicate: string | Var, object: string | Var): WOQLQuery; /** * Creates a pattern matching rule for triple [Subject, Predicate, Object] * add extra information about the type of the value object * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string | number | boolean | Var} objValue - an specific value * @returns {WOQLQuery} A WOQLQuery which contains the a quad or a triple Statement */ value(subject: string | Var, predicate: string | Var, objValue: string | number | boolean | Var): WOQLQuery; /** * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, Object, Graph) * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string * @returns {WOQLQuery} */ quad(subject: string | Var, predicate: string | Var, object: string | Var, graphRef: string): WOQLQuery; /** * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, * Object, Graph) removed from the current commit * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string * @returns {WOQLQuery} */ added_quad(subject: string | Var, predicate: string | Var, object: string | Var, graphRef: any): WOQLQuery; /** * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, * Object, Graph) removed from the current commit * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string * @returns {WOQLQuery} */ removed_quad(subject: string | Var, predicate: string | Var, object: string | Var, graphRef: any): WOQLQuery; /** * Returns true if ClassA subsumes ClassB, according to the current DB schema * @param {string} classA - ClassA * @param {string} classB - ClassB * @returns {boolean} WOQLQuery */ sub(classA: string, classB: string): boolean; subsumption: (classA: string, classB: string) => boolean; /** * Matches if a is equal to b * @param {string|Var} varName - literal, variable or id * @param {string|Var} varValue - literal, variable or id * @returns {WOQLQuery} */ eq(varName: string | Var, varValue: string | Var): WOQLQuery; equals: (varName: string | Var, varValue: string | Var) => WOQLQuery; /** * Substring * @param {string|Var} string - String or variable * @param {number|Var} before - integer or variable (characters from start to begin) * @param {number|Var} [length] - integer or variable (length of substring) * @param {number|Var} [after] - integer or variable (number of characters after substring) * @param {string|Var} [subString] - String or variable * @returns {WOQLQuery} */ substr(string: string | Var, before: number | Var, length?: number | Var, after?: number | Var, subString?: string | Var): WOQLQuery; substring: (string: string | Var, before: number | Var, length?: number | Var, after?: number | Var, subString?: string | Var) => WOQLQuery; /** * Use the document inteface to import documents * @deprecated * Retrieves the exernal resource defined by QueryResource and copies values * from it into variables defined in AsVars * @param {Vars | array} asvars - an array of AsVar variable mappings (see as for format below) * @param {WOQLQuery} queryResource - an external resource (remote, file, post) to query * @returns {WOQLQuery} A WOQLQuery which contains the get expression */ get(asvars: any, queryResource: WOQLQuery): WOQLQuery; /** * Use the document inteface to import documents * @deprecated * @put Outputs the results of a query to a file * @param {Vars | array} varsToExp - an array of AsVar variable * mappings (see as for format below) * @param {WOQLQuery} query - The query which will be executed to produce the results * @param {string} fileResource - an file resource local to the server * @returns {WOQLQuery} A WOQLQuery which contains the put expression */ put(varsToExp: any, query: WOQLQuery, fileResource: string): WOQLQuery; /** * @param {...(array|string|Var)} varList variable number of arguments * @returns WOQLQuery */ as(...varList: (string | any[] | Var)[]): WOQLQuery; /** * Identifies a remote resource by URL and specifies the format of the resource through the options * @param {object} remoteObj - The URL at which the remote resource can be accessed * @param {typedef.DataFormatObj} [formatObj] - The format of the resource data {} * @returns {WOQLQuery} A WOQLQuery which contains the remote resource identifier */ remote(remoteObj: any, formatObj?: typedef.DataFormatObj): WOQLQuery; /** * Identifies a resource as a local path on the client, to be sent to the server through a * HTTP POST request, with the format defined through the options * @param {string} url - The Path on the server at which the file resource can be accessed * @param {typedef.DataFormatObj} [formatObj] - imput options, optional * @param {string} [source] - It defines the source of the file, it can be 'url','post' * @returns {WOQLQuery} A WOQLQuery which contains the Post resource identifier */ post(url: string, formatObj?: typedef.DataFormatObj, source?: string): WOQLQuery; /** * Deletes a single triple from the default graph of the database * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @returns {WOQLQuery} - A WOQLQuery which contains the Triple Deletion statement */ delete_triple(subject: string | Var, predicate: string | Var, object: string | Var): WOQLQuery; /** * Adds triples according to the the pattern [subject,predicate,object] * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @returns {WOQLQuery} */ add_triple(subject: string | Var, predicate: string | Var, object: string | Var): WOQLQuery; /** * Deletes a single triple from the graph [Subject, Predicate, Object, Graph] * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string * @returns {WOQLQuery} - A WOQLQuery which contains the Delete Quad Statement */ delete_quad(subject: string | Var, predicate: string | Var, object: string | Var, graphRef: string): WOQLQuery; /** * Adds quads according to the pattern [S,P,O,G] * @param {string|Var} subject - The IRI of a triple’s subject or a variable * @param {string|Var} predicate - The IRI of a property or a variable * @param {string|Var} object - The IRI of a node or a variable, or a literal * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string * @returns {WOQLQuery} */ add_quad(subject: string | Var, predicate: string | Var, object: string | Var, graphRef: string): WOQLQuery; /** * Remove whitespace from both sides of a string: * @param {string|Var} inputStr - A string or variable containing * the untrimmed version of the string * @param {string|Var} resultVarName - A string or variable * containing the trimmed version of the string * @returns {WOQLQuery} A WOQLQuery which contains the Trim pattern matching expression */ trim(inputStr: string | Var, resultVarName: string | Var): WOQLQuery; /** * Evaluates the passed arithmetic expression and generates or matches the result value * @param {object| WOQLQuery | string} arithExp - query or JSON-LD representing the query * @param {string|Var} resultVarName - output variable * @returns {WOQLQuery} */ eval(arithExp: any, resultVarName: string | Var): WOQLQuery; /** * Evaluates the passed arithmetic expression and generates or matches the result value. * Alias for eval() to support both naming conventions in fluent/chained style. * @param {object|WOQLQuery|string} arithExp - A WOQL query containing a valid arithmetic expression * @param {string|number|Var} resultVarName - Either a variable to store the result, or a numeric * literal to test against the evaluated expression * @returns {WOQLQuery} */ evaluate(arithExp: any, resultVarName: string | number | Var): WOQLQuery; /** * Adds the numbers together * @param {...(string|number|Var)} args - a variable or numeric containing the values to add * @returns {WOQLQuery} A WOQLQuery which contains the addition expression */ plus(...args: (string | number | Var)[]): WOQLQuery; /** * * Subtracts Numbers N1..Nn * @param {...(string|number|Var)} args - variable or numeric containing the value that will be * subtracted from * @returns {WOQLQuery} A WOQLQuery which contains the subtraction expression */ minus(...args: (string | number | Var)[]): WOQLQuery; /** * * Multiplies numbers N1...Nn together * @param {...(string|number|Var)} args - a variable or numeric containing the value * @returns {WOQLQuery} A WOQLQuery which contains the multiplication expression */ times(...args: (string | number | Var)[]): WOQLQuery; /** * Divides numbers N1...Nn by each other left, to right precedence * @param {...(string|number|Var )} args - numbers to tbe divided * @returns {WOQLQuery} A WOQLQuery which contains the division expression */ divide(...args: (string | number | Var)[]): WOQLQuery; /** * Division - integer division - args are divided left to right * @param {...(string|number|Var)} args - numbers for division * @returns {WOQLQuery} A WOQLQuery which contains the division expression */ div(...args: (string | number | Var)[]): WOQLQuery; /** * Exponent - raises varNum01 to the power of varNum02 * @param {string|number|Var} varNum - a variable or numeric containing the number to be * raised to the power of the second number * @param {number} expNum - a variable or numeric containing the exponent * @returns {WOQLQuery} A WOQLQuery which contains the exponent expression */ exp(varNum: string | number | Var, expNum: number): WOQLQuery; /** * Generates the nearest lower integer to the passed number * @param {string|number|Var} varNum - Variable or numeric containing the number to be floored * @returns {WOQLQuery} A WOQLQuery which contains the floor expression */ floor(varNum: string | number | Var): WOQLQuery; /** * Tests whether a given instance IRI has type Class, according to the current state of the DB * @param {string|Var} instanceIRI - A string IRI or a variable that identify the class instance * @param {string|Var} classId - A Class IRI or a variable * @returns {WOQLQuery} A WOQLQuery object containing the type test */ isa(instanceIRI: string | Var, classId: string | Var): WOQLQuery; /** * Generates a string Leverstein distance measure between stringA and stringB * @param {string|Var} stringA - string literal or variable representing a string to be compared * @param {string|Var } stringB - string literal or variable * representing the other string to be compared * @param {number|string|Var} distance - variable representing the distance between the variables * @returns {WOQLQuery} A WOQLQuery which contains the Like pattern matching expression */ like(stringA: string | Var, stringB: string | Var, distance: string | number | Var): WOQLQuery; /** * Compares the value of v1 against v2 and returns true if v1 is less than v2 * @param {string|number|Var} varNum01 - a variable or numeric containing * the number to be compared * @param {string|number|Var} varNum02 - a variable or numeric containing the second comporator * @returns {WOQLQuery} A WOQLQuery which contains the comparison expression */ less(varNum01: string | number | Var, varNum02: string | number | Var): WOQLQuery; /** * Compares the value of v1 against v2 and returns true if v1 is greater than v2 * @param {string|number|Var} varNum01 - a variable or numeric containing the number to be compared * @param {string|number|Var} varNum02 - a variable or numeric containing the second comporator * @returns {WOQLQuery} A WOQLQuery which contains the comparison expression */ greater(varNum01: string | number | Var, varNum02: string | number | Var): WOQLQuery; /** * Specifies that the Subquery is optional - if it does not match the query will not fail * @param {WOQLQuery} [subquery] - A subquery which will be optionally matched * @returns {WOQLQuery} A WOQLQuery object containing the optional sub Query */ opt(subquery?: WOQLQuery): WOQLQuery; optional: (subquery?: WOQLQuery) => WOQLQuery; /** * Generate a new IRI from the prefix and a hash of the variables which will be unique for any * given combination of variables * @param {string} prefix - A prefix for the IRI - typically formed of the doc prefix and the * classtype of the entity (“doc:Person”) * @param {array|string|Var} inputVarList - An array of variables and / or strings from which the * unique hash will be generated * @param {string|Var} resultVarName - Variable in which the unique ID is stored * @returns {WOQLQuery} A WOQLQuery object containing the unique ID generating function */ unique(prefix: string, inputVarList: string | any[] | Var, resultVarName: string | Var): WOQLQuery; /** * Generates the node's ID combined the variable list with a specific prefix (URL base). * If the input variables's values are the same, the output value will be the same. * @param {string} prefix * @param {string |array} inputVarList the variable input list for generate the id * @param {string} outputVar the output variable name */ idgen(prefix: string, inputVarList: string | any[], outputVar: string): WOQLQuery; idgenerator: (prefix: string, inputVarList: string | any[], outputVar: string) => WOQLQuery; /** * Generates a random ID with a specified prefix * Uses cryptographically secure random base64 encoding to generate unique identifiers * @param {string} prefix - prefix for the generated ID * @param {string} outputVar - variable that stores the generated ID * @returns {WOQLQuery} A WOQLQuery which contains the random ID generation pattern * @example * idgen_random("Person/", "v:person_id") */ idgen_random(prefix: string, outputVar: string): WOQLQuery; /** * Backward-compatible alias for idgen_random * @deprecated Use idgen_random instead */ random_idgen: (prefix: string, outputVar: string) => WOQLQuery; /** * Changes a string to upper-case * @param {string|Var} inputVarName - string or variable representing the uncapitalized string * @param {string|Var} resultVarName - variable that stores the capitalized string output * @returns {WOQLQuery} A WOQLQuery which contains the Upper case pattern matching expression */ upper(inputVarName: string | Var, resultVarName: string | Var): WOQLQuery; /** * Changes a string to lower-case * @param {string|Var} inputVarName - string or variable representing the non-lowercased string * @param {string|Var} resultVarName - variable that stores the lowercased string output * @returns {WOQLQuery} A WOQLQuery which contains the Lower case pattern matching expression */ lower(inputVarName: string | Var, resultVarName: string | Var): WOQLQuery; /** * Pads out the string input to be exactly len long by appending the pad character pad to * form output * @param {string|Var} inputVarName - The input string or variable in unpadded state * @param {string|Var} pad - The characters to use to pad the string or a variable representing them * @param {number | string | Var} len - The variable or integer value representing the length of * the output string * @param {string|Var} resultVarName - stores output * @returns {WOQLQuery} A WOQLQuery which contains the Pad pattern matching expression */ pad(inputVarName: string | Var, pad: string | Var, len: string | number | Var, resultVarName: string | Var): WOQLQuery; /** * Splits a string (Input) into a list strings (Output) by removing separator * @param {string|Var} inputVarName - A string or variable representing the unsplit string * @param {string|Var} separator - A string or variable containing a sequence of charatcters * to use as a separator * @param {string|Var} resultVarName - variable that stores output list * @returns {WOQLQuery} A WOQLQuery which contains the Split pattern matching expression */ split(inputVarName: string | Var, separator: string | Var, resultVarName: string | Var): WOQLQuery; /** * Matches if List includes Element * @param {string|object|Var} element - Either a variable, IRI or any simple datatype * @param {string|array|Var} list - List ([string, literal] or string*) Either a variable * representing a list or a list of variables or literals * @returns {WOQLQuery} A WOQLQuery which contains the List inclusion pattern matching expression */ member(element: any, list: string | any[] | Var): WOQLQuery; /** * takes a variable number of string arguments and concatenates them into a single string * @param {array|string|Var} varList - a variable representing a list or a list of variables or * strings - variables can be embedded in the string if they do not contain spaces * @param {string|Var} resultVarName - A variable or string containing the output string * @returns {WOQLQuery} A WOQLQuery which contains the Concatenation pattern matching expression */ concat(varList: string | any[] | Var, resultVarName: string | Var): WOQLQuery; concatenate: (varList: string | any[] | Var, resultVarName: string | Var) => WOQLQuery; /** * Joins a list variable together (Input) into a string variable (Output) by glueing the strings * together with Glue * @param {string|array|Var} varList - a variable representing a list or a list of strings * and / or variables * @param {string|Var} glue - A variable (v:glue) or (glue) string representing the characters * to put in between the joined strings in input * @param {string|Var} resultVarName - A variable or string containing the output string * @returns {WOQLQuery} A WOQLQuery which contains the Join pattern matching expression */ join(varList: string | any[] | Var, glue: string | Var, resultVarName: string | Var): WOQLQuery; /** * computes the sum of the List of values passed. In contrast to other arithmetic functions, * sum self-evaluates - it does not have to be passed to evaluate() * @param {WOQLQuery} subquery - a subquery or ([string or numeric]) - a list variable, or a * list of variables or numeric literals * @param {string|Var} total - the variable name with the sum result of the values in List * @returns {WOQLQuery} - A WOQLQuery which contains the Sum expression */ sum(subquery: WOQLQuery, total: string | Var): WOQLQuery; /** * * Specifies an offset position in the results to start listing results from * @param {number|string|Var} start - A variable that refers to an interger or an integer literal * @param {WOQLQuery} [subquery] - WOQL Query object, you can pass a subquery as an argument * or a chained query * @returns {WOQLQuery} A WOQLQuery whose results will be returned starting from * the specified offset */ start(start: string | number | Var, subquery?: WOQLQuery): WOQLQuery; /** * Specifies a maximum number of results that will be returned from the subquery * @param {number|string} limit - A variable that refers to an non-negative integer or a * non-negative integer * @param {WOQLQuery} [subquery] - A subquery whose results will be limited * @returns {WOQLQuery} A WOQLQuery whose results will be returned starting from * the specified offset */ limit(limit: string | number, subquery?: WOQLQuery): WOQLQuery; /** * Matches the regular expression defined in Patern against the Test string, to produce * the matched patterns in Matches * @param {string} pattern - string or variable using normal PCRE regular expression syntax with * the exception that special characters have to be escaped twice (to enable transport in JSONLD) * @param {string|Var} inputVarName - string or variable containing the string to be tested for * patterns with the regex * @param {string|array|object|Var} resultVarList - variable representing the list of matches * or a list of strings or variables * @returns {WOQLQuery} A WOQLQuery which contains the Regular Expression pattern * matching expression */ re(pattern: string, inputVarName: string | Var, resultVarList: any): WOQLQuery; regexp: (pattern: string, inputVarName: string | Var, resultVarList: any) => WOQLQuery; /** * Calculates the length of the list in va and stores it in vb * @param {string|array} inputVarList - Either a variable representing a list or a list of * variables or literals * @param {string|Var} resultVarName - A variable in which the length of the list is stored or * the length of the list as a non-negative integer * @returns {WOQLQuery} A WOQLQuery which contains the Length pattern matching expression */ length(inputVarList: string | any[], resultVarName: string | Var): WOQLQuery; /** * Extracts a contiguous subsequence from a list, following JavaScript's slice() semantics * @param {string|array|Var} inputList - Either a variable representing a list or a list of * variables or literals * @param {string|Var} resultVarName - A variable in which the sliced list is stored * @param {number|string|Var} start - The start index (0-based, supports negative indices) * @param {number|string|Var} [end] - The end index (exclusive, optional - defaults to list length) * @returns {WOQLQuery} A WOQLQuery which contains the Slice pattern matching expression * @example * let [result] = vars("result") * slice(["a", "b", "c", "d"], result, 1, 3) // result = ["b", "c"] * slice(["a", "b", "c", "d"], result, -2) // result = ["c", "d"] */ slice(inputList: string | any[] | Var, resultVarName: string | Var, start: string | number | Var, end?: string | number | Var): WOQLQuery; /** * * Logical negation of the contained subquery - if the subquery matches, the query * will fail to match * @param {string | WOQLQuery} [subquery] - A subquery which will be negated * @returns {WOQLQuery} A WOQLQuery object containing the negated sub Query */ not(subquery?: string | WOQLQuery): WOQLQuery; /** * Results in one solution of the subqueries * @param {string| WOQLQuery } [subquery] - WOQL Query objects * @returns {WOQLQuery} A WOQLQuery object containing the once sub Query */ once(subquery?: string | WOQLQuery): WOQLQuery; /** * Runs the query without backtracking on side-effects * @param {string| WOQLQuery } [subquery] - WOQL Query objects * @returns {WOQLQuery} A WOQLQuery object containing the immediately sub Query */ immediately(query: any): WOQLQuery; /** * Creates a count of the results of the query * @param {string|number|Var} countVarName - variable or integer count * @param {WOQLQuery} [subquery] * @returns {WOQLQuery} A WOQLQuery object containing the count sub Query */ count(countVarName: string | number | Var, subquery?: WOQLQuery): WOQLQuery; /** * Casts the value of Input to a new value of type Type and stores the result in CastVar * @param {string|number|object|Var} varName - Either a single variable or a * literal of any basic type * @param {string|Var} varType - Either a variable or a basic datatype (xsd / xdd) * @param {string|Var} resultVarName - save the return variable * @returns {WOQLQuery} A WOQLQuery which contains the casting expression */ typecast(varName: any, varType: string | Var, resultVarName: string | Var): WOQLQuery; cast: (varName: any, varType: string | Var, resultVarName: string | Var) => WOQLQuery; /** * Orders the results of the contained subquery by a precedence list of variables * @param {...string|...Var|...array} orderedVarlist - A sequence of variables, * by which to order the results, * each optionally followed by either “asc” or “desc” to represent order as a list, by default * it will sort the variable in ascending order * @returns {WOQLQuery} A WOQLQuery which contains the ordering expression */ order_by(...orderedVarlist: any[]): WOQLQuery; /** * * Groups the results of the contained subquery on the basis of identical values for Groupvars, * extracts the patterns defined in PatternVars and stores the results in GroupedVar * @param {array|string|Var} gvarlist - Either a single variable or an array of variables * @param {array|string|Var} groupedvar - Either a single variable or an array of variables * @param {string|Var} output - output variable name * @param {WOQLQuery} [groupquery] - The query whose results will be grouped * @returns {WOQLQuery} A WOQLQuery which contains the grouping expression */ group_by(gvarlist: string | any[] | Var, groupedvar: string | any[] | Var, output: string | Var, groupquery?: WOQLQuery): WOQLQuery; /** * A function that always matches, always returns true * @returns {WOQLQuery} A WOQLQuery object containing the true value that will match any pattern */ true(): WOQLQuery; /** * Performs a path regular expression match on the graph * @param {string|Var} subject - An IRI or variable that refers to an IRI representing the subject, * i.e. the starting point of the path * @param {string} pattern -(string) - A path regular expression describing a pattern through * multiple edges of the graph (see: https://terminusdb.com/docs/path-query-reference-guide) * @param {string|Var} object - An IRI or variable that refers to an IRI representing the object, * i.e. ending point of the path * @param {string|Var} [resultVarName] - A variable in which the actual paths * traversed will be stored * @returns {WOQLQuery} - A WOQLQuery which contains the path regular expression matching expression */ path(subject: string | Var, pattern: string, object: string | Var, resultVarName?: string | Var): WOQLQuery; /** * Extract the value of a key in a bound document. * @param {string|Var} document - Document which is being accessed. * @param {string|Var} field - The field from which the document which is being accessed. * @param {string|Var} value - The value for the document and field. * @returns {WOQLQuery} A WOQLQuery which contains the a dot Statement */ dot(document: string | Var, field: string | Var, value: string | Var): WOQLQuery; /** * Calculates the size in bytes of the contents of the resource identified in ResourceID * @param {string|Var} resourceId - A valid resource identifier string (can refer to any graph / * branch / commit / db) * @param {string|Var} resultVarName - The variable name */ size(resourceId: string | Var, resultVarName: string | Var): WOQLQuery; /** * * Calculates the number of triples of the contents of the resource identified in ResourceID * @param {string|Var} resourceId - A valid resource identifier string (can refer to any graph / * branch / commit / db) * @param {string|number|Var} tripleCount - An integer literal with the size in bytes or a * variable containing that integer * @returns {WOQLQuery} A WOQLQuery which contains the size expression */ triple_count(resourceId: string | Var, TripleCount: any): WOQLQuery; /** * Returns true if 'elementId' is of type 'elementType', according to the current DB schema * @param {string|Var} elementId - the id of a schema graph element * @param {string|Var} elementType - the element type * @returns {WOQLQuery} A WOQLQuery object containing the type_of pattern matching rule */ type_of(elementId: string | Var, elementType: string | Var): WOQLQuery; } import WOQLCore = require("./woqlCore"); import { Var } from "./woqlDoc"; import typedef = require("../typedef");