You are viewing a plain text version of this content. The canonical link for it is here.
Posted to triplesoup-commits@incubator.apache.org by le...@apache.org on 2007/04/13 15:19:52 UTC

svn commit: r528519 [10/12] - in /incubator/triplesoup/donations/TRIPLES-2-libb: ./ docs/ docs/html/ docs/tmpl/ docs/xml/ redland-integration/ redland/ src/ test/ tests/ utils/

Added: incubator/triplesoup/donations/TRIPLES-2-libb/missing
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/missing?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/missing (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/missing Fri Apr 13 08:19:45 2007
@@ -0,0 +1,198 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+# Franc,ois Pinard <pi...@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.in; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing - GNU libit 0.0"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`$configure_ac'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`$configure_ac'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`$configure_ac'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0

Propchange: incubator/triplesoup/donations/TRIPLES-2-libb/missing
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-2-libb/mkinstalldirs
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/mkinstalldirs?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/mkinstalldirs (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/mkinstalldirs Fri Apr 13 08:19:45 2007
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <fr...@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here

Propchange: incubator/triplesoup/donations/TRIPLES-2-libb/mkinstalldirs
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.am?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.am (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.am Fri Apr 13 08:19:45 2007
@@ -0,0 +1,3 @@
+EXTRA_DIST = \
+	patch_1.0.5 \
+	rdf_storage_b.c

Added: incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.in?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.in (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/redland/Makefile.in Fri Apr 13 08:19:45 2007
@@ -0,0 +1,295 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@
+ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@
+ENABLE_REDLAND_FALSE = @ENABLE_REDLAND_FALSE@
+ENABLE_REDLAND_TRUE = @ENABLE_REDLAND_TRUE@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@
+GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@
+HTML_DIR = @HTML_DIR@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = \
+	patch_1.0.5 \
+	rdf_storage_b.c
+
+subdir = redland
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  redland/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: incubator/triplesoup/donations/TRIPLES-2-libb/redland/README
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/redland/README?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/redland/README (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/redland/README Fri Apr 13 08:19:45 2007
@@ -0,0 +1,12 @@
+If you have installed the B storage in /usr or in /usr/local, more o less
+these are the correct commands:
+
+wget http://download.librdf.org/source/redland-1.0.5.tar.gz
+tar xvfz redland-1.0.5.tar.gz
+cd redland-1.0.5
+patch -p0 < /where/the/b/tarball/is/redland/patch_1.0.5
+./autogen.sh
+LIBS="-lb" ./configure [options]
+make
+make install
+

Added: incubator/triplesoup/donations/TRIPLES-2-libb/redland/patch_1.0.5
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/redland/patch_1.0.5?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/redland/patch_1.0.5 (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/redland/patch_1.0.5 Fri Apr 13 08:19:45 2007
@@ -0,0 +1,36 @@
+diff -u librdf_OLD/Makefile.am librdf/Makefile.am
+--- librdf_OLD/Makefile.am	2006-11-01 06:12:21.000000000 +0100
++++ librdf/Makefile.am	2007-01-12 14:23:20.000000000 +0100
+@@ -112,6 +112,8 @@
+ librdf_la_SOURCES += rdf_storage_sqlite.c
+ endif
+ 
++librdf_la_SOURCES += rdf_storage_b.c
++
+ if STORAGE_POSTGRESQL
+ librdf_la_SOURCES += rdf_storage_postgresql.c
+ endif
+Only in librdf: rdf_storage_b.c
+diff -u librdf_OLD/rdf_storage.c librdf/rdf_storage.c
+--- librdf_OLD/rdf_storage.c	2006-10-08 08:44:14.000000000 +0200
++++ librdf/rdf_storage.c	2007-01-12 14:24:06.000000000 +0100
+@@ -93,6 +93,7 @@
+ #ifdef STORAGE_SQLITE
+   librdf_init_storage_sqlite(world);
+ #endif
++  librdf_init_storage_b(world);
+ }
+ 
+ 
+diff -u librdf_OLD/rdf_storage_internal.h librdf/rdf_storage_internal.h
+--- librdf_OLD/rdf_storage_internal.h	2006-07-30 07:54:11.000000000 +0200
++++ librdf/rdf_storage_internal.h	2007-01-12 14:22:54.000000000 +0100
+@@ -184,6 +184,7 @@
+ void librdf_init_storage_sqlite(librdf_world *world);
+ #endif
+ 
++void librdf_init_storage_b(librdf_world *world);
+ 
+ /* module init */
+ void librdf_init_storage(librdf_world *world);
+Common subdirectories: librdf_OLD/win32 and librdf/win32

Added: incubator/triplesoup/donations/TRIPLES-2-libb/redland/rdf_storage_b.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/redland/rdf_storage_b.c?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/redland/rdf_storage_b.c (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/redland/rdf_storage_b.c Fri Apr 13 08:19:45 2007
@@ -0,0 +1,808 @@
+/* -*- Mode: c; c-basic-offset: 2 -*-
+ *
+ * rdf_storage_b.c - RDF Storage using B implementation
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <rdf_config.h>
+#endif
+
+#ifdef WIN32
+#include <win32_rdf_config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h> /* for abort() as used in errors */
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+
+#include <redland.h>
+#include <rdf_storage.h>
+#include <rdf_digest.h>
+#include <rdf_types.h>
+
+#include <b.h>
+
+typedef struct
+{
+  librdf_storage *storage;
+
+  b_t *db;
+  int db_cache;
+
+  unsigned char *path;
+
+} librdf_storage_b_context;
+
+typedef struct {
+  librdf_storage *storage;
+  librdf_storage_b_context* b_context;
+
+  int finished;
+
+  librdf_statement *statement;
+  librdf_node* context;
+
+  b_iterator_triple_t *iterator;
+} librdf_storage_b_stream_context;
+
+typedef struct {
+  librdf_storage *storage;
+  librdf_storage_b_context* b_context;
+
+  int finished;
+  b_iterator_type_t *iterator;
+  unsigned char *what;
+} librdf_storage_b_iterator_context;
+
+static b_triple_t * librdf_storage_b_triple(librdf_storage* storage,
+                                            librdf_node *subject_node, 
+		                            librdf_node *property_node,
+                                            librdf_node *object_node,
+					    librdf_node *context_node);
+static void librdf_storage_b_triple_free(unsigned char **values);
+
+static int librdf_storage_b_stream_end_of_stream(void* context);
+static int librdf_storage_b_stream_next_statement(void* context);
+static void librdf_storage_b_stream_finished(void* context);
+static void* librdf_storage_b_stream_get_statement(void* context, int flags);
+
+static int librdf_storage_b_iterator_is_end(void* iterator);
+static int librdf_storage_b_iterator_next_method(void* iterator);
+static void* librdf_storage_b_iterator_get_method(void* iterator, int);
+static void librdf_storage_b_iterator_finished(void* iterator);
+
+static int
+librdf_storage_b_init(librdf_storage* storage, char *name, librdf_hash* options)
+{
+  librdf_storage_b_context *context=(librdf_storage_b_context*)storage->context;
+  unsigned char *path;
+  int len;
+
+  if(!name)
+    return 1;
+
+  context->storage = storage;
+
+  if(options && (context->db_cache=(int)librdf_hash_get_as_long(options, "cache"))<0)
+    context->db_cache=0;
+
+  len=strlen(name);
+
+  if(!(path=(unsigned char*)LIBRDF_MALLOC(cstring, len+1)))
+    return 1;
+
+  strncpy((char *)path, name, len+1);
+  context->path=path;
+
+  if(options)
+    librdf_free_hash(options);
+
+  return 0;
+}
+
+static void
+librdf_storage_b_terminate(librdf_storage* storage)
+{
+  librdf_storage_b_context *context=(librdf_storage_b_context*)storage->context;
+
+  if(context->path)
+    LIBRDF_FREE(cstring, context->path);
+}
+
+static int
+librdf_storage_b_open(librdf_storage* storage, librdf_model* model)
+{
+  librdf_storage_b_context *context=(librdf_storage_b_context*)storage->context;
+  b_error_t error;
+
+  if((error=b_new(&context->db, context->path))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
+               "B database %s open failed - %s", context->path,
+               b_strerror(error));
+    return 1;
+  }
+
+  if(context->db_cache)
+    b_set_max_cache(context->db, context->db_cache);
+
+  return 0;
+}
+
+static int
+librdf_storage_b_close(librdf_storage* storage)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_error_t error;
+
+  if(context->db) {
+    if((error=b_destroy(context->db))!=B_OK) {
+      librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+                 NULL, "B database %s close failed - %s", context->path,
+                 b_strerror(error));
+    }
+    context->db=NULL;
+  }
+
+  return 0;
+}
+
+static int
+librdf_storage_b_size(librdf_storage* storage)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_uint64 count=0;
+  b_error_t error;
+
+  if((error=b_count_triple(context->db, &count))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s get size failed - %s", context->path,
+               b_strerror(error));
+  }
+
+  return (int)count;
+}
+
+static int
+librdf_storage_b_context_add_statement(librdf_storage* storage,
+                                       librdf_node* context_node,
+                                       librdf_statement* statement)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_triple_t *triple;
+  b_error_t error;
+
+  if(!(triple= librdf_storage_b_triple(storage, 
+                                       librdf_statement_get_subject(statement), 
+                                       librdf_statement_get_predicate(statement),
+                                       librdf_statement_get_object(statement),
+                                       context_node)))
+    return 1;
+
+  if((error=b_add_triple(context->db, triple))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s add triple failed - %s", context->path,
+               b_strerror(error));
+
+    b_triple_destroy(triple);
+    return 1;
+  }
+
+  b_triple_destroy(triple);
+  return 0;
+}
+
+static int
+librdf_storage_b_add_statement(librdf_storage* storage,
+                                    librdf_statement* statement)
+{
+  return librdf_storage_b_context_add_statement(storage, NULL, statement);
+}
+
+static unsigned char **
+librdf_storage_b_triple_array(librdf_storage *storage,
+                              librdf_node *subject_node,
+			      librdf_node *property_node,
+                              librdf_node *object_node,
+			      librdf_node *context_node,
+			      unsigned int *values_len)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  unsigned char **values;
+  librdf_uri *uri;
+
+  if(!(values=calloc(9, sizeof(unsigned char *))))
+    return NULL;
+
+  memset(values_len, 0, sizeof(unsigned int)*9);
+
+#define B_FIND_NODE( x , a , b , c , d , e) \
+  if(x) { \
+    switch(librdf_node_get_type(x)) { \
+      case LIBRDF_NODE_TYPE_RESOURCE: \
+        values[a]=librdf_uri_as_counted_string(librdf_node_get_uri(x), \
+                                               &values_len[a]); \
+        break; \
+      \
+      case LIBRDF_NODE_TYPE_BLANK: \
+        values[b]=librdf_node_get_blank_identifier(x); \
+        break; \
+      \
+      case LIBRDF_NODE_TYPE_LITERAL: \
+        values[c]=librdf_node_get_literal_value_as_counted_string(x, \
+                                                    &values_len[c]); \
+        if ((uri=librdf_node_get_literal_value_datatype_uri(x))) \
+          values[d]=(unsigned char *)librdf_uri_as_counted_string(uri, \
+			                                     &values_len[d]); \
+        values[e]=(unsigned char *)librdf_node_get_literal_value_language(x); \
+        break; \
+      \
+      case LIBRDF_NODE_TYPE_UNKNOWN: \
+        break; \
+      \
+    } \
+  }
+
+  B_FIND_NODE(subject_node, 0, 1, 1, 1, 1);
+  B_FIND_NODE(property_node, 2, 2, 2, 2, 2);
+  B_FIND_NODE(object_node, 3, 4, 5, 7, 8);
+  B_FIND_NODE(context_node, 6, 6, 6, 6, 6);
+
+  return values;
+}
+
+static b_triple_t *
+librdf_storage_b_triple(librdf_storage *storage,
+                        librdf_node *subject_node, librdf_node *property_node,
+                        librdf_node *object_node, librdf_node *context_node)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  unsigned char **values;
+  unsigned int values_len[9];
+  b_triple_t *triple;
+  b_error_t error;
+
+  if(!(values = librdf_storage_b_triple_array(storage, subject_node, 
+				              property_node,object_node,
+					      context_node, values_len)))
+	  return NULL;
+
+  if((error=b_triple_new_incomplete(&triple, values[0], values_len[0], 
+				    values[1], values_len[1],
+				    values[2], values_len[2],
+				    values[3], values_len[3],
+				    values[4], values_len[4],
+				    values[5], values_len[5],
+				    values[6], values_len[6],
+				    values[7], values_len[7],
+				    values[8], values_len[8]))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s create triple failed - %s", context->path,
+               b_strerror(error));
+    librdf_storage_b_triple_free(values);
+    return NULL;
+  }
+
+  librdf_storage_b_triple_free(values);
+  return triple;
+}
+
+static void librdf_storage_b_triple_free(unsigned char **values) {
+/*
+  int i;
+  for(i=0;i<9;i++)
+    if(values[i])
+      free(values[i]);
+*/
+
+  free(values);
+}
+
+static int
+librdf_storage_b_context_remove_statement(librdf_storage* storage,
+                                          librdf_node* context_node,
+                                          librdf_statement* statement)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_triple_t *triple;
+  b_error_t error;
+
+  if(!(triple= librdf_storage_b_triple(storage,
+                                       librdf_statement_get_subject(statement), 
+                                       librdf_statement_get_predicate(statement),
+                                       librdf_statement_get_object(statement),
+                                       context_node)))
+    return 1;
+
+  if((error=b_remove_triple(context->db, triple))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s remove triple failed - %s", context->path,
+               b_strerror(error));
+
+    b_triple_destroy(triple);
+    return 1;
+  }
+
+  b_triple_destroy(triple);
+  return 0;
+}
+
+static int
+librdf_storage_b_remove_statement(librdf_storage* storage, 
+                                  librdf_statement* statement)
+{
+  return librdf_storage_b_context_remove_statement(storage, NULL,
+                                                   statement);
+}
+
+static int
+librdf_storage_b_contains_statement(librdf_storage* storage,
+                                         librdf_statement* statement)
+{
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_triple_t *triple;
+  b_error_t error;
+  char status;
+
+  if(!(triple= librdf_storage_b_triple(storage,
+                                       librdf_statement_get_subject(statement), 
+                                       librdf_statement_get_predicate(statement),
+                                       librdf_statement_get_object(statement),
+                                       NULL)))
+    return 1;
+
+  if((error=b_get_triple(context->db, triple, &status))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s remove triple failed - %s", context->path,
+               b_strerror(error));
+
+    b_triple_destroy(triple);
+    return 1;
+  }
+
+  b_triple_destroy(triple);
+  return status ? 1 : 0;
+}
+
+static librdf_stream*
+librdf_storage_b_serialise(librdf_storage* storage)
+{
+  librdf_stream *stream;
+  librdf_storage_b_stream_context *scontext;
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_error_t error;
+
+  scontext=(librdf_storage_b_stream_context*)LIBRDF_CALLOC(librdf_storage_b_stream_context, 1, sizeof(librdf_storage_b_stream_context));
+  scontext->storage=storage;
+  scontext->b_context=context;
+
+  librdf_storage_add_reference(scontext->storage);
+
+  if((error=b_iterator_triple_new(context->db, &scontext->iterator, NULL))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B iterator create failed - %s", context->path,
+               b_strerror(error));
+    librdf_storage_b_stream_finished((void*)scontext);
+    return NULL;
+  }
+	  
+  if(!(stream=librdf_new_stream(storage->world,
+                                (void*)scontext,
+                                &librdf_storage_b_stream_end_of_stream,
+                                &librdf_storage_b_stream_next_statement,
+                                &librdf_storage_b_stream_get_statement,
+                                &librdf_storage_b_stream_finished))) {
+    librdf_storage_b_stream_finished((void*)scontext);
+    return NULL;
+  }
+
+  return stream;
+}
+
+static int
+librdf_storage_b_get_next_stream_common(librdf_storage_b_stream_context* scontext,
+                                        b_iterator_triple_t *iterator,
+                                        librdf_statement **statement)
+{
+  librdf_node *node;
+  b_triple_t *next;
+  b_error_t error;
+ 
+  if((error=b_iterator_triple_step(iterator, &next))!=B_OK) {
+    librdf_log(scontext->storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s iterator triple step failed - %s",
+               scontext->b_context->path, b_strerror(error));
+    return 1;
+  }
+
+  if(!next)
+    return 1;
+
+  if(!(*statement=librdf_new_statement(scontext->storage->world)))
+    return 1;
+
+  librdf_statement_clear(*statement);
+
+  if(next->subject_uri)
+    node=librdf_new_node_from_uri_string(scontext->storage->world,
+                                         next->subject_uri);
+  else
+    node=librdf_new_node_from_blank_identifier(scontext->storage->world,
+                                               next->subject_bnode);
+
+  librdf_statement_set_subject(*statement, node);
+
+  node=librdf_new_node_from_uri_string(scontext->storage->world,
+                                       next->property);
+
+  librdf_statement_set_predicate(*statement, node);
+
+  if(next->object_uri)
+    node=librdf_new_node_from_uri_string(scontext->storage->world,
+                                         next->object_uri);
+  else if(next->object_bnode)
+    node=librdf_new_node_from_blank_identifier(scontext->storage->world,
+                                               next->object_bnode);
+  else {
+    librdf_uri *datatype;
+
+    if(next->datatype)
+      datatype=librdf_new_uri(scontext->storage->world,
+                              next->datatype);
+    else
+      datatype=NULL;
+
+    node=librdf_new_node_from_typed_literal(scontext->storage->world,
+                                            next->object_literal,
+                                            (char *)next->lang,
+                                            datatype);
+
+    if(datatype)
+      librdf_free_uri(datatype);
+  }
+
+  librdf_statement_set_object(*statement, node);
+
+  return 0;
+}
+
+static int
+librdf_storage_b_stream_end_of_stream(void* context)
+{
+  librdf_storage_b_stream_context* scontext=(librdf_storage_b_stream_context*)context;
+
+  if(scontext->finished)
+    return 1;
+
+  if(scontext->statement == NULL) {
+    if(librdf_storage_b_get_next_stream_common(scontext, scontext->iterator, &scontext->statement))
+      scontext->finished=1;
+  }
+
+  return scontext->finished;
+}
+
+static int
+librdf_storage_b_stream_next_statement(void* context)
+{
+  librdf_storage_b_stream_context* scontext=(librdf_storage_b_stream_context*)context;
+
+  if(scontext->finished)
+    return 1;
+
+  if(librdf_storage_b_get_next_stream_common(scontext, scontext->iterator, &scontext->statement))
+    scontext->finished=1;
+
+  return scontext->finished;
+}
+
+static void*
+librdf_storage_b_stream_get_statement(void* context, int flags)
+{
+  librdf_storage_b_stream_context* scontext=(librdf_storage_b_stream_context*)context;
+
+  switch(flags) {
+    case LIBRDF_ITERATOR_GET_METHOD_GET_OBJECT:
+      return scontext->statement;
+    case LIBRDF_ITERATOR_GET_METHOD_GET_CONTEXT:
+      return scontext->context;
+    default:
+      librdf_log(scontext->storage->world,
+                 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
+                 "Unknown iterator method flag %d", flags);
+      return NULL;
+  }
+}
+
+static void
+librdf_storage_b_stream_finished(void* context)
+{
+  librdf_storage_b_stream_context* scontext=(librdf_storage_b_stream_context*)context;
+
+  if(scontext->storage)
+    librdf_storage_remove_reference(scontext->storage);
+
+  if(scontext->statement)
+    librdf_free_statement(scontext->statement);
+
+  if(scontext->context)
+    librdf_free_node(scontext->context);
+
+  if(scontext->iterator)
+    b_iterator_triple_destroy(scontext->iterator);
+
+  LIBRDF_FREE(librdf_storage_b_stream_context, scontext);
+}
+
+static librdf_stream*
+librdf_storage_b_find_statements(librdf_storage* storage, librdf_statement* statement)
+{
+  librdf_stream *stream;
+  librdf_storage_b_stream_context *scontext;
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_triple_t *compare;
+  b_error_t error;
+
+  scontext=(librdf_storage_b_stream_context*)LIBRDF_CALLOC(librdf_storage_b_stream_context, 1, sizeof(librdf_storage_b_stream_context));
+  scontext->storage=storage;
+  scontext->b_context=context;
+
+  librdf_storage_add_reference(scontext->storage);
+
+  if(!(compare = librdf_storage_b_triple(storage,
+				         librdf_statement_get_subject(statement), 
+					 librdf_statement_get_predicate(statement),
+					 librdf_statement_get_object(statement), 
+					 NULL))) {
+    librdf_storage_b_stream_finished((void*)scontext);
+    return NULL;
+  }
+
+  if((error=b_iterator_triple_new(context->db, &scontext->iterator, compare))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B iterator create failed - %s", context->path,
+               b_strerror(error));
+
+    librdf_storage_b_stream_finished((void*)scontext);
+    b_triple_destroy(compare);
+    return NULL;
+  }
+	  
+  b_triple_destroy(compare);
+
+  if(!(stream=librdf_new_stream(storage->world,
+                                (void*)scontext,
+                                &librdf_storage_b_stream_end_of_stream,
+                                &librdf_storage_b_stream_next_statement,
+                                &librdf_storage_b_stream_get_statement,
+                                &librdf_storage_b_stream_finished))) {
+    librdf_storage_b_stream_finished((void*)scontext);
+    return NULL;
+  }
+
+  return stream;
+}
+
+static librdf_stream*
+librdf_storage_b_context_serialise(librdf_storage* storage, librdf_node* context_node)
+{
+  librdf_stream *stream;
+  librdf_storage_b_stream_context *scontext;
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  b_triple_t *compare;
+  b_error_t error;
+
+  scontext=(librdf_storage_b_stream_context*)LIBRDF_CALLOC(librdf_storage_b_stream_context, 1, sizeof(librdf_storage_b_stream_context));
+  scontext->storage=storage;
+  scontext->b_context=context;
+
+  librdf_storage_add_reference(scontext->storage);
+
+  if(!(compare = librdf_storage_b_triple (storage, NULL, NULL, NULL, context_node))) {
+    librdf_storage_b_stream_finished((void*)scontext);
+    return NULL;
+  }
+
+  if((error=b_iterator_triple_new(context->db, &scontext->iterator, compare))!=B_OK) {
+    librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B iterator create failed - %s", context->path,
+               b_strerror(error));
+
+    librdf_storage_b_stream_finished((void*)scontext);
+    b_triple_destroy(compare);
+    return NULL;
+  }
+	  
+  b_triple_destroy(compare);
+
+  if(!(stream=librdf_new_stream(storage->world,
+                                (void*)scontext,
+                                &librdf_storage_b_stream_end_of_stream,
+                                &librdf_storage_b_stream_next_statement,
+                                &librdf_storage_b_stream_get_statement,
+                                &librdf_storage_b_stream_finished))) {
+    librdf_storage_b_stream_finished((void*)scontext);
+    return NULL;
+  }
+
+  return stream;
+}
+
+static librdf_iterator*
+librdf_storage_b_get_contexts(librdf_storage* storage) {
+  librdf_storage_b_context* context=(librdf_storage_b_context*)storage->context;
+  librdf_storage_b_iterator_context* icontext;
+  librdf_iterator* iterator;
+  b_error_t error;
+
+  icontext=(librdf_storage_b_iterator_context*)LIBRDF_CALLOC(librdf_storage_b_iterator_context, 1, sizeof(librdf_storage_b_iterator_context));
+  if(!icontext)
+    return NULL;
+
+  icontext->b_context=context;
+  icontext->storage=storage;
+
+  librdf_storage_add_reference(icontext->storage);
+
+  if((error=b_iterator_type_new(context->db, B_TYPE_CONTEXT, &icontext->iterator))!=B_OK) {
+    librdf_storage_b_iterator_finished((void*)icontext);
+    return NULL;
+  }
+
+  if(!(iterator=librdf_new_iterator(storage->world,
+                                    (void*)icontext,
+                                    &librdf_storage_b_iterator_is_end,
+                                    &librdf_storage_b_iterator_next_method,
+                                    &librdf_storage_b_iterator_get_method,
+                                    &librdf_storage_b_iterator_finished))) {
+    librdf_storage_b_iterator_finished((void*)icontext);
+    return NULL;
+  }
+
+  return iterator;
+}
+
+static int
+librdf_storage_b_get_next_iterator_common(librdf_storage_b_iterator_context* icontext)
+{
+  b_error_t error;
+
+  if(icontext->what)
+    LIBRDF_FREE(cstring, icontext->what);
+
+  if((error=b_iterator_type_step(icontext->iterator, &icontext->what, NULL))!=B_OK)  {
+    librdf_log(icontext->storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, 
+               NULL, "B database %s iterator type step failed - %s",
+               icontext->b_context->path, b_strerror(error));
+    icontext->what=NULL;
+    return 1;
+  }
+
+  if(!icontext->what)
+    return 1;
+
+  return 0;
+}
+
+static int librdf_storage_b_iterator_is_end(void* iterator)
+{
+  librdf_storage_b_iterator_context* icontext=(librdf_storage_b_iterator_context*)iterator;
+
+  if(icontext->finished)
+    return 1;
+
+  if(!icontext->what)
+    if(librdf_storage_b_get_next_iterator_common(icontext))
+      icontext->finished=1;
+
+  return icontext->finished;
+}
+
+static int librdf_storage_b_iterator_next_method(void* iterator)
+{
+  librdf_storage_b_iterator_context* icontext=(librdf_storage_b_iterator_context*)iterator;
+
+  if(icontext->finished)
+    return 1;
+
+  if(librdf_storage_b_get_next_iterator_common(icontext))
+    icontext->finished=1;
+
+  return icontext->finished;
+}
+
+static void* librdf_storage_b_iterator_get_method(void* iterator, int flags) 
+{
+  librdf_storage_b_iterator_context* icontext=(librdf_storage_b_iterator_context*)iterator;
+
+  switch(flags) {
+    case LIBRDF_ITERATOR_GET_METHOD_GET_OBJECT:
+      if(icontext->what)
+        return librdf_new_node_from_uri_string(icontext->storage->world,
+                                               icontext->what);
+      else
+        return NULL;
+
+    case LIBRDF_ITERATOR_GET_METHOD_GET_KEY:
+    case LIBRDF_ITERATOR_GET_METHOD_GET_VALUE:
+      return NULL;
+
+    default:
+      librdf_log(icontext->storage->world,
+                 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
+                 "Unknown iterator method flag %d", flags);
+    return NULL;
+  }
+}
+
+static void librdf_storage_b_iterator_finished(void* iterator)
+{
+  librdf_storage_b_iterator_context* icontext=(librdf_storage_b_iterator_context*)iterator;
+
+  if(icontext->storage)
+    librdf_storage_remove_reference(icontext->storage);
+
+  if(icontext->what)
+    free(icontext->what);
+
+  LIBRDF_FREE(librdf_storage_b_iterator_context, icontext);
+}
+
+static librdf_node*
+librdf_storage_b_get_feature(librdf_storage* storage, librdf_uri* feature)
+{
+  /* librdf_storage_b_context* scontext=(librdf_storage_b_context*)storage->context; */
+  unsigned char *uri_string;
+
+  if(!feature)
+    return NULL;
+
+  if(!(uri_string=librdf_uri_as_string(feature)))
+    return NULL;
+
+  if(!strcmp((const char*)uri_string, LIBRDF_MODEL_FEATURE_CONTEXTS)) {
+    return librdf_new_node_from_typed_literal(storage->world,
+                                              (const unsigned char*)"1",
+                                              NULL, NULL);
+  }
+
+  return NULL;
+}
+
+/* local function to register B storage functions */
+static void
+librdf_storage_b_register_factory(librdf_storage_factory *factory) 
+{
+  factory->context_length     = sizeof(librdf_storage_b_context);
+  
+  factory->init               = librdf_storage_b_init;
+  factory->terminate          = librdf_storage_b_terminate;
+  factory->open               = librdf_storage_b_open;
+  factory->close              = librdf_storage_b_close;
+  factory->size               = librdf_storage_b_size;
+  factory->add_statement      = librdf_storage_b_add_statement;
+  factory->remove_statement   = librdf_storage_b_remove_statement;
+  factory->contains_statement = librdf_storage_b_contains_statement;
+  factory->serialise          = librdf_storage_b_serialise;
+  factory->find_statements    = librdf_storage_b_find_statements;
+  factory->context_add_statement = librdf_storage_b_context_add_statement;
+  factory->context_remove_statement = librdf_storage_b_context_remove_statement;
+  factory->context_serialise  = librdf_storage_b_context_serialise;
+  factory->get_contexts       = librdf_storage_b_get_contexts;
+  factory->get_feature        = librdf_storage_b_get_feature;
+}
+
+void
+librdf_init_storage_b(librdf_world *world)
+{
+  librdf_storage_register_factory(world, "b", "B",
+                                  &librdf_storage_b_register_factory);
+}
+

