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 | |||
* | * | |||
* $Id: rasqal.h,v 1.88 2005/02/24 11:06:38 cmdjb Exp $ | * $Id: rasqal.h,v 1.93 2005/03/20 22:11:21 cmdjb Exp $ | |||
* | * | |||
* Copyright (C) 2003-2005, David Beckett http://purl.org/net/dajobe/ | * Copyright (C) 2003-2005, David Beckett http://purl.org/net/dajobe/ | |||
* Institute for Learning and Research Technology http://www.ilrt.bristol.a c.uk/ | * Institute for Learning and Research Technology http://www.ilrt.bristol.a c.uk/ | |||
* University of Bristol, UK http://www.bristol.ac.uk/ | * 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 | |||
skipping to change at line 98 | skipping to change at line 98 | |||
} rasqal_prefix; | } rasqal_prefix; | |||
/* variable binding */ | /* variable binding */ | |||
typedef struct { | typedef struct { | |||
const unsigned char *name; | const unsigned char *name; | |||
struct rasqal_literal_s *value; | struct rasqal_literal_s *value; | |||
int offset; /* offset in the rasqal_query variables array */ | int offset; /* offset in the rasqal_query variables array */ | |||
} rasqal_variable; | } rasqal_variable; | |||
typedef enum { | typedef enum { | |||
RASQAL_DATA_GRAPH_NONE = 0, | ||||
RASQAL_DATA_GRAPH_NAMED = 1, | ||||
RASQAL_DATA_GRAPH_BACKGROUND = 2, | ||||
} rasqal_data_graph_flags; | ||||
typedef struct { | ||||
raptor_uri* uri; | ||||
raptor_uri* name_uri; | ||||
int flags; | ||||
} rasqal_data_graph; | ||||
typedef enum { | ||||
RASQAL_LITERAL_UNKNOWN, | RASQAL_LITERAL_UNKNOWN, | |||
RASQAL_LITERAL_URI, | RASQAL_LITERAL_URI, | |||
RASQAL_LITERAL_QNAME, | RASQAL_LITERAL_QNAME, | |||
RASQAL_LITERAL_STRING, | RASQAL_LITERAL_STRING, | |||
RASQAL_LITERAL_BLANK, | RASQAL_LITERAL_BLANK, | |||
RASQAL_LITERAL_PATTERN, | RASQAL_LITERAL_PATTERN, | |||
RASQAL_LITERAL_BOOLEAN, | RASQAL_LITERAL_BOOLEAN, | |||
RASQAL_LITERAL_INTEGER, | RASQAL_LITERAL_INTEGER, | |||
RASQAL_LITERAL_FLOATING, | RASQAL_LITERAL_FLOATING, | |||
RASQAL_LITERAL_VARIABLE, | RASQAL_LITERAL_VARIABLE, | |||
skipping to change at line 170 | skipping to change at line 182 | |||
RASQAL_EXPR_BANG, | RASQAL_EXPR_BANG, | |||
RASQAL_EXPR_LITERAL, | RASQAL_EXPR_LITERAL, | |||
RASQAL_EXPR_FUNCTION, | RASQAL_EXPR_FUNCTION, | |||
RASQAL_EXPR_BOUND, | RASQAL_EXPR_BOUND, | |||
RASQAL_EXPR_STR, | RASQAL_EXPR_STR, | |||
RASQAL_EXPR_LANG, | RASQAL_EXPR_LANG, | |||
RASQAL_EXPR_DATATYPE, | RASQAL_EXPR_DATATYPE, | |||
RASQAL_EXPR_ISURI, | RASQAL_EXPR_ISURI, | |||
RASQAL_EXPR_ISBLANK, | RASQAL_EXPR_ISBLANK, | |||
RASQAL_EXPR_ISLITERAL, | RASQAL_EXPR_ISLITERAL, | |||
RASQAL_EXPR_LAST= RASQAL_EXPR_ISLITERAL | RASQAL_EXPR_CAST, | |||
RASQAL_EXPR_LAST= RASQAL_EXPR_CAST | ||||
} rasqal_op; | } rasqal_op; | |||
struct rasqal_variable_s; | struct rasqal_variable_s; | |||
/* expression (arg1), unary op (arg1), binary op (arg1,arg2), | /* expression (arg1), unary op (arg1), binary op (arg1,arg2), | |||
* literal or variable | * literal or variable | |||
*/ | */ | |||
struct rasqal_expression_s { | struct rasqal_expression_s { | |||
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; | |||
rasqal_literal* literal; | rasqal_literal* literal; | |||
rasqal_variable* variable; | rasqal_variable* variable; | |||
unsigned char *value; /* UTF-8 value */ | unsigned char *value; /* UTF-8 value */ | |||
/* for extension function qname(args...) */ | /* 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; | |||
/* Extra flags for triples */ | /* Extra flags for triples */ | |||
typedef enum { | typedef enum { | |||
/* true when all of subject, predicate, object are given */ | /* true when all of subject, predicate, object are given */ | |||
RASQAL_TRIPLE_FLAGS_EXACT=1, | RASQAL_TRIPLE_FLAGS_EXACT=1, | |||
skipping to change at line 249 | skipping to change at line 262 | |||
RASQAL_API const char* rasqal_query_get_name(rasqal_query* query); | RASQAL_API const char* rasqal_query_get_name(rasqal_query* query); | |||
RASQAL_API const char* rasqal_query_get_label(rasqal_query* query); | RASQAL_API const char* rasqal_query_get_label(rasqal_query* query); | |||
RASQAL_API void rasqal_query_set_fatal_error_handler(rasqal_query* query, v oid *user_data, raptor_message_handler handler); | RASQAL_API void rasqal_query_set_fatal_error_handler(rasqal_query* query, v oid *user_data, raptor_message_handler handler); | |||
RASQAL_API void rasqal_query_set_error_handler(rasqal_query* query, void *u ser_data, raptor_message_handler handler); | RASQAL_API void rasqal_query_set_error_handler(rasqal_query* query, void *u ser_data, raptor_message_handler handler); | |||
RASQAL_API void rasqal_query_set_warning_handler(rasqal_query* query, void *user_data, raptor_message_handler handler); | RASQAL_API void rasqal_query_set_warning_handler(rasqal_query* query, void *user_data, raptor_message_handler handler); | |||
RASQAL_API void rasqal_query_set_feature(rasqal_query *query, rasqal_featur e feature, int value); | RASQAL_API void rasqal_query_set_feature(rasqal_query *query, rasqal_featur e feature, int value); | |||
RASQAL_API int rasqal_query_get_distinct(rasqal_query *query); | RASQAL_API int rasqal_query_get_distinct(rasqal_query *query); | |||
RASQAL_API int rasqal_query_get_limit(rasqal_query *query); | RASQAL_API int rasqal_query_get_limit(rasqal_query *query); | |||
RASQAL_API void rasqal_query_add_source(rasqal_query* query, raptor_uri* ur | RASQAL_API RASQAL_DEPRECATED void rasqal_query_add_source(rasqal_query* que | |||
i); | ry, raptor_uri* uri); | |||
RASQAL_API raptor_sequence* rasqal_query_get_source_sequence(rasqal_query* | RASQAL_API RASQAL_DEPRECATED raptor_sequence* rasqal_query_get_source_seque | |||
query); | nce(rasqal_query* query); | |||
RASQAL_API raptor_uri* rasqal_query_get_source(rasqal_query* query, int idx | RASQAL_API RASQAL_DEPRECATED raptor_uri* rasqal_query_get_source(rasqal_que | |||
); | ry* query, int idx); | |||
RASQAL_API int rasqal_query_add_data_graph(rasqal_query* query, raptor_uri* | ||||
uri, raptor_uri* name_uri, int flags); | ||||
RASQAL_API raptor_sequence* rasqal_query_get_data_graph_sequence(rasqal_que | ||||
ry* query); | ||||
RASQAL_API rasqal_data_graph* rasqal_query_get_data_graph(rasqal_query* que | ||||
ry, int idx); | ||||
RASQAL_API void rasqal_query_add_variable(rasqal_query* query, rasqal_varia ble* var); | RASQAL_API void rasqal_query_add_variable(rasqal_query* query, rasqal_varia ble* var); | |||
RASQAL_API RASQAL_DEPRECATED raptor_sequence* rasqal_query_get_variable_seq uence(rasqal_query* query); | ||||
RASQAL_API raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal _query* query); | RASQAL_API raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal _query* query); | |||
RASQAL_API raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_q uery* query); | RASQAL_API raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_q uery* query); | |||
RASQAL_API rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx); | RASQAL_API rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx); | |||
RASQAL_API int rasqal_query_has_variable(rasqal_query* query, const unsigne d char *name); | RASQAL_API int rasqal_query_has_variable(rasqal_query* query, const unsigne d char *name); | |||
RASQAL_API int rasqal_query_set_variable(rasqal_query* query, const unsigne d char *name, rasqal_literal* value); | RASQAL_API int rasqal_query_set_variable(rasqal_query* query, const unsigne d char *name, rasqal_literal* value); | |||
RASQAL_API RASQAL_DEPRECATED void rasqal_query_add_triple(rasqal_query* que ry, rasqal_triple* triple); | ||||
RASQAL_API raptor_sequence* rasqal_query_get_triple_sequence(rasqal_query* query); | RASQAL_API raptor_sequence* rasqal_query_get_triple_sequence(rasqal_query* query); | |||
RASQAL_API rasqal_triple* rasqal_query_get_triple(rasqal_query* query, int idx); | RASQAL_API rasqal_triple* rasqal_query_get_triple(rasqal_query* query, int idx); | |||
RASQAL_API void rasqal_query_add_constraint(rasqal_query* query, rasqal_exp | RASQAL_API RASQAL_DEPRECATED void rasqal_query_add_constraint(rasqal_query* | |||
ression* expr); | query, rasqal_expression* expr); | |||
RASQAL_API raptor_sequence* rasqal_query_get_constraint_sequence(rasqal_que | RASQAL_API RASQAL_DEPRECATED raptor_sequence* rasqal_query_get_constraint_s | |||
ry* query); | equence(rasqal_query* query); | |||
RASQAL_API rasqal_expression* rasqal_query_get_constraint(rasqal_query* que | RASQAL_API RASQAL_DEPRECATED rasqal_expression* rasqal_query_get_constraint | |||
ry, int idx); | (rasqal_query* query, int idx); | |||
RASQAL_API void rasqal_query_add_prefix(rasqal_query* query, rasqal_prefix* prefix); | RASQAL_API void rasqal_query_add_prefix(rasqal_query* query, rasqal_prefix* prefix); | |||
RASQAL_API raptor_sequence* rasqal_query_get_prefix_sequence(rasqal_query* query); | RASQAL_API raptor_sequence* rasqal_query_get_prefix_sequence(rasqal_query* query); | |||
RASQAL_API rasqal_prefix* rasqal_query_get_prefix(rasqal_query* query, int idx); | RASQAL_API rasqal_prefix* rasqal_query_get_prefix(rasqal_query* query, int idx); | |||
/* graph patterns */ | /* graph patterns */ | |||
RASQAL_API raptor_sequence* rasqal_query_get_graph_pattern_sequence(rasqal_ query* query); | RASQAL_API raptor_sequence* rasqal_query_get_graph_pattern_sequence(rasqal_ query* query); | |||
RASQAL_API rasqal_graph_pattern* rasqal_query_get_graph_pattern(rasqal_quer y* query, int idx); | RASQAL_API rasqal_graph_pattern* rasqal_query_get_graph_pattern(rasqal_quer y* query, int idx); | |||
RASQAL_API void rasqal_graph_pattern_add_sub_graph_pattern(rasqal_graph_pat tern* graph_pattern, rasqal_graph_pattern* sub_graph_pattern); | ||||
RASQAL_API rasqal_triple* rasqal_graph_pattern_get_triple(rasqal_graph_patt ern* graph_pattern, int idx); | RASQAL_API rasqal_triple* rasqal_graph_pattern_get_triple(rasqal_graph_patt ern* graph_pattern, int idx); | |||
RASQAL_API raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequ ence(rasqal_graph_pattern* graph_pattern); | RASQAL_API raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequ ence(rasqal_graph_pattern* graph_pattern); | |||
RASQAL_API rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern (rasqal_graph_pattern* graph_pattern, int idx); | RASQAL_API rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern (rasqal_graph_pattern* graph_pattern, int idx); | |||
RASQAL_API int rasqal_graph_pattern_get_flags(rasqal_graph_pattern* graph_p attern); | RASQAL_API int rasqal_graph_pattern_get_flags(rasqal_graph_pattern* graph_p attern); | |||
RASQAL_API void rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* fh); | RASQAL_API void rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* fh); | |||
RASQAL_API int rasqal_graph_pattern_add_constraint(rasqal_graph_pattern* gp | ||||
, rasqal_expression* expr); | ||||
RASQAL_API raptor_sequence* rasqal_graph_pattern_get_constraint_sequence(ra | ||||
sqal_graph_pattern* gp); | ||||
RASQAL_API rasqal_expression* rasqal_graph_pattern_get_constraint(rasqal_gr | ||||
aph_pattern* gp, int idx); | ||||
/* Utility methods */ | /* Utility methods */ | |||
RASQAL_API void rasqal_query_print(rasqal_query* query, FILE *stream); | RASQAL_API void rasqal_query_print(rasqal_query* query, FILE *stream); | |||
/* Query */ | /* Query */ | |||
RASQAL_API int rasqal_query_prepare(rasqal_query* query, const unsigned cha r *query_string, raptor_uri *base_uri); | RASQAL_API int rasqal_query_prepare(rasqal_query* query, const unsigned cha r *query_string, raptor_uri *base_uri); | |||
RASQAL_API rasqal_query_results* rasqal_query_execute(rasqal_query* query); | RASQAL_API rasqal_query_results* rasqal_query_execute(rasqal_query* query); | |||
RASQAL_API void* rasqal_query_get_user_data(rasqal_query *query); | RASQAL_API void* rasqal_query_get_user_data(rasqal_query *query); | |||
RASQAL_API void rasqal_query_set_user_data(rasqal_query *query, void *user_ data); | RASQAL_API void rasqal_query_set_user_data(rasqal_query *query, void *user_ data); | |||
skipping to change at line 313 | skipping to change at line 332 | |||
RASQAL_API int rasqal_query_results_is_boolean(rasqal_query_results *query_ results); | 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); | RASQAL_API int rasqal_query_results_get_boolean(rasqal_query_results *query _results); | |||
/* Graph result format */ | /* Graph result format */ | |||
RASQAL_API int rasqal_query_results_is_graph(rasqal_query_results *query_re sults); | RASQAL_API int rasqal_query_results_is_graph(rasqal_query_results *query_re sults); | |||
RASQAL_API raptor_statement* rasqal_query_results_get_triple(rasqal_query_r esults *query_results); | RASQAL_API raptor_statement* rasqal_query_results_get_triple(rasqal_query_r esults *query_results); | |||
RASQAL_API int rasqal_query_results_next_triple(rasqal_query_results *query _results); | RASQAL_API int rasqal_query_results_next_triple(rasqal_query_results *query _results); | |||
RASQAL_API int rasqal_query_results_write(raptor_iostream *iostr, rasqal_qu ery_results *results, raptor_uri *format_uri, raptor_uri *base_uri); | RASQAL_API int rasqal_query_results_write(raptor_iostream *iostr, rasqal_qu ery_results *results, raptor_uri *format_uri, raptor_uri *base_uri); | |||
/* Data graph class */ | ||||
RASQAL_API rasqal_data_graph* rasqal_new_data_graph(raptor_uri* uri, raptor | ||||
_uri* name_uri, int flags); | ||||
RASQAL_API void rasqal_free_data_graph(rasqal_data_graph* dg); | ||||
RASQAL_API void rasqal_data_graph_print(rasqal_data_graph* dg, FILE* fh); | ||||
/* Expression class */ | /* Expression class */ | |||
RASQAL_API rasqal_expression* rasqal_new_1op_expression(rasqal_op op, rasqa l_expression* arg); | RASQAL_API rasqal_expression* rasqal_new_1op_expression(rasqal_op op, rasqa l_expression* arg); | |||
RASQAL_API rasqal_expression* rasqal_new_2op_expression(rasqal_op op, rasqa l_expression* arg1, rasqal_expression* arg2); | RASQAL_API rasqal_expression* rasqal_new_2op_expression(rasqal_op op, rasqa l_expression* arg1, rasqal_expression* arg2); | |||
RASQAL_API rasqal_expression* rasqal_new_string_op_expression(rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal); | RASQAL_API rasqal_expression* rasqal_new_string_op_expression(rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal); | |||
RASQAL_API rasqal_expression* rasqal_new_literal_expression(rasqal_literal* literal); | RASQAL_API rasqal_expression* rasqal_new_literal_expression(rasqal_literal* literal); | |||
RASQAL_API rasqal_expression* rasqal_new_variable_expression(rasqal_variabl e *variable); | RASQAL_API rasqal_expression* rasqal_new_variable_expression(rasqal_variabl e *variable); | |||
RASQAL_API rasqal_expression* rasqal_new_function_expression(raptor_uri* na me, raptor_sequence* args); | RASQAL_API rasqal_expression* rasqal_new_function_expression(raptor_uri* na me, raptor_sequence* args); | |||
RASQAL_API rasqal_expression* rasqal_new_cast_expression(raptor_uri* name, rasqal_expression *value); | ||||
RASQAL_API void rasqal_free_expression(rasqal_expression* expr); | RASQAL_API void rasqal_free_expression(rasqal_expression* expr); | |||
RASQAL_API void rasqal_expression_print_op(rasqal_expression* expr, FILE* f h); | RASQAL_API void rasqal_expression_print_op(rasqal_expression* expr, FILE* f h); | |||
RASQAL_API void rasqal_expression_print(rasqal_expression* expr, FILE* fh); | RASQAL_API void rasqal_expression_print(rasqal_expression* expr, FILE* fh); | |||
RASQAL_API rasqal_literal* rasqal_expression_evaluate(rasqal_query *query, rasqal_expression* expr); | RASQAL_API rasqal_literal* rasqal_expression_evaluate(rasqal_query *query, rasqal_expression* expr); | |||
typedef int (*rasqal_expression_foreach_fn)(void *user_data, rasqal_express ion *e); | typedef int (*rasqal_expression_foreach_fn)(void *user_data, rasqal_express ion *e); | |||
RASQAL_API int rasqal_expression_foreach(rasqal_expression* expr, rasqal_ex pression_foreach_fn fn, void *user_data); | RASQAL_API int rasqal_expression_foreach(rasqal_expression* expr, rasqal_ex pression_foreach_fn fn, void *user_data); | |||
/* Literal class */ | /* Literal class */ | |||
RASQAL_API rasqal_literal* rasqal_new_integer_literal(rasqal_literal_type t ype, int integer); | RASQAL_API rasqal_literal* rasqal_new_integer_literal(rasqal_literal_type t ype, int integer); | |||
End of changes. 12 change blocks. | ||||
17 lines changed or deleted | 49 lines changed or added | |||