Skip to content
Browse files

Kill support for Raptor V1

  • Loading branch information...
1 parent c5183b7 commit 15dd8f533a32e868df1062ff276c0013a01a012c @dajobe committed Jan 4, 2011
View
12 INSTALL.html
@@ -160,18 +160,6 @@
</p>
</dd>
-<dt><tt>--enable-raptor2</tt><br /></dt>
-<dd><p>Build raptor against the
-beta <a href="http://librdf.org/raptor/">Raptor</a>
-V2 APIs (libraptor2) rather than the default V1 APIs (libraptor). This
-is a developer option for testing against the raptor 2 beta APIs. In
-some future version, this will be the default and rasqal will depend
-on raptor2. When rasqal is built in this way and librdf is built
-against it, librdf also has to be built with a configure
-<code>--enable-raptor</code> option.
-</p>
-</dd>
-
<dt><tt>--with-memory-signing</tt><br /></dt>
<dd><p>Enable signing of memory allocations so that when memory is
allocated with malloc() and released free(), a check is made that the
View
122 configure.ac
@@ -305,110 +305,29 @@ if test $have_tm_gmtoff = "yes" ; then
fi
-# raptor is REQUIRED despite the checking here
-RAPTOR_MIN_VERSION=1.4.19
-RAPTOR_MAX_VERSION=1.8.99
-RAPTOR2_MIN_VERSION=1.9.2
+# raptor V2 is REQUIRED; --enable-raptor2 option was removed
+RAPTOR_MIN_VERSION=1.9.2
-raptor2=no
-AC_ARG_ENABLE(raptor2, [ --enable-raptor2 Enable use of raptor2], raptor2="$enableval", raptor2="no")
-
-AC_SUBST(RAPTOR_MIN_VERSION)
-AC_SUBST(RAPTOR_MAX_VERSION)
AC_CHECK_PROGS(PKG_CONFIG, pkg-config)
if test "X$PKG_CONFIG" = X; then
- AC_MSG_WARN(pkg-config not found. configuring raptor 2.0 will require it. Get it from http://pkg-config.freedesktop.org/)
+ AC_MSG_ERROR(pkg-config not found. configuring raptor V2 requires it. Get it from http://pkg-config.freedesktop.org/)
fi
AC_MSG_CHECKING(for raptor)
-RAPTOR_VERSION_DEC=0
-if test "X$PKG_CONFIG" != X; then
- # When raptor2 is stable, this can be changed to prefer raptor2
- # For now an explicit configure --enable-raptor2 is required.
- if test "X$raptor2" = "Xyes"; then
- RAPTOR_MIN_VERSION=$RAPTOR2_MIN_VERSION
-
- if $PKG_CONFIG raptor2 --exists; then
- RAPTOR_CONFIG="$PKG_CONFIG raptor2"
- RAPTOR_PACKAGE="raptor2"
- else
- AC_MSG_ERROR(Raptor2 is not installed - see http://librdf.org/raptor/ to get a version newer than $RAPTOR_MIN_VERSION)
- fi
- else
- if $PKG_CONFIG raptor --exists; then
- if $PKG_CONFIG raptor --atleast-version=$RAPTOR_MIN_VERSION --max-version=$RAPTOR_MAX_VERSION; then
- RAPTOR_CONFIG="$PKG_CONFIG raptor"
- RAPTOR_PACKAGE="raptor"
- else
- AC_MSG_ERROR(Installed raptor $RAPTOR_VERSION is not in supported range - $RAPTOR_MIN_VERSION to $RAPTOR_MAX_VERSION)
- fi
- else
- AC_MSG_ERROR(Raptor is not installed - see http://librdf.org/raptor/ to get a version newer than $RAPTOR_MIN_VERSION)
- fi
- fi
- with_raptor=system
- RAPTOR_VERSION=`$RAPTOR_CONFIG --modversion 2>/dev/null`
+if $PKG_CONFIG raptor2 --exists; then
+ RAPTOR_VERSION=`$PKG_CONFIG raptor2 --modversion 2>/dev/null`
RAPTOR_VERSION_DEC=`echo $RAPTOR_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
+ AC_MSG_RESULT(system $RAPTOR_VERSION)
else
- # otherwise use raptor-config for raptor V1 only
- raptor2=no
- AC_CHECK_PROG(RAPTOR_CONFIG, raptor-config, raptor-config)
- AC_ARG_WITH(raptor, [ --with-raptor=SOURCE Pick raptor source - system/internal (default auto)], with_raptor="$withval", with_raptor="auto")
-
- if test "X$RAPTOR_CONFIG" = X; then
- with_raptor=internal
- else
- RAPTOR_VERSION=`$RAPTOR_CONFIG --version 2>/dev/null`
-
- RAPTOR_VERSION_DEC=`$RAPTOR_CONFIG --version-decimal 2>/dev/null`
- RAPTOR_MIN_VERSION_DEC=`echo $RAPTOR_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
- RAPTOR_MAX_VERSION_DEC=`echo $RAPTOR_MAX_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
-
- if test "X$with_raptor" = Xauto; then
- if test "X$RAPTOR_VERSION" != X -a $RAPTOR_VERSION_DEC -ge $RAPTOR_MIN_VERSION_DEC -a $RAPTOR_VERSION_DEC -le $RAPTOR_MAX_VERSION_DEC; then
- with_raptor=system
- else
- AC_MSG_WARN(System raptor $RAPTOR_VERSION is not in supported range - $RAPTOR_MIN_VERSION to $RAPTOR_MAX_VERSION)
- with_raptor=internal
- fi
- elif test $with_raptor = system; then
- if test $RAPTOR_VERSION_DEC -lt $RAPTOR_MIN_VERSION_DEC -o $RAPTOR_VERSION_DEC -gt $RAPTOR_MAX_VERSION_DEC; then
- AC_MSG_WARN(System raptor $RAPTOR_VERSION is not in supported range - $RAPTOR_MIN_VERSION to $RAPTOR_MAX_VERSION)
- AC_MSG_WARN(Proceeding anyway since --with-raptor=system was given)
- AC_MSG_WARN(To use the internal raptor use --with-raptor=internal)
- AC_MSG_WARN(or omit any --with-raptor argument.)
- fi
- fi
+ AC_MSG_RESULT(not found)
- unset RAPTOR_MIN_VERSION_DEC RAPTOR_MAX_VERSION_DEC
- fi
- RAPTOR_PACKAGE="raptor"
+ AC_MSG_ERROR(Raptor V2 is not installed - see http://librdf.org/raptor/ to get a version newer than $RAPTOR_MIN_VERSION)
fi
-AC_SUBST(with_raptor)
-AC_SUBST(RAPTOR_PACKAGE)
-if test $with_raptor = system; then
- AC_MSG_RESULT(system $RAPTOR_VERSION)
-else
- RAPTOR_VERSION=internal
- AC_MSG_RESULT(internal)
- if test ! -r $srcdir/../raptor/src/raptor_general.c; then
- AC_MSG_ERROR(Raptor sources missing from $srcdir/../raptor directory - cannot use internal)
- fi
-fi
AC_SUBST(RAPTOR_VERSION_DEC)
-AM_CONDITIONAL(RAPTOR2, test "X$raptor2" = "Xyes")
-if test "X$raptor2" = "Xyes"; then
- AC_DEFINE(HAVE_RAPTOR2_API, 1, [Raptor2 API is available])
- HAVE_RAPTOR2_API=1
-else
- HAVE_RAPTOR2_API=0
-fi
-AC_SUBST(HAVE_RAPTOR2_API)
-
AC_CHECK_PROG(REDLAND_CONFIG, redland-config, redland-config)
AC_ARG_WITH(redland-config, [ --with-redland-config=PATH Location of redland redland-config ()], redland_config="$withval", redland_config="")
@@ -750,28 +669,9 @@ AC_MSG_RESULT($query_engine_version)
AC_DEFINE_UNQUOTED(RASQAL_QUERY_ENGINE_VERSION, $query_engine_version, [Query engine version])
-if test $with_raptor = internal; then
- RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS -I\$(top_srcdir)/../raptor/src"
- RASQAL_INTERNAL_LIBS="$RASQAL_INTERNAL_LIBS \$(top_builddir)/../raptor/src/libraptor.la"
- RAPPER_PATH=":\$(top_srcdir)/../raptor/utils"
-else
- RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS `$RAPTOR_CONFIG --cflags`"
- RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS `$RAPTOR_CONFIG --libs`"
- RAPPER_PATH=""
-fi
-
-
-oLIBS="$LIBS"
-LIBS="$LIBS $RASQAL_EXTERNAL_LIBS"
-# FIXME remove these raptor checks when RAPTOR2_MIN_VERSION increases
-# raptor_stringbuffer_append_hexadecimal() is in raptor2 >1.9.0
-AC_CHECK_FUNC(raptor_stringbuffer_append_uri_escaped_counted_string, have_rsauecs=yes, have_rsauecs=no)
-LIBS="$oLIBS"
-
-if test "X$have_rsauecs" = Xyes; then
- AC_DEFINE(RAPTOR_STRINGBUFFER_APPEND_URI_ESCAPED_COUNTED_STRING, 1, [Have raptor_stringbuffer_append_uri_escaped_counted_string()])
-fi
-
+RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS `$PKG_CONFIG raptor2 --cflags`"
+RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS `$PKG_CONFIG raptor2 --libs`"
+RAPPER_PATH=""
if test $need_regex_pcre = 1; then
C=`$PCRE_CONFIG --cflags`
View
4 rasqal.pc.in
@@ -3,11 +3,11 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/@PACKAGE@
-have_raptor2_api=@HAVE_RAPTOR2_API@
+have_raptor2_api=1
Name: Rasqal RDF Query Library
Description: Rasqal RDF Query parsing and execution library
-Requires: @RAPTOR_PACKAGE@ >= @RAPTOR_MIN_VERSION@
+Requires: raptor2 >= @RAPTOR_MIN_VERSION@
Requires.private: @PKGCONFIG_REQUIRES@
Version: @VERSION@
Libs: -L${libdir} -lrasqal
View
19 src/rasqal.h.in
@@ -971,20 +971,16 @@ void rasqal_world_set_raptor(rasqal_world* world, raptor_world* raptor_world_ptr
RASQAL_API
raptor_world *rasqal_world_get_raptor(rasqal_world* world);
-#if @HAVE_RAPTOR2_API@
RASQAL_API
void rasqal_world_set_log_handler(rasqal_world* world, void *user_data, raptor_log_handler handler);
-#endif
RASQAL_API
int rasqal_world_set_default_generate_bnodeid_parameters(rasqal_world* world, char *prefix, int base);
RASQAL_API
int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler2 handler);
-#if @HAVE_RAPTOR2_API@
RASQAL_API
const raptor_syntax_description* rasqal_world_get_query_results_format_description(rasqal_world* world, unsigned int counter);
-#endif
RASQAL_API
const char* rasqal_world_guess_query_results_format_name(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier);
@@ -1022,15 +1018,18 @@ const char* rasqal_query_get_name(rasqal_query* query);
RASQAL_API
const char* rasqal_query_get_label(rasqal_query* query);
-/* on raptor2: use rasqal_world_set_log_handler() instead of these */
-#if @HAVE_RAPTOR2_API@
+/* This is a typedef to let these deprecated API work with raptor2
+ * which removed this typedef and changed the way error handling was
+ * done. Use rasqal_world_set_log_handler() on the world class
+ * instead of these functions.
+ */
typedef void* raptor_message_handler;
-#endif
-RASQAL_API
+
+RASQAL_API RASQAL_DEPRECATED
void rasqal_query_set_fatal_error_handler(rasqal_query* query, void *user_data, raptor_message_handler handler);
-RASQAL_API
+RASQAL_API RASQAL_DEPRECATED
void rasqal_query_set_error_handler(rasqal_query* query, void *user_data, raptor_message_handler handler);
-RASQAL_API
+RASQAL_API RASQAL_DEPRECATED
void rasqal_query_set_warning_handler(rasqal_query* query, void *user_data, raptor_message_handler handler);
RASQAL_API
View
25 src/rasqal_algebra.c
@@ -1398,13 +1398,8 @@ rasqal_algebra_get_variables_mentioned_in(rasqal_query* query,
short *row;
int i;
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!seq)
return NULL;
@@ -1591,22 +1586,12 @@ rasqal_algebra_extract_aggregate_expressions(rasqal_query* query,
/* flags */ 0);
/* Sequence to hold list of aggregate expressions */
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression,
(raptor_data_print_handler)rasqal_expression_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_expression,
- (raptor_sequence_print_handler*)rasqal_expression_print);
-#endif
ae->agg_exprs = seq;
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
ae->agg_vars_seq = seq;
/* init internal variable counter */
@@ -1997,13 +1982,8 @@ rasqal_algebra_query_add_projection(rasqal_query* query,
if(seq)
vars_size = raptor_sequence_size(seq);
-#ifdef HAVE_RAPTOR2_API
vars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- vars_seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!vars_seq) {
rasqal_free_algebra_node(node);
return NULL;
@@ -2339,13 +2319,8 @@ main(int argc, char *argv[]) {
/* This is an artificial order conditions sequence equivalent to
* ORDER BY 1, 2 which would probably never appear in a query.
*/
-#ifdef HAVE_RAPTOR2_API
conditions = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression,
(raptor_data_print_handler)rasqal_expression_print);
-#else
- conditions = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_expression,
- (raptor_sequence_print_handler*)rasqal_expression_print);
-#endif
if(!conditions)
FAIL;
lit3 = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 1);
View
43 src/rasqal_dataset.c
@@ -131,9 +131,6 @@ rasqal_free_dataset(rasqal_dataset* ds)
static void
rasqal_dataset_statement_handler(void *user_data,
-#ifndef HAVE_RAPTOR2_API
- const
-#endif
raptor_statement *statement)
{
rasqal_dataset* ds;
@@ -162,34 +159,6 @@ rasqal_dataset_statement_handler(void *user_data,
}
-#ifndef HAVE_RAPTOR2_API
-/* Raptor V1 only */
-static void
-rasqal_dataset_raptor_error_handler(void *user_data,
- raptor_locator* locator,
- const char *message)
-{
- rasqal_world* world = (rasqal_world*)user_data;
- int locator_len;
-
- if(locator &&
- (locator_len = raptor_format_locator(NULL, 0, locator)) > 0
- ) {
- char *buffer = (char*)RASQAL_MALLOC(cstring, locator_len + 1);
- raptor_format_locator(buffer, locator_len, locator);
-
- rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR,
- locator,
- "Failed to parse %s - %s", buffer, message);
- RASQAL_FREE(cstring, buffer);
- } else
- rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR,
- locator,
- "Failed to parse - %s", message);
-}
-#endif
-
-
int
rasqal_dataset_load_graph_iostream(rasqal_dataset* ds,
const char* format_name,
@@ -223,24 +192,12 @@ rasqal_dataset_load_graph_iostream(rasqal_dataset* ds,
format_name = "guess";
/* parse iostr with parser and base_uri */
-#ifdef HAVE_RAPTOR2_API
parser = raptor_new_parser(ds->world->raptor_world_ptr, format_name);
raptor_parser_set_statement_handler(parser, ds,
rasqal_dataset_statement_handler);
-#else
- parser = raptor_new_parser(format_name);
- raptor_set_statement_handler(parser, ds,
- rasqal_dataset_statement_handler);
- raptor_set_error_handler(parser, ds->world,
- rasqal_dataset_raptor_error_handler);
-#endif
/* parse and store triples */
-#ifdef HAVE_RAPTOR2_API
raptor_parser_parse_iostream(parser, iostr, base_uri);
-#else
- rasqal_raptor_parse_iostream(parser, iostr, base_uri);
-#endif
raptor_free_parser(parser);
View
12 src/rasqal_engine.c
@@ -624,11 +624,7 @@ rasqal_engine_remove_filter_graph_patterns(rasqal_query* query,
}
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_graph_pattern, (raptor_sequence_print_handler*)rasqal_graph_pattern_print);
-#endif
if(!seq) {
RASQAL_DEBUG1("Cannot create new gp sequence\n");
*modified_p = -1;
@@ -1444,11 +1440,7 @@ rasqal_engine_make_rowsource(rasqal_query* query,
con->order_size = raptor_sequence_size(order_seq);
}
-#ifdef HAVE_RAPTOR2_API
con->seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print);
-#else
- con->seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row, (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
if(!con->seq) {
rasqal_rowsource_engine_finish(NULL, con);
return NULL;
@@ -1813,11 +1805,7 @@ rasqal_query_engine_1_execute_init(void* ex_data,
}
}
-#ifdef HAVE_RAPTOR2_API
execution_data->seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_gp_data, NULL);
-#else
- execution_data->seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_gp_data, NULL);
-#endif
if(!execution_data->seq) {
*error_p = RASQAL_ENGINE_FAILED;
return 1;
View
6 src/rasqal_engine_sort.c
@@ -113,20 +113,14 @@ rasqal_engine_rowsort_row_compare(void* user_data, const void *a, const void *b)
}
-#ifdef HAVE_RAPTOR2_API
static int
-#else
-static void
-#endif
rasqal_engine_rowsort_map_print_row(void *object, FILE *fh)
{
if(object)
rasqal_row_print((rasqal_row*)object, fh);
else
fputs("NULL", fh);
-#ifdef HAVE_RAPTOR2_API
return 0;
-#endif
}
View
22 src/rasqal_expr.c
@@ -1733,13 +1733,8 @@ rasqal_expression_copy_expression_sequence(raptor_sequence* exprs_seq)
if(!exprs_seq)
return NULL;
-#ifdef HAVE_RAPTOR2_API
nexprs_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression,
- (raptor_data_print_handler)rasqal_expression_print);
-#else
- nexprs_seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_expression,
- (raptor_sequence_print_handler*)rasqal_expression_print);
-#endif
+ (raptor_data_print_handler)rasqal_expression_print);
if(!nexprs_seq)
return NULL;
@@ -1800,13 +1795,8 @@ rasqal_expression_sequence_evaluate(rasqal_query* query,
return NULL;
}
-#ifdef HAVE_RAPTOR2_API
literal_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal,
(raptor_data_print_handler)rasqal_literal_print);
-#else
- literal_seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_literal,
- (raptor_sequence_print_handler*)rasqal_literal_print);
-#endif
for(i = 0; i < size; i++) {
rasqal_expression* e;
@@ -2207,19 +2197,13 @@ main(int argc, char *argv[])
int error=0;
rasqal_world *world;
-#ifdef HAVE_RAPTOR2_API
raptor_world* raptor_world_ptr;
raptor_world_ptr = raptor_new_world();
if(!raptor_world_ptr || raptor_world_open(raptor_world_ptr))
exit(1);
-#else
- raptor_init();
-#endif
world = rasqal_new_world();
-#ifdef HAVE_RAPTOR2_API
rasqal_world_set_raptor(world, raptor_world_ptr);
-#endif
/* no rasqal_world_open() */
rasqal_uri_init(world);
@@ -2265,11 +2249,7 @@ main(int argc, char *argv[])
RASQAL_FREE(rasqal_world, world);
-#ifdef HAVE_RAPTOR2_API
raptor_free_world(raptor_world_ptr);
-#else
- raptor_finish();
-#endif
return error;
}
View
24 src/rasqal_format_rdf.c
@@ -86,9 +86,7 @@ typedef struct
typedef struct
{
rasqal_world* world;
-#ifdef RAPTOR_V2_AVAILABLE
raptor_world *raptor_world_ptr;
-#endif
rasqal_query_results_formatter* formatter;
@@ -129,9 +127,7 @@ rasqal_query_results_rdf_init(rasqal_query_results_formatter* formatter,
const char* name)
{
rasqal_query_results_format_rdf* context = (rasqal_query_results_format_rdf*)formatter->context;
-#ifdef HAVE_RAPTOR2_API
raptor_world* raptor_world_ptr = formatter->factory->world->raptor_world_ptr;
-#endif
context->name = name;
@@ -219,7 +215,6 @@ rasqal_query_results_rdf_finish(rasqal_query_results_formatter* formatter)
}
-#ifdef RAPTOR_V2_AVAILABLE
/*
* rasqal_query_results_rdf_write:
* @iostr: #raptor_iostream to write the query results to
@@ -417,7 +412,6 @@ rasqal_query_results_rdf_write(rasqal_query_results_formatter* formatter,
return rc;
}
-#endif
/* Local handlers for turning RDF graph read from an iostream into rows */
@@ -432,9 +426,7 @@ rasqal_rowsource_rdf_init(rasqal_rowsource* rowsource, void *user_data)
con->rowsource = rowsource;
con->world = rowsource->world;
-#ifdef RAPTOR_V2_AVAILABLE
con->raptor_world_ptr = rasqal_world_get_raptor(rowsource->world);
-#endif
con->rs_uri = raptor_new_uri(con->raptor_world_ptr,
rs_namespace_uri_string);
@@ -779,11 +771,7 @@ rasqal_query_results_rdf_get_rowsource(rasqal_query_results_formatter* formatter
con->base_uri = base_uri ? raptor_uri_copy(base_uri) : NULL;
con->iostr = iostr;
-#ifdef HAVE_RAPTOR2_API
con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print);
-#else
- con->results_sequence = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row, (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table);
@@ -795,7 +783,6 @@ rasqal_query_results_rdf_get_rowsource(rasqal_query_results_formatter* formatter
}
-#ifdef HAVE_RAPTOR2_API
static void
rasqal_query_results_format_rdf_copy_syntax_description_from_parser(rasqal_query_results_format_factory *factory, const char* name)
{
@@ -816,7 +803,6 @@ rasqal_query_results_format_rdf_copy_syntax_description_from_parser(rasqal_query
}
}
}
-#endif
static int
@@ -852,11 +838,8 @@ rasqal_query_results_rdfxml_register_factory(rasqal_query_results_format_factory
factory->desc.mime_types = rdfxml_types;
factory->desc.mime_types_count = RDFXML_TYPES_COUNT;
-#ifdef HAVE_RAPTOR2_API
rasqal_query_results_format_rdf_copy_syntax_description_from_parser(factory,
"rdfxml");
-#else
-#endif
factory->desc.label = "RDF/XML Query Results";
@@ -869,11 +852,7 @@ rasqal_query_results_rdfxml_register_factory(rasqal_query_results_format_factory
factory->init = rasqal_query_results_rdf_init;
factory->finish = rasqal_query_results_rdf_finish;
-#ifdef RAPTOR_V2_AVAILABLE
factory->write = rasqal_query_results_rdf_write;
-#else
- factory->write = NULL;
-#endif
factory->get_rowsource = rasqal_query_results_rdf_get_rowsource;
factory->recognise_syntax = rasqal_query_results_rdfxml_recognise_syntax;
@@ -1035,11 +1014,8 @@ rasqal_query_results_turtle_register_factory(rasqal_query_results_format_factory
factory->desc.mime_types = turtle_types;
factory->desc.mime_types_count = TURTLE_TYPES_COUNT;
-#ifdef HAVE_RAPTOR2_API
rasqal_query_results_format_rdf_copy_syntax_description_from_parser(factory,
"turtle");
-#else
-#endif
factory->desc.label = "Turtle Query Results";
View
57 src/rasqal_format_sparql_xml.c
@@ -86,10 +86,6 @@ rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter,
{
int rc=1;
rasqal_world* world = rasqal_query_results_get_world(results);
-#ifndef HAVE_RAPTOR2_API
- const raptor_uri_handler *uri_handler;
- void *uri_context;
-#endif
raptor_xml_writer* xml_writer=NULL;
raptor_namespace *res_ns=NULL;
raptor_namespace_stack *nstack=NULL;
@@ -111,28 +107,13 @@ rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter,
}
-#ifdef HAVE_RAPTOR2_API
nstack = raptor_new_namespaces(world->raptor_world_ptr, 1);
-#else
- raptor_uri_get_handler(&uri_handler, &uri_context);
- nstack = raptor_new_namespaces(uri_handler, uri_context,
- (raptor_simple_message_handler)rasqal_world_simple_error, world,
- 1);
-#endif
if(!nstack)
return 1;
-#ifdef HAVE_RAPTOR2_API
xml_writer = raptor_new_xml_writer(world->raptor_world_ptr,
nstack,
iostr);
-#else
- xml_writer = raptor_new_xml_writer(nstack,
- uri_handler, uri_context,
- iostr,
- (raptor_simple_message_handler)rasqal_world_simple_error, world,
- 1);
-#endif
if(!xml_writer)
goto tidy;
@@ -180,16 +161,10 @@ rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter,
attrs=(raptor_qname **)raptor_alloc_memory(sizeof(raptor_qname*));
if(!attrs)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
attrs[0] = raptor_new_qname_from_namespace_local_name(world->raptor_world_ptr,
res_ns,
(const unsigned char*)"name",
(const unsigned char*)name); /* attribute value */
-#else
- attrs[0] = raptor_new_qname_from_namespace_local_name(res_ns,
- (const unsigned char*)"name",
- (const unsigned char*)name); /* attribute value */
-#endif
if(!attrs[0]) {
raptor_free_memory((void*)attrs);
goto tidy;
@@ -280,17 +255,11 @@ rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter,
attrs=(raptor_qname **)raptor_alloc_memory(sizeof(raptor_qname*));
if(!attrs)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
attrs[0] = raptor_new_qname_from_namespace_local_name(world->raptor_world_ptr,
res_ns,
(const unsigned char*)"name",
name);
-#else
- attrs[0] = raptor_new_qname_from_namespace_local_name(res_ns,
- (const unsigned char*)"name",
- name);
-#endif
if(!attrs[0]) {
raptor_free_memory((void*)attrs);
goto tidy;
@@ -352,22 +321,12 @@ rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter,
if(l->language)
attrs[0]=raptor_new_qname(nstack,
(const unsigned char*)"xml:lang",
- (const unsigned char*)l->language
-#ifndef HAVE_RAPTOR2_API
- , (raptor_simple_message_handler)rasqal_world_simple_error, world
-#endif
- );
+ (const unsigned char*)l->language);
else
-#ifdef HAVE_RAPTOR2_API
attrs[0] = raptor_new_qname_from_namespace_local_name(world->raptor_world_ptr,
res_ns,
(const unsigned char*)"datatype",
(const unsigned char*)raptor_uri_as_string(l->datatype));
-#else
- attrs[0] = raptor_new_qname_from_namespace_local_name(res_ns,
- (const unsigned char*)"datatype",
- (const unsigned char*)raptor_uri_as_string(l->datatype));
-#endif
if(!attrs[0]) {
raptor_free_memory((void*)attrs);
goto tidy;
@@ -516,9 +475,6 @@ typedef struct
raptor_sax2* sax2;
raptor_locator locator;
int depth; /* element depth */
-#ifndef HAVE_RAPTOR2_API
- raptor_error_handlers error_handlers; /* SAX2 error handler */
-#endif
/* SPARQL XML Results parsing */
rasqal_sparql_xml_read_state state; /* state */
@@ -974,14 +930,7 @@ rasqal_query_results_get_rowsource_sparql_xml(rasqal_query_results_formatter* fo
con->locator.uri=base_uri;
-#ifdef HAVE_RAPTOR2_API
con->sax2 = raptor_new_sax2(world->raptor_world_ptr, &con->locator, con);
-#else
- con->error_handlers.locator = &con->locator;
- raptor_error_handlers_init(&con->error_handlers);
-
- con->sax2 = raptor_new_sax2(con, &con->error_handlers);
-#endif
if(!con->sax2)
return NULL;
@@ -993,11 +942,7 @@ rasqal_query_results_get_rowsource_sparql_xml(rasqal_query_results_formatter* fo
raptor_sax2_set_end_element_handler(con->sax2,
rasqal_sparql_xml_sax2_end_element_handler);
-#ifdef HAVE_RAPTOR2_API
con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print);
-#else
- con->results_sequence = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row, (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table);
View
12 src/rasqal_format_table.c
@@ -82,10 +82,7 @@ rasqal_query_results_write_table_bindings(raptor_iostream *iostr,
rasqal_query_results* results,
raptor_uri *base_uri)
{
-#ifdef HAVE_RAPTOR2_API
rasqal_world* world = rasqal_query_results_get_world(results);
-#else
-#endif
raptor_sequence *seq = NULL;
int *widths = NULL;
int bindings_count = -1;
@@ -118,11 +115,7 @@ rasqal_query_results_write_table_bindings(raptor_iostream *iostr,
widths[i] = w;
}
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_chararray, NULL);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_chararray, NULL);
-#endif
if(!seq) {
rc = 1;
goto tidy;
@@ -144,14 +137,9 @@ rasqal_query_results_write_table_bindings(raptor_iostream *iostr,
if(!l)
continue;
-#ifdef HAVE_RAPTOR2_API
str_iostr = raptor_new_iostream_to_string(world->raptor_world_ptr,
(void**)&values[i], &v_len,
rasqal_alloc_memory);
-#else
- str_iostr = raptor_new_iostream_to_string((void**)&values[i], &v_len,
- rasqal_alloc_memory);
-#endif
if(!str_iostr) {
rc = 1;
goto tidy;
View
45 src/rasqal_general.c
@@ -141,7 +141,6 @@ rasqal_world_open(rasqal_world *world)
if(world->opened++)
return 0; /* not an error */
-#ifdef HAVE_RAPTOR2_API
/* Create and init a raptor_world unless one is provided externally with rasqal_world_set_raptor() */
if(!world->raptor_world_ptr) {
world->raptor_world_ptr = raptor_new_world();
@@ -152,9 +151,6 @@ rasqal_world_open(rasqal_world *world)
if(rc)
return rc;
}
-#else
- raptor_init();
-#endif
rc = rasqal_uri_init(world);
if(rc)
@@ -164,14 +160,6 @@ rasqal_world_open(rasqal_world *world)
if(rc)
return rc;
-#ifndef HAVE_RAPTOR2_API
-/* FIXME */
-#ifndef RAPTOR_ERROR_HANDLER_MAGIC
-#define RAPTOR_ERROR_HANDLER_MAGIC 0xD00DB1FF
-#endif
- world->error_handlers.magic = RAPTOR_ERROR_HANDLER_MAGIC;
-#endif
-
world->query_languages = raptor_new_sequence((raptor_data_free_handler)rasqal_free_query_language_factory, NULL);
if(!world->query_languages)
return 1;
@@ -252,12 +240,8 @@ rasqal_free_world(rasqal_world* world)
rasqal_uri_finish(world);
-#ifdef HAVE_RAPTOR2_API
if(world->raptor_world_ptr && world->raptor_world_allocated_here)
raptor_free_world(world->raptor_world_ptr);
-#else
- raptor_finish();
-#endif
RASQAL_FREE(rasqal_world, world);
}
@@ -302,7 +286,6 @@ rasqal_world_get_raptor(rasqal_world* world)
}
-#ifdef HAVE_RAPTOR2_API
/**
* rasqal_world_set_log_handler:
* @world: rasqal_world object
@@ -320,7 +303,6 @@ rasqal_world_set_log_handler(rasqal_world* world, void *user_data,
world->log_handler = handler;
world->log_handler_user_data = user_data;
}
-#endif
/* helper functions */
@@ -541,22 +523,13 @@ rasqal_language_name_check(rasqal_world* world, const char *name)
static const char* const rasqal_log_level_labels[RAPTOR_LOG_LEVEL_LAST+1]={
-#ifdef HAVE_RAPTOR2_API
- /* raptor2 levels */
"none",
"trace",
"debug",
"info",
"warn",
"error",
"fatal"
-#else
- /* raptor1 levels */
- "none",
- "fatal error",
- "error",
- "warning"
-#endif
};
@@ -584,26 +557,17 @@ rasqal_log_error_varargs(rasqal_world* world, raptor_log_level level,
{
char *buffer;
size_t length;
-#ifdef HAVE_RAPTOR2_API
raptor_log_message logmsg;
raptor_log_handler handler = world->log_handler;
void* handler_data = world->log_handler_user_data;
-#else
- raptor_message_handler handler = world->error_handlers.handlers[level].handler;
- void* handler_data = world->error_handlers.handlers[level].user_data;
-#endif
if(level == RAPTOR_LOG_LEVEL_NONE)
return;
buffer=raptor_vsnprintf(message, arguments);
if(!buffer) {
if(locator) {
-#ifdef HAVE_RAPTOR2_API
raptor_locator_print(locator, stderr);
-#else
- raptor_print_locator(stderr, locator);
-#endif
fputc(' ', stderr);
}
fputs("rasqal ", stderr);
@@ -622,24 +586,15 @@ rasqal_log_error_varargs(rasqal_world* world, raptor_log_level level,
/* This is the single place in rasqal that the user error handler
* functions are called.
*/
-#ifdef HAVE_RAPTOR2_API
/* raptor2 raptor_log_handler */
logmsg.code = -1; /* no information to put as code */
logmsg.level = level;
logmsg.locator = locator;
logmsg.text = buffer;
handler(handler_data, &logmsg);
-#else
- /* raptor1 raptor_message_handler */
- handler(handler_data, locator, buffer);
-#endif
} else {
if(locator) {
-#ifdef HAVE_RAPTOR2_API
raptor_locator_print(locator, stderr);
-#else
- raptor_print_locator(stderr, locator);
-#endif
fputc(' ', stderr);
}
fputs("rasqal ", stderr);
View
8 src/rasqal_graph_pattern.c
@@ -840,11 +840,7 @@ rasqal_graph_pattern_add_sub_graph_pattern(rasqal_graph_pattern* graph_pattern,
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(sub_graph_pattern, rasqal_graph_pattern, 1);
if(!graph_pattern->graph_patterns) {
-#ifdef HAVE_RAPTOR2_API
graph_pattern->graph_patterns = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print);
-#else
- graph_pattern->graph_patterns = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_graph_pattern, (raptor_sequence_print_handler*)rasqal_graph_pattern_print);
-#endif
if(!graph_pattern->graph_patterns) {
if(sub_graph_pattern)
@@ -1022,11 +1018,7 @@ rasqal_new_2_group_graph_pattern(rasqal_query* query,
{
raptor_sequence *seq;
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_graph_pattern, (raptor_sequence_print_handler*)rasqal_graph_pattern_print);
-#endif
if(!seq) {
if(first_gp)
rasqal_free_graph_pattern(first_gp);
View
76 src/rasqal_internal.h
@@ -494,35 +494,6 @@ struct rasqal_query_s {
};
-/* Definitions from raptor V2 raptor.h - REMOVE when Raptor V2 is required */
-#ifndef HAVE_RAPTOR2_API
-typedef void (*raptor_data_free_handler)(void* data);
-typedef void (*raptor_data_print_handler)(void *object, FILE *fh);
-
-typedef struct {
- const char* mime_type;
- size_t mime_type_len;
- unsigned char q;
-} raptor_type_q;
-
-
-typedef struct {
- const char* const* names;
- unsigned int names_count;
-
- const char* label;
-
- const raptor_type_q* mime_types;
- unsigned int mime_types_count;
-
- const char* const* uri_strings;
- unsigned int uri_strings_count;
-
- unsigned int flags;
-} raptor_syntax_description;
-#endif
-
-
/*
* A query language factory for a query language.
*
@@ -1119,12 +1090,7 @@ int rasqal_redland_init(rasqal_world*);
void rasqal_redland_finish(void);
#endif
-#ifdef HAVE_RAPTOR2_API
-rasqal_triple* raptor_statement_as_rasqal_triple(rasqal_world* world, const raptor_statement *statement);
-#else
rasqal_triple* raptor_statement_as_rasqal_triple(rasqal_world* world, const raptor_statement *statement);
-int rasqal_raptor_parse_iostream(raptor_parser* rdf_parser, raptor_iostream *iostr, raptor_uri *base_uri);
-#endif
int rasqal_raptor_triple_match(rasqal_world* world, rasqal_triple *triple, rasqal_triple *match, rasqal_triple_parts parts);
@@ -1297,14 +1263,9 @@ struct rasqal_world_s {
/* should rasqal free the raptor_world */
int raptor_world_allocated_here;
-#ifdef HAVE_RAPTOR2_API
/* log handler */
raptor_log_handler log_handler;
void *log_handler_user_data;
-#else
- /* error handlers structure */
- raptor_error_handlers error_handlers;
-#endif
/* sequence of query language factories */
raptor_sequence *query_languages;
@@ -1650,43 +1611,6 @@ rasqal_solution_modifier* rasqal_new_solution_modifier(rasqal_query* query, rapt
void rasqal_free_solution_modifier(rasqal_solution_modifier* sm);
-/* raptor1 -> raptor2 migration */
-/* use preprocessor macros to map raptor2 calls to raptor1 if raptor2 is not available */
-#ifndef HAVE_RAPTOR2_API
-
-#define raptor_new_iostream_to_file_handle(world, fh) raptor_new_iostream_to_file_handle(fh)
-#define raptor_new_iostream_from_file_handle(world, fh) raptor_new_iostream_from_file_handle(fh)
-#define raptor_new_iostream_from_filename(world, filename) raptor_new_iostream_from_filename(filename)
-#define raptor_iostream_write_bytes(ptr, size, nmemb, iostr) raptor_iostream_write_bytes(iostr, ptr, size, nmemb)
-#define raptor_iostream_write_byte(byte, iostr) raptor_iostream_write_byte(iostr, byte)
-#define raptor_iostream_counted_string_write(string, len, iostr) raptor_iostream_write_counted_string(iostr, string, len)
-#define raptor_iostream_string_write(string, iostr) raptor_iostream_write_string(iostr, string)
-#define raptor_iostream_decimal_write(decimal, iostr) raptor_iostream_write_decimal(iostr, decimal)
-#define raptor_iostream_read_bytes(ptr, size, nmemb, iostr) raptor_iostream_read_bytes(iostr, ptr, size, nmemb)
-#define raptor_xml_escape_string_write(string, len, quote, iostr) raptor_iostream_write_xml_escaped_string(iostr, string, len, quote, NULL, NULL)
-
-#define raptor_string_ntriples_write(str, len, delim, iostr) raptor_iostream_write_string_ntriples(iostr, str, len, delim)
-
-#define raptor_new_qname_from_namespace_uri(nstack, uri, xml_version) raptor_namespaces_qname_from_uri(nstack, uri, xml_version)
-
-#define raptor_new_serializer(world, name) raptor_new_serializer(name)
-#define raptor_world_is_serializer_name(world, name) raptor_serializer_syntax_name_check(name)
-#define raptor_world_is_parser_name(world, name) raptor_syntax_name_check(name)
-
-#define raptor_unicode_utf8_string_get_char(input, length, output) raptor_utf8_to_unicode_char(output, input, length)
-#define raptor_unicode_utf8_string_put_char(char, output, length) raptor_unicode_char_to_utf8(char, output)
-
-#define raptor_new_uri(world, uri_string) raptor_new_uri(uri_string)
-#define raptor_new_uri_from_uri_local_name(world, base_uri, name) raptor_new_uri_from_uri_local_name(base_uri, name)
-#define raptor_uri_write(uri, iostr) raptor_iostream_write_uri(iostr, uri)
-
-#define raptor_new_www(world) raptor_www_new()
-
-#define RAPTOR_LOG_LEVEL_WARN RAPTOR_LOG_LEVEL_WARNING
-
-#endif /* !HAVE_RAPTOR2_API */
-
-
/* end of RASQAL_INTERNAL */
#endif
View
29 src/rasqal_literal.c
@@ -2613,14 +2613,8 @@ rasqal_literal_expand_qname(void *user_data, rasqal_literal *l)
raptor_uri *uri;
/* expand a literal qname */
-#ifdef HAVE_RAPTOR2_API
uri = raptor_qname_string_to_uri(rq->namespaces,
l->string, l->string_len);
-#else
- uri = raptor_qname_string_to_uri(rq->namespaces,
- l->string, l->string_len,
- (raptor_simple_message_handler)rasqal_query_simple_error, rq);
-#endif
if(!uri)
return 1;
RASQAL_FREE(cstring, (void*)l->string);
@@ -2632,16 +2626,9 @@ rasqal_literal_expand_qname(void *user_data, rasqal_literal *l)
if(l->flags) {
/* expand a literal string datatype qname */
-#ifdef HAVE_RAPTOR2_API
uri = raptor_qname_string_to_uri(rq->namespaces,
l->flags,
strlen((const char*)l->flags));
-#else
- uri = raptor_qname_string_to_uri(rq->namespaces,
- l->flags,
- strlen((const char*)l->flags),
- (raptor_simple_message_handler)rasqal_query_simple_error, rq);
-#endif
if(!uri)
return 1;
l->datatype = uri;
@@ -3935,20 +3922,14 @@ rasqal_literal_sequence_sort_map_compare(void* user_data,
}
-#ifdef HAVE_RAPTOR2_API
static int
-#else
-static void
-#endif
rasqal_literal_sequence_sort_map_print_literal_sequence(void *object, FILE *fh)
{
if(object)
raptor_sequence_print((raptor_sequence*)object, fh);
else
fputs("NULL", fh);
-#ifdef HAVE_RAPTOR2_API
return 0;
-#endif
}
@@ -4043,13 +4024,8 @@ rasqal_new_literal_sequence_of_sequence_from_data(rasqal_world* world,
#define GET_CELL(row, column, offset) \
row_data[((((row) * width) + (column))<<1) + (offset)]
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)raptor_free_sequence,
(raptor_data_print_handler)raptor_sequence_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)raptor_free_sequence,
- (raptor_sequence_print_handler*)raptor_sequence_print);
-#endif
if(!seq)
return NULL;
@@ -4067,13 +4043,8 @@ rasqal_new_literal_sequence_of_sequence_from_data(rasqal_world* world,
if(!data_values_seen)
break;
-#ifdef HAVE_RAPTOR2_API
row = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal,
(raptor_data_print_handler)rasqal_literal_print);
-#else
- row = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_literal,
- (raptor_sequence_print_handler*)rasqal_literal_print);
-#endif
if(!row) {
raptor_free_sequence(seq); seq = NULL;
goto tidy;
View
5 src/rasqal_map.c
@@ -57,13 +57,8 @@ struct rasqal_map_s {
raptor_data_free_handler free_compare_data;
raptor_data_free_handler free_key;
raptor_data_free_handler free_value;
-#ifdef HAVE_RAPTOR2_API
raptor_data_print_handler print_key;
raptor_data_print_handler print_value;
-#else
- raptor_sequence_print_handler* print_key;
- raptor_sequence_print_handler* print_value;
-#endif
int allow_duplicates;
};
View
97 src/rasqal_query.c
@@ -98,10 +98,6 @@ rasqal_new_query(rasqal_world *world, const char *name,
{
rasqal_query_language_factory* factory;
rasqal_query* query;
-#ifndef HAVE_RAPTOR2_API
- const raptor_uri_handler *uri_handler;
- void *uri_context;
-#endif
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL);
@@ -130,51 +126,27 @@ rasqal_new_query(rasqal_world *world, const char *name,
if(!query->context)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
query->namespaces = raptor_new_namespaces(world->raptor_world_ptr, 0);
-#else
- raptor_uri_get_handler(&uri_handler, &uri_context);
- query->namespaces = raptor_new_namespaces(uri_handler, uri_context,
- (raptor_simple_message_handler)rasqal_query_simple_error,
- query,
- 0);
-#endif
if(!query->namespaces)
goto tidy;
query->vars_table = rasqal_new_variables_table(query->world);
if(!query->vars_table)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
query->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print);
-#else
- query->triples = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_triple, (raptor_sequence_print_handler*)rasqal_triple_print);
-#endif
if(!query->triples)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
query->prefixes = raptor_new_sequence((raptor_data_free_handler)rasqal_free_prefix, (raptor_data_print_handler)rasqal_prefix_print);
-#else
- query->prefixes = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_prefix, (raptor_sequence_print_handler*)rasqal_prefix_print);
-#endif
if(!query->prefixes)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
query->data_graphs = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, (raptor_data_print_handler)rasqal_data_graph_print);
-#else
- query->data_graphs = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_data_graph, (raptor_sequence_print_handler*)rasqal_data_graph_print);
-#endif
if(!query->data_graphs)
goto tidy;
-#ifdef HAVE_RAPTOR2_API
query->results = raptor_new_sequence((raptor_data_free_handler)rasqal_query_results_remove_query_reference, NULL);
-#else
- query->results = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_query_results_remove_query_reference, NULL);
-#endif
if(!query->results)
goto tidy;
@@ -314,27 +286,14 @@ rasqal_query_get_label(rasqal_query* query)
*
* Set the query error handling function.
*
- * The function will receive callbacks when the query fails.
+ * @Deprecated: Does nothing - use rasqal_world_set_log_handler() to
+ * set the handler for all messages.
*
**/
void
rasqal_query_set_fatal_error_handler(rasqal_query* query, void *user_data,
raptor_message_handler handler)
{
-#ifdef HAVE_RAPTOR2_API
-#else
- raptor_error_handlers* error_handlers;
-
- RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query);
-
- if(!query->world)
- return;
-
- error_handlers = &query->world->error_handlers;
-
- error_handlers->handlers[RAPTOR_LOG_LEVEL_FATAL].user_data = user_data;
- error_handlers->handlers[RAPTOR_LOG_LEVEL_FATAL].handler = handler;
-#endif
}
@@ -346,27 +305,14 @@ rasqal_query_set_fatal_error_handler(rasqal_query* query, void *user_data,
*
* Set the query error handling function.
*
- * The function will receive callbacks when the query fails.
+ * @Deprecated: Does nothing - use rasqal_world_set_log_handler() to
+ * set the handler for all messages.
*
**/
void
rasqal_query_set_error_handler(rasqal_query* query, void *user_data,
raptor_message_handler handler)
{
-#ifdef HAVE_RAPTOR2_API
-#else
- raptor_error_handlers* error_handlers;
-
- RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query);
-
- if(!query->world)
- return;
-
- error_handlers = &query->world->error_handlers;
-
- error_handlers->handlers[RAPTOR_LOG_LEVEL_ERROR].user_data = user_data;
- error_handlers->handlers[RAPTOR_LOG_LEVEL_ERROR].handler = handler;
-#endif
}
@@ -378,27 +324,14 @@ rasqal_query_set_error_handler(rasqal_query* query, void *user_data,
*
* Set the query warning handling function.
*
- * The function will receive callbacks when the query gives a warning.
+ * @Deprecated: Does nothing - use rasqal_world_set_log_handler() to
+ * set the handler for all messages.
*
**/
void
rasqal_query_set_warning_handler(rasqal_query* query, void *user_data,
raptor_message_handler handler)
{
-#ifdef HAVE_RAPTOR2_API
-#else
- raptor_error_handlers* error_handlers;
-
- RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query);
-
- if(!query->world)
- return;
-
- error_handlers = &query->world->error_handlers;
-
- error_handlers->handlers[RAPTOR_LOG_LEVEL_WARN].user_data = user_data;
- error_handlers->handlers[RAPTOR_LOG_LEVEL_WARN].handler = handler;
-#endif
}
@@ -856,13 +789,8 @@ rasqal_query_add_variable(rasqal_query* query, rasqal_variable* var)
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(var, rasqal_variable, 1);
if(!query->selects) {
-#ifdef HAVE_RAPTOR2_API
query->selects = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- query->selects = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!query->selects)
return 1;
}
@@ -1138,11 +1066,7 @@ rasqal_query_add_prefix(rasqal_query* query, rasqal_prefix* prefix)
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(prefix, rasqal_prefix, 1);
if(!query->prefixes) {
-#ifdef HAVE_RAPTOR2_API
query->prefixes = raptor_new_sequence((raptor_data_free_handler)rasqal_free_prefix, (raptor_data_print_handler)rasqal_prefix_print);
-#else
- query->prefixes = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_prefix, (raptor_sequence_print_handler*)rasqal_prefix_print);
-#endif
if(!query->prefixes)
return 1;
} else {
@@ -1982,14 +1906,9 @@ rasqal_query_escape_counted_string(rasqal_query* query,
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL);
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, NULL);
-#ifdef HAVE_RAPTOR2_API
iostr = raptor_new_iostream_to_string(query->world->raptor_world_ptr,
&output_string, output_len_p,
rasqal_alloc_memory);
-#else
- iostr = raptor_new_iostream_to_string(&output_string, output_len_p,
- rasqal_alloc_memory);
-#endif
if(!iostr)
return NULL;
rc = rasqal_query_iostream_write_escaped_counted_string(query, iostr,
@@ -2124,11 +2043,7 @@ rasqal_query_add_update_operation(rasqal_query* query,
return 1;
if(!query->updates) {
-#ifdef HAVE_RAPTOR2_API
query->updates = raptor_new_sequence((raptor_data_free_handler)rasqal_free_update_operation, (raptor_data_print_handler)rasqal_update_operation_print);
-#else
- query->updates = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_update_operation, (raptor_sequence_print_handler*)rasqal_update_operation_print);
-#endif
if(!query->updates) {
rasqal_free_update_operation(update);
return 1;
View
48 src/rasqal_query_results.c
@@ -218,12 +218,10 @@ rasqal_new_query_results(rasqal_world* world,
query_results->ask_result = -1;
query_results->store_results = 0;
query_results->current_triple_result = -1;
-#ifdef HAVE_RAPTOR2_API
+
/* initialize static query_results->result_triple */
raptor_statement_init(&query_results->result_triple, world->raptor_world_ptr);
-#else
- /* query_results->result_triple is static */
-#endif
+
query_results->triple = NULL;
query_results->results_sequence = NULL;
query_results->size = 0;
@@ -345,10 +343,8 @@ rasqal_free_query_results(rasqal_query_results* query_results)
if(query_results->results_sequence)
raptor_free_sequence(query_results->results_sequence);
-#ifdef HAVE_RAPTOR2_API
/* free terms owned by static query_results->result_triple */
raptor_free_statement(&query_results->result_triple);
-#endif
if(query_results->triple)
rasqal_free_triple(query_results->triple);
@@ -1110,23 +1106,16 @@ rasqal_query_results_get_triple(rasqal_query_results* query_results)
continue;
}
-#ifdef HAVE_RAPTOR2_API
/* raptor v2 terms are copied, not shared */
if(rs->subject) {
raptor_free_term(rs->subject);
rs->subject = NULL;
}
-#endif
switch(s->type) {
case RASQAL_LITERAL_URI:
-#ifdef HAVE_RAPTOR2_API
rs->subject = raptor_new_term_from_uri(query_results->world->raptor_world_ptr,
s->value.uri);
-#else
- rs->subject = s->value.uri;
- rs->subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
-#endif
break;
case RASQAL_LITERAL_BLANK:
@@ -1147,13 +1136,8 @@ rasqal_query_results_get_triple(rasqal_query_results* query_results)
"Could not create a new subject blank literal");
return NULL;
}
-#ifdef HAVE_RAPTOR2_API
rs->subject = raptor_new_term_from_blank(query_results->world->raptor_world_ptr,
nodeid);
-#else
- rs->subject = nodeid;
- rs->subject_type = RAPTOR_IDENTIFIER_TYPE_ANONYMOUS;
-#endif
break;
case RASQAL_LITERAL_QNAME:
@@ -1204,18 +1188,13 @@ rasqal_query_results_get_triple(rasqal_query_results* query_results)
}
switch(p->type) {
case RASQAL_LITERAL_URI:
-#ifdef HAVE_RAPTOR2_API
/* raptor v2 terms are copied, not shared */
if(rs->predicate) {
raptor_free_term(rs->predicate);
rs->predicate = NULL;
}
rs->predicate = raptor_new_term_from_uri(query_results->world->raptor_world_ptr,
p->value.uri);
-#else
- rs->predicate = p->value.uri;
- rs->predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
-#endif
break;
case RASQAL_LITERAL_QNAME:
@@ -1266,23 +1245,16 @@ rasqal_query_results_get_triple(rasqal_query_results* query_results)
continue;
}
-#ifdef HAVE_RAPTOR2_API
/* raptor v2 terms are copied, not shared */
if(rs->object) {
raptor_free_term(rs->object);
rs->object = NULL;
}
-#endif
switch(o->type) {
case RASQAL_LITERAL_URI:
-#ifdef HAVE_RAPTOR2_API
rs->object = raptor_new_term_from_uri(query_results->world->raptor_world_ptr,
o->value.uri);
-#else
- rs->object = o->value.uri;
- rs->object_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
-#endif
break;
case RASQAL_LITERAL_BLANK:
@@ -1307,27 +1279,15 @@ rasqal_query_results_get_triple(rasqal_query_results* query_results)
rasqal_free_literal(p);
return NULL;
}
-#ifdef HAVE_RAPTOR2_API
rs->object = raptor_new_term_from_blank(query_results->world->raptor_world_ptr,
nodeid);
-#else
- rs->object = nodeid;
- rs->object_type = RAPTOR_IDENTIFIER_TYPE_ANONYMOUS;
-#endif
break;
case RASQAL_LITERAL_STRING:
-#ifdef HAVE_RAPTOR2_API
rs->object = raptor_new_term_from_literal(query_results->world->raptor_world_ptr,
o->string,
o->datatype,
(const unsigned char*)o->language);
-#else
- rs->object = o->string;
- rs->object_literal_language = (const unsigned char*)o->language;
- rs->object_literal_datatype = o->datatype;
- rs->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL;
-#endif
break;
case RASQAL_LITERAL_QNAME:
@@ -1666,11 +1626,7 @@ rasqal_query_results_add_row(rasqal_query_results* query_results,
RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(row, rasqal_row, 1);
if(!query_results->results_sequence) {
-#ifdef HAVE_RAPTOR2_API
query_results->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print);
-#else
- query_results->results_sequence = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row, (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
if(!query_results->results_sequence)
return 1;
View
23 src/rasqal_query_transform.c
@@ -256,13 +256,8 @@ rasqal_query_expand_wildcards(rasqal_query* rq)
return 0;
/* If 'SELECT *' was given, make the selects be a list of all variables */
-#ifdef HAVE_RAPTOR2_API
rq->selects = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- rq->selects = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!rq->selects)
return 1;
@@ -307,13 +302,8 @@ rasqal_query_remove_duplicate_select_vars(rasqal_query* rq)
if(!size)
return 0;
-#ifdef HAVE_RAPTOR2_API
new_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- new_seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!new_seq)
return 1;
@@ -710,11 +700,7 @@ rasqal_query_merge_triple_patterns(rasqal_query* query,
RASQAL_DEBUG3("Initial columns %d to %d\n", gp->start_column, gp->end_column);
#endif
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_graph_pattern, (raptor_sequence_print_handler*)rasqal_graph_pattern_print);
-#endif
if(!seq)
return 1;
@@ -835,11 +821,7 @@ rasqal_query_remove_empty_group_graph_patterns(rasqal_query* query,
return 0;
}
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_graph_pattern, (raptor_sequence_print_handler*)rasqal_graph_pattern_print);
-#endif
if(!seq) {
RASQAL_DEBUG1("Cannot create new gp sequence\n");
*modified = -1;
@@ -1408,13 +1390,8 @@ rasqal_graph_patterns_join(rasqal_graph_pattern *dest_gp,
if(src_gp->graph_patterns) {
if(!dest_gp->graph_patterns) {
-#ifdef HAVE_RAPTOR2_API
dest_gp->graph_patterns = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern,
(raptor_data_print_handler)rasqal_graph_pattern_print);
-#else
- dest_gp->graph_patterns = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_graph_pattern,
- (raptor_sequence_print_handler*)rasqal_graph_pattern_print);
-#endif
if(!dest_gp->graph_patterns)
return -1;
}
View
17 src/rasqal_query_write.c
@@ -84,11 +84,7 @@ rasqal_query_write_sparql_uri(sparql_writer_context *wc,
const raptor_namespace* nspace = raptor_qname_get_namespace(qname);
if(!raptor_namespace_get_prefix(nspace))
raptor_iostream_write_byte(':', iostr);
-#ifdef HAVE_RAPTOR2_API
raptor_qname_write(qname, iostr);
-#else
- raptor_iostream_write_qname(iostr, qname);
-#endif
raptor_free_qname(qname);
return;
}
@@ -815,27 +811,14 @@ rasqal_query_write_sparql_20060406(raptor_iostream *iostr,
{
int i;
sparql_writer_context wc;
-#ifndef HAVE_RAPTOR2_API
- const raptor_uri_handler *uri_handler;
- void *uri_context;
-#endif
int limit, offset;
wc.world = query->world;
wc.base_uri = NULL;
-#ifdef HAVE_RAPTOR2_API
wc.type_uri = raptor_new_uri_for_rdf_concept(query->world->raptor_world_ptr,
(const unsigned char*)"type");
wc.nstack = raptor_new_namespaces(query->world->raptor_world_ptr, 1);
-#else
- wc.type_uri = raptor_new_uri_for_rdf_concept("type");
- raptor_uri_get_handler(&uri_handler, &uri_context);
- wc.nstack = raptor_new_namespaces(uri_handler, uri_context,
- (raptor_simple_message_handler)rasqal_query_simple_error,
- query,
- 1);
-#endif
if(base_uri) {
raptor_iostream_counted_string_write("BASE ", 5, iostr);
View
217 src/rasqal_raptor.c
@@ -81,32 +81,6 @@ static int rasqal_raptor_triple_present(rasqal_triples_source *rts, void *user_d
static void rasqal_raptor_free_triples_source(void *user_data);
-#ifndef HAVE_RAPTOR2_API
-static raptor_uri*
-ordinal_as_uri(rasqal_world* world, int ordinal)
-{
- int t = ordinal;
- size_t len;
- unsigned char *buffer;
- raptor_uri* uri;
-
- len = raptor_rdf_namespace_uri_len + 1 + 1; /* 1 for min-length, 1 for '_' */
- while(t /= 10)
- len++;
- buffer = (unsigned char*)RASQAL_MALLOC(cstring, len + 1);
- if(!buffer)
- return NULL;
-
- sprintf((char*)buffer, "%s_%d", raptor_rdf_namespace_uri, ordinal);
- uri = raptor_new_uri(world->raptor_world_ptr, buffer);
- RASQAL_FREE(cstring, buffer);
-
- return uri;
-}
-#endif
-
-
-#ifdef HAVE_RAPTOR2_API
rasqal_triple*
raptor_statement_as_rasqal_triple(rasqal_world* world,
const raptor_statement *statement)
@@ -163,108 +137,10 @@ raptor_statement_as_rasqal_triple(rasqal_world* world,
return rasqal_new_triple(s, p, o);
}
-#else /* ifdef HAVE_RAPTOR_API */
-rasqal_triple*
-raptor_statement_as_rasqal_triple(rasqal_world* world,
- const raptor_statement *statement)
-{
- rasqal_literal *s, *p, *o;
-
- if(statement->subject_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) {
- unsigned char *new_blank;
- size_t blank_len;
-
- blank_len = strlen((char*)statement->subject);
- new_blank = (unsigned char*)RASQAL_MALLOC(cstring, blank_len + 1);
- memcpy(new_blank, statement->subject, blank_len + 1);
- s = rasqal_new_simple_literal(world, RASQAL_LITERAL_BLANK, new_blank);
- } else if(statement->subject_type == RAPTOR_IDENTIFIER_TYPE_ORDINAL) {
- raptor_uri* uri;
-
- uri = ordinal_as_uri(world, *((int*)statement->subject));
- if(!uri)
- return NULL;
- s = rasqal_new_uri_literal(world, uri);
- } else {
- raptor_uri *uri;
-
- uri = raptor_uri_copy((raptor_uri*)statement->subject);
- s = rasqal_new_uri_literal(world, uri);
- }
-
- if(statement->predicate_type == RAPTOR_IDENTIFIER_TYPE_ORDINAL) {
- raptor_uri* uri = ordinal_as_uri(world, *((int*)statement->predicate));
-
- if(!uri)
- return NULL;
- p = rasqal_new_uri_literal(world, uri);
- } else {
- raptor_uri *uri;
-
- uri = raptor_uri_copy((raptor_uri*)statement->predicate);
- p = rasqal_new_uri_literal(world, uri);
- }
-
- if(statement->object_type == RAPTOR_IDENTIFIER_TYPE_LITERAL ||
- statement->object_type == RAPTOR_IDENTIFIER_TYPE_XML_LITERAL) {
- unsigned char *string;
- char *language = NULL;
- raptor_uri *uri = NULL;
- size_t literal_len;
-
- literal_len = strlen((char*)statement->object);
- string = (unsigned char*)RASQAL_MALLOC(cstring, literal_len + 1);
- memcpy(string, statement->object, literal_len + 1);
-
- if(statement->object_literal_language) {
- size_t language_len;
- language_len = strlen((const char*)statement->object_literal_language);
- language = (char*)RASQAL_MALLOC(cstring, language_len + 1);
- memcpy(language, statement->object_literal_language, language_len + 1);
- }
-
- if(statement->object_type == RAPTOR_IDENTIFIER_TYPE_XML_LITERAL) {
- const unsigned char* dt_uri_string;
-
- dt_uri_string = (const unsigned char*)raptor_xml_literal_datatype_uri_string;
- uri = raptor_new_uri(world->raptor_world_ptr, dt_uri_string);
- } else if(statement->object_literal_datatype) {
- raptor_uri *dt_uri = (raptor_uri*)statement->object_literal_datatype;
-
- uri = raptor_uri_copy(dt_uri);
- }
- o = rasqal_new_string_literal(world, string, language, uri, NULL);
- } else if(statement->object_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) {
- char *blank = (char*)statement->object;
- unsigned char *new_blank;
- size_t blank_len;
-
- blank_len = strlen(blank);
- new_blank = (unsigned char*)RASQAL_MALLOC(cstring, blank_len + 1);
- memcpy(new_blank, blank, blank_len + 1);
- o = rasqal_new_simple_literal(world, RASQAL_LITERAL_BLANK, new_blank);
- } else if(statement->object_type == RAPTOR_IDENTIFIER_TYPE_ORDINAL) {
- raptor_uri* uri = ordinal_as_uri(world, *((int*)statement->object));
-
- if(!uri)
- return NULL;
- o = rasqal_new_uri_literal(world, uri);
- } else {
- raptor_uri *uri;
- uri = raptor_uri_copy((raptor_uri*)statement->object);
- o = rasqal_new_uri_literal(world, uri);
- }
-
- return rasqal_new_triple(s, p, o);
-}
-#endif /* ifdef HAVE_RAPTOR2_API ... else */
static void
rasqal_raptor_statement_handler(void *user_data,
-#ifndef HAVE_RAPTOR2_API
- const
-#endif
raptor_statement *statement)
{
rasqal_raptor_triples_source_user_data* rtsc;
@@ -293,48 +169,8 @@ rasqal_raptor_statement_handler(void *user_data,
}
-#ifndef HAVE_RAPTOR2_API
-static void
-rasqal_raptor_error_handler(void *user_data,
- raptor_locator* locator, const char *message)
-{
- rasqal_query* query = (rasqal_query*)user_data;
- int locator_len;
-
- query->failed = 1;
-
- if(locator &&
-#ifdef HAVE_RAPTOR2_API
- (locator_len = raptor_locator_format(NULL, 0, locator)) > 0
-#else
- (locator_len = raptor_format_locator(NULL, 0, locator)) > 0
-#endif
- ) {
- char *buffer = (char*)RASQAL_MALLOC(cstring, locator_len + 1);
-#ifdef HAVE_RAPTOR2_API
- raptor_locator_format(buffer, locator_len, locator);
-#else
- raptor_format_locator(buffer, locator_len, locator);
-#endif
-
- rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR,
- &query->locator,
- "Failed to parse %s - %s", buffer, message);
- RASQAL_FREE(cstring, buffer);
- } else
- rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR,
- &query->locator,
- "Failed to parse - %s", message);
-}
-#endif
-
-
static unsigned char*
rasqal_raptor_generate_id_handler(void *user_data,
-#ifdef HAVE_RAPTOR2_API
-#else
- raptor_genid_type type,
-#endif
unsigned char *user_bnodeid)
{
rasqal_raptor_triples_source_user_data* rtsc;
@@ -377,43 +213,6 @@ rasqal_raptor_support_feature(void *user_data,
}
-#ifdef HAVE_RAPTOR2_API
-#else
-
-#define RASQAL_RAPTOR_READ_BUFFER_SIZE 4096
-
-/* Based on raptor_parser_parse_iostream() from Raptor 1.9.0
- * backported to the Raptor V1 API
- */
-int
-rasqal_raptor_parse_iostream(raptor_parser* rdf_parser,
- raptor_iostream *iostr,
- raptor_uri *base_uri)
-{
- /* Read buffer */
- unsigned char buffer[RASQAL_RAPTOR_READ_BUFFER_SIZE + 1];
- int rc = 0;
-
- rc = raptor_start_parse(rdf_parser, base_uri);
- if(rc)
- return rc;
-
- while(!raptor_iostream_read_eof(iostr)) {
- int len = raptor_iostream_read_bytes(buffer, 1,
- RASQAL_RAPTOR_READ_BUFFER_SIZE,
- iostr);
- int is_end = (len < RASQAL_RAPTOR_READ_BUFFER_SIZE);
-
- rc = raptor_parse_chunk(rdf_parser, buffer, len, is_end);
- if(rc || is_end)
- break;
- }
-
- return rc;
-}
-#endif
-
-
static int
rasqal_raptor_init_triples_source(rasqal_query* rdf_query,
void *factory_user_data,
@@ -498,19 +297,11 @@ rasqal_raptor_init_triples_source(rasqal_query* rdf_query,
if(!parser_name)
parser_name = "guess";
-#ifdef HAVE_RAPTOR2_API
parser = raptor_new_parser(rdf_query->world->raptor_world_ptr, parser_name);
raptor_parser_set_statement_handler(parser, rtsc, rasqal_raptor_statement_handler);
raptor_world_set_generate_bnodeid_handler(rdf_query->world->raptor_world_ptr,
rtsc,
rasqal_raptor_generate_id_handler);
-#else
- parser = raptor_new_parser(parser_name);
- raptor_set_statement_handler(parser, rtsc, rasqal_raptor_statement_handler);
- raptor_set_error_handler(parser, rdf_query, rasqal_raptor_error_handler);
- raptor_set_generate_id_handler(parser, rtsc,
- rasqal_raptor_generate_id_handler);
-#endif
#ifdef RAPTOR_FEATURE_NO_NET
if(rdf_query->features[RASQAL_FEATURE_NO_NET])
@@ -519,17 +310,9 @@ rasqal_raptor_init_triples_source(rasqal_query* rdf_query,
#endif
if(iostr) {
-#ifdef HAVE_RAPTOR2_API
raptor_parser_parse_iostream(parser, iostr, dg->base_uri);
-#else
- rasqal_raptor_parse_iostream(parser, iostr, dg->base_uri);
-#endif
} else {
-#ifdef HAVE_RAPTOR2_API
raptor_parser_parse_uri(parser, uri, name_uri);
-#else
- raptor_parse_uri(parser, uri, name_uri);
-#endif
}
raptor_free_parser(parser);
View
6 src/rasqal_result_formats.c
@@ -144,11 +144,7 @@ rasqal_init_result_formats(rasqal_world* world)
{
int rc = 0;
-#ifdef HAVE_RAPTOR2_API
world->query_results_formats = raptor_new_sequence((raptor_data_free_handler)rasqal_free_query_results_format_factory, NULL);
-#else
- world->query_results_formats = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_query_results_format_factory, NULL);
-#endif
if(!world->query_results_formats)
return 1;
@@ -568,7 +564,6 @@ rasqal_query_results_formatter_get_mime_type(rasqal_query_results_formatter *for
}
-#ifdef HAVE_RAPTOR2_API
/**
* rasqal_world_get_query_results_format_description:
* @world: world object
@@ -596,7 +591,6 @@ rasqal_world_get_query_results_format_description(rasqal_world* world,
return &factory->desc;
}
-#endif
/**
View
10 src/rasqal_row.c
@@ -307,24 +307,14 @@ rasqal_new_row_sequence(rasqal_world* world,
#define GET_CELL(row, column, offset) \
row_data[((((row)*vars_count)+(column))<<1)+(offset)]
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row,
(raptor_data_print_handler)rasqal_row_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row,
- (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
if(!seq)
return NULL;
if(vars_seq_p) {
-#ifdef HAVE_RAPTOR2_API
vars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- vars_seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!vars_seq) {
raptor_free_sequence(seq);
return NULL;
View
15 src/rasqal_rowsource.c
@@ -98,13 +98,8 @@ rasqal_new_rowsource_from_handler(rasqal_world* world,
rowsource->vars_table = NULL;
/* no free method here - the variables are owned by rowsource->vars_table */
-#ifdef HAVE_RAPTOR2_API
rowsource->variables_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable,
(raptor_data_print_handler)rasqal_variable_print);
-#else
- rowsource->variables_sequence = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_variable,
- (raptor_sequence_print_handler*)rasqal_variable_print);
-#endif
if(!rowsource->variables_sequence) {
rasqal_free_rowsource(rowsource);
return NULL;
@@ -310,13 +305,8 @@ rasqal_rowsource_read_all_rows(rasqal_rowsource *rowsource)
if(rowsource->handler->read_all_rows) {
seq = rowsource->handler->read_all_rows(rowsource, rowsource->user_data);
if(!seq) {
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row,
(raptor_data_print_handler)rasqal_row_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row,
- (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
}
if(seq && rowsource->generate_group) {
@@ -337,13 +327,8 @@ rasqal_rowsource_read_all_rows(rasqal_rowsource *rowsource)
return seq;
}
-#ifdef HAVE_RAPTOR2_API
seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row,
(raptor_data_print_handler)rasqal_row_print);
-#else
- seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_row,
- (raptor_sequence_print_handler*)rasqal_row_print);
-#endif
if(!seq)
return NULL;
View
25 src/rasqal_rowsource_aggregation.c
@@ -408,13 +408,8 @@ rasqal_aggregation_rowsource_init(rasqal_rowsource* rowsource, void *user_data)
con = (rasqal_aggregation_rowsource_context*)user_data;
-#ifdef HAVE_RAPTOR2_API
con->input_values = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal,
(raptor_data_print_handler)rasqal_literal_print);
-#else
- con->input_values = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_literal,
- (raptor_sequence_print_handler*)rasqal_literal_print);
-#endif
con->last_group_id = -1;
@@ -880,13 +875,8 @@ rasqal_new_aggregation_rowsource(rasqal_world *world, rasqal_query* query,
} else {
/* single argument */
-#ifdef HAVE_RAPTOR2_API
expr_data->exprs_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression,
(raptor_data_print_handler)rasqal_expression_print);
-#else
- expr_data->exprs_seq = raptor_new_sequence((raptor_sequence_free_handler*)rasqal_free_expression,
- (raptor_sequence_print_handler*)rasqal_expression_print);
-#endif
raptor_sequence_push(expr_data->exprs_seq,