# Redland librdf RDF API Library - Release Notes

## Redland 1.0.17 changes

Issues Fixed:

- 0000529: MySql storage error on initial creation
- 0000540: configure: remove obsolete --with-xml-parser/--with-openssl-digests
- 0000541: configure pkg-config checks not overridable
- 0000542: win32_rdf_config.h doesn't work on MSVC2008
- 0000543: assertion in rasqal_query_results_next_triple called from librdf_query_rasqal_query_results_next_statement

## Concept class changes

Added `rdf:HTML` and `rdf:langString` from RDF 1.1.

## Storage class changes

Update deprecated MySQL engine type syntax. Patch from olberger on github.

## Configuration and build fixes

Make configure restore CPPFLAGS after virtuoso test. Helps portabilty and Debian hardening.

Fixes to Win32 builds with MSVC2008 from Michael Stahl.

## Internal fixes

Several alignment and error path fixes from clang and llvm.

Fix `rasqal_query_results_next_triple()` call with NULL. Patch from Michael Stahl.

## Redland 1.0.16 changes

Issues Fixed:

- 0000443: "1"^^xsd:boolean does not evaluate as true
- 0000460: librdf error - storages already registered
- 0000497: "1"^^xsd:boolean and "true"^^xsd:boolean are not true
- 0000518: Blank node parsing error
- 0000519: SPARQL query-related methods crash on certain literals

### General changes

Requires Raptor 2.0.7 or newer

### Model class changes

`librdf_model_contains_statement()` now returns > 0 only for invalid statements according to the API contract. NULL statements are considered invalid. Fixes Issue #0000489

### Node class changes

All the constructors now normalize the nodes (Raptor terms) so that equality is a cheap pointer comparison. Fixes Issue #0000443.

### Query class changes

`librdf_query_results_get_binding_value()` and `librdf_query_results_get_binding_name()` now fail when called with negative offsets.

### Serializer class changes

Serializing (using Raptor) now sets the statement graph field to make serializing to N-Quads work.

### Storage class changes

Loading the same storage multiple times no longer gives a runtime error.

`librdf_storage_contains_statement()` now returns > 0 only for invalid statements according to the API contract. Uses `librdf_statement_is_complete()` for testing statement validity.

hashes storage: Make matching a statement work when using graph names (redland contexts). Fixes Issue #0000515

mysql storage: Defaulted storage configuration host to 'localhost' if it is not given. Opening a store with missing configuration now reports the required keys.

postgres storage: Fixed a bad malloc result test during query allocation that probably caused `librdf_model_find_statements()` to fail. Fix from 'zoggy' on github - thanks. Made loading triples from a stream to postgresql actually work via `librdf_model_add_statements()`. Defaulted storage configuration host to 'localhost' if it is not given. Opening a store with missing configuration now reports the required keys.

### Unicode module changes

Added `librdf_latin1_to_utf8_2()` with size_t args. Deprecates librdf_latin1_to_utf8().

Added `librdf_utf8_to_latin1_2()` with size_t args and new default arg for replacing out of range characters. Deprecates librdf_utf8_to_latin1().

### World class changes

Added `librdf_world_set_raptor_init_handler()` and `librdf_world_set_rasqal_init_handler()` methods to set handlers for configuring internal raptor and rasqal after they have been constructed but before they are initialized; before `raptor_world_open()` or `rasqal_world_open()` are run, respectively. Added new typedefs `librdf_raptor_init_handler` and `librdf_rasqal_init_handler` for the handlers.

### Other API changes

Added `librdf_license_string` and `librdf_home_url_string` static strings to public API following Raptor and Rasqal naming convention.

### Other changes

No longer gives an error when the same storage module is attempted to be loaded more than once. This is a harmless error and can be generated by installations that include the shared library storage module in a '.so' file and the '.la' file associated with it. Fixes Issue #0000460

Multiple fixes for newer GCC warnings.

Multiple internal fixes for signed int conversions especially around size_t and allocation.

Removed old debugging memory allocation options `--with-dmalloc` for dmalloc and `--with-memory-signing` for internal signing of memory blocks. Valgrind and static analyzers replace this.

Multiple portability fixes for building out of the source tree. Out of source tree 'make check' and 'make dist' should both work. Thanks to Daniel Richard G. for the patches.

Multiple internal error path cleanup issues and int/size_t issues found via clang static analyzer.

configure now looks for Oracle DB (aka Sleepycat DB aka Berkeley DB) 5.3

autogen.sh now supports the NOCONFIGURE variable like Lib{XML2,XSLT}, aborts the run if an progrma fails and creates the NEWS if it does not exist to aid building from GIT and 'make dist'.

## Redland 1.0.15 changes

Issues Fixed:

- 0000461: librdf error - query language vsparql already registered
- 0000468: xlc on AIX configure tests for both HAVE_BDB_OPEN_7_ARGS and HAVE_BDB_OPEN_6_ARGS pass
- 0000475: Freeing a counted_string returned by redland on a modern Windows system crashes
- 0000478: Object returned from librdf_stream_get_object must be copied, but may not copiable
- 0000483: Documentation of librdf_parser_get_namespaces_seen_count return is incorrect
- 0000485: No rule to make target `-lltdl', needed by `librdf.la'. Stop.

### General changes

Added new API functions `librdf_alloc_memory()`, `librdf_calloc_memory()` and `librdf_free_memory()` to allow freeing memory allocated inside librdf shared library, such as on windows with DLLs. (Lauri Aalto) Fixes Issue #0000475

### Hash class changes

Export `librdf_new_hash()` to the public API.