Added: incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.am?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.am (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.am Fri Apr 13 08:19:45 2007
@@ -0,0 +1,28 @@
+lib_LTLIBRARIES = libb.la
+
+libb_la_SOURCES = \
+	badd.c \
+	bcache.c \
+	bcount.c \
+	bdestroy.c \
+	bel.c \
+	berror.c \
+	bget.c \
+	bhash.c \
+	bio.c \
+	biterator.c \
+	bjournaling.c \
+	bmd5.c \
+	bnew.c \
+	bremove.c \
+	bstring.c \
+	bsync.c \
+	btcache.c \
+	btempty.c \
+	btimer.c \
+	btriple.c
+
+EXTRA_DIST = b.h b_internal.h
+
+incdir = $(includedir)
+inc_DATA = b.h

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.in?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.in (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/Makefile.in Fri Apr 13 08:19:45 2007
@@ -1,51 +1,521 @@
-# (c) 2006 Satis Superque Merce B.V. All rights reserved. This code
-# contains trade secrets of Satis Superque Merce B.V. and any
-# unauthorized use or disclosure is strictly prohibited.
-#
-# $Id: Makefile.in 29834 2006-10-19 16:22:05Z Andrea Marchesini <ba...@theveniceproject.com> $
-#
-
-DEPTH		= ../../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= b
-LIBRARY_NAME	= mozb_s
-
-CSRCS		= \
-		badd.c \
-		bcache.c \
-		bcount.c \
-		bdestroy.c \
-		berror.c \
-		bget.c \
-		bhash.c \
-		bio.c \
-		biterator.c \
-		bmd5.c \
-		bnew.c \
-		bremove.c \
-		bstring.c \
-		bsync.c \
-		btcache.c \
-		btempty.c \
-		btimer.c \
-		btriple.c \
-		$(NULL)
-
-EXPORTS		= \
-		b.h
-
-# We want only the static lib, not the shared lib
-FORCE_STATIC_LIB = 1
-
-include $(topsrcdir)/config/rules.mk
-
-DEFINES += -DB_INTERNAL
-
-LOCAL_INCLUDES += \
-		  -I$(srcdir) \
-		  $(NULL)
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@
+ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@
+ENABLE_REDLAND_FALSE = @ENABLE_REDLAND_FALSE@
+ENABLE_REDLAND_TRUE = @ENABLE_REDLAND_TRUE@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@
+GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@
+HTML_DIR = @HTML_DIR@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+lib_LTLIBRARIES = libb.la
+
+libb_la_SOURCES = \
+	badd.c \
+	bcache.c \
+	bcount.c \
+	bdestroy.c \
+	bel.c \
+	berror.c \
+	bget.c \
+	bhash.c \
+	bio.c \
+	biterator.c \
+	bjournaling.c \
+	bmd5.c \
+	bnew.c \
+	bremove.c \
+	bstring.c \
+	bsync.c \
+	btcache.c \
+	btempty.c \
+	btimer.c \
+	btriple.c
+
+
+EXTRA_DIST = b.h b_internal.h
+
+incdir = $(includedir)
+inc_DATA = b.h
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+libb_la_LDFLAGS =
+libb_la_LIBADD =
+am_libb_la_OBJECTS = badd.lo bcache.lo bcount.lo bdestroy.lo bel.lo \
+	berror.lo bget.lo bhash.lo bio.lo biterator.lo bjournaling.lo \
+	bmd5.lo bnew.lo bremove.lo bstring.lo bsync.lo btcache.lo \
+	btempty.lo btimer.lo btriple.lo
+libb_la_OBJECTS = $(am_libb_la_OBJECTS)
+
+DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/badd.Plo ./$(DEPDIR)/bcache.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bcount.Plo ./$(DEPDIR)/bdestroy.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bel.Plo ./$(DEPDIR)/berror.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bget.Plo ./$(DEPDIR)/bhash.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bio.Plo ./$(DEPDIR)/biterator.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bjournaling.Plo ./$(DEPDIR)/bmd5.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bnew.Plo ./$(DEPDIR)/bremove.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/bstring.Plo ./$(DEPDIR)/bsync.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/btcache.Plo ./$(DEPDIR)/btempty.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/btimer.Plo ./$(DEPDIR)/btriple.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+	$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libb_la_SOURCES)
+DATA = $(inc_DATA)
+
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+SOURCES = $(libb_la_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+libLTLIBRARIES_INSTALL = $(INSTALL)
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(libdir)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f="`echo $$p | sed -e 's|^.*/||'`"; \
+	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
+	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	    p="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
+	  $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" = "$$p" && dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libb.la: $(libb_la_OBJECTS) $(libb_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libb_la_LDFLAGS) $(libb_la_OBJECTS) $(libb_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/badd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcount.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdestroy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/berror.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bget.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bhash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/biterator.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjournaling.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmd5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bnew.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bremove.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bstring.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsync.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btcache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btempty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btimer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btriple.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+incDATA_INSTALL = $(INSTALL_DATA)
+install-incDATA: $(inc_DATA)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(incdir)
+	@list='$(inc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(incDATA_INSTALL) $$d$$p $(DESTDIR)$(incdir)/$$f"; \
+	  $(incDATA_INSTALL) $$d$$p $(DESTDIR)$(incdir)/$$f; \
+	done
+
+uninstall-incDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inc_DATA)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " rm -f $(DESTDIR)$(incdir)/$$f"; \
+	  rm -f $(DESTDIR)$(incdir)/$$f; \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(incdir)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-incDATA
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-incDATA uninstall-info-am \
+	uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am info info-am install \
+	install-am install-data install-data-am install-exec \
+	install-exec-am install-incDATA install-info install-info-am \
+	install-libLTLIBRARIES install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-incDATA uninstall-info-am \
+	uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/b.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/b.h?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/b.h (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/b.h Fri Apr 13 08:19:45 2007
@@ -15,15 +15,15 @@
 #include <string.h>
 
 #ifndef WIN32
-#include <sys/mman.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/time.h>
+#  include <sys/mman.h>
+#  include <unistd.h>
+#  include <errno.h>
+#  include <sys/time.h>
 #else
-#include <Windows.h>
-#include <Winbase.h>
-#include <Winsock2.h>
-#include <sys/timeb.h>
+#  include <Windows.h>
+#  include <Winbase.h>
+#  include <Winsock2.h>
+#  include <sys/timeb.h>
 #endif
 
 #include <sys/types.h>
@@ -36,7 +36,7 @@
 /**
  * b_t:
  *
- * The principal data struct. You must have 1 for any B storage.
+ * The principal data struct. You must have one of this for any B storage.
  **/
 typedef struct b_t b_t;
 
@@ -98,7 +98,8 @@
  *
  * The list of errors for this library.
  **/
-typedef enum {
+typedef enum
+{
   B_OK = 0,
 
   B_ERROR_MEMORY,
@@ -120,7 +121,8 @@
  *
  * The types of simple elements.
  */
-typedef enum {
+typedef enum
+{
   B_TYPE_URI,
   B_TYPE_PROPERTY,
   B_TYPE_LITERAL,
@@ -152,7 +154,8 @@
  *
  * This struct describes a RDF triple.
  */
-typedef struct {
+typedef struct
+{
   unsigned char *	subject_uri;
   b_uint64		subject_uri_len;
 
@@ -180,6 +183,8 @@
   unsigned char *	lang;
   b_uint64		lang_len;
 } b_triple_t;
+
+/* List of functions */
 
 b_error_t	b_new		(b_t **			data,
 				 unsigned char *	path);

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/b_internal.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/b_internal.h?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/b_internal.h (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/b_internal.h Fri Apr 13 08:19:45 2007
@@ -17,6 +17,7 @@
 #define B_PATH_CONTEXTS_DATA	"_contexts.data"
 #define B_PATH_DATATYPES_DATA	"_datatypes.data"
 #define B_PATH_TRIPLES_DATA	"_triples.data"
+#define B_PATH_JOURNALING_DATA	".journaling"
 
 #define B_HASH_SIZE		16
 #define B_TRIPLE_SIZE		(sizeof(b_tmap_item_t) * 9)
@@ -130,7 +131,8 @@
 				 b_uint64		size,
 				 void *			data);
 
-struct b_cache_t {
+struct b_cache_t
+{
   unsigned char		hash[B_HASH_SIZE];
 
   unsigned char *	what;
@@ -139,7 +141,8 @@
   b_uint64		pointer;
 };
 
-struct b_tcache_t {
+struct b_tcache_t
+{
   b_uint64		tmap_pointer;
   unsigned char		tmap_index;
 
@@ -161,7 +164,8 @@
   b_tcache_t *		next;
 };
 
-struct b_t {
+struct b_t
+{
   b_uint64		max_cache;
 
   b_hash_t *		hashes_cache;
@@ -181,9 +185,13 @@
 
   b_tempty_t *		triples_empty;
   b_uint64		triples_empty_size;
+
+  unsigned char *	journaling_file;
+  b_io_t *		journaling_io;
 };
 
-struct b_hash_t {
+struct b_hash_t
+{
   unsigned char		hash[B_HASH_SIZE];
   unsigned char *	what;
   b_uint64		len;
@@ -192,7 +200,8 @@
   b_hash_t *		prev;
 };
 
-struct b_string_t {
+struct b_string_t
+{
   unsigned char *	string;
   b_uint64		size;
 
@@ -202,7 +211,8 @@
   b_int64		callback_ret;
 };
 
-struct b_io_t {
+struct b_io_t
+{
   void *		fd;
 
   b_uint64		size;
@@ -212,12 +222,14 @@
   unsigned char		*data;
 };
 
-struct b_el_t {
+struct b_el_t
+{
   b_tcache_t *		cache;
   b_el_t *		next;
 };
 
-struct b_iterator_type_t {
+struct b_iterator_type_t
+{
   b_t *			data;
   b_type_t		type;
 
@@ -227,7 +239,8 @@
   b_uint64		pointer;
 };
 
-struct b_iterator_compare_t {
+struct b_iterator_compare_t
+{
   char			subject_uri_exists;
   unsigned char		subject_uri[B_HASH_SIZE];
   char			subject_bnode_exists;
@@ -252,7 +265,8 @@
   unsigned char		lang[B_HASH_SIZE];
 };
 
-struct b_iterator_triple_t {
+struct b_iterator_triple_t
+{
   b_t *			data;
   char			status;
   b_iterator_compare_t *compare;
@@ -261,9 +275,10 @@
   b_el_t *		results;
 };
 
-struct b_map_t {
+struct b_map_t
+{
   /* This 2 elements must be in the top: */
-  unsigned char		hash[16];
+  unsigned char		hash[B_HASH_SIZE];
   b_uint64		len;
 
   /* how many triples linked with this item? */
@@ -274,18 +289,21 @@
   b_uint64		parent;
 };
 
-struct b_timer_t {
+struct b_timer_t
+{
   struct timeval	start;
   struct timeval	stop;
   char			stopped;
 };
 
-struct b_tempty_t {
+struct b_tempty_t
+{
   b_uint64		pointer;
   b_tempty_t *		next;
 };
 
-struct b_tmap_t {
+struct b_tmap_t
+{
   /* Maybe tomorrow a single bit: */
   unsigned char		map[B_TMAP_NUMB];
 
@@ -304,11 +322,19 @@
   unsigned char		langs[B_TMAP_NUMB];
 };
 
-struct b_tmap_item_t {
+struct b_tmap_item_t
+{
   unsigned char		hash[B_HASH_SIZE];
   b_uint64		pointer;
 };
 
+typedef enum
+{
+  B_JOURNALING_CACHE_EMPTY,
+  B_JOURNALING_END_WRITE,
+  B_JOURNALING_WRITE
+} b_journaling_type_t;
+
 /* b_string: */
 b_error_t	b_string_new		(b_string_t **		string);
 
@@ -416,7 +442,6 @@
 b_error_t	b_tcache_copy_easy	(b_tcache_t *		src,
 					 b_tcache_t **		dest);
 
-/* copy: */
 /* triple: */
 b_error_t	b_triple_check		(b_triple_t *		triple);
 
@@ -489,6 +514,25 @@
 b_error_t	b_remove_type_cache	(b_t *			data,
 					 b_io_t *		io,
 					 b_cache_t *		cache);
+
+/* journaling: */
+void		b_journaling_new	(b_t *			data,
+					 b_io_t *		io,
+					 b_journaling_type_t	type,
+					 ...);
+
+b_error_t	b_journaling_recover	(b_t *			data);
+
+void		b_journaling_destroy	(b_t *			data);
+
+/* b_el_t functions: */
+
+b_error_t	b_el_new		(b_tcache_t *		cache,
+					 b_el_t **		list);
+
+b_tcache_t *	b_el_first		(b_el_t **		list);
+
+void		b_el_free		(b_el_t **		list);
 
 #endif
 

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/badd.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/badd.c?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/badd.c (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/badd.c Fri Apr 13 08:19:45 2007
@@ -46,8 +46,6 @@
       return B_OK;
     }
 
-  b_cache_destroy (exist);
-
   if ((error = b_get_type_internal (data, type, &io)) != B_OK)
     return error;
 

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/bdestroy.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/bdestroy.c?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/bdestroy.c (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/bdestroy.c Fri Apr 13 08:19:45 2007
@@ -60,6 +60,15 @@
   if (data->triples_io)
     b_io_destroy (data->triples_io);
 
+  if (data->journaling_io)
+    b_io_destroy (data->journaling_io);
+
+  if (data->journaling_file)
+    {
+      remove ((char *) data->journaling_file);
+      free (data->journaling_file);
+    }
+
   /* Free memory: */
   free (data);
   return B_OK;

Added: incubator/triplesoup/donations/TRIPLES-2-libb/src/bel.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/bel.c?view=auto&rev=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/bel.c (added)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/bel.c Fri Apr 13 08:19:45 2007
@@ -0,0 +1,59 @@
+/* (c) 2007 Satis Superque Merce B.V. All rights reserved.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+#include <b.h>
+
+b_error_t
+b_el_new (b_tcache_t * cache, b_el_t ** list)
+{
+  b_el_t *new;
+
+  if (!(new = calloc (1, sizeof (b_el_t))))
+    return B_ERROR_MEMORY;
+
+  new->cache = cache;
+  new->next = *list;
+  *list = new;
+
+  return B_OK;
+}
+
+void
+b_el_free (b_el_t ** list)
+{
+  b_el_t *tmp;
+
+  while (*list)
+    {
+      tmp = *list;
+      *list = tmp->next;
+
+      if (tmp->cache)
+	b_tcache_destroy_single (NULL, NULL, tmp->cache);
+
+      free (tmp);
+    }
+}
+
+b_tcache_t *
+b_el_first (b_el_t ** list)
+{
+  b_el_t *first;
+  b_tcache_t *cache;
+
+  first = *list;
+  cache = first->cache;
+
+  *list = first->next;
+  free (first);
+
+  return cache;
+}
+
+/* EOF */

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/bget.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/bget.c?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/bget.c (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/bget.c Fri Apr 13 08:19:45 2007
@@ -130,7 +130,10 @@
 		return B_ERROR_MEMORY;
 
 	      if (map.len && b_io_read (io, iwhat, map.len) <= 0)
-		return B_ERROR_INTERNAL;
+		{
+		  free (iwhat);
+		  return B_ERROR_INTERNAL;
+		}
 
 	      iwhat[map.len] = 0;
 	    }
@@ -183,7 +186,10 @@
     return B_ERROR_MEMORY;
 
   if (map.len && b_io_read (io, iwhat, map.len) <= 0)
-    return B_ERROR_INTERNAL;
+    {
+      free (iwhat);
+      return B_ERROR_INTERNAL;
+    }
 
   iwhat[map.len] = 0;
 
@@ -274,7 +280,7 @@
   b_tmap_t tmap;
   b_tmap_item_t tmap_item;
 
-  int i, j;
+  int i, j, elements;
   char tmap_results[B_TMAP_NUMB];
 
   B_LOG3 ("b_get_triple_cache: %p %p %p", data, triple, exist);
@@ -382,7 +388,7 @@
   /* Check in the file: */
   while (1)
     {
-      if (b_io_read (data->triples_io, &tmap, sizeof (tmap)) <= 0)
+      if (b_io_read (data->triples_io, &tmap, sizeof (b_tmap_t)) <= 0)
 	{
 	  b_tcache_destroy_single (NULL, NULL, cache);
 	  return B_OK;
@@ -397,48 +403,48 @@
       memset (&tmap_results, 0, sizeof (tmap_results));
 
       /* Disactive no compatible results: */
-      for (i = 0; i < B_TMAP_NUMB; i++)
+      for (i = elements = 0; i < B_TMAP_NUMB; i++)
 	{
 	  if (!tmap.map[i])
 	    tmap_results[i] = 1;
 	  else
-	    {
-	      if (cache->subject_uri
-		  && B_TMAP_VALUE (tmap.subjects_uri[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
-
-	      if (cache->subject_bnode
-		  && B_TMAP_VALUE (tmap.subjects_bnode[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
-
-	      if (cache->object_uri
-		  && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
-
-	      if (cache->object_bnode
-		  && B_TMAP_VALUE (tmap.objects_bnode[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
-
-	      if (cache->object_literal
-		  && B_TMAP_VALUE (tmap.objects_literal[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
-
-	      if (cache->context
-		  && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
-
-	      if (cache->datatype
-		  && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
-
-	      if (cache->lang
-		  && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
-	    }
+	    elements++;
+	}
+
+      /* Disactive no compatible results: */
+      for (i = 0; i < elements; i++)
+	{
+	  if (cache->subject_uri
+	      && B_TMAP_VALUE (tmap.subjects_uri[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
+
+	  if (cache->subject_bnode
+	      && B_TMAP_VALUE (tmap.subjects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
+
+	  if (cache->object_uri
+	      && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
+
+	  if (cache->object_bnode
+	      && B_TMAP_VALUE (tmap.objects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
+
+	  if (cache->object_literal
+	      && B_TMAP_VALUE (tmap.objects_literal[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
+
+	  if (cache->context
+	      && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
+
+	  if (cache->datatype
+	      && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
+
+	  if (cache->lang
+	      && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
 	}
 
 #define B_GET_FILE( x , y , n ) \

Modified: incubator/triplesoup/donations/TRIPLES-2-libb/src/biterator.c
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-2-libb/src/biterator.c?view=diff&rev=528519&r1=528518&r2=528519
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-2-libb/src/biterator.c (original)
+++ incubator/triplesoup/donations/TRIPLES-2-libb/src/biterator.c Fri Apr 13 08:19:45 2007
@@ -424,10 +424,7 @@
   /* Previous results? */
   else if (iterator->results)
     {
-      b_el_t *list = iterator->results;
-      cache = list->cache;
-      iterator->results = list->next;
-      free (list);
+      cache = b_el_first (&iterator->results);
       error = B_OK;
     }
 
@@ -565,7 +562,7 @@
   else
     {
       int tmap_results[B_TMAP_NUMB];
-      int i, j;
+      int i, j, elements;
 
       if (iterator->results)
 	return B_ERROR_INTERNAL;
@@ -583,48 +580,48 @@
       memset (&tmap_results, 0, sizeof (tmap_results));
 
       /* Disactive no compatible results: */
-      for (i = 0; i < B_TMAP_NUMB; i++)
+      for (i = elements = 0; i < B_TMAP_NUMB; i++)
 	{
 	  if (!tmap.map[i])
 	    tmap_results[i] = 1;
 	  else
-	    {
-	      if (iterator->compare->subject_uri_exists
-		  && B_TMAP_VALUE (tmap.subjects_uri[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
-
-	      if (iterator->compare->subject_bnode_exists
-		  && B_TMAP_VALUE (tmap.subjects_bnode[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
-
-	      if (iterator->compare->object_uri_exists
-		  && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
-
-	      if (iterator->compare->object_bnode_exists
-		  && B_TMAP_VALUE (tmap.objects_bnode[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
-
-	      if (iterator->compare->object_literal_exists
-		  && B_TMAP_VALUE (tmap.objects_literal[i]) ==
-		  B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
-
-	      if (iterator->compare->context_exists
-		  && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
-
-	      if (iterator->compare->datatype_exists
-		  && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
-
-	      if (iterator->compare->lang_exists
-		  && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
-		tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
-	    }
+	    elements++;
+	}
+
+      /* Disactive no compatible results: */
+      for (i = 0; i < elements; i++)
+	{
+	  if (iterator->compare->subject_uri_exists
+	      && B_TMAP_VALUE (tmap.subjects_uri[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.subjects_uri[i])] = 1;
+
+	  if (iterator->compare->subject_bnode_exists
+	      && B_TMAP_VALUE (tmap.subjects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.subjects_bnode[i])] = 1;
+
+	  if (iterator->compare->object_uri_exists
+	      && B_TMAP_VALUE (tmap.objects_uri[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.objects_uri[i])] = 1;
+
+	  if (iterator->compare->object_bnode_exists
+	      && B_TMAP_VALUE (tmap.objects_bnode[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.objects_bnode[i])] = 1;
+
+	  if (iterator->compare->object_literal_exists
+	      && B_TMAP_VALUE (tmap.objects_literal[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.objects_literal[i])] = 1;
+
+	  if (iterator->compare->context_exists
+	      && B_TMAP_VALUE (tmap.contexts[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.contexts[i])] = 1;
+
+	  if (iterator->compare->datatype_exists
+	      && B_TMAP_VALUE (tmap.datatypes[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.datatypes[i])] = 1;
+
+	  if (iterator->compare->lang_exists
+	      && B_TMAP_VALUE (tmap.langs[i]) == B_TMAP_VALUE_EMPTY)
+	    tmap_results[B_TMAP_DATA (tmap.langs[i])] = 1;
 	}
 
 #define B_GET_FILE( x , y , n , e ) \
@@ -638,14 +635,12 @@
 		 sizeof(b_tmap_item_t) * n, SEEK_SET); \
       if (b_io_read (iterator->data->triples_io, &x, \
 		     sizeof (b_tmap_item_t)) <= 0) \
-	{ \
-	  return B_ERROR_INTERNAL; \
-	} \
+        return B_ERROR_INTERNAL; \
         \
       switch (b_hash_compare (x.hash, iterator->compare->x)) \
 	{ \
           case -1: \
-            for (j=0; j<B_TMAP_NUMB; j++) \
+            for (j = 0; j < B_TMAP_NUMB; j++) \
               { \
                 if (B_TMAP_VALUE (tmap.y[j]) != B_TMAP_VALUE_EMPTY) \
                   { \
@@ -657,7 +652,7 @@
             break; \
           \
           case 1: \
-            for (j=B_TMAP_NUMB-1; j>=0; j--) \
+            for (j = B_TMAP_NUMB-1; j >=0; j--) \
               { \
                 if (B_TMAP_VALUE (tmap.y[j]) != B_TMAP_VALUE_EMPTY) \
                   { \
@@ -692,8 +687,14 @@
 	  B_GET_FILE (datatype, datatypes, 7, datatype_exists);
 	  B_GET_FILE (lang, langs, 8, lang_exists);
 
+	  if (tmap_results[i])
+	    continue;
+
 	  if (!(c = (b_tcache_t *) calloc (1, sizeof (b_tcache_t))))
-	    return B_ERROR_MEMORY;
+	    {
+	      b_el_free (&iterator->results);
+	      return B_ERROR_MEMORY;
+	    }
 
 	  b_io_seek (iterator->data->triples_io,
 		     tmap_pointer + sizeof (b_tmap_t) + i * B_TRIPLE_SIZE,
@@ -704,6 +705,7 @@
 		 sizeof (b_tmap_item_t)) <= 0) \
     { \
       b_tcache_destroy_single (NULL, NULL, c); \
+      b_el_free (&iterator->results); \
       return B_ERROR_INTERNAL; \
     } \
   \
@@ -714,12 +716,14 @@
           != B_OK) \
 	{ \
           b_tcache_destroy_single (NULL, NULL, c); \
+	  b_el_free (&iterator->results); \
 	  return error; \
 	} \
       \
       if (!c->x) \
 	{ \
           b_tcache_destroy_single (NULL, NULL, c); \
+	  b_el_free (&iterator->results); \
 	  return B_ERROR_INTERNAL; \
 	} \
     }
@@ -734,8 +738,15 @@
 	  B_TRIPLE_POINTER2 (datatype, B_TYPE_DATATYPE);
 	  B_TRIPLE_POINTER2 (lang, B_TYPE_LITERAL);
 
-	  b_tcache_destroy_single (NULL, NULL, c);
+	  c->tmap_index = i;
+	  c->tmap_pointer = tmap_pointer;
 
+	  if ((error = b_el_new (c, &iterator->results)) != B_OK)
+	    {
+	      b_tcache_destroy_single (NULL, NULL, c);
+	      b_el_free (&iterator->results);
+	      return error;
+	    }
 	}
 
       if (iterator->results)