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.81 2005/02/03 15:04:23 cmdjb Exp $ | * $Id: rasqal.h,v 1.88 2005/02/24 11:06:38 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 44 | skipping to change at line 44 | |||
#ifdef WIN32 | #ifdef WIN32 | |||
# ifdef RASQAL_INTERNAL | # ifdef RASQAL_INTERNAL | |||
# define RASQAL_API _declspec(dllexport) | # define RASQAL_API _declspec(dllexport) | |||
# else | # else | |||
# define RASQAL_API _declspec(dllimport) | # define RASQAL_API _declspec(dllimport) | |||
# endif | # endif | |||
#else | #else | |||
# define RASQAL_API | # define RASQAL_API | |||
#endif | #endif | |||
/* Use gcc 3.1+ feature to allow marking of deprecated API calls. | ||||
* This gives a warning during compiling. | ||||
*/ | ||||
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3 | ||||
#ifdef __APPLE_CC__ | ||||
/* OSX gcc cpp-precomp is broken */ | ||||
#define RASQAL_DEPRECATED | ||||
#else | ||||
#define RASQAL_DEPRECATED __attribute__((deprecated)) | ||||
#endif | ||||
#else | ||||
#define RASQAL_DEPRECATED | ||||
#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 | |||
/* Public statics */ | /* Public statics */ | |||
extern const char * const rasqal_short_copyright_string; | extern const char * const rasqal_short_copyright_string; | |||
extern const char * const rasqal_copyright_string; | extern const char * const rasqal_copyright_string; | |||
extern const char * const rasqal_version_string; | extern const char * const rasqal_version_string; | |||
extern const unsigned int rasqal_version_major; | extern const unsigned int rasqal_version_major; | |||
extern const unsigned int rasqal_version_minor; | extern const unsigned int rasqal_version_minor; | |||
extern const unsigned int rasqal_version_release; | extern const unsigned int rasqal_version_release; | |||
extern const unsigned int rasqal_version_decimal; | extern const unsigned int rasqal_version_decimal; | |||
/* Public structure */ | /* Public structure */ | |||
typedef struct rasqal_query_s rasqal_query; | typedef struct rasqal_query_s rasqal_query; | |||
typedef struct rasqal_query_results_s rasqal_query_results; | typedef struct rasqal_query_results_s rasqal_query_results; | |||
typedef struct rasqal_literal_s rasqal_literal; | typedef struct rasqal_literal_s rasqal_literal; | |||
typedef struct rasqal_graph_pattern_s rasqal_graph_pattern; | ||||
typedef enum { | typedef enum { | |||
RASQAL_FEATURE_LAST | RASQAL_FEATURE_LAST | |||
} rasqal_feature; | } rasqal_feature; | |||
typedef struct { | typedef struct { | |||
const unsigned char *prefix; | const unsigned char *prefix; | |||
raptor_uri* uri; | raptor_uri* uri; | |||
int declared; | int declared; | |||
int depth; | int depth; | |||
skipping to change at line 147 | skipping to change at line 162 | |||
RASQAL_EXPR_STAR, | RASQAL_EXPR_STAR, | |||
RASQAL_EXPR_SLASH, | RASQAL_EXPR_SLASH, | |||
RASQAL_EXPR_REM, | RASQAL_EXPR_REM, | |||
RASQAL_EXPR_STR_EQ, | RASQAL_EXPR_STR_EQ, | |||
RASQAL_EXPR_STR_NEQ, | RASQAL_EXPR_STR_NEQ, | |||
RASQAL_EXPR_STR_MATCH, | RASQAL_EXPR_STR_MATCH, | |||
RASQAL_EXPR_STR_NMATCH, | RASQAL_EXPR_STR_NMATCH, | |||
RASQAL_EXPR_TILDE, | RASQAL_EXPR_TILDE, | |||
RASQAL_EXPR_BANG, | RASQAL_EXPR_BANG, | |||
RASQAL_EXPR_LITERAL, | RASQAL_EXPR_LITERAL, | |||
RASQAL_EXPR_PATTERN, | ||||
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_LAST= RASQAL_EXPR_ISLITERAL | |||
} rasqal_op; | } rasqal_op; | |||
skipping to change at line 196 | skipping to change at line 213 | |||
/* an RDF triple or a triple pattern */ | /* an RDF triple or a triple pattern */ | |||
typedef struct { | typedef struct { | |||
rasqal_literal* subject; | rasqal_literal* subject; | |||
rasqal_literal* predicate; | rasqal_literal* predicate; | |||
rasqal_literal* object; | rasqal_literal* object; | |||
rasqal_literal* origin; | rasqal_literal* origin; | |||
unsigned int flags; /* | of enum rasqal_triple_flags bits */ | unsigned int flags; /* | of enum rasqal_triple_flags bits */ | |||
} rasqal_triple ; | } rasqal_triple ; | |||
/* Flags for graph patterns */ | ||||
typedef enum { | ||||
/* true when the graph pattern is an optional match */ | ||||
RASQAL_PATTERN_FLAGS_OPTIONAL=1, | ||||
RASQAL_PATTERN_FLAGS_LAST=RASQAL_PATTERN_FLAGS_OPTIONAL | ||||
} rasqal_pattern_flags; | ||||
/* RASQAL API */ | /* RASQAL API */ | |||
/* Public functions */ | /* Public functions */ | |||
RASQAL_API void rasqal_init(void); | RASQAL_API void rasqal_init(void); | |||
RASQAL_API void rasqal_finish(void); | RASQAL_API void rasqal_finish(void); | |||
RASQAL_API int rasqal_languages_enumerate(const unsigned int counter, const char **name, const char **label, const unsigned char **uri_string); | RASQAL_API int rasqal_languages_enumerate(const unsigned int counter, const char **name, const char **label, const unsigned char **uri_string); | |||
RASQAL_API int rasqal_language_name_check(const char *name); | RASQAL_API int rasqal_language_name_check(const char *name); | |||
skipping to change at line 221 | skipping to change at line 246 | |||
RASQAL_API void rasqal_free_query(rasqal_query* query); | RASQAL_API void rasqal_free_query(rasqal_query* query); | |||
/* Methods */ | /* Methods */ | |||
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_limit(rasqal_query *query); | ||||
RASQAL_API void rasqal_query_add_source(rasqal_query* query, raptor_uri* ur i); | RASQAL_API void rasqal_query_add_source(rasqal_query* query, raptor_uri* ur i); | |||
RASQAL_API raptor_sequence* rasqal_query_get_source_sequence(rasqal_query* query); | RASQAL_API raptor_sequence* rasqal_query_get_source_sequence(rasqal_query* query); | |||
RASQAL_API raptor_uri* rasqal_query_get_source(rasqal_query* query, int idx ); | RASQAL_API raptor_uri* rasqal_query_get_source(rasqal_query* query, 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 raptor_sequence* rasqal_query_get_variable_sequence(rasqal_query | RASQAL_API RASQAL_DEPRECATED raptor_sequence* rasqal_query_get_variable_seq | |||
* query); | uence(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 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 void rasqal_query_add_triple(rasqal_query* query, rasqal_triple* triple); | 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 ression* expr); | RASQAL_API void rasqal_query_add_constraint(rasqal_query* query, rasqal_exp ression* expr); | |||
RASQAL_API raptor_sequence* rasqal_query_get_constraint_sequence(rasqal_que ry* query); | RASQAL_API raptor_sequence* rasqal_query_get_constraint_sequence(rasqal_que ry* query); | |||
RASQAL_API rasqal_expression* rasqal_query_get_constraint(rasqal_query* que ry, int idx); | RASQAL_API rasqal_expression* rasqal_query_get_constraint(rasqal_query* que ry, 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 */ | ||||
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_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 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 void rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* | ||||
fh); | ||||
/* 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 272 | skipping to change at line 311 | |||
/* Boolean result format */ | /* Boolean result format */ | |||
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); | |||
RAPTOR_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); | |||
/* 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 void rasqal_free_expression(rasqal_expression* expr); | RASQAL_API void rasqal_free_expression(rasqal_expression* expr); | |||
skipping to change at line 391 | skipping to change at line 430 | |||
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); | |||
}; | }; | |||
typedef struct rasqal_triples_source_s rasqal_triples_source; | typedef struct rasqal_triples_source_s rasqal_triples_source; | |||
typedef struct { | typedef struct { | |||
void *user_data; /* user data for triples_source_factory */ | void *user_data; /* user data for triples_source_factory */ | |||
size_t user_data_size; /* size of user data for new_triples_source */ | size_t user_data_size; /* size of user data for new_triples_source */ | |||
/** | ||||
* create a new triples source - returns non-zero on failure | ||||
* < 0 is a 'no rdf data error', > 0 is an unspecified error | ||||
*/ | ||||
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); | |||
} rasqal_triples_source_factory; | } rasqal_triples_source_factory; | |||
/* set the triples_source_factory */ | /* set the triples_source_factory */ | |||
RASQAL_API void rasqal_set_triples_source_factory(void (*register_fn)(rasqa l_triples_source_factory *factory), void* user_data); | RASQAL_API void rasqal_set_triples_source_factory(void (*register_fn)(rasqa l_triples_source_factory *factory), void* user_data); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
6 lines changed or deleted | 56 lines changed or added | |||