Top | ![]() |
![]() |
![]() |
![]() |
typedef | rasqal_expression |
enum | rasqal_expression_flags |
rasqal_evaluation_context | |
enum | rasqal_op |
enum | rasqal_compare_flags |
enum | rasqal_pattern_flags |
rasqal_expression * rasqal_new_0op_expression (rasqal_world *world
,rasqal_op op
);
Constructor - create a new 0-operand (constant) expression.
The operators are:
RASQAL_EXPR_VARSTAR
The only operator here is the '*' in COUNT(*) as used by LAQRS.
rasqal_expression * rasqal_new_1op_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg
);
Constructor - create a new 1-operand expression. Takes ownership of the operand expression.
The operators are:
RASQAL_EXPR_TILDE
RASQAL_EXPR_BANG
RASQAL_EXPR_UMINUS
RASQAL_EXPR_BOUND
RASQAL_EXPR_STR
RASQAL_EXPR_LANG
RASQAL_EXPR_LANGMATCHES
RASQAL_EXPR_DATATYPE
RASQAL_EXPR_ISURI
RASQAL_EXPR_ISBLANK
RASQAL_EXPR_ISLITERAL
RASQAL_EXPR_ORDER_COND_ASC
RASQAL_EXPR_ORDER_COND_DESC
RASQAL_EXPR_COUNT
RASQAL_EXPR_SUM
RASQAL_EXPR_AVG
RASQAL_EXPR_MIN
RASQAL_EXPR_MAX
The operator RASQAL_EXPR_TILDE
is not used by SPARQL (formerly RDQL).
rasqal_expression * rasqal_new_2op_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg1
,rasqal_expression *arg2
);
Constructor - create a new 2-operand expression. Takes ownership of the operand expressions.
The operators are:
RASQAL_EXPR_AND
RASQAL_EXPR_OR
RASQAL_EXPR_EQ
RASQAL_EXPR_NEQ
RASQAL_EXPR_LT
RASQAL_EXPR_GT
RASQAL_EXPR_LE
RASQAL_EXPR_GE
RASQAL_EXPR_PLUS
RASQAL_EXPR_MINUS
RASQAL_EXPR_STAR
RASQAL_EXPR_SLASH
RASQAL_EXPR_REM
RASQAL_EXPR_STR_EQ
RASQAL_EXPR_STR_NEQ
RASQAL_EXPR_REM
RASQAL_EXPR_STR_EQ
, RASQAL_EXPR_STR_NEQ
and
RASQAL_EXPR_REM
are unused (formerly RDQL).
rasqal_expression * rasqal_new_3op_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg1
,rasqal_expression *arg2
,rasqal_expression *arg3
);
Constructor - create a new 3-operand expression. Takes ownership of the operands.
The operators are: RASQAL_EXPR_REGEX RASQAL_EXPR_IF RASQAL_EXPR_SUBSTR
rasqal_expression * rasqal_new_4op_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg1
,rasqal_expression *arg2
,rasqal_expression *arg3
,rasqal_expression *arg4
);
Constructor - create a new 4-operand expression. Takes ownership of the operands.
The operators are: RASQAL_EXPR_REPLACE
rasqal_expression * rasqal_new_aggregate_function_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg1
,raptor_sequence *params
,unsigned int flags
);
Constructor - create a new 1-arg aggregate function expression for a builtin aggregate function
Takes ownership of the args
and params
world |
rasqal_world object |
|
op |
built-in aggregate function expression operator |
|
arg1 |
rasqal_expression argument to aggregate function |
|
params |
sequence of rasqal_expression function parameters (or NULL) |
|
flags |
extension function bitflags |
rasqal_expression * rasqal_new_cast_expression (rasqal_world *world
,raptor_uri *name
,rasqal_expression *value
);
Constructor - create a new expression for casting and expression to a datatype. Takes ownership of the datatype uri and expression value.
rasqal_expression * rasqal_new_function_expression (rasqal_world *world
,raptor_uri *name
,raptor_sequence *args
,raptor_sequence *params
,unsigned int flags
);
Constructor - create a new expression for a URI-named function with arguments and optional parameters.
Takes ownership of the name
, args
and params
arguments.
world |
rasqal_world object |
|
name |
function name |
|
args |
sequence of rasqal_expression function arguments |
|
params |
sequence of rasqal_expression function parameters (or NULL) |
|
flags |
extension function bitflags |
rasqal_expression * rasqal_new_group_concat_expression (rasqal_world *world
,unsigned int flags
,raptor_sequence *args
,rasqal_literal *separator
);
Constructor - create a new SPARQL group concat expression
Takes an optional distinct flag, a list of expressions and an optional separator string.
Takes ownership of the args
and separator
world |
rasqal_world object |
|
flags |
bitset of flags. Only RASQAL_EXPR_FLAG_DISTINCT is defined |
|
args |
sequence of rasqal_expression list arguments |
|
separator |
SEPARATOR string literal or NULL |
rasqal_expression * rasqal_new_literal_expression (rasqal_world *world
,rasqal_literal *literal
);
Constructor - create a new expression for a rasqal_literal Takes ownership of the operand literal.
rasqal_expression * rasqal_new_set_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg1
,raptor_sequence *args
);
Constructor - create a new set IN/NOT IN operation with expression arguments.
Takes ownership of the arg1
and args
world |
rasqal_world object |
|
op |
list operation |
|
arg1 |
expression to look for in list |
|
args |
sequence of rasqal_expression list arguments |
rasqal_expression * rasqal_new_string_op_expression (rasqal_world *world
,rasqal_op op
,rasqal_expression *arg1
,rasqal_literal *literal
);
Constructor - create a new expression with one expression and one string operand. Takes ownership of the operands.
The operators are:
RASQAL_EXPR_STR_MATCH
and
RASQAL_EXPR_STR_NMATCH
(unused: formerly for RDQL)
rasqal_expression *
rasqal_new_expression_from_expression (rasqal_expression *e
);
Copy Constructor - create a new rasqal_expression object from an existing rasqal_expression object.
rasqal_expression * rasqal_new_expr_seq_expression (rasqal_world *world
,rasqal_op op
,raptor_sequence *args
);
Constructor - create a new expression with a sequence of expression arguments.
Takes ownership of the args
world |
rasqal_world object |
|
op |
expression operation |
|
args |
sequence of rasqal_expression arguments |
void
rasqal_free_expression (rasqal_expression *e
);
Destructor - destroy a rasqal_expression object.
int rasqal_expression_compare (rasqal_expression *e1
,rasqal_expression *e2
,int flags
,int *error_p
);
Compare two expressions
The two literals are compared. The comparison returned is as for strcmp, first before second returns <0. equal returns 0, and first after second returns >0. For URIs, the string value is used for the comparsion.
See rasqal_literal_compare()
for comparison flags.
If error
is not NULL, *error is set to non-0 on error
e1 |
rasqal_expression first expression |
|
e2 |
rasqal_expression second expression |
|
flags |
comparison flags: see |
|
error_p |
pointer to error |
rasqal_literal * rasqal_expression_evaluate (rasqal_world *world
,raptor_locator *locator
,rasqal_expression *e
,int flags
);
rasqal_expression_evaluate
is deprecated and should not be used in newly-written code.
Evaluate a rasqal_expression tree to give a rasqal_literal result or error.
Deprecated
: use rasqal_expression_evaluate2()
using a rasqal_evaluation_context
world |
||
locator |
error locator (or NULL) |
|
e |
The expression to evaluate. |
|
flags |
Flags for |
rasqal_literal * rasqal_expression_evaluate2 (rasqal_expression *e
,rasqal_evaluation_context *eval_context
,int *error_p
);
Evaluate a rasqal_expression tree in the context of a rasqal_evaluation_context to give a rasqal_literal result or error.
const char *
rasqal_expression_op_label (rasqal_op op
);
Get a label for the rasqal expression operator
int rasqal_expression_print (rasqal_expression *e
,FILE *fh
);
Print a Rasqal expression in a debug format.
The print debug format may change in any release.
void rasqal_expression_print_op (rasqal_expression *e
,FILE *fh
);
Print a rasqal expression operator in a debug format.
The print debug format may change in any release.
int (*rasqal_expression_visit_fn) (void *user_data
,rasqal_expression *e
);
User function to visit an expression and operate on it with
rasqal_expression_visit()
int rasqal_expression_visit (rasqal_expression *e
,rasqal_expression_visit_fn fn
,void *user_data
);
Visit a user function over a rasqal_expression
If the user function fn
returns non-0, the visit is truncated
and the value is returned.
e |
rasqal_expression to visit |
|
fn |
visit function |
|
user_data |
user data to pass to visit function |
rasqal_evaluation_context * rasqal_new_evaluation_context (rasqal_world *world
,raptor_locator *locator
,int flags
);
Constructor - create a rasqal_evaluation_context for use with
rasqal_expression_evaluate2()
void
rasqal_free_evaluation_context (rasqal_evaluation_context *eval_context
);
Destructor - destroy a rasqal_evaluation_context object.
int rasqal_evaluation_context_set_base_uri (rasqal_evaluation_context *eval_context
,raptor_uri *base_uri
);
Set the URI for a rasqal_evaluation_context
int rasqal_evaluation_context_set_rand_seed (rasqal_evaluation_context *eval_context
,unsigned int seed
);
Set the random seed for a rasqal_evaluation_context
typedef struct { rasqal_world *world; raptor_uri* base_uri; raptor_locator *locator; int flags; unsigned int seed; rasqal_random* random; } rasqal_evaluation_context;
A context for evaluating an expression such as with
rasqal_expression_evaluate2()
rasqal_world * |
rasqal world |
|
raptor_uri * |
base URI of expression context (or NULL) |
|
raptor_locator * |
locator or NULL |
|
expression comparison flags |
||
random seeed |
||
random number generator object |
Rasqal expression operators. A mixture of unary, binary and tertiary operators (string matches). Also includes casting and two ordering operators from ORDER BY in SPARQL.
Internal |
||
Expression for AND(A, B) |
||
Expression for OR(A, B) |
||
Expression for A equals B |
||
Expression for A not equals B. |
||
Expression for A less than B. |
||
Expression for A greather than B. |
||
Expression for A less than or equal to B. |
||
Expression for A greater than or equal to B. |
||
Expression for -A. |
||
Expression for +A. |
||
Expression for A-B. |
||
Expression for A*B. |
||
Expression for A/B. |
||
Expression for A/B remainder. |
||
Expression for A string equals B. |
||
Expression for A string not-equals B. |
||
Expression for string A matches literal regex B with flags. |
||
Expression for string A not-matches literal regex B with flags. |
||
Expression for binary not A. |
||
Expression for logical not A. |
||
Expression for a rasqal_literal. |
||
Expression for a function A with arguments (B...). |
||
Expression for SPARQL ISBOUND(A). |
||
Expression for SPARQL STR(A). |
||
Expression for SPARQL LANG(A). |
||
Expression for SPARQL DATATYPE(A). |
||
Expression for SPARQL ISURI(A). |
||
Expression for SPARQL ISBLANK(A). |
||
Expression for SPARQL ISLITERAL(A). |
||
Expression for cast literal A to type B. |
||
Expression for SPARQL order condition ascending. |
||
Expression for SPARQL order condition descending. |
||
Expression for SPARQL LANGMATCHES(A, B). |
||
Expression for string A matches expression regex B with flags. |
||
Obsolete - not used |
||
Obsolete - not used |
||
Expression for LAQRS select |
||
Expression for LAQRS select Variable * |
||
Expression for SPARQL sameTerm |
||
Expression for LAQRS select |
||
Expression for LAQRS select |
||
Expression for LAQRS select |
||
Expression for LAQRS select |
||
Expression for LAQRS COALESCE(Expr+) |
||
Expression for LAQRS IF(expr, expr, expr) |
||
Expression for LAQRS URI(expr) |
||
Expression for LAQRS IRI(expr) |
||
Expression for LAQRS STRLANG(expr, expr) |
||
Expression for LAQRS STRDT(expr, expr) |
||
Expression for LAQRS |
||
Expression for LAQRS GROUP_CONCAT(arglist) aggregate function |
||
Expression for LAQRS SAMPLE(expr) aggregate function |
||
Expression for LAQRS expr IN ( list of expr ) |
||
Expression for LAQRS expr NOT IN ( list of expr ) |
||
Expression for SPARQL 1.1 isNUMERIC(expr) |
||
Expression for SPARQL 1.1 YEAR(datetime) |
||
Expression for SPARQL 1.1 MONTH(datetime) |
||
Expression for SPARQL 1.1 DAY(datetime) |
||
Expression for SPARQL 1.1 HOURS(datetime) |
||
Expression for SPARQL 1.1 MINUTES(datetime) |
||
Expression for SPARQL 1.1 SECONDS(datetime) |
||
Expression for SPARQL 1.1 TIMEZONE(datetime) |
||
Expression for LAQRS CURRENT_DATETIME( void ) |
||
Expression for LAQRS NOW( void ) |
||
Expression for LAQRS FROM_UNIXTIME(int) |
||
Expression for LAQRS TO_UNIXTIME(datetime) |
||
Expression for SPARQL 1.1 CONCAT(strings) |
||
Expression for SPARQL 1.1 STRLEN(str) |
||
Expression for SPARQL 1.1 SUBSTR(str, start[,offset]) |
||
Expression for SPARQL 1.1 UCASE(str) |
||
Expression for SPARQL 1.1 LCASE(str) |
||
Expression for SPARQL 1.1 STRSTARTS(str, str) |
||
Expression for SPARQL 1.1 STRENDS(str, str) |
||
Expression for SPARQL 1.1 CONTAINS(str, str) |
||
Expression for SPARQL 1.1 ENCODE_FOR_URI(str) |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Expression for SPARQL 1.1 |
||
Internal |
Flags for rasqal_expression_evaluate()
, rasqal_literal_compare()
or
rasqal_literal_as_string_flags()