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 * rasqal.h - Rasqal RDF Query library interfaces and definition
* *
* $Id: rasqal.h,v 1.65 2004/10/25 14:00:36 cmdjb Exp $ * $Id: rasqal.h,v 1.75 2005/01/15 22:53:44 cmdjb Exp $
* *
* Copyright (C) 2003-2004, 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
* 3. Apache License, V2.0 or any newer version * 3. Apache License, V2.0 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
#ifndef LIBRDF_OBJC_FRAMEWORK
#include <raptor.h> #include <raptor.h>
#else
#include <Redland/raptor.h>
#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;
skipping to change at line 130 skipping to change at line 134
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,
RASQAL_EXPR_LE, RASQAL_EXPR_LE,
RASQAL_EXPR_GE, RASQAL_EXPR_GE,
RASQAL_EXPR_UMINUS,
RASQAL_EXPR_PLUS, RASQAL_EXPR_PLUS,
RASQAL_EXPR_MINUS, RASQAL_EXPR_MINUS,
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,
skipping to change at line 161 skipping to change at line 166
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 */
}; };
typedef struct rasqal_expression_s rasqal_expression; typedef struct rasqal_expression_s rasqal_expression;
/* three expressions */ /* Extra flags for triples */
typedef enum {
/* true when all of subject, predicate, object are given */
RASQAL_TRIPLE_FLAGS_EXACT=1,
/* true when the triple is an optional match */
RASQAL_TRIPLE_FLAGS_OPTIONAL=2,
RASQAL_TRIPLE_FLAGS_LAST=RASQAL_TRIPLE_FLAGS_OPTIONAL
} rasqal_triple_flags;
/* 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 */
} rasqal_triple ; } rasqal_triple ;
/* 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);
skipping to change at line 233 skipping to change at line 248
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 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);
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 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 unsigned char *string); RASQAL_API rasqal_literal* rasqal_new_floating_literal(double f);
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(const unsigned char * pattern, const char *flags); RASQAL_API rasqal_literal* rasqal_new_pattern_literal(const unsigned char * pattern, const char *flags);
RASQAL_API rasqal_literal* rasqal_new_string_literal(const unsigned char *s tring, const char *language, raptor_uri *datatype, const unsigned char *dat atype_qname); RASQAL_API rasqal_literal* rasqal_new_string_literal(const unsigned char *s tring, const char *language, raptor_uri *datatype, const unsigned char *dat atype_qname);
RASQAL_API rasqal_literal* rasqal_new_simple_literal(rasqal_literal_type ty pe, const unsigned 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);
skipping to change at line 280 skipping to change at line 296
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 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 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);
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 */
typedef enum {
RASQAL_TRIPLE_SUBJECT = 1,
RASQAL_TRIPLE_PREDICATE= 2,
RASQAL_TRIPLE_OBJECT = 4,
RASQAL_TRIPLE_ORIGIN = 8
} rasqal_triple_parts;
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[4]); /* the [4]array (s,p,o,origin) bindings against the current triple match
* only touching triple parts given.
* returns parts that were bound or 0 on failure
*/
rasqal_triple_parts (*bind_match)(struct rasqal_triples_match_s*, void *u
ser_data, rasqal_variable *bindings[4], rasqal_triple_parts parts);
/* move to next match */
void (*next_match)(struct rasqal_triples_match_s*, void *user_data); void (*next_match)(struct rasqal_triples_match_s*, void *user_data);
/* check for end of triple match - return non-0 if is end */
int (*is_end)(struct rasqal_triples_match_s*, void *user_data); int (*is_end)(struct rasqal_triples_match_s*, void *user_data);
/* finish triples match and destroy any allocated memory */
void (*finish)(struct rasqal_triples_match_s*, void *user_data); void (*finish)(struct rasqal_triples_match_s*, void *user_data);
}; };
typedef struct rasqal_triples_match_s rasqal_triples_match; typedef struct rasqal_triples_match_s rasqal_triples_match;
typedef struct typedef struct
{ {
/* All the parts of this triple are nodes - no variables */ /* triple (subject, predicate, object) and origin */
int is_exact;
/* triple (subject, predicate, object) and origin (SOURCE in BRQL) */
rasqal_variable* bindings[4]; rasqal_variable* bindings[4];
rasqal_triples_match *triples_match; rasqal_triples_match *triples_match;
void *context; void *context;
/* parts of the triple*/
rasqal_triple_parts parts;
} 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;
/* the triples_source_factory initialises these method */ /* the triples_source_factory initialises these method */
rasqal_triples_match* (*new_triples_match)(struct rasqal_triples_source_s * rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t); rasqal_triples_match* (*new_triples_match)(struct rasqal_triples_source_s * rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t);
 End of changes. 17 change blocks. 
11 lines changed or deleted 48 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/