Dave Beckett

Hosted by

since 2005.


(See DOAP Project)

Rasqal RDF Query Library - Release Notes

Rasqal 0.9.34 changes

Not yet released.

Rasqal 0.9.33 changes

Issues Fixed:

  • 0000546: Can't take query from URI when using -p
  • 0000568: Filter expression with division does not work
  • 0000583: CONSTRUCT halts at a template triple with unbound variable
  • 0000588: roqet: select from SERVICE returns all NULLs

SPARQL changes

Fixed BASE to override any API base URI.

Datetime class changes

Fixed storing timezone minutes correctly.

Graph pattern class changes

Added new getter functions rasqal_graph_pattern_get_triples(), rasqal_literal_get_type() and rasqal_literal_get_language() from Pull Request #1 by Cosmin Basca. Thanks.

Query engine changes

Fixed the aggregation total evaluation of AVG.

Fixed STRBEFORE and STRAFTER evaluation to match languages if present and add the needle language to the result.

Fixed CONCAT() evaluation to return the correct types and languages.

Sorting now uses sort utility function raptor_sort_r() with context args provided by Raptor 2.0.15+ or an internal simple (not so performant) replacement, if too old.

Query result formatter changes

Can write variable bindings query results in mKR relation CSV format. Patch by Richard H. McCullough.

Query result class changes

Made internal changes to support reading and writing boolean result formats. That means rasqal_query_results_formatter_read() may now return boolean results if the formatter supports it, such as SPARQL XML.

Added rasqal_new_query_results_from_string() to make a query results from a string (with optional length). The results format is guessed from the input data - base_uri and string content using rasqal_world_guess_query_results_format_name().

Added rasqal_query_results_formats_check2() deprecating rasqal_query_results_formats_check(). The API change is due to the return value; the result is now non-0 if the format exists.

Added rasqal_new_query_results2() deprecating rasqal_new_query_results() removing the now ignored vars_table parameter. A query result now manages it's own variables table.

Results class changes

Fixed returning the correct variables count for reading SPARQL XML results sets. This caused some queries to fail if the projected variables count did not match the count in the result set. Fixes Issue #0000588

Variables table class changes

Added rasqal_variables_table_add2() deprecating rasqal_variables_table_add(). This takes a more sensible argument style with copying the input parameters name and value, and allowing name length to be optionally given. This results in smaller calling code and better ownership semantics.

Utility changes

roqet(1) now supports using a URI or local file to send to a SPARQL protocol service URI. Fixes Issue #0000546

Other changes

Fixes to make Rasqal build in Travis CI, testing against newest and oldest raptors.

Use __FUNCTION__ (c99) replacing __func__ (c90) in debug macros.

Fixes in Pull Request #3 for building with icc from Sebastian Freundt. Thanks.

Many code quality fixes from clang and coverity primarily in error path cleanups (out of memory cases) and dead code.

Updated the fix-flex and fix-bison scripts to remove dead code that clang and coverity complain about.

Added new C testrunner utility to run the tests to eventually replace the (perl) improve and check-sparql scripts.

Fixed some API changelog mistakes.

Updated gcc / clang warning args used (-Wxxxx) and made multiple minor code fixes such as replacing %d with %u in debug messages or adding missing default: to switches even when all cases were covered.

Added many more internal casts to make -Wconversion happier when enabled.

Rasqal 0.9.32 changes

Issues Fixed:

  • 0000558: sparql11-update causes fallback to sparql10
  • 0000560: "--with-pcre-config" documented but not supported
  • 0000561: 'make check' fails; possibly because raptor2 built in separate directory
  • 0000564: Rasqal fails with linker error for armv7 cross-compilation: duplicate symbol _main
  • 0000567: Segfault based on documentation recommendation

SPARQL changes

Fixed the SPARQL 1.0 and SPARQL 1.1 syntax feature checking so that language sparql11-update allows all SPARQL 1.1 syntax features to be used. Fixes Issue #0000558

Updated the SPARQL parser to use and require Bison 3.0 (for maintainer, building from GIT sources).

Updated the SPARQL lexer for Bison 3.0.

API changes

Made rasqal_new_query() match the documentation in accepting a NULL name. Fixes Issue #0000567

Configuration changes

Make ossp work as a UUID library option. --with-uuid-library=ossp and automatic discovery of ossp UUID now work. Fixed the inclusion of OSSP's uuid.h header.

Fix the searching for the pcre-config and libgcrypt-config configuration utilities. This probably never worked unless the envariables form (PCRE_CONFIG and LIBGCRYPT_CONFIG) were set.

Added a new internal to-ntriples utility to remove all use of rapper(1) so that the raptor utilities do not need to be available for running tests with 'make check'. Fixes Issue #0000561

Make --with-libgcrypt-config work.

Make --with-pcre-config work. Fixes Issue# 0000560

Fix noisy mhash_dir addition error; it was always added the cflags and includes even when mhash_dir was blank.

Improve raptor missing / too old error message.

Other changes

Mention libmtwist near --with-random-approach. Fixes Issue #0000561

Internal changes

Add more STANDALONE if/ifndef STANDALONE blocks around internal code or functions used in tests.

Make rasqal_xsd_check_double_format() an internal non-static symbol. Fixes Issue #0000564

Rasqal 0.9.31 changes

Issues Fixed:

  • 0000527: segmentation fault in roqet when making a SPARQL SERVICE query that returns an HTTP error
  • 0000536: configure accepts bogus values for --with-xml2-config
  • 0000537: configure pkg-config checks not overridable
  • 0000538: work around MSVC 2008's inexcusable lack of stdint.h header
  • 0000539: win32_rasqal_config.h doesn't work on MSVC2008

roqet(1) utility changes

roqet(1) gains a new operating mode: reading query result files in a given format and generating them in different format. This means it can be used to convert result formats. Use this mode with the -t RESULT-FILE major option and -R INPUT-RESULT-FORMAT to set the input format. -r OUTPUT-RESULT-FORMAT can be used to set the output format.

  # Convert a SPARQL TSV result to XML
  $ roqet -t result.tsv -R tsv -r xml

  # Convert a SPARQL XML result (default input format) to TSV
  $ roqet -t result.srx -r tsv

Tidied and improved the help and error messages.

The utility now supports -r simple / --results simple as it says in the documentation.

The debug result format now prints 'row:' when writing. (This format has always promised it may change).

Query result changes

Added support for reading the SPARQL 1.1 Query Results CSV and TSV Formats W3C Recommendation, 21 March 2013. Writing support already existed. This is a modular addition so the APIs that handle reading results automatically get this support.

Added rasqal_query_results_type_label() to get a string label for a rasqal_query_results_type.

Query engine changes

Internal work to support executing the SERVICE graph pattern.

Query engine can execute the new VALUES graph pattern.

SPARQL lexer and parser handles VALUES replacing the old BINDINGS syntax.

Fixed crash when a SERVICE returns no rowsource. Fixes Issue #0000527

Added proper validation of xsd:double and xsd:float literal format.

Correctly handle GROUP BY over no data - returning one row with all bindings missing.

Literal languages are now normalized to lowercase (RDF Concepts)

API changes

rasqal_prefix_id() now uses a q rather than _ to help raptor N-Triples 2008 conformance.

Improved SPARQL 1.1 query formatter to handle VALUES forms and to print in a prettier form with better indenting.

rasqal_graph_pattern_op gains RASQAL_GRAPH_PATTERN_OPERATOR_VALUES

rasqal_new_rowsource_from_handler() now allows a NULL query so that rowsources can be fully independent of a query, such as when building from a syntax string or other independent object.

rasqal_new_rowsequence_rowsource() now allows an empty sequence of rows.

Portability changes

Win32 build fix patches from Michael Stahl: Fixes Issues #0000539 and #0000538

Configuration and build changes

Added new internal convienience library libsv providing support for reading CSV and TSV files (and others potentially). Required for the updated support for reading SPARQL CSV and TSV result formats.

Added new librasqalcmdline convienience library to share code between roqet(1) and check-query (under development, not installed).

Build internal libmtwist, libgetopt (new) as libtool convienience libraries to stop automake moans about subdir-objects.

configure was fixed to correctly find and use OSSP libuuid even in the presence of half installed / broken UUID systems like on OSX where just the headers are present.

Fixes for building with parallel make such as make -jN

Fixed alignments and error paths found via clang.

configure now uses PKG_CHECK_MODULES() to enable overriding discovery of pkg-config if needed. Fixes Issue #0000537

Fix crash if xml2-config(1) when pointed at a non executable file. Patch from Michael Stahl Fixes Issue #0000536

configure ensures CPPFLAGS can be passed through without destruction. This helps Debian hardening

Removed the need for Perl XML::DOM to be installed in order for 'make test' to run via check-sparql. This requires the roqet(1) new '-'t mode.

Add a configure check for the debugging __func__ so that on systems where it does not exist the debug macros work. It may or may not be a macro, so it cannot be tested with #ifdef in the CPP.

Improved the configure check for Flex to allow it to be missing for non-maintainer mode.

Other changes

Flex code generation updates - now recommend flex 2.5.36.

Fixes in tests data for N-Triples conformance that is checked by newer Raptor.

Rasqal 0.9.30 changes

Removed RDQL support as promised. So long and thanks for all the queries. Use SPARQL instead.

Issues Fixed:

  • 0000506: has bash -specific (non-POSIX) == syntax
  • 0000511: Add support for OSSP UUID library
  • 0000517: Autoconf errors when checking for several headers and cross-compiling
  • 0000523: mpfr dependency

Decimal class changes

rasqal_xsd_decimal_is_zero() now uses fabs() and an epsilon approach for C99 decimal mode.

Make rasqal_xsd_decimal_compare() work for C99 decimal mode.

rasqal_xsd_decimal_compare() and rasqal_xsd_decimal_equals() use Knuth's approximate equality as decribed below.

Literal class changes

Return rdf term type string from rasqal_literal_get_rdf_term_type() for integer subtypes (RASQAL_LITERAL_INTEGER_SUBTYPE). Fixes Issue #0000519 (Redland librdf)

rasqal_literal_to_result_term() now returns NULL on an alloc failure.

rasqal_new_floating_literal() added, deprecating rasqal_new_float_literal() and takes the float type as an argument.

Query engine changes

Fix some wrong data size allocs found by clang in Project rowsource.

Take more care in promoting literals to float and exceeding the range; turn them into doubles if that happens.

Floating and double comparisons and equality use a proper epsilon check using Knuth's approximate comparison approach, rather than =. Affects rasqal_literal_as_boolean(), rasqal_literal_equals(), rasqal_xsd_decimal_compare(), rasqal_xsd_decimal_equals() and other internal methods.

Query language changes

Updated the SPARQL syntax to support integer^^uri-ref. Fixes Issue #0000519 (Redland librdf)

Removed RDQL support as promised. So long and thanks for all the queries. Use SPARQL instead.

Portability changes

Test for mpfr_snprintf() specifically which appeared in MPFR 2.4.0. Fixes Issue #0000523

The Bison minimum version is now 2.0 (from 2004-12-25) until we hear otherwise.

Use RASQAL_DISABLE_DEPRECATED to flag out deprecated implementation code. Call gtkdoc-scan with the deprecated guard.

Use #if defined(RASQAL_DEBUG) to help portability when it's not defined.

Added good and bad cast macros for checking of type truncation. Helped remove compiler warnings.

Configuration changes

Make configure handle Apple /usr/bin/flex which adds an extra field so awk $NF did not work.

configure now supports finding UUID support inside libc for OSX.

Fix some configure portability with non-POSIX bash syntax and adding some -W flags to autotool calls. Fixes Issue #0000506

Updated to abort run if a configuring program fails, generate NEWS with old timestamp if missing so automake can run and some small doc and message updates.

Rasqal 0.9.29 changes

Rasqal fully supports SPARQL 1.0 from this release. All the approved tests pass.

Requires Raptor 2.0.7 or newer.

RDQL query language support will be removed in the next release. SPARQL has been available for 4 years and is fully supported.

Add support for SPARQL 1.1 draft UUID() and STRUUID().

Issues Fixed:

  • 0000493: Offset in sub-select results in no rows at all.
  • 0000494: Temp buffer to small.
  • 0000504: rasqal_regex_replace() is not public

Datatype changes

Added a new datatype rasqal_xsd_date class for XSD with literal enum RASQAL_LITERAL_DATE, constructor rasqal_new_xsd_date(), destructor rasqal_free_xsd_datetime() and core methods rasqal_xsd_date_to_counted_string(), rasqal_xsd_date_to_string() rasqal_xsd_date_equals() (returning incomparible) and rasqal_xsd_date_compare().

The rasqal_xsd_datetime and new date class above both get the same new fields for comparing datetimes and dates: time_on_timeline and have_tz to record the three timezone possibilities: none ('N'), zulu ('Z') or numeric ('Y'). A "time on timeline" value is calculated on construction and the field values are not normalized.

Added rasqal_xsd_datetime_equals2 deprecating rasqal_xsd_datetime_equals and returning and incomparible flag to caller.

Added rasqal_xsd_datetime_compare2() deprecating rasqal_xsd_datetime_compare() and returning the incomparible state between datetimes. The new rasqal_xsd_date_compare() uses this signature.

Added new rasqal_new_xsd_datetime_from_xsd_date() datetime constructor to build a datetime from a date.

Correct the buffer size in rasqal_xsd_datetime_get_seconds_as_decimal() Fixes Issue #0000494

Graph pattern class changes

Added rasqal_query_graph_pattern_visit2() deprecating rasqal_query_graph_pattern_visit()

Literal class changes

Enum rasqal_op gains new tokens RASQAL_EXPR_UUID and RASQAL_EXPR_STRUUID for the new SPARQL 1.1 draft UUID() and STRUUID built-in functions.

rasqal_literal_divide() result is now a decimal if both args are integer - rule from XPath F&O;

Added support for the XSD:Date datatype with a new rasqal_literal_type enum value RASQAL_LITERAL_DATE. Updated the literal code including the constructor rasqal_new_numeric_literal() to auto-convert to the internal format as well as the core literal methods.

Query engine changes

The rules for in-scope variables for FILTER were corrected to match the SPARQL 1.0 semantics. This fixed the last remaining failure Rasqal had for the SPARQL 1.0 approved test cases.

DISTINCT now compares using RDF term comparison not value comparison so now "" is distinct from ""^^xsd:string. This has a consquence of making RDQL test B-01 as failing but this is no loss. Relatedly, RDQL support will be removed in the next release.

Handle errors found in aggregation expressions following SPARQL standard.

Fix blank node generation when made in a CONSTRUCT to match SPARQL standard.

Make limit and offset check work properly in a subquery. Fixes Issue #0000493

Added support for executing SPARQL 1.1 draft UUID() and STRUUID using either libuuid or internal random API that backs executing RAND().

Resilience changes

Ran entire SPARQL 1.0 and 1.1 test suite through Rasqal and valgrind to check for reference loss and memory leaks. Fixed several issues in newer code.

Fixed several code issues with unused values found by clang. Or changed code that was correct to make clang moan less.

Add code marking of good and bad type casts using macros RASQAL_GOOD_CAST and RASQAL_BAD_CAST macros.

Other changes

The configure test for libgcrypt as a digest backend now works; it really didn't before now. Added option --with-libgcrypt-config=PATH to allow selecting the path to the libgcrypt-config. mhash remains the preferred hash digest library as it provides more digests and is more commonly available.

