Expression

Description

Object that contains an SPARQL expression.

This object also has access to create deriving expressions, using its self value

Methods

if( consequent: string | number | boolean | Date | Expression<ConditionalOrExpressionToken>, alternative: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that evaluates the self value as a condition and then returns the consequent value if the condition is true, otherwise it returns alternative.

See FunctionExpressionsBuilder.if for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression to return its value when the self value is evaluated to true.

string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression to returns its value when the self value is evaluated to false.

coalesce( ...expressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an Expression that returns the value of the first expression from the expressions list and the self value that evaluates without error.

See FunctionExpressionsBuilder.coalesce for the complete version of this method.

Parameters

NameTypeDescription

Extra expressions to be evaluated for the non-raising error one.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
sameTerm( term: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns true if the self value and term are the same RDF term, or false otherwise.

See FunctionExpressionsBuilder.sameTerm for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression to evaluate its value against the self value.

isIRI(): Expression

Creates an Expression that returns true if the self value is an IRI. Returns false otherwise.

See FunctionExpressionsBuilder.isIRI for the complete version of this method.

isURI(): Expression

Creates an Expression that returns true if the self value is an URI. Returns false otherwise.

See FunctionExpressionsBuilder.isURI for the complete version of this method.

isBlank(): Expression

Creates an Expression that returns true if the self value is a blank node. Returns false otherwise.

See FunctionExpressionsBuilder.isBlank for the complete version of this method.

isLiteral(): Expression

Creates an Expression that returns true if the self value is a literal. Returns false otherwise.

See FunctionExpressionsBuilder.isLiteral for the complete version of this method.

isNumeric(): Expression

Creates an Expression that returns true if the self value is a numeric value. Returns false otherwise.

See FunctionExpressionsBuilder.isNumeric for the complete version of this method.

str(): Expression

Creates an Expression that returns the string representation of the self value.

See FunctionExpressionsBuilder.str for the complete version of this method.

lang(): Expression

Creates an Expression that returns the language tag of the self value.

See FunctionExpressionsBuilder.lang for the complete version of this method.

datatype(): Expression

Creates an Expression that returns the datatype IRI of the self value.

See FunctionExpressionsBuilder.datatype for the complete version of this method.

iri(): Expression

Creates an Expression that constructs an IRI by resolving the self value.

See FunctionExpressionsBuilder.iri for the complete version of this method.

uri(): Expression

Creates an Expression that constructs a URI by resolving the self value.

See FunctionExpressionsBuilder.uri for the complete version of this method.

bnode(): Expression

Creates an Expression that constructs a blank node using the self value as base for the blank node label.

See FunctionExpressionsBuilder.bnode for the complete version of this method.

strDT( dataType: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that constructs an RDF literal with the self lexical value and dataType specified.

See FunctionExpressionsBuilder.strDT for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expresion with an IRI value to use as the datatype of the literal.

strLang( languageTag: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that constructs an RDF literal with the self lexical value and languageTag specified.

See FunctionExpressionsBuilder.strLang for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expresion with a string value to use as the language tag of the literal.

strLen(): Expression

Creates an Expression that returns the number of characters of the self value.

See FunctionExpressionsBuilder.strLen for the complete version of this method.

substr( starting: string | number | boolean | Date | Expression<ConditionalOrExpressionToken>, length?: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns a the portion of the self value value beginning at the position indicated by the value of starting and counting fot the number of characters indicated by the value of length if provided, otherwise it length will be considered infinite.

The index of the first character of a string is 1.

See FunctionExpressionsBuilder.substr for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the index from where to start the portion to take.

string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the number of characters of the portion to take.

uCase(): Expression

Creates an Expression that returns the self value converted to uppercase.

See FunctionExpressionsBuilder.uCase for the complete version of this method.

lCase(): Expression

Creates an Expression that returns the self value converted to lowercase.

See FunctionExpressionsBuilder.lCase for the complete version of this method.

strStarts( arg: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns the true if the self value starts with the value of arg, otherwise it returns false.

See FunctionExpressionsBuilder.strStarts for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the string value to check it's the start of the self value.

strEnds( arg: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns the true if the self value ends with the value of arg, otherwise it returns false.

See FunctionExpressionsBuilder.strEnds for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the string value to check it's the end of the self value.

contains( arg: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns the true if the self value contains the value of arg as a substring, otherwise it returns false.

See FunctionExpressionsBuilder.contains for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the string value to check it's contained by the self value.

strBefore( arg: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns the part the self value that precedes the first occurrence of arg value.

See FunctionExpressionsBuilder.strBefore for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the string value to check where it appears in the self value.

strAfter( arg: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns the part the self value that follows the first occurrence of arg value.

See FunctionExpressionsBuilder.strAfter for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the string value to check where it appears in the self value.

encodeForUri(): Expression

Creates an Expression that returns a literal with the encoded special characters that the self value provided may have.

See FunctionExpressionsBuilder.encodeForUri for the complete version of this method.

concat( ...literals: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an Expression that returns the concatenation of the self value with the string values of the literals provided.

See FunctionExpressionsBuilder.concat for the complete version of this method.

Parameters

NameTypeDescription

Expressions with the string values to concatenate to the self value.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
langMatches( languageRange: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns true if the self lang tag value value matches languageRange as defined in Matching of Language}.

See FunctionExpressionsBuilder.langMatches for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the language range that the self lang tag value will be checked against.

regex( pattern: RegExp ): Expression

Creates an Expression that returns true if self text value value matches the pattern regular expression.

See FunctionExpressionsBuilder.regex for the complete version of this method.

Parameters

NameTypeDescription
RegExp

RegExp used as the matcher.

replace( pattern: RegExp, replacement: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an Expression that returns a string produced by the self text value by replacing each non-overlapping occurrence of the pattern regular expression with the replacement string.

See FunctionExpressionsBuilder.replace for the complete version of this method.

Parameters

NameTypeDescription
RegExp

RegExp used as the matcher.

string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Expression with the string or pattern to use as the replacement.

abs(): Expression

Creates an Expression that returns the absolute value of the self value.

See FunctionExpressionsBuilder.abs for the complete version of this method.

round(): Expression

Creates an Expression that returns the number with no fractional part that is closest to the self value. If there are two such numbers, then the one that is closest to positive infinity is returned.

See FunctionExpressionsBuilder.round for the complete version of this method.

ceil(): Expression

Creates an Expression that returns the closest to negative infinity number with no fractional part that is closest to the elf value.

See FunctionExpressionsBuilder.ceil for the complete version of this method.

floor(): Expression

Creates an Expression that returns the closest to positive infinity number with no fractional part that is closest to the self value.

See FunctionExpressionsBuilder.replace for the complete version of this method.

year(): Expression

Creates an Expression that returns the year part of the self value as an integer.

See FunctionExpressionsBuilder.year for the complete version of this method.

month(): Expression

Creates an Expression that returns the month part of the self value as an integer.

See FunctionExpressionsBuilder.month for the complete version of this method.

day(): Expression

Creates an Expression that returns the day part of the self value as an integer.

See FunctionExpressionsBuilder.day for the complete version of this method.

hours(): Expression

Creates an Expression that returns the hours part of the self value as an integer.

See FunctionExpressionsBuilder.hours for the complete version of this method.

minutes(): Expression

Creates an Expression that returns the minutes part of the self value as an integer.

See FunctionExpressionsBuilder.minutes for the complete version of this method.

seconds(): Expression

Creates an Expression that returns the seconds part of the self value as a decimal.

See FunctionExpressionsBuilder.seconds for the complete version of this method.

timezone(): Expression

Creates an Expression that returns the timezone part of the self value as an xsd:dayTimeDuration.

Beware that using a Date object will generate a literal in ISO 8601 format with the Z timezone.

See FunctionExpressionsBuilder.timezone for the complete version of this method.

Creates an Expression that returns the timezone part of the self value as a string.

Beware that using a Date object will generate a literal in ISO 8601 format with the Z timezone.

See FunctionExpressionsBuilder.tz for the complete version of this method.

md5(): Expression

Creates an Expression that returns the MD5 checksum, calculated on the UTF-8 representation of the self string value.

See FunctionExpressionsBuilder.md5 for the complete version of this method.

sha1(): Expression

Creates an Expression that returns the SHA1 checksum, calculated on the UTF-8 representation of the self string value.

See FunctionExpressionsBuilder.sha1 for the complete version of this method.

sha256(): Expression

Creates an Expression that returns the SHA256 checksum, calculated on the UTF-8 representation of the self string value.

See FunctionExpressionsBuilder.sha256 for the complete version of this method.

sha384(): Expression

Creates an Expression that returns the SHA384 checksum, calculated on the UTF-8 representation of the self string value.

See FunctionExpressionsBuilder.sha384 for the complete version of this method.

sha512(): Expression

Creates an Expression that returns the SHA512 checksum, calculated on the UTF-8 representation of the self string value.

See FunctionExpressionsBuilder.sha512 for the complete version of this method.

count(): Expression

Creates an Expression that counts the number of times the self expression has a solution over the solution group.

See FunctionExpressionsBuilder.count for the complete version of this method.

countDistinct(): Expression

Creates an Expression that counts the number of times the self expression has a bound for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.count for the complete version of this method.

sum(): Expression

Creates an Expression that returns the value of the sum of the self expression's values over the solution group.

See FunctionExpressionsBuilder.sum for the complete version of this method.

sumDistinct(): Expression

Creates an Expression that returns the value of the sum of the self expression's values for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.sumDistinct for the complete version of this method.

avg(): Expression

Creates an Expression that returns the average value of the self expression's values over the solution group.

See FunctionExpressionsBuilder.avg for the complete version of this method.

avgDistinct(): Expression

Creates an Expression that returns the average value of the self expression's values for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.avgDistinct for the complete version of this method.

min(): Expression

Creates an Expression that returns the minimum value of the self expression's values over the solution group.

See FunctionExpressionsBuilder.min for the complete version of this method.

minDistinct(): Expression

Creates an Expression that returns the minimum value of the self expression's values for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.minDistinct for the complete version of this method.

max(): Expression

Creates an Expression that returns the maximum value of the self expression's values over the solution group.

See FunctionExpressionsBuilder.max for the complete version of this method.

maxDistinct(): Expression

Creates an Expression that returns the maximum value of the self expression's values for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.maxDistinct for the complete version of this method.

groupConcat( separator?: string ): Expression

Creates an Expression that returns the string concatenation of the self expression's values over the solution group.

See FunctionExpressionsBuilder.groupConcat for the complete version of this method.

Parameters

NameTypeDescription
string

Optional separator character used in the concatenation, where by default its a space.

groupConcatDistinct( separator?: string ): Expression

Creates an Expression that returns the string concatenation of the self expression's values for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.groupConcatDistinct for the complete version of this method.

Parameters

NameTypeDescription
string

Optional separator character used in the concatenation, where by default its a space.

sample(): Expression

Creates an Expression that returns an arbitrary value from the self expression's values over the solution group.

See FunctionExpressionsBuilder.sample for the complete version of this method.

sampleDistinct(): Expression

Creates an Expression that returns an arbitrary value from the self expression's values for every distinct sequence over the solution group.

See FunctionExpressionsBuilder.sampleDistinct for the complete version of this method.

or( ...restExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns logical ORs between the self value and every restExpressions.

See OperationExpressionsBuilder.or for the complete version of this method.

Parameters

NameTypeDescription

Expressions to construct a logical OR with the previous expression.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
and( ...restExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns logical ANDs between the self value and every restExpressions.

See OperationExpressionsBuilder.and for the complete version of this method.

Parameters

NameTypeDescription

Expressions to construct a logical AND with the previous expression.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
equals( rightExpression: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an operation Expression that returns true if the self value and rightExpression are the same RDF term.

See OperationExpressionsBuilder.equals for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Right expression to be compared against the self value.

notEquals( rightExpression: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an operation Expression that returns true if the self value and rightExpression are NOT the same RDF term.

See OperationExpressionsBuilder.notEquals for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Right expression to be compared against the self value.

lt( rightExpression: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an operation Expression that returns true if the self value is less than the rightExpression.

See OperationExpressionsBuilder.lt for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Right expression to be compared against the self value.

lte( rightExpression: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an operation Expression that returns true if the self value is less or equal than the rightExpression.

See OperationExpressionsBuilder.lte for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Right expression to be compared against the self value.

gt( rightExpression: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an operation Expression that returns true if the self value is greater than the rightExpression.

See OperationExpressionsBuilder.gt for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Right expression to be compared against the self value.

gte( rightExpression: string | number | boolean | Date | Expression<ConditionalOrExpressionToken> ): Expression

Creates an operation Expression that returns true if the self value is greater or equal than the rightExpression.

See OperationExpressionsBuilder.gte for the complete version of this method.

Parameters

NameTypeDescription
string | number | boolean | Date | Expression<ConditionalOrExpressionToken>

Right expression to be compared against the self value.

in( ...rightExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns true whether the self value is equal to any of the rightExpressions values.

See OperationExpressionsBuilder.in for the complete version of this method.

Parameters

NameTypeDescription

Expressions to compare its values against the self value.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
notIn( ...rightExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns true whether the self value is NOT equal to any of the rightExpressions values.

See OperationExpressionsBuilder.notIn for the complete version of this method.

Parameters

NameTypeDescription

Expressions to compare its values against the self value.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
add( ...restExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns the arithmetic sum between the self value and every restExpressions.

See OperationExpressionsBuilder.add for the complete version of this method.

Parameters

NameTypeDescription

Expressions to construct an arithmetic sum with the previous expression.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
subtract( ...restExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns the arithmetic difference between the self value and every restExpressions.

See OperationExpressionsBuilder.subtract for the complete version of this method.

Parameters

NameTypeDescription

Expressions to construct an arithmetic difference with the previous expression.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
multiply( ...restExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns the arithmetic product between the self value and every restExpressions.

See OperationExpressionsBuilder.multiply for the complete version of this method.

Parameters

NameTypeDescription

Expressions to construct an arithmetic product with the previous expression.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
divide( ...restExpressions: (string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[] ): Expression

Creates an operation Expression that returns the arithmetic quotient between the self value and every restExpressions.

See OperationExpressionsBuilder.divide for the complete version of this method.

Parameters

NameTypeDescription

Expressions to construct an arithmetic quotient with the previous expression.

(string | number | boolean | Date | Expression<ConditionalOrExpressionToken>)[]
not(): Expression

Creates an operation Expression that returns true if the effective boolean value of the self value is false.

See OperationExpressionsBuilder.not for the complete version of this method.

plus(): Expression

Creates an operation Expression that returns the numeric self value with its sing unchanged.

See OperationExpressionsBuilder.plus for the complete version of this method.

minus(): Expression

Creates an operation Expression that returns the numeric self value with its sing reversed.

See OperationExpressionsBuilder.minus for the complete version of this method.

as( variable: string | Variable ): Projectable<AssigmentToken>

Creates an assigment to a variable from the current expression.

Parameters

NameTypeDescription
string | Variable

Name or variable where the expression value will be assigned.

_getExpression(): T

Returns the ExpressionToken of the expression.

Expression

Description

Constant with the utils for Expression objects.

Methods

createFrom<T extends ExpressionToken, C extends Container<T>, O extends object>( container: C, object: O ): O & Expression<T>

Factory function that allows to crete a Expression from the object provided.

Parameters

NameTypeDescription
C

The related container with the data for the Expression statement.

O

Returns

The Expression statement created from the object provided.