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 08:56:16 UTC

svn commit: r528394 [10/35] - in /incubator/triplesoup/donations/TRIPLES-3-RDFStore: ./ dbms/ dbms/client/ dbms/client/t/ dbms/dbmsproxy/ dbms/deamon/ dbms/doc/ dbms/include/ dbms/libdbms/ dbms/utils/ doc/ include/ lib/ lib/DBD/ lib/RDFStore/ lib/RDFSt...

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,75 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: backend_dbms_store.h,v 1.3 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_DBMS_STORE
+#define _H_DBMS_STORE
+
+extern backend_store_t * backend_dbms;
+#endif
+

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store_private.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store_private.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store_private.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_dbms_store_private.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,141 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: backend_dbms_store_private.h,v 1.4 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_BDB_STORE_PRIVATE
+#define _H_BDB_STORE_PRIVATE
+
+#include <sys/types.h>
+
+#if !defined(WIN32)
+#include <sys/param.h>
+#ifndef RDFSTORE_PLATFORM_SOLARIS	/* for SOLARIS */
+#include <sys/cdefs.h>
+#endif
+#endif
+
+#include <limits.h>
+
+#include <fcntl.h>
+
+#include "dbms.h"
+#include "dbms_compat.h"
+
+#define _flock( d,op ) {  \
+        int a=flock( (d->fd)(d),op | LOCK_NB ); \
+        if ((a<0) && ( errno == EWOULDBLOCK )) { \
+                /* printf("Wait..%d \n",getpid()); */ \
+                flock( (d->fd)(d),op); \
+                } else  \
+        if (a<0) {  \
+                perror("Locking trouble"); \
+                }; \
+        }
+
+#define lock_ro( d ) _flock( d, LOCK_SH )
+#define ulock_ro( d ) _flock( d, LOCK_UN )
+#define lock_rw( d ) _flock( d, LOCK_EX )
+#define ulock_rw( d ) _flock( d, LOCK_UN )
+
+#ifdef RDFSTORE_DEBUG
+#define D { printf("Me %s:%d\n",__FILE__,__LINE__); }
+#else
+#define D /* nope */
+#endif
+
+typedef struct dbms_store_rec {
+	dbms	* dbms;
+#ifdef DB_VERSION_MAJOR
+        DBC *   cursor ;
+#endif
+	char filename[ MAXPATHLEN ];
+
+	/* current error code */
+	char		err[256*2]; /* we will also have DBMS errors to include sometimes */
+
+	void * (* malloc)(size_t s);
+        void (* free)(void * adr);
+        void (* callback)(dbms_cause_t cause, int cnt);
+        void (* error)(char * err, int erx);
+#ifdef RDFSTORE_FLAT_STORE_DEBUG
+	int	num_store; /* some debug info */
+	int	num_fetch;
+	int	num_inc;
+	int	num_dec;
+	int	num_sync;
+	int	num_next;
+	int	num_from;
+	int	num_first;
+	int	num_delete;
+	int	num_clear;
+	int	num_exists;
+#endif
+} dbms_store_t;
+
+#endif
+

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_store.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_store.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_store.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/backend_store.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,141 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: backend_store.h,v 1.6 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_BACKEND_STORE
+#define _H_BACKEND_STORE
+
+typedef struct backend_store_struct {
+	const int api_version;
+	const char * name;
+	const int version;
+	rdfstore_flat_store_error_t (*open)(int remote, int ro, void * * mme, char * dir,
+			char * name, unsigned int local_hash_flags, char *          host, int             port,
+        		void *(*_my_malloc)( size_t size), void(*_my_free)(void *),
+			void(*_my_report)(dbms_cause_t cause, int count), void(*_my_error)(char * err, int erx),
+			int bt_compare_fcn_type
+		);
+	rdfstore_flat_store_error_t (*close) (void * me);
+	rdfstore_flat_store_error_t (*fetch) (void * me, DBT key, DBT * val);
+	rdfstore_flat_store_error_t (*fetch_compressed) (void * me, 
+		void(*func_decode)(unsigned int,unsigned char*, unsigned int *, unsigned char *),
+		DBT key, 
+		unsigned int * outsize, unsigned char * outchar);
+	rdfstore_flat_store_error_t (*store) (void * me, DBT key, DBT val);
+	rdfstore_flat_store_error_t (*store_compressed) (void * me, 
+		void(*func_encode)(unsigned int,unsigned char*, unsigned int *, unsigned char *),
+		DBT key, 
+		unsigned int, unsigned char *, 
+		unsigned char *);
+	rdfstore_flat_store_error_t (*exists) (void * me, DBT key); 
+	rdfstore_flat_store_error_t (*delete) (void * me, DBT key); 
+	rdfstore_flat_store_error_t (*sync) (void * me); 
+	rdfstore_flat_store_error_t (*clear) (void * me);
+	rdfstore_flat_store_error_t (*from) (void * me, DBT closest_key, DBT * key);
+	rdfstore_flat_store_error_t (*first) (void * me, DBT * first_key);
+	rdfstore_flat_store_error_t (*next) (void * me, DBT previous_key, DBT * next_key);
+	rdfstore_flat_store_error_t (*inc) (void * me, DBT key, DBT * new_value);
+	rdfstore_flat_store_error_t (*dec) (void * me, DBT key, DBT * new_value); 
+	void (*reset_debuginfo)( void * me );
+	void (*set_error)(void * me,  char * msg, rdfstore_flat_store_error_t erx);
+	char *(*get_error)(void * me);
+	DBT (*kvdup)( void * me, DBT data );
+	int (*isremote)(void * me);
+	} backend_store_t;
+
+#define API (2004111401)
+
+#define DECLARE_MODULE_BACKEND( prefix, name, version ) \
+backend_store_t prefix ## _module = { \
+	API,\
+	name, \
+	version, \
+	&prefix ## _open, \
+	&prefix ## _close, \
+	&prefix ## _fetch, \
+	&prefix ## _fetch_compressed, \
+	&prefix ## _store, \
+	&prefix ## _store_compressed, \
+	&prefix ## _exists, \
+	&prefix ## _delete, \
+	&prefix ## _sync, \
+	&prefix ## _clear, \
+	&prefix ## _from, \
+	&prefix ## _first, \
+	&prefix ## _next, \
+	&prefix ## _inc, \
+	&prefix ## _dec, \
+	&prefix ## _reset_debuginfo, \
+	&prefix ## _set_error, \
+	&prefix ## _get_error, \
+	&prefix ## _kvdup, \
+	&prefix ## _isremote \
+	}; \
+backend_store_t * prefix = & prefix ## _module;
+#endif
+

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/fraenkel_compress.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/fraenkel_compress.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/fraenkel_compress.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/fraenkel_compress.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,34 @@
+/*
+  *
+  *     Copyright (c) 2000-2006 Alberto Reggiori <ar...@webweaving.org>
+  *                        Dirk-Willem van Gulik <di...@webweaving.org>
+  *
+  * NOTICE
+  *
+  * This product is distributed under a BSD/ASF like license as described in the 'LICENSE'
+  * file you should have received together with this source code. If you did not get a
+  * a copy of such a license agreement you can pick up one at:
+  *
+  *     http://rdfstore.sourceforge.net/LICENSE
+  *
+  * $Id: fraenkel_compress.h,v 1.3 2006/06/19 10:10:23 areggiori Exp $
+  */
+
+#ifndef _FRAENKEL_COMPRESS_H
+#define _FRAENKEL_COMRPESS_H
+
+unsigned int 
+compress_fraenkel ( 
+	unsigned char * in, 
+	unsigned char * out,
+	unsigned int insize
+	); 
+
+unsigned int 
+expand_fraenkel ( 
+	unsigned char * in, 
+	unsigned char * out,
+	unsigned int insize
+	); 
+#endif
+

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/my_compress.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/my_compress.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/my_compress.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/my_compress.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,43 @@
+/*
+  *
+  *     Copyright (c) 2000-2006 Alberto Reggiori <ar...@webweaving.org>
+  *                        Dirk-Willem van Gulik <di...@webweaving.org>
+  *
+  * NOTICE
+  *
+  * This product is distributed under a BSD/ASF like license as described in the 'LICENSE'
+  * file you should have received together with this source code. If you did not get a
+  * a copy of such a license agreement you can pick up one at:
+  *
+  *     http://rdfstore.sourceforge.net/LICENSE
+  *
+  * $Id: my_compress.h,v 1.4 2006/06/19 10:10:23 areggiori Exp $
+  */
+
+#ifndef _MY_COMPRESS_H
+#define _MY_COMRPESS_H
+#define MAXBUFFRLE( bits ) ( \
+        bits/sizeof(unsigned int) +\
+        bits/sizeof(unsigned int)/15/256 \
+        )
+#define IDSBUFF (MAXBUFFRLE( RDFSTORE_MAXRECORDS )+2*sizeof(unsigned int))
+
+#define MAXRUNLENGTH 16*256*256*256 /* too high for average machine I know.... */
+#define MAXVARLENGTH 127 /* up to 127 bytes repeated - this value can be increased *up to* 127 - but watch out efficiency!! */
+#define OPTIMAL ( (double)1 / (double)10000 ) /* this is a "optimal" compression a vlen/len value should be */
+
+unsigned int 
+compress_mine ( 
+	unsigned char * in, 
+	unsigned char * out,
+	unsigned int insize
+	); 
+
+unsigned int 
+expand_mine ( 
+	unsigned char * in, 
+	unsigned char * out,
+	unsigned int insize
+	); 
+#endif
+

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/ppport.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/ppport.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/ppport.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/ppport.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,284 @@
+/* This file is Based on output from 
+ * Perl/Pollution/Portability Version 2.0000 
+ */
+/* $Id: ppport.h,v 1.2 2002/06/27 13:30:18 dirkx Exp $ */
+
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
+#ifndef PERL_REVISION
+#   ifndef __PATCHLEVEL_H_INCLUDED__
+#       include "patchlevel.h"
+#   endif
+#   ifndef PERL_REVISION
+#	define PERL_REVISION	(5)
+        /* Replace: 1 */
+#       define PERL_VERSION	PATCHLEVEL
+#       define PERL_SUBVERSION	SUBVERSION
+        /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+        /* Replace: 0 */
+#   endif
+#endif
+
+#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
+
+#ifndef ERRSV
+#	define ERRSV perl_get_sv("@",FALSE)
+#endif
+
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
+/* Replace: 1 */
+#	define PL_Sv		Sv
+#	define PL_compiling	compiling
+#	define PL_copline	copline
+#	define PL_curcop	curcop
+#	define PL_curstash	curstash
+#	define PL_defgv		defgv
+#	define PL_dirty		dirty
+#	define PL_hints		hints
+#	define PL_na		na
+#	define PL_perldb	perldb
+#	define PL_rsfp_filters	rsfp_filters
+#	define PL_rsfp		rsfp
+#	define PL_stdingv	stdingv
+#	define PL_sv_no		sv_no
+#	define PL_sv_undef	sv_undef
+#	define PL_sv_yes	sv_yes
+/* Replace: 0 */
+#endif
+
+#ifndef pTHX
+#    define pTHX
+#    define pTHX_
+#    define aTHX
+#    define aTHX_
+#endif         
+
+#ifndef PTR2IV
+#    define PTR2IV(d)   (IV)(d)
+#endif
+ 
+#ifndef INT2PTR
+#    define INT2PTR(any,d)      (any)(d)
+#endif
+
+#ifndef dTHR
+#  ifdef WIN32
+#	define dTHR extern int Perl___notused
+#  else
+#	define dTHR extern int errno
+#  endif
+#endif
+
+#ifndef boolSV
+#	define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
+#endif
+
+#ifndef gv_stashpvn
+#	define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
+#endif
+
+#ifndef newSVpvn
+#	define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
+#endif
+
+#ifndef newRV_inc
+/* Replace: 1 */
+#	define newRV_inc(sv) newRV(sv)
+/* Replace: 0 */
+#endif
+
+/* DEFSV appears first in 5.004_56 */
+#ifndef DEFSV
+#  define DEFSV	GvSV(PL_defgv)
+#endif
+
+#ifndef SAVE_DEFSV
+#    define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
+#endif
+
+#ifndef newRV_noinc
+#  ifdef __GNUC__
+#    define newRV_noinc(sv)               \
+      ({                                  \
+          SV *nsv = (SV*)newRV(sv);       \
+          SvREFCNT_dec(sv);               \
+          nsv;                            \
+      })
+#  else
+#    if defined(CRIPPLED_CC) || defined(USE_THREADS)
+static SV * newRV_noinc (SV * sv)
+{
+          SV *nsv = (SV*)newRV(sv);       
+          SvREFCNT_dec(sv);               
+          return nsv;                     
+}
+#    else
+#      define newRV_noinc(sv)    \
+        ((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
+#    endif
+#  endif
+#endif
+
+/* Provide: newCONSTSUB */
+
+/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))
+
+#if defined(NEED_newCONSTSUB)
+static
+#else
+extern void newCONSTSUB _((HV * stash, char * name, SV *sv));
+#endif
+
+#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
+void
+newCONSTSUB(stash,name,sv)
+HV *stash;
+char *name;
+SV *sv;
+{
+	U32 oldhints = PL_hints;
+	HV *old_cop_stash = PL_curcop->cop_stash;
+	HV *old_curstash = PL_curstash;
+	line_t oldline = PL_curcop->cop_line;
+	PL_curcop->cop_line = PL_copline;
+
+	PL_hints &= ~HINT_BLOCK_SCOPE;
+	if (stash)
+		PL_curstash = PL_curcop->cop_stash = stash;
+
+	newSUB(
+
+#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
+     /* before 5.003_22 */
+		start_subparse(),
+#else
+#  if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
+     /* 5.003_22 */
+     		start_subparse(0),
+#  else
+     /* 5.003_23  onwards */
+     		start_subparse(FALSE, 0),
+#  endif
+#endif
+
+		newSVOP(OP_CONST, 0, newSVpv(name,0)),
+		newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
+		newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+	);
+
+	PL_hints = oldhints;
+	PL_curcop->cop_stash = old_cop_stash;
+	PL_curstash = old_curstash;
+	PL_curcop->cop_line = oldline;
+}
+#endif
+
+#endif /* newCONSTSUB */
+
+
+#ifndef START_MY_CXT
+
+/*
+ * Boilerplate macros for initializing and accessing interpreter-local
+ * data from C.  All statics in extensions should be reworked to use
+ * this, if you want to make the extension thread-safe.  See ext/re/re.xs
+ * for an example of the use of these macros.
+ *
+ * Code that uses these macros is responsible for the following:
+ * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
+ * 2. Declare a typedef named my_cxt_t that is a structure that contains
+ *    all the data that needs to be interpreter-local.
+ * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
+ * 4. Use the MY_CXT_INIT macro such that it is called exactly once
+ *    (typically put in the BOOT: section).
+ * 5. Use the members of the my_cxt_t structure everywhere as
+ *    MY_CXT.member.
+ * 6. Use the dMY_CXT macro (a declaration) in all the functions that
+ *    access MY_CXT.
+ */
+
+#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
+    defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)
+
+/* This must appear in all extensions that define a my_cxt_t structure,
+ * right after the definition (i.e. at file scope).  The non-threads
+ * case below uses it to declare the data as static. */
+#define START_MY_CXT
+
+#if PERL_REVISION == 5 && \
+    (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
+/* Fetches the SV that keeps the per-interpreter data. */
+#define dMY_CXT_SV \
+	SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)
+#else /* >= perl5.004_68 */
+#define dMY_CXT_SV \
+	SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,		\
+				  sizeof(MY_CXT_KEY)-1, TRUE)
+#endif /* < perl5.004_68 */
+
+/* This declaration should be used within all functions that use the
+ * interpreter-local data. */
+#define dMY_CXT	\
+	dMY_CXT_SV;							\
+	my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
+
+/* Creates and zeroes the per-interpreter data.
+ * (We allocate my_cxtp in a Perl SV so that it will be released when
+ * the interpreter goes away.) */
+#define MY_CXT_INIT \
+	dMY_CXT_SV;							\
+	/* newSV() allocates one more than needed */			\
+	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
+	Zero(my_cxtp, 1, my_cxt_t);					\
+	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+
+/* This macro must be used to access members of the my_cxt_t structure.
+ * e.g. MYCXT.some_data */
+#define MY_CXT		(*my_cxtp)
+
+/* Judicious use of these macros can reduce the number of times dMY_CXT
+ * is used.  Use is similar to pTHX, aTHX etc. */
+#define pMY_CXT		my_cxt_t *my_cxtp
+#define pMY_CXT_	pMY_CXT,
+#define _pMY_CXT	,pMY_CXT
+#define aMY_CXT		my_cxtp
+#define aMY_CXT_	aMY_CXT,
+#define _aMY_CXT	,aMY_CXT
+
+#else /* single interpreter */
+
+#ifndef NOOP
+#  define NOOP (void)0
+#endif
+
+#ifdef HASATTRIBUTE
+#  define PERL_UNUSED_DECL __attribute__((unused))
+#else
+#  define PERL_UNUSED_DECL
+#endif    
+
+#ifndef dNOOP
+#  define dNOOP extern int Perl___notused PERL_UNUSED_DECL
+#endif
+
+#define START_MY_CXT	static my_cxt_t my_cxt;
+#define dMY_CXT_SV	dNOOP
+#define dMY_CXT		dNOOP
+#define MY_CXT_INIT	NOOP
+#define MY_CXT		my_cxt
+
+#define pMY_CXT		void
+#define pMY_CXT_
+#define _pMY_CXT
+#define aMY_CXT
+#define aMY_CXT_
+#define _aMY_CXT
+
+#endif 
+
+#endif /* START_MY_CXT */
+
+
+#endif /* _P_P_PORTABILITY_H_ */

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/ppport.h
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,488 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore.h,v 1.48 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE
+#define _H_RDFSTORE
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <dbms.h>
+
+#ifdef SUNOS4
+double strtod();                /* SunOS needed this */
+#endif
+
+#include "rdfstore_flat_store.h"
+#include "rdfstore_compress.h"
+
+#define RDFSTORE_MAX_URI_LENGTH		MAXPATHLEN		/* not sure here - a URI can be longer probably */
+#define RDFSTORE_WORD_SPLITS		"\v\f\n\r\t ,:;'\"!#$%^&*()~`_=+{}[]<>?.-/\\|"	/* for free-text stuff */
+#define RDFSTORE_RDF_PARSETYPE_LITERAL	"http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"
+#define RDFSTORE_MAX_LANG_LENGTH	50			/* not sure here - a URI can be longer probably */
+
+#ifndef RDFSTORE_WORD_STEMMING
+#define RDFSTORE_WORD_STEMMING		(5) /* up to 5 chars from start or end of word */
+#endif
+
+#if (! defined(RDFSTORE_MAXRECORDS)) || (RDFSTORE_MAXRECORDS < 128)
+#define RDFSTORE_MAXRECORDS (2097152)
+#endif
+
+#define RDFSTORE_RECORDS_PER_BYTE	8
+#define RDFSTORE_MAXRECORDS_BYTES_SIZE  ( RDFSTORE_MAXRECORDS / RDFSTORE_RECORDS_PER_BYTE ) /* one bit per statement */
+
+#define RDFSTORE_MAX_FETCH_OBJECT_DEEPNESS	20	/* max levels to visit when return "coincise bounded description of a resource" */
+
+#define RDFSTORE_INDEXING_VERSION	"20041222"	/* which is even more modern than the SWAD-e paper one */
+
+/* very basic data types */
+
+typedef uint32_t	rdf_store_digest_t;		/* Hash Code */
+typedef dbms_counter	rdf_store_counter_t;		/* Counter type */
+
+#define RDFSTORE_NODE_TYPE_RESOURCE  0
+#define RDFSTORE_NODE_TYPE_LITERAL   1
+#define RDFSTORE_NODE_TYPE_BNODE     2
+
+#define RDFSTORE_PARSE_TYPE_NORMAL   0
+#define RDFSTORE_PARSE_TYPE_LITERAL  1
+
+typedef struct RDF_Node {
+        int	type; /* 0=resource, 1=literal and 2=bNode */
+	union { 
+        	struct {
+                	unsigned char    * identifier; /* uri or nodeID */
+			int	identifier_len;
+                	} resource;
+        	struct {
+                	unsigned char    * string;
+			int	string_len;
+                	int     parseType; /* 0=Resource 1=Literal i.e. XML */
+                	unsigned char    lang[RDFSTORE_MAX_LANG_LENGTH];
+                	unsigned char    * dataType; /* XMLSchema URI ref to the data type for the literal */
+                	} literal;
+        	} value;
+	rdf_store_digest_t hashcode;  /* see digest.c for details */
+	struct rdfstore	* model; /* for resource centric API ala Jena */
+        } RDF_Node;
+
+typedef struct RDF_Statement {
+        RDF_Node * subject;
+        RDF_Node * predicate;
+        RDF_Node * object;
+        RDF_Node * context;
+        RDF_Node * node; /* this represent a statement which is actually an RDF resource i.e. reification stuff */
+	rdf_store_digest_t	hashcode;  /* see digest.c for details */
+	int	isreified;	/* 0=stated 1=quoted ( should this be related to the above value union resource thingie??? ) */
+	struct rdfstore	* model; /* for resource centric API ala Jena */
+        } RDF_Statement;
+
+/* triple search pattern - quite generic with s,p,o and context (c) with free-text AND/OR/NOT words */
+#define RDFSTORE_TRIPLE_PATTERN_PART_RESOURCE_NODE   2000
+#define RDFSTORE_TRIPLE_PATTERN_PART_LITERAL_NODE    2001
+#define RDFSTORE_TRIPLE_PATTERN_PART_STRING          2002
+typedef struct RDF_Triple_Pattern_Part {
+	int type; /* RDFSTORE_TRIPLE_PATTERN_PART_RESOURCE_NODE, RDFSTORE_TRIPLE_PATTERN_PART_LITERAL_NODE or RDFSTORE_TRIPLE_PATTERN_PART_STRING */
+	union { 
+        	RDF_Node * node;
+                unsigned char * string;
+        	} part;
+	struct RDF_Triple_Pattern_Part * next;
+	} RDF_Triple_Pattern_Part;
+
+typedef struct RDF_Triple_Pattern {
+        struct RDF_Triple_Pattern_Part * subjects; /* OR space seprated URIs */
+	unsigned int subjects_operator; /* 0=OR 1=AND 2=NOT */
+        struct RDF_Triple_Pattern_Part * predicates;
+	unsigned int predicates_operator;
+        struct RDF_Triple_Pattern_Part * objects;
+	unsigned int objects_operator;
+        struct RDF_Triple_Pattern_Part * contexts;
+	unsigned int contexts_operator;
+        struct RDF_Triple_Pattern_Part * langs;
+	unsigned int langs_operator;
+        struct RDF_Triple_Pattern_Part * dts;
+	unsigned int dts_operator;
+        struct RDF_Triple_Pattern_Part * words;
+	unsigned int words_operator;
+        struct RDF_Triple_Pattern_Part * ranges;
+	unsigned int ranges_operator; /*	One axe ranges (considering first element from ranges linked list):
+	
+						1 = x <  22.34
+						2 = x <= .45
+						3 = x == 23.45
+						4 = x != 23.45
+						5 = x >= .748748
+						6 = x >  .0002 
+
+						Two axes ranges (considering first 2 elements from ranges linked list):
+
+						7  = 21.23 < x < 22.34     i.e. x >  21.23  &&  x <  22.34
+						8  = 21.23 <= x < 22.34    i.e. x >= 21.23  &&  x <  22.34
+						9  = 21.23 <= x <= 22.34   i.e. x >= 21.33  &&  x <= 22.34
+						10 = 21.23 < x <= 22.34    i.e. x >  21.33  &&  x <= 22.34
+
+						Values in ranges are euristacally parsed either to a long or double; and xsd_integer or xsd_double
+						special tables (b-trees) are used to answer the range question. If the RDF literal has an rdf:datatype
+						of xsd:date or xsd:dateTime, such range operations can be carried out on dataes using the xsd_date table.
+
+						*/
+        } RDF_Triple_Pattern;
+
+#include "rdfstore_digest.h"
+#include "rdfstore_iterator.h"
+
+typedef struct rdfstore {
+	int	flag;
+	int	freetext;
+	int	sync;
+	FLATDB	* model;
+	FLATDB	* statements;
+	FLATDB	* nodes;
+	FLATDB	* subjects;
+	FLATDB	* predicates;
+	FLATDB	* objects;
+	FLATDB	* contexts;
+	FLATDB	* languages; /* not used: but would index xml:lang into literals */
+	FLATDB	* datatypes; /* not used: but would index rdf:dataType into literals */
+	FLATDB	* s_connections;
+	FLATDB	* p_connections;
+	FLATDB	* o_connections;
+	FLATDB	* windex;
+	FLATDB	* xsd_integer; /* xsd:integer */
+	FLATDB	* xsd_double; /* xsd:float or xsd:double special one */
+	FLATDB	* xsd_date; /* xsd:date or xsd:dateTime */
+	int	remote;
+	int	port;
+	RDF_Node * context; /* default context/statement-group stuff */
+        struct rdfstore_iterator * cursor;
+	int	attached; /* the number of items (cursors) currenlty attached */
+	int	tobeclosed; /* set to 1 means that the iterator attached has to close the storage itself */
+	char	version[10];
+
+	char	host[ MAXPATHLEN ];
+        char	uri[ RDFSTORE_MAX_URI_LENGTH ]; /* source URI */
+	char	name[ MAXPATHLEN ];
+
+	unsigned char bits_encode[RDFSTORE_MAXRECORDS_BYTES_SIZE]; /* buffers for compression and decompression */
+        unsigned char bits_decode[RDFSTORE_MAXRECORDS_BYTES_SIZE];
+
+	/* Functions for encoding/decoding - MUST match */
+        void(*func_encode)(unsigned int,unsigned char*, unsigned int *, unsigned char *);
+        void(*func_decode)(unsigned int,unsigned char*, unsigned int *, unsigned char *);
+	/* special ones for o_connections table - generally different compression algorithm from the above default one */
+        void(*func_encode_connections)(unsigned int,unsigned char*, unsigned int *, unsigned char *);
+        void(*func_decode_connections)(unsigned int,unsigned char*, unsigned int *, unsigned char *);
+	FLATDB	* prefixes; /* prefix mapping stuff - generally in-memory and default loaded on creation, otherwise could be persistent too */
+	} rdfstore;
+
+
+/* RDFStore core types API */
+
+RDF_Node * rdfstore_node_new();
+RDF_Node * rdfstore_node_clone( RDF_Node * node );
+int rdfstore_node_set_type( RDF_Node * node, int type );
+int rdfstore_node_get_type( RDF_Node * node );
+unsigned char * rdfstore_node_get_label( RDF_Node * node, int * len );
+unsigned char * rdfstore_node_to_string( RDF_Node * node, int * len );
+unsigned char * rdfstore_node_get_digest( RDF_Node * node, int * len );
+int rdfstore_node_equals( RDF_Node * node1, RDF_Node * node2 );
+int rdfstore_node_free( RDF_Node * node );
+void rdfstore_node_dump( RDF_Node * node );
+int rdfstore_node_set_model( RDF_Node * node, rdfstore * model ); /* for resource centric API ala Jena */
+int rdfstore_node_reset_model( RDF_Node * node );
+rdfstore * rdfstore_node_get_model( RDF_Node * node );
+
+/* RDF literals */
+
+RDF_Node * rdfstore_literal_new( unsigned char * string, int len, int parseType, unsigned char * lang, unsigned char * dt );
+RDF_Node * rdfstore_literal_clone( RDF_Node * node );
+unsigned char *  rdfstore_literal_get_label( RDF_Node * node, int * len );
+unsigned char * rdfstore_literal_to_string( RDF_Node * node, int * len );
+unsigned char * rdfstore_literal_get_digest( RDF_Node * node, int * len );
+int rdfstore_literal_equals( RDF_Node * node1, RDF_Node * node2 );
+int rdfstore_literal_set_string( RDF_Node * node, unsigned char * string, int len );
+int rdfstore_literal_set_lang( RDF_Node * node, unsigned char * lang );
+unsigned char * rdfstore_literal_get_lang( RDF_Node * node );
+int rdfstore_literal_set_datatype( RDF_Node * node, unsigned char * dt );
+unsigned char * rdfstore_literal_get_datatype( RDF_Node * node );
+int rdfstore_literal_set_parsetype( RDF_Node * node, int parseType );
+int rdfstore_literal_get_parsetype( RDF_Node * node );
+int rdfstore_literal_free( RDF_Node * node );
+void rdfstore_literal_dump( RDF_Node * node );
+int rdfstore_literal_set_model( RDF_Node * node, rdfstore * model ); /* for resource centric API ala Jena */
+int rdfstore_literal_reset_model( RDF_Node * node );
+rdfstore * rdfstore_literal_get_model( RDF_Node * node );
+
+/* RDF resources (URIs and bNodes) */
+
+RDF_Node * rdfstore_resource_new( unsigned char * identifier, int len, int type );
+RDF_Node * rdfstore_resource_new_from_qname( unsigned char * namespace, int nsl, unsigned char * localname, int lnl, int type );
+RDF_Node * rdfstore_resource_clone( RDF_Node * node );
+unsigned char * rdfstore_resource_get_label( RDF_Node * node, int * len );
+unsigned char * rdfstore_resource_to_string( RDF_Node * node, int * len );
+unsigned char * rdfstore_resource_get_digest( RDF_Node * node, int * len );
+int rdfstore_resource_equals( RDF_Node * node1, RDF_Node * node2 );
+int rdfstore_resource_set_uri( RDF_Node * node, unsigned char * identifier, int len );
+unsigned char * rdfstore_resource_get_uri( RDF_Node * node, int * len );
+int rdfstore_resource_is_anonymous( RDF_Node * node );
+int rdfstore_resource_is_bnode( RDF_Node * node );
+unsigned char * rdfstore_resource_get_namespace( RDF_Node * node, int * len );
+unsigned char * rdfstore_resource_get_localname( RDF_Node * node, int * len );
+unsigned char * rdfstore_resource_get_bnode( RDF_Node * node, int * len );
+unsigned char * rdfstore_resource_get_nodeid( RDF_Node * node, int * len );
+int rdfstore_resource_free( RDF_Node * node );
+void rdfstore_resource_dump( RDF_Node * node );
+int rdfstore_resource_set_model( RDF_Node * node, rdfstore * model ); /* for resource centric API ala Jena */
+int rdfstore_resource_reset_model( RDF_Node * node );
+rdfstore * rdfstore_resource_get_model( RDF_Node * node );
+
+/* RDF statements */
+
+RDF_Statement * rdfstore_statement_new( RDF_Node * s, RDF_Node * p, RDF_Node * o, RDF_Node * c, RDF_Node * node, int isreified );
+RDF_Statement * rdfstore_statement_clone( RDF_Statement * st );
+unsigned char * rdfstore_statement_get_label( RDF_Statement * st, int * len );
+unsigned char * rdfstore_statement_to_string( RDF_Statement * st, int * len );
+unsigned char * rdfstore_statement_get_digest( RDF_Statement * st, int * len );
+int rdfstore_statement_equals( RDF_Statement * st1, RDF_Statement * st2 );
+int rdfstore_statement_isreified( RDF_Statement * st );
+RDF_Node * rdfstore_statement_get_subject( RDF_Statement * st );
+int rdfstore_statement_set_subject( RDF_Statement * st, RDF_Node * s );
+RDF_Node * rdfstore_statement_get_predicate( RDF_Statement * st );
+int rdfstore_statement_set_predicate( RDF_Statement * st, RDF_Node * p );
+RDF_Node * rdfstore_statement_get_object( RDF_Statement * st );
+int rdfstore_statement_set_object( RDF_Statement * st, RDF_Node * o );
+RDF_Node * rdfstore_statement_get_context( RDF_Statement * st );
+int rdfstore_statement_set_context( RDF_Statement * st, RDF_Node * c );
+RDF_Node * rdfstore_statement_get_node( RDF_Statement * st );
+int rdfstore_statement_set_node( RDF_Statement * st, RDF_Node * node );
+int rdfstore_statement_free( RDF_Statement * st );
+void rdfstore_statement_dump( RDF_Statement * st );
+int rdfstore_statement_set_model( RDF_Statement * st, rdfstore * model ); /* for resource centric API ala Jena */
+int rdfstore_statement_reset_model( RDF_Statement * st );
+rdfstore * rdfstore_statement_get_model( RDF_Statement * st );
+
+/* RDF_Triple_Pattern related */
+RDF_Triple_Pattern * rdfstore_triple_pattern_new();
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_subject( RDF_Triple_Pattern * tp, RDF_Node * node );
+int rdfstore_triple_pattern_set_subjects_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_predicate( RDF_Triple_Pattern * tp, RDF_Node * node );
+int rdfstore_triple_pattern_set_predicates_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_object( RDF_Triple_Pattern * tp, RDF_Node * node );
+int rdfstore_triple_pattern_set_objects_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_context( RDF_Triple_Pattern * tp, RDF_Node * node );
+int rdfstore_triple_pattern_set_contexts_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_lang( RDF_Triple_Pattern * tp, char * lang );
+int rdfstore_triple_pattern_set_langs_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_datatype( RDF_Triple_Pattern * tp, char * dt, int len );
+int rdfstore_triple_pattern_set_datatypes_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_word( RDF_Triple_Pattern * tp, unsigned char * word, int len );
+int rdfstore_triple_pattern_set_words_operator( RDF_Triple_Pattern * tp, int op );
+RDF_Triple_Pattern_Part * rdfstore_triple_pattern_add_ranges( RDF_Triple_Pattern * tp, char * num, int len ); /* always do strtol() or strtod() on it */
+int rdfstore_triple_pattern_set_ranges_operator( RDF_Triple_Pattern * tp, int op );
+int rdfstore_triple_pattern_free( RDF_Triple_Pattern * tp );
+void rdfstore_triple_pattern_dump( RDF_Triple_Pattern * tp );
+
+/* RDFStore itself API */
+int
+rdfstore_connect (
+	rdfstore * *	me,
+        char *          name,
+        int             flags,
+	int             freetext,
+        int             sync,
+        int             remote,
+        char *          host,
+        int             port,
+	/* Callbacks for memory management and error handling. */
+	void * (* malloc)(size_t s),
+        void (* free)(void * adr),
+        void (* callback)(dbms_cause_t cause, int cnt),
+        void (* error)(char * err, int erx)
+	);
+
+char * rdfstore_get_version (
+	rdfstore * me
+	);
+
+int rdfstore_disconnect (
+	rdfstore * me
+	);
+
+int rdfstore_isconnected (
+	rdfstore * me
+	);
+
+int rdfstore_isremote (
+	rdfstore * me
+	);
+
+int rdfstore_if_modified_since (
+        char * name,
+        char * since,
+        /* Callbacks for memory management and error handling. */
+        void *(*_mmalloc) (size_t s),
+        void (*_mfree) (void *adr),
+        void (*_mcallback) (dbms_cause_t cause, int cnt),
+        void (*_merror) (char *err, int erx) 
+        );
+
+int rdfstore_size ( 
+	rdfstore 	* me,
+	unsigned int	* size
+	);
+
+int rdfstore_contains ( 
+        rdfstore        * me,
+        RDF_Statement   * statement,
+	RDF_Node	* given_context
+        );
+
+int rdfstore_insert ( 
+        rdfstore        * me,
+        RDF_Statement   * statement,
+	RDF_Node	* given_context
+        );
+
+int rdfstore_remove ( 
+        rdfstore        * me,
+        RDF_Statement   * statement,
+	RDF_Node	* given_context
+        );
+
+int rdfstore_set_context ( 
+        rdfstore        * me,
+	RDF_Node	* given_context
+        );
+
+int rdfstore_reset_context ( 
+        rdfstore        * me
+        );
+
+RDF_Node *
+rdfstore_get_context (
+        rdfstore        * me
+        );
+
+int rdfstore_set_source_uri (
+        rdfstore        * me,
+        char            * uri
+        );
+
+int rdfstore_get_source_uri (
+        rdfstore        * me,
+        char            * uri
+        );
+
+int rdfstore_is_empty (
+        rdfstore        * me
+        );
+
+/* return iterator over the result set (even empty if no results) */
+rdfstore_iterator *
+rdfstore_search (
+        rdfstore        * me,
+	RDF_Triple_Pattern * tp,
+	int	search_type /*	0=main indexes (subjects, predicates, objects tables)
+				1=RDQL indexes (s_connections, p_connections, o_connections tables) */
+        );
+
+rdfstore_iterator *
+rdfstore_fetch_object(
+	rdfstore * me,
+        RDF_Node * resource,
+        RDF_Node * given_context
+	);
+
+/* return iterator over the whole model content - we could eventually specify a context then it becomes a search in context.... */
+rdfstore_iterator *
+rdfstore_elements (
+        rdfstore        * me
+        );
+
+/* Special keys with a special meaning.  - should be longer than 4 bytes to
+ * make sure they do not match a unsigned int.
+ */
+#define RDFSTORE_INDEXING_VERSION_KEY 	("indexing_version")
+#define RDFSTORE_COUNTER_KEY 		("counter")
+#define RDFSTORE_COUNTER_REMOVED_KEY 	("counter_removed")
+#define RDFSTORE_FREETEXT_KEY 		("freetext")
+#define RDFSTORE_NAME_KEY 		("name")
+#define RDFSTORE_COMPRESSION_KEY 	("compression")
+#define RDFSTORE_COMPRESSION_CONNECTIONS_KEY 	("compression_connections")
+#define RDFSTORE_LASTMODIFIED_KEY 	("last_modified")
+
+#if 0
+void packInt(uint32_t value, unsigned char *lookup);
+void unpackInt(unsigned char *value, uint32_t *lookup);
+#else
+#define packInt(value,buffer) { assert(sizeof((value)) == sizeof(uint32_t)); *(uint32_t *)(buffer)=htonl((value)); }
+#define unpackInt(buffer,value) { *(value) = ntohl(*(uint32_t *)(buffer)); }
+#endif
+#endif

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_ap_sha1.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_ap_sha1.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_ap_sha1.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_ap_sha1.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,107 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ *    not be used to endorse or promote products derived from this
+ *    software without prior written permission. For written
+ *    permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    nor may "Apache" appear in their name, without prior written
+ *    permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * Portions of this software are based upon public domain software
+ * originally written at the National Center for Supercomputing Applications,
+ * University of Illinois, Urbana-Champaign.
+ * 
+ * $Id: rdfstore_ap_sha1.h,v 1.1 2003/05/05 17:57:43 areggiori Exp $
+ */
+
+/*
+ * NIST Secure Hash Algorithm
+ * 	heavily modified by Uwe Hollerbach uh@alumni.caltech edu
+ * 	from Peter C. Gutmann's implementation as found in
+ * 	Applied Cryptography by Bruce Schneier
+ * 	This code is hereby placed in the public domain
+ */
+
+#ifndef RDFSTORE_APACHE_SHA1_H
+#define RDFSTORE_APACHE_SHA1_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RDFSTORE_SHA_DIGESTSIZE 20
+
+/*
+ * Define the Magic String prefix that identifies a password as being
+ * hashed using our algorithm.
+ */
+#define RDFSTORE_AP_SHA1PW_ID "{SHA}"
+#define RDFSTORE_AP_SHA1PW_IDLEN 5
+
+typedef unsigned long RDFSTORE_AP_LONG;     /* a 32-bit quantity */
+
+typedef struct {
+    RDFSTORE_AP_LONG digest[5];             /* message digest */
+    RDFSTORE_AP_LONG count_lo, count_hi;    /* 64-bit bit count */
+    RDFSTORE_AP_LONG data[16];              /* SHA data buffer */
+    int local;                     /* unprocessed amount in data */
+} RDFSTORE_AP_SHA1_CTX;
+
+void rdfstore_ap_SHA1Init(RDFSTORE_AP_SHA1_CTX *context);
+void rdfstore_ap_SHA1Update(RDFSTORE_AP_SHA1_CTX *context, const char *input,
+			       unsigned int inputLen);
+void rdfstore_ap_SHA1Update_binary(RDFSTORE_AP_SHA1_CTX *context,
+				      const unsigned char *input,
+				      unsigned int inputLen);
+void rdfstore_ap_SHA1Final(unsigned char digest[RDFSTORE_SHA_DIGESTSIZE],
+                              RDFSTORE_AP_SHA1_CTX *context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* !RDFSTORE_APACHE_SHA1_H */

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_bits.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_bits.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_bits.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_bits.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,154 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore_bits.h,v 1.9 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE_BITS
+#define _H_RDFSTORE_BITS
+
+#include <assert.h>
+#include "rdfstore_compress.h"
+
+#define MAXBITBYTE (RDFSTORE_MAXRECORDS_BYTES_SIZE)
+#define STEP 16 /* bytes per increase */
+
+typedef struct bitseq {
+        int     size;
+        unsigned char bits[MAXBITBYTE];
+        } bitseq;
+
+int rdfstore_bits_setmask( 
+	unsigned int  * len,
+	unsigned char * bits,
+	unsigned int at, 
+	unsigned int mask,
+	unsigned int value,
+	unsigned int maxlen
+);
+
+int rdfstore_bits_isanyset ( 
+	unsigned int  * len,
+	unsigned char * bits,
+	unsigned int * at, 
+	unsigned char mask
+	);
+
+unsigned int 
+rdfstore_bits_getfirstrecord (
+        unsigned int size,      /* in bytes */
+        unsigned char * bits,   /* bit array */
+        unsigned int at,        /* as record no (bits/4) */
+        unsigned char mask      /* 0000 to 1111 */
+);
+
+unsigned int rdfstore_bits_getfirstsetafter (
+        unsigned int size,
+        unsigned char * bits,
+        unsigned int at
+);
+
+unsigned int rdfstore_bits_exor (
+        unsigned int la, unsigned char * ba,
+        unsigned int lb, unsigned char * bb,
+        unsigned char * bc
+        );
+unsigned int rdfstore_bits_or (
+        unsigned int la, unsigned char * ba,
+        unsigned int lb, unsigned char * bb,
+        unsigned char * bc
+        );
+unsigned int rdfstore_bits_and (
+        unsigned int la, unsigned char * ba,
+        unsigned int lb, unsigned char * bb,
+        unsigned char * bc
+        );
+unsigned int rdfstore_bits_not (
+        unsigned int la, unsigned char * ba,
+        unsigned char * bb
+        );
+
+unsigned int rdfstore_bits_shorten (
+        unsigned int la, unsigned char * ba
+	);
+
+unsigned int rdfstore_bits_and2(
+        int n,
+        unsigned int la, unsigned char * ba,
+        unsigned int lb, unsigned char * bb,
+        unsigned char mask,
+        unsigned char * bc
+        );
+
+unsigned int rdfstore_bits_or2( 
+        int n,
+        unsigned int la, unsigned char * ba,
+        unsigned int lb, unsigned char * bb,
+        unsigned char mask,
+        unsigned char * bc
+        );
+
+#endif

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_compress.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_compress.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_compress.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_compress.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,92 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore_compress.h,v 1.7 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE_COMPRESS
+#define _H_RDFSTORE_COMPRESS
+
+#include "rdfstore.h"
+
+typedef enum {
+        RDFSTORE_COMPRESSION_TYPE_NONE=1,
+        RDFSTORE_COMPRESSION_TYPE_NULLS,
+        RDFSTORE_COMPRESSION_TYPE_BITS,
+        RDFSTORE_COMPRESSION_TYPE_BLOCK,
+        RDFSTORE_COMPRESSION_TYPE_RLE,
+        RDFSTORE_COMPRESSION_TYPE_FRAENKEL,
+        RDFSTORE_COMPRESSION_TYPE_ORIGINAL,
+        RDFSTORE_COMPRESSION_TYPE_DEFAULT
+} rdfstore_compression_types;
+
+int rdfstore_compress_init(
+        rdfstore_compression_types type,
+        void(**func_encode)(unsigned int,unsigned char*, unsigned int *, unsigned char *),
+        void(**func_decode)(unsigned int,unsigned char*, unsigned int *, unsigned char *)
+);
+#endif 
+

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_digest.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_digest.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_digest.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_digest.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,88 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore_digest.h,v 1.9 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE_DIGEST
+#define _H_RDFSTORE_DIGEST
+
+#include "rdfstore_ap_sha1.h"
+#include "rdfstore.h"
+
+int rdfstore_digest_digest ( unsigned char * input, int len, unsigned char digest[RDFSTORE_SHA_DIGESTSIZE] );
+
+const char * rdfstore_digest_get_digest_algorithm ( );
+
+int rdfstore_digest_get_node_digest(RDF_Node * node, unsigned char dd[RDFSTORE_SHA_DIGESTSIZE], int unique );
+
+rdf_store_digest_t rdfstore_digest_get_node_hashCode ( RDF_Node * node, int unique );
+
+int rdfstore_digest_get_statement_digest ( RDF_Statement * statement, RDF_Node * given_context, unsigned char dd[RDFSTORE_SHA_DIGESTSIZE] );
+
+rdf_store_digest_t rdfstore_digest_get_statement_hashCode ( RDF_Statement * statement, RDF_Node * given_context );
+
+#endif

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,225 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore_flat_store.h,v 1.8 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE_FLATSTORE
+#define _H_RDFSTORE_FLATSTORE
+
+/* Note that this structure is private */
+typedef struct __flatdb FLATDB;
+
+/* flat_store error management */
+typedef int rdfstore_flat_store_error_t;
+
+/* error codes */
+#define FLAT_STORE_E_UNDEF            2000
+#define FLAT_STORE_E_NONNUL           2001
+#define FLAT_STORE_E_NOMEM            2002
+#define FLAT_STORE_E_NOPE             2003
+#define FLAT_STORE_E_KEYEMPTY         2004
+#define FLAT_STORE_E_KEYEXIST         2005
+#define FLAT_STORE_E_NOTFOUND         2006
+#define FLAT_STORE_E_OLD_VERSION      2007
+#define FLAT_STORE_E_DBMS             2008
+#define FLAT_STORE_E_CANNOTOPEN       2009
+#define FLAT_STORE_E_BUG              2010
+
+#define FLAT_STORE_BT_COMP_INT	      7000
+#define FLAT_STORE_BT_COMP_DOUBLE     7001
+#define FLAT_STORE_BT_COMP_DATE	      7002 /* not implemented yet */
+
+#ifdef RDFSTORE_FLAT_STORE_DEBUG
+void rdfstore_flat_store_reset_debuginfo( FLATDB * me );
+#endif
+
+void rdfstore_flat_store_set_error(FLATDB * me,  char * msg, rdfstore_flat_store_error_t erx);
+char * rdfstore_flat_store_get_error(FLATDB * me);
+
+DBT rdfstore_flat_store_kvdup( FLATDB * me, DBT data );
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_open ( 
+	int remote,
+	int ro,
+	FLATDB * * mme,
+	char * dir,
+	char * name,
+	unsigned int local_hash_flags,
+	char *          host,
+        int             port,
+	/* OPTIONAL functions to pass free/malloc and
+	 * a warning/error report 
+    	 */
+        void *(*_my_malloc)( size_t size),
+        void(*_my_free)(void *),
+        void(*_my_report)(dbms_cause_t cause, int count),
+        void(*_my_error)(char * err, int erx),
+	int bt_compare_fcn_type
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_close ( 
+	FLATDB * me
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_fetch (
+	FLATDB * me,
+	DBT 	key,
+	DBT    * val
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_fetch_compressed (
+	FLATDB * me,
+        void(*func_decode)(unsigned int,unsigned char*, unsigned int *, unsigned char *),
+	DBT 	key,
+	unsigned int * outsize, unsigned char * outchar
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_store (
+	FLATDB * me,
+	DBT 	key,
+	DBT 	val
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_store_compressed (
+	FLATDB * me,
+        void(*func_encode)(unsigned int,unsigned char*, unsigned int *, unsigned char *),
+	DBT 	key,
+	unsigned int insize, unsigned char * inchar,
+	unsigned char * buff
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_exists (
+	FLATDB * me,
+	DBT 	key
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_delete (
+	FLATDB * me,
+	DBT 	key
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_sync (
+	FLATDB * me
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_clear (
+	FLATDB * me
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_from(
+	FLATDB * me,
+	DBT closest_key,
+	DBT * key
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_first (
+	FLATDB * me,
+	DBT    * first_key
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_next (
+	FLATDB * me,
+	DBT 	previous_key,
+	DBT    * next_key
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_inc (
+	FLATDB * me,
+	DBT 	key,
+	DBT    * new_value
+	);
+
+rdfstore_flat_store_error_t
+rdfstore_flat_store_dec (
+	FLATDB * me,
+	DBT 	key,
+	DBT    * new_value
+	);
+#endif
+
+int
+rdfstore_flat_store_isremote(
+	FLATDB * me
+);
+
+#ifndef MIN
+#define MIN(a,b) ( (a)>(b) ? (b) : (a) )
+#endif

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store_private.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store_private.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store_private.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_flat_store_private.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,79 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore_flat_store_private.h,v 1.3 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE_FLATSTORE_PRIVATE
+#define _H_RDFSTORE_FLATSTORE_PRIVATE
+
+struct __flatdb {
+	backend_store_t * store;		/* Functions of the backend store. */
+	void * instance;			/* Instance of a certain backend for a specific DB */
+        void (* free)(void * adr);		
+	};
+
+#endif

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_iterator.h
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_iterator.h?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_iterator.h (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/include/rdfstore_iterator.h Fri Apr 13 01:56:01 2007
@@ -0,0 +1,245 @@
+/*
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+#
+# $Id: rdfstore_iterator.h,v 1.6 2006/06/19 10:10:23 areggiori Exp $
+#
+*/
+
+#ifndef _H_RDFSTORE_ITERATOR
+#define _H_RDFSTORE_ITERATOR
+
+#include "rdfstore.h"
+#include "rdfstore_compress.h"
+
+typedef struct rdfstore_iterator {
+        struct rdfstore * store;
+        unsigned int size; /* num of statements i.e. number of bits set in ids[] below */
+        unsigned char ids[RDFSTORE_MAXRECORDS_BYTES_SIZE]; /* keep the set of statements for search iterators i.e. bit vector 1 bit per statement */
+        unsigned int ids_size; /* its size in bytes also */
+        unsigned int remove_holes;
+        unsigned int st_counter;
+        unsigned int    pos;
+        } rdfstore_iterator;
+
+typedef rdfstore_iterator * RDFStore_Iterator;
+
+/* dispose iterator */
+int rdfstore_iterator_close (
+	rdfstore_iterator * me
+        );
+
+int rdfstore_iterator_hasnext (
+        rdfstore_iterator       * me
+        );
+
+RDF_Statement   *
+rdfstore_iterator_next (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_next_subject (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_next_predicate (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_next_object (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_next_context (
+        rdfstore_iterator       * me
+        );
+
+RDF_Statement   *
+rdfstore_iterator_current (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_current_subject (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_current_predicate (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_current_object (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_current_context (
+        rdfstore_iterator       * me
+        );
+
+RDF_Statement   *
+rdfstore_iterator_first (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_first_subject (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_first_predicate (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_first_object (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_first_context (
+        rdfstore_iterator       * me
+        );
+
+RDF_Statement   *
+rdfstore_iterator_each (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_each_subject (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_each_predicate (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_each_object (
+        rdfstore_iterator       * me
+        );
+
+RDF_Node   *
+rdfstore_iterator_each_context (
+        rdfstore_iterator       * me
+        );
+
+int rdfstore_iterator_remove (
+        rdfstore_iterator       * me
+        );
+
+int rdfstore_iterator_contains ( 
+        rdfstore_iterator       * me,   
+        RDF_Statement           * statement,
+        RDF_Node		* given_context
+        );
+
+rdfstore_iterator *
+rdfstore_iterator_intersect (
+        rdfstore_iterator       * me,	
+        rdfstore_iterator       * you
+        );
+
+rdfstore_iterator *
+rdfstore_iterator_unite (
+        rdfstore_iterator       * me,	
+        rdfstore_iterator       * you
+        );
+
+rdfstore_iterator *
+rdfstore_iterator_subtract (
+        rdfstore_iterator       * me,	
+        rdfstore_iterator       * you
+        );
+
+rdfstore_iterator *
+rdfstore_iterator_complement (
+        rdfstore_iterator       * me
+        );
+
+rdfstore_iterator *
+rdfstore_iterator_exor (
+        rdfstore_iterator       * me,	
+        rdfstore_iterator       * you
+        );
+
+rdfstore_iterator *
+rdfstore_iterator_duplicate (
+        rdfstore_iterator       * me
+        );
+
+unsigned int rdfstore_iterator_size (
+        rdfstore_iterator       * me
+        );
+
+#endif