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
.
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.
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.
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.
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.
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.
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
.
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
Deprecated methods librdf_parser_set_error
and
librdf_parser_set_warning
which never worked. The
new logging API works correctly with this code.
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:
bulk
: whether model/storage method add_statements
should be optimized, until a model/storage sync operationmerge
: whether to maintain a table with merged modelsContext 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.
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).
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:
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.
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 changesrdfproc 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:
password
from standard input, to prevent
exposing it as a parameter.write=yes
storage option)._:
abc as blank node arguments.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.
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.
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.
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
)
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.
Constructor librdf_new_query
now takes a const
unsigned char* string
query.
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.
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
)
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.
Updated to match API changes above. Fixes for OSX 10.3
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.
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.
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.
Updated to match API changes above.
Updated to match API changes above.
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.
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.
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).
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.
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.
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.
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.
Renamed Redland statics to be librdf_*
rather than
redland_*
. Added a one-line
librdf_short_copyright_string.
Fixed the broken use of UNIVERSAL::isa
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)
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.
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 nodelibrdf_node_is_literal
- return non-0 if the node is a literallibrdf_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:
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.
Added librdf_parser_parse_string_as_stream
and
librdf_parser_parse_string_into_model
to allow parsing
content from strings.
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
.
Added librdf_storage_sync
to sync the backing store.
(This is slightly internal to Redland, you should not be calling this
directly)
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.
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
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.
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.
librdf_model
class into model interface
(librdf_model
) and implementation class
(librdf_model_storage
).--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.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.
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):
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); }
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);
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.
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.
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.
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'");
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); }
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);
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)
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.
Release notes for 0.9.11 and earlier are in the NEWS page or ChangeLog
Copyright 2003-2004 Dave Beckett, Institute for Learning and Research Technology, University of Bristol