rasqal.h   rasqal.h 
/* -*- Mode: c; c-basic-offset: 2 -*- /* -*- Mode: c; c-basic-offset: 2 -*-
* *
* rdql.h - Rasqal RDF Query library interfaces and definition * rdql.h - Rasqal RDF Query library interfaces and definition
* *
* $Id: rasqal.h,v 1.54 2004/06/01 19:50:47 cmdjb Exp $ * $Id: rasqal.h,v 1.55 2004/08/03 14:05:09 cmdjb Exp $
* *
* Copyright (C) 2003-2004 David Beckett - http://purl.org/net/dajobe/ * Copyright (C) 2003-2004 David Beckett - http://purl.org/net/dajobe/
* Institute for Learning and Research Technology - http://www.ilrt.bris.ac .uk/ * Institute for Learning and Research Technology - http://www.ilrt.bris.ac .uk/
* University of Bristol - http://www.bristol.ac.uk/ * University of Bristol - http://www.bristol.ac.uk/
* *
* This package is Free Software or Open Source available under the * This package is Free Software or Open Source available under the
* following licenses (these are alternatives): * following licenses (these are alternatives):
* 1. GNU Lesser General Public License (LGPL) * 1. GNU Lesser General Public License (LGPL)
* 2. GNU General Public License (GPL) * 2. GNU General Public License (GPL)
* 3. Mozilla Public License (MPL) * 3. Mozilla Public License (MPL)
skipping to change at line 60 skipping to change at line 60
/* 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 enum { typedef enum {
RASQAL_FEATURE_LAST RASQAL_FEATURE_LAST
} rasqal_feature; } rasqal_feature;
typedef struct { typedef struct {
const char *prefix; const unsigned char *prefix;
raptor_uri* uri; raptor_uri* uri;
} rasqal_prefix ; } rasqal_prefix ;
/* variable binding */ /* variable binding */
typedef struct { typedef struct {
const 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_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,
skipping to change at line 88 skipping to change at line 88
RASQAL_LITERAL_BOOLEAN, RASQAL_LITERAL_BOOLEAN,
RASQAL_LITERAL_INTEGER, RASQAL_LITERAL_INTEGER,
RASQAL_LITERAL_FLOATING, RASQAL_LITERAL_FLOATING,
RASQAL_LITERAL_VARIABLE, RASQAL_LITERAL_VARIABLE,
RASQAL_LITERAL_LAST= RASQAL_LITERAL_VARIABLE RASQAL_LITERAL_LAST= RASQAL_LITERAL_VARIABLE
} rasqal_literal_type; } rasqal_literal_type;
struct rasqal_literal_s { struct rasqal_literal_s {
int usage; int usage;
rasqal_literal_type type; rasqal_literal_type type;
char *string; /* string, pattern, qname, blank, float types */ const unsigned char *string; /* UTF-8 string, pattern, qname, blank, floa t types */
union { union {
int integer; /* integer and boolean types */ int integer; /* integer and boolean types */
double floating; /* floating */ double floating; /* floating */
raptor_uri* uri; /* uri */ raptor_uri* uri; /* uri */
rasqal_variable* variable; /* variable */ rasqal_variable* variable; /* variable */
} value; } value;
char *language; /* for string */ const char *language; /* for string */
raptor_uri *datatype; /* for string */ raptor_uri *datatype; /* for string */
char *flags; /* for pattern; used as datatype qname for string */ const unsigned char *flags; /* for pattern; used as datatype qname for string */
}; };
typedef enum { typedef enum {
RASQAL_EXPR_UNKNOWN, RASQAL_EXPR_UNKNOWN,
RASQAL_EXPR_AND, RASQAL_EXPR_AND,
RASQAL_EXPR_OR, RASQAL_EXPR_OR,
RASQAL_EXPR_EQ, RASQAL_EXPR_EQ,
RASQAL_EXPR_NEQ, RASQAL_EXPR_NEQ,
RASQAL_EXPR_LT, RASQAL_EXPR_LT,
RASQAL_EXPR_GT, RASQAL_EXPR_GT,
skipping to change at line 137 skipping to change at line 137
/* 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;
char *value; unsigned char *value; /* UTF-8 value */
}; };
typedef struct rasqal_expression_s rasqal_expression; typedef struct rasqal_expression_s rasqal_expression;
/* three expressions */ /* three expressions */
typedef struct { typedef struct {
rasqal_literal* subject; rasqal_literal* subject;
rasqal_literal* predicate; rasqal_literal* predicate;
rasqal_literal* object; rasqal_literal* object;
} rasqal_triple ; } rasqal_triple ;
skipping to change at line 179 skipping to change at line 179
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 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 * query); RASQAL_API raptor_sequence* rasqal_query_get_variable_sequence(rasqal_query * 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 char *n RASQAL_API int rasqal_query_has_variable(rasqal_query* query, const unsigne
ame); d char *name);
RASQAL_API int rasqal_query_set_variable(rasqal_query* query, const char *n RASQAL_API int rasqal_query_set_variable(rasqal_query* query, const unsigne
ame, rasqal_literal* value); d char *name, rasqal_literal* value);
RASQAL_API void rasqal_query_add_triple(rasqal_query* query, rasqal_triple* triple); RASQAL_API void rasqal_query_add_triple(rasqal_query* query, 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);
skipping to change at line 207 skipping to change at line 207
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);
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 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 char* rasqal_query_results_get_binding_name(rasqal_query_r RASQAL_API const unsigned char* rasqal_query_results_get_binding_name(rasqa
esults *query_results, int offset); l_query_results *query_results, int offset);
RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value_by_name(r RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value_by_name(r
asqal_query_results *query_results, const char *name); 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);
/* 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 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);
RASQAL_API rasqal_literal* rasqal_new_floating_literal(const char *string); RASQAL_API rasqal_literal* rasqal_new_floating_literal(const unsigned char *string);
RASQAL_API rasqal_literal* rasqal_new_uri_literal(raptor_uri* uri); RASQAL_API rasqal_literal* rasqal_new_uri_literal(raptor_uri* uri);
RASQAL_API rasqal_literal* rasqal_new_pattern_literal(char *pattern, char * RASQAL_API rasqal_literal* rasqal_new_pattern_literal(const unsigned char *
flags); pattern, const char *flags);
RASQAL_API rasqal_literal* rasqal_new_string_literal(char *string, char *la RASQAL_API rasqal_literal* rasqal_new_string_literal(const unsigned char *s
nguage, raptor_uri *datatype, char *datatype_qname); tring, const char *language, raptor_uri *datatype, const unsigned char *dat
RASQAL_API rasqal_literal* rasqal_new_simple_literal(rasqal_literal_type ty atype_qname);
pe, char *string); RASQAL_API rasqal_literal* rasqal_new_simple_literal(rasqal_literal_type ty
pe, const unsigned char *string);
RASQAL_API rasqal_literal* rasqal_new_boolean_literal(int value); RASQAL_API rasqal_literal* rasqal_new_boolean_literal(int value);
RASQAL_API rasqal_literal* rasqal_new_variable_literal(rasqal_variable *var iable); RASQAL_API rasqal_literal* rasqal_new_variable_literal(rasqal_variable *var iable);
RASQAL_API rasqal_literal* rasqal_new_literal_from_literal(rasqal_literal* literal); RASQAL_API rasqal_literal* rasqal_new_literal_from_literal(rasqal_literal* literal);
RASQAL_API void rasqal_free_literal(rasqal_literal* literal); RASQAL_API void rasqal_free_literal(rasqal_literal* literal);
RASQAL_API void rasqal_literal_print(rasqal_literal* literal, FILE* fh); RASQAL_API void rasqal_literal_print(rasqal_literal* literal, FILE* fh);
RASQAL_API rasqal_variable* rasqal_literal_as_variable(rasqal_literal* lite ral); RASQAL_API rasqal_variable* rasqal_literal_as_variable(rasqal_literal* lite ral);
RASQAL_API char* rasqal_literal_as_string(rasqal_literal* literal); RASQAL_API const unsigned char* rasqal_literal_as_string(rasqal_literal* li teral);
RASQAL_API rasqal_literal* rasqal_literal_as_node(rasqal_literal* literal); RASQAL_API rasqal_literal* rasqal_literal_as_node(rasqal_literal* literal);
#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 char* prefix, raptor_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 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);
/* Variable class */ /* Variable class */
RASQAL_API rasqal_variable* rasqal_new_variable(rasqal_query* query, const 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);
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);
/* rasqal_engine.c */ /* rasqal_engine.c */
struct rasqal_triples_match_s { struct rasqal_triples_match_s {
void *user_data; void *user_data;
int (*bind_match)(struct rasqal_triples_match_s*, void *user_data, rasqal _variable *bindings[3]); int (*bind_match)(struct rasqal_triples_match_s*, void *user_data, rasqal _variable *bindings[3]);
void (*next_match)(struct rasqal_triples_match_s*, void *user_data); void (*next_match)(struct rasqal_triples_match_s*, void *user_data);
 End of changes. 15 change blocks. 
26 lines changed or deleted 27 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/