configure now looks for libuuid with pkg-config to back the SPARQL 1.1 UUID generation support. The UUID backend can be selected with new configure option --uuid-library=NAME

Made rasqal_regex_replace() public with same signature as the internal API. Fixes Issue #0000504

The tests/sparql/check-sparql test runner was updated to understand more of the manifest vocabulary.

Building from GIT now requires automake 1.11.2+ for the -Wextra-portability option.

Added -d none to roqet(1) arguments so it is possible disable debug output on the command line (default).

Rasqal 0.9.28 changes

Issues Fixed:

  • 0000466: zero size calloc does not return object (src/rasqal_row.c)
  • 0000467: Tests fail because diff doesn't accept -u flag
  • 0000470: snprintf portability issues
  • 0000471: Compile error when RASQAL_DEBUG set to > 1
  • 0000474: roqet flags listed in help, but not recognised

SPARQL changes

The language name 'sparql' is now SPARQL 1.1

Added support for SPARQL 1.1 draft string functions STRBEFORE(), STRAFTER() and REPLACE().

Query engine changes

Add parsing and evaluation support for SPARQL 1.1 draft STRBEFORE (2 args), STRAFTER (2 args) and REPLACE (3 or 4 args). The evaluation of REPLACE currently fully works for PCRE regex with Unicode and works for POSIX regex without Unicode.

Clear errno before calling strtol() and checking the result. This caused issues when used in threaded applications, even though Rasqal is not thread-safe.

The (psuedo) random number generation now can use a variety of library random routines, defaulting to a new internal Mersenne Twister implementation - libmtwist. The choice of PRNG can be made with configure --with-random-approach=ALGO to pick from mtwist (the default), gmp (when GMP is available and used for decimals), random_r(), rand_r() then the portable but not so safe: random() and rand().

Expression class changes

Enum rasqal_op gains new tokens RASQAL_EXPR_STRBEFORE, RASQAL_EXPR_STRAFTER and RASQAL_EXPR_REPLACE for the new SPARQL 1.1 string expressions. STRBEFORE(), STRAFTER() and REPLACE() respectively.

Added rasqal_new_4op_expression() to construct 3/4-arg expressions.

Query format and query result format changes

Added the W3C Format URIs to the JSON, XML, CSV and TSV SPARQL result formats. (Nicholas J Humfrey)

Corrected the SPARQL query output for LIMIT and OFFSET

Handle <literal></literal> as empty literal when reading in XML query results.

Other changes

Use a more comprehensive configure build and run test for ceil(), floor() and round() to prevent GCC optimizing it away and getting the wrong answer when checking whether to link with -lm

Removed the obsolete -w option from the roqet --help message which was removed from code some time ago. Fixes Issue 0000474.

Prevent a gcc 4K stack size warning in a few tests.

Reorganized the regex code to a new regex module, adding the new function rasqal_regex_replace() for regex search and replace (all) backing SPARQL 1.1 REPLACE()

Several internal fixes for compiling with RASQAL_DEBUG > 1 (Lauri Aalto) Fixes Issue #0000471

Remove several internal uses of snprintf() for simple integer formatting.

The check-sparql utility used during 'make check' now sets the DIFF envariable for check tests to allow use off GNU Diff. Fixes Issue #0000467 (Peter O'Gorman / pogma)

Code style changes for calling calloc().

Do not calloc() with 0 count for a result row - not portable. Fixes Issue #0000466 (Peter O'Gorman / pogma)

The check_query utility (which is still not complete) can now handle comparing query results when sorting is involved.

Rasqal 0.9.27 changes

Issues Fixed:

  • 0000127: UNION graph pattern support in query engine
  • 0000423: SPARQL UNION with shared variables fails
  • 0000434: OPTIONAL and named graphs don't mix
  • 0000454: xsd:nonNegativeInteger is parsed as RASQAL_LITERAL_QNAME instead of RASQAL_LITERAL_[INTEGER|UDT|INTEGER_SUBTYPE]
  • 0000459: Making a query that binds to a variable with the same name as a bnode fails

SPARQL changes

The parser now supports the optional SILENT keyword for SERVICE.

The parser now supports the CONSTRUCT WHERE abbreviation, expanding the WHERE triples into a triple template with the same triples.

Query engine changes

sub-SELECTs are now supported including those that contain sorting, grouping, limiting and offset as well as projection.

CONSTRUCT works when working over a query with optionals. It previously stopped returning results at the first unbound variable value.

OPTIONAL, sub-graph pattern groups and UNION fully execute correctly. Fixes were made to the variable scoping and join operations.

A lot of refactoring was done to provide the structure to enable sub-SELECT to be turned into a query algebra structure and executed.

An entirely new variable scoping algorithm was implemented to properly compute where a variable is assigned; the assumption was removed that a variable with a given name can only be bound in one place.

Several bugs were fixed in the join implementation which affected the sub-graph pattern grouping (natural join) and optional (left join).

Pulled new internal function rasqal_query_results_formatter_get_read_rowsource() out of rasqal_service_execute() to provide the structure for executing SERVICE queries in the query engine.

Literal class changes

rasqal_new_numeric_literal_from_long() added to make an integer or decimal literal depending if it fits in range.

rasqal_xsd_decimal_get_long() added to convert an arbitrary precision decimal to a C long with an overflow error flag.

xsd:integer subtypes are stored and printed correctly. Fixes Issue #0000454.

Query class changes

rasqal_query_get_distinct() added to get the distinct flag from SELECT DISTINCT ... queries.

rasqal_query_set_wildcard() added to set the '*' flag for SELECT * queries

rasqal_query_has_variable2() added with variable type arg deprecating rasqal_query_has_variable(). Note the warning about using RASQAL_VARIABLE_TYPE_UNKNOWN is ambiguous.

Deprecated rasqal_query_has_variable() for the above. Lookup by any type.

rasqal_query_set_variable2() added with type arg deprecating rasqal_query_set_variable(). Note the warning about using RASQAL_VARIABLE_TYPE_UNKNOWN is ambiguous.

Deprecated rasqal_query_set_variable() for above. Lookup by any type.

Query result format changes

The CSV and TSV query result formats (names csv and tsv respectively) were altered to match the editor's draft SPARQL 1.1 Query Results CSV and TSV Formats which includes no header line, no result number and implementing the specified quoting and end of lines in the specification.

Variable class changes

rasqal_variables_table_add_variable() added to add an existing variable to a variables table.

rasqal_variables_table_get_by_name() added with variable type arg.

rasqal_variables_table_contains() added to check if a variable with the given type and name is in the variables table.

roqet(1) utility changes

Correctly order the help so the -d/--dump-query value list appears after the option description.

Porting changes

Several patches were made to aid compiling on MS Windows were applied based on those made by the KDE Emerge scripts to build KDE on windows. This includes a native replacement for the missing gettimeofday() and timegm() functions. MS Windows remains an unsupported target.

Other changes

The minimum Raptor version needed is now 2.0.4 for the raptor_bnodeid_ntriples_write() function.

The test runner was fixed to fail the suite when there are failures as well as expected failures.

Code style change and cleanup for alloc/free macros. New code style:

  1. var = RASQAL_CALLOC(type, nmem, size)
    var = RASQAL_CALLOC(type, 1, sizeof(*var))
    when nmem = 1
  2. var = RASQAL_CALLOC(type, size)
  3. RASQAL_FREE(type, var)

The consequence here is allocs that mostly fit into 1 line without so much boilerplate and duplication of types. The RASQAL_MALLOC and RASQAL_CALLOC macros now do the cast to the return type. RASQAL_FREE takes the object type too but always casts arg to void This

Code style change for allocating strings:

  1. len = strlen(); malloc(..., len + 1)
  2. and memcmp(..., len + 1)

Expanded GCC warnings to take advantage of newer analysis which found several issues:

  • Use of int for storing string and buffer lengths: replaced many internal uses with the correct size_t for length computations.
  • Use of int for storing time: replaced with time_t that may be larger
  • Use of void* for pointer differences: replaced with ptrdiff_t where necessary.
  • Precision truncation between int and long, size_t.
  • Precision truncation between float and double.

Made several internal functions to improve the above. There remain some int / size_t errors in the public API that will need new API functions to properly fix for 64-bit machines dealing with strings more than >32bits in length; which should be rare.

Reduced Rasqal's call stack size by ensuring all I/O buffers are dynamically allocated.

configure now always checks for where ceil(), floor() and round() can be found: in libc or libm.

The configure default for --enable-maintainer-mode no longer enables the debugging symbols. These can be added with --enable-debug

The configure gains an option --with-gmp=PATH to set the installation path of the GNU Multiple Precision Arithmetic Library (GMP) if it is not in the standard lib/include prefix.

Rasqal 0.9.26 changes

Issues Fixed:

  • Issue #0000430: Incorrect HTML generated with unknown literal types
  • Issue #0000431: Only a limited number of literal datatypes are displayable in a HTML format.
  • Issue #0000436: queries involving calculations with large numbers return incorrect results unless scientific notation is used
  • Issue #0000438: timegm not available on solaris
  • Issue #0000439: warning when variable is not selected makes 4store tests to fail
  • Issue #0000446: rasqal may require -lm for floor, ceil, round on some systems and architectures

SPARQL 1.1 Query draft language changes

Added support for SPARQL 1.1 message digest functions MD5(), SHA1(), SHA224(), SHA256(), SHA384() and SHA512()

Query engine changes

Many internal query engine changes to more accuractly compute variable scope, use and binding to better support more complex queries with scopes such as UNION (now mostly working) and sub-SELECT (execution is not yet supported).

Added rasqal_world_set_warning_level() to set the query warning level in the 0...100 range where 0 is no warnings, 50 is the default and 100 is all warnings.

Query errors now fail with regular errors not fatal errors that abort(). Query parsing errors are not work killing the process. Also adjusted some error paths to prevent reporting 2 errors at once.

rasqal_op enumeration gains values RASQAL_EXPR_MD5, RASQAL_EXPR_SHA1, RASQAL_EXPR_SHA224, RASQAL_EXPR_SHA256, RASQAL_EXPR_SHA384 and RASQAL_EXPR_SHA512 for message digest expressions corresponding to SPARQL 1.1 message digest functions.

Added message digest support either built with internal MD5 and SHA1 which are always available, or with libmhash which provides the full list of message digests that SPARQL 1.1 requires (and is optimized).

Make ROUND() work with XSD Decimal when compiled against GNU MP.

Check for overflow when converting a string to int and if resulting long won't fit in an int, turn it into a decimal. Fixes Issue #0000436.

Removed Query Engine V1 that was long disabled. configure loses the --with-query-engine-version option.

Query results formatter class changes

Fixed HTML query results generating invalid HTML. Fixes Issue #0000430

Support writing additional literal types in HTML query results. Fixes Issue #0000431

The JSON query result format now accepts the application/sparql-results+json mime type, as specified in the Serializing SPARQL Query Results in JSON W3C WG Note.

roqet(1) utility changes

Added options -W / --warnings level (default 50) to set the warning level and -E to ignore errors.

Other changes

configure gains a --enable-debug option to enable or disable the debugging messages. Useful for when building using from GIT.

Removed internal test/debug 'redland' triples store that has not worked for some time. Removed the --with-triples-source and --with-redland-config options from configure.

Add a portable version of timegm() when it is not present in the system (such as Solaris). Fixes Issue #0000438.

Added configure tests for ceil(), floor() and round() that look for them in libc or libm. Fixes Issue #0000446.

Fixed up several code paths with problems found by clang, mostly unused variables, unnecessary calculations but a couple of bad accesses.

Rasqal 0.9.25 changes

Issues Fixed:

SPARQL 1.1 Query draft language changes

Added support for SPARQL 1.1 numeric functions ABS(), ROUND(), CEIL() and FLOOR().

Added support for SPARQL 1.1 BIND(expr as ?var) using existing RASQAL_GRAPH_PATTERN_OPERATOR_LET.

Added support for SPARQL 1.1 CLEAR and DROP to use optional SILENT keyword.

Added support for SPARQL 1.1 RAND() along with a query API feature for user setting of the random seed.

Added support for SPARQL 1.1 TZ()

Fixed SPARQL 1.1 ENCODE_FOR_URI() to not preserve language and datatype of input.

Fixed support for SPARQL 1.1 BNODE() to work with no argument given.

Fixed SPARQL 1.1 GROUP BY to allow an optional AS ?var.

