rasqal.h   rasqal.h 
/* -*- Mode: c; c-basic-offset: 2 -*- /* -*- Mode: c; c-basic-offset: 2 -*-
* *
* rasqal.h - Rasqal RDF Query library interfaces and definition * rasqal.h - Rasqal RDF Query library interfaces and definition
* *
* Copyright (C) 2003-2008, David Beckett http://www.dajobe.org/ * Copyright (C) 2003-2009, David Beckett http://www.dajobe.org/
* Copyright (C) 2003-2005, University of Bristol, UK http://www.bristol.ac .uk/ * 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/ * This package is Free Software and part of Redland http://librdf.org/
* *
* It is licensed under the following three licenses as alternatives: * It is licensed under the following three licenses as alternatives:
* 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
* 2. GNU General Public License (GPL) V2 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version
* 3. Apache License, V2.0 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 * You may not use this file except in compliance with at least one of
skipping to change at line 32 skipping to change at line 32
*/ */
#ifndef RASQAL_H #ifndef RASQAL_H
#define RASQAL_H #define RASQAL_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* RASQAL_VERSION:
*
* Rasqal library version number
*
* Format: major * 10000 + minor * 100 + release
*/
#define RASQAL_VERSION 917
/**
* RASQAL_VERSION_STRING:
*
* Rasqal library version string
*/
#define RASQAL_VERSION_STRING "0.9.17"
/**
* RASQAL_VERSION_MAJOR:
*
* Rasqal library major version
*/
#define RASQAL_VERSION_MAJOR 0
/**
* RASQAL_VERSION_MINOR:
*
* Rasqal library minor version
*/
#define RASQAL_VERSION_MINOR 9
/**
* RASQAL_VERSION_RELEASE:
*
* Rasqal library release
*/
#define RASQAL_VERSION_RELEASE 17
/**
* RASQAL_API: * RASQAL_API:
* *
* Macro for wrapping API function call declarations. * Macro for wrapping API function call declarations.
* *
*/ */
#ifndef RASQAL_API #ifndef RASQAL_API
# ifdef WIN32 # ifdef WIN32
# ifdef __GNUC__ # ifdef __GNUC__
# undef _declspec # undef _declspec
# define _declspec(x) __declspec(x) # define _declspec(x) __declspec(x)
skipping to change at line 77 skipping to change at line 114
#else #else
#define RASQAL_DEPRECATED #define RASQAL_DEPRECATED
#endif #endif
#ifndef LIBRDF_OBJC_FRAMEWORK #ifndef LIBRDF_OBJC_FRAMEWORK
#include <raptor.h> #include <raptor.h>
#else #else
#include <Redland/raptor.h> #include <Redland/raptor.h>
#endif #endif
#ifndef RAPTOR_WORLD_DECLARED
#define RAPTOR_WORLD_DECLARED 1
/* Declare raptor_world type unless it is declared in raptor.h */
typedef struct raptor_world_s raptor_world;
#endif
/* Public statics */ /* Public statics */
RASQAL_API RASQAL_API
extern const char * const rasqal_short_copyright_string; extern const char * const rasqal_short_copyright_string;
RASQAL_API RASQAL_API
extern const char * const rasqal_copyright_string; extern const char * const rasqal_copyright_string;
RASQAL_API RASQAL_API
extern const char * const rasqal_version_string; extern const char * const rasqal_version_string;
RASQAL_API RASQAL_API
extern const unsigned int rasqal_version_major; extern const unsigned int rasqal_version_major;
RASQAL_API RASQAL_API
skipping to change at line 158 skipping to change at line 201
* *
* None currently defined. * None currently defined.
*/ */
typedef enum { typedef enum {
RASQAL_FEATURE_NO_NET, RASQAL_FEATURE_NO_NET,
RASQAL_FEATURE_LAST = RASQAL_FEATURE_NO_NET RASQAL_FEATURE_LAST = RASQAL_FEATURE_NO_NET
} rasqal_feature; } rasqal_feature;
/** /**
* rasqal_prefix: * rasqal_prefix:
* @world: rasqal_world object
* @prefix: short prefix string * @prefix: short prefix string
* @uri: URI associated with the prefix. * @uri: URI associated with the prefix.
* @declared: Internal flag. * @declared: Internal flag.
* @depth: Internal flag. * @depth: Internal flag.
* *
* Namespace (prefix, uri) pair. * Namespace (prefix, uri) pair.
* *
* Includes internal flags used for marking when prefixes are * Includes internal flags used for marking when prefixes are
* declared and at what XML element depth when used in XML formats. * declared and at what XML element depth when used in XML formats.
*/ */
typedef struct { typedef struct {
rasqal_world* world;
const unsigned char *prefix; const unsigned char *prefix;
raptor_uri* uri; raptor_uri* uri;
int declared; int declared;
int depth; int depth;
} rasqal_prefix; } rasqal_prefix;
/** /**
* rasqal_variable_type: * rasqal_variable_type:
* @RASQAL_VARIABLE_TYPE_NORMAL: The regular variable type. * @RASQAL_VARIABLE_TYPE_NORMAL: The regular variable type.
* @RASQAL_VARIABLE_TYPE_ANONYMOUS: Anonymous variable type. * @RASQAL_VARIABLE_TYPE_ANONYMOUS: Anonymous variable type.
skipping to change at line 194 skipping to change at line 239
* result. * result.
*/ */
typedef enum { typedef enum {
RASQAL_VARIABLE_TYPE_UNKNOWN = 0, RASQAL_VARIABLE_TYPE_UNKNOWN = 0,
RASQAL_VARIABLE_TYPE_NORMAL = 1, RASQAL_VARIABLE_TYPE_NORMAL = 1,
RASQAL_VARIABLE_TYPE_ANONYMOUS = 2 RASQAL_VARIABLE_TYPE_ANONYMOUS = 2
} rasqal_variable_type; } rasqal_variable_type;
/* forward reference */ /* forward reference */
struct rasqal_expression_s; struct rasqal_expression_s;
typedef struct rasqal_variables_table_s rasqal_variables_table;
/** /**
* rasqal_variable: * rasqal_variable:
* @vars_table: variables table that owns this variable
* @name: Variable name. * @name: Variable name.
* @value: Variable value or NULL if unbound. * @value: Variable value or NULL if unbound.
* @offset: Internal. * @offset: Internal.
* @type: Variable type. * @type: Variable type.
* @expression: Expression when the variable is a computed SELECT expressio n * @expression: Expression when the variable is a computed SELECT expressio n
* *
* Binding between a variable name and a value. * Binding between a variable name and a value.
* *
* Includes internal field @offset for recording the offset into the * Includes internal field @offset for recording the offset into the
* (internal) rasqal_query variables array. * (internal) rasqal_query variables array.
*/ */
typedef struct { typedef struct {
rasqal_variables_table* vars_table;
const unsigned char *name; const unsigned char *name;
rasqal_literal* value; rasqal_literal* value;
int offset; int offset;
rasqal_variable_type type; rasqal_variable_type type;
struct rasqal_expression_s* expression; struct rasqal_expression_s* expression;
} rasqal_variable; } rasqal_variable;
/** /**
* rasqal_data_graph_flags: * rasqal_data_graph_flags:
* @RASQAL_DATA_GRAPH_NONE: Internal. * @RASQAL_DATA_GRAPH_NONE: Internal.
skipping to change at line 234 skipping to change at line 282
* These are used by rasqal_query_add_data_graph(). See #rasqal_data_graph. * These are used by rasqal_query_add_data_graph(). See #rasqal_data_graph.
*/ */
typedef enum { typedef enum {
RASQAL_DATA_GRAPH_NONE = 0, RASQAL_DATA_GRAPH_NONE = 0,
RASQAL_DATA_GRAPH_NAMED = 1, RASQAL_DATA_GRAPH_NAMED = 1,
RASQAL_DATA_GRAPH_BACKGROUND = 2, RASQAL_DATA_GRAPH_BACKGROUND = 2,
} rasqal_data_graph_flags; } rasqal_data_graph_flags;
/** /**
* rasqal_data_graph: * rasqal_data_graph:
* @world: rasqal_world object
* @uri: source URI * @uri: source URI
* @name_uri: name of graph for %RASQAL_DATA_NAMED * @name_uri: name of graph for %RASQAL_DATA_NAMED
* @flags: %RASQAL_DATA_GRAPH_NAMED or %RASQAL_DATA_GRAPH_BACKGROUND * @flags: %RASQAL_DATA_GRAPH_NAMED or %RASQAL_DATA_GRAPH_BACKGROUND
* *
* A source of RDF data for querying. * A source of RDF data for querying.
* *
* The #uri is the original source (base URI) of the content. It may * The #uri is the original source (base URI) of the content. It may
* also have an additional name @name_uri as long as @flags is * also have an additional name @name_uri as long as @flags is
* %RASQAL_DATA_NAMED * %RASQAL_DATA_NAMED
*/ */
typedef struct { typedef struct {
rasqal_world* world;
raptor_uri* uri; raptor_uri* uri;
raptor_uri* name_uri; raptor_uri* name_uri;
int flags; int flags;
} rasqal_data_graph; } rasqal_data_graph;
/** /**
* rasqal_literal_type: * rasqal_literal_type:
* @RASQAL_LITERAL_BLANK: RDF blank node literal (SPARQL r:bNode) * @RASQAL_LITERAL_BLANK: RDF blank node literal (SPARQL r:bNode)
* @RASQAL_LITERAL_URI: RDF URI Literal (SPARQL r:URI) * @RASQAL_LITERAL_URI: RDF URI Literal (SPARQL r:URI)
* @RASQAL_LITERAL_STRING: RDF Literal / xsd:string (SPARQL r:Literal) * @RASQAL_LITERAL_STRING: RDF Plain Literal - no datatype (SPARQL r:Litera
l)
* @RASQAL_LITERAL_XSD_STRING: String xsd:string
* @RASQAL_LITERAL_BOOLEAN: Boolean literal xsd:boolean. * @RASQAL_LITERAL_BOOLEAN: Boolean literal xsd:boolean.
* @RASQAL_LITERAL_INTEGER: Integer literal xsd:integer. * @RASQAL_LITERAL_INTEGER: Integer literal xsd:integer.
* @RASQAL_LITERAL_DOUBLE: Double floating point literal xsd:double. * @RASQAL_LITERAL_DOUBLE: Double floating point literal xsd:double.
* @RASQAL_LITERAL_FLOAT: Floating point literal xsd:float. * @RASQAL_LITERAL_FLOAT: Floating point literal xsd:float.
* @RASQAL_LITERAL_DECIMAL: Decimal integer xsd:decimal. * @RASQAL_LITERAL_DECIMAL: Decimal integer xsd:decimal.
* @RASQAL_LITERAL_DATETIME: Date/Time literal xsd:dateTime. * @RASQAL_LITERAL_DATETIME: Date/Time literal xsd:dateTime.
* @RASQAL_LITERAL_UDT: User defined typed literal with unknown datatype UR I
* @RASQAL_LITERAL_PATTERN: Pattern literal for a regex. * @RASQAL_LITERAL_PATTERN: Pattern literal for a regex.
* @RASQAL_LITERAL_QNAME: XML Qname literal. * @RASQAL_LITERAL_QNAME: XML Qname literal.
* @RASQAL_LITERAL_VARIABLE: Variable literal. * @RASQAL_LITERAL_VARIABLE: Variable literal.
* @RASQAL_LITERAL_UNKNOWN: Internal. * @RASQAL_LITERAL_UNKNOWN: Internal.
* @RASQAL_LITERAL_FIRST_XSD: Internal. * @RASQAL_LITERAL_FIRST_XSD: Internal.
* @RASQAL_LITERAL_LAST_XSD: Internal. * @RASQAL_LITERAL_LAST_XSD: Internal.
* @RASQAL_LITERAL_LAST: Internal. * @RASQAL_LITERAL_LAST: Internal.
* *
* Types of literal. * Types of literal.
* *
* The order in the enumeration is significant as it encodes * The order in the enumeration is significant as it encodes
* the SPARQL term ordering conditions: * the SPARQL term ordering conditions:
* *
* Blank Nodes << IRIs << RDF literals << typed literals * Blank Nodes << IRIs << RDF literals << typed literals
* *
* which coresponds to in enum values * which coresponds to in enum values
* *
* BLANK << URI << STRING << * BLANK << URI << STRING <<
* (BOOLEAN | INTEGER | DOUBLE | FLOAT | DECIMAL | DATETIME) * (BOOLEAN | INTEGER | DOUBLE | FLOAT | DECIMAL | DATETIME | XSD_STRIN G)
* *
* (RASQAL_LITERAL_FIRST_XSD ... RASQAL_LITERAL_LAST_XSD) * (RASQAL_LITERAL_FIRST_XSD ... RASQAL_LITERAL_LAST_XSD)
* *
* Not used (internal): PATTERN, QNAME, VARIABLE * Not used (internal): PATTERN, QNAME, VARIABLE
* *
* See rasqal_literal_compare() when used with flags * See rasqal_literal_compare() when used with flags
* %RASQAL_COMPARE_XQUERY * %RASQAL_COMPARE_XQUERY
*/ */
typedef enum { typedef enum {
/* internal */ /* internal */
RASQAL_LITERAL_UNKNOWN, RASQAL_LITERAL_UNKNOWN,
RASQAL_LITERAL_BLANK, RASQAL_LITERAL_BLANK,
RASQAL_LITERAL_URI, RASQAL_LITERAL_URI,
RASQAL_LITERAL_STRING, RASQAL_LITERAL_STRING,
RASQAL_LITERAL_XSD_STRING,
RASQAL_LITERAL_BOOLEAN, RASQAL_LITERAL_BOOLEAN,
RASQAL_LITERAL_INTEGER, RASQAL_LITERAL_INTEGER,
RASQAL_LITERAL_DOUBLE,
RASQAL_LITERAL_FLOAT, RASQAL_LITERAL_FLOAT,
RASQAL_LITERAL_DOUBLE,
RASQAL_LITERAL_DECIMAL, RASQAL_LITERAL_DECIMAL,
RASQAL_LITERAL_DATETIME, RASQAL_LITERAL_DATETIME,
/* internal */ /* internal */
RASQAL_LITERAL_FIRST_XSD = RASQAL_LITERAL_STRING, RASQAL_LITERAL_FIRST_XSD = RASQAL_LITERAL_XSD_STRING,
/* internal */ /* internal */
RASQAL_LITERAL_LAST_XSD = RASQAL_LITERAL_DATETIME, RASQAL_LITERAL_LAST_XSD = RASQAL_LITERAL_DATETIME,
RASQAL_LITERAL_UDT,
RASQAL_LITERAL_PATTERN, RASQAL_LITERAL_PATTERN,
RASQAL_LITERAL_QNAME, RASQAL_LITERAL_QNAME,
RASQAL_LITERAL_VARIABLE, RASQAL_LITERAL_VARIABLE,
/* internal */ /* internal */
RASQAL_LITERAL_LAST= RASQAL_LITERAL_VARIABLE RASQAL_LITERAL_LAST= RASQAL_LITERAL_VARIABLE
} rasqal_literal_type; } rasqal_literal_type;
#define RASQAL_LITERAL_UDT_DEFINED 1
/** /**
* rasqal_xsd_decimal: * rasqal_xsd_decimal:
* *
* Rasqal XSD Decimal class. * Rasqal XSD Decimal class.
*/ */
typedef struct rasqal_xsd_decimal_s rasqal_xsd_decimal; typedef struct rasqal_xsd_decimal_s rasqal_xsd_decimal;
/** /**
* rasqal_literal: * rasqal_literal:
* @world: world object pointer
* @usage: Usage count. * @usage: Usage count.
* @type: Type of literal. * @type: Type of literal.
* @string: String form of literal for literal types UTF-8 string, pattern, qname, blank, double, float, decimal, datetime. * @string: String form of literal for literal types UTF-8 string, pattern, qname, blank, double, float, decimal, datetime.
* @string_len: Length of @string. * @string_len: Length of @string.
* @value: Alternate value content. * @value: Alternate value content.
* @language: Language for string literal type. * @language: Language for string literal type.
* @datatype: Datatype for string literal type. * @datatype: Datatype for string literal type.
* @flags: Flags for literal types * @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. * Rasqal literal class.
* *
*/ */
struct rasqal_literal_s { struct rasqal_literal_s {
rasqal_world *world;
int usage; int usage;
rasqal_literal_type type; rasqal_literal_type type;
/* UTF-8 string, pattern, qname, blank, double, float, decimal, datetime */ /* UTF-8 string, pattern, qname, blank, double, float, decimal, datetime */
const unsigned char *string; const unsigned char *string;
unsigned int string_len; unsigned int string_len;
union { union {
/* integer and boolean types */ /* integer and boolean types */
int integer; int integer;
/* double and float */ /* double and float */
double floating; double floating;
/* uri (can be temporarily NULL if a qname, see flags below) */ /* uri (can be temporarily NULL if a qname, see flags below) */
skipping to change at line 363 skipping to change at line 426
const char *language; const char *language;
raptor_uri *datatype; raptor_uri *datatype;
/* various flags for literal types: /* various flags for literal types:
* pattern regex flags * pattern regex flags
* string datatype of qname * string datatype of qname
* uri qname of URI not yet expanded (temporary) * uri qname of URI not yet expanded (temporary)
*/ */
const unsigned char *flags; const unsigned char *flags;
/* parent XSD type if any or RASQAL_LITERAL_UNKNOWN */
rasqal_literal_type parent_type; rasqal_literal_type parent_type;
/* world object */ int valid;
rasqal_world *world;
}; };
/** /**
* rasqal_op: * rasqal_op:
* @RASQAL_EXPR_AND: Expression for AND(A, B) * @RASQAL_EXPR_AND: Expression for AND(A, B)
* @RASQAL_EXPR_OR: Expression for OR(A, B) * @RASQAL_EXPR_OR: Expression for OR(A, B)
* @RASQAL_EXPR_EQ: Expression for A equals B * @RASQAL_EXPR_EQ: Expression for A equals B
* @RASQAL_EXPR_NEQ: Expression for A not equals B. * @RASQAL_EXPR_NEQ: Expression for A not equals B.
* @RASQAL_EXPR_LT: Expression for A less than B. * @RASQAL_EXPR_LT: Expression for A less than B.
* @RASQAL_EXPR_GT: Expression for A greather than B. * @RASQAL_EXPR_GT: Expression for A greather than B.
skipping to change at line 411 skipping to change at line 472
* @RASQAL_EXPR_ISBLANK: Expression for SPARQL ISBLANK(A). * @RASQAL_EXPR_ISBLANK: Expression for SPARQL ISBLANK(A).
* @RASQAL_EXPR_ISLITERAL: Expression for SPARQL ISLITERAL(A). * @RASQAL_EXPR_ISLITERAL: Expression for SPARQL ISLITERAL(A).
* @RASQAL_EXPR_CAST: Expression for cast literal A to type B. * @RASQAL_EXPR_CAST: Expression for cast literal A to type B.
* @RASQAL_EXPR_ORDER_COND_ASC: Expression for SPARQL order condition ascen ding. * @RASQAL_EXPR_ORDER_COND_ASC: Expression for SPARQL order condition ascen ding.
* @RASQAL_EXPR_ORDER_COND_DESC: Expression for SPARQL order condition desc ending. * @RASQAL_EXPR_ORDER_COND_DESC: Expression for SPARQL order condition desc ending.
* @RASQAL_EXPR_GROUP_COND_ASC: Expression for LAQRS group condition ascend ing. * @RASQAL_EXPR_GROUP_COND_ASC: Expression for LAQRS group condition ascend ing.
* @RASQAL_EXPR_GROUP_COND_DESC: Expression for LAQRS group condition desce nding. * @RASQAL_EXPR_GROUP_COND_DESC: Expression for LAQRS group condition desce nding.
* @RASQAL_EXPR_COUNT: Expression for LAQRS select COUNT() * @RASQAL_EXPR_COUNT: Expression for LAQRS select COUNT()
* @RASQAL_EXPR_VARSTAR: Expression for LAQRS select Variable * * @RASQAL_EXPR_VARSTAR: Expression for LAQRS select Variable *
* @RASQAL_EXPR_SAMETERM: Expression for SPARQL sameTerm * @RASQAL_EXPR_SAMETERM: Expression for SPARQL sameTerm
* @RASQAL_EXPR_SUM: Expression for LAQRS select SUM()
* @RASQAL_EXPR_AVG: Expression for LAQRS select AVG()
* @RASQAL_EXPR_MIN: Expression for LAQRS select MIN()
* @RASQAL_EXPR_MAX: Expression for LAQRS select MAX()
* @RASQAL_EXPR_COALESCE: Expression for LAQRS COALESCE(Expr+)
* @RASQAL_EXPR_UNKNOWN: Internal * @RASQAL_EXPR_UNKNOWN: Internal
* @RASQAL_EXPR_LAST: Internal * @RASQAL_EXPR_LAST: Internal
* *
* Rasqal expression operators. A mixture of unary, binary and * Rasqal expression operators. A mixture of unary, binary and
* tertiary operators (string matches). Also includes casting and * tertiary operators (string matches). Also includes casting and
* two ordering operators from ORDER BY in SPARQL. * two ordering operators from ORDER BY in SPARQL.
*/ */
typedef enum { typedef enum {
/* internal */ /* internal */
RASQAL_EXPR_UNKNOWN, RASQAL_EXPR_UNKNOWN,
skipping to change at line 460 skipping to change at line 526
RASQAL_EXPR_CAST, RASQAL_EXPR_CAST,
RASQAL_EXPR_ORDER_COND_ASC, RASQAL_EXPR_ORDER_COND_ASC,
RASQAL_EXPR_ORDER_COND_DESC, RASQAL_EXPR_ORDER_COND_DESC,
RASQAL_EXPR_LANGMATCHES, RASQAL_EXPR_LANGMATCHES,
RASQAL_EXPR_REGEX, RASQAL_EXPR_REGEX,
RASQAL_EXPR_GROUP_COND_ASC, RASQAL_EXPR_GROUP_COND_ASC,
RASQAL_EXPR_GROUP_COND_DESC, RASQAL_EXPR_GROUP_COND_DESC,
RASQAL_EXPR_COUNT, RASQAL_EXPR_COUNT,
RASQAL_EXPR_VARSTAR, RASQAL_EXPR_VARSTAR,
RASQAL_EXPR_SAMETERM, RASQAL_EXPR_SAMETERM,
RASQAL_EXPR_SUM,
RASQAL_EXPR_AVG,
RASQAL_EXPR_MIN,
RASQAL_EXPR_MAX,
RASQAL_EXPR_COALESCE,
/* internal */ /* internal */
RASQAL_EXPR_LAST= RASQAL_EXPR_SAMETERM RASQAL_EXPR_LAST= RASQAL_EXPR_COALESCE
} rasqal_op; } rasqal_op;
/** /**
* rasqal_expression: * rasqal_expression:
* @world: rasqal_world object
* @usage: reference count - 1 for itself
* @op: expression operation
* @arg1: first argument
* @arg2: second argument
* @arg3: third argument (for #EXPR_REGEX )
* @literal: literal argument
* @value: UTF-8 value
* @name: name for extension function qname(args...) and cast-to-uri
* @args; args for extension function qname(args...), cast-to-uri and COALE
SCE
*
* Expression with arguments
* *
* expression (arg1), unary op (arg1), binary op (arg1,arg2),
* literal or variable
*/ */
struct rasqal_expression_s { struct rasqal_expression_s {
int usage; /* reference count - 1 for itself */ rasqal_world* world;
int usage;
rasqal_op op; rasqal_op op;
struct rasqal_expression_s* arg1; struct rasqal_expression_s* arg1;
struct rasqal_expression_s* arg2; struct rasqal_expression_s* arg2;
struct rasqal_expression_s* arg3; /* optional 3rd arg for EXPR_REGEX */ struct rasqal_expression_s* arg3;
rasqal_literal* literal; rasqal_literal* literal;
unsigned char *value; /* UTF-8 value */ unsigned char *value;
/* for extension function qname(args...) and cast-to-uri */
raptor_uri* name; raptor_uri* name;
raptor_sequence* args; raptor_sequence* args;
}; };
typedef struct rasqal_expression_s rasqal_expression; typedef struct rasqal_expression_s rasqal_expression;
/** /**
* rasqal_triple_flags:
* @RASQAL_TRIPLE_FLAGS_EXACT: Not used.
* @RASQAL_TRIPLE_FLAGS_OPTIONAL: Not used.
* @RASQAL_TRIPLE_FLAGS_LAST: Internal.
*
* Flags for triple patterns.
*/
typedef enum {
/* Not used - was only used internally in the execution engine */
RASQAL_TRIPLE_FLAGS_EXACT=1,
/* Not used - this is now a property of a graph pattern */
RASQAL_TRIPLE_FLAGS_OPTIONAL=2,
RASQAL_TRIPLE_FLAGS_LAST=RASQAL_TRIPLE_FLAGS_OPTIONAL
} rasqal_triple_flags;
/**
* rasqal_triple: * rasqal_triple:
* @subject: Triple subject. * @subject: Triple subject.
* @predicate: Triple predicate. * @predicate: Triple predicate.
* @object: Triple object. * @object: Triple object.
* @origin: Triple origin. * @origin: Triple origin.
* @flags: Or of enum #rasqal_triple_flags bits. * @flags: Or of enum #rasqal_triple_flags bits.
* *
* A triple pattern or RDF triple. * A triple pattern or RDF triple.
* *
* This is used as a triple pattern in queries and * This is used as a triple pattern in queries and
skipping to change at line 576 skipping to change at line 640
RASQAL_QUERY_VERB_LAST=RASQAL_QUERY_VERB_INSERT RASQAL_QUERY_VERB_LAST=RASQAL_QUERY_VERB_INSERT
} rasqal_query_verb; } rasqal_query_verb;
/** /**
* rasqal_graph_pattern_operator: * rasqal_graph_pattern_operator:
* @RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: Just triple patterns and constrain ts. * @RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: Just triple patterns and constrain ts.
* @RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: Set of graph patterns (ANDed) a nd constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: Set of graph patterns (ANDed) a nd constraints.
* @RASQAL_GRAPH_PATTERN_OPERATOR_UNION: Set of graph patterns (UNIONed) an d constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_UNION: Set of graph patterns (UNIONed) an d constraints.
* @RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: Set of graph patterns (ANDed) and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: Set of graph patterns (ANDed) and constraints.
* @RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: A graph term + a graph pattern and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: A graph term + a graph pattern and constraints.
* @RASQAL_GRAPH_PATTERN_OPERATOR_FILTER: A filter graph pattern with an ex
pression
* @RASQAL_GRAPH_PATTERN_OPERATOR_LET: LET ?var := Expression (LAQRS)
* @RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: Internal. * @RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: Internal.
* @RASQAL_GRAPH_PATTERN_OPERATOR_LAST: Internal. * @RASQAL_GRAPH_PATTERN_OPERATOR_LAST: Internal.
* *
* Graph pattern operators * Graph pattern operators
*/ */
typedef enum { typedef enum {
RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN = 0, RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN = 0,
RASQAL_GRAPH_PATTERN_OPERATOR_BASIC = 1, RASQAL_GRAPH_PATTERN_OPERATOR_BASIC = 1,
RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL = 2, RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL = 2,
RASQAL_GRAPH_PATTERN_OPERATOR_UNION = 3, RASQAL_GRAPH_PATTERN_OPERATOR_UNION = 3,
RASQAL_GRAPH_PATTERN_OPERATOR_GROUP = 4, RASQAL_GRAPH_PATTERN_OPERATOR_GROUP = 4,
RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH = 5, RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH = 5,
RASQAL_GRAPH_PATTERN_OPERATOR_FILTER = 6,
RASQAL_GRAPH_PATTERN_OPERATOR_LET = 7,
RASQAL_GRAPH_PATTERN_OPERATOR_LAST=RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH RASQAL_GRAPH_PATTERN_OPERATOR_LAST = RASQAL_GRAPH_PATTERN_OPERATOR_LET
} rasqal_graph_pattern_operator; } rasqal_graph_pattern_operator;
/** /**
* rasqal_graph_pattern_visit_fn: * rasqal_graph_pattern_visit_fn:
* @query: #rasqal_query containing the graph pattern * @query: #rasqal_query containing the graph pattern
* @gp: current graph_pattern * @gp: current graph_pattern
* @user_data: user data passed in * @user_data: user data passed in
* *
* User function to visit an graph_pattern and operate on it with * User function to visit an graph_pattern and operate on it with
* rasqal_graph_pattern_visit() or rasqal_query_graph_pattern_visit() * rasqal_graph_pattern_visit() or rasqal_query_graph_pattern_visit()
skipping to change at line 612 skipping to change at line 680
*/ */
typedef int (*rasqal_graph_pattern_visit_fn)(rasqal_query* query, rasqal_gr aph_pattern* gp, void *user_data); typedef int (*rasqal_graph_pattern_visit_fn)(rasqal_query* query, rasqal_gr aph_pattern* gp, void *user_data);
/* RASQAL API */ /* RASQAL API */
/* Public functions */ /* Public functions */
RASQAL_API RASQAL_API
rasqal_world *rasqal_new_world(void); rasqal_world *rasqal_new_world(void);
RASQAL_API RASQAL_API
int rasqal_world_open(rasqal_world* world);
RASQAL_API
void rasqal_free_world(rasqal_world* world); void rasqal_free_world(rasqal_world* world);
RASQAL_API
void rasqal_world_set_raptor(rasqal_world* world, raptor_world* raptor_worl
d_ptr);
RASQAL_API
raptor_world *rasqal_world_get_raptor(rasqal_world* world);
/* Features */ /* Features */
RASQAL_API RASQAL_API
int rasqal_features_enumerate(const rasqal_feature feature, const char **na me, raptor_uri **uri, const char **label); int rasqal_features_enumerate(rasqal_world* world, const rasqal_feature fea ture, const char **name, raptor_uri **uri, const char **label);
RASQAL_API RASQAL_API
unsigned int rasqal_get_feature_count(void); unsigned int rasqal_get_feature_count(void);
RASQAL_API RASQAL_API
rasqal_feature rasqal_feature_from_uri(raptor_uri *uri); rasqal_feature rasqal_feature_from_uri(rasqal_world* world, raptor_uri *uri );
RASQAL_API RASQAL_API
int rasqal_feature_value_type(const rasqal_feature feature); int rasqal_feature_value_type(const rasqal_feature feature);
RASQAL_API RASQAL_API
int rasqal_languages_enumerate(rasqal_world* world, unsigned int counter, c onst char **name, const char **label, const unsigned char **uri_string); int rasqal_languages_enumerate(rasqal_world* world, unsigned int counter, c onst char **name, const char **label, const unsigned char **uri_string);
RASQAL_API RASQAL_API
int rasqal_language_name_check(rasqal_world* world, const char *name); int rasqal_language_name_check(rasqal_world* world, const char *name);
/* Query class */ /* Query class */
skipping to change at line 691 skipping to change at line 766
int rasqal_query_get_offset(rasqal_query* query); int rasqal_query_get_offset(rasqal_query* query);
RASQAL_API RASQAL_API
void rasqal_query_set_offset(rasqal_query* query, int offset); void rasqal_query_set_offset(rasqal_query* query, int offset);
RASQAL_API RASQAL_API
int rasqal_query_add_data_graph(rasqal_query* query, raptor_uri* uri, rapto r_uri* name_uri, int flags); int rasqal_query_add_data_graph(rasqal_query* query, raptor_uri* uri, rapto r_uri* name_uri, int flags);
RASQAL_API RASQAL_API
raptor_sequence* rasqal_query_get_data_graph_sequence(rasqal_query* query); raptor_sequence* rasqal_query_get_data_graph_sequence(rasqal_query* query);
RASQAL_API RASQAL_API
rasqal_data_graph* rasqal_query_get_data_graph(rasqal_query* query, int idx ); rasqal_data_graph* rasqal_query_get_data_graph(rasqal_query* query, int idx );
RASQAL_API
int rasqal_query_dataset_contains_named_graph(rasqal_query* query, raptor_u
ri *graph_uri);
RASQAL_API RASQAL_API
int rasqal_query_add_variable(rasqal_query* query, rasqal_variable* var); int rasqal_query_add_variable(rasqal_query* query, rasqal_variable* var);
RASQAL_API RASQAL_API
raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal_query* que ry); raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal_query* que ry);
RASQAL_API RASQAL_API
raptor_sequence* rasqal_query_get_describe_sequence(rasqal_query* query);
RASQAL_API
raptor_sequence* rasqal_query_get_anonymous_variable_sequence(rasqal_query* query); raptor_sequence* rasqal_query_get_anonymous_variable_sequence(rasqal_query* query);
RASQAL_API RASQAL_API
raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_query* query ); raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_query* query );
RASQAL_API RASQAL_API
rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx); rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx);
RASQAL_API RASQAL_API
int rasqal_query_has_variable(rasqal_query* query, const unsigned char *nam e); int rasqal_query_has_variable(rasqal_query* query, const unsigned char *nam e);
RASQAL_API RASQAL_API
int rasqal_query_set_variable(rasqal_query* query, const unsigned char *nam e, rasqal_literal* value); int rasqal_query_set_variable(rasqal_query* query, const unsigned char *nam e, rasqal_literal* value);
RASQAL_API RASQAL_API
skipping to change at line 755 skipping to change at line 834
raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequence(rasqal _graph_pattern* graph_pattern); raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequence(rasqal _graph_pattern* graph_pattern);
RASQAL_API RASQAL_API
rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern(rasqal_gra ph_pattern* graph_pattern, int idx); rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern(rasqal_gra ph_pattern* graph_pattern, int idx);
RASQAL_API RASQAL_API
rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator(rasqal_grap h_pattern* graph_pattern); rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator(rasqal_grap h_pattern* graph_pattern);
RASQAL_API RASQAL_API
const char* rasqal_graph_pattern_operator_as_string(rasqal_graph_pattern_op erator op); const char* rasqal_graph_pattern_operator_as_string(rasqal_graph_pattern_op erator op);
RASQAL_API RASQAL_API
void rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* fh); void rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* fh);
RASQAL_API RASQAL_API
int rasqal_graph_pattern_add_constraint(rasqal_graph_pattern* gp, rasqal_ex int rasqal_graph_pattern_set_filter_expression(rasqal_graph_pattern* gp, ra
pression* expr); sqal_expression* expr);
RASQAL_API
raptor_sequence* rasqal_graph_pattern_get_constraint_sequence(rasqal_graph_
pattern* gp);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_graph_pattern_get_constraint(rasqal_graph_pattern * gp, int idx); rasqal_expression* rasqal_graph_pattern_get_filter_expression(rasqal_graph_ pattern* gp);
RASQAL_API RASQAL_API
int rasqal_graph_pattern_visit(rasqal_query* query, rasqal_graph_pattern *g p, rasqal_graph_pattern_visit_fn fn, void* user_data); int rasqal_graph_pattern_visit(rasqal_query* query, rasqal_graph_pattern *g p, rasqal_graph_pattern_visit_fn fn, void* user_data);
RASQAL_API RASQAL_API
int rasqal_graph_pattern_get_index(rasqal_graph_pattern* gp); int rasqal_graph_pattern_get_index(rasqal_graph_pattern* gp);
RASQAL_API
int rasqal_graph_pattern_variable_bound_in(rasqal_graph_pattern *gp, rasqal
_variable *v);
RASQAL_API
rasqal_literal* rasqal_graph_pattern_get_origin(rasqal_graph_pattern* graph
_pattern);
/* Utility methods */ /* Utility methods */
RASQAL_API RASQAL_API
const char* rasqal_query_verb_as_string(rasqal_query_verb verb); const char* rasqal_query_verb_as_string(rasqal_query_verb verb);
RASQAL_API RASQAL_API
void rasqal_query_print(rasqal_query* query, FILE* fh); void rasqal_query_print(rasqal_query* query, FILE* fh);
/* Query */ /* Query */
RASQAL_API RASQAL_API
int rasqal_query_prepare(rasqal_query* query, const unsigned char *query_st ring, raptor_uri *base_uri); int rasqal_query_prepare(rasqal_query* query, const unsigned char *query_st ring, raptor_uri *base_uri);
skipping to change at line 786 skipping to change at line 867
RASQAL_API RASQAL_API
void* rasqal_query_get_user_data(rasqal_query* query); void* rasqal_query_get_user_data(rasqal_query* query);
RASQAL_API RASQAL_API
void rasqal_query_set_user_data(rasqal_query* query, void *user_data); void rasqal_query_set_user_data(rasqal_query* query, void *user_data);
/* query results */ /* query results */
RASQAL_API RASQAL_API
void rasqal_free_query_results(rasqal_query_results *query_results); void rasqal_free_query_results(rasqal_query_results *query_results);
RASQAL_API
rasqal_query* rasqal_query_results_get_query(rasqal_query_results* query_re
sults);
/* Bindings result format */ /* Bindings result format */
RASQAL_API RASQAL_API
int rasqal_query_results_is_bindings(rasqal_query_results *query_results); int rasqal_query_results_is_bindings(rasqal_query_results *query_results);
RASQAL_API RASQAL_API
int rasqal_query_results_get_count(rasqal_query_results *query_results); int rasqal_query_results_get_count(rasqal_query_results *query_results);
RASQAL_API RASQAL_API
int rasqal_query_results_next(rasqal_query_results *query_results); int rasqal_query_results_next(rasqal_query_results *query_results);
RASQAL_API RASQAL_API
int rasqal_query_results_finished(rasqal_query_results *query_results); int rasqal_query_results_finished(rasqal_query_results *query_results);
RASQAL_API RASQAL_API
skipping to change at line 867 skipping to change at line 951
RASQAL_API RASQAL_API
const char* rasqal_query_results_formatter_get_mime_type(rasqal_query_resul ts_formatter *formatter); const char* rasqal_query_results_formatter_get_mime_type(rasqal_query_resul ts_formatter *formatter);
RASQAL_API RASQAL_API
int rasqal_query_iostream_write_escaped_counted_string(rasqal_query* query, raptor_iostream* iostr, const unsigned char* string, size_t len); int rasqal_query_iostream_write_escaped_counted_string(rasqal_query* query, raptor_iostream* iostr, const unsigned char* string, size_t len);
RASQAL_API RASQAL_API
unsigned char* rasqal_query_escape_counted_string(rasqal_query* query, cons t unsigned char *string, size_t len, size_t* output_len_p); unsigned char* rasqal_query_escape_counted_string(rasqal_query* query, cons t unsigned char *string, size_t len, size_t* output_len_p);
/* Data graph class */ /* Data graph class */
RASQAL_API RASQAL_API
rasqal_data_graph* rasqal_new_data_graph(raptor_uri* uri, raptor_uri* name_ uri, int flags); rasqal_data_graph* rasqal_new_data_graph(rasqal_world* world, raptor_uri* u ri, raptor_uri* name_uri, int flags);
RASQAL_API RASQAL_API
void rasqal_free_data_graph(rasqal_data_graph* dg); void rasqal_free_data_graph(rasqal_data_graph* dg);
RASQAL_API RASQAL_API
void rasqal_data_graph_print(rasqal_data_graph* dg, FILE* fh); void rasqal_data_graph_print(rasqal_data_graph* dg, FILE* fh);
/** /**
* rasqal_compare_flags: * rasqal_compare_flags:
* @RASQAL_COMPARE_NOCASE: String comparisons are case independent. * @RASQAL_COMPARE_NOCASE: String comparisons are case independent.
* @RASQAL_COMPARE_XQUERY: XQuery comparsion rules apply. * @RASQAL_COMPARE_XQUERY: XQuery comparsion rules apply.
* @RASQAL_COMPARE_RDF: RDF Term comparsion rules apply. * @RASQAL_COMPARE_RDF: RDF Term comparsion rules apply.
* @RASQAL_COMPARE_URI: Allow comparison of URIs * @RASQAL_COMPARE_URI: Allow comparison of URIs and allow strings to ha
ve a boolean value (for RDQL)
* @RASQAL_COMPARE_SAMETERM: SPARQL sameTerm() builtin rules apply.
* *
* Flags for rasqal_expression_evaluate() or rasqal_literal_compare(). * Flags for rasqal_expression_evaluate(), rasqal_literal_compare(),
* rasqal_literal_as_string_flags(), rasqal_new_literal_from_promotion(),
* rasqal_literal_equals_flags().
*/ */
typedef enum { typedef enum {
RASQAL_COMPARE_NOCASE = 1, RASQAL_COMPARE_NOCASE = 1,
RASQAL_COMPARE_XQUERY = 2, RASQAL_COMPARE_XQUERY = 2,
RASQAL_COMPARE_RDF = 4, RASQAL_COMPARE_RDF = 4,
RASQAL_COMPARE_URI = 8 RASQAL_COMPARE_URI = 8,
RASQAL_COMPARE_SAMETERM = 16
} rasqal_compare_flags; } rasqal_compare_flags;
/* Expression class */ /* Expression class */
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_0op_expression(rasqal_op op); rasqal_expression* rasqal_new_0op_expression(rasqal_world* world, rasqal_op op);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_1op_expression(rasqal_op op, rasqal_expressio n* arg); rasqal_expression* rasqal_new_1op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_2op_expression(rasqal_op op, rasqal_expressio n* arg1, rasqal_expression* arg2); rasqal_expression* rasqal_new_2op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_3op_expression(rasqal_op op, rasqal_expressio n* arg1, rasqal_expression* arg2, rasqal_expression* arg3); rasqal_expression* rasqal_new_3op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_string_op_expression(rasqal_op op, rasqal_exp ression* arg1, rasqal_literal* literal); rasqal_expression* rasqal_new_string_op_expression(rasqal_world* world, ras qal_op op, rasqal_expression* arg1, rasqal_literal* literal);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_literal_expression(rasqal_literal* literal); rasqal_expression* rasqal_new_literal_expression(rasqal_world* world, rasqa l_literal* literal);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_function_expression(raptor_uri* name, raptor_ sequence* args); rasqal_expression* rasqal_new_function_expression(rasqal_world* world, rapt or_uri* name, raptor_sequence* args);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_cast_expression(raptor_uri* name, rasqal_expr rasqal_expression* rasqal_new_cast_expression(rasqal_world* world, raptor_u
ession *value); ri* name, rasqal_expression *value);
RASQAL_API
rasqal_expression* rasqal_new_coalesce_expression(rasqal_world* world, rapt
or_sequence* args);
RASQAL_API RASQAL_API
rasqal_expression* rasqal_new_expression_from_expression(rasqal_expression* e); rasqal_expression* rasqal_new_expression_from_expression(rasqal_expression* e);
RASQAL_API RASQAL_API
void rasqal_free_expression(rasqal_expression* e); void rasqal_free_expression(rasqal_expression* e);
RASQAL_API RASQAL_API
void rasqal_expression_print_op(rasqal_expression* e, FILE* fh); void rasqal_expression_print_op(rasqal_expression* e, FILE* fh);
RASQAL_API RASQAL_API
void rasqal_expression_print(rasqal_expression* e, FILE* fh); void rasqal_expression_print(rasqal_expression* e, FILE* fh);
RASQAL_API RASQAL_API
rasqal_literal* rasqal_expression_evaluate(rasqal_query* query, rasqal_expr ession* e, int flags); rasqal_literal* rasqal_expression_evaluate(rasqal_world *world, raptor_loca tor *locator, rasqal_expression* e, int flags);
/** /**
* rasqal_expression_visit_fn: * rasqal_expression_visit_fn:
* @user_data: user data passed in with rasqal_expression_visit() * @user_data: user data passed in with rasqal_expression_visit()
* @e: current expression * @e: current expression
* *
* User function to visit an expression and operate on it with * User function to visit an expression and operate on it with
* rasqal_expression_visit() * rasqal_expression_visit()
* *
* Return value: 0 to truncate the visit * Return value: 0 to truncate the visit
skipping to change at line 983 skipping to change at line 1073
rasqal_literal* rasqal_literal_as_node(rasqal_literal* l); rasqal_literal* rasqal_literal_as_node(rasqal_literal* l);
RASQAL_API RASQAL_API
raptor_uri* rasqal_literal_datatype(rasqal_literal* l); raptor_uri* rasqal_literal_datatype(rasqal_literal* l);
RASQAL_API RASQAL_API
rasqal_literal* rasqal_literal_value(rasqal_literal* l); rasqal_literal* rasqal_literal_value(rasqal_literal* l);
RASQAL_API RASQAL_API
int rasqal_literal_compare(rasqal_literal* l1, rasqal_literal* l2, int flag s, int *error); int rasqal_literal_compare(rasqal_literal* l1, rasqal_literal* l2, int flag s, int *error);
RASQAL_API RASQAL_API
int rasqal_literal_equals(rasqal_literal* l1, rasqal_literal* l2); int rasqal_literal_equals(rasqal_literal* l1, rasqal_literal* l2);
RASQAL_API
int rasqal_literal_same_term(rasqal_literal* l1, rasqal_literal* l2);
RASQAL_API
rasqal_literal_type rasqal_literal_get_rdf_term_type(rasqal_literal* l);
RASQAL_API
int rasqal_literal_is_rdf_literal(rasqal_literal* l);
RASQAL_API RASQAL_API
rasqal_prefix* rasqal_new_prefix(const unsigned char* prefix, raptor_uri* u ri); rasqal_prefix* rasqal_new_prefix(rasqal_world* world, const unsigned char* prefix, raptor_uri* uri);
RASQAL_API RASQAL_API
void rasqal_free_prefix(rasqal_prefix* p); void rasqal_free_prefix(rasqal_prefix* p);
RASQAL_API RASQAL_API
void rasqal_prefix_print(rasqal_prefix* p, FILE* fh); void rasqal_prefix_print(rasqal_prefix* p, FILE* fh);
/* Triple class */ /* Triple class */
RASQAL_API RASQAL_API
rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal_literal* p redicate, rasqal_literal* object); rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal_literal* p redicate, rasqal_literal* object);
RASQAL_API RASQAL_API
rasqal_triple* rasqal_new_triple_from_triple(rasqal_triple* t); rasqal_triple* rasqal_new_triple_from_triple(rasqal_triple* t);
skipping to change at line 1029 skipping to change at line 1125
/* memory functions */ /* memory functions */
RASQAL_API RASQAL_API
void rasqal_free_memory(void *ptr); void rasqal_free_memory(void *ptr);
RASQAL_API RASQAL_API
void* rasqal_alloc_memory(size_t size); void* rasqal_alloc_memory(size_t size);
RASQAL_API RASQAL_API
void* rasqal_calloc_memory(size_t nmemb, size_t size); void* rasqal_calloc_memory(size_t nmemb, size_t size);
/* decimal functions */ /* decimal functions */
RASQAL_API RASQAL_API
rasqal_xsd_decimal* rasqal_new_xsd_decimal(void); rasqal_xsd_decimal* rasqal_new_xsd_decimal(rasqal_world* world);
RASQAL_API RASQAL_API
void rasqal_free_xsd_decimal(rasqal_xsd_decimal* dec); void rasqal_free_xsd_decimal(rasqal_xsd_decimal* dec);
RASQAL_API RASQAL_API
int rasqal_xsd_decimal_set_string(rasqal_xsd_decimal* dec, const char* stri ng); int rasqal_xsd_decimal_set_string(rasqal_xsd_decimal* dec, const char* stri ng);
RASQAL_API RASQAL_API
double rasqal_xsd_decimal_get_double(rasqal_xsd_decimal* dec); double rasqal_xsd_decimal_get_double(rasqal_xsd_decimal* dec);
RASQAL_API RASQAL_API
char* rasqal_xsd_decimal_as_string(rasqal_xsd_decimal* dec); char* rasqal_xsd_decimal_as_string(rasqal_xsd_decimal* dec);
RASQAL_API RASQAL_API
char* rasqal_xsd_decimal_as_counted_string(rasqal_xsd_decimal* dec, size_t* len_p); char* rasqal_xsd_decimal_as_counted_string(rasqal_xsd_decimal* dec, size_t* len_p);
skipping to change at line 1067 skipping to change at line 1163
int rasqal_xsd_decimal_compare(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b ); int rasqal_xsd_decimal_compare(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b );
RASQAL_API RASQAL_API
int rasqal_xsd_decimal_equals(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) ; int rasqal_xsd_decimal_equals(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) ;
RASQAL_API RASQAL_API
int rasqal_xsd_decimal_is_zero(rasqal_xsd_decimal* d); int rasqal_xsd_decimal_is_zero(rasqal_xsd_decimal* d);
/* rasqal_engine.c */ /* rasqal_engine.c */
/** /**
* rasqal_triple_parts: * rasqal_triple_parts:
* @RASQAL_TRIPLE_NONE: no parts
* @RASQAL_TRIPLE_SUBJECT: Subject present in a triple. * @RASQAL_TRIPLE_SUBJECT: Subject present in a triple.
* @RASQAL_TRIPLE_PREDICATE: Predicate present in a triple. * @RASQAL_TRIPLE_PREDICATE: Predicate present in a triple.
* @RASQAL_TRIPLE_OBJECT: Object present in a triple. * @RASQAL_TRIPLE_OBJECT: Object present in a triple.
* @RASQAL_TRIPLE_ORIGIN: Origin/graph present in a triple. * @RASQAL_TRIPLE_ORIGIN: Origin/graph present in a triple.
* @RASQAL_TRIPLE_GRAPH: Alias for RASQAL_TRIPLE_ORIGIN * @RASQAL_TRIPLE_GRAPH: Alias for RASQAL_TRIPLE_ORIGIN
* @RASQAL_TRIPLE_SPO: Subject, Predicate and Object present in a triple. * @RASQAL_TRIPLE_SPO: Subject, Predicate and Object present in a triple.
* @RASQAL_TRIPLE_SPOG: Subject, Predicate, Object, Graph present in a trip le. * @RASQAL_TRIPLE_SPOG: Subject, Predicate, Object, Graph present in a trip le.
* *
* Flags for parts of a triple. * Flags for parts of a triple.
*/ */
typedef enum { typedef enum {
RASQAL_TRIPLE_NONE = 0,
RASQAL_TRIPLE_SUBJECT = 1, RASQAL_TRIPLE_SUBJECT = 1,
RASQAL_TRIPLE_PREDICATE= 2, RASQAL_TRIPLE_PREDICATE= 2,
RASQAL_TRIPLE_OBJECT = 4, RASQAL_TRIPLE_OBJECT = 4,
RASQAL_TRIPLE_ORIGIN = 8, RASQAL_TRIPLE_ORIGIN = 8,
RASQAL_TRIPLE_GRAPH = RASQAL_TRIPLE_ORIGIN, RASQAL_TRIPLE_GRAPH = RASQAL_TRIPLE_ORIGIN,
RASQAL_TRIPLE_SPO = RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT, RASQAL_TRIPLE_SPO = RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT,
RASQAL_TRIPLE_SPOG = RASQAL_TRIPLE_SPO | RASQAL_TRIPLE_GRAPH RASQAL_TRIPLE_SPOG = RASQAL_TRIPLE_SPO | RASQAL_TRIPLE_GRAPH
} rasqal_triple_parts; } rasqal_triple_parts;
/** /**
* rasqal_triples_match: * rasqal_triples_match:
* @world: rasqal_world object
* @user_data: User data pointer for factory methods. * @user_data: User data pointer for factory methods.
* @bind_match: The [4]array (s,p,o,origin) bindings against the current tr iple match only touching triple parts given. Returns parts that were bound or 0 on failure. * @bind_match: The [4]array (s,p,o,origin) bindings against the current tr iple match only touching triple parts given. Returns parts that were bound or 0 on failure.
* @next_match: Move to next match. * @next_match: Move to next match.
* @is_end: Check for end of triple match - return non-0 if is end. * @is_end: Check for end of triple match - return non-0 if is end.
* @finish: Finish triples match and destroy any allocated memory. * @finish: Finish triples match and destroy any allocated memory.
* @world: rasqal_world object * @is_exact: non-0 if triple to match is all literal constants
* @finished: >0 if the match has finished
* *
* Triples match structure as initialised by #rasqal_triples_source * Triples match structure as initialised by #rasqal_triples_source
* method init_triples_match. * method init_triples_match.
*/ */
struct rasqal_triples_match_s { struct rasqal_triples_match_s {
rasqal_world *world;
void *user_data; void *user_data;
rasqal_triple_parts (*bind_match)(struct rasqal_triples_match_s* rtm, voi d *user_data, rasqal_variable *bindings[4], rasqal_triple_parts parts); rasqal_triple_parts (*bind_match)(struct rasqal_triples_match_s* rtm, voi d *user_data, rasqal_variable *bindings[4], rasqal_triple_parts parts);
void (*next_match)(struct rasqal_triples_match_s* rtm, void *user_data); void (*next_match)(struct rasqal_triples_match_s* rtm, void *user_data);
int (*is_end)(struct rasqal_triples_match_s* rtm, void *user_data); int (*is_end)(struct rasqal_triples_match_s* rtm, void *user_data);
void (*finish)(struct rasqal_triples_match_s* rtm, void *user_data); void (*finish)(struct rasqal_triples_match_s* rtm, void *user_data);
rasqal_world *world; int is_exact;
int finished;
}; };
typedef struct rasqal_triples_match_s rasqal_triples_match; typedef struct rasqal_triples_match_s rasqal_triples_match;
/** /**
* rasqal_triple_meta: * rasqal_triple_meta:
* @bindings: Variable bindings for this triple+origin to set. * @bindings: Variable bindings for this triple+origin to set.
* @triples_match: The matcher that is setting these bindings. * @triples_match: The matcher that is setting these bindings.
* @context: Context data used by the matcher. * @context: Context data used by the matcher.
* @parts: Parts of the triple to match/bindings to set. * @parts: Bitmask of #rasqal_triple_parts flags describing the parts of th
* @is_exact: non-0 if all parts of the triple are given e triple pattern that will bind to variables. There may also be variables
* @executed: non-0 if the triple pattern has been fully executed mentioned that are bound in other triple patterns even if @parts is 0.
* @is_exact: unused
* @executed: unused
* *
* Triple matching metadata for one triple pattern. * Metadata for triple pattern matching for one triple pattern.
*/ */
typedef struct { typedef struct {
/* triple (subject, predicate, object) and origin */ /* triple (subject, predicate, object) and origin */
rasqal_variable* bindings[4]; rasqal_variable* bindings[4];
rasqal_triples_match *triples_match; rasqal_triples_match *triples_match;
void *context; void *context;
rasqal_triple_parts parts; rasqal_triple_parts parts;
/* non-0 if the associated triple pattern contains no variables */
int is_exact; int is_exact;
/* non-0 if the triple pattern has been fully executed */
int executed; int executed;
} rasqal_triple_meta; } rasqal_triple_meta;
/** /**
* RASQAL_TRIPLES_SOURCE_MIN_VERSION:
*
* Lowest accepted @rasqal_triples_source API version
*/
#define RASQAL_TRIPLES_SOURCE_MIN_VERSION 1
/**
* RASQAL_TRIPLES_SOURCE_MAX_VERSION:
*
* Highest accepted @rasqal_triples_source API version
*/
#define RASQAL_TRIPLES_SOURCE_MAX_VERSION 1
/**
* rasqal_triples_source: * rasqal_triples_source:
* @version: API version - only V1 is defined for now
* @query: Source for this query. * @query: Source for this query.
* @user_data: Context user data passed into the factory methods. * @user_data: Context user data passed into the factory methods.
* @init_triples_match: Factory method to initalise a new #rasqal_triples_m atch. * @init_triples_match: Factory method to initalise a new #rasqal_triples_m atch.
* @triple_present: Factory method to return presence or absence of a compl ete triple. * @triple_present: Factory method to return presence or absence of a compl ete triple.
* @free_triples_source: Factory method to deallocate resources. * @free_triples_source: Factory method to deallocate resources.
* *
* Triples source as initialised by a #rasqal_triples_source_factory. * Triples source as initialised by a #rasqal_triples_source_factory.
*/ */
struct rasqal_triples_source_s { struct rasqal_triples_source_s {
int version;
rasqal_query* query; rasqal_query* query;
void *user_data; void *user_data;
/* API v1 */
int (*init_triples_match)(rasqal_triples_match* rtm, struct rasqal_triple s_source_s* rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t); int (*init_triples_match)(rasqal_triples_match* rtm, struct rasqal_triple s_source_s* rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t);
int (*triple_present)(struct rasqal_triples_source_s* rts, void *user_dat a, rasqal_triple *t); int (*triple_present)(struct rasqal_triples_source_s* rts, void *user_dat a, rasqal_triple *t);
void (*free_triples_source)(void *user_data); void (*free_triples_source)(void *user_data);
/* API v2 onwards */
}; };
typedef struct rasqal_triples_source_s rasqal_triples_source; typedef struct rasqal_triples_source_s rasqal_triples_source;
/** /**
* RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION:
*
* Lowest accepted @rasqal_triples_source_factory API version
*/
#define RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION 1
/**
* RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION:
*
* Highest accepted @rasqal_triples_source_factory API version
*/
#define RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION 1
/**
* rasqal_triples_source_factory: * rasqal_triples_source_factory:
* @version: API factory version - only V1 is defined for now
* @user_data: User data for triples_source_factory. * @user_data: User data for triples_source_factory.
* @user_data_size: Size Of @user_data for new_triples_source. * @user_data_size: Size Of @user_data for new_triples_source.
* @new_triples_source: Create a new triples source - returns non-zero on f ailure &lt; 0 is a 'no rdf data error', &gt; 0 is an unspecified error.. * @new_triples_source: Create a new triples source - returns non-zero on f ailure &lt; 0 is a 'no rdf data error', &gt; 0 is an unspecified error..
* *
* A factory that initialises #rasqal_triples_source structures * A factory that initialises #rasqal_triples_source structures
* to returning matches to a triple pattern. * to returning matches to a triple pattern.
*/ */
typedef struct { typedef struct {
int version;
void *user_data; void *user_data;
size_t user_data_size; size_t user_data_size;
/* API v1 */
int (*new_triples_source)(rasqal_query* query, void *factory_user_data, v oid *user_data, rasqal_triples_source* rts); int (*new_triples_source)(rasqal_query* query, void *factory_user_data, v oid *user_data, rasqal_triples_source* rts);
/* API v2 onwards */
} rasqal_triples_source_factory; } rasqal_triples_source_factory;
/**
* rasqal_triples_source_factory_register_fn:
* @factory: factory to register
*
* Register a factory for generating triples sources #rasqal_triples_source
*
* Return value: non-0 on failure
*/
typedef int (*rasqal_triples_source_factory_register_fn)(rasqal_triples_sou
rce_factory *factory);
/* set the triples_source_factory */ /* set the triples_source_factory */
RASQAL_API RASQAL_API
void rasqal_set_triples_source_factory(rasqal_world* world, void (*register _fn)(rasqal_triples_source_factory *factory), void* user_data); int rasqal_set_triples_source_factory(rasqal_world* world, rasqal_triples_s ource_factory_register_fn register_fn, void* user_data);
/* The info below is solely for gtk-doc - ignore it */ /* The info below is solely for gtk-doc - ignore it */
/** /**
* raptor_world:
*
* Internal
*/
/**
* RAPTOR_WORLD_DECLARED:
*
* Internal
*/
/**
* RASQAL_QUERY_RESULTS_FORMATTER_DECLARED: * RASQAL_QUERY_RESULTS_FORMATTER_DECLARED:
* *
* Internal * Internal
*/ */
/** /**
* RASQAL_WORLD_DECLARED: * RASQAL_WORLD_DECLARED:
* *
* Internal * Internal
*/ */
/** /**
* RASQAL_LITERAL_UDT_DEFINED
*
* Internal
*/
/**
* rasqal_expression_s: * rasqal_expression_s:
* @usage: Internal * @usage: Internal
* @op: Internal * @op: Internal
* @arg1: Internal * @arg1: Internal
* @arg2: Internal * @arg2: Internal
* @arg3: Internal * @arg3: Internal
* @literal: Internal * @literal: Internal
* @value: Internal * @value: Internal
* @name: Internal * @name: Internal
* @args: Internal * @args: Internal
skipping to change at line 1284 skipping to change at line 1452
* Return value: non-0 on failure * Return value: non-0 on failure
*/ */
/** /**
* free_triples_source: * free_triples_source:
* @user_data: user data * @user_data: user data
* *
* Internal - see #rasqal_triples_source * Internal - see #rasqal_triples_source
*/ */
/**
* rasqal_variables_table:
*
* Internal - for now
*/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 91 change blocks. 
68 lines changed or deleted 255 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/