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.109 2005/05/19 21:44:59 cmdjb Exp $ | * $Id: rasqal.h,v 1.112 2005/06/08 16:20:24 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 192 | skipping to change at line 192 | |||
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_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_ORDER_COND_NONE, | RASQAL_EXPR_LAST= RASQAL_EXPR_ORDER_COND_DESC | |||
RASQAL_EXPR_LAST= RASQAL_EXPR_ORDER_COND_NONE | ||||
} 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; | |||
skipping to change at line 257 | skipping to change at line 256 | |||
typedef enum { | typedef enum { | |||
RASQAL_QUERY_VERB_UNKNOWN = 0, | RASQAL_QUERY_VERB_UNKNOWN = 0, | |||
RASQAL_QUERY_VERB_SELECT = 1, | RASQAL_QUERY_VERB_SELECT = 1, | |||
RASQAL_QUERY_VERB_CONSTRUCT = 2, | RASQAL_QUERY_VERB_CONSTRUCT = 2, | |||
RASQAL_QUERY_VERB_DESCRIBE = 3, | RASQAL_QUERY_VERB_DESCRIBE = 3, | |||
RASQAL_QUERY_VERB_ASK = 4, | RASQAL_QUERY_VERB_ASK = 4, | |||
RASQAL_QUERY_VERB_LAST=RASQAL_QUERY_VERB_ASK | RASQAL_QUERY_VERB_LAST=RASQAL_QUERY_VERB_ASK | |||
} rasqal_query_verb; | } rasqal_query_verb; | |||
/* Graph pattern operators */ | ||||
typedef enum { | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN = 0, | ||||
/* Basic - just triple patterns and constraints */ | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_BASIC = 1, | ||||
/* Optional - set of graph patterns (ANDed) and constraints */ | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL = 2, | ||||
/* Union - set of graph patterns (UNIONed) and constraints */ | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_UNION = 3, | ||||
/* Group - set of graph patterns (ANDed) and constraints */ | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_GROUP = 4, | ||||
/* Graph - a graph term + a graph pattern and constraints */ | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH = 5, | ||||
RASQAL_GRAPH_PATTERN_OPERATOR_LAST=RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH | ||||
} rasqal_graph_pattern_operator; | ||||
/* 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 293 | skipping to change at line 309 | |||
RASQAL_API rasqal_query_verb rasqal_query_get_verb(rasqal_query *query); | RASQAL_API rasqal_query_verb rasqal_query_get_verb(rasqal_query *query); | |||
RASQAL_API int rasqal_query_get_wildcard(rasqal_query *query); | RASQAL_API int rasqal_query_get_wildcard(rasqal_query *query); | |||
RASQAL_API int rasqal_query_get_distinct(rasqal_query *query); | RASQAL_API int rasqal_query_get_distinct(rasqal_query *query); | |||
RASQAL_API void rasqal_query_set_distinct(rasqal_query *query, int is_disti nct); | RASQAL_API void rasqal_query_set_distinct(rasqal_query *query, int is_disti nct); | |||
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_set_limit(rasqal_query *query, int limit); | RASQAL_API void rasqal_query_set_limit(rasqal_query *query, int limit); | |||
RASQAL_API int rasqal_query_get_offset(rasqal_query *query); | RASQAL_API int rasqal_query_get_offset(rasqal_query *query); | |||
RASQAL_API void rasqal_query_set_offset(rasqal_query *query, int limit); | RASQAL_API void rasqal_query_set_offset(rasqal_query *query, int limit); | |||
RASQAL_API RASQAL_DEPRECATED void rasqal_query_add_source(rasqal_query* que | ||||
ry, raptor_uri* uri); | ||||
RASQAL_API RASQAL_DEPRECATED raptor_sequence* rasqal_query_get_source_seque | ||||
nce(rasqal_query* query); | ||||
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 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 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 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 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 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 RASQAL_DEPRECATED void rasqal_query_add_constraint(rasqal_query* | ||||
query, rasqal_expression* expr); | ||||
RASQAL_API RASQAL_DEPRECATED raptor_sequence* rasqal_query_get_constraint_s | ||||
equence(rasqal_query* query); | ||||
RASQAL_API RASQAL_DEPRECATED rasqal_expression* rasqal_query_get_constraint | ||||
(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); | |||
RASQAL_API raptor_sequence* rasqal_query_get_order_conditions_sequence(rasq al_query* query); | RASQAL_API raptor_sequence* rasqal_query_get_order_conditions_sequence(rasq al_query* query); | |||
RASQAL_API rasqal_expression* rasqal_query_get_order_condition(rasqal_query * query, int idx); | RASQAL_API rasqal_expression* rasqal_query_get_order_condition(rasqal_query * query, int idx); | |||
/* graph patterns */ | /* graph patterns */ | |||
RASQAL_API rasqal_graph_pattern* rasqal_query_get_query_graph_pattern(rasqa l_query* query); | RASQAL_API rasqal_graph_pattern* rasqal_query_get_query_graph_pattern(rasqa l_query* query); | |||
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 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 | RASQAL_API RASQAL_DEPRECATED int rasqal_graph_pattern_get_flags(rasqal_grap | |||
attern); | h_pattern* graph_pattern); | |||
RASQAL_API rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator( | ||||
rasqal_graph_pattern* graph_pattern); | ||||
RASQAL_API const char* rasqal_graph_pattern_operator_as_string(rasqal_graph | ||||
_pattern_operator verb); | ||||
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 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 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); | RASQAL_API rasqal_expression* rasqal_graph_pattern_get_constraint(rasqal_gr aph_pattern* gp, int idx); | |||
RASQAL_API raptor_sequence* rasqal_query_get_construct_triples_sequence(ras qal_query* query); | RASQAL_API raptor_sequence* rasqal_query_get_construct_triples_sequence(ras qal_query* query); | |||
RASQAL_API rasqal_triple* rasqal_query_get_construct_triple(rasqal_query* q uery, int idx); | RASQAL_API rasqal_triple* rasqal_query_get_construct_triple(rasqal_query* q uery, int idx); | |||
/* Utility methods */ | /* Utility methods */ | |||
RASQAL_API const char* rasqal_query_verb_as_string(rasqal_query_verb verb); | RASQAL_API const char* rasqal_query_verb_as_string(rasqal_query_verb verb); | |||
RASQAL_API void rasqal_query_print(rasqal_query* query, FILE *stream); | RASQAL_API void rasqal_query_print(rasqal_query* query, FILE *stream); | |||
skipping to change at line 423 | skipping to change at line 435 | |||
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 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 RASQAL_DEPRECATED void rasqal_triple_set_flags(rasqal_triple* t, | ||||
unsigned int flags); | ||||
RASQAL_API RASQAL_DEPRECATED unsigned int rasqal_triple_get_flags(rasqal_tr | ||||
iple* t); | ||||
/* Variable class */ | /* Variable class */ | |||
RASQAL_API rasqal_variable* rasqal_new_variable_typed(rasqal_query* rq, ras qal_variable_type type, unsigned char *name, rasqal_literal *value); | RASQAL_API rasqal_variable* rasqal_new_variable_typed(rasqal_query* rq, ras qal_variable_type type, unsigned char *name, rasqal_literal *value); | |||
RASQAL_API rasqal_variable* rasqal_new_variable(rasqal_query* query, unsign ed char *name, rasqal_literal *value); | RASQAL_API rasqal_variable* rasqal_new_variable(rasqal_query* query, unsign ed char *name, rasqal_literal *value); | |||
RASQAL_API void rasqal_free_variable(rasqal_variable* variable); | RASQAL_API void rasqal_free_variable(rasqal_variable* variable); | |||
RASQAL_API void rasqal_variable_print(rasqal_variable* t, FILE* fh); | RASQAL_API void rasqal_variable_print(rasqal_variable* t, FILE* fh); | |||
RASQAL_API void rasqal_variable_set_value(rasqal_variable* v, rasqal_litera l *l); | RASQAL_API void rasqal_variable_set_value(rasqal_variable* v, rasqal_litera l *l); | |||
/* memory functions */ | /* memory functions */ | |||
RASQAL_API void rasqal_free_memory(void *ptr); | RASQAL_API void rasqal_free_memory(void *ptr); | |||
skipping to change at line 489 | skipping to change at line 499 | |||
/* non-0 if all parts of the triple are given */ | /* non-0 if all parts of the triple are given */ | |||
int is_exact; | int is_exact; | |||
} rasqal_triple_meta; | } rasqal_triple_meta; | |||
struct rasqal_triples_source_s { | struct rasqal_triples_source_s { | |||
/* A source for this query */ | /* A source for this query */ | |||
rasqal_query *query; | rasqal_query *query; | |||
void *user_data; | void *user_data; | |||
/* DEPRECATED METHOD */ | ||||
rasqal_triples_match* (*new_triples_match)(struct rasqal_triples_source_s | ||||
* rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t); | ||||
/* the triples_source_factory initialises these method */ | /* the triples_source_factory initialises these method */ | |||
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); | |||
}; | }; | |||
typedef struct rasqal_triples_source_s rasqal_triples_source; | typedef struct rasqal_triples_source_s rasqal_triples_source; | |||
typedef struct { | typedef struct { | |||
End of changes. 8 change blocks. | ||||
25 lines changed or deleted | 25 lines changed or added | |||