Fixed support for """-quoted and '''-quoted strings not over-quoting and adding support for optional language. Fixes Issue #0000427 and Issue #0000428.

DateTime class changes

Added rasqal_xsd_datetime_get_tz_as_counted_string() to get back the timezone string component of a datetime.

Datatype class changes

rasqal_xsd_format_double() now correctly formats numbers that have no trailing 0s.

Decimal class changes

Added rasqal_xsd_decimal_abs(), rasqal_xsd_decimal_round(), rasqal_xsd_decimal_ceil() and rasqal_xsd_decimal_floor() to support the ABS(), ROUND(), CEIL() and FLOOR() functions for decimals.

Expression class changes

rasqal_op gains RASQAL_EXPR_ABS, RASQAL_EXPR_ROUND, RASQAL_EXPR_CEIL and RASQAL_EXPR_FLOOR for numeric operations, RASQAL_EXPR_RAND for SPARQL 1.1 RAND() and RASQAL_EXPR_TZ for SPARQL 1.1 TZ() timezone accessor.

Added an evaluation context structure rasqal_evaluation_context for the information needed to evaluate any rasqal_expression tree. This makes expression evaluation independent of a query, but still tied to a rasqal world and (via variables) a variables table. Added constructor rasqal_new_evaluation_context() to set the locator and flags, destructor rasqal_free_evaluation_context(), method rasqal_evaluation_context_set_base_uri() to set/reset the shared reference to the context base URI and method rasqal_evaluation_context_set_rand_seed() to set the random seed for the evaluation.

Added rasqal_expression_evaluate2() taking just an expression and an evaluation context.

rasqal_expression_evaluate() is deprecated for the above.

Added new method rasqal_xsd_datetime_get_tz_as_counted_string() for executing RASQAL_EXPR_TZ for SPARQL 1.1 TZ().

Query Engine changes

Initialise seed for RAND() from either a mixture of system sources or from a value set by user. The user value can be set with new query feature RASQAL_FEATURE_RAND_SEED. Uses rasqal_evaluation_context_set_rand_seed() on the query's internal evaluation context.

Enable rasqal_query_set_store_results() to actually work after a query prepare.

Handle evaluation of FILTER over an empty inner graph pattern such as in a query like ASK WHERE { FILTER ( TRUE ) }

Ignore errors in executing SPARQL 1.1 project expression AS variables.

Update rasqal_literal_as_boolean(), rasqal_literal_as_integer and rasqal_literal_as_floating when evaluating NULL to return a type error not an assertion failure or abort (in debug mode).

Change internal error handling to separate a NULL return from an error return when evaluating expressions. Updated lots of callers of expression evaluation to handle a NULL expression response. Needed since now NULL is a valid expression evalution in some cases; like STRLANG() on non-simple literals.

Updated to use rasqal_evaluation_context for expression evaluation.

Handle support executing empty graph patterns such as in queries like SELECT (expr AS ?var) WHERE {} which just evaluates expr and returns a single row with a single result.

Query Result Formatter class changes

Handle NULL values for RDF and Tables results.

Other changes

Added rasqal_world_get_query_language_description() to get a description of a query language replacing and deprecating rasqal_languages_enumerate().

More fixes to check-query test script.

Make GPL V2 or newer explicit in LICENSE.html.

Rasqal 0.9.24 Changes

SPARQL 1.1 Update draft Language changes

Added support for CLEAR and DROP applying to more than one graph. The options are now: just default graph with DEFAULT, all named graphs with NAMED and all graphs with ALL.

Added support for optional SILENT flag before most update operations.

Added support for ADD, MOVE and COPY operations which both operate between two graphs - either named or default. The source graph is stored in the update structure graph_uri field and the destination graph in the document_uri field; the names have no meaning here since both are graphs and a NULL value signifies the default graph.

Added support for DELETE WHERE {} writing the triple results into the delete_templates field of the update structure.

Added support for multiple update operations in one 'query' separated by ';'.

GROUP_CONCAT() now sets the RASQAL_EXPR_FLAG_AGGREGATE rasqal_expression flag like the other builtin aggregate expressions.

Query Engine changes

Fixed a few memory leaks in aggregate operation with GROUP and with HAVING.

Literal API changes

Fixed a memory leak with datetime literals.

Update API changes

rasqal_update_type gains new enum values RASQAL_UPDATE_TYPE_ADD, RASQAL_UPDATE_TYPE_MOVE and RASQAL_UPDATE_TYPE_COPY for the SPARQL 1.1 Update ADD, MOVE and COPY operations respectively.

Added enum rasqal_update_graph_applies to specify scope that update applies to beyond one graph to either just the default graph, to all named graphs or to all graphs. Applies to CLEAR and DROP operations only

Other changes

Make all object destructors simply return on a NULL object pointer. This was already done but with different code styles.

Rasqal 0.9.23 Changes

Fixed Issues:

  • 0000407: ORDER BY does not appear to handle undefined values correctly
  • 0000414: Type of operation->insert_templates depends on Update syntax
  • 0000415: Graph pattern operator not correctly filled out in SPARQL 1.1 Updates
  • 0000417: SELECT DISTINCT sometimes returns duplicates

Graph pattern class changes

Added rasqal_graph_pattern_get_flattened_triples() to flatten a recursive basic/graph graph pattern to a sequence of triples or triple patterns (have variables).

SPARQL Query Language changes

Fix the parsing of SPARQL 1.1 Update draft INSERT and DELETE to return sequences of triples in the insert_templates and delete_templates fields as documented. It would previously sometimes return that but mostly return a sequence of recursive graph patterns.

When a syntax error happens due to use of a language feature, do proper error handling (no aborting) and clean up parsing resources.

Rasqal 0.9.22 Changes


This means: functions, enums and types were added, removed and changed.

Consequently the shared library major soname version has changed from 2 to 3.

The main changes in this release were to add more draft SPARQL 1.1 features and to use Raptor V2.

Rasqal now depends on Raptor V2. Raptor V1 is not supported. The minimum Raptor2 version is 2.0.0.

Given the the large dependency change above that requires recompiling with some breakage, this release makes an ABI and API break. All deprecated functions, types and other deprecated functionality have been removed. The libtool library version was bumped to 3.0.0. The detailed API changes are described in the Changes section of the Rasqal reference manual.

Query Engine Changes

Query engine initialises start of execution datetime to enable a NOW() function to provide a stable value during a single execution.

Query Language Changes

Split query language support into more languages with aliases:

  • sparql (and alias sparql10): SPARQL 1.0 query with no 1.1 features.
  • sparql11-query: SPARQL 1.1 query.
  • sparql11-update: SPARQL 1.1 update.
  • sparql11: SPARQL 1.1 with both query and update.
  • laqrs: LAQRS experimental language with all of above plus experiments.

LAQRS Query Language changes

Added experimental datetime builtin methods:

  • NOW() / CURRENT_DATETIME(): Synonyms to return an XSD datetime for the current wall clock date and time. At the first execution / preparation of the query, the value is set as a constant throughout the life of the query execution.
  • FROM_UNIXTIME(): turns an integer value into an XSD DateTime.
  • TO_UNIXTIME(): turns an XSD DateTime into an integer value.

These functions are not opposites and will not roundtrip date times since they do not take into consideration leap seconds or daylight saving time changes.

SPARQL Query Language changes

Fixed SPARQL 1.1 draft isNUMERIC() which was stored wrongly in the parse tree as RASQAL_EXPR_ISLITERAL.

Added SPARQL 1.1 draft dateTime accessor builtin functions along with expression execution support.

  • DAY()
  • HOURS()
  • MONTH()
  • YEAR()

Added SPARQL 1.1 draft string builtin functions along with expression execution support.

  • CONCAT()
  • LCASE()
  • STRLEN()
  • SUBSTR()
  • UCASE()

Data Graph class changes

Removed deprecated rasqal_new_data_graph() constructor replaced by rasqal_new_data_graph_from_uri() with additional arguments.

Datetime class changes

Added rasqal_xsd_datetime class to the public API implementing the XML Schema datatypes (XSD) dateTime with microsecond accuracy (where present) and timezone offsets of minutes accuracy. The new class has constructors:

  • rasqal_new_xsd_datetime()
  • rasqal_new_xsd_datetime_from_timeval()
  • rasqal_new_xsd_datetime_from_unixtime()


  • rasqal_free_xsd_datetime()

and methods:

  • rasqal_xsd_datetime_compare()
  • rasqal_xsd_datetime_equals()
  • rasqal_xsd_datetime_get_as_timeval()
  • rasqal_xsd_datetime_get_as_unixtime()
  • rasqal_xsd_datetime_get_seconds_as_decimal()
  • rasqal_xsd_datetime_get_timezone_as_counted_string()
  • rasqal_xsd_datetime_set_from_timeval()
  • rasqal_xsd_datetime_set_from_unixtime()
  • rasqal_xsd_datetime_to_counted_string()
  • rasqal_xsd_datetime_to_string()

Expression class changes

rasqal_expression_evaluate() now evaluates the new SPARQL 1.1 draft strings and datetime builtin functions.

rasqal_op gains new values for SPARQL 1.1 builtin functions:


rasqal_op gains new values for LAQRS experimental builtin functions:


rasqal_new_function_expression() constructor gained params and flags arguments to handle aggregate expressions. This was renamed from rasqal_new_function_expression2().

Removed deprecated rasqal_new_function_expression2() replaced by rasqal_new_function_expression() with same arguments.

Added constructor rasqal_new_expr_seq_expression() replacing rasqal_new_coalesce_expression() and taking an op argument to use for different expression operations.

Removed method rasqal_new_coalesce_expression() replaced by rasqal_new_expr_seq_expression() with additional op argument.

rasqal_expression_evaluate() evalutes experimental LAQRS datetime builtin methods NOW(), CURRENT_DATETIME(), FROM_UNIXTIME() and TO_UNIXTIME().

Fixed RASQAL_EXPR_DATATYPE expression execution to return the result rather than the function argument.

Literal class changes

Support XSD dateTime literals. rasqal_literal value union gains a datetime field.

Added new constructor rasqal_new_datetime_literal_from_datetime() to make a datetime literal.

rasqal_literal_set_typed_value() turns xsd:dateTime literals into rasqal_xsd_datetime objects.

rasqal_literal_equals_flags() and rasqal_literal_compare() now use rasqal_datetime equality and comparison methods.

Added new accessor rasqal_literal_as_counted_string() get the string version of its and its length, letting the caller avoid strlen() on the result.

Query class changes

Added method rasqal_query_get_result_type() to get the expected result type based on the query structure.

Added method rasqal_query_set_store_results to enable storing results of an execution.

Removed deprecated methods: rasqal_query_set_fatal_error_handler() rasqal_query_set_error_handler() rasqal_query_set_warning_handler() replaced by using rasqal_world_set_log_handler() calling a raptor_log_handler.

Removed deprecated methods: rasqal_query_set_default_generate_bnodeid_parameters() rasqal_query_set_generate_bnodeid_handler() that have moved to methods on the rasqal_world object: rasqal_world_set_default_generate_bnodeid_parameters() and rasqal_world_set_generate_bnodeid_handler() respectively.

rasqal_query_add_data_graph() was altered to take a single rasqal_data_graph argument instead of uri, name and flags. This was renamed from rasqal_query_add_data_graph2().

Removed rasqal_query_add_data_graph2() replaced by rasqal_query_add_data_graph() with same arguments.

Query Results class changes

Added support for query result rewinding, if the results were stored in execution via rasqal_query_set_store_results(), new method rasqal_query_results_rewind() may be called to reset back to the initial binding result.

Added rasqal_query_results_get_row_by_offset() to access stored query result rows if storing results was enabled by rasqal_query_set_store_results().

Enum rasqal_query_results_type gains value RASQAL_QUERY_RESULTS_UNKNOWN for when a query result type is unknown or yet to be determined.

Added method rasqal_query_results_get_type() to get the query result type.

rasqal_query_results_read() was altered to take a name, mime_type, format_uri, base_uri args instead of format_uri, base_uri. This was renamed from rasqal_query_results_read2().

Removed rasqal_query_results_read2() replaced by rasqal_query_results_read() with the same arguments.

rasqal_query_results_write() was altered to take a name, mime_type, format_uri, base_uri args instead of format_uri, base_uri. This was renamed from rasqal_query_results_write2().

Removed rasqal_query_results_write2() replaced by rasqal_query_results_write() with same arguments.

Query Results Formatter class changes

Added new constructor rasqal_new_query_results_formatter_for_content() to get a query result formatter based on guessing from format URI, name, mime type, some initial content or an identifier using rasqal_world_guess_query_results_format_name().

Removed rasqal_new_query_results_formatter2() constructor replaced by rasqal_new_query_results_formatter() constructor.

Removed deprecated rasqal_new_query_results_formatter_by_mime_type() replaced by rasqal_new_query_results_formatter_for_content() with additional arguments.

Added world method rasqal_world_guess_query_results_format_name() to guess format based on format URI, mime type, some initial content or an identifier.

Added guessing based on identifier/filename suffix for the 'rdf' (.rdf), 'turtle' (.ttl, .n3) and 'xml' (.srx) formatters.

Added reading support for the existing 'rdfxml' and 'turtle' query result formatters to make both of these read/write formatters.

Added rasqal_world_get_query_results_format_description() to get the list of query results format syntaxes using a raptor_syntax_description structure. This replaced and deprecates the rasqal_query_results_formats_enumerate() and rasqal_query_results_formatter_get_mime_type() methods.

This change allows the query result formats to be identified and discovered by multiple names (aliases) and URI strings when using the rasqal_new_query_results_formatter2() constructor.

rasqal_new_query_results_formatter() constructor was altered to take name, format type, format URI args instead of just name, format URI. This was renamed from rasqal_new_query_results_formatter2().

rasqal_query_results_formats_check() was altered to take name, format URI, mime_type flags instead of name, uri and type. This was renamed from rasqal_query_results_formats_check2().

Removed rasqal_query_results_formats_check2() replaced by rasqal_query_results_formats_check() with the same arguments.

Removed rasqal_query_results_formats_enumerate() replaced by rasqal_world_get_query_results_format_description() using static syntax description approach.

Removed rasqal_query_results_formatter_get_mime_type() replaced by using fields of raptor_syntax_description structure returned by rasqal_world_get_query_results_format_description().

Variable class changes

Removed deprecated constructors rasqal_new_variable_typed() rasqal_new_variable() replaced by the rasqal_variables_table_add() method on a variables table to create and add a variable in a context.

Other changes

Replaced all uses of strcpy() with memcpy() and known lengths.

Refactored huge rasqal_expression_evaluate() switch and case code into sub-methods preparing for possible later change to a jump table based on expression operation.

rasqal_xsd_decimal_as_string(): Fix decimal to string xsd lexical form details: rounding precision, format details (such as 0.0 not 0.0E0) when built with MPFR or GMP instead of the (imprecise) double implementation.

Fix xsd double lexical form formatting to use capital E.

Started creating check-query query test runner utility.

Rasqal 0.9.21 Changes

The main changes in this release are to add support for features of SPARQL 1.1 Query W3C working draft of 14 October 2010:

  • Executing grouping of results: GROUP BY
  • Executing aggregate expressions: AVG, COUNT, GROUP_CONCAT, MAX, MIN, SAMPLE, SUM
  • Executing filtering of aggregate expressions: HAVING
  • Parsing of new syntax: BINDINGS, isNUMERIC(), MINUS, sub SELECT and SERVICE.

Fixed Issues:

  • 0000388: Can only write JSON format for variable binding and boolean results

Query Engine changes

Support executing new SPARQL 1.1 draft function isNUMERIC().

Support executing built-in aggregate expressions:

  • AVG(expr)
  • COUNT(*) and COUNT(expr)
  • GROUP_CONCAT(expr) with optional ;separator = 'string'
  • MAX(expr)
  • MIN(expr)
  • SAMPLE(expr)
  • SUM(expr)

with and without DISTINCT across the arguments.

Support executing grouping of results with GROUP BY (or implicitly if aggregate function was given) and HAVING to filter groups.

LAQRS Query Language changes

Explain more carefully that EXPLAIN and COALESCE() are LAQRS only and remain experimental.

SPARQL Query Language changes

Separate SPARQL 1.0 and SPARQL 1.1 draft language names giving query languages sparql (with alias sparql10 for SPARQL 1.0), sparql11 for SPARQL 1.1 and laqrs for experiments. The sparql name without a version currently points to SPARQL 1.0 but over time will advance to be SPARQL 1.1

Added support for parsing (not executing) new SPARQL 1.1 draft tokens: BINDINGS for variable bindings, UNDEF, SERVICE and MINUS.

Added support for parsing and executing new SPARQL 1.1 draft isNUMERIC() expression.

Added support for parsing (not executing) new SPARQL 1.1 draft sub-SELECT queries.

Support for parsing and executing built-in (not user) aggregate expressions: AVG(expr), COUNT(*) and COUNT(expr), GROUP_CONCAT(expr) with optional ;separator = 'string', MAX(expr), MIN(expr), SAMPLE(expr) and SUM(expr) with and without DISTINCT across the arguments.

Added support for executing grouping of results with GROUP BY (or implicitly if aggregate function was given) and HAVING to filter groups.

Bindings class changes

Added a class to support for SPARQL 1.1 draft BINDINGS in a query specifying a set of variable bindings and a sequence of rows of values to bind to them. Intended for applying to a SPARQL 1.1 draft query SERVICE call.

Added bindings class rasqal_bindings with constructor rasqal_new_bindings, destructor rasqal_free_bindings() and method rasqal_bindings_print()

Added accessor methods for getting bindings variables and rows rasqal_query_get_bindings_variables_sequence(), rasqal_query_get_bindings_variable(), rasqal_query_get_bindings_rows_sequence() and rasqal_query_get_bindings_row()

Data Graph class changes

Turn a data graph into a reference-counted class and add support for specifying the format of a data graph for parsing after retrieval.

typedef rasqal_data_graph gains new optional format_type, format_name and format_uri fields for describing the format of the graph an optional uri field for base URI and a usage field.

Added constructor rasqal_new_data_graph_from_uri() with format_type, format_name and format_uri args deprecating rasqal_new_data_graph() without them, which always guessed the format.

Added constructor rasqal_new_data_graph_from_iostream() taking a raptor_iostream arg to allow getting data graphs from non-URIs which could be strings, memory etc.

Added copy constructor rasqal_new_data_graph_from_data_graph() for data graphs.

Expression and literal class changes

Added support for SPARQL 1.1 draft isNUMERIC() expressions. The rasqal_op gains a new RASQAL_EXPR_ISNUMERIC value.

Added rasqal_expression_op_label() to return the label for an expression operation.

Added rasqal_expression_compare() to compare literals.

Added rasqal_expression_is_aggregate() to test if an expression is an aggregate one - has an aggregate operation or user-defined function.

Added rasqal_literal_type_label() to return the label for a literal type.

Graph pattern class changes

rasqal_graph_pattern_operator enumeration gains new values for SPARQL 1.1 draft features: RASQAL_GRAPH_PATTERN_OPERATOR_SELECT for sub-SELECT, RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE for service binding and RASQAL_GRAPH_PATTERN_OPERATOR_MINUS for minus operation between graph patterns.

Added new constructor rasqal_new_single_graph_pattern() for use with service and minus graph patterns.

Added rasqal_graph_pattern_get_variable() method to get the variable for SPARQL 1.1 draft BIND and LAQRS LET graph patterns.

Added rasqal_graph_pattern_get_service() method to get the service object for SPARQL 1.1 draft SERVICE graph pattern.

Query class changes

Added rasqal_query_add_data_graph2() to add a previously constructed data graph to a query deprecating rasqal_query_add_data_graph() that did construct and add in one go.

Added rasqal_query_add_data_graphs() to add a sequence of data graphs to a query.

Added rasqal_query_add_data_graph_from_iostream() using new rasqal_new_data_graph_from_iostream().

Note in the docs for rasqal_query_set_limit() and rasqal_query_set_offset() that with the new query engine approach, you cannot set the limit or offset until the query is prepared which is after parsing.

Query results class changes

Add a formatter to write a variable bindings query results in Turtle format with the schema used for the W3C DAWG and SPARQL Working group test cases.

rasqal_query_results_formats_check2() added with new flags arg for asking for a format to read or write, deprecating rasqal_query_results_formats_check() without it.

Row class changes

The rasqal_row gains a group_id field for returning group boundaries. Change of groups should be detected by a change in IDs between rows.

Service class changes

Added a rasqal_service class for executing remote queries against a SPARQL HTTP protocol endpoint and getting back a query results set. The data graphs attached get turned into default-graph-uri and named-graph-uri URI parameters to the request.

Added constructor rasqal_new_service(), destructor rasqal_free_service() and methods rasqal_service_set_www() to set the WWW object rasqal_service_set_format() to set the accept request header and rasqal_service_execute() to execute the query returning the results.

Triples source class changes

Add a way for a triples source factory to return meaningful errors by adding a new init_triples_source factory method to the rasqal_triples_source_factory that takes a rasqal_triples_error_handler callback. The RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION is now 2 and ranges 1 to 2 are supported.

Add a way for a triples source to indicate support for optional features by adding a support_feature method toe the rasqal_triples_source structure. The RASQAL_TRIPLES_SOURCE_MAX_VERSION is now 2 and ranges 1 to 2 are supported.

Added enum rasqal_triples_source_feature with value RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH to indicate a triple source supports reading data graphs from a raptor_iostream.

Variable class changes

Now a reference-counted class.

Deprecated rasqal_new_variable() and rasqal_new_variable_typed() for rasqal_variables_table_add().

Internal changes

All destructors accept NULL objects and do nothing.

Add a Raptor V2-style raptor_syntax_description data model to Rasqal and use it to initialise query languages. It is not currently exposed in the API and may not be until Rasqal requires Raptor V2 when it can share code.

Added an internal rasqal_bindings structure for SPARQL 1.1 BINDINGS.

Add an internal query results modifiers structure rasqsal_solution_modifier class for use in storing group by, having, limit, offset information which together SPARQL 1.1 documentationc calls modifiers.

Added rowsources for grouping, executing aggregated queries across groups, having filters per group. Modified the projection rowsource to handle aggregation.

roqet(1) utility changes

Added support for serializing to graphs or bindings with the same Raptor serializer / Rasqal result formatter name such as for example 'json'.

Added -F NAME option for specifying the data graph format; otherwise Raptor uses the guessing mechanism.

Added support for reading a data graph from standard input (stdin) when the -D / --data , -G / --name or -s / --source options are used with value '-'.

Added -p / --protocol SERVICE-URI option to execute a remote query at a SPARQL HTTP protocol URI. This is used with -e query string to specify the query to execute remotely.

Configuration and build changes

Use AC_LANG_SOURCE for gcc flag test.

Other changes

The srxread and srxwrite example programs now build when Rasqal is configured and built with raptor V2.

Rasqal 0.9.20 Changes

The main changes in this release are:

  • Support more SPARQL 1.1 Query and Update draft syntax and some execution semantics for new built-in expressions.
  • Support building with Raptor V2 API as well as Raptor V1 API. The Raptor V2 API is only used if --enable-raptor2 is given to configure.

Fixed Issues:

  • 0000352: CONSTRUCT with a LIMIT doesn't limit query results
  • 0000353: CONSTRUCT with an ORDER always(?) returns an empty graph
  • 0000354: Comparing xsd:int and xsd:integer fails in SPARQL
  • 0000360: [PATCH] HTML Table results format
  • 0000374: Solaris 10 'make check' failures
  • 0000377: Cannot format results in roqet
  • 0000378: Crash when cleaning up after a failed query containing unsupported syntax

Query API changes

Moved generate blank node ID functionality to world class. Deprecated rasqal_query_set_default_generate_bnodeid_parameters() for rasqal_world_set_default_generate_bnodeid_parameters(). Deprecated rasqal_query_set_generate_bnodeid_handler() for new function (with different handler signature) rasqal_world_set_generate_bnodeid_handler().

Added rasqal_query_get_having_conditions_sequence() and rasqal_query_get_having_condition() for getting access to the HAVING expression list in a query.

Expression and literal class changes

Added new literal type RASQAL_LITERAL_INTEGER_SUBTYPE to let subtypes of xsd:integer work in data and expression evaluation.

Add support for SPARQL 1.1 draft FILTER expression operators including execution in the expression evaluation and writing the expression as SPARQL:

New rasqal_op enum SPARQL 1.1 expression
RASQAL_EXPR_IF IF(condition expression, expr if true, expr if false)
RASQAL_EXPR_STRLANG STRLANG(literal string, language string)
RASQAL_EXPR_STRDT STRDT(literal string, datatype URI)
RASQAL_EXPR_IN Expr IN ( list )

Added expression evaluation and expression formatting support for the above new (non-aggregate) expression operations in: rasqal_expression_clear(), rasqal_expression_visit(), rasqal_expression_write(), rasqal_expression_print(), rasqal_expression_is_constant() and rasqal_query_write_sparql_expression().

Added rasqal_op enumeration values for built-in aggregate functions RASQAL_EXPR_GROUP_CONCAT and RASQAL_EXPR_SAMPLE but no expression execution.

Added new bitflags rasqal_expression_flags for rasqal_expression flags with initial bitflags RASQAL_EXPR_FLAG_DISTINCT for distinct (aggregate functions) and RASQAL_EXPR_FLAG_AGGREGATE for aggregate functions.

Added rasqal_new_function_expression2() for functions with parameters and optional bit flags deprecating rasqal_new_function_expression(). This is not capable of adding a user extension aggregate function.

Added new rasqal_new_aggregate_function_expression() constructor for making a 1-arg built-in aggregate functions. This is not capable of adding a user extension aggregate function.

The never used RASQAL_EXPR_GROUP_COND_ASC and RASQAL_EXPR_GROUP_COND_DESC are marked as obsolete.

Updated documentation for rasqal_expression_visit(), rasqal_graph_pattern_visit_fn and rasqal_expression_visit_fn typedef to match what the code actually does.

Added rasqal_new_group_concat_expression() for building SPARQL GROUP_CONCAT() expressions with flags, non-empty list of expressions and optional literal separator.

SPARQL query language changes

Support latest SPARQL 1.1 Query W3C working draft of 1 June 2010 syntax such as:

For SPARQL 1.1 Query, allow DISTINCT optionally before extension function expressions with new flag RASQAL_EXPR_FLAG_DISTINCT.

Added draft SPARQL 1.1 Query IF(), URI(), IRI(), STRLANG(), STRDT() and BNODE() (with optional expression arg) built-in expressions.

Added draft SPARQL 1.1 Query IN() and NOT IN() operators.

Adjust draft SPARQL 1.1 Query select expression syntax to latest version: '(' Expr 'AS' Var ')' with required braces.

Added draft SPARQL 1.1 Query aggregate functions GROUP_CONCAT() and SAMPLE() with new expression enum RASQAL_EXPR_GROUP_CONCAT and RASQAL_EXPR_SAMPLE as well as formatting to SPARQL and placeholder expression handling implementation - no aggregate expression evaluation. Supports the optional ; SEPARATOR = "string" syntax for GROUP_CONCAT().

Add support for draft SPARQL 1.1 Query syntax GROUP BY a list of select expressions and HAVING with a list of expressions.

Add partial support for draft SPARQL 1.1 Query extension (aggregate) functions with DISTINCT and parameters.

Support latest SPARQL 1.1 Update W3C working draft of 1 June 2010 syntax such as:

  • DELETE DATA { ... }
  • DELETE DATA { GRAPH uri { ... } } INSERT DATA { GRAPH uri { ... } }
  • DELETE WHERE { ... }
  • DELETE WHERE { GRAPH uri { ... } }
  • DELETE { ... } WHERE { ... }
  • DROP GRAPH uri
  • INSERT DATA { ... }
  • INSERT { GRAPH uri { ... } } WHERE { ... }
  • LOAD uri INTO uri
  • LOAD uri
  • WITH uri DELETE { ... } INSERT { ... } USING NAMED uri WHERE { ... }

Not all cases may be covered yet since the grammar is hard to implement and may be ambiguous.

LAQRS syntax support

Start giving deprecated messages for LAQRS SELECT ... AS varname (bare variable name) instead of the draft SPARQL 1.1 Query SELECT ... AS ?varname with $ or ? symbol.

Query engine changes

Make query result limit and offset work when no ORDER BY is part of the query (yes - this is a well-defined count of under-defined actual results) with the original query engine. Related to Issue#0000352.

Add datatype support for xsd:date for value normalization and comparisons.

Handle when results are sorted before used to build triples via CONSTRUCT, which has no practical use since triples are not ordered and is less efficient since you have to read all the results into memory. Anyway, it works now.

Query results formatter class changes

Added an HTML Table results format (name 'table') by Nicholas J Humfrey using patch from Issue#0000360.

A NULL base_uri is valid in rasqal_query_results_formatter_write()

World class changes

Moved generate blank node ID functionality to world class, deprecating the query class methods. Added rasqal_world_set_default_generate_bnodeid_parameters(), rasqal_world_set_generate_bnodeid_handler() with new handler typedef rasqal_generate_bnodeid_handler2.

Other changes

Made all rasqal destructors simply return when given a NULL object pointer. They mostly did this already.

Updated based on fedora spec (not tested)

Replace strncpy() with memcpy() since the the strncpy() zero-checking and zero-filling semantics are never needed.

Minimum raptor version is now 1.4.19 so that the raptor_world typedef is always available.

Rasqal 0.9.19 Changes

The only change to this release is to fix the pkg-config rasqal.pc file to to restore the dependency on raptor which was accidently deleted. Lesson learnt: do not commit code after midnight local time.

Rasqal 0.9.18 Changes

The main changes in this release are:

  • Add initial draft parsing and API (NOT execution) support for SPARQL 1.1 Update W3C Working Draft of 2010-01-26.
  • Add public APIs (row, results, result formatter, variables table) so that query results can be built, read and written without a query.
  • Add API resilience checks for invalid NULL pointer arguments.

Fixed Issues:

  • 0000320: Add a void* user_data field to rasqal_variable
  • 0000323: Official MIME Type for JSON isn't text/json
  • 0000343: Mime type for 'table' results format is text/plan
  • 0000345: MIME Type and URI for TSV and CSV
  • 0000347: rasqal linking fix

Query API Changes

A user data void* user_data field was added to the rasqal_variable structure to allow application code to store additional information.

Added a new rasqal_query_verb enum value for SPARQL 1.1 (draft) Update: RASQAL_QUERY_VERB_UPDATE which indicates that a sequence of update operations are available in the query structure, rather than a query (SELECT, ASK, DESCRIBE).

Added a rasqal_update_operation class for holding an updates that adds and/or removes triples from a graph (with possible conditional where) or does a graph administration operation on a graph.

Added an rasqal_update_type enum for the types of graph update - clear, drop, delete, insert and, load.

Added rasqal_update_type_label() to get a label for a rasqal-update_type.

  const char* rasqal_update_type_label(rasqal_update_type type);

Added an rasqal_update_flags enum for capturing update operations flags such as SPARQL 1.1 Update SILENT for silent graph administration operations and DATA for bulk insert/delete data, rather than graph pattern templates with variables.

Added rasqal_query_get_update_operations_sequence() to get the sequence of updates from a query. Added rasqal_query_get_update_operation() get an individual update operation from a query via an index.

  raptor_sequence* rasqal_query_get_update_operations_sequence(rasqal_query* query);

  rasqal_update_operation* rasqal_query_get_update_operation(rasqal_query* query,
    int idx);

Query Results Class Changes

rasqal_new_query_results() added to public API to construct a standalone query result set without being the result of a query execution. (The destructor is already present). Added method rasqal_query_results_add_row() to add a row to a query result set.

  rasqal_query_results* rasqal_new_query_results(rasqal_world* world,
     rasqal_query* query, rasqal_query_results_type type,
     rasqal_variables_table* vars_table);

  int rasqal_query_results_add_row(rasqal_query_results* query_results,
     rasqal_row* row);

rasqal_query_results_type enum added to public API for use with rasqal_new_query_results().

Query Results Formatter Class Changes

Registered URIs for the CSV and TSV query result formats and fixed the mime types for those as well as the JSON format as reported in issues Issue #0000345 and Issue #0000323.

Added rasqal_new_query_results_formatter2() with format name, mime type and URI args deprecating rasqal_new_query_results_formatter() and rasqal_new_query_results_formatter_by_mime_type().

  rasqal_query_results_formatter* rasqal_new_query_results_formatter2(rasqal_world* world,
    const char *name, const char *mime_type, raptor_uri* format_uri);

Added rasqal_query_results_write2() and rasqal_query_results_read2() with both name and mime_type args deprecating rasqal_query_results_write() and rasqal_query_results_read() respectively.

  int rasqal_query_results_write2(raptor_iostream *iostr,
    rasqal_query_results *results, const char* name, const char* mime_type,
    raptor_uri *format_uri, raptor_uri *base_uri);

  int rasqal_query_results_read2(raptor_iostream *iostr,
    rasqal_query_results *results, const char* name, const char* mime_type,
    raptor_uri *format_uri, raptor_uri *base_uri);

Query Result Row Class

Export the query result row class to the public API to allow creating standalone query results set without a query.

Added rasqal_new_row_for_size(), rasqal_free_row() to construct and destruct a row and rasqal_row_set_value_at() to set row literal values.

  rasqal_row* rasqal_new_row_for_size(rasqal_world* world, int size);

  void rasqal_free_row(rasqal_row* row);

  int rasqal_row_set_value_at(rasqal_row* row, int offset,
    rasqal_literal* value);

Variables Table Class

Added variables table class rasqal_variables_table to the public API to allow use in creating a standalone query results.

Added rasqal_new_variables_table() and rasqal_free_variables_table() to construct and destroy a variables table. Added method rasqal_variables_table_add() to add a variable to the variables table.

  rasqal_variables_table* rasqal_new_variables_table(rasqal_world* world);

  void rasqal_free_variables_table(rasqal_variables_table* vt);

  rasqal_variable* rasqal_variables_table_add(rasqal_variables_table* vt,
    rasqal_variable_type type, const unsigned char *name,
    rasqal_literal *value);

SPARQL Changes

Added syntax-only and API support (no execution) for the SPARQL 1.1 Update W3C Working Draft of 2010-01-26 syntax. These are only available when using the 'laqrs' query language name, until SPARQL 1.1 is stable.

Added new lexer support for keywords: WITH, CLEAR, CREATE, SILENT, DATA, DROP, LOAD


Added DROP GRAPH uri

Added INSERT DATA { triples }

Added DELETE templates to delete multiple subgraphs.

Added DELETE DATA { triples }

Added LOAD uri and LOAD uri INTO graph-uri

Added WITH uri DELETE { ... } INSERT { ... } WHERE ... update form since other combinations are ambiguous.

NOTE: The older LAQRS experimental INSERT and DELETE formats are supported but deprecated.

Query Engine changes

Nobody reported it, but decimal division was totally broken. Fixed it to do division and not add!

Other Changes

Multiple code style updates and code file reorganizing.

Link roqet directly with -lraptor to get raptor symbols used linked directly, to enable alternate library linking approaches to work. Based on the request in Fixes Issue#0000347 and Fedora bug 564885.

Added checks for the public API methods to ensure NULL pointers are not accepted or used.

Added example code for constructing a query result set without a query

Updated configure and the build system to use silent rules for the maintainer (by default), or when --enable-silent-rules is passed to configure. This feature requires building with automake 1.11 which requires autoconf 2.62 or newer when building from GIT. script was updated to enforce the autotools versions above.

The rasqal.pc file now uses the Requires.private field for raptor; it should only be in the link line with
pkg-config --static ... is used.

Enforce that only raptor versions <1.9.0 are supported. No Raptor2 or Raptor2 alpha support yet.

Rasqal 0.9.17 Changes


This means: functions and structs were removed, modified and added.

Consequently the shared library major soname version has changed from 1 to 2.

The main change in this release is to add a new query engine and to enable it as the default query engine. It supports more of the SPARQL query algebra such as groups and optionals. There were many other changes and fixes.

Fixed Issues: (most of them in query engine 2)

  • Issue#0000077: OPTIONAL messes up query results
  • Issue#0000128: GROUP graph pattern support in the query engine
  • Issue#0000168: Wrong processing of the function "bound" with "OPTIONAL"
  • Issue#0000258: Using FILTER with OPTIONAL in SPARQL queries
  • Issue#0000261: Some SPARQL queries with multiple OPTIONAL patterns fail to return results
  • Issue#0000271: rasqal library does not compile cleanly when using g++ compiler
  • Issue#0000279: JSON query binding serializer is returning illegal JSON - extra double quotes before "ordered" and "distinct"
  • Issue#0000305: bound gives incoherent results

Rasqal world API changes

Added methods for setting of an already-opened raptor library to pass into rasqal, rather than it creating one itself. rasqal_world_open() can then be called to do the actual initialisation:

  int rasqal_world_open(rasqal_world* world);

  void rasqal_world_set_raptor(rasqal_world* world,
                               raptor_world* raptor_world_ptr);

  raptor_world *rasqal_world_get_raptor(rasqal_world* world);

Exported new C defines for the library versions: RASQAL_VERSION in 6-digit integer MMNNRR format (Major, miNor, Release), RASQAL_VERSION_STRING in string "MM.NN.RR" format, RASQAL_VERSION_MAJOR for integer major version number, RASQAL_VERSION_MINOR for integer minor version number and RASQAL_VERSION_RELEASE for integer release number.

API CHANGE: rasqal_features_enumerate() gains an initial rasqal_world argument to become a method of the world class:

  int rasqal_features_enumerate(rasqal_world* world,
    const rasqal_feature feature, const char **name,
    raptor_uri **uri, const char **label);

API CHANGE: rasqal_feature_from_uri() gains an initial rasqal_world argument to become a method of the world class:

  rasqal_feature rasqal_feature_from_uri(rasqal_world* world,
    raptor_uri *uri);

Data Graph API changes

API CHANGE: The rasqal_data_graph structure gains a new world reference pointer field.

API CHANGE: rasqal_new_data_graph() gains an initial rasqal_world argument:

  rasqal_data_graph* rasqal_new_data_graph(rasqal_world* world,
    raptor_uri* uri, raptor_uri* name_uri, int flags);

Expression API changes

rasqal_op enumeration gains values for LAQRS (possible SPARQL 1.1) expression operators: RASQAL_EXPR_SUM, RASQAL_EXPR_AVG, RASQAL_EXPR_MIN and RASQAL_EXPR_MAX. It also gains RASQAL_EXPR_COALESCE for LAQRS experimental coalesce expression COALESCE(expression list)

API CHANGE: The rasqal_expression structure gains a new world reference pointer field.

API CHANGE: All rasqal_expression constructors gain an initial rasqal_world argument:

  rasqal_expression* rasqal_new_0op_expression(rasqal_world* world,
    rasqal_op op);
  rasqal_expression* rasqal_new_1op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg);
  rasqal_expression* rasqal_new_2op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2);
  rasqal_expression* rasqal_new_3op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg1,  rasqal_expression* arg2,
    rasqal_expression* arg3);
  rasqal_expression* rasqal_new_string_op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal);
  rasqal_expression* rasqal_new_literal_expression(rasqal_world* world,
    rasqal_literal* literal);
  rasqal_expression* rasqal_new_function_expression(rasqal_world* world,
    raptor_uri* name, raptor_sequence* args);
  rasqal_expression* rasqal_new_cast_expression(rasqal_world* world,
    raptor_uri* name, rasqal_expression *value);

API CHANGE: rasqal_expression_evaluate() gains an initial rasqal_world argument:

  rasqal_literal* rasqal_expression_evaluate2(rasqal_world *world,
    raptor_locator *locator, rasqal_expression* e, int flags);

Added rasqal_graph_pattern_get_origin() to get the graph from a GRAPH graph pattern:

  rasqal_literal* rasqal_graph_pattern_get_origin(rasqal_graph_pattern* gp);

Added rasqal_graph_pattern_set_filter_expression() and rasqal_graph_pattern_get_filter_expression() methods to set/get an expression for a filter graph pattern:

  int rasqal_graph_pattern_set_filter_expression(rasqal_graph_pattern* gp,
    rasqal_expression* expr);

    rasqal_graph_pattern_get_filter_expression(rasqal_graph_pattern* gp);

Graph Pattern API changes

rasqal_graph_pattern_operator enumeration gains RASQAL_GRAPH_PATTERN_OPERATOR_FILTER for a filter graph pattern and RASQAL_GRAPH_PATTERN_OPERATOR_LET for LAQRS experimental assignment 'graph pattern'.

API CHANGE: Removed functions rasqal_graph_pattern_add_constraint(), rasqal_graph_pattern_get_constraint_sequence() and rasqal_graph_pattern_get_constraint(). These are replaced by filter graph pattern with expression - functions rasqal_graph_pattern_set_filter_expression and rasqal_graph_pattern_get_filter_expression().

LAQRS Changes

LAQRS is now available in the configuration and does not need to be explicitly selected with configure.

Add SUM(), AVG(), MIN() and MAX() aggregate expressions to LAQRS. Supported in syntax only, not in any of the query engines.

Add LET ?var := expression experimental syntax. Query engine 2 can execute this.

Add COALESCE(expression list) experimental expression to return the first defined expression value in the list. Query engines 1 and 2 can execute this.

Literal API changes

API CHANGE: Reordered rasqal_literal_type enumeration to match numeric type promotion order: float is now between integer and double. Also added RASQAL_LITERAL_XSD_STRING for xsd:string typed literals and RASQAL_LITERAL_UDT for unknown data typed literals. Both were separated out of RASQAL_LITERAL_STRING which is now for RDF plain literals and plain/typed turned into RDF terms only

Added rasqal_literal_get_rdf_term_type() method to return the RDF term type of a literal as a rasqal_literal_type - uri, blank node, literal or cannot be represented (e.g. qname or internal literal types).

  rasqal_literal_type rasqal_literal_get_rdf_term_type(rasqal_literal* l);

Added rasqal_literal_same_term() method to perform SPARQL sameTerm() comparison.

  int rasqal_literal_same_term(rasqal_literal* l1, rasqal_literal* l2);

Added rasqal_literal_is_rdf_literal() method to check if a literal is an RDF literal (not qname or other internal types).

  int rasqal_literal_is_rdf_literal(rasqal_literal* l);

Prefix API changes

API CHANGE: The rasqal_prefix structure gain a new world reference pointer field.

API CHANGE: rasqal_new_prefix() gains an initial rasqal_world argument:

  rasqal_prefix* rasqal_new_prefix(rasqal_world* world,
    const unsigned char* prefix, raptor_uri* uri);

Query API changes

Added rasqal_query_dataset_contains_named_graph() method to check if a named graph is in a dataset:

  int rasqal_query_dataset_contains_named_graph(rasqal_query* query,
                                                raptor_uri *graph_uri);

Query Formatter Changes

SPARQL DESCRIBE no longer writes commas between terms.

Query Results API changes

Added rasqal_query_results_get_query() method to get the associated query:

    rasqal_query_results_get_query(rasqal_query_results* query_results);

Added rasqal_graph_pattern_variable_bound_in() method to check if a graph pattern in a query defines a variable

  int rasqal_graph_pattern_variable_bound_in(rasqal_graph_pattern *gp,
    rasqal_variable *v);

Query Results Formatter Changes

SPARQL/JSON: Do not emit double " for distinct/ordered flags. Fixes Issue #0000279

Added comma-separated values (CSV), tab-separated values (TSV) and text table output formats with names csv, tsv and table.

RDQL Changes

Some updates to handle refactored query list of constraint expressions switching to a filter graph pattern. RDQL only has 0 or 1 such expressions in a single query.

SPARQL Changes

Ensure GroupOrUnionGraphPattern rule constructs the sequence of graph patterns in document order.

OptionalGraphPattern rule is now a list of 1 group graph patterns.

Fix support for <> URI literal.

Support \b, \f, \' and \" escapes in all types of quoted literals.

Fixed optional WHERE in parser to match SPARQL grammar - optional for DESCRIBE, but required for SELECT, CONSTRUCT and ASK queries.

Triples Source API changes

API CHANGE: The rasqal_triples_source and rasqal_triples_source_factory structures gain API version fields that must be set to a known API version.

API CHANGE: The rasqal_set_triples_source_factory() function for registering a triples source factory now take a function with an int error return code, and it returns an int now:

  int rasqal_set_triples_source_factory(rasqal_world* world,
     rasqal_triples_source_factory_register_fn register_fn,
     void* user_data);

Variable API changes

API CHANGE: The rasqal_variable structure gains a variables table pointer.

Other API changes

rasqal_triple_parts adds value RASQAL_TRIPLE_NONE for no parts.

rasqal_compare_flags enumeration gains RASQAL_COMPARE_URI - now also provides RDQL string to bool comparison.

API CHANGE: rasqal_new_xsd_decimal() gains an initial rasqal_world argument:

  rasqal_xsd_decimal* rasqal_new_xsd_decimal(rasqal_world* world);

Removed rasqal_triple_flags enumeration with unused values: RASQAL_TRIPLE_FLAGS_EXACT, RASQAL_TRIPLE_FLAGS_OPTIONAL and RASQAL_TRIPLE_FLAGS_LAST

Configure and Build Changes

configure now prefers pkg-config raptor to raptor-config but will accept both for now. pkg-config will not allow compiling against raptor in source tree in future.

Added --with-query-engine-version to configure to allow selecting default query engine version - values 1 or 2. This is allowed for people to switch to old engine if necessary for some existing query that the new engine cannot handle. This option will be removed at some point.

Add SHAVE support (git clone git:// ) to "make autotools output sane" which amounts to much less verbose messages when compiling. It is now enabled for the maintainer.

rasqal-config(1) is now a wrapper around pkg-config rasqal. Consequently --prefix=DIR and --libtool-libs are ignored.

Query Engine Changes

An entirely new query execution engine was written. The existing query execution engine was refactored out of a mess of rasqal_query and rasqal_query_results code and data. It is the default query engine as of Rasqal 0.9.17

The query engine to use can be selected at configure time wiht --with-query-engine-version to allow switching to old engine if necessary for some existing query that the new engine cannot handle. This option will be removed at some point.

The interface between the query API and the query engine is now via the rasqal_rowsource abstraction - an evaluation of a query returns a rowsource that generates the result rows of variable bindings.

Rewrote query_results class to be a pure wrapper around the rowsource and variables table, handling such things like generating triples (CONSTRUCT) from rows, creating a boolean result (ASK) by counting at least 1 result rows and generating syntax results using a query results formatter.

Added a new rasqal_query_execution_factory abstraction to provide the interface that the query execution engines implement to return a rowsource to get the results.

Both query engines can potentially be selected at runtime from the query API but ONLY when rasqal is built for development (configure --enable-maintainer-mode).

  1. If the envariable RASQAL_DEBUG_ENGINE is set with value 1 or 2, the query execution engine is chosen.
  2. The roqet(1) utility gains a -g / --engine argument.

Query engine 1 (existing):
Existing lazy evaluated engine that is hard to refactor. Internally, implemented by functions named rasqal_query_engine_1_...(). Execution factory instance rasqal_query_engine_1

Query engine 2 (new):
Based on transforming a tree of SPARQL algebra nodes constructed from the query, into a tree of rowsource-generating expressions that when evaluated at the top, returns the result rows. Each algebra node type and each rowsource type has it's own set of module unit tests built-in. Execution factory instance rasqal_query_engine_algebra

Removed query engine core legacy support for CONSTRUCT * - never in the SPARQL 1.0 language.

Pulled out row sorting code from query engine 1 into a rasqal_engine_sort module so it can be used by all query engines.

Implemented rowsource abstraction rasqal_rowsource for the following types of rowsources:

  • empty rowsource: always returns no rows
  • filter rowsource: filter an inner rowsource with an expression - used for SPARQL FILTER
  • graph rowsource: apply a graph variable to an inner rowsource - used for SPARQL GRAPH matching
  • join rowsource: join two inner rowsources on common variables and an expression. Two types of join supported: left outer join used for SPARQL OPTIONAL and natural join for groups of graph patterns.
  • project rowsource: pick [project] certain variables from an inner rowsource
  • query engine execution rowsource: rows generated by a query execution engine
  • row sequence rowsource: built from a sequence of rows
  • SPARQL xml rowsource: make rows from SPARQL Results XML syntax
  • triples rowsource: create a rowsource by binding variables to an RDF graph sort rowsource: sorts the inner rowsource by an order expression - used for SPARQL ORDERBY
  • union rowsource: union/concatenation of two inner rowsources - used for SPARQL UNION

Renamed row abstraction from rasqal_query_result_row to rasqal_row since it is independent of query results and shorter.

Use new rasqal_engine_error enumeration for query engine/internal errors - OK, FAILED or FINISHED rather than altering rasqal_query_results object fields directly.

Documented query execution engine internals as autodocs.

Added a query algebra abstraction rasqal_algebra with node type rasqal_algebra_node_operator based on SPARQL algebra operators: BGP, FILTER, JOIN, DIFF, LEFTJOIN, UNION, TOLIST, ORDERBY, PROJECT, DISTINCT, REDUCED, SLICE and GRAPH. Some of these are not needed by the query execution engines since they are handled by the high level query API - such as SLICE (limit and offset) and TOLIST (turning results into user data)

Added a variables table abstraction rasqal_variables_table pulled out of the internal query results and query structures which now point to it. Constructor rasqal_new_variables_table(), destructor rasqal_free_variables_table() and methods rasqal_variables_table_add(), rasqal_variables_table_get(), rasqal_variables_table_has(), rasqal_variables_table_set(), rasqal_variables_table_get_value(), rasqal_variables_table_get_named_variables_count(), rasqal_variables_table_get_anonymous_variables_count(), rasqal_variables_table_get_total_variables_count(), rasqal_variables_table_get_named_variables_sequence() and rasqal_variables_table_get_anonymous_variables_sequence().

Allow queries with no graph pattern to be accepted such as SPARQL DESCRIBE uri (which the query engine does not execute at present but now is at least parsed).

Do not warn about unbound variables for variables bound in GRAPH and SELECT expressions.

Renamed query language-specific factory class for creating query structure from SPARQL and RDQL syntaxes from struct rasqal_query_engine_factory to rasqal_query_language_factory since it is about the language, not the engine.

Query engine known problems:

  • Variable binding/use scope is not calculated correctly.
  • Consequently no queries with UNION work correctly.
  • Also consequently, some OPTIONAL queries execute and return results when they shouldn't due to scoping of variable rules especially in nested optionals.
  • DISTINCT uses RDF literal equality not RDF sameTerm equality and thus returns results not to spec.
  • xsd:date comparison is not date-aware, it uses a simple string equality
  • REDUCED is not implemented.

Summary of the approved DAWG SPARQL 1.0 tests as of Rasqal SVN r15841

Fail:       22 (4.99 %)
    algebra                        4
    dataset                        3
    distinct                       4
    graph                          2
    open-world                     3
    optional                       4
    reduced                        2
Pass:      419 (95.01 %)

The above results in EARL: RDF/XML and Turtle

Internal Changes

Added sparql algebra tests based on the examples in the SPARQL 1.0 Query Language Specification section 12.2.1 Converting Graph Patterns

Optionally support the experimental raptor V2 API.

Lots of resiliency fixes in the case of out of memory - Lauri Aalto.

Adjusted internal test suite to use a perl improve script that generates and uses an RDF-based manifest. The test running is now much more consise when successful.

Switch to final DAWG approved testsuite files from at CVS Revision 1.6 1008

Rasqal 0.9.16 Changes


This means: functions were removed, modified and added.

Consequently the shared library major soname version has changed from 0 to 1.

The header files moved to be installed in PREFIX/include/rasqal such as /usr/include/rasqal for usual installs.

NOTE: In the next release of rasqal, the rasqal-config utility that provides the compile and link args will be deprecated, generate a warning when run and will turn into a wrapper for pkg-config rasqal ... It will be removed in a future release.

Major Changes (break ABI and API)

Removed rasqal_init() and rasqal_finish() functions.

Added a new rasqal_world object to manage library allocations and classes with new library constructor/initializing function rasqal_world *rasqal_new_world(void) and destructor/cleanup function: void rasqal_free_world(rasqal_world*)

The following functions now take a librdf_world* world argument as the first argument: rasqal_language_name_check(), rasqal_languages_enumerate(), rasqal_new_query(), rasqal_query_results_formats_check (), rasqal_new_query_results_formatter(), rasqal_new_query_results_formatter_by_mime_type(), rasqal_new_integer_literal(), rasqal_new_typed_literal(), rasqal_new_double_literal(), rasqal_new_float_literal(), rasqal_new_uri_literal(), rasqal_new_pattern_literal(), rasqal_new_string_literal(), rasqal_new_simple_literal(), rasqal_new_boolean_literal(), rasqal_new_variable_literal(), rasqal_new_decimal_literal(), rasqal_new_decimal_literal_from_decimal()

Removed deprecated rasqal_new_floating_literal(), rasqal_graph_pattern_get_flags(), rasqal_expression_foreach() functions, RASQAL_LITERAL_FLOATING macro and rasqal_expression_foreach_fn typedef.

Modified rasqal_triples_match struct to add a rasqal_world* world field.

There is no more static data such as error pointers, arrays of query languages, URI objects; it is all attached to the rasqal_world object.

Misc changes

Fixed memory leaks in lang() expression evaluation. (Lauri Aalto)

Made several low-memory resiliance fixes in query construction and execution. (Lauri Aalto)

Library requires raptor 1.4.17 or newer to get the newly public raptor SAX2 API for reading SPARQL XML Results format.

Updated mpfr configure check to look for modern functions rather than functions that are also in the older gmp-mpfr library too.

Only the first error is reported for syntax errors in lex/parse of SPARQL and RDQL since the lack of error recovery means that the consequent messages are of little use.

Fatal errors in SPARQL and RDQL lexer/parser no longer does an abort, but exits via setjmp/longjmp.

Query Engine Changes

Added internal rowsource class to get rows from an execution engine or a syntax (query result formatter).

Graph Pattern Class Changes

Modified rasqal_graph_pattern_add_sub_graph_pattern() to have an int return value for catching allocation failures.

Query Class Changes

Modified rasqal_query_add_variable() and rasqal_query_add_prefix() to have int return values for catching allocation failures.

Query Results Class Changes

Updated the internals to allow construction of a query result outside the query engine, such as from a syntax.

Added rasqal_query_results_read() to read a query results from an iostream in some format.

Modified rasqal_query_results_formats_enumerate() to add a flags argument with RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER and RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER choices to choose formats for read or write enumeration.

Removed function rasqal_query_results_formats_enumerate_full now handled by rasqal_query_results_formats_enumerate().

Added rasqal_query_results_formatter_read() to read query results from a syntax via an iostream.

Variable Class Changes

Added rasqal_new_variable_from_variable() copy constructor.

Rasqal 0.9.15 Changes

General Changes

Many updates for better SPARQL support. Rasqal 0.9.15 passes over 92% of the DAWG SPARQL Test Suite as of 2007-11-13.

Rasqal still does not support either UNION or GROUP and OPTIONAL remains buggy. There remain a few other minor areas not yet completely supported such as XSD date and XSD dateTime equality and comparisons.

WARNING: ABI AND API CHANGE in Rasqal 0.9.16. The next release of Rasqal will be incompatible with this one.

It will have both ABI and API changes that will require source updates.

The shared library major soname will change from 0 to 1.

The header files will move to be installed in PREFIX/include/rasqal such as /usr/include/rasqal for usual installs.

The full details of the API change have not been decided but the driving change is that using the library will be done via a new Rasqal world object,k will now be used to working like a Redland librdf_world. All constructors will take this world object as an argument and all static data will be indirected from the object. Handlers such as the uri_handler/data and error handlers will also move to be set/get via the world object.

There are almost certainly other API changes and cleanups that will be done, and some possibly some of the data structures may be made internal.

Fixed issues:

SPARQL Query Language Changes

Many updates to support the SPARQL Candidate Recommendation and Proposed Recommendation versions of the language including:

  • Added REDUCED syntax support (no query engine support)
  • Added SAMETERM() support.
  • Allowing numbers at the start of local names.
  • Allowing @lang and ^^datatype after triple-quoted literals.
  • Make unary + and - work
  • Remove CONSTRUCT * that is no longer in the spec
  • Removed hexadecimal literals which were never in the spec
  • Made queries with the ASK verb work again.
  • Made LANG() and DATATYPE() work to spec on typed literals.
  • Remove warning about optional SPARQL WHERE although it is still a dumb idea to have useless keywords.

Query Engine Changes

Many internal changes were made including refactoring the engine core and adding of additional internal documentation for the engine functions.

Substantial improvements were made to datatypes support:

  • SPARQL / XQuery / XPath numeric type promotion is now supported, including derived types of xsd:integer etc.
  • Added XSD xsd:decimal implementation either using GNU MP, MPFR, C99 _Decimal (but I have yet to find a working implementation) or by default and inaccurately, C doubles.
  • Added XSD xsd:dateTime initial support for validation.
  • Numeric operations such as +, -, *, / and ! as well as comparisons are now done in the appropriate datatype (which may be a promotion).

Improved the way that literal equality and comparisons work especially with respect to datatypes. Triple pattern matching (equality) works with RDF terms. SPARQL FILTER literal equality and comparisons follow SPARQL rules with possible numeric type promotion, then using RDF Term if the types are different. ORDER comparison or DISTINCT equality checks use RDF Term. RDQL execution uses it's own existing "stringy" rules.

Set the query base URI.

Make queries that bind the origin (SPARQL GRAPH) match correctly against the default graph.

Memory reduction in stack usage when evaluation expressions (such as SPARQL FILTERs).

Public API changes

Added rasqal_home_url_string static constant.

Added rasqal_xsd_decimal class and API calls described below.

Added a decimal part to the rasqal_literal union value for RASQAL_LITERAL_DECIMAL types.

Added a parent_type part to the rasqal_literal when the type can be promoted.


Added RASQAL_COMPARE_RDF and RASQAL_COMPARE_URI comparison types for RDF Term comparison rules and allowing URI comparison (without STR()) respectively.

Added rasqal_new_typed_literal() to make an RDF typed literal from a type and string (no language).

Added rasqal_new_float_literal() for wrapping a C float as XSD float.

Added new decimal literal constructor rasqal_literal* rasqal_new_decimal_literal_from_decimal(const unsigned char *string, rasqal_ xsd_decimal* decimal)

Added rasqal_literal_datatype method to get the datatype URI of a literal.

Added rasqal_literal_value method to get the literal value of a literal, looking up any variables to their value. FIXME should this not involve query results?

Added addition rasqal_triple_parts enums: RASQAL_TRIPLE_GRAPH for just the named graph part RASQAL_TRIPLE_SPO for subject, predicate and objects and RASQAL_TRIPLE_SPOG for all parts including named graph.

Decimal Class

A new rasqal_xsd_decimal class was added to handle XSD decimals with accurate decimal arithmetic.


rasqal_xsd_decimal* rasqal_new_xsd_decimal(void);


void rasqal_free_xsd_decimal(rasqal_xsd_decimal* dec);


double rasqal_xsd_decimal_get_double(rasqal_xsd_decimal* dec);
int rasqal_xsd_decimal_set_double(rasqal_xsd_decimal* dec, double d);
iint rasqal_xsd_decimal_set_string(rasqal_xsd_decimal* dec, const char* string);
int rasqal_xsd_decimal_set_long(rasqal_xsd_decimal* dec, long l);
int rasqal_xsd_decimal_print(rasqal_xsd_decimal* dec, FILE* stream);
char* rasqal_xsd_decimal_as_string(rasqal_xsd_decimal* dec);
char* rasqal_xsd_decimal_as_counted_string(rasqal_xsd_decimal* dec, size_t* len_p);

Numeric methods (writing to the result argument):

int rasqal_xsd_decimal_add(rasqal_xsd_decimal* result,
                           rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_subtract(rasqal_xsd_decimal* result,
                                rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_multiply(rasqal_xsd_decimal* result,
                                rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_divide(rasqal_xsd_decimal* result,
                              rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_negate(rasqal_xsd_decimal* result,
                              rasqal_xsd_decimal* a);

Comparison methods:

int rasqal_xsd_decimal_compare(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_equals(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_is_zero(rasqal_xsd_decimal* d);

Query Results Formatter Class Changes

Updated to the 4th version of the SPARQL XML Results format by removing the ordered and distinct attributes. Removed support for all the earlier versions 1 to 3.

roqet Utility Changes

Added -D / --data options for specifying data URis for the default graph and -G / --named for URIs of named graphs (the existing -s is a also a synonym for the latter).

Other Changes

Many internal fixes and cleanups after failures so that memory is not lost and/or rasqal does not crash. These many changes were primarily made by Lauri Aalto.

Several portability fixes for helping with low-memory, embedded systems and using a compiler that is not gcc.

The SPARQL test runner check-sparql was improved to read the SPARQL XML Results format (but not via XML::Simple because it is insanely complex and counterintuitive), handle DAWG test manifests and generate EARL reports. It also has new help and usage messages.

Rasqal 0.9.14 Changes

General Changes

Added syntax and API support (but no query engine support) for experimental extensions to SPARQL called LAQRS: LAQRS Adds to Querying RDF in SPARQL.

Updated the query results formatter to allow better introspection of supported formats.

Fixed issues:

LAQRS Adds to Querying RDF in SPARQL (LAQRS)

LAQRS is experimental and Rasqal provides only syntax and API support (but no query engine support) for:

  • EXPLAIN as a keyword allowed before any query. Returned by rasqal_query_get_explain()
  • COUNT() and COUNT(*) via new expressions RASQAL_EXPR_COUNT and RASQAL_EXPR_VARSTAR
  • SELECT expression AS variable via the new expression field of rasqal_variable
  • GROUP BY results via rasqal_query_get_group_conditions_sequence() and rasqal_query_get_group_condition() and new expressions RASQAL_EXPR_GROUP_COND_ASC and RASQAL_EXPR_GROUP_COND_DESC


LAQRS is not enabled by default in Rasqal (unless using maintainer mode or building from Subversion). To enable it, configure Rasqal like this:

$ ./configure '--enable-query-languages=sparql rdql laqrs'

Rasqal build summary:
  RDF query languages available : rdql sparql
  RDF query languages enabled   : sparql rdql laqrs
  Triples source                : raptor 1.4.15

The API changes for LAQRS are as follows:


Added a constructor to create a constant or 0-operand expression (for COUNT):

rasqal_expression* rasqal_new_0op_expression(rasqal_op op);

Added a query method to get the explain flag:

int rasqal_query_get_explain(rasqal_query* query);

Added a query method to get the 'group by' condition expressions:

rasqal_query_get_group_conditions_sequence(rasqal_query* query);

rasqal_query_get_group_condition(rasqal_query* query, int idx);

Added rasqal_expression expression types:

  • RASQAL_EXPR_GROUP_COND_ASC for group condition ascending.
  • RASQAL_EXPR_GROUP_COND_DESC for group condition descending.
  • RASQAL_EXPR_COUNT for select COUNT()

rasqal_variable now has a rasqal_expression* field expression.

Configuration and Build Changes

The pkgconfig rasqal.pc file and the rasqal-config script now separates directly linked shared libraries and indirectly linked ones. This prevents unnecessary references to libraries. The regular libraries includes -L plus -lrasqal and the dynamic and static libraries are available with:

  • pkgconfig rasqal --static --libs
  • rasqal-config --libs --private-libs

So for example to statically link with rasqal, use either:

$ cc .. -o foo foo.c `pkgconfig rasqal --static --libs`

$ cc .. -o foo foo.c `rasqal-config --libs --private-libs`

Query Results Formatter Changes

Made it easier to discover and create of query results in a syntax by using a MIME Type.

Added query results formatter constructor by required mime type:

rasqal_new_query_results_formatter_by_mime_type(const char *mime_type);

Added a method to return the mime type of a selected formatter:

const char*
  rasqal_query_results_formatter *formatter);

Added another query results formatter static method to enumerate possible results formats, their names, labels and (new) mime type.

rasqal_query_results_formats_enumerate_full(const unsigned int counter,
  const char **name, const char **label,
  const unsigned char **uri_string, const char **mime_type);

Added a static method to check for support for a query results format.

int rasqal_query_results_formats_check(const char *name,
  raptor_uri* uri, const char *mime_type);

SPARQL Query Language Changes

Updated for the SPARQL Query Language for RDF, W3C Working Draft 26 March 2007

  • Added REDUCED token. This entailed changing the distinct flag from a boolean to a mode. rasqal_query_get_distinct and rasqal_query_set_distinct now takes a mode (0, 1 DISTINCT, 2 REDUCED) rather than the former boolean flag. There is no query engine support for REDUCED at present.

Query Engine Changes

Added the possibility that a query's native result is a syntax (rather than natively bindings, boolean or triples) and added a method to check for that:

int rasqal_query_results_is_syntax(rasqal_query_results* query_results);

Many query engine internal changes, but these remain unsupported: OPTIONAL graph pattern (partially working), GROUP graph pattern (no support), UNION graph pattern (no support) and new SELECT REDUCED (no support).

roqet Utility Changes

roqet can use -r to generate a chosen result syntax for bindings results or triples (using raptor).

roqet now generates namespace declarations for triples when serializing output. The result is that they are used when the serializer handles them such as generating RDF/XML (Abbreviated) or Turtle.

Other Changes

rasqal_expression lost the unused rasqal_variable* field variable

Added exported variables to return the license string in rasqal_license_string and home page in rasqal_home_url_string

Rasqal 0.9.13 Changes

General Changes

Added a new rasqal_query_results_formatter class.

Many internal query engine changes, mostly to separate query and query_results internals so that eventually the run-time execution context is entirely separated from the static query structure.

Added query features system with one initial feature RASQAL_FEATURE_NO_NET.

Configuration and Build Changes

Allow shell variable LEX to be set to things that aren't exactly flex Recommend flex 2.5.33 and update configure to point at the main flex site whichq finally gets 2.5.33 after 9 years.

PKGCONFIG vars not substituted correctly in Remove @LDFLAGS from Fixes Issue#0000098.

Win32 build fixes.Correct win32 static linking of rasqal. (Fixes Issue#0000100) and include float.h and #define isnan on win32. (Fixes Issue#0000111).

In maintainer mode, add all the supported compiler -W warning flags to the CFLAGS.

Declare several rasqal functions with GCC printf-formatting attributes when using a new enough GCC.

Remove broken debug messages. #0000131.

SPARQL Query Language Changes

Added labels to grammar tokens using bison to give better error messages.

Fix looking for EOF in an unsigned variable since it may be negative on some systems.

The query engine now implements SPARQL GRAPH matching.

RDQL Query Language Changes

Added labels to grammar tokens using bison to give better error messages.

Fix looking for EOF in an unsigned variable since it may be negative on some systems.

Query Engine Changes

The query engine now implements SPARQL GRAPH matching.

Merge only all adjacent sequences of basic graph pattern triples, not anything with triples such as optional BGP triples. Fixes Issue#0000080.

When an exact triple match is present, do not execute a query forever. Fixes Issue#0000094.

Fail if a variable argument to LANG() has an undefined value rather than try to execute a NULL pointer. Fixes Issue#0000113.

Add query / query_results link early so reference counting is done right. Fixes Issue#0000095.

Report failure as well as query finished when an error occurs during making results. Fixes Issue#0000118.

Added a hack to check an outer constraint expression. Fixes Issue#0000129.

Free origins (GRAPH nodes) in triples to prevent memory leak. Fixes Issue#0000133.

Query API Changes

Added a new rasqal_query_results_formatter class to format librdf_query_results into a syntax. Also added a rasqal_query_results_formats_enumerate() function to enumerate all the supported formats. The query results method rasqal_query_results_write() was changed to use this class internally.

Added a new feature system to allow setting parameters on the query parser/engine. Initially have one feature RASQAL_FEATURE_NO_NET that prevents network requests during a query execution. Added functions: rasqal_features_enumerate, rasqal_get_feature_count, rasqal_feature_from_uri, rasqal_feature_value_type, rasqal_query_set_feature, rasqal_query_set_feature_string, rasqal_query_get_feature, rasqal_query_get_feature_string.

roqet gained a -f / --feature option to set query features.

Rasqal 0.9.12 Changes

General Changes

Added JSON as a query results format based on the Serializing SPARQL Query Results in JSON draft.

Added query writing to a raptor_iostream which allows reading in one query language and writing in another. The only useful consequence of this now is that it enables roqet to become an RDQL to SPARQL translator.

Rasqal now requires raptor 1.4.9 or newer.

Configuration and Build Changes

Now using subversion.

roqet utility Changes

Altered the -d (--dump-query) option to now take an argument of the query format to dump. The values it can take are debug, structure or sparql.

To convert a query from RDQL to SPARQL, use:

roqet -q -i rdql -d sparql -n query.rdql > query.sparql

Added -r json for JSON query results output based on the draft defined in the Serializing SPARQL Query Results in JSON draft

SPARQL Query Language Changes

Updated to match SPARQL Query Language for RDF, W3C Candidate Recommendation 6 April 2006. All DAWG syntax tests now pass. The update includes near alignment with SPARQL grammar term names except where the flex/bison approach diverged.

Updated SPARQL tests from DAWG CVS

Finally removed long deprecated ASC[] and DESC[] syntax.

RDQL Query Language Changes

Handle empty regex // Fixes Issue#0000071

Query Engine Changes

Some updates to handle latest changes to SPARQL grammar.

Added RASQAL_EXPR_REGEX 3-arg operation to match the SPARQL regex() 2/3-arg function.

Many internal changes to move more of the query execution state from inside rasqal_query to inside rasqal_query_results and related structures. This is not yet complete but when done, you will be able to execute the same query more than once at the same time.

Query API Changes

Added rasqal_query_write to write a query structure into a syntax onto a raptor_iostream. Implements writing SPARQL format with format URI NULL, or

Added a JSON SPARQL query results format with format URI identifier based on the draft defined in Implemented document with version alt-ser-sparql.rst,v 1.3 2006/02/16 16:03:08 k Exp.

rasqal_query_get_all_variable_sequence was corrected to match the definition - return all variables, not just the bound (SELECTed) ones. Fixes Issue#00000079.

Added rasqal_query_get_anonymous_variable_sequence to return only anonymous variables after change above.

Added rasqal_graph_pattern_get_index to get the absolute index of a graph pattern in a graph.

IOstream class Changes

Added rasqal_query_iostream_write_escaped_counted_string and rasqal_query_escape_counted_string to format an escaped string suitable for using inside a query.

Documentation Changes

Updated roqet.1 for --exec option and new usages.

Rasqal 0.9.11 Changes

General Changes

Duplicated SELECT variables are now detected, give a warning and are removed.

Rasqal now requires raptor 1.4.8 or newer to get the guess parser that uses URI/name and mime type returned from protocol request (if available) to choose the correct parser.

Added an internal rasqal_map key : value map for use with result duplicate detection and ordering.

A major source code regoranisation moved all library source code to the src/ dir, roqet to utils/ and other documentation to docs/. This should only affect packagers, not any functionality.

Many more function documentation were added to the sources for use by gtk-doc.

SPARQL Query Language Changes

Updated to the SPARQL Query Language for RDF W3C Working Draft 23 November 2005:

  • Added isIRI keywords.
  • Updated the name definitions to allow initial _ in variable names.
  • Changed the decimal and double literal syntax.
  • Allow negative numeric literals.
  • Change the AND and OR logic when an error is present.

Added a post 2005-11-23 SPARQL WD syntax change: added langMatches operator and initial query engine support.

Invalid \uHHHH and \UHHHHHHHH hex escapes and floating point number formats are detected and warned.

Updates to the query engine make DISTINCT and ORDER BY now work, including with LIMIT.

The lexer now counts line numbers correctly over multi-line comments.

Updated changes to the valid characters allowed in SPARQL names for variable, prefix and QNames.

RDQL Query Language Changes

The lexer now counts line numbers correctly over multi-line comments.

Query Engine Changes

When query result sorting is used with limit (SPARQL LIMIT) and offset, they now work correctly, performing the limit and offset after ordering the result. This matches the SPARQL query result semantics.

The query engine now implements distinct results (SPARQL DISTINCT) including with ordering (SPARQL ORDER BY).

More cases with optional graph patterns (SPARQL OPTIONALs) are now executed correctly. Note: this does not mean all cases work, there are known problems with executing optional clauses.

Added types for xsd:float (C float) and xsd:double (C double); xsd:decimal (handled as a string) and xsd:datetime (as a string).

Fixed (a compare b) between integers and doubles to be the right sign.

Do not promote literals early on in comparisons to strings "perl style" but do the best type-based comparison as late as possible.

Query API Changes

Added rasqal_new_double_literal.

Added rasqal_graph_pattern_visit and type for visitor function rasqal_graph_pattern_visit_fn.

Added rasqal_new_expression_from_expression.

Added rasqal_expression_visit and type for visitor function rasqal_expression_visit_fn.

Deprecated function rasqal_new_floating_literal replaced by new rasqal_new_double_literal.

Deprecated function rasqal_expression_foreach, replaced by new rasqal_expression_visit.

Function rasqal_expression_evaluate gains a flag argument of new enum rasqal_compare_flags.

Added enum rasqal_compare_flags flags for rasqal_expression_evaluate or rasqal_literal_compare. Type RASQAL_COMPARE_XQUERY can be used with to ask for use of XQuery comparison and type promotions.

Added rasqal_literal types: RASQAL_LITERAL_DECIMAL, RASQAL_LITERAL_DATETIME, RASQAL_LITERAL_DOUBLE (replacing deprecated RASQAL_LITERAL_FLOATING) and RASQAL_LITERAL_FLOAT. Reordered the rasqal_literal types in the enum.

The enum types in rasqal_literal_type were reordered to make them match sparql type promotion.

roqet utility program changes

roqet gains -e/--exec option to execute a query string directly rather than via a file or URI containing the query.

Now writes out XML results format in format with version URI and short name "xml". The previous version is available with short name "xml-v2". The latest version now writes ordered and distinct boolean-valued attributes on the results element.

Configuration Changes

The script for building from CVS was revamped to be more modular.

configure now takes an --enable-gtk-doc option to enable building of the documentation using the gtk-doc utility. It is by default enabled only if the utility is available.

Documentation Changes

The GNOME gtk-doc program is now used to automatically extract documentation from source comments into reference documentation. This is then merged with templates and additional documentation to provide a reference manual for rasqal as XML document which is turned into HTML along with GNOME devhelp support.

This new documentation intended to replace the librasqal manual page/web page as easier to read document with scope for better expanding with more detail of rasqal including examples and tutorial information. The librasqal manual page will continue to contain the summary information for the present.

Rasqal 0.9.10 Changes

General Changes

The query engine now supports ordering query results, in SPARQL this is the ORDER BY clause.

SPARQL Query Language Changes

The SPARQL parser now passes (accepts) all the 70+ SyntaxFull tests in the RDF Data Access Working Group (DAWG) test suite for SPARQL. This mostly means accepting optional punctuation in some places.

Sorting results with ORDER BY now partially works however comparison is not done with the SPARQL literal comparison rules (after XQuery) but using the existing RDQL-style "string-y" comparisons.

Allow <> as a URI.

The SPARQL parser now accepts some changes made by the DAWG after the last published working draft: SPARQL Query Language for RDF, W3C Working Draft, 19 April 2005. This includes:

  • In ORDER BY ASC(expression) replaces ASC[...], DESC(expression) replaces DESC[...], and it also accepts ORDER BY (expression). ORDER BY func() is accepted although at present no extension function support is available that could use it.
  • [] can be used in the triple predicate position as an anonymous existential variable
  • Enforce that ASK queries cannot use ORDER BY, LIMIT or OFFSET

Omitting WHERE gives a warning. Don't do that!

Query Engine Changes

The query engine now allows sorting of results (ORDER BY in SPARQL). It performs comparisons using the existing RDQL style and does not yet support the SPARQL literal comparison rules. Sorting can be done by a sequence of expressions, ascending or descending. If the final result is equality, the object pointers are used.

Note: removal of duplicates is not supported yet.

Some test code for datatypes support was added, not enabled by default and not yet useful.

Query API Changes

Removed functions deprecated in 0.9.9.

Added rasqal_graph_pattern_operator enumeration with values for the main SPARQL graph patterns, graph pattern class method rasqal_graph_pattern_get_operator and graph pattern utility function rasqal_graph_pattern_operator_as_string

Modified the type of the final argument of rasqal_new_graph_pattern_from_sequence and rasqal_graph_pattern_add_triples from an integer to a rasqal_graph_pattern_operator enumeration.

Deprecated function rasqal_graph_pattern_get_flags now always returning 0 replaced by the graph pattern operator functions listed above .

roqet utility program changes

Removed deprecated flags -f and -o

Rasqal 0.9.9 Changes

General Changes

SPARQL is now the default query language

Added a signing memory debugging system to aid checking when rasqal-allocated memory is freed in another library or vice-versa enabled by --with-memory-signing configure option (defaults to on in maintainer mode).

Fixed a few internal malloc/frees to use RASQAL_MALLOC / RASQAL_FREE so that the above signed memory system worked.

SPARQL Query Language Changes

Grammar updated to follow the SPARQL Query Language for RDF, W3C Working Draft, 19 April 2005. This changes many parts of the syntax:

  • Turtle/N3 style for triples with abbreviations
  • { ... } around triple patterns
  • OPTIONAL instead of []
  • GRAPH replaces SOURCE
  • FROM NAMED replaces LOAD
  • FILTER replaces AND
  • REGEX replaces ?var =~ /match/flags and !~
  • Added LIMIT, OFFSET and ORDER BY with ASC[] and DESC[]
  • Changed function syntax to remove &
  • Removed old operator tokens: ne, eq, ==

(Note: the query engine does not support sorting amongst other recently added SPARQL features)

SPARQL keywords are now case independent rather than just upper or lowercase.

Added """long literals""" after N3 (and soon, Turtle) and '''long literals''' for SPARQL only.

Added many SPARQL tests from DAWG most not yet approved by the working group. Not all pass either because not implemented or known bugs.

Added the revised SPARQL Query Results XML Format (the latest version not yet published) support to rasqal_query_results_write when called with format URI

Query Engine Changes

Uses the query results limit and offset information to skip initial results (offset) and provide a maximum number of results (limit).

Moved some engine-specific operations from RDQL and SPARQL parser.

Added internal rasqal_formula class for the Turtle part of the SPARQL parser

Deprecated the rasqal_triples_source factory method new_triples_match. It is replaced by a new method init_triples_match and will be removed from the next release.

Query API Changes

Added bnode identifier generation functions: rasqal_query_set_default_generate_bnodeid_parameters, rasqal_query_set_generate_bnodeid_handler based on the raptor API for generating blank node identifiers in the Turtle/N3 triple style.

Added order_conditions_sequence to the query structure to store query ordering conditions and added access methods rasqal_query_get_order_conditions_sequence and rasqal_query_get_order_condition to read the resulting expressions.


Added types for variables in two version - normal and anonymous with an new enum rasqal_variable_type and rasqal_new_variable_typed to allow creating them.

Completed the distinct/limit and offset get/set methods by adding: rasqal_query_set_distinct, rasqal_query_set_limit, rasqal_query_get_offset and rasqal_query_set_offset

Deprecated the rasqal_triple flags field - the value RASQAL_TRIPLE_FLAGS_EXACT was only used in internals of the execution engine. The value RASQAL_TRIPLE_FLAGS_OPTIONAL was never used. Optionals are now noted on graph patterns. Deprecated rasqal_triple_set_flags and rasqal_triple_get_flags.

Added enum rasqal_query_verb for the main query verbs: RASQAL_QUERY_VERB_SELECT RASQAL_QUERY_VERB_CONSTRUCT RASQAL_QUERY_VERB_DESCRIBE and RASQAL_QUERY_VERB_ASK. Added method rasqal_query_get_verb to access the verb.

Added rasqal_query_get_query_graph_pattern to get the top graph pattern.

Added rasqal_query_get_wildcard to get the query verb wildcard flag such as with SPARQL SELECT *

Added rasqal_query_get_construct_triples_sequence and rasqal_query_get_construct_triple to get the triples made from a SPARQL CONSTRUCT query.

roqet utility program changes

Updated roqet to include better query structure walking with -w / --walk including listing query verb, distinct, limit, offset flags, construct triples and easier to read groupings of graph patterns and triples.

Deprecated roqet arguments -f / --format and -o / --output in place of -r / --results as both choose the query results format.

SPARQL is now the default query language for roqet.

Rasqal 0.9.8 Changes

SPARQL Query Language Changes

Grammar updated to follow the SPARQL Query Language for RDF, W3C Working Draft, 17 February 2005.

Added support for casting in constraint expressions for datatyped literals with the syntax qname(literal) such as xsd:decimal("10").

Added named graphs parsing with LOAD and note that UNION cannot be handled yet, SOURCE and [...] syntax for optionals are deprecated.

Query Engine Changes

Engine now operates over a hierarchy of rasqal_graph_pattern objects, where at the root the query has a single query graph rather than a sequence of graph patterns. The query graph contains the former sequence of graph patterns.

Constraints can be applied to any graph pattern, not just at the top level of a query.

Added casting expressions type RASQAL_EXPR_CAST and constructor rasqal_new_cast_expression.

Fixed setting of a triple origin (SPARQL GRAPH) which was not working in 0.9.7

xsd:boolean RDF literals are now promoted into internal RASQAL_LITERAL_BOOLEAN typed rasqal_literal like for XSD integer and double.

The query engine uses the named graph information when evaluating queries, passing it to the rasqal_triples_match factory methods either implemented with raptor or redland as a rasqal_triples_source_factory and returning them as results of variable bindings.

Query API Changes

Added no-arg constructor rasqal_new_graph_pattern

Added method rasqal_graph_pattern_add_triples to add triples to an existing graph pattern.

Added methods rasqal_graph_pattern_add_constraint, rasqal_graph_pattern_get_constraint_sequence and rasqal_graph_pattern_get_constraint to add constraints to a graph pattern.

Added method rasqal_graph_pattern_add_sub_graph_pattern to add a sub-graph pattern to a graph pattern.

Added a Data Graph class with constructor rasqal_new_data_graph, destructor rasqal_free_data_graph and debug method rasqal_data_graph_print.

Added query methods for data graphs: rasqal_query_add_data_graph, rasqal_query_get_data_graph_sequence, rasqal_query_get_data_graph.

Deprecated query methods rasqal_query_add_constraint, rasqal_query_get_constraint_sequence rasqal_query_get_constraint, rasqal_query_add_source, rasqal_query_get_source_sequence and rasqal_query_get_source. These will be removed in the next release.

Removed functions deprecated in previous version: rasqal_query_get_variable_sequence and rasqal_query_add_triple.

Rasqal 0.9.7 Changes

General Changes

Fix a resource clean up when query results are either not read at all or not fully exhausted. This caused a problem in Redland when it held on to MySQL database handles despite a query having ended.

Added option -n/--dryrun to roqet to stop after preparing the query. Added option -w/--walk-query to walk and print the query using the graph API.

New build configuration and portability fixes for win32 (John Barstow)

Portability fixes for win32 - define RASQAL_INLINE and use it as for raptor. (Dave Viner)

Make rasqal tests work when building against raptor in a sibling source tree.

Query Engine Changes

Added a graph pattern API with rasqal_graph_pattern typedef and rasqal_pattern_flags enum with value RASQAL_PATTERN_FLAGS_OPTIONAL to allow complete walking of the query structure.

Two new methods to the query class were added to support this: rasqal_query_get_graph_pattern_sequence to get the raptor_sequence of graph patterns in a query and rasqal_query_get_graph_pattern to get individual an graph pattern by index.

The new graph pattern methods added are:

  • rasqal_graph_pattern_get_triple to get a raptor_triple inside a graph pattern.
  • rasqal_graph_pattern_get_sub_graph_pattern_sequence to get the raptor_sequence of sub-graph patterns.
  • rasqal_graph_pattern_get_sub_graph_pattern to get a sub-graph pattern inside a graph pattern by index.
  • rasqal_graph_pattern_get_flags to get a graph pattern's flags.
  • rasqal_graph_pattern_print to print a graph pattern in a debug form.

Deprecated rasqal_query_add_triple as it doesn't construct the graph patterns and is of little use as it does not build the correct query structures.

Added query API methods to get the bound and all variables in a query: rasqal_query_get_bound_variable_sequence and rasqal_query_get_all_variable_sequence respectively. Deprecated rasqal_query_get_variable_sequence as too ambiguous.

With the aid of gcc -Wswitch-enum, found and fixed cases where switch on enumerated values were missing cases. The remaining cases return failure or an error message rather than abort(). This fixed a crash when comparing for equality a variable ?x with a blank node value and an interger.

Deleted RASQAL_EXPR_PATTERN as it was never used.

Added rasqal_query_get_distinct to get a query-specified distinct results flag.

Added rasqal_query_get_limit to get a query-specified limit on the number of results.

SPARQL Query Language Changes

Updated some of the SPARQL syntax to match the changes in the SPARQL Query Language for RDF W3C Working Draft of 17 February 2005. Added GRAPH replacing SOURCE and WITH replacing FROM. Added warnings about using the older forms and about using [...] instead of OPTIONAL.

Added recording of DISTINCT and LIMIT in the query structures but not yet used by the query engine.

RDQL Query Language Changes


Rasqal 0.9.6 Changes

General Changes

Fix a bug in writing a query result to XML when blank nodes are used. Now also correctly uses the base URI when pass in to the writing method.

Added support for three types of query result - bindings (the only one in previous versions), an RDF graph and a boolean. Added rasqal_query_results methods to test the type of the result: rasqal_query_results_is_bindings, rasqal_query_results_is_boolean and rasqal_query_results_is_graph.

Added rasqal_query_results_get_triple to get current triple as a raptor_statement and rasqal_query_results_next_triple to move to the next triple.

Added rasqal_query_results_get_boolean to get a boolean query result value.

Added rasqal_triple copy constructor rasqal_new_triple_from_triple.

Query Engine Changes

Constructs an RDF graph result as a sequence of triples. This enables the SPARQL CONSTRUCT form to work.

Can return a boolean result indicating that there were variable binding results, but not returning them. This enables the SPARQL ASK form to work.

Added a new function expression - rasqal_op enum value RASQAL_EXPR_FUNCTION, added new name and args fields to the rasqal_expression structure and added rasqal_new_function_expression to construct this expression.

Added new 1-argument expression RASQAL_EXPR_STR returning a string version of the expression.

Added new 1-argument expressions operating on RDF literals: RASQAL_EXPR_LANG returning the language string of an RDF literal, RASQAL_EXPR_DATATYPE returning the datatype URI of an RDF literal.

Added new 1-argument testing expressions returning booleans: RASQAL_EXPR_BOUND true if the variable argument is bound to a value, RASQAL_EXPR_ISURI true if the argument is a URI, RASQAL_EXPR_ISBLANK true if the argument is a blank node and RASQAL_EXPR_ISLITERAL true if the argument is an RDF literal.

Fixed a problem in optional results returning extra results with no new bindings.

SPARQL Query Language Changes

The SPARQL Parser now allows UTF-8 and \u, \U in prefixes and QNames.

Now supports CONSTRUCT and ASK queries using the updated query engine features.

OPTIONAL can now be used wherever [ ... ] could be used (parser bug fix).

Now supports the SPARQL built-in functions STR() returning a string version of the expression, LANG() returning the language string of an RDF literal, DATATYPE() returning the datatype URI of an RDF literal, BOUND() testing if a variable is bound, ISURI() testing if an expression is a URI, ISBLANK() testing if an expression is a blank node and ISLITERAL() testing if an expression is an RDF literal.

Now supports SPARQL BASE directive for setting the base URI of a query. This is experimental and may not be in the next version or may not be in the final SPARQL language.

The parser now expands QNames correctly when used in literals like "blah"^^xsd:string.

RDQL Query Language Changes

The RDQL Parser now allows UTF-8 and \u, \U in prefixes and QNames. This makes RDQL testsuite tests S-03, S-04 and S-05 work.

Rasqal 0.9.5 Changes

A release with major changes internal to the query engine to operate over graph patterns instead of sequences of triple patterns and to add execution of optional graph patterns. Additionally the query results can now be written in a recognised XML format.

This version of Rasqal requires Raptor 1.4.4.

Core Changes

Added a rasqal_graph_pattern class for handling matching a graph pattern (set of triple patterns) in an rasqal_query. RDQL only has one of these wheras SPARQL may have many, and they may be nested (this may change, as SPARQL is under development).

Added rasqal_query_results_write method to write variable binding query results to a raptor_iostream in the XML format defined by SPARQL Variable Binding Results XML Format, W3C Working Draft, 21 December 2004.

Query Engine Changes

Updated the query engine to operate over graph patterns rather than a single sequence of triple patterns. The graph patterns may be optional, which is used to implement SPARQL optionals. Nested graph patterns are constructed but cannot yet be executed.

Added a unary minus expression type.

Improved the type promotion for expression evaluation. Try to evaluate strings as doubles or integers if the operation contains one double or integer respectively.

Fixed a memory leak with string matches/non-matches.

SPARQL Query Language Changes

Optional graph patterns OPTIONAL and [ ... ] now work.

Added the { ... } group syntax and removed the ( ... ) form.

$ was added as an allowed variable prefixes.

A warning was added to show SOURCE * is ignored.

Added the UNION keyword, unsupported.

Rasqal now passes the DAWG SPARQL test cases: Optional triples (dawg-opt-query-001, dawg-opt-query-002, dawg-opt-query-003, dawg-opt-query-004) and examples from query WD (sparql-query-example-2.1a, sparql-query-example-2.2a, sparql-query-example-2.3a, sparql-query-example-2.4a, sparql-query-example-3)

Allow UTF-8 qname prefixes and check name against XML name constraints.

Recover lexer state from errors in regexes.

Terminate the lexer on a syntax error, rather than produce multiple errors.

RDQL Query Language Changes

The lexer now handles UTF-8 qname prefixes, enabling RDQL testsuite test S-02 to pass.

Allow UTF-8 qname prefixes and check name against XML name constraints.

Recover lexer state from errors in regexes.

Terminate the lexer on a syntax error, rather than produce multiple errors.

Rasqal 0.9.4 Changes

Pass on raptor parser errors to rasqal's error routines and upwards.

Clean up several memory allocations when a query fails to prepare or execute fully.

Fixed lexer jams when a query contained an illegal variable name after a '?'.

Fixed lexer crashes when a query ended in a regex pattern like /abc/.

Tidied up the testing framework so 'make distcheck' works.

Rasqal 0.9.3 Changes

Rasqal's License was changed from LGPL 2.1/MPL 1.1 to LGPL 2.1/Apache 2

Added support for the SPARQL Query Language for RDF, W3C Working Draft, 12 October 2004 from the W3C RDF Data Access Working Group (DAWG). The support is at the basic syntax level - token lexer and grammar parser which passes the first simple tests from the proposed DAWG testcases. No additional query engine support has been added for SPARQL features that are not supported by RDQL.

Queries can now be prepared and then executed multiple times.

Added configure --enable-query-languages option with rdql and sparql as the choices.

Thanks to Chris Pointon for several patches to make Rasqal easier to build under Win32. Applied with some modifications. Renamed the RDQL and SPARQL syntax tokens ERROR to ERROR_TOKEN to help.

Added experimental support for querying multiple sources; the same query is executed over each source in turn. Also added some support for returning the source URI which is not yet enabled as this feature is in flux in the DAWG work. This may change or be removed in future versions.

roqet can specify a data source URI on the command line with -s / --source) URI for queries executing against an implicit model.

Added the DAWG SPARQL test cases driven from the manifest.n3 format. Created tests from the examples in the working draft.

Added an experimental XML result format for bindings, based on DAWG work. Enabled in roqet with -o xml. This is very likely to change or replaced in future versions.

Added roqet argument -d / --dump-query to dump the processed query, rather than do it by default (0.9.2 and earlier).

roqet can now read queries from URIs, using the raptor_www class to do the retrieval.

Fixed the configure checks for a posix regex function regcomp to correctly discover it is present.

Internal changes

Added support for declaring prefixes for XML-style QNames both before and after their use.

The struct rasqal_prefix gained a declared field.

The struct rasqal_triple gained an origin field; not used at present but intended to support work on tracking triple provenance such as provided by Redland Contexts.

Added methods rasqal_triple_set_origin and rasqal_triple_get_origin to support the above.

struct rasqal_triple_meta now takes a 4-array of bindings, the fourth being the origin.

Exported function rasqal_set_triples_source_factory publically as originally intended.

Rasqal 0.9.2 Changes

This release made minor portability fixes for building with C++ and Win32 (untested).

Several functions changed their parameters or return values from char* to unsigned char* or const unsigned char* to reflect the actual use.

Changed to return a const unsigned char*:

Changed to take const unsigned char* (or add const):

Rasqal 0.9.1 Changes

This release changed the way that results were returned. A new rasqal_query_results class was created. This allows for a clean separation of the two concepts allowing multiple form of the results to be retrieved as methods of the query_results class, rather than the query class. The only form of results currently available is variable bindings, but RDF graphs will be returned in future, as a set of triples in a serialised form.

The execution method rasqal_query_execute was changed to return a new object of that class rather than an int success or failure.

The following methods of the rasqal_query class were renamed and moved to the new rasqal_query_results class:

0.9.0 name 0.9.1+ name
rasqal_query_get_result_count rasqal_query_results_get_count
rasqal_query_next_result rasqal_query_results_next
rasqal_query_results_finished rasqal_query_results_finished
rasqal_query_get_result_bindings rasqal_query_results_get_bindings
rasqal_query_get_result_binding_value rasqal_query_results_get_binding_value
rasqal_query_get_result_binding_name rasqal_query_results_get_binding_name
rasqal_query_get_result_binding_by_name rasqal_query_results_get_binding_value_by_name
rasqal_query_get_bindings_count rasqal_query_results_get_bindings_count

A new rasqal_free_query_results destructor was created to delete the query results. (There is no public constructor).

Other minor bugs were fixed such as multiple constraints now being ANDed and not ORed, and adding defensive code for when queries fail and results methods are invoked.

Rasqal 0.9.0 Changes

It is all new.