# Redland RDF Application Framework - Release Notes

## 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/share/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-2008 Dave Beckett
Copyright (C) 2000-2005 University of Bristol