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.75 2005/01/15 22:53:44 cmdjb Exp $ | * $Id: rasqal.h,v 1.81 2005/02/03 15:04:23 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 148 | skipping to change at line 148 | |||
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_PATTERN, | |||
RASQAL_EXPR_LAST= RASQAL_EXPR_PATTERN | 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_LAST= RASQAL_EXPR_ISLITERAL | ||||
} 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...) */ | ||||
raptor_uri* name; | ||||
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, | |||
/* true when the triple is an optional match */ | /* true when the triple is an optional match */ | |||
RASQAL_TRIPLE_FLAGS_OPTIONAL=2, | RASQAL_TRIPLE_FLAGS_OPTIONAL=2, | |||
RASQAL_TRIPLE_FLAGS_LAST=RASQAL_TRIPLE_FLAGS_OPTIONAL | RASQAL_TRIPLE_FLAGS_LAST=RASQAL_TRIPLE_FLAGS_OPTIONAL | |||
skipping to change at line 239 | skipping to change at line 251 | |||
/* 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); | |||
/* query results */ | /* query results */ | |||
RASQAL_API void rasqal_free_query_results(rasqal_query_results *query_resul ts); | RASQAL_API void rasqal_free_query_results(rasqal_query_results *query_resul ts); | |||
/* Bindings result format */ | ||||
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_r esults); | RASQAL_API int rasqal_query_results_get_count(rasqal_query_results *query_r esults); | |||
RASQAL_API int rasqal_query_results_next(rasqal_query_results *query_result s); | RASQAL_API int rasqal_query_results_next(rasqal_query_results *query_result s); | |||
RASQAL_API int rasqal_query_results_finished(rasqal_query_results *query_re sults); | RASQAL_API int rasqal_query_results_finished(rasqal_query_results *query_re sults); | |||
RASQAL_API int rasqal_query_results_get_bindings(rasqal_query_results *quer y_results, const unsigned char ***names, rasqal_literal ***values); | RASQAL_API int rasqal_query_results_get_bindings(rasqal_query_results *quer y_results, const unsigned char ***names, rasqal_literal ***values); | |||
RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value(rasqal_qu ery_results *query_results, int offset); | RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value(rasqal_qu ery_results *query_results, int offset); | |||
RASQAL_API const unsigned char* rasqal_query_results_get_binding_name(rasqa l_query_results *query_results, int offset); | RASQAL_API const unsigned char* rasqal_query_results_get_binding_name(rasqa l_query_results *query_results, int offset); | |||
RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value_by_name(r asqal_query_results *query_results, const unsigned char *name); | RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value_by_name(r asqal_query_results *query_results, const unsigned char *name); | |||
RASQAL_API int rasqal_query_results_get_bindings_count(rasqal_query_results *query_results); | RASQAL_API int rasqal_query_results_get_bindings_count(rasqal_query_results *query_results); | |||
/* 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_re | ||||
sults); | ||||
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); | ||||
RAPTOR_API int rasqal_query_results_write(raptor_iostream *iostr, rasqal_qu ery_results *results, raptor_uri *format_uri, raptor_uri *base_uri); | RAPTOR_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 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); | |||
skipping to change at line 292 | skipping to change at line 317 | |||
#define RASQAL_COMPARE_NOCASE 1 | #define RASQAL_COMPARE_NOCASE 1 | |||
RASQAL_API int rasqal_literal_compare(rasqal_literal* l1, rasqal_literal* l 2, int flags, int *error); | RASQAL_API int rasqal_literal_compare(rasqal_literal* l1, rasqal_literal* l 2, int flags, int *error); | |||
RASQAL_API int rasqal_literal_equals(rasqal_literal* l1, rasqal_literal* l2 ); | RASQAL_API int rasqal_literal_equals(rasqal_literal* l1, rasqal_literal* l2 ); | |||
RASQAL_API rasqal_prefix* rasqal_new_prefix(const unsigned char* prefix, ra ptor_uri* uri); | RASQAL_API rasqal_prefix* rasqal_new_prefix(const unsigned char* prefix, ra ptor_uri* uri); | |||
RASQAL_API void rasqal_free_prefix(rasqal_prefix* prefix); | RASQAL_API void rasqal_free_prefix(rasqal_prefix* prefix); | |||
RASQAL_API void rasqal_prefix_print(rasqal_prefix* p, FILE* fh); | RASQAL_API void rasqal_prefix_print(rasqal_prefix* p, FILE* fh); | |||
/* Triple class */ | /* Triple class */ | |||
RASQAL_API rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal _literal* predicate, rasqal_literal* object); | RASQAL_API rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal _literal* predicate, rasqal_literal* object); | |||
RASQAL_API rasqal_triple* rasqal_new_triple_from_triple(rasqal_triple* t); | ||||
RASQAL_API void rasqal_free_triple(rasqal_triple* t); | RASQAL_API void rasqal_free_triple(rasqal_triple* t); | |||
RASQAL_API void rasqal_triple_print(rasqal_triple* t, FILE* fh); | RASQAL_API void rasqal_triple_print(rasqal_triple* t, FILE* fh); | |||
RASQAL_API void rasqal_triple_set_origin(rasqal_triple* t, rasqal_literal * l); | RASQAL_API void rasqal_triple_set_origin(rasqal_triple* t, rasqal_literal * l); | |||
RASQAL_API rasqal_literal* rasqal_triple_get_origin(rasqal_triple* t); | RASQAL_API rasqal_literal* rasqal_triple_get_origin(rasqal_triple* t); | |||
RASQAL_API void rasqal_triple_set_flags(rasqal_triple* t, unsigned int flag s); | RASQAL_API void rasqal_triple_set_flags(rasqal_triple* t, unsigned int flag s); | |||
RASQAL_API unsigned int rasqal_triple_get_flags(rasqal_triple* t); | RASQAL_API unsigned int rasqal_triple_get_flags(rasqal_triple* t); | |||
/* Variable class */ | /* Variable class */ | |||
RASQAL_API rasqal_variable* rasqal_new_variable(rasqal_query* query, const unsigned char *name, rasqal_literal *value); | RASQAL_API rasqal_variable* rasqal_new_variable(rasqal_query* query, const unsigned char *name, rasqal_literal *value); | |||
RASQAL_API void rasqal_free_variable(rasqal_variable* variable); | RASQAL_API void rasqal_free_variable(rasqal_variable* variable); | |||
End of changes. 8 change blocks. | ||||
3 lines changed or deleted | 35 lines changed or added | |||