BDB Hash now uses the newer 7 args open form in preference to the 6 args form. (Peter O'Gorman / pogma). Fixes Issue #0000468

### Statement class changes

Reverted `librdf_new_statement_from_statement()` to the pre-`raptor_term` deep copy contract for the function. (Lauri Aalto) Fixes Issue #0000478

Added `librdf_new_statement_from_statement2()` providing a shallow copy of statement which was the post-`raptor_term` semantics of `librdf_new_statement_from_statement()`. (Lauri Aalto) Fixes Issue #0000478

### Storage class changes

Virtuoso storage:

- Added switch for VIRTUOSO_DV_TIMESTAMP_OBJ.
- Prevent virtuoso query being registered twice in non-modular build Fixes Issue #0000461.

### Other changes

Fixed the parser test to actually test 3 parsers rather than a non-deterministic number. Emits warnings when parser constructor fails since a syntax may not be supported.

Set up the libltdl build dependencies and linking flags properly. Fixes Issue #0000485

Portability changes were made to rdfproc for windows.

Add the `REDLAND_CALLBACK_STDCALL` attribute macro in the serializer log handler for windows.

Multiple librdf and `rdfproc(1)` changes to allocate and free memory using librdf_alloc_memory, librdf_calloc_memory and librdf_free_memory to ensure memory is allocated correctly across libraries (DLLs). (Lauri Aalto).

Several code style changes were made.

## Redland 1.0.14 Changes

Rasqal minimum version is now 0.9.25 for the new `rasqal_world_get_query_language_description()` function.

Issues Fixed:

- Issue #0000375: Add functionality to parse from iostream (or similar)
- Issue #0000418: SQLite driver adds duplicate statements if a conext is given.
- Issue #0000432: Seg fault when getting a blank node after parsing RDF
- Issue #0000447: fatal error: rdf_types.h: No such file or directory

### Hash Class Changes

BDB Hash (name 'bdb'): Add checks for Oracle Berkeley DB 5.1, 5.0 and 4.9 and updated `configure` messages with the new name. The 5.x storage has the same API but has a new on-disk format that will require a use of the `db-upgrade(1)` utility in the utils directory.

Fixed `librdf_hash_get_as_boolean()` 'false' string fixed to actually be a False value.

### Node Class Changes

`librdf_node_write()` is defined to now always write N-Triples format.

Blank node ID generation and mapping from parsing is now consistently made across Redland librdf rather than relying on some Raptor defaults. Fixes Issue #0000432

Fixed URI reference leak in `librdf_new_node_from_uri_local_name()` and `librdf_new_node_from_normalised_uri_string()` constructors.

### Parser Class Changes

Do not report programmer errors via logging, just runtime errors.

Added `librdf_parser_parse_iostream_as_stream()` and `librdf_parser_parse_iostream_into_model()` from patch by Norman Gray with style fixes by Lauri Aalto. Thanks. Fixes Issue #0000375

### Query Class Changes

Added `librdf_query_language_get_description()` to return the full description of of the query language. Deprecates `librdf_query_languages_enumerate()`

### Statement Class Changes

Restored `librdf_statement_decode_parts()` to the public ABI/API which was accidently removed. It has been deprecated for `librdf_statement_decode2()` for some time and now always fails.

### Storage Class Changes

Storage Hashes (name 'hashes'): Fixed a reference leak and shared values issue when cloning a storage. The BDB hash type (current default) was updated for Oracle DB 5.1; see above.

Storage SQLite (name 'sqlite'): Do not add duplicate statements if a context is given. Fixes Issue #0000418. Fixed a librdf_node reference leak when serializing model with context nodes.

### UTF8 Module

Made functions that were already declared in a public header file and documentation into part of the API.

Added but deprecated for Raptor equivalents (they are wrappers for them):

      int librdf_unicode_char_to_utf8(librdf_unichar c,
        unsigned char *output, int length);

      int librdf_utf8_to_unicode_char(librdf_unichar *output,
        const unsigned char *input, int length);

Added:

      unsigned char* librdf_utf8_to_latin1(const unsigned char *input,
        int length, int *output_length);

      unsigned char* librdf_latin1_to_utf8(const unsigned char *input,
        int length, int *output_length);

      void librdf_utf8_print(const unsigned char *input, int length,
        FILE *stream);

### Other Changes

The internal Redland librdf AVL Tree implementation was removed and the 'trees' storage changed to use the AVL Tree implementation in Raptor (`raptor_avltree`) which is newer and has bug fixes beyond the Redland librdf version.

Redland librdf was ran through the LLVM clang static code analyzer and several issues fixed, mostly in unused variables and values computed that were needed but also included a few use of uninitialized variables especially in error cases. one problem fixed was in `librdf_world_set_feature()` to actually set the value for the genid base and genid counter features (`LIBRDF_WORLD_FEATURE_GENID_BASE` and `LIBRDF_WORLD_FEATURE_GENID_COUNTER` respectively)

`configure` now tries harder to find the Oracle Berkeley DB library using Debian multiarch directories if present. This is yet another heuristic and rather a hack. For a consistent approach the `--with-bdb`, `--with-bdb-lib`, `--with-bdb-include` and `--with-bdb-dbname` options to `configure` should be used.

Use `raptor.h` header from Raptor V2.

Removed Raptor V1 support code as librdf no longer supports Raptor V1.

Updated RPM spec file to make Redland librdf package require Raptor V2 (raptor2 package) and Rasqal (rasqal package).

Add sanity checking when initialising Raptor so that there are always parsers and serializers, or something went very wrong and librdf will not work, so return an error.

Removed internal cache module that no code used, didn't seem to entirely work and was never in the public API.

Now configure generates the (untested) win32_rdf_config.h for (untested) WIN32 builds.

## Redland 1.0.13 Changes

Raptor minimum version is now 2.0.0. Raptor V1 support was removed.

Rasqal minimum version is now 0.9.22. Removed use of deprecated Rasqal functions that were conditioned on older rasqal versions.

Issues Fixed:

- Issue #0000325: Make mime_types and syntax URIs available in parser and serialiser enumerations
- Issue #0000404: Parsing errors when parsing RDFa
- Issue #0000419: Syntax error when debugging enabled

### Node class changes

Mark `librdf_node_to_string()` and `librdf_node_to_counted_string()` as deprecated.

### Parser class changes

`librdf_new_parser()` now logs failure to find a parser for the given name, type and/or uri rather than just returning NULL.

Added `librdf_parser_get_description()` deprecating `librdf_parser_enumerate()`. Fixes Issue #0000325

### Query results class changes

Added `(librdf_query_results_formats_get_description()` deprecating `librdf_query_results_formats_enumerate()`.

Removed toy 'triples' query language. Use 'sparql' instead.

### Serializer class changes

`librdf_new_serializer()` now log failure to find a serializer by the given name, type and/or uri rather than just returning NULL.

Added `librdf_serializer_get_description()` deprecating `librdf_serializer_enumerate()`. Fixes Issue #0000325

The graph name is now provided to Raptor serializers so that they can write out quads, if supported. At present this works with the 'nquads' serializer.

### Storage class changes

`librdf_new_storage()`, `librdf_new_storage_with_options()` now log failure to find storage by the given name rather than just returning NULL.

### Other changes

Add new generated version defines to librdf.h: `LIBRDF_VERSION`, `LIBRDF_VERSION_STRING`, `LIBRDF_VERSION_MAJOR`, `LIBRDF_VERSION_MAJOR` `LIBRDF_VERSION_MINOR` and `LIBRDF_VERSION_DECIMAL` (already in earlier versions).

Removed all code in user build of library that calls abort() and replaced with an error log, then failure.

## Redland 1.0.12 Changes

The main changes in this release are:

- Enable `librdf.h` to be used as the top-level header in addition to `redland.h`
- Fix linking issues when building with GNU ld with DT_NEEDED disabled

Issues Fixed:

- Issue #0000329: librdf_statement_is_complete is missing from the bindings (Redland.i)
- Issue #0000348: linking failure fix
- Issue #0000391: librdf_free_foo(0)
- Issue #0000392: librdf_stream_get_context returns void*
- Issue #0000393: librdf_storage_hashes_context_serialise_get_statement

### General changes

The main header file for Redland librdf is `redland.h` but some applications used `librdf.h` direct, which no longer works in 1.0.11 since some Rasqal symbols were needed. `librdf.h` now includes the raptor and rasqal headers and `redland.h` is a simple wrapper around librdf.h

Redland librdf now links with symbols in libraries used indirectly (only Raptor) to help systems that use GNU ld with a different linking model to previous versions. This is quite technical and hard to understand but see Fedora's change in implicit DSO linking and Understanding the (Proposed) Change to DSO Linking that were introduced in Fedora Core 13 released in February 2010. Redland librdf was packed with patches to fix this, which are now merged into the sources.

### Stream Class changes

Added `librdf_stream_get_context2()` returning a `librdf_node*` deprecating `librdf_stream_get_context()` that returns a void pointer. Fixes Issue #0000392.

### SWIG Bindings Interface

Export `librdf_statement_is_complete` to bindings languages. Fixes Issue #0000329

### Configuration changes

Rasqal minimum version has been 0.9.19 for some time but is now enforced in `configure`.

Updated `configure` to work with newer autoconf that enforces `AC_LANG_SOURCE`.

### Other changes

Updated examples to build with Raptor V2 also.

The node and statement destructors for the Raptor V2 build now allow NULL pointers like the Raptor V1 versions. Related to Issue #0000391 which had already been fixed for other classes.

## Redland 1.0.11 Changes

The main changes in this release are:

- Virtuoso storage backend querying now fully works
- 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`.
- Several new convenience APIs were added
- Several APIs were deprecated for better APIs calls

Issues Fixed:

- Issue #0000124: Node, Statement and Model to_string should use N3 syntax
- Issue #0000284: Added storage and query interface support for Virtuoso QUAD store
- Issue #0000321: librdf_free_node after librdf_iterator_get_object in rdfproc
- Issue #0000322: rdfproc uses rasqal_ functions instead of librdf_ in option parsing
- Issue #0000334: rdfproc chatters unmercifully; hard to use in scripts
- Issue #0000338: librdf_query_results_to_counted_string cannot format a query result if the format name has no URI (csv, tsv)
- Issue #0000341: undefined symbol error from virtuoso storage .so
- Issue #0000344: It is hard to use table, csv, tsv results formats
- Issue #0000350: Redland Tree Storage crashes when loading two specific, valid, RDFMXL files
- Issue #0000363: Add method to the public API to allow enumeration of the query factories
- Issue #0000366: SELECTing list of named graphs doesn't return any results
- Issue #0000371: SPARQL queries in rdfproc using Virtuoso don't work
- Issue #0000380: SPARQL queries using Virtuoso do not work
- Issue #0000382: simple graph query returns no results
- Issue #0000383: rdfproc -n does not always make the store empty

### Raptor V2 API support

This release adds support for building with Raptor V2 API as an alternate to the Raptor V1 API. When built with Raptor V2 , librdf uses the Raptor V2 URI, Term and Statement to fully implement the librdf equivalents. Specifically when this is enabled the following are typedefed as equivalent:

- `librdf_uri` = `raptor_uri`
- `librdf_node` = `raptor_term`
- `librdf_statement` = `raptor_statement`

### Configuration and build changes

Added `--enable-raptor2` to enable librdf to build with Raptor V2 API. This requires a rasqal built with Raptor V2 API (with the `--enable-raptor2` argument to Rasqal's `configure`). The librdf `configure` will check that Rasqal was built this way and only enable Raptor V2 API support if it will work.

The minimum Raptor version is now 1.4.19 (or Raptor V2 beta 1.9.0+)

Tests now use the in-memory storage if the BDB (Sleepycat DB) storage is not available.

Updated to prevent an error when used with autoconf 2.68+

### Hash Class Changes

Exposed `librdf_hash_from_string()` function to public API for converting from a string to a `librdf_hash` object. This is useful for building storage options.

Added `librdf_hash_to_string()` function for converting a `librdf_hash` back ito a string, intended to be the opposite of `librdf_string_to_hash()` and takes a filter arg to help hide arguments such as 'password'.

### Log Class Changes

Added a `LIBRDF_FROM_RAPTOR` log facility.

### Model Class Changes

Added `librdf_model_write()` deprecating `librdf_model_print()` debug routine.

### Node Class Changes

Added `librdf_new_node_from_counted_uri_string()` to make an RDF node from a URI string and length avoiding a `strlen()`.

Added `librdf_node_get_counted_blank_identifier()` to return ID with length.

Added `librdf_new_node_from_counted_blank_identifier()` with counted ID string.

Added `librdf_node_new_static_node_iterator()` with world arg added deprecating `librdf_node_static_iterator_create()` without it.

`librdf_node_write()` added to write a redland node to an iostream, formatted as N-Triples.

Adjusted `librdf_node_print()` to use `librdf_node_write()`. If anyone was relying on this unsupported debug format, this changes the result. Fixes Issue#0000124

Deprecate `librdf_node_to_string()`, `librdf_node_to_counted_string()` for `librdf_node_write()` since these were really only meant for internal use.

Adjusted `librdf_node_to_string()`, `librdf_node_to_counted_string()` to use construct an iostream to a string and use `librdf_node_write()` to create the strings. Thus the format is now an N-Triples term rather than the older debug format. These functions are still for debugging and deprecated for `librdf_node_write()`.

### Query Class Changes

Fix rasqal query engine integration to allow querying over the Redland graph names (context URIs) and binding variables to the names. Fixes Issue #000382.

Fix query engine to prevent runtime warning for models with no contexts (graphs) when using GRAPH in a query.

Added `librdf_query_languages_enumerate()` function to list supported query languages.

Made the Virtuoso storage engine (name 'virtuoso') use the internal Rasqal query results formatting API rather than an internal copy of a few query result formatters.

### Query Results Class Changes

Added `librdf_new_query_results_formatter2()` with name, mime type and fomrat URI args deprecating `librdf_new_query_results_formatter()` and `librdf_new_query_results_formatter_by_mime_type()` with a mixture.

Altered all query result formatters to all take format name, mime_type and uri args. Added `librdf_query_results_to_counted_string2()`, `librdf_query_results_to_string2()`, `librdf_query_results_to_file_handle2()`, `librdf_query_results_to_file2()` deprecating the functions without the 2 suffix.

### Serializer Class Changes

`librdf_serializer_serialize_stream_to_iostream()` and `librdf_serializer_serialize_model_to_iostream()` now document their ownership transfer of the `raptor_iostream` object. Fixes Issue #0000372

### Statement Class Changes

Added `librdf_statement_encode2()`, `librdf_statement_encode_parts2()`, `librdf_statement_decode2()` taking a world arg, deprecating those without the 2 suffx and no world arg.

Added `librdf_statement_write()` using `librdf_node_write()` to format the statement as N-Triples.

Adjusted `librdf_statement_to_string()` to use librdf_statement_write() to write statement in N-Triples format rather than the previous format.

### Stream Class Changes

Added `librdf_stream_write()` deprecating `librdf_stream_print()` debug routine.

### Storage Class Changes

`librdf_storage_context_remove_statement()` now checks that statement is non-NULL and allows NULL context. Now matches function spec.

Storage Postgresql (name 'postgresql'). Fix the contains-statement method as called by `librdf_storage_contains_statement()` to work using patch from Andrew Malton - thanks.

Storage Trees (name 'trees'). Fix the crash bug when comparing nodes one of which has a language and the other doesn't. Issue #0000350.

Storage Virtuoso (name 'virtuoso'). Fix to use the internal Rasqal query formatting API to allow returning any result format. This is not using a very efficient mechanism since it results in about 3 copies of the result set: in librasqa;, librdf and virtuoso but it works and does not duplicate code. Update the storage to support newer Virtuoso versions such as recent ODBC extensions. Added support for `SQL_DESC_COL_LITERAL_LANG` `SQL_DESC_COL_LITERAL_TYPE` and `SQL_DESC_COL_BOX_FLAGS` from Virtuoso ODBC Implementation - Virtuoso ODBC RDF Extensions for SPASQL. Tested with Virtuoso 5.0.13 open source edition.

### URI Class Changes

Added `librdf_new_uri2()` taking a counted URI string argument, avoiding `strlen()`s.

### World Class Changes

Export `librdf_world_set_raptor()` and `librdf_world_get_raptor()` to get/set the raptor world. These are only used when librdf is built with Raptor V2.

### Internal changes

`struct librdf_query_factory_s` methods `new_results_formatter` and `new_results_formatter_by_mime_type` are replaced by one `new_results_formatter` method that takes name, mime type and format URI args. It also gains a `new_results_formatter2` factory method for query results formatting. The only implementor of this factory is the internal Rasqal query results formatter.

### Language Bindings (SWIG) changes

Exposed several functions (some new) that make sense to higher-level libraries bound to librdf via SWIG:

- `librdf_hash_from_string()` to build a hash from a string; useful for encoding storage options.
- `librdf_hash_to_string()` to turn a hash into a string; useful for decoding storage options.
- `librdf_model_add_typed_literal_statement()` to add a typed literal statement direct to a graph.
- `librdf_new_node_from_normalised_uri_string()` to create a URI node.
- `librdf_new_node_from_uri_local_name()` to create a URI node
- `librdf_node_get_li_ordinal()` to get the 1 from a rdf:_1 predicate node.
- `librdf_parser_check_name()` for checking parser names.
- `librdf_query_results_is_syntax()` to check if query result is a syntax.
- `librdf_query_results_to_file2()` supplementing the deprecated `librdf_query_results_to_file()`
- `librdf_query_results_to_string2()` supplementing the deprecated `librdf_query_results_to_string()`
- `librdf_serializer_check_name()` for checking serializer names.
- `librdf_serializer_serialize_stream_to_file()` to go along with it's pair that serializes a model to a file.
- `librdf_serializer_serialize_stream_to_string()` to go along with the pair that serializes a model to string.
- `librdf_world_set_logger()` to set for logging callbacks.

### Other changes

`rdfproc(1)` utility now send non-result information messages to stderr, indented to make this more useful for scripting. It also gains '-q' (--quiet) and '-V' options (--verbose) to control this output - entirely removing it (quiet) or being more verbose. That is '-q -v' is equivalent to the default verbosity. Change based on patch by Norman Gray in issue - thanks! Fixes Issue #0000334

`rdfproc(1)` utility now fails with error when using -n (make a new storage) to a read only operation such as a query. Fixes Issue #0000383.

Switched to GIT source control.

Added HACKING.md documenting code style.

Added `examples/example8.c` to show how to serializer query results to strings when queries return either variable bindings or triples forms.

## Redland 1.0.10 Changes

The main changes in this release are:

Added a Virtuoso storage by Patrick van Kleef
Support Rasqal 0.9.17 API
Fix compiling against sqlite 3.6.17 or newer
Fix modular storage dynamic loading linking problems.

Building requires installed Raptor (1.4.17 or newer) and Rasqal (0.9.16 or newer) libraries, preferably with `pkg-config` to provide the compile/link details.

Issues Fixed:

- Issue #0000302: Modular storages fail to load from any other library or language binding (drobilla)
- Issue #0000304: librdf_storage_trees_remove_statement returns wrong value (I think)
- Issue #0000311: Incorrect literal comparison in tree structure
- Issue #0000315: cannot compile library on linux 2.6.31
- Issue #0000317: rdf_init_test fails if threads are enables

### Configuration and build changes

Default to environment LIBS, CPPFLAGS, LDFLAGS in `configure` to address Gentoo issue 267405

Make redland-src-config work for external raptor and rasqal again. This is for the maintainers only.

Put modular build libltdl includes and libs into INTERNAL macros

### Parser Class Changes

`librdf_parser_check_name()` added to check if a parser name is valid:

      int librdf_parser_check_name(librdf_world* world, const char *name);

### Query Class Changes

Support Rasqal 0.9.17 API changes including versioned triple factory and triple sources, `RASQAL_LITERAL_UDT` user-defined datatype literals. Use `rasqal_literal_get_rdf_term_type` when available or fall back to internal version.

### Serializer Class Changes

`librdf_serializer_check_name()` added to check if a serializer name is valid:

      int librdf_serializer_check_name(librdf_world* world, const char *name);

### Storage Class Changes

Update storage module link dependencies so that they depend on librdf library to prevent unresolved symbol errors.

More validation of storage module names.

Storages 'file' and 'uri'. These get new storage option `format` with a name value to set the on disk / remote URI) syntax format. For the both storages it has to be a legal parser name and for the file storage it has to be a legal serializer name too. This pretty much limits the values to ntriples, rdfxml and turtle for the file storage (depending on how raptor is built).

Storage 'postgresql'. Replace deprecated PQescapeString with PQescapeStringConn that takes a PGconn connection handle and when encoding takes into consideration any connection properties such as character encodings in force.

Storage 'sqlite'. Change define SQLITE_API to REDLAND_SQLITE_API to allow redland to compile with sqlite 3.6.17 or newer where the SQLITE_API macro is defined. Thanks to Samuli Suominen for the report and fix.

Storage 'virtuoso'. Added a Virtuoso storage patch from Issue#0000284 by Patrick van Kleef with some parts omitted for passing through SPARQL queries that used rasqal internals.

### Other changes

Export the list helper class to the public API, primarily for use by external storage modules.

`rdfproc` utility: for the 'parse' command, get the warning count from the warning_count_node, not the (just freed) error_count_node.

Fix totally bogus memset in `librdf_cache_set_common()` that zeroed junk on the stack rather than the memory expected.

## Redland 1.0.9 Changes

The main changes in this release are:

Made storages modular by default - separate dynamically loaded modules discovered from presence in the PREFIX`/lib/redland` directory. or from the directory defined in the `REDLAND_MODULE_PATH` environment variable directory.

Building requires installed Raptor (1.4.18 or newer) and Rasqal libraries.

Issues Fixed:

- Issue #0000272: Casts for g++
- Issue #0000282: Documentation fixes
- Issue #0000283: `librdf_new_node_from_blank_identifier()` read memory after free bug.
- Issue #0000285: `librdf_storage_postgresql_get_contexts()` fix
- Issue #0000286: multiple postgresql storage fixes.

### General Changes

Developer builds from Subversion now require libtool 2.2.0 or newer to `libtoolize` from `configure.ac`.

`configure` now discovers Berkeley DB 4.7

`configure` options `--with-raptor=internal` and `--with-rasqal=internal` were removed.

Removed openssl digest support - not used much and an extra large dependency. MD5 and SHA1 remain builtin.

### Statement Class Changes

Fix to `librdf_statement_encode_parts()` for buffer overrun error that could occur with certain size buffers. Patch from Lou Sakey - thanks.

### Storage Class Changes

Made the redland storage module API `librdf_storage_factory` public. What was called the storage context is now less confusingly called the storage instance.

Moved iterator and stream `get_method` flags to public API as new enums since they are used by the storage modules API.

Moved `librdf_log()` and `librdf_log_simple()` into public API to allow external storage modules to log messages.

More checks for failure during storage instance allocation.

postgresql storage: Fixes for "Numerous leaks, potential NULL pointer use, and dropped postgresql errors and buffer overruns in the postgresql storage module" based on patches in Issue #0000286.

sqlite storage: Fixes to prevent deadlocks with `BEGIN IMMEDIATE` instead of the default `BEGIN DEFERRED`. No longer writes to the sqlite database when just querying. Several other fixes.

trees storage: Several fixes.

### Other Changes

Multiple Win32 build fixes based on patches from Lou Sakey - thanks.

Added `librdf_parser_guess_name2()` to SWIG API.

### Internal Changes

Added LRU cache for internal use.

Several autogen.sh updates for libltdl.

Use libtool's `libltdl` to dynamially load storage modules. Will link in a copy from sources if not present in the system from libtool.

Internal raptor and rasqal sources removed - now use `pkg-config(1)` to find external libraries to compile and link to.

Fixes for AVL Tree: update parent pointers when deleting - patch from Aymeric Barthe - thanks.

Added internal support for upcoming Raptor V2 API. Not yet enabled. Added `librdf_world_get_raptor()` and `librdf_world_set_raptor()` methods. Added `librdf_parser_guess_name2()` with librdf_world parameter and deprecated `librdf_parser_guess_name()` without it.

Wrapped deprecated functions with `REDLAND_DISABLE_DEPRECATED` blocks.

## Redland 1.0.8 Changes

The main changes in this release are:

Updated to use Rasqal 0.9.16 (Rasqal 0.9.16 release notes) from 0.9.15. NOTE: Rasqal's ABI and API changed so Redland 1.0.8 requires 0.9.16 or newer.

Updated to use Raptor 1.4.18 (Raptor 1.4.18 release notes) from 1.4.16.

Added a new in-memory indexed storage 'trees' using AVL Trees

Issues Fixed:

- 0000256: mysql reconnect not working (MySQL v5 only?)

> NOTE: The next release of redland will NOT include raptor and rasqal in the tarball, they will be separate download dependencies.

> NOTE: In the next release of redland, the `redland-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 redland ...` It will be removed in a future release.

### General Changes

`configure` was updated to ensure that redland 1.0.8+ will work with rasqal 0.9.16 to 0.9.99 only.

### Parser Class Changes

`librdf_parser_set_feature()` now handles setting feature values as strings or integers, depending on the required type (although Raptor will handle this too).

Added `librdf_parser_parse_file_handle_as_stream()` and `librdf_parser_parse_file_handle_into_model()` helper methods.

### Serializer Class Changes

`librdf_serializer_set_feature()` now handles setting feature values as strings or integers, depending on the required type (although Raptor will handle this too).

### Storage Class Changes

Added a new in-memory storage named "trees" by Dave Robillard that uses AVLTrees internally for faster indexed triple store/querying. This is an alpha quality storage since it is brand new and it may be changed in future.

### Other Changes

`LIBRDF_URI_RDF_MS`, `LIBRDF_URI_RDF_SCHEMA` public API macros changed definition to pass in a world parameter.

Added `librdf_get_concept_ms_namespace()` and `librdf_get_concept_schema_namespace()` to make the concept macros above work.

Added an rss2atom example program.

Update configure to use autoconf 2.5.x `AC_CHECK_TYPES` for testing byte, u32 and u64.

Fixes for resilence under low memory and allocation failures.

### Internal Changes

Applied some updates from running the Linux 'sparse' utility.

Allow get_context method calls in stream/iterator map functions. Originally reported on redland-dev 6 May 2008 by John Fieber.

The storage method `librdf_storage_find_statements_in_context()` now uses the storage factory method find_statements_in_context if it exists, instead of always using the find_statements factory method and filtering.

## Redland 1.0.7 Changes

The main changes in this release are:

Updated to use Rasqal 0.9.15 (Rasqal 0.9.15 release notes) from 0.9.14. NOTE: Rasqal's API will change in 0.9.16 so Redland 1.0.7 requires 0.9.15 exactly - no newer, no older.

Updated to use Raptor 1.4.16 (Raptor 1.4.16 release notes) from 1.4.15.

Added modular storage backends. When `--enable-modular` is given to configure, all the storage major backends are compiled as dynamically loadable modules. The memory, file and uri storages are always available. This is not enabled by default as it is a new feature.

Issues Fixed:

- 0000187: "rdf_query_results.c", line 630: void function cannot return value
- 0000189: librdf_uri_is_file_uri: wrong return value
- 0000203: API declarations for Symbian portability
- 0000205: Memory leak in rdf_query_rasqal.c
- 0000209: Null dereference + assertion failures in minimal librdf setup-cleanup
- 0000213: Multiple instances of world object make trouble
- 0000215: librdf_new_node_from_typed_counted_literal() does not respect parameter lengths
- 0000218: librdf_query_execute does not assert model parameter
- 0000229: Segmentation fault when invoking librdf_new_model_from_model()
- 0000230: on Gentoo/FreeBSD redland fails compilation due to a missing #define pthread.h
- 0000234: autogen.sh $dir quoting
- 0000235: $(EXEEXT) in tests
- 0000236: EOL issues when building svn version on cygwin

### General Changes

`configure` was updated to ensure that redland 1.0.7 will work with rasqal 0.9.15 only due to the future API change coming in the next rasqal version.

Make lots of writable static data truly constant especially from writable static data from rdf_concepts. This causes a SOURCE COMPATIBILITY BREAK: the `rdf_concepts.h` public API node and uri macros now require a `librdf_world*` parameter.

### Parser Class Changes

Added `librdf_parser_set_uri_filter()` and `librdf_parser_get_uri_filter()` to set and get parser URI filters, passed on into raptor.

### Storage Class Changes

Several SQLite storage improvements and fixes were made:

- Added transaction support
- Handle SQL errors more gracefully
- the contains_statement method now works with a blank subject node.
- Resource allocation and low mwmory fixes

### URI Class Changes

Added `librdf_uri_compare()` to compare uri objects rather than rely on stringifying them and comparing the strings.

### Internal and Other Changes

Many low memory and error path, resource leak fixes for parsers, streams, module factory construction and module initialising.

`librdf_serializer_set_namespace()` now allows NULL uri and prefix to be given.

`librdf_storage_mysql_transaction_commit()` now terminates if there is no work to commit.

autogen.sh version comparsion was fixed so that 1.10 is seen as newer than 1.9.

## Redland 1.0.6 Changes

The main changes in this release are:

Updated to use Rasqal 0.9.14 (Rasqal 0.9.14 release notes) from 0.9.13.

Updated to use Raptor 1.4.15 (Raptor 1.4.15 release notes) from 1.4.13.

Plus a new transactions API for changes to the graph, implemented and tested for MySQL.

Added a new query results formatter class to turn a query results object into a syntax.

### Model Class Changes

Added a model transaction API:

- `librdf_model_transaction_start()` to begin the transaction
- `librdf_model_transaction_start_with_handle()` to begin it using an existing connection pointer (such as a MySQL connection)
- `librdf_model_transaction_commit()` to commit the changes
- `librdf_model_transaction_rollback()` to abort them (automatic if not commited before a close)
- `librdf_model_transaction_get_handle()` to get a handle associated with a connection.

Fixes Issue #0000038

Implemented the Transaction API for MySQL (tested) and PostgreSQL (not tested).

Invert test in `librdf_model_add_submodel()`. Fixes Issue#0000175

### Parser Class Changes

Added `librdf_parser_guess_name()` to guess a parser name from content, similar to how a parser is constructed from content.

Added functions to return the namespaces declared during a parse: `librdf_parser_get_namespaces_seen_count()` to return the number seen, `librdf_parser_get_namespaces_seen_prefix()` to get the prefix string and `librdf_parser_get_namespaces_seen_uri()` to get the `librdf_uri*`.

### Query and Query Results Class Changes

Added a new Query Results Formatter class building `librdf_query_results_formatter*` objects to turn a query results into a syntax such as SPARQL query results formats, JSON. New functions:

- Constructors: `librdf_new_query_results_formatter()` and `librdf_new_query_results_formatter_by_mime_type()`.
- Destructor: `librdf_free_query_results_formatter()`
- Method: `librdf_query_results_formatter_write()` to write the query results to an iostream.
- Helper functions: `librdf_query_results_formats_check()` and `librdf_query_results_formats_enumerate()`

Added `librdf_query_results_is_syntax()` to check if a query result is a syntax, and not any of the other possibilities - bindings, boolean or graph.

### Serializer Class Changes

Default to serializer named "rdfxml" if no name is given to ensure another rdfxml serializer such as XMP is not returned.

### Storage Class Changes

The MySQL storage implements the transaction API. It batches up all the pending insertions and aggregates them so that any set of triple writes during the transaction sequence are all done at one point, with 4 INSERTs only.

Added a supporting functions `librdf_hash_interpret_template()` to interpolate variables into strings using a librdf_hash of key/values.

The MySQL storage now takes an optional storage option 'layout' that can choose between the v1 and v2 SQL schemas (only the table type has changed). The SQL fragments are described in Turtle files that are installed and read on startup.

### Configuration and Build Changes

Packagers note: two new files are installed into PREFIX/lib/redland for the MySQL schemas. Without them installed, the MySQL storage will not work.

Removed the `configure` script option `--enable-parsers` since Raptor is always required and always used inside Redland whether or not any parsers were configured.

Use `pkg-config` Libs.private in `redland.pc` for internal dynamically linked libraries.

`redland-config` gains an --private-libs option to hold private libraries moved from --libs which now only contains -L and a -lrdf.

Added a building utility `touch-mtime.pl` to handle `touch -r` which does not work on SunOS. Fixes Issue #0000159

### Other Changes

Added `librdf_world_open()` for every public API constructor or function that mentions librdf_world* and could have failed to run `librdf_world_open()` after `librdf_new_world()`. This makes `librdf_world_open()` entirely optional. Fixes Issue #0000173

`rdfproc` gains an --transactions / -T option for enabling transactions on the command line and an --results / -r option to set the query results formatter name.

Do not throw away the rasqal node type information now, it is needed later on in `FILTER` comparisons. Fixes Issue #0000153

Fix reference count problem in storages that caused connections to fail to free in MySQL. Fixes #0000150

Fix reference count / memory leak in file storage.

## Redland 1.0.5 Changes

The main changes in this release are:

Updated to use Rasqal 0.9.13 (Rasqal 0.9.13 release notes) from 0.9.12.

Updated to use Raptor 1.4.13 (Raptor 1.4.13 release notes) from 1.4.9.

Plus several API additions and many bug fixes.

### Configuration and Build Changes

`configure` now removes un-necessary tests for C++ or F77++ compilers that libtool stupidly insists on. Add lots of gcc `-W` flags when they are supported and in maintainer mode.

Made `configure --with-threads` work. Fixes Issue #0000125

### Model Class Changes

Methods `librdf_model_add`, `librdf_model_add_statement`, `librdf_model_add_typed_literal_statement`, `librdf_model_add_string_literal_statement` and `librdf_model_contains_statement` now enforce only allowing legal RDF triples.

Added `librdf_model_enumerate` to list all the model implementations - currently just one, a model over a storage.

### Node Class Changes

The node class can now encode and decode long literals with length >65535 using new encoding type 'N'.

Added new constructor `librdf_new_node_from_typed_counted_literal` to build a typed node with a counted literal string.

### Parser Class Changes

Changes to allow NULL base uris in parsing methods, but to fail if it is omitted but required. Applies to `librdf_parser_parse_as_stream`, `librdf_parser_parse_into_model`, `librdf_parser_parse_string_as_stream`, `librdf_parser_parse_string_into_model`, `librdf_parser_parse_counted_string_as_stream` and `librdf_parser_parse_counted_string_into_model`

Added `librdf_parser_get_accept_header` to get the `Accept` header that would be sent with a parser HTTP fetch of content.

### Query Class Changes

Graph names in SPARQL now connect up to redland context nodes to allow SPARQL `GRAPH` to work.

### Serializer Class Changes

Added new methods to serialize `librdf_stream`s of triples rather than just `librdf_model`: `librdf_serializer_serialize_stream_to_file_handle`, `librdf_serializer_serialize_stream_to_file`, `librdf_serializer_serialize_stream_to_string`, `librdf_serializer_serialize_stream_to_counted_string` and `librdf_serializer_serialize_stream_to_iostream`. Fixes Issue #0000092

### Storage Class Changes

Methods `librdf_storage_add_statement`, `librdf_storage_add_statements` and `librdf_storage_contains_statement` now enforce only allowing legal RDF triples.

The Memory storage now supports deleting while iterating or streaming the storage.

The PostgreSQL storage now accepts option 'database' like MySQL and other Redland relational databases in addition to the existing option it accepted, 'dbname'.

SQLite storage fixes:

Fix crash in `librdf_model_context_remove_statements` Fixes Issue #0000103

Wrap all `sqlite_FREE` calls on error messages so that they are only called with SQLITE API v2. Fixes Issue #0000105

Check for no language or no datatype when they are NULL in `librdf_storage_sqlite_literal_helper`. Fixes Issue #0000136

Store pending queries while the database is locked doing a `SELECT` and do them once the select is done. Such as deleting triples during a find or serialise. Fixes Issue #0000139

SQLite storage now has a 'synchronous' storage option which takes values 'off', 'normal' or 'full' allowing access to the sqlite pragma to control when commits are synchronised to file.

### Other changes

`rdfproc` now allows the base URI for parsing to be set to null with `-` and adjust messages to handle this.

Added some more const fixes to heuristics. Fixes Issue #0000107

Autodocs for `librdf_new_node_from_blank_identifier`. Fixes Issue #0000114

If `librdf_storage_sqlite_statement_operator_helper` fails, free the stringbuffer. Fixes Issue #0000116

Do not read from stream when parsing returns a NULL pointer. Fixes Issue #0000130

Fix debug call in `librdf_query_register_factory`, `librdf_storage_hashes_add_remove_statement` and `librdf_storage_hashes_contains_statement` Fixes Issue #0000132

Added rss2ical.c example to turn RSS/Atom 1.0 feeds into iCalendar using raptor, redland and SPARQL.

Many minor fixes and changes due to adding lots of -W flags and using gcc4.

### SWIG Bindings Interface

Fixed typo to declare `librdf_query_results_get_binding_value` to return a new object.

Export new function `librdf_parser_get_accept_header`

Export version strings and integer constants for raptor: (`raptor_version_string`, `raptor_version_major`, `raptor_version_minor`, `raptor_version_release`, `raptor_version_decimal`) and rasqal (`rasqal_version_string`, `rasqal_version_major`, `rasqal_version_minor`, `rasqal_version_release`, `rasqal_version_decimal`)

## Redland 1.0.4 Changes

The main changes in this release are:

Updated to use Rasqal 0.9.12 (Rasqal 0.9.12 release notes) to update to SPARQL 2006-04-06 for JSON results

Updated to use Raptor 1.4.9 (Raptor 1.4.9 release notes)

Plus fixing some crash bugs in parsing and serializing.

### Configuration and Build Changes

Now using Subversion for version control and the Redland installation instructions explain how to get Redland from Subversion.

Win32 fixes and VC build files updates from John Barstow.

Let configure find BDB 4.4

### Node Class Changes

`librdf_new_node_from_literal` and `librdf_new_node_from_typed_literal` now accept empty strings as an alternative to a NULL language pointer.

### Parser Class Changes

Add one more place where it needed handling old and new raptor statement predicate values `RAPTOR_IDENTIFIER_TYPE_RESOURCE` and `RAPTOR_IDENTIFIER_TYPE_PREDICATE`.

Fixed a bad uses of flose() causing a crash in parsing a file or from a `FILE*` file handle when run under newer `glibc`s.

### Serializer Class Changes

Fixed a bad uses of flose() causing a crash in serializing to a file when run under newer `glibc`s.

### Storage Class Changes

Introduced a `UINT64_T_FMT` to handle formatting a 64-bit `unsigned` `int` in storages as `%llu` is not portable.

## Redland 1.0.3 Changes

The main changes in this release are:

Updated to use Rasqal 0.9.11 (Rasqal 0.9.11 release notes) to update to SPARQL 2005-11-23

Updated to use Raptor 1.4.8 (Raptor 1.4.8 release notes)

A large source re-arrangement was performed for raptor and rasqal inside redland. All C sources and headers that build the libraries were moved to the src dir, general documentation in the doc dir and utilities in the utils dir for each sub-library.

Version Control change: Redland will be switching to use Subversion for version control after the 1.0.3 release. Please check the Redland Subversion site for the latest status or the online Redland installation notes for the redland specific subversion installation information.

A new PostgreSQL storage backend was added contributed by Shi Wenzhong based on the MySQL storage backend. Fixes issue #0000046

### Configuration Changes

The autogen.sh 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 redland as XML document which is turned into HTML along with GNOME devhelp support.

### Portability Changes

Some win32 build fixes were made.

### World Class Changes

`librdf_world_get_genid()` was changed to include the process ID in the generated blank ID. Fixes Issue #0000037 (patch from Marc Powell).

### Node Class changes

`librdf_node_encode()`: Give an error when a node cannot be encoded due to string data being too long.

### Serializer Class changes

Added `librdf_serializer_serialize_model_to_iostream()`, not exposed in the SWIG bindings.

### Storage Class Changes

Added a PostgreSQL storage backend contributed by Shi Wenzhong based on the MySQL storage backend. Fixes Issue #0000046

### Other Changes

Deprecated `librdf_files_temporary_file_name()`.

Deleted some function prototypes defined in headers but never had code: `librdf_node_init()`, `librdf_iterator_finished()`, `librdf_storage_get()` and `librdf_world_set_uris_hash()`

Added examples/example7.c to read from an RDF/XML file, add a triple and write it back.

## Redland 1.0.2 Changes

The changes in this release are:

- Fix a crash when querying or searching with the model find_statements method and getting no results
- Update to use Rasqal 0.9.10 (Rasqal 0.9.10 release notes) to provide query results sorting such as SPARQL `ORDER BY` and some SPARQL syntax updates.
- Update to use Raptor 1.4.7 (Raptor 1.4.7 release notes) to fix some crashes in the RSS tag soup parser and serializer.

## Redland 1.0.1 Changes

The main changes in this release are to update to use Rasqal 0.9.9 (Rasqal 0.9.9 release notes) to provide improved SPARQL query support for the revised syntax Raptor 1.4.6 (Raptor 1.4.6 release notes) to provide a new GRDDL parser as well as updated RSS enclosures support with the RSS tag soup parser and RSS 1.0 serializer.

The digest and hash classes now expose public API constructors, destructors and methods via their header files.

### Configuration changes

Added `--with-memory-signing` to check when memory is allocated / freed across Redland libraries.

### Portability Fixes

Added Win32 portability fixes and build configuration (John Barstow)

### Binding API changes

The following changes were made to the bindings API as exported by the SWIG interface file `Redland.i`:

The digest class was added: constructor `librdf_new_digest`, destructor `librdf_free_digest` and methods `librdf_digest_init`, `librdf_digest_update`, `librdf_digest_update_string`, `librdf_digest_final` and `librdf_digest_to_string`,.

The hash class was added as selected functions: constructors `librdf_new_hash_from_string` and `librdf_new_hash_from_array_of_strings` and destructor `librdf_free_hash`.

The query class methods `librdf_query_get_limit`, `librdf_query_set_limit`, `librdf_query_get_offset` and `librdf_query_set_offset` were added.

Functions were added for accessing parts of structured log messages as `librdf_log_message` objects: `librdf_log_message_code`, `librdf_log_message_level`, `librdf_log_message_facility`, `librdf_log_message_message`, `librdf_log_message_locator` and Raptor `raptor_locator` objects: `raptor_locator_line`, `raptor_locator_column`, `raptor_locator_byte`, `raptor_locator_file` and `raptor_locator_uri`.

### Digest Class changes

This class was added to the public API in this release adding constructor `librdf_new_digest`, destructor `librdf_free_digest` and methods `librdf_digest_init`, `librdf_digest_update`, `librdf_digest_update_string`, `librdf_digest_final`, `librdf_digest_get_digest`, `librdf_digest_get_digest_length`, `librdf_digest_to_string` and `librdf_digest_print`

### Hash Class changes

This class was added to the public API in this release adding constructors `librdf_new_hash_from_string`, `librdf_new_hash_from_array_of_strings` and `librdf_new_hash_from_hash`; destructor `librdf_free_hash`; and methods `librdf_hash_get`, `librdf_hash_get_as_boolean`, `librdf_hash_get_as_long`, `librdf_hash_get_del`, `librdf_hash_put_strings`, `librdf_hash_print`, `librdf_hash_print_keys` and `librdf_hash_print_values`.

### Iterator Class changes

Added a `librdf_new_empty_iterator` helper to make an always-empty iterator.

### Log Class changes

Added `LIBRDF_FROM_MEMORY` facility.

### Model Class changes

All methods returning an `librdf_iterator` or `librdf_stream` now return an empty iterator/stream rather than NULL when returning an empty result sequence. Errors are still returned as NULL.

### Node Class changes

Removed unused `LIBRDF_NODE_TYPE_RESERVED1` (#3) from `librdf_node_type` enum.

### Query Class changes

Update to use Rasqal 0.9.9 API. Redland 1.0.1 will not build with older Rasqal releases.

The query API gains methods `librdf_query_get_limit`, `librdf_query_set_limit`, `librdf_query_get_offset` and `librdf_query_set_offset` for setting and getting query result limit (max results) and offsets (result to start from).

Fixed some across-library memory allocation/frees between redland and rasqal that caused problems on win32. Requires rasqal 0.9.9 or newer.

### Stream Class changes

Added a `librdf_new_empty_strea` helper to make an always-empty strea.

### Storage Class changes

The MySQL store now uses a portable method across endiannesses to create a 64bit key. This fixes Issue #0000023 (Morten Frederiksen)

> NOTE: This matches the algorithm used for little-endian systems but big-endian stores will need to serialize the store before upgrading and reload afterwards.

The MySQL store now uses connection pooling to prevent making a new connection to the database for each request. Fixes Issue #0000027 (Morten Frederiksen)

The SQLite store now does not skip items with the factory methods for serializing, finding statements, serializing contexts and getting context statements. Fixes Issue #0000006

All store methods that return an `librdf_iterator` or `librdf_stream` now return an empty iterator/stream rather than NULL when returning an empty result sequence. Errors are still returned as NULL.

### Other changes

Added `REDLAND_INLINE` macro, which can be overridden if inline is not wanted.

## Redland 1.0.0 Changes

This is Redland 1.0.0.

The main changes in this release are to update to use Rasqal 0.9.6 to provide improved SPARQL query support for optionals, CONSTRUCT, ASK, builtins, Raptor 1.4.4 to provide better serializing to RDF/XML and RSS 1.0 and better RSS tag soup parsing and a new experimental SQLite storage supporting SQLite V2 and V3 libraries.

### Configuration changes

The storages compiled into redland can be individually selected with the `--enable-storages=`LIST configure option.

The default for `--with-dmalloc` is now no. Reason: valgrind.

### Portability Fixes

Removed configure altering the search PATH - which was a bad idea as it makes the configure environment different from the user's.

Added `/opt/local` to the BerkeleyDB / SleepycatDB search path to help darwinports.

To help Redland built as an OSX Framework with ObjectiveC, Redland public headers can be put in a different directory structure if `LIBRDF_OBJC_FRAMEWORK` is defined in the build environment. In this case the headers are found in a subdirectory `Redland`. This only applies to the public Redland header files that `#include` other public header files - `redland.h` including `librdf.h`, `librdf.h` including several `rdf_*.h` files and Rasqal's `rasqal.h` including `raptor.h`. (Patch from René Puls)

### `rdfproc` RDF processor utility program changes

Added a `size` command calling `librdf_model_size`.

### Model Class changes

Added `librdf_model_contains_context` to find a context node in a model.

The `librdf_model_sync` now returns a success or failure int.

### Parser Class Changes

Updated to Raptor 1.4.4 providing an updated RSS tag soup parser with fixes for RSS 0.9, RSS.1.1 and Atom.

The constructor now finds the correct parser when given NULL arguments for mime type or type URI.

### Query Class changes

Update to Rasqal 0.9.5 providing improved SPARQL support: new optionals handling, `CONSTRUCT` to make RDF graphs, formatting of query results in the SPARQL XML format along with many other improvements and fixes.

Added base_uri argument to `librdf_new_query`

Added `librdf_query_results_to_counted_string`, `librdf_query_results_to_string`, `librdf_query_results_to_file_handle` and `librdf_query_results_to_file` to get the results of a query written to a syntax using Rasqal's rasqal_query_results_write and Raptor's XML writer API.

Added boolean returning methods: `librdf_query_results_is_bindings`, `librdf_query_results_is_boolean`, `librdf_query_results_is_graph` for testing result formats and `librdf_query_results_get_boolean` to get a boolean result back.

### Serializer Class changes

Updated to Raptor 1.4.4 providing a new XML writer API, an improved RDF/XML serializer allowing user namespace declarations and relative URIs, a new RSS 1.0 serializer.

The serializers now respect any user-declared namespaces done with `librdf_serializer_set_namespace` by passing it on to the Raptor serializer with `raptor_serialize_set_namespace`. At present only the Raptor RDF/XML serializer uses these user-declared namespace hints.

The constructor now finds the correct serializer when given NULL arguments for mime type or type URI.

### Storage Class changes

The storages compiled into redland can be individually selected with the `--enable-storages=`LIST configure option.

SQLite Storage. A new experimental storage supporting SQLite V2 and V3 libraries.

MySQL storage. Return failure early if the connection failed rather than try to continue opening the storage.

MySQL storage. Only use `mysql_real_escape_string` if a connection was made. Do not try to free resources such as the mysql DB connection owned by iterators after an error, let `librdf_free_iterator` tidy up. (Patch from Morten Frederiksen)

### URI Class changes

Handle resolving against a base URI with an omitted path.

### Other changes

Removed `librdf_concept_labels` - never used or exported.

## Redland 0.9.19 Changes

This is Redland 1.0 Release Candidate 2.

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

The main changes in this release are to update to use Rasqal 0.9.5 to provide initial SPARQL query support and to use Raptor 1.4.2 to provide serializing to RDF/XML and N-Triples.

### `rdfproc` RDF processor utility program changes

Updated to allow an optional base URI for the `serialize` command and to handle the three forms of query results - bindings, graph or boolean.

### Model Class changes

Added `librdf_model_to_string` and `librdf_model_to_counted_string` to serialize a model to a string using the Serializer class functionality. Exported `librdf_model_to_string` to the language bindings.

### Query Class changes

Now requires Rasqal 0.9.5 which provides initial support for the SPARQL Query Language for RDF, W3C Working Draft, 12 October 2004 from the W3C RDF Data Access Working Group (DAWG).

### Serializer Class changes

Pass on errors and warnings via the existing Redland logging mechanism. Previously they all went to stderr, the default.

Switched to use Raptor 1.4 series serializing classes so now provides RDF/XML and N-Triples serializing and will gain any fugure serializing formats as Raptor adds them.

Using the Raptor support, the serializers can now serialize to strings in addition to the existing serializing to FILE* and files. This is performed by the new methods: `librdf_serializer_serialize_model_to_file_handle` (deprecating `librdf_serializer_serialize_model`), `librdf_serializer_serialize_model_to_string` and `librdf_serializer_serialize_model_to_counted_string`. Exported `librdf_serializer_serialize_model_to_string` to the language bindings.

### Storage Class changes

`librdf_storage_context_add_statement` and `librdf_storage_context_add_statements` - With a NULL context, call the non-context method as documented.

Fixed bogus '+' in `get_contexts` method in the mysql storage.

### World Class changes

`librdf_world_get_feature` now returns a `librdf_node*`, `librdf_world_set_feature` takes a `librdf_node*` value. Export these to the language bindings.

## Redland 0.9.18 Changes

Revert the statement class usage counting - it broke things.

## Redland 0.9.17 Changes

This is Redland 1.0 Release Candidate 1.

The main changes in this release are the addition of the Query and Query Results classes, and the removal of the language bindings into the new Redland Bindings package.

The interface between the Redland library and Redland Bindings when done via swig is by the swig interface file `Redland.i` which is now installed in `/usr/share/redland/Redland.i`.

### Portability changes

Several patches for building Redland natively on Win32 were provided by Jose Kahan. These included adding an `win32_rdf_config.h` hard-coded config for Win32, using that in the all the C source files and adding an `REDLAND_STATIC` define to help statically linking Win32 builds of Redland.

### Configuration changes

Redland 0.9.17 requires Raptor 1.3.2 and Rasqal 0.9.1. Installed versions are used if available by default, otherwise the copies in the source tree will be used. The `--with-raptor=` and `--with-rasqal=` configure options with values `internal` or `system` can be used to select when both are available.

Removed all the language binding-specific configuration code including options such as `--with-perl` that are now used by Redland Bindings.

### Packaging changes

Updated the RPM spec file to remove building of the redland-perl and redland-python RPMs which are now made in the redland-bindings package.

Added `-lrdf` to the pkgconfig redland.pc file (Curtis Hovey)

Redland requires automake 1.7 and autoconf 2.54 to build from CVS.

### Query and Query Result Classes

The Query (`librdf_query`) and Query Results (`librdf_query_results`) classes are new in Redland 0.9.17. They provide RDF query support with RDQL using Rasqal 0.9.1, which is now included in the Redland distribution.

The Query class has the following functions and methods:

- `librdf_new_query` (constructor)
- `librdf_new_query_from_query` (constructor)
- `librdf_new_query_from_factory` (factory constructor)
- `librdf_free_query` (destructor)
- `librdf_query_execute`

The Query Results class has the following methods:

- `librdf_query_results_as_stream`
- `librdf_query_results_get_count`
- `librdf_query_results_next`
- `librdf_query_results_finished`
- `librdf_query_results_get_bindings`
- `librdf_query_results_get_binding_value`
- `librdf_query_results_get_binding_name`
- `librdf_query_results_get_binding_value_by_name`
- `librdf_query_results_get_bindings_count`
- `librdf_free_query_results` (destructor)

A new example example5.c was created to demonstrate using the query classes.

### New Logging API

An enhanced logging API was added to provide enhanced information from log messages, error and warnings such as from parsing. The new world method `librdf_world_set_logger` allows setting of the log handler callback which gives a `librdf_log_message`. Parts of this the structure can be read by using the following new accessors methods:

- `librdf_log_message_code`
- `librdf_log_message_level`
- `librdf_log_message_facility`
- `librdf_log_message_message`
- `librdf_log_message_locator`

The locator returns an `raptor_locator` that gives the line, column, byte offset, URI and/or filename of the message. Raptor 1.3.2+ provides accessor methods for that structure that are described in libraptor.3.

### Model Class changes

Check that duplicate statements are not added to models with the `librdf_model_add_statement` and `librdf_model_add_statements` methods. The methods for adding statements with a context do not check.

Added `librdf_model_query_execute` method to execute a `librdf_query` against a model, returning an `librdf_query_results`

Added `librdf_model_load` method that uses Raptor parser guessing to load content from a URI into a model.

The contexts methods now give a run time warning if called when the model does not support contexts or the are not enabled. The methods affected are:

- `librdf_model_context_add_statement`
- `librdf_model_context_add_statements`
- `librdf_model_context_as_stream`
- `librdf_model_context_remove_statement`
- `librdf_model_context_remove_statements`
- `librdf_model_context_serialize`
- `librdf_model_find_statements_in_context`
- `librdf_model_get_contexts`

Fixed a memory leak inside `librdf_model_find_statements_in_context`.

### Node Class changes

Fix assert bug in `librdf_node_get_blank_identifier` that caused it to always fail.

A bug was fixed in `librdf_node_get_li_ordinal` to not always fail, returning -1

### Parser Class changes

Deprecated methods `librdf_parser_set_error` and `librdf_parser_set_warning` which never worked. The new logging API works correctly with this code.

### Storage Class changes

Where possible, check that duplicate statements are not added to stores with the `librdf_storage_add_statement` and `librdf_storage_add_statements` methods. The methods for adding statements with a context do not check.

The "mysql" storage was updated by Morten Frederiksen to revise the schema and to add two new features, controlled by new boolean storage options:

1. `bulk`: whether model/storage method add_statements should be optimized, until a model/storage sync operation
2. `merge`: whether to maintain a table with merged models

Context methods will now give a run time warning if called and contexts are not supported or enabled. The methods affected are:

- `librdf_storage_context_add_statement`
- `librdf_storage_context_remove_statement`
- `librdf_storage_context_serialise`
- `librdf_storage_get_contexts`

Fixed a memory leak inside `librdf_storage_find_statements_in_context`.

A bug was fixed in method `librdf_storage_node_stream_to_node_create` to allow the second node parameter to be NULL, so that methods `librdf_storage_get_arcs_out` and `librdf_storage_get_arcs_in` that can use it to work.

## Redland 0.9.16 Changes

A small but important fix to make the installed C headers work correctly again. The rdf_uri.h file had `#include rdf_digest.h` which is an internal header and not installed. This required removing two functions from the public API that returned `librdf_digest*`, but neither of them could be used since rdf_digest.h was not shipped.

Patched librdf.h and raptor.h to `#include stdio.h` so that the empty program `#include <redland.h>` `main() {}` now works (ditto for raptor).

## Redland 0.9.15 Changes

This version of Redland updates to use Raptor 1.2.0 (raptor news) along with the new syntax Turtle Terse RDF Triple Language.

Three new storage modules were added:

1. MySQL store written by Morten Frederiksen supporting the entire storage API include full contexts support.
2. AKT Triplestore using MySQL inside 3store
3. File and URI-backed in-memory store - read/write file, read only URI.

The details of these modules are explained in much greater detail in the storage modules overview including the features that they support.

The runtime is now compiled with assertions to check for illegal use of NULL pointers in arguments, these will give warning messages (which can be disabled with `--disable-assert-messages`). The storage and model classes now track when open iterator and streams are operating on them and will not release resources until all the open iterators and streams are finished.

### URI and Literal string type changes

There are many changes are to properly use and return UTF-8 strings as `unsigned char*` for URIs (looking forward to Internationalized Resource Identifiers, IRIs emerging) and for RDF literal strings, plus other fixes to work better with C++ correcting the use of `const`. Redland and Raptor now both compile cleanly with g++ 3.2, 3.3 and all warnings enabled.

### `rdfproc` RDF processor utility program changes

rdfproc was extensively updated and it can now more easily work with any type of Redland store and has better support for working with contexts. The detailed changes are as follows:

- Added an -s TYPE option to specify a storage type
- Added an -t option for giving storage options
- Added an -p option to read the value of storage option `password` from standard input, to prevent exposing it as a parameter.
- The default of creating a new store was replaced; -n enables truncation or overwriting (the `write=yes` storage option).
- Now recognises `_:`abc as blank node arguments.
- Parsing now return counts of errors and warnings if possible.
- The parse-stream command can take an optional context node
- Added a contexts command, to list the contexts in a model.
- Added support for environment variables RDFPROC_STORAGE_OPTIONS and RDFPROC_STORAGE_TYPE to provide default storage options (-t) and type (-s)
- Help message updated and correctly lists supported parsers

### Configuration changes

Redland 0.9.15 requires Raptor 1.2.0 either installed otherwise the copy in the source tree will be installed.

`--with-mysql=`CONFIG added to point to the mysql_config program for the MySQL backing store

`--with-threestore` added to enable the AKT Triplestore

`--disable-assert` added to disable compiling run-time assertions.

`--disable-assert-messages` added to disable compiling run-time assertion messages.

### Packaging changes

A redland-python RPM package is now provided and the default RPM packaging now provides the MySQL store, in addition to the in-memory and BDB previously packaged. The new file and uri stores are also available. The full list of store modules is described further in the storage modules overview.

### Model Class changes

Methods `librdf_model_add_string_literal_statement` and `librdf_model_add_typed_literal_statement` now take a `const unsigned char* string`. Method `librdf_model_query_string` now takes a `const unsigned char* string` query.

New methods were added `librdf_model_find_statements_in_context` to search for a statement matching only in a particular context, `librdf_model_find_statements_with_options` to allow options with searching (none used at present), and `librdf_model_get_contexts` to list the context nodes in a graph.

Methods `librdf_model_get_feature`, `librdf_model_set_feature` were modified to take and return `librdf_node*` values.

### Node Class changes

Constructors `librdf_new_node_from_uri_string`, `librdf_new_node_from_uri_local_name` and `librdf_new_node_from_normalised_uri_string` now take a `const unsigned char* string` URI string. Constructors `librdf_new_node_from_literal` and `librdf_new_node_from_typed_literal` now take a `const unsigned char* string` RDF literal. Constructor `librdf_new_node_from_blank_identifier` now takes a `const unsigned char* string` blank node identifier.

Methods `librdf_node_get_literal_value`, `librdf_node_get_literal_value_as_counted_string` and `librdf_node_get_blank_identifier` now return a `const unsigned char* string` RDF literal, blank node identifier

(Debugging methods `librdf_node_to_string` and `librdf_node_to_counted_string`where changed to return a `const unsigned char* string`)

### Parser Class changes

Added methods `librdf_parser_parse_counted_string_as_stream` and `librdf_parser_parse_counted_string_into_model` for parsing a string with a given length rather than a C NUL-terminated string.

Methods `librdf_parser_parse_string_as_stream` and `librdf_parser_parse_string_into_model` now take a `const unsigned char* string` syntax buffer.

Methods `librdf_parser_get_feature` and `librdf_parser_set_feature` were modified to take and return `librdf_node*` values.

### Query Class changes

Constructor `librdf_new_query` now takes a `const unsigned char* string` query.

### Serializer Class changes

Added methods `librdf_serializer_get_feature` and `librdf_serializer_set_feature` taking and returning `librdf_node*` values like the methods for the model and parser classes.

### Statement Class changes

The statement objects are now usage counted like most other objects so they are cheap to copy. No user-API level changes are needed.

(Debugging method `librdf_statement_to_string` now returns a `const unsigned char* string`)

### URI Class changes

Constructors `librdf_new_uri`, `librdf_new_uri_from_uri_local_name`, `librdf_new_uri_normalised_to_base` and `librdf_new_uri_relative_to_base`. now take a `const unsigned char* string` URI string.

Methods `librdf_uri_as_string`, `librdf_uri_as_counted_string`, `librdf_uri_to_string` and `librdf_uri_to_counted_string` now return a `const unsigned char* string` URI string.

### Java API Changes

Updated to match API changes above. Fixes for OSX 10.3

### Perl API changes

Updated to match API changes above. Fixes for perl 5.8.1 and later which changed how `MakeMaker` installed. Let perl install the files rather than try to force it based on the prefix argument to configure. Make Parser method parse_string_into_model call the correct Redland function. Added OSX Java directories to JDK search path.

### PHP API Changes

Updated to match API changes above. Redland is now started up and shutdown once in the PHP module code and does not need to called directly.

### Python API changes

Updated to match API changes above. Fix Node literal_values to work with datatype URIs. Export the NS class. Added a FileStorage class for the storage type `file`. Removed use of the python Distutils which was often getting the linking wrong.

### Ruby API changes

Updated to match API changes above.

### Tcl API changes

Updated to match API changes above.

### Other changes

Redland now ships with both portable MD5 as well as (new in 0.9.15) SHA1 digest implementations used if neither is available via an optimised library.

## Redland 0.9.14 Changes

This version of Redland is an update mostly to synchronise with the Raptor version 1.0.0 (RDF/XML and N-Triples parser) - see Raptor NEWS for the changes since 0.9.12.

New in this version is the rdfproc utility which allows command line creation of redland stores, parsing of syntaxes and manipulation of the model.

### Configuration changes

Added `--with-raptor` to either choose the system or internal raptor library. If omittted, redland will guess and choose either the system one, if new enough or the internal one (always present).

### Hash Class changes

Added a `librdf_hash_put_strings` helper method to put a pair of string values into a hash. Useful for making model or storage options.

### Node Class changes

Resource (URI) / literal / blank nodes are now interned on construction so there is only one object for each distinct `librdf_node` object. This reduces memory and makes copying cheaper at the cost of an increase in construction cost. Copying nodes is very common, since not only is it done for nodes but any time a statement is used or returned. This interning was already done for the URI class but the change required `librdf_node` to be made immutable, which was done in 0.9.13.

### Storage Class changes

Added `librdf_storage_context_as_stream` deprecating `librdf_storage_context_serialise` to be consistent with the *as_stream method name changes to model.

Added `librdf_new_storage_with_options` taking an `librdf_hash*` of options rather than the string of `librdf_new_storage`.

Added new optional storage factory methods context_add_statements and context_remove_statements. If omitted, the storage class implements them with context_add_statement and context_remove_statement.

### Stream and Iterator Classes changes

Optimised the stream and iterator internals to do less factory method calls when looking for new items or the end of stream/iterator. This should make them slightly faster.

### Miscellaneous changes

Renamed Redland statics to be `librdf_*` rather than `redland_*`. Added a one-line librdf_short_copyright_string.

### Perl API Changes

Fixed the broken use of `UNIVERSAL::isa`

## Redland 0.9.13 Changes

This version of Redland is a major update to 0.9.12 changing the node class. `librdf_node` objects are now immutable once created, higher-level language APIs no longer have deal with sharing or copying internals, some additional API support for parsing content from strings.

This includes the stable and complete version 0.9.12 of the Raptor parser which supports all of the revised RDF/XML syntax.

Initial work was added on an ECMA CLI interface using the C# ("C sharp") language.

Blank nodes generated by parsing the syntaxes are now generated more unique (not guaranteed) based on the Redland startup time and a serial number.

The Perl, Python and Java APIs now always return new nodes and statements removing the need to consider sharing at this level. This means that the following operation is legal in Perl, Python and Java:

    # perl
    $n=RDF::Redland::Node->from_uri("http://example.org/foo");
    $s=new RDF::Redland::Statement($n, $n, $n);
    $model->add($s);

    # python
    n=RDF.Uri("http://example.org/foo")
    s=RDF.Statement(n, n, n) # n is used as a resource RDF.Node here
    model.add_statement(s)

### Configuration

Several improvements were made to the building and configuring including a better attempt to find matching Sleepycat/Berkeley DB header and library files (and support BDB up to 4.1), searching for installed Java JDKs and Tcl headers. Each of the language interfaces can be individually enabled to be build, tested and installed with the main C library.

### Node Class changes

The `librdf_node` class was modifed to make objects immutable once constructed, they cannot be modified. The following set methods were consequently removed.

- `librdf_node_set_blank_identifier`
- `librdf_node_set_li_ordinal`
- `librdf_node_set_literal_value`
- `librdf_node_set_type`
- `librdf_node_set_typed_literal_value`
- `librdf_node_set_uri`

The following utility methods were added (covering all the `librdf_node_get_type` values):

- `librdf_node_is_blank` - return non-0 if the node is a blank node
- `librdf_node_is_literal` - return non-0 if the node is a literal
- `librdf_node_is_resource` - return non-0 if the node is a URI

(These are reflected into the same methods on the Perl, Python and Java node classes)

`LIBRDF_NODE_TYPE_LI` as returned by `librdf_node_get_type` was deleted, it was never used.

To support datatyped literals, the following method was added:

- librdf_node_get_literal_value_datatype_uri - get the typed literal datatype URI of the literal node

### Model Class changes

Added `ibrdf_model_sync` to sync the model to the backing store.

Added `librdf_model_as_stream` and `librdf_model_context_as_stream` to replace `librdf_model_context_serialise` and `librdf_model_context_serialize` respectively. This was done both to reduce the confusion with the `librdf_serializer` class and the mixture of US/UK spelling of that word. The old functions will remain for now.

### Parser Class changes

Added `librdf_parser_parse_string_as_stream` and `librdf_parser_parse_string_into_model` to allow parsing content from strings.

### Statement Class changes

Added `librdf_statement_is_complete` to test if a statement has all the subject, predicate and object fields assigned. Partial statements cannot be added to a model but can be used in matching statement queries with `librdf_model_find_statements`.

### Storage Class changes

Added `librdf_storage_sync` to sync the backing store. (This is slightly internal to Redland, you should not be calling this directly)

### Perl Interface Changes

Updated to make the object constructors less verbose and to allow Redland URI objects and native perl URIs to be used in place of Redland Nodes where convienent (such as in making Statements). All existing code should work but can be shortened. A new `--with-perl` configure argument to enable the perl interface.

### Python API changes

A major update to use Python 2.2+ idioms and features by Edd Dumbill with help from Matt Biddulph for unit tests. A new `--with-python` configure argument to enable the python interface. Edd wrote the following change log.

General changes

- Removed string exceptions and replaced with RedlandError ones
- Where underlying Redland C objects were unexpectedly null, raise exceptions rather than returning None, "" or [] as appropriate.
- Raise exceptions if Redland C constructors fail in Python constructors.
- Did quite a lot of documentation updating, where possible demonstrating preferred Pythonic usages.
- Added more unit tests to test changed functionality.

#### RDF.Node class

- Constructor now accepts Uri to make a resource/property node, or a string to make a string literal
- Removed usage of node_type() in favour of is_resource(), is_blank() etc methods.
- DEPRECATED get_blank_identifier() etc. methods in favour of node.blank_identifier etc properties. Raise exception if properties inconsistent with the node type are requested.

#### RDF.Statement class

- No need to name subject, predicate, object in constructor any more. Uris or string literals accepted in place of nodes in constructor argument.
- __getattr__ method deleted, using new-style property() for subject, predicate, object

#### RDF.Model class

- Deleted get_*_iterator methods
- Renamed sources() to get_sources(), targets() to get_targets(), arcs() to get_predicates(). Retained old method names as aliases.
- Added get_sources_context(), get_targets_context(), get_predicates_context() which return (node, context) tuples.
- Amended get_source(), get_sources() etc methods so that Uri and string literals were acceptable as shortcut types for nodes.
- Added find_statements_context() which returns (statement, context) tuples.
- Renamed context_remove_statements() to remove_statements_with_context(). Retained old method name as an alias.
- Added __delitem__ method so del[statement] and del[statement, context] work.
- Added append() method so append(statement) and append(statement, context) work. Suggest that append() is used in preference to add_statement() for Python idiomatic usage.
- DEPRECATED serialise() in favour of as_stream().
- Added as_stream_context() to serialise (statement, context) tuples.
- Exception raised if len() is attempted on model with a non-countable storage.
- DEPRECATED Model.add(), Model.add_typed_literal_statement() usages: now that constructing Statements is easier, it's incongruous to have these in the model. Additionally it saves reproducing various bits of error checking that properly belong in the Node() constructor.
- Implemented __contains__() so "if statement in model" and "if (statement, context) in model" work as expected using the more efficient Redland C methods where possible.

#### RDF.Stream class

- DEPRECATED Stream.context_iter(). Use in preference the _context variants of the appropriate Model methods. This leads to fewer lines of code.

#### RDF.Uri class

- Amended constructor so strings or Uri instances can be passed as the first argument, without named parameters being required, and the right thing still happen.

### Java Interface Changes

Additions for the new API calls as outlined above (such as model/storage sync, parsing from strings etc.). New configure argument `--with-jdk` to pick the JDK in order to find the JNI headers. See the java API page for details.

### PHP, Ruby and Tcl Interfaces Changes

Updates in configuring and building these interfaces and new `--with-php`, `--with-ruby` and `--with-tcl` configure arguments. See the corresponding API pages and installation documentation for details. Tcl now tries to guess the includes directories.

### Internal changes and fixes

- Added Sleepycat/BDB 4.0 and 4.1 support - the open API changed again
- Split the `librdf_model` class into model interface (`librdf_model`) and implementation class (`librdf_model_storage`).
- Removed the old and outdated repat RDF parser.
- Removed the very old expat XML parser from the sources; much newer or expat or libxml2 are very widespread.
- Added simple thread support from patches by Seth Ladd with configuration option `--with-threads` that locks key shared classes to allow separate threads to work in the same memory space. The current locked classes are URI and World.
- Deleting statements in the in-memory store now works.
- Getting the context of iterators returned from in-memory sources, targets, arcs now works.

## Redland 0.9.12 Changes

This version of Redland is a major update to 0.9.11 incorporating a much more improved, complete and stable version 0.9.7 of the Raptor parser and a significant new feature, contexts. The high-level language APIs received some updates and the start of two new languages APIs were added: Ruby and PHP.

Several incompatible API changes were made in this release that effect the C interface and all the higher level language APIs. These were made to support contexts and to fix some inconsistencies in the interface about object ownership.

The persistent storage format was changed to support RDF typed literals and this requires an upgrade of any existing Berkeley/Sleepycat DB stores created by Redland 0.9.11 or earlier. A utility redland-db-upgrade is provided that will create an updated store from an existing one.

A Perl script utils/update-api-0912.pl can help automate the API changes as far as possible or warn about those that cannot be automatically updated.

### New Feature - Contexts

This feature allows a Node to be given whenever a statement is added to a model which can can be retrieved from any model query that returns answers as an Iterator of Nodes or a Stream of Statements. Both of these classes gained a new method `get_context` that returns the original Node that was given when the statement corresponding to the answer was added to the model.

The context node can also be used to add and remove sets of statements to/from a model, and each statement with a given context node can be listed as a stream of statements.

Adding this feature required substantial internal changes to these two classes and the internal storage apis and implementations along with moderate code changes at the application level, which are described below.

This feature can be used for the following (not an exhaustive list):

- Enable true graph merging / updating / demerging - identify the subgraphs with context nodes.
- Statement Identity - add each statement with a different context node
- Statement Provenance - use the context node as the subject of other statements about the statement that is returned.

### Iterator Class Changes

The Iterator `get_next` method was split into `get_object` always returning a pointer to a shared object and the `next` method to advance the iterator. The `get_object` method is generally called `current` in the higher level language APIs.

(Iterator and Stream now have consistent method names; they may be merged in future.)

The `get_object` method now always returns a pointer to a shared object. If this object is needed outside the scope of an iteration, it must be copied, which for Nodes is the copy constructor `librdf_new_node_from_node`.

C example for Redland 0.9.11 and earlier:

      while(!librdf_iterator_end(iterator)) {
        node=(librdf_node*)librdf_iterator_get_next(iterator);
        /* do something with the node */
      }

Redland 0.9.12:

      while(!librdf_iterator_end(iterator)) {
        node=(librdf_node*)librdf_iterator_get_object(iterator);
        /* do something with the node */
        librdf_iterator_next(iterator);
      }

A new method `get_context` was added returning a Node for the context of the original Statement that generated the Iterator Node.

C Iterator context example:

      while(!librdf_iterator_end(iterator)) {
        node=(librdf_node*)librdf_iterator_get_object(iterator);
        context_node=(librdf_node*)librdf_iterator_get_context(iterator);
        /* do something with the node and its context */
        librdf_iterator_next(iterator);
      }

### Model Class Changes

The Model `add_statement` method no longer takes ownership of the passed in statement object. The caller now retains ownership and can reuse the statement several times and has responsibility for freeing it if need be (when it isn't shared).

C example for Redland 0.9.11 and earlier:

      librdf_model_add_statement(model, statement);

Redland 0.9.12:

      librdf_model_add_statement(model, statement);
      librdf_free_statement(statement);

C streaming statement example for Redland 0.9.11 and earlier:

      while(!librdf_stream_end(stream)) {
        librdf_statement *statement=librdf_stream_next(stream);
        /* This statement is new, so could be added directly */
        librdf_model_add_statement(model, statement);
      }

Redland 0.9.12:

      while(!librdf_stream_end(stream)) {
        librdf_statement *statement=librdf_stream_get_object(stream);
        /* This statement is now shared so can still be just added */
        librdf_model_add_statement(model, statement);
      }

`librdf_model_add_string_literal_statement` lost the xml_space argument.

A new method was added to add a Statement with an RDF datatyped literals object:

      int librdf_model_add_typed_literal_statement(librdf_model* model,
         librdf_node* subject,
         librdf_node* predicate,
         char* string, char *xml_language, librdf_uri *datatype_uri);

This should be used in preference to `librdf_model_add_string_literal_statement` which remains in the API as a wrapper around the above.

New methods were added to add, remove and list Statements to contexts.

      /* Add a single statement to the model with context */
      int librdf_model_context_add_statement(librdf_model* model,
        librdf_node* context, librdf_statement* statement);

      /* Add all statements on the stream to the model with context */
      int librdf_model_context_add_statements(librdf_model* model,
        librdf_node* context, librdf_stream* stream);

      /* Remove a single statement from the model with the given context */
      int librdf_model_context_remove_statement(librdf_model* model,
        librdf_node* context, librdf_statement* statement);

      /* Remove all statements from the model with given context */
      int librdf_model_context_remove_statements(librdf_model* model,
        librdf_node* context);

      /* List all statements in the model with the given context */
      librdf_stream* librdf_model_context_serialize(librdf_model* model,
        librdf_node* context);

### Node Class Changes

The Node class gained a new constructor:

      librdf_node* librdf_new_node_from_typed_literal(
        librdf_world *world,
        const char *string,
        const char *xml_language,
        librdf_uri* datatype_uri);

that should be used in preference to `librdf_new_node_from_literal` which remains in the API as a wrapper around the above.

`librdf_node_new_nodefrom_literal` lost the xml_space argument.

### Parser Class Changes

The Parser class has an updated Raptor parser version 0.9.7 - parsers named `raptor` for RDF/XML (MIME Type `application/rdf+xml`) and `ntriples` for N-Triples. See the Raptor NEWS for the detailed changes since 0.9.5 in the last release of Redland.

The Java SiRPAC parsers `sirpac-stanford`, `sirpac-w3c` and the W3C LibWWW parser `libwww` have been removed. Raptor replaces them.

### Serializer Class Changes

The Serializer class gained a new method:

      int librdf_serializer_serialize_model_to_file(
        librdf_serializer* serializer,
        const char *name,
        librdf_uri* base_uri,
        librdf_model* model);

This writes the serialized model to a filename (rather than a file handle as done by `librdf_serializer_serialize_model`) which is easier to use from higher level language APIs until a cross-language I/O abstraction is available.

The class gained an RDF/XML serializer that can be called either by the name `rdfxml` or the MIME Type `application/rdf+xml`. The examples in each language have been updated to demonstrate using this.

### Storage Class Changes

The built in storage factories (`memory`, `hashes`) now both support contexts. These are enabled by adding the storage option `contexts='yes'` to the options string. The hashes storage additionally supports indexing predicates as an extra hash which can be enabled with `index-predicates='yes'`. This makes triple queries of the form (subject unknown, predicate known, object unknown) fast.

C Example of creating a 0.9.12 storage that does contexts using on-disk Berkeley/Sleepycat DB:

       storage=librdf_new_storage(world,
         "hashes",
          name,
         "hash-type='bdb',write='yes',new='yes',contexts='yes'");

### Stream Class Changes

The Stream `next` method was split into `get_object` always returning a pointer to a shared Statement and the `next` method to advance the iterator. The `get_object` method is generally called `current` in the higher level language APIs.

(Iterator and Stream now have consistent method names; they may be merged in future.)

C example for Redland 0.9.11 and earlier:

      while(!librdf_stream_end(stream)) {
        statement=(librdf_statement*)librdf_stream_next(stream);
        /* do something with the statement */
      }

Redland 0.9.12:

      while(!librdf_stream_end(stream)) {
        statement=(librdf_statement*)librdf_stream_get_object(stream);
        /* do something with the statement */
        librdf_stream_next(stream);
      }

A new method `get_context` was added returning a Node for the context of the Statement.

C Stream context example:

      while(!librdf_stream_end(stream)) {
        statement=(librdf_statement*)librdf_stream_get_object(stream);
        context_node=(librdf_node*)librdf_stream_get_context(iterator);
        /* do something with the statement and its context node */
        librdf_stream_next(stream);
      }

### Perl Interface Changes

The Perl interface moved to the `RDF::Redland` package (the `RDF` namespace was deprecated in 0.9.11).

The interface was updated to receive Redland error and warning messages callbacks. These can be set using the `RDF::Redland::set_error_handler` and `RDF::Redland::set_warning_handler` subroutines taking a subroutine argument. They are called with a single scalar argument which is the Redland message.

The interface was updated to match the Interator and Stream changes described above.

Perl iterator example for Redland 0.9.11 and earlier:

      while(!$iterator->end) {
        my $node=$iterator->next;
        # do something with the node
      }

Redland 0.9.12:

      while(!$iterator->end) {
        my $node=$iterator->current;
        # do something with the node
        $iterator->next;
      }

Perl stream example for Redland 0.9.11 and earlier:

      while(!$stream->end) {
        my $statement=$stream->next;
        # do something with the statement
      }

Redland 0.9.12:

      while(!$stream->end) {
        my $statement=$stream->current;
        # do something with the statement
        $stream->next;
      }

Perl example of using the Serializer class:

      # Use any rdf/xml parser that is available
      my $serializer=new RDF::Redland::Serializer("rdfxml");
      $serializer->serialize_model_to_file("output.rdf", $uri, $model);

### Python API Changes

The Python interface gained pydoc comments, along with an HTML derived version.

The interface was updated to receive Redland error and warning messages callbacks as python exceptions. These can be caught using the standard python try {} catch {} blocks.

The interface was updated to match the Interator and Stream changes described above.

Python iterator example for Redland 0.9.11 and earlier:

      while not iterator.end():
        node=iterator.next()
        # do something with the node

Redland 0.9.12:

      while not iterator.end():
        node=iterator.current()
        # do something with the node
        iterator.next()

Python stream example for Redland 0.9.11 and earlier:

      while not stream.end():
        statement=stream.next()
        # do something with the statement

Redland 0.9.12:

      while not stream.end():
        statement=stream.current()
        # do something with the statement
        stream.next()

Python example of using the Serializer class:

      # Use any rdf/xml parser that is available
      serializer=RDF.Serializer()
      serializer.serialize_model_to_file("output.rdf", model)

### Java Interface Changes

The Java classes were updated to have a `finished()` method that the user can call to cleanup objects replacing the rather useless Java `finalize()` method that gives no guarantees to when it is called.

The Java API is still experimental and may change further.

## Redland 0.9.1 - Redland 0.9.11 Changes

Release notes for 0.9.11 and earlier are in the NEWS page or ChangeLog

Copyright (C) 2000-2013 Dave Beckett
Copyright (C) 2000-2005 University of Bristol