/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal.h - Rasqal RDF Query library interfaces and definition * * Copyright (C) 2003-2010, David Beckett http://www.dajobe.org/ * Copyright (C) 2003-2005, University of Bristol, UK http://www.bristol.ac.uk/ * * This package is Free Software and part of Redland http://librdf.org/ * * It is licensed under the following three licenses as alternatives: * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version * 3. Apache License, V2.0 or any newer version * * You may not use this file except in compliance with at least one of * the above three licenses. * * See LICENSE.html or LICENSE.txt at the top of this package for the * complete terms and further detail along with the license texts for * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. *
*/
#ifndef RASQAL_H #define RASQAL_H
#ifdef __cplusplus extern"C" { #endif
/** * RASQAL_VERSION: * * Rasqal library version number * * Format: major * 10000 + minor * 100 + release
*/ #define RASQAL_VERSION 933
/** * rasqal_prefix: * @world: rasqal_world object * @prefix: short prefix string * @uri: URI associated with the prefix. * @declared: Internal flag. * @depth: Internal flag. * * Namespace (prefix, uri) pair. * * Includes internal flags used for marking when prefixes are * declared and at what XML element depth when used in XML formats.
*/ typedefstruct {
rasqal_world* world; constunsignedchar *prefix;
raptor_uri* uri; int declared; int depth;
} rasqal_prefix;
/** * rasqal_variable_type: * @RASQAL_VARIABLE_TYPE_NORMAL: The regular variable type. * @RASQAL_VARIABLE_TYPE_ANONYMOUS: Anonymous variable type. * @RASQAL_VARIABLE_TYPE_UNKNOWN: Internal. * * Rasqal variable types. * * ANONYMOUS can be used in queries but cannot be returned in a * result.
*/ typedefenum {
RASQAL_VARIABLE_TYPE_UNKNOWN = 0,
RASQAL_VARIABLE_TYPE_NORMAL = 1,
RASQAL_VARIABLE_TYPE_ANONYMOUS = 2
} rasqal_variable_type;
/** * rasqal_variable: * @vars_table: variables table that owns this variable * @name: Variable name. * @value: Variable value or NULL if unbound. * @offset: Internal. * @type: Variable type. * @expression: Expression when the variable is a computed SELECT expression * @user_data: Pointer to user data associated with a variable. This is not used by rasqal. * @usage: reference count * * Binding between a variable name and a value. * * Includes internal field @offset for recording the offset into the * (internal) rasqal_query variables array.
*/ typedefstruct {
rasqal_variables_table* vars_table; constunsignedchar *name;
rasqal_literal* value; int offset;
rasqal_variable_type type; struct rasqal_expression_s* expression; void *user_data; int usage;
} rasqal_variable;
/** * rasqal_data_graph_flags: * @RASQAL_DATA_GRAPH_NONE: Internal. * @RASQAL_DATA_GRAPH_NAMED: Graphs with a source and name. * @RASQAL_DATA_GRAPH_BACKGROUND: Graphs with a source only. * * Flags for the type of #rasqal_data_graph. * * These are used by rasqal_new_data_graph_from_uri() and * rasqal_new_data_graph_from_iostream(). See #rasqal_data_graph.
*/ typedefenum {
RASQAL_DATA_GRAPH_NONE = 0,
RASQAL_DATA_GRAPH_NAMED = 1,
RASQAL_DATA_GRAPH_BACKGROUND = 2
} rasqal_data_graph_flags;
/** * rasqal_data_graph: * @world: rasqal_world object * @uri: source URI * @name_uri: name of graph for %RASQAL_DATA_GRAPH_NAMED * @flags: %RASQAL_DATA_GRAPH_NAMED or %RASQAL_DATA_GRAPH_BACKGROUND * @format_type: MIME Type of data format at @uri (or NULL) * @format_name: Raptor parser Name of data format at @uri (or NULL) * @format_uri: URI of data format at @uri (or NULL) * @iostr: Raptor iostream for content, overriding @uri if present (or NULL) * @base_uri: base URI for reading from iostream * @usage: usage count of this object * * A source of RDF data for querying. * * If @iostr is present, the graph can be constructed by parsing the * iostream and using @base_uri as a base uri. Otherwise the graph * can be constructed from the graph at URI @uri. * * In either case the @name_uri is the graph name as long as @flags * is %RASQAL_DATA_GRAPH_NAMED
*/ typedefstruct {
rasqal_world* world;
raptor_uri* uri;
raptor_uri* name_uri; unsignedint flags; char* format_type; char* format_name;
raptor_uri* format_uri;
raptor_iostream* iostr;
raptor_uri* base_uri; int usage;
} rasqal_data_graph;
/** * rasqal_literal_type: * @RASQAL_LITERAL_BLANK: RDF blank node literal (SPARQL r:bNode) * @RASQAL_LITERAL_URI: RDF URI Literal (SPARQL r:URI) * @RASQAL_LITERAL_STRING: RDF Plain Literal - no datatype (SPARQL r:Literal) * @RASQAL_LITERAL_XSD_STRING: String xsd:string * @RASQAL_LITERAL_BOOLEAN: Boolean literal xsd:boolean. * @RASQAL_LITERAL_INTEGER: Integer literal xsd:integer. * @RASQAL_LITERAL_DOUBLE: Double floating point literal xsd:double. * @RASQAL_LITERAL_FLOAT: Floating point literal xsd:float. * @RASQAL_LITERAL_DECIMAL: Decimal integer xsd:decimal. * @RASQAL_LITERAL_DATETIME: Date/Time literal xsd:dateTime. * @RASQAL_LITERAL_UDT: User defined typed literal with unknown datatype URI * @RASQAL_LITERAL_PATTERN: Pattern literal for a regex. * @RASQAL_LITERAL_QNAME: XML Qname literal. * @RASQAL_LITERAL_VARIABLE: Variable literal. * @RASQAL_LITERAL_DATE: Date literal xsd:date. * @RASQAL_LITERAL_INTEGER_SUBTYPE: Internal. * @RASQAL_LITERAL_UNKNOWN: Internal. * @RASQAL_LITERAL_FIRST_XSD: Internal. * @RASQAL_LITERAL_LAST_XSD: Internal. * @RASQAL_LITERAL_LAST: Internal. * * Types of literal. * * The order in the enumeration is significant as it encodes * the SPARQL term ordering conditions: * * Blank Nodes << IRIs << RDF literals << typed literals * * which coresponds to in enum values * * BLANK << URI << STRING << * (BOOLEAN | INTEGER | DOUBLE | FLOAT | DECIMAL | DATETIME | XSD_STRING) * * (RASQAL_LITERAL_FIRST_XSD ... RASQAL_LITERAL_LAST_XSD) * * Not used (internal): PATTERN, QNAME, VARIABLE * * See rasqal_literal_compare() when used with flags * %RASQAL_COMPARE_XQUERY
*/ typedefenum { /* internal */
RASQAL_LITERAL_UNKNOWN,
RASQAL_LITERAL_BLANK,
RASQAL_LITERAL_URI,
RASQAL_LITERAL_STRING,
RASQAL_LITERAL_XSD_STRING,
RASQAL_LITERAL_BOOLEAN,
RASQAL_LITERAL_INTEGER,
RASQAL_LITERAL_FLOAT,
RASQAL_LITERAL_DOUBLE,
RASQAL_LITERAL_DECIMAL,
RASQAL_LITERAL_DATETIME, /* internal */
RASQAL_LITERAL_FIRST_XSD = RASQAL_LITERAL_XSD_STRING, /* internal */
RASQAL_LITERAL_LAST_XSD = RASQAL_LITERAL_DATETIME,
RASQAL_LITERAL_UDT,
RASQAL_LITERAL_PATTERN,
RASQAL_LITERAL_QNAME,
RASQAL_LITERAL_VARIABLE, /* internal */
RASQAL_LITERAL_INTEGER_SUBTYPE,
RASQAL_LITERAL_DATE, /* internal */
RASQAL_LITERAL_LAST = RASQAL_LITERAL_DATE
} rasqal_literal_type;
/** * RASQAL_XSD_DATETIME_NO_TZ: * * Sentinel XSD Decimal timezone value indicating no timezone is present.
*/ #define RASQAL_XSD_DATETIME_NO_TZ (9999)
/** * rasqal_xsd_date: * @year: year * @month: month 1-12 * @day: 1-31 * @timezone_minutes: minutes +/- against UTC or RASQAL_XSD_DATETIME_NO_TZ if there is no timezone in the dateTime. * @time_on_timeline: time on timeline of first instant of date in timezone * @have_tz: timezone flag: 'Z' if Zulu, 'Y' if has other timezone offset in @timezone_minutes, 'N' if there is no timezone * * XML schema date datatype (xsd:date) * * Examples of timezone fields: * "2010-01-02" : timezone_minutes RASQAL_XSD_DATETIME_NO_TZ, have_tz 'N' * "2010-01-02Z" : timezone_minutes 0, have_tz 'Z' * "2010-01-02+00:00" : timezone_minutes 0, have_tz 'Y' * "2010-01-02-01:00" : timezone_minutes -60, have_tz 'Y'
*/ typedefstruct { signedint year; /* the following fields are integer values not characters */ unsignedchar month; unsignedchar day; signedshort timezone_minutes;
time_t time_on_timeline; char have_tz;
} rasqal_xsd_date;
/** * rasqal_xsd_datetime: * @year: year * @month: month 1-12 * @day: 1-31 * @hour: hour 0-23 * @minute: minute 0-59 * @second: second 0-60 (yes 60 is allowed for leap seconds) * @microseconds: microseconds * @timezone_minutes: minutes +/- against UTC or RASQAL_XSD_DATETIME_NO_TZ if there is no timezone in the dateTime. * @time_on_timeline: time on timeline * @have_tz: timezone flag: 'Z' if Zulu, 'Y' if has other timezone offset in @timezone_minutes, 'N' if there is no timezone * * XML Schema dateTime datatype (xsd:dateTime) * * Signed types are required for normalization process where a value * can be negative temporarily. * * Examples of timezone fields: * "2010-01-02T01:02:03" : timezone_minutes RASQAL_XSD_DATETIME_NO_TZ, have_tz 'N' * "2010-01-02T01:02:03Z" : timezone_minutes 0, have_tz 'Z' * "2010-01-02T01:02:03+00:00" : timezone_minutes 0, have_tz 'Y' * "2010-01-02T01:02:03-01:00" : timezone_minutes -60, have_tz 'Y'
*/ typedefstruct { signedint year; unsignedchar month; unsignedchar day; /* the following fields are integer values not characters */ signedchar hour; signedchar minute; signedchar second; signedint microseconds; signedshort timezone_minutes;
time_t time_on_timeline; char have_tz;
} rasqal_xsd_datetime;
/** * rasqal_literal: * @world: world object pointer * @usage: Usage count. * @type: Type of literal. * @string: String form of literal for literal types UTF-8 string, pattern, qname, blank, double, float, decimal, datetime. * @string_len: Length of @string. * @value: Alternate value content. * @language: Language for string literal type. * @datatype: Datatype for string literal type. * @flags: Flags for literal types * @parent_type: parent XSD type if any or RASQAL_LITERAL_UNKNOWN * @valid: >0 if literal format is a valid lexical form for this datatype. 0 if not valid. <0 if this has not been checked yet * * Rasqal literal class. *
*/ struct rasqal_literal_s {
rasqal_world *world;
union { /* integer and boolean types */ int integer; /* double and float */ double floating; /* uri (can be temporarily NULL if a qname, see flags below) */
raptor_uri* uri; /* variable */
rasqal_variable* variable; /* decimal */
rasqal_xsd_decimal* decimal; /* datetime */
rasqal_xsd_datetime* datetime; /* date */
rasqal_xsd_date* date;
} value;
/* for string */ char *language;
raptor_uri *datatype;
/* various flags for literal types: * pattern regex flags * string datatype of qname * uri qname of URI not yet expanded (temporary)
*/ constunsignedchar *flags;
rasqal_literal_type parent_type;
int valid;
};
/** * rasqal_op: * @RASQAL_EXPR_AND: Expression for AND(A, B) * @RASQAL_EXPR_OR: Expression for OR(A, B) * @RASQAL_EXPR_EQ: Expression for A equals B * @RASQAL_EXPR_NEQ: Expression for A not equals B. * @RASQAL_EXPR_LT: Expression for A less than B. * @RASQAL_EXPR_GT: Expression for A greather than B. * @RASQAL_EXPR_LE: Expression for A less than or equal to B. * @RASQAL_EXPR_GE: Expression for A greater than or equal to B. * @RASQAL_EXPR_UMINUS: Expression for -A. * @RASQAL_EXPR_PLUS: Expression for +A. * @RASQAL_EXPR_MINUS: Expression for A-B. * @RASQAL_EXPR_STAR: Expression for A*B. * @RASQAL_EXPR_SLASH: Expression for A/B. * @RASQAL_EXPR_REM: Expression for A/B remainder. * @RASQAL_EXPR_STR_EQ: Expression for A string equals B. * @RASQAL_EXPR_STR_NEQ: Expression for A string not-equals B. * @RASQAL_EXPR_STR_MATCH: Expression for string A matches literal regex B with flags. * @RASQAL_EXPR_STR_NMATCH: Expression for string A not-matches literal regex B with flags. * @RASQAL_EXPR_REGEX: Expression for string A matches expression regex B with flags. * @RASQAL_EXPR_TILDE: Expression for binary not A. * @RASQAL_EXPR_BANG: Expression for logical not A. * @RASQAL_EXPR_LITERAL: Expression for a #rasqal_literal. * @RASQAL_EXPR_FUNCTION: Expression for a function A with arguments (B...). * @RASQAL_EXPR_BOUND: Expression for SPARQL ISBOUND(A). * @RASQAL_EXPR_STR: Expression for SPARQL STR(A). * @RASQAL_EXPR_LANG: Expression for SPARQL LANG(A). * @RASQAL_EXPR_LANGMATCHES: Expression for SPARQL LANGMATCHES(A, B). * @RASQAL_EXPR_DATATYPE: Expression for SPARQL DATATYPE(A). * @RASQAL_EXPR_ISURI: Expression for SPARQL ISURI(A). * @RASQAL_EXPR_ISBLANK: Expression for SPARQL ISBLANK(A). * @RASQAL_EXPR_ISLITERAL: Expression for SPARQL ISLITERAL(A). * @RASQAL_EXPR_CAST: Expression for cast literal A to type B. * @RASQAL_EXPR_ORDER_COND_ASC: Expression for SPARQL order condition ascending. * @RASQAL_EXPR_ORDER_COND_DESC: Expression for SPARQL order condition descending. * @RASQAL_EXPR_GROUP_COND_ASC: Obsolete - not used * @RASQAL_EXPR_GROUP_COND_DESC: Obsolete - not used * @RASQAL_EXPR_COUNT: Expression for LAQRS select COUNT() aggregate function * @RASQAL_EXPR_VARSTAR: Expression for LAQRS select Variable * * @RASQAL_EXPR_SAMETERM: Expression for SPARQL sameTerm * @RASQAL_EXPR_SUM: Expression for LAQRS select SUM() aggregate function * @RASQAL_EXPR_AVG: Expression for LAQRS select AVG() aggregate function * @RASQAL_EXPR_MIN: Expression for LAQRS select MIN() aggregate function * @RASQAL_EXPR_MAX: Expression for LAQRS select MAX() aggregate function * @RASQAL_EXPR_COALESCE: Expression for LAQRS COALESCE(Expr+) * @RASQAL_EXPR_IF: Expression for LAQRS IF(expr, expr, expr) * @RASQAL_EXPR_URI: Expression for LAQRS URI(expr) * @RASQAL_EXPR_IRI: Expression for LAQRS IRI(expr) * @RASQAL_EXPR_STRLANG: Expression for LAQRS STRLANG(expr, expr) * @RASQAL_EXPR_STRDT: Expression for LAQRS STRDT(expr, expr) * @RASQAL_EXPR_BNODE: Expression for LAQRS BNODE() and BNODE(expr) * @RASQAL_EXPR_GROUP_CONCAT: Expression for LAQRS GROUP_CONCAT(arglist) aggregate function * @RASQAL_EXPR_SAMPLE: Expression for LAQRS SAMPLE(expr) aggregate function * @RASQAL_EXPR_IN: Expression for LAQRS expr IN ( list of expr ) * @RASQAL_EXPR_NOT_IN: Expression for LAQRS expr NOT IN ( list of expr ) * @RASQAL_EXPR_ISNUMERIC: Expression for SPARQL 1.1 isNUMERIC(expr) * @RASQAL_EXPR_YEAR: Expression for SPARQL 1.1 YEAR(datetime) * @RASQAL_EXPR_MONTH: Expression for SPARQL 1.1 MONTH(datetime) * @RASQAL_EXPR_DAY: Expression for SPARQL 1.1 DAY(datetime) * @RASQAL_EXPR_HOURS: Expression for SPARQL 1.1 HOURS(datetime) * @RASQAL_EXPR_MINUTES: Expression for SPARQL 1.1 MINUTES(datetime) * @RASQAL_EXPR_SECONDS: Expression for SPARQL 1.1 SECONDS(datetime) * @RASQAL_EXPR_TIMEZONE: Expression for SPARQL 1.1 TIMEZONE(datetime) * @RASQAL_EXPR_CURRENT_DATETIME: Expression for LAQRS CURRENT_DATETIME( void ) * @RASQAL_EXPR_NOW: Expression for LAQRS NOW( void ) * @RASQAL_EXPR_FROM_UNIXTIME: Expression for LAQRS FROM_UNIXTIME(int) * @RASQAL_EXPR_TO_UNIXTIME: Expression for LAQRS TO_UNIXTIME(datetime) * @RASQAL_EXPR_CONCAT: Expression for SPARQL 1.1 CONCAT(strings) * @RASQAL_EXPR_STRLEN: Expression for SPARQL 1.1 STRLEN(str) * @RASQAL_EXPR_SUBSTR: Expression for SPARQL 1.1 SUBSTR(str, start[,offset]) * @RASQAL_EXPR_UCASE: Expression for SPARQL 1.1 UCASE(str) * @RASQAL_EXPR_LCASE: Expression for SPARQL 1.1 LCASE(str) * @RASQAL_EXPR_STRSTARTS: Expression for SPARQL 1.1 STRSTARTS(str, str) * @RASQAL_EXPR_STRENDS: Expression for SPARQL 1.1 STRENDS(str, str) * @RASQAL_EXPR_CONTAINS: Expression for SPARQL 1.1 CONTAINS(str, str) * @RASQAL_EXPR_ENCODE_FOR_URI: Expression for SPARQL 1.1 ENCODE_FOR_URI(str) * @RASQAL_EXPR_TZ: Expression for SPARQL 1.1 TZ() * @RASQAL_EXPR_RAND: Expression for SPARQL 1.1 RAND() * @RASQAL_EXPR_ABS: Expression for SPARQL 1.1 ABS() * @RASQAL_EXPR_ROUND: Expression for SPARQL 1.1 ROUND() * @RASQAL_EXPR_CEIL: Expression for SPARQL 1.1 CEIL() * @RASQAL_EXPR_FLOOR: Expression for SPARQL 1.1 FLOOR() * @RASQAL_EXPR_MD5: Expression for SPARQL 1.1 MD5() * @RASQAL_EXPR_SHA1: Expression for SPARQL 1.1 SHA1() * @RASQAL_EXPR_SHA224: Expression for SPARQL 1.1 SHA224() * @RASQAL_EXPR_SHA256: Expression for SPARQL 1.1 SHA256() * @RASQAL_EXPR_SHA384: Expression for SPARQL 1.1 SHA384() * @RASQAL_EXPR_SHA512: Expression for SPARQL 1.1 SHA512() * @RASQAL_EXPR_STRBEFORE: Expression for SPARQL 1.1 STRBEFORE() * @RASQAL_EXPR_STRAFTER: Expression for SPARQL 1.1 STRAFTER() * @RASQAL_EXPR_REPLACE: Expression for SPARQL 1.1 REPLACE() * @RASQAL_EXPR_UUID: Expression for SPARQL 1.1 UUID() * @RASQAL_EXPR_STRUUID: Expression for SPARQL 1.1 STRUUID() * @RASQAL_EXPR_UNKNOWN: Internal * @RASQAL_EXPR_LAST: Internal * * 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.
*/ typedefenum { /* internal */
RASQAL_EXPR_UNKNOWN,
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_UMINUS,
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_STR_MATCH,
RASQAL_EXPR_STR_NMATCH,
RASQAL_EXPR_TILDE,
RASQAL_EXPR_BANG,
RASQAL_EXPR_LITERAL,
RASQAL_EXPR_FUNCTION,
RASQAL_EXPR_BOUND,
RASQAL_EXPR_STR,
RASQAL_EXPR_LANG,
RASQAL_EXPR_DATATYPE,
RASQAL_EXPR_ISURI,
RASQAL_EXPR_ISBLANK,
RASQAL_EXPR_ISLITERAL,
RASQAL_EXPR_CAST,
RASQAL_EXPR_ORDER_COND_ASC,
RASQAL_EXPR_ORDER_COND_DESC,
RASQAL_EXPR_LANGMATCHES,
RASQAL_EXPR_REGEX,
RASQAL_EXPR_GROUP_COND_ASC,
RASQAL_EXPR_GROUP_COND_DESC,
RASQAL_EXPR_COUNT,
RASQAL_EXPR_VARSTAR,
RASQAL_EXPR_SAMETERM,
RASQAL_EXPR_SUM,
RASQAL_EXPR_AVG,
RASQAL_EXPR_MIN,
RASQAL_EXPR_MAX,
RASQAL_EXPR_COALESCE,
RASQAL_EXPR_IF,
RASQAL_EXPR_URI,
RASQAL_EXPR_IRI,
RASQAL_EXPR_STRLANG,
RASQAL_EXPR_STRDT,
RASQAL_EXPR_BNODE,
RASQAL_EXPR_GROUP_CONCAT,
RASQAL_EXPR_SAMPLE,
RASQAL_EXPR_IN,
RASQAL_EXPR_NOT_IN,
RASQAL_EXPR_ISNUMERIC,
RASQAL_EXPR_YEAR,
RASQAL_EXPR_MONTH,
RASQAL_EXPR_DAY,
RASQAL_EXPR_HOURS,
RASQAL_EXPR_MINUTES,
RASQAL_EXPR_SECONDS,
RASQAL_EXPR_TIMEZONE,
RASQAL_EXPR_CURRENT_DATETIME,
RASQAL_EXPR_NOW,
RASQAL_EXPR_FROM_UNIXTIME,
RASQAL_EXPR_TO_UNIXTIME,
RASQAL_EXPR_CONCAT,
RASQAL_EXPR_STRLEN,
RASQAL_EXPR_SUBSTR,
RASQAL_EXPR_UCASE,
RASQAL_EXPR_LCASE,
RASQAL_EXPR_STRSTARTS,
RASQAL_EXPR_STRENDS,
RASQAL_EXPR_CONTAINS,
RASQAL_EXPR_ENCODE_FOR_URI,
RASQAL_EXPR_TZ,
RASQAL_EXPR_RAND,
RASQAL_EXPR_ABS,
RASQAL_EXPR_ROUND,
RASQAL_EXPR_CEIL,
RASQAL_EXPR_FLOOR,
RASQAL_EXPR_MD5,
RASQAL_EXPR_SHA1,
RASQAL_EXPR_SHA224,
RASQAL_EXPR_SHA256,
RASQAL_EXPR_SHA384,
RASQAL_EXPR_SHA512,
RASQAL_EXPR_STRBEFORE,
RASQAL_EXPR_STRAFTER,
RASQAL_EXPR_REPLACE,
RASQAL_EXPR_UUID,
RASQAL_EXPR_STRUUID, /* internal */
RASQAL_EXPR_LAST = RASQAL_EXPR_STRUUID
} rasqal_op;
/** * rasqal_triple: * @subject: Triple subject. * @predicate: Triple predicate. * @object: Triple object. * @origin: Triple origin. * @flags: Or of enum #rasqal_triple_flags bits. * * A triple pattern or RDF triple. * * This is used as a triple pattern in queries and * an RDF triple when generating RDF triples such as with SPARQL CONSTRUCT.
*/ typedefstruct {
rasqal_literal* subject;
rasqal_literal* predicate;
rasqal_literal* object;
rasqal_literal* origin; unsignedint flags;
} rasqal_triple;
/** * rasqal_pattern_flags: * @RASQAL_PATTERN_FLAGS_OPTIONAL: True when the graph pattern is an optional match. * @RASQAL_PATTERN_FLAGS_LAST: Internal * * Flags for #rasqal_graph_pattern.
*/ typedefenum {
RASQAL_PATTERN_FLAGS_OPTIONAL = 1,
/** * rasqal_generate_bnodeid_handler: * @world: world arg * @user_data: user data given to * @user_bnodeid: user blank node ID string passed in * * User handler used with rasqal_world_set_generate_bnodeid_handler() to set method for generating a blank node ID. * * Return value: blank node ID string or NULL on failure.
*/ typedefunsignedchar* (*rasqal_generate_bnodeid_handler)(rasqal_world* world, void *user_data, unsignedchar *user_bnodeid);
/** * rasqal_update_flags: * @RASQAL_UPDATE_FLAGS_SILENT: the update operation should be silent * @RASQAL_UPDATE_FLAGS_DATA: the update operation is triple data not templates * * Bitflags for graph update operations
*/ typedefenum {
RASQAL_UPDATE_FLAGS_SILENT = 1,
RASQAL_UPDATE_FLAGS_DATA = 2
} rasqal_update_flags;
/** * rasqal_update_graph_applies: * @RASQAL_UPDATE_GRAPH_ONE: the update operation applies to 1 graph * @RASQAL_UPDATE_GRAPH_DEFAULT: the update operation applies to the default graph * @RASQAL_UPDATE_GRAPH_NAMED: the update operation applies to all named graphs * @RASQAL_UPDATE_GRAPH_ALL: the update operation applies ALL graphs * * The graph(s) that the update operation applies to.
*/ typedefenum {
RASQAL_UPDATE_GRAPH_ONE = 0,
RASQAL_UPDATE_GRAPH_DEFAULT = 1,
RASQAL_UPDATE_GRAPH_NAMED = 2,
RASQAL_UPDATE_GRAPH_ALL = 3
} rasqal_update_graph_applies;
/** * rasqal_update_operation: * @type: type of update * @graph_uri: optional graph URI (clear, drop, load, with ... delete, insert); source graph (add, move, copy) * @document_uri: optional document URI (load); destination graph (add, move, copy) * @insert_templates: optional sequence of #rasqal_triple to insert. Data triples if @flags is #RASQAL_UPDATE_FLAGS_DATA set, templates otherwise. * @delete_templates: optional sequence of #rasqal_triple templates to delete * @where: optional where template (insert/delete) * @flags: update flags - bit-or of flags defined in #rasqal_update_flags * @applies: the graph(s) that the update operation applies to, or @graph_uri if #RASQAL_UPDATE_GRAPH_ONE * * Update operation - changing the dataset * * For LOAD and CLEAR if @applies is set (not 0) then the operation * applies to just those graph(), otherwise it applies to the @graph_uri. * * For ADD, MOVE and COPY the source graph is stored in @graph_uri * field and the destination graph in the @document_uri field. The * field names have no meaning in this case since both values are * always present, always graphs and a NULL value signifies the * default graph. *
*/ typedefstruct {
rasqal_update_type type;
/** * rasqal_graph_pattern_visit_fn: * @query: #rasqal_query containing the graph pattern * @gp: current graph_pattern * @user_data: user data passed in * * User function to visit a graph_pattern and operate on it with * rasqal_graph_pattern_visit() or rasqal_query_graph_pattern_visit() * * Return value: non-0 to truncate the visit
*/ typedefint (*rasqal_graph_pattern_visit_fn)(rasqal_query* query, rasqal_graph_pattern* gp, void *user_data);
/* Bindings result format */
RASQAL_API
rasqal_query_results_type rasqal_query_results_get_type(rasqal_query_results* query_results);
RASQAL_API constchar* rasqal_query_results_type_label(rasqal_query_results_type type);
RASQAL_API int rasqal_query_results_is_bindings(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_get_count(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_next(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_finished(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_get_bindings(rasqal_query_results *query_results, constunsignedchar ***names, rasqal_literal ***values);
RASQAL_API
rasqal_literal* rasqal_query_results_get_binding_value(rasqal_query_results *query_results, int offset);
RASQAL_API constunsignedchar* rasqal_query_results_get_binding_name(rasqal_query_results *query_results, int offset);
RASQAL_API
rasqal_literal* rasqal_query_results_get_binding_value_by_name(rasqal_query_results *query_results, constunsignedchar *name);
RASQAL_API int rasqal_query_results_get_bindings_count(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_add_row(rasqal_query_results* query_results, rasqal_row* row);
RASQAL_API
rasqal_row* rasqal_query_results_get_row_by_offset(rasqal_query_results* query_results, int result_offset);
/* Boolean result format */
RASQAL_API int rasqal_query_results_is_boolean(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_get_boolean(rasqal_query_results *query_results);
/* Graph result format */
RASQAL_API int rasqal_query_results_is_graph(rasqal_query_results *query_results);
RASQAL_API
raptor_statement* rasqal_query_results_get_triple(rasqal_query_results *query_results);
RASQAL_API int rasqal_query_results_next_triple(rasqal_query_results *query_results);
/* Syntax result format */
RASQAL_API int rasqal_query_results_is_syntax(rasqal_query_results* query_results);
/* One more time */
RASQAL_API int rasqal_query_results_rewind(rasqal_query_results* query_results);
/** * rasqal_query_results_format_flags: * @RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER: format can be read. * @RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER: format can be written. * * Bitflags for rasqal_query_results_formats_check() to find formats with features.
*/ typedefenum {
RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER = 1,
RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER = 2
} rasqal_query_results_format_flags;
/** * rasqal_evaluation_context: * @world: rasqal world * @base_uri: base URI of expression context (or NULL) * @locator: locator or NULL * @flags: expression comparison flags * @seed: random seeed * @random: random number generator object * * A context for evaluating an expression such as with * rasqal_expression_evaluate2()
*/ typedefstruct {
rasqal_world *world;
raptor_uri* base_uri;
raptor_locator *locator; int flags; unsignedint seed;
rasqal_random* random;
} rasqal_evaluation_context;
RASQAL_API void rasqal_free_expression(rasqal_expression* e);
RASQAL_API void rasqal_expression_print_op(rasqal_expression* e, FILE* fh);
RASQAL_API int rasqal_expression_print(rasqal_expression* e, FILE* fh);
RASQAL_API RASQAL_DEPRECATED
rasqal_literal* rasqal_expression_evaluate(rasqal_world *world, raptor_locator *locator, rasqal_expression* e, int flags);
RASQAL_API
rasqal_literal* rasqal_expression_evaluate2(rasqal_expression *e, rasqal_evaluation_context* eval_context, int *error_p);
RASQAL_API constchar* rasqal_expression_op_label(rasqal_op op);
RASQAL_API int rasqal_expression_compare(rasqal_expression* e1, rasqal_expression* e2, int flags, int* error_p);
/** * rasqal_expression_visit_fn: * @user_data: user data passed in with rasqal_expression_visit() * @e: current expression * * User function to visit an expression and operate on it with * rasqal_expression_visit() * * Return value: non-0 to truncate the visit
*/ typedefint (*rasqal_expression_visit_fn)(void *user_data, rasqal_expression *e);
RASQAL_API int rasqal_expression_visit(rasqal_expression* e, rasqal_expression_visit_fn fn, void*user_data);
RASQAL_API
rasqal_evaluation_context* rasqal_new_evaluation_context(rasqal_world* world, raptor_locator* locator, int flags);
RASQAL_API void rasqal_free_evaluation_context(rasqal_evaluation_context* eval_context);
RASQAL_API int rasqal_evaluation_context_set_base_uri(rasqal_evaluation_context* eval_context, raptor_uri *base_uri);
RASQAL_API int rasqal_evaluation_context_set_rand_seed(rasqal_evaluation_context* eval_context, unsignedint seed);
/** * rasqal_triple_parts: * @RASQAL_TRIPLE_NONE: no parts * @RASQAL_TRIPLE_SUBJECT: Subject present in a triple. * @RASQAL_TRIPLE_PREDICATE: Predicate present in a triple. * @RASQAL_TRIPLE_OBJECT: Object present in a triple. * @RASQAL_TRIPLE_ORIGIN: Origin/graph present in a triple. * @RASQAL_TRIPLE_GRAPH: Alias for RASQAL_TRIPLE_ORIGIN * @RASQAL_TRIPLE_SPO: Subject, Predicate and Object present in a triple. * @RASQAL_TRIPLE_SPOG: Subject, Predicate, Object, Graph present in a triple. * * Flags for parts of a triple.
*/ typedefenum {
--> --------------------
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.