summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:40:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:40:05 +0000
commit4038ab95a094b363f1748f3dcb51511a1217475d (patch)
tree7f393d66a783f91ddd263c78d681e485cf4f45ca /examples
parentInitial commit. (diff)
downloadraptor2-8a74621eb7909f43a549b042a496e042ad12fdcb.tar.xz
raptor2-8a74621eb7909f43a549b042a496e042ad12fdcb.zip
Adding upstream version 2.0.16.upstream/2.0.16upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--examples/Makefile.am75
-rw-r--r--examples/Makefile.in772
-rw-r--r--examples/grapper.c1322
-rw-r--r--examples/raptor_abort.c128
-rw-r--r--examples/rdfcat.c55
-rw-r--r--examples/rdfcount.c62
-rw-r--r--examples/rdfguess.c102
-rw-r--r--examples/rdfprint.c42
-rw-r--r--examples/rdfserialize.c47
9 files changed, 2605 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..8ea2900
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,75 @@
+# -*- Mode: Makefile -*-
+#
+# Makefile.am - automake file for Raptor examples
+#
+# Copyright (C) 2003-2010, David Beckett http://www.dajobe.org/
+# Copyright (C) 2003-2004, University of Bristol, UK http://www.bristol.ac.uk/
+#
+# This package is Free Software and part of Redland http://librdf.org/
+#
+# It is licensed under the following three licenses as alternatives:
+# 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
+# 2. GNU General Public License (GPL) V2 or any newer version
+# 3. Apache License, V2.0 or any newer version
+#
+# You may not use this file except in compliance with at least one of
+# the above three licenses.
+#
+# See LICENSE.html or LICENSE.txt at the top of this package for the
+# complete terms and further detail along with the license texts for
+# the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
+#
+#
+
+EXTRA_PROGRAMS = \
+raptor_abort grapper \
+rdfcat rdfprint rdfserialize rdfguess rdfcount
+
+examples: $(EXTRA_PROGRAMS)
+
+CLEANFILES = $(EXTRA_PROGRAMS)
+
+AM_CFLAGS=$(MEM)
+AM_LDFLAGS=$(MEM_LIBS)
+AM_CPPFLAGS=-I$(top_srcdir)/src
+
+raptor_abort_SOURCES = raptor_abort.c
+raptor_abort_LDADD=$(top_builddir)/src/libraptor2.la
+raptor_abort_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+grapper_SOURCES = grapper.c
+grapper_LDADD=$(top_builddir)/src/libraptor2.la
+grapper_CFLAGS=`pkg-config --cflags gtk+-2.0 gconf-2.0`
+grapper_LDFLAGS=`pkg-config --libs gtk+-2.0 gconf-2.0`
+grapper_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+rdfcat_SOURCES = rdfcat.c
+rdfcat_LDADD=$(top_builddir)/src/libraptor2.la
+rdfcat_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+rdfprint_SOURCES = rdfprint.c
+rdfprint_LDADD=$(top_builddir)/src/libraptor2.la
+rdfprint_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+rdfserialize_SOURCES = rdfserialize.c
+rdfserialize_LDADD=$(top_builddir)/src/libraptor2.la
+rdfserialize_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+rdfguess_SOURCES = rdfguess.c
+rdfguess_LDADD=$(top_builddir)/src/libraptor2.la
+rdfguess_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+rdfcount_SOURCES = rdfcount.c
+rdfcount_LDADD=$(top_builddir)/src/libraptor2.la
+rdfcount_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+
+
+$(top_builddir)/src/libraptor2.la:
+ cd $(top_builddir)/src && $(MAKE) libraptor2.la
+
+$(top_builddir)/../librdf/librdf.la:
+ cd $(top_builddir)/../librdf && $(MAKE) librdf.la
+
+grapper-future:
+ $(MAKE) clean
+ $(MAKE) grapper CC="$(CC) -DGTK_DISABLE_DEPRECATED" V=1
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644
index 0000000..29e4d56
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,772 @@
+# Makefile.in generated by automake 1.16.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2021 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@
+
+# -*- Mode: Makefile -*-
+#
+# Makefile.am - automake file for Raptor examples
+#
+# Copyright (C) 2003-2010, David Beckett http://www.dajobe.org/
+# Copyright (C) 2003-2004, University of Bristol, UK http://www.bristol.ac.uk/
+#
+# This package is Free Software and part of Redland http://librdf.org/
+#
+# It is licensed under the following three licenses as alternatives:
+# 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
+# 2. GNU General Public License (GPL) V2 or any newer version
+# 3. Apache License, V2.0 or any newer version
+#
+# You may not use this file except in compliance with at least one of
+# the above three licenses.
+#
+# See LICENSE.html or LICENSE.txt at the top of this package for the
+# complete terms and further detail along with the license texts for
+# the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
+#
+#
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+EXTRA_PROGRAMS = raptor_abort$(EXEEXT) grapper$(EXEEXT) \
+ rdfcat$(EXEEXT) rdfprint$(EXEEXT) rdfserialize$(EXEEXT) \
+ rdfguess$(EXEEXT) rdfcount$(EXEEXT)
+subdir = examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/build/gtk-doc.m4 \
+ $(top_srcdir)/build/libtool.m4 \
+ $(top_srcdir)/build/ltoptions.m4 \
+ $(top_srcdir)/build/ltsugar.m4 \
+ $(top_srcdir)/build/ltversion.m4 \
+ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/build/pkg.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/raptor_config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_grapper_OBJECTS = grapper-grapper.$(OBJEXT)
+grapper_OBJECTS = $(am_grapper_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+grapper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(grapper_CFLAGS) \
+ $(CFLAGS) $(grapper_LDFLAGS) $(LDFLAGS) -o $@
+am_raptor_abort_OBJECTS = raptor_abort.$(OBJEXT)
+raptor_abort_OBJECTS = $(am_raptor_abort_OBJECTS)
+am_rdfcat_OBJECTS = rdfcat.$(OBJEXT)
+rdfcat_OBJECTS = $(am_rdfcat_OBJECTS)
+am_rdfcount_OBJECTS = rdfcount.$(OBJEXT)
+rdfcount_OBJECTS = $(am_rdfcount_OBJECTS)
+am_rdfguess_OBJECTS = rdfguess.$(OBJEXT)
+rdfguess_OBJECTS = $(am_rdfguess_OBJECTS)
+am_rdfprint_OBJECTS = rdfprint.$(OBJEXT)
+rdfprint_OBJECTS = $(am_rdfprint_OBJECTS)
+am_rdfserialize_OBJECTS = rdfserialize.$(OBJEXT)
+rdfserialize_OBJECTS = $(am_rdfserialize_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/build/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/grapper-grapper.Po \
+ ./$(DEPDIR)/raptor_abort.Po ./$(DEPDIR)/rdfcat.Po \
+ ./$(DEPDIR)/rdfcount.Po ./$(DEPDIR)/rdfguess.Po \
+ ./$(DEPDIR)/rdfprint.Po ./$(DEPDIR)/rdfserialize.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(grapper_SOURCES) $(raptor_abort_SOURCES) $(rdfcat_SOURCES) \
+ $(rdfcount_SOURCES) $(rdfguess_SOURCES) $(rdfprint_SOURCES) \
+ $(rdfserialize_SOURCES)
+DIST_SOURCES = $(grapper_SOURCES) $(raptor_abort_SOURCES) \
+ $(rdfcat_SOURCES) $(rdfcount_SOURCES) $(rdfguess_SOURCES) \
+ $(rdfprint_SOURCES) $(rdfserialize_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/build/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+CURL_CONFIG = @CURL_CONFIG@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ETAGS = @ETAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILECMD = @FILECMD@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+HTML_DIR = @HTML_DIR@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JING = @JING@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURL_CFLAGS = @LIBCURL_CFLAGS@
+LIBCURL_LIBS = @LIBCURL_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBXML_CFLAGS = @LIBXML_CFLAGS@
+LIBXML_LIBS = @LIBXML_LIBS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MEM = @MEM@
+MEM_LIBS = @MEM_LIBS@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PKG_CONFIG_REQUIRES = @PKG_CONFIG_REQUIRES@
+RANLIB = @RANLIB@
+RAPTOR_LDFLAGS = @RAPTOR_LDFLAGS@
+RAPTOR_LIBTOOLLIBS = @RAPTOR_LIBTOOLLIBS@
+RAPTOR_LIBTOOL_VERSION = @RAPTOR_LIBTOOL_VERSION@
+RAPTOR_PARSERS = @RAPTOR_PARSERS@
+RAPTOR_SERIALIZERS = @RAPTOR_SERIALIZERS@
+RAPTOR_VERSION = @RAPTOR_VERSION@
+RAPTOR_VERSION_DECIMAL = @RAPTOR_VERSION_DECIMAL@
+RAPTOR_VERSION_MAJOR = @RAPTOR_VERSION_MAJOR@
+RAPTOR_VERSION_MINOR = @RAPTOR_VERSION_MINOR@
+RAPTOR_VERSION_RELEASE = @RAPTOR_VERSION_RELEASE@
+RAPTOR_WWW_LIBRARY = @RAPTOR_WWW_LIBRARY@
+RAPTOR_XML_PARSER = @RAPTOR_XML_PARSER@
+RECHO = @RECHO@
+RECHO_C = @RECHO_C@
+RECHO_N = @RECHO_N@
+RPM_RELEASE = @RPM_RELEASE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TAR = @TAR@
+VERSION = @VERSION@
+XML_CONFIG = @XML_CONFIG@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_CONFIG = @XSLT_CONFIG@
+XSLT_LIBS = @XSLT_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+CLEANFILES = $(EXTRA_PROGRAMS)
+AM_CFLAGS = $(MEM)
+AM_LDFLAGS = $(MEM_LIBS)
+AM_CPPFLAGS = -I$(top_srcdir)/src
+raptor_abort_SOURCES = raptor_abort.c
+raptor_abort_LDADD = $(top_builddir)/src/libraptor2.la
+raptor_abort_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+grapper_SOURCES = grapper.c
+grapper_LDADD = $(top_builddir)/src/libraptor2.la
+grapper_CFLAGS = `pkg-config --cflags gtk+-2.0 gconf-2.0`
+grapper_LDFLAGS = `pkg-config --libs gtk+-2.0 gconf-2.0`
+grapper_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+rdfcat_SOURCES = rdfcat.c
+rdfcat_LDADD = $(top_builddir)/src/libraptor2.la
+rdfcat_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+rdfprint_SOURCES = rdfprint.c
+rdfprint_LDADD = $(top_builddir)/src/libraptor2.la
+rdfprint_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+rdfserialize_SOURCES = rdfserialize.c
+rdfserialize_LDADD = $(top_builddir)/src/libraptor2.la
+rdfserialize_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+rdfguess_SOURCES = rdfguess.c
+rdfguess_LDADD = $(top_builddir)/src/libraptor2.la
+rdfguess_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+rdfcount_SOURCES = rdfcount.c
+rdfcount_LDADD = $(top_builddir)/src/libraptor2.la
+rdfcount_DEPENDENCIES = $(top_builddir)/src/libraptor2.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu examples/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+grapper$(EXEEXT): $(grapper_OBJECTS) $(grapper_DEPENDENCIES) $(EXTRA_grapper_DEPENDENCIES)
+ @rm -f grapper$(EXEEXT)
+ $(AM_V_CCLD)$(grapper_LINK) $(grapper_OBJECTS) $(grapper_LDADD) $(LIBS)
+
+raptor_abort$(EXEEXT): $(raptor_abort_OBJECTS) $(raptor_abort_DEPENDENCIES) $(EXTRA_raptor_abort_DEPENDENCIES)
+ @rm -f raptor_abort$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(raptor_abort_OBJECTS) $(raptor_abort_LDADD) $(LIBS)
+
+rdfcat$(EXEEXT): $(rdfcat_OBJECTS) $(rdfcat_DEPENDENCIES) $(EXTRA_rdfcat_DEPENDENCIES)
+ @rm -f rdfcat$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(rdfcat_OBJECTS) $(rdfcat_LDADD) $(LIBS)
+
+rdfcount$(EXEEXT): $(rdfcount_OBJECTS) $(rdfcount_DEPENDENCIES) $(EXTRA_rdfcount_DEPENDENCIES)
+ @rm -f rdfcount$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(rdfcount_OBJECTS) $(rdfcount_LDADD) $(LIBS)
+
+rdfguess$(EXEEXT): $(rdfguess_OBJECTS) $(rdfguess_DEPENDENCIES) $(EXTRA_rdfguess_DEPENDENCIES)
+ @rm -f rdfguess$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(rdfguess_OBJECTS) $(rdfguess_LDADD) $(LIBS)
+
+rdfprint$(EXEEXT): $(rdfprint_OBJECTS) $(rdfprint_DEPENDENCIES) $(EXTRA_rdfprint_DEPENDENCIES)
+ @rm -f rdfprint$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(rdfprint_OBJECTS) $(rdfprint_LDADD) $(LIBS)
+
+rdfserialize$(EXEEXT): $(rdfserialize_OBJECTS) $(rdfserialize_DEPENDENCIES) $(EXTRA_rdfserialize_DEPENDENCIES)
+ @rm -f rdfserialize$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(rdfserialize_OBJECTS) $(rdfserialize_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapper-grapper.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raptor_abort.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdfcat.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdfcount.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdfguess.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdfprint.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdfserialize.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+grapper-grapper.o: grapper.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapper_CFLAGS) $(CFLAGS) -MT grapper-grapper.o -MD -MP -MF $(DEPDIR)/grapper-grapper.Tpo -c -o grapper-grapper.o `test -f 'grapper.c' || echo '$(srcdir)/'`grapper.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/grapper-grapper.Tpo $(DEPDIR)/grapper-grapper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grapper.c' object='grapper-grapper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapper_CFLAGS) $(CFLAGS) -c -o grapper-grapper.o `test -f 'grapper.c' || echo '$(srcdir)/'`grapper.c
+
+grapper-grapper.obj: grapper.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapper_CFLAGS) $(CFLAGS) -MT grapper-grapper.obj -MD -MP -MF $(DEPDIR)/grapper-grapper.Tpo -c -o grapper-grapper.obj `if test -f 'grapper.c'; then $(CYGPATH_W) 'grapper.c'; else $(CYGPATH_W) '$(srcdir)/grapper.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/grapper-grapper.Tpo $(DEPDIR)/grapper-grapper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grapper.c' object='grapper-grapper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapper_CFLAGS) $(CFLAGS) -c -o grapper-grapper.obj `if test -f 'grapper.c'; then $(CYGPATH_W) 'grapper.c'; else $(CYGPATH_W) '$(srcdir)/grapper.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 ./$(DEPDIR)/grapper-grapper.Po
+ -rm -f ./$(DEPDIR)/raptor_abort.Po
+ -rm -f ./$(DEPDIR)/rdfcat.Po
+ -rm -f ./$(DEPDIR)/rdfcount.Po
+ -rm -f ./$(DEPDIR)/rdfguess.Po
+ -rm -f ./$(DEPDIR)/rdfprint.Po
+ -rm -f ./$(DEPDIR)/rdfserialize.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/grapper-grapper.Po
+ -rm -f ./$(DEPDIR)/raptor_abort.Po
+ -rm -f ./$(DEPDIR)/rdfcat.Po
+ -rm -f ./$(DEPDIR)/rdfcount.Po
+ -rm -f ./$(DEPDIR)/rdfguess.Po
+ -rm -f ./$(DEPDIR)/rdfprint.Po
+ -rm -f ./$(DEPDIR)/rdfserialize.Po
+ -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:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libtool cscopelist-am ctags ctags-am \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am 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 tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+examples: $(EXTRA_PROGRAMS)
+
+$(top_builddir)/src/libraptor2.la:
+ cd $(top_builddir)/src && $(MAKE) libraptor2.la
+
+$(top_builddir)/../librdf/librdf.la:
+ cd $(top_builddir)/../librdf && $(MAKE) librdf.la
+
+grapper-future:
+ $(MAKE) clean
+ $(MAKE) grapper CC="$(CC) -DGTK_DISABLE_DEPRECATED" V=1
+
+# 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:
diff --git a/examples/grapper.c b/examples/grapper.c
new file mode 100644
index 0000000..a15c662
--- /dev/null
+++ b/examples/grapper.c
@@ -0,0 +1,1322 @@
+/* -*- Mode: c; c-basic-offset: 2 -*-
+ *
+ * grapper.c - Raptor GTK GUI example code
+ *
+ * Copyright (C) 2003-2010, David Beckett http://www.dajobe.org/
+ * Copyright (C) 2003-2005, University of Bristol, UK http://www.bristol.ac.uk/
+ *
+ * This package is Free Software and part of Redland http://librdf.org/
+ *
+ * It is licensed under the following three licenses as alternatives:
+ * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
+ * 2. GNU General Public License (GPL) V2 or any newer version
+ * 3. Apache License, V2.0 or any newer version
+ *
+ * You may not use this file except in compliance with at least one of
+ * the above three licenses.
+ *
+ * See LICENSE.html or LICENSE.txt at the top of this package for the
+ * complete terms and further detail along with the license texts for
+ * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
+ *
+ *
+ * Requires GTK 2.5.0+
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <raptor_config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <unistd.h>
+
+/* for the memory allocation functions */
+#if defined(HAVE_DMALLOC_H) && defined(RAPTOR_MEMORY_DEBUG_DMALLOC)
+#include <dmalloc.h>
+#endif
+
+/* Raptor includes */
+#include <raptor2.h>
+
+/* Gtk 2.0 */
+#include <gtk/gtk.h>
+
+/* Gconf */
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+#if GTK_CHECK_VERSION(2,5,0)
+#else
+#error "Requires GTK 2.5.0+"
+#endif
+
+/* Qnames button does nothing */
+#undef GRAPPER_QNAMES
+
+/* GtkUIManager and external XML file is too damn complex to make work */
+#ifdef GTK_DISABLE_DEPRECATED
+/* GtkItemFactory was deprecated in GTK+ 2.4 */
+#undef ITEM_FACTORY
+/* GtkToolTips was deprecated in GTK+ 2.12 */
+#undef TOOL_TIPS
+#else
+#define ITEM_FACTORY 1
+#define TOOL_TIPS 1
+#endif
+
+static const char *application_name = "Grapper";
+static const char *application_title = "Grapper GUI RDF Parser Utility";
+static const char *application_description = "GUI RDF parser utility based on the Raptor RDF parsing library";
+
+
+/* Top level window */
+static GtkWidget *grapper_window;
+
+
+/* GConf */
+static GConfClient *gconf_client = NULL;
+
+#define GCONF_GRAPPER_NAMESPACE "/apps/grapper"
+
+/* configuration dir listened to */
+static const gchar* gconf_namespace= GCONF_GRAPPER_NAMESPACE;
+
+/* window width key */
+static const gchar* width_gconf_key = (const gchar*) GCONF_GRAPPER_NAMESPACE "/width";
+/* window height key */
+static const gchar* height_gconf_key = (const gchar*) GCONF_GRAPPER_NAMESPACE "/height";
+
+#define MIN_WINDOW_WIDTH 400
+#define MIN_WINDOW_HEIGHT 300
+
+
+typedef struct
+{
+ raptor_world* world;
+ /* model data */
+#ifdef GRAPPER_QNAMES
+ int qnames;
+#endif
+ int guess;
+ unsigned int syntax;
+
+ int options[RAPTOR_OPTION_LAST];
+ int options_set[RAPTOR_OPTION_LAST];
+ int ignore_warnings;
+
+ unsigned char *url;
+
+ /* last picked filename or NULL */
+ gchar *filename;
+
+ /* GList *triples_list; */
+ int triples_count;
+ int warnings_count;
+ int errors_count;
+ gchar *error;
+
+ /* view/controller data */
+ GtkWidget *window;
+ GtkWidget *v_box;
+ GtkWidget *url_entry;
+ GtkListStore *triples_store;
+ GtkWidget *file_selection;
+ GtkWidget *status;
+ GtkWidget *triples_frame;
+ GtkWidget *errors_frame;
+ GtkListStore *errors_store;
+
+} grapper_state;
+
+
+typedef struct
+{
+ grapper_state* state;
+ int option;
+} grapper_widget_data;
+
+
+enum {
+ SUBJECT_COLUMN,
+ PREDICATE_COLUMN,
+ OBJECT_COLUMN,
+ N_COLUMNS
+};
+
+
+/* Local prototypes */
+static void grapper_model_parse(grapper_state *state);
+
+
+static void
+grapper_view_url_changed(grapper_state *state)
+{
+ GtkWidget *url_entry=state->url_entry;
+
+ gtk_entry_set_text(GTK_ENTRY(url_entry), (const gchar*)state->url);
+}
+
+#ifdef GRAPPER_QNAMES
+static void
+grapper_view_qnames_changed(grapper_state *state)
+{
+
+}
+#endif
+
+static void
+grapper_view_guess_changed(grapper_state *state)
+{
+
+}
+
+static void
+grapper_view_option_changed(grapper_state *state, int option)
+{
+
+}
+
+static void
+grapper_view_syntax_changed(grapper_state *state)
+{
+
+}
+
+static void
+grapper_view_set_triples_count(grapper_state *state, int count)
+{
+#define TC_BUF_LEN 18
+ char buf[TC_BUF_LEN+1];
+ if(count>0)
+ snprintf(buf, TC_BUF_LEN, "Triples: %d", count);
+ else
+ memcpy(buf, "Triples", 8);
+
+ gtk_frame_set_label(GTK_FRAME(state->triples_frame), buf);
+}
+
+static void
+grapper_view_add_triple(grapper_state *state, unsigned char* nodes[3], int i)
+{
+ GtkListStore *store=state->triples_store;
+ GtkTreeIter iter;
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ SUBJECT_COLUMN, nodes[0],
+ PREDICATE_COLUMN, nodes[1],
+ OBJECT_COLUMN, nodes[2],
+ -1);
+}
+
+static void
+grapper_view_empty_triples(grapper_state *state)
+{
+ gtk_list_store_clear(state->triples_store);
+ gtk_list_store_clear(state->errors_store);
+}
+
+
+static void
+grapper_view_reset_status(grapper_state *state)
+{
+ gtk_list_store_clear(state->errors_store);
+}
+
+
+static void
+grapper_view_update_error_count(grapper_state *state)
+{
+#define EC_BUF_LEN 18
+ char buf[EC_BUF_LEN+1];
+ int count=state->errors_count;
+
+ if(count>0)
+ snprintf(buf, EC_BUF_LEN, "Errors: %d", count);
+ else
+ memcpy(buf, "Errors", 7);
+
+ gtk_frame_set_label(GTK_FRAME(state->errors_frame), buf);
+}
+
+
+static void
+grapper_view_add_error_message(grapper_state *state, gchar *error,
+ raptor_locator *locator, int is_error)
+{
+ if(error) {
+ GtkListStore *store = state->errors_store;
+ GtkTreeIter iter;
+ int line = (locator && locator->line >= 0) ? locator->line : 0;
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, line,
+ 1, (is_error ? "Error" : "Warning"),
+ 2, error,
+ -1);
+ grapper_view_update_error_count(state);
+ }
+}
+
+
+static void
+grapper_model_add_triple(grapper_state *state, unsigned char *nodes[3])
+{
+ /* g_list_append(state->triples_list, nodes); */
+ state->triples_count++;
+
+ grapper_view_add_triple(state, nodes, state->triples_count-1);
+ grapper_view_set_triples_count(state, state->triples_count);
+}
+
+
+static void
+grapper_model_empty_triples(grapper_state *state)
+{
+ /* g_list_free(state->triples_list); */
+
+ grapper_view_empty_triples(state);
+}
+
+
+static void
+grapper_model_set_url(grapper_state *state, const unsigned char *url)
+{
+ if(state->url) {
+ if(!strcmp((const char*)state->url, (const char*)url))
+ return;
+
+ g_free(state->url);
+ }
+
+ state->url = (unsigned char*)g_strdup((const char*)url);
+
+ grapper_view_url_changed(state);
+}
+
+
+#ifdef GRAPPER_QNAMES
+static void
+grapper_model_set_qnames (grapper_state *state, int qnames)
+{
+ if(state->qnames == qnames)
+ return;
+
+ state->qnames=qnames;
+ grapper_view_qnames_changed(state);
+}
+#endif
+
+
+static void
+grapper_model_set_guess (grapper_state *state, int guess)
+{
+ if(state->guess == guess)
+ return;
+
+ state->guess=guess;
+ grapper_view_guess_changed(state);
+}
+
+static void
+grapper_model_set_option(grapper_state *state, int option, int value)
+{
+ if(state->options[option] == value)
+ return;
+
+ state->options[option] = value;
+ state->options_set[option] = 1;
+ grapper_view_option_changed(state, option);
+}
+
+
+static void
+grapper_model_set_syntax (grapper_state *state, unsigned int syntax)
+{
+ if(state->syntax == syntax)
+ return;
+
+ state->syntax=syntax;
+ grapper_view_syntax_changed(state);
+}
+
+
+static void
+grapper_model_reset_counts(grapper_state *state)
+{
+ state->triples_count = 0;
+ state->warnings_count = 0;
+ state->errors_count = 0;
+ grapper_view_update_error_count(state);
+}
+
+
+static void
+grapper_model_reset_error(grapper_state *state)
+{
+ if(state->error) {
+ g_free(state->error);
+ state->error = NULL;
+ }
+ grapper_view_reset_status(state);
+}
+
+
+static void
+grapper_model_log_handler(void *data, raptor_log_message *message)
+{
+ grapper_state* state = (grapper_state*)data;
+
+ if(message->level >= RAPTOR_LOG_LEVEL_ERROR) {
+ state->errors_count++;
+
+ if(state->error)
+ g_free(state->error);
+
+ state->error = g_strdup(message->text);
+
+ grapper_view_add_error_message(state, state->error, message->locator, 1);
+ } else {
+ state->warnings_count++;
+
+ if(state->ignore_warnings)
+ return;
+
+ if(state->error)
+ g_free(state->error);
+
+ state->error = g_strdup(message->text);
+
+ grapper_view_add_error_message(state, state->error, message->locator, 0);
+ }
+}
+
+
+static void
+grapper_model_statements_handler(void *data, raptor_statement *statement)
+{
+ grapper_state* state = (grapper_state*)data;
+ unsigned char* nodes[3];
+
+ nodes[0] = raptor_term_to_string(statement->subject);
+ nodes[1] = raptor_term_to_string(statement->predicate);
+ nodes[2] = raptor_term_to_string(statement->object);
+
+ grapper_model_add_triple(state, nodes);
+ free(nodes[0]);
+ free(nodes[1]);
+ free(nodes[2]);
+}
+
+
+static void
+grapper_model_parse(grapper_state *state)
+{
+ raptor_uri* uri;
+ raptor_parser* rdf_parser;
+ const char *syntax_name;
+ int i;
+ const raptor_syntax_description* sd;
+
+ if(!state->url)
+ return;
+
+ grapper_model_empty_triples(state);
+
+ grapper_model_reset_counts(state);
+ grapper_model_reset_error(state);
+
+ uri = raptor_new_uri(state->world, state->url);
+ sd = raptor_world_get_parser_description(state->world, state->syntax);
+ syntax_name = sd->names[0];
+
+
+ if(state->guess) {
+ rdf_parser = raptor_new_parser_for_content(state->world, NULL, NULL, NULL,
+ 0, state->url);
+ if(!rdf_parser) {
+ fprintf(stderr, "Failed to create guessed raptor parser from uri %s\n",
+ state->url);
+ exit(1);
+ }
+
+ fprintf(stdout, "Guessed parser name '%s' from uri %s\n",
+ raptor_parser_get_name(rdf_parser), state->url);
+ } else {
+ rdf_parser = raptor_new_parser(state->world, syntax_name);
+ }
+
+
+ for(i = 0; i <= RAPTOR_OPTION_LAST; i++) {
+ if(state->options_set[i])
+ raptor_parser_set_option(rdf_parser, (raptor_option)i, NULL, state->options[i]);
+ }
+
+ raptor_world_set_log_handler(state->world, state, grapper_model_log_handler);
+ raptor_parser_set_statement_handler(rdf_parser, state,
+ grapper_model_statements_handler);
+
+ raptor_parser_parse_uri(rdf_parser, uri, NULL);
+
+ raptor_free_parser(rdf_parser);
+ raptor_free_uri(uri);
+}
+
+
+
+/* go button clicked / url entry activated callback */
+static void
+url_entry_callback(GtkWidget *widget, gpointer data)
+{
+ grapper_state* state = (grapper_state*)data;
+ GtkWidget *url_entry = state->url_entry;
+ const unsigned char* url;
+
+ url = (const unsigned char*)gtk_entry_get_text(GTK_ENTRY(url_entry));
+ grapper_model_set_url(state, url);
+ grapper_model_parse(state);
+}
+
+
+/* open action wanted */
+static void
+do_open_action(grapper_state* state)
+{
+ unsigned char *uri_string;
+ GtkWidget *files = gtk_file_chooser_dialog_new("Open",
+ GTK_WINDOW(state->window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ if(state->filename)
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(files), state->filename);
+
+ if (gtk_dialog_run(GTK_DIALOG (files)) == GTK_RESPONSE_ACCEPT) {
+ state->filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(files));
+ uri_string = (unsigned char*)gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(files));
+ grapper_model_set_url(state, uri_string);
+ g_free(uri_string);
+
+ grapper_model_parse(state);
+ }
+ gtk_widget_destroy(files);
+}
+
+
+/* quit callback */
+static void
+do_quit_action(grapper_state* state)
+{
+ gtk_main_quit();
+}
+
+
+/* preferences option menu item toggled callback */
+static void
+option_menu_toggled(GtkCheckMenuItem *checkmenuitem, gpointer data)
+{
+ grapper_widget_data* sbdata = (grapper_widget_data*)data;
+ int active = gtk_check_menu_item_get_active(checkmenuitem);
+
+ grapper_model_set_option(sbdata->state, sbdata->option, active);
+}
+
+
+#ifdef GRAPPER_QNAMES
+/* qnames button clicked callback */
+static void
+qnames_button_callback(GtkWidget *widget, gpointer data)
+{
+ grapper_state* state = (grapper_state*)data;
+ int active = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)) != 0);
+
+ grapper_model_set_qnames(state, active);
+}
+#endif
+
+
+/* guess button clicked callback */
+static void
+guess_button_callback(GtkWidget *widget, gpointer data)
+{
+ grapper_state* state = (grapper_state*)data;
+ int active = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)) != 0);
+
+ grapper_model_set_guess(state, active);
+}
+
+
+/* syntax menu changed callback */
+static void
+syntax_menu_callback(GtkWidget *widget, gpointer data)
+{
+ grapper_state* state = (grapper_state*)data;
+ unsigned int syntax;
+
+ syntax = (unsigned int)gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+
+ grapper_model_set_syntax(state, syntax);
+}
+
+
+/* delete (window) event callback */
+static gboolean
+delete_event_callback(GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+ return FALSE; /* continue normal event handing */
+}
+
+
+/* destroy callback */
+static void
+destroy_callback(GtkWidget *widget, gpointer data)
+{
+ gtk_main_quit ();
+}
+
+
+#ifdef ITEM_FACTORY
+static void
+open_menu_callback(gpointer user_data, guint action, GtkWidget *widget)
+{
+ do_open_action((grapper_state*)user_data);
+}
+#else
+static void
+on_open_menu_callback(GtkAction *action, gpointer user_data)
+{
+ do_open_action((grapper_state*)user_data);
+}
+#endif
+
+
+#ifdef ITEM_FACTORY
+static void
+quit_menu_callback(gpointer user_data, guint action, GtkWidget *widget)
+{
+ do_quit_action((grapper_state*)user_data);
+}
+#else
+static void
+on_quit_menu_callback(GtkAction *action, gpointer user_data)
+{
+ do_quit_action((grapper_state*)user_data);
+}
+#endif
+
+
+static void
+do_about_action(grapper_state* state) {
+ const gchar* authors[2]= { "Dave Beckett http://www.dajobe.org/", NULL };
+
+#if 1
+ /* using 2.5.x+ stock about dialog */
+ gtk_show_about_dialog(GTK_WINDOW(state->window),
+ "authors", authors,
+ "comments", application_description,
+ "copyright", raptor_short_copyright_string,
+ "license", raptor_license_string,
+ "name", application_name,
+ "version", raptor_version_string,
+ "website", raptor_home_url_string,
+ "website-label", "Raptor",
+ NULL);
+#else
+ /* using 2.5.x+ by hand about */
+ GtkWidget *about;
+
+ about = gtk_about_dialog_new();
+ gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(about), application_name);
+ gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about), raptor_version_string);
+ gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(about),
+ raptor_short_copyright_string);
+ gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about),
+ application_description);
+ gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(about), raptor_license_string);
+ gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about), raptor_home_url_string);
+ gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(about), "Raptor");
+ gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(about), authors);
+
+ gtk_widget_show_all(about);
+#endif
+}
+
+
+#ifdef ITEM_FACTORY
+static void
+about_menu_callback(gpointer user_data, guint action, GtkWidget *widget)
+{
+ do_about_action((grapper_state*)user_data);
+}
+#else
+static void
+on_about_menu_callback(GtkAction* action, gpointer user_data)
+{
+ do_about_action((grapper_state*)user_data);
+}
+#endif
+
+
+#ifdef ITEM_FACTORY
+static GtkItemFactoryEntry menu_item_factory_entries[] = {
+ /* path, accelerator, callback, callback_action, item_type, extra_data */
+ { (gchar*)"/_File", NULL, NULL, 0, (gchar*)"<Branch>" },
+ { (gchar*)"/File/_Open...", (gchar*)"<CTRL>O", (GtkItemFactoryCallback)open_menu_callback, 1, (gchar*)"<StockItem>", GTK_STOCK_OPEN },
+ { (gchar*)"/File/sep1", NULL, NULL, 0, (gchar*)"<Separator>" },
+ { (gchar*)"/File/_Quit", (gchar*)"<CTRL>Q", (GtkItemFactoryCallback)quit_menu_callback, 1, (gchar*)"<StockItem>", GTK_STOCK_QUIT },
+ { (gchar*)"/_Preferences", NULL, NULL, 0, (gchar*)"<Branch>" },
+ { (gchar*)"/_Help", NULL, NULL, 0, (gchar*)"<LastBranch>" },
+ { (gchar*)"/Help/About", NULL, (GtkItemFactoryCallback)about_menu_callback, 1, (gchar*)"<Item>" }
+};
+
+static gint menu_item_factory_nentries = sizeof(menu_item_factory_entries) / sizeof(menu_item_factory_entries[0]);
+#else
+static GtkActionEntry menu_actions[] = {
+ /* name, stock id, label */
+ { "FileMenuAction", NULL, "_File" },
+ { "PreferencesMenuAction", NULL, "_Preferences" },
+ { "HelpMenuAction", NULL, "_Help" },
+
+ /* name, stock id, label, accelerator, tooltip, callback */
+ { "OpenAction", GTK_STOCK_OPEN, "_Open", (gchar*)"<control>O", "Open a file", G_CALLBACK ( on_open_menu_callback ) },
+ { "QuitAction", GTK_STOCK_QUIT, "_Quit", (gchar*)"<control>Q", "Quit", G_CALLBACK ( on_quit_menu_callback ) },
+
+ { "AboutAction", GTK_STOCK_ABOUT, NULL, NULL, "About", G_CALLBACK ( on_about_menu_callback ) }
+};
+
+static gint menu_actions_nentries = G_N_ELEMENTS (menu_actions);
+#endif
+
+
+static void
+init_grapper_window(GtkWidget *window, grapper_state *state)
+{
+
+ GtkAccelGroup *accel_group;
+ GtkWidget *menu_bar;
+ GtkMenu *prefs_menu;
+ GtkWidget *v_paned;
+ GtkWidget *v_box;
+ GtkWidget *box;
+ GtkWidget *go_button;
+ GtkWidget* option_items[RAPTOR_OPTION_LAST];
+#ifdef GRAPPER_QNAMES
+ GtkWidget *qnames_button;
+#endif
+ GtkWidget *guess_button;
+ GtkWidget *syntax_combo_box;
+ GtkWidget *url_entry;
+ GtkWidget *triples_frame, *prefs_frame;
+ GtkWidget *triples_scrolled_window;
+ GtkWidget *triples_treeview;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+#ifdef GRAPPER_QNAMES
+ GtkTooltips *qnames_tooltips;
+#endif
+#ifdef TOOL_TIPS
+ GtkTooltips *guess_tooltips;
+ GtkTooltips *syntax_tooltips;
+#else
+#endif
+ GtkWidget *prefs_box;
+ GtkListStore *store;
+ int i;
+ GtkWidget *errors_frame, *errors_scrolled_window;
+ GtkWidget *errors_treeview;
+ GtkListStore *errors_store;
+#ifdef SYNTAX_LIST_STORE
+ GtkListStore *syntax_list_store;
+ GtkTreeIter iter;
+ GtkCellRenderer* cell;
+#endif
+#ifdef ITEM_FACTORY
+ GtkItemFactory* menu_item_factory;
+#else
+ GtkActionGroup *action_group;
+ GtkUIManager *menu_manager;
+ GError *error;
+#endif
+
+
+ state->window=window;
+
+ /* connect window delete event to callback */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event_callback), NULL);
+
+ /* connect window destroy event to callback */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy_callback), NULL);
+
+
+
+ /* vertical box */
+ v_box = gtk_vbox_new (FALSE, 0);
+
+ /* gtk_container_set_border_width (GTK_CONTAINER (v_box), 10); */
+
+ state->v_box = v_box;
+
+
+ /* acceleration group for menu bar*/
+ accel_group = gtk_accel_group_new();
+
+
+ /* Menu bar */
+#ifdef ITEM_FACTORY
+ menu_item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,
+ "<Main>", accel_group);
+ gtk_item_factory_create_items(menu_item_factory,
+ menu_item_factory_nentries,
+ menu_item_factory_entries,
+ state);
+ gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
+
+ menu_bar = gtk_item_factory_get_widget (menu_item_factory, "<Main>");
+ gtk_widget_show(menu_bar);
+#else
+ action_group = gtk_action_group_new("Actions");
+ gtk_action_group_add_actions (action_group,
+ menu_actions, menu_actions_nentries,
+ state);
+ menu_manager = gtk_ui_manager_new ();
+ gtk_ui_manager_insert_action_group (menu_manager, action_group, 0);
+ error = NULL;
+ gtk_ui_manager_add_ui_from_file(menu_manager, "grapper-ui.xml", &error);
+ if (error) {
+ g_message ("Building menus failed: %s", error->message);
+ g_error_free (error);
+ }
+
+ /* get the menu bar widget */
+ menu_bar = gtk_ui_manager_get_widget(menu_manager, "/MainMenu");
+#endif
+
+
+ gtk_box_pack_start (GTK_BOX (v_box), menu_bar, FALSE, FALSE, 0);
+
+
+#ifdef ITEM_FACTORY
+#else
+ /* enable keyboard shortcuts */
+ gtk_window_add_accel_group (GTK_WINDOW(window),
+ gtk_ui_manager_get_accel_group (menu_manager));
+#endif
+
+ /* horizontal box for url entry, OK, Open buttons in vertical box (v_box) */
+ box = gtk_hbox_new (FALSE, 0);
+
+
+ /* url text entry in horizontal box */
+ url_entry = gtk_entry_new();
+ gtk_entry_set_max_length(GTK_ENTRY(url_entry), 200);
+ /* connect text entry activate (enter key) callback */
+ g_signal_connect (G_OBJECT(url_entry), "activate",
+ G_CALLBACK(url_entry_callback), state);
+ gtk_editable_set_editable(GTK_EDITABLE(url_entry), TRUE);
+
+ /* pack into the invisible box */
+ gtk_box_pack_start(GTK_BOX(box), url_entry, TRUE, TRUE, 0);
+
+ gtk_widget_show(url_entry);
+ state->url_entry = url_entry;
+
+ /* go button in horizontal box */
+ go_button = gtk_button_new_from_stock(GTK_STOCK_OK);
+
+ /* connect button clicked event to callback */
+ g_signal_connect (G_OBJECT (go_button), "clicked",
+ G_CALLBACK (url_entry_callback), state);
+
+ /* pack into the invisible box */
+ gtk_box_pack_start (GTK_BOX(box), go_button, FALSE, TRUE, 0);
+
+ gtk_widget_show (go_button);
+
+
+ gtk_widget_show (box);
+
+
+ /* add hbox to vbox */
+ gtk_box_pack_start (GTK_BOX (v_box), box, FALSE, FALSE, 0);
+
+
+ /* horizontal box for syntax prefs in vertical box (v_box) */
+ prefs_frame = gtk_frame_new ("RDF Syntax");
+
+ prefs_box = gtk_hbutton_box_new();
+
+ gtk_button_box_set_layout (GTK_BUTTON_BOX(prefs_box), GTK_BUTTONBOX_START);
+
+#ifdef GRAPPER_QNAMES
+ /* qnames button in horizontal box */
+ qnames_button = gtk_check_button_new_with_label ("QNames");
+
+ qnames_tooltips = gtk_tooltips_new ();
+ gtk_tooltips_set_tip (qnames_tooltips, qnames_button,
+ "Display URIs as XML QNames", NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(qnames_button),
+ (state->qnames));
+
+ /* connect button clicked event to callback */
+ g_signal_connect (G_OBJECT (qnames_button), "clicked",
+ G_CALLBACK (qnames_button_callback), state);
+
+ /* pack into the invisible box */
+ gtk_box_pack_start (GTK_BOX(prefs_box), qnames_button, TRUE, TRUE, 0);
+
+ gtk_widget_show (qnames_button);
+#endif
+
+ /* guess button in horizontal box */
+ guess_button = gtk_check_button_new_with_label ("Guess Syntax");
+
+#ifdef TOOL_TIPS
+ guess_tooltips = gtk_tooltips_new ();
+ gtk_tooltips_set_tip (guess_tooltips, guess_button,
+ "Try to guess the syntax from the URI", NULL);
+#else
+ gtk_widget_set_tooltip_text (GTK_WIDGET(guess_button),
+ "Try to guess the syntax from the URI");
+#endif
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(guess_button),
+ (state->guess));
+
+ /* connect button clicked event to callback */
+ g_signal_connect (G_OBJECT (guess_button), "clicked",
+ G_CALLBACK (guess_button_callback), state);
+
+ /* pack into the invisible box */
+ gtk_box_pack_start (GTK_BOX(prefs_box), guess_button, TRUE, TRUE, 0);
+
+ gtk_widget_show (guess_button);
+
+ /* add prefs frame to vbox */
+ gtk_container_add (GTK_CONTAINER(prefs_frame), prefs_box);
+
+ gtk_widget_show (prefs_box);
+
+ /* add prefs frame to start of vbox */
+ gtk_box_pack_start (GTK_BOX (v_box), prefs_frame, FALSE, TRUE, 0);
+
+ gtk_widget_show (prefs_frame);
+
+
+
+ /* paned in vertical box */
+ v_paned = gtk_vpaned_new ();
+
+
+ /* triples frame in vertical paned */
+ triples_frame = gtk_frame_new("Triples");
+ state->triples_frame = triples_frame;
+
+ gtk_paned_pack1 (GTK_PANED (v_paned), triples_frame, TRUE, FALSE);
+ gtk_widget_show (triples_frame);
+
+
+ /* scroll window in triples frame */
+ triples_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER(triples_scrolled_window), 10);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(triples_scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ gtk_container_add (GTK_CONTAINER(triples_frame), triples_scrolled_window);
+ gtk_widget_show (triples_scrolled_window);
+
+ store = gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+ state->triples_store = store;
+
+ triples_treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(triples_treeview), TRUE);
+
+ /* set columns renderer for treeview */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Subject",
+ renderer,
+ "text", SUBJECT_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id (column, SUBJECT_COLUMN);
+ gtk_tree_view_column_set_resizable (column, 1);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (triples_treeview), column);
+
+ renderer= gtk_cell_renderer_text_new ();
+ column= gtk_tree_view_column_new_with_attributes ("Predicate",
+ renderer,
+ "text", PREDICATE_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id (column, PREDICATE_COLUMN);
+ gtk_tree_view_column_set_resizable (column, 1);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (triples_treeview), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Object",
+ renderer,
+ "text", OBJECT_COLUMN,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id (column, OBJECT_COLUMN);
+ gtk_tree_view_column_set_resizable (column, 1);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (triples_treeview), column);
+
+
+ /* pack the store into the scrolled window */
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(triples_scrolled_window),
+ triples_treeview);
+ gtk_widget_show(triples_treeview);
+
+
+ /* errors frame in vertical paned */
+ errors_frame = gtk_frame_new ("Errors");
+ state->errors_frame = errors_frame;
+
+ gtk_paned_pack2 (GTK_PANED (v_paned), errors_frame, TRUE, FALSE);
+ gtk_widget_show (errors_frame);
+
+
+ gtk_box_pack_start (GTK_BOX (v_box), v_paned, TRUE, TRUE, 0);
+ gtk_widget_show (v_paned);
+
+
+ /* scroll window in errors frame */
+ errors_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER(errors_scrolled_window), 10);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(errors_scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ gtk_container_add (GTK_CONTAINER(errors_frame), errors_scrolled_window);
+ gtk_widget_show (errors_scrolled_window);
+
+ errors_store = gtk_list_store_new (3,
+ G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING);
+ state->errors_store = errors_store;
+
+ errors_treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(errors_store));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(errors_treeview), TRUE);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Line",
+ renderer,
+ "text", 0,
+ NULL);
+ gtk_tree_view_column_set_resizable (column, 1);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (errors_treeview), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Type",
+ renderer,
+ "text", 1,
+ NULL);
+ gtk_tree_view_column_set_resizable (column, 1);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (errors_treeview), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Message",
+ renderer,
+ "text", 2,
+ NULL);
+ gtk_tree_view_column_set_resizable (column, 1);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (errors_treeview), column);
+
+#ifdef TOOL_TIPS
+ gtk_tooltips_set_tip (gtk_tooltips_new (), errors_treeview,
+ "Errors and warnings from parsing the content.", NULL);
+#else
+ gtk_widget_set_tooltip_text (GTK_WIDGET(errors_treeview),
+ "Errors and warnings from parsing the content.");
+#endif
+
+ /* pack the errors store into the errors scrolled window */
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(errors_scrolled_window),
+ errors_treeview);
+ gtk_widget_show (errors_treeview);
+
+
+
+
+#ifdef ITEM_FACTORY
+ prefs_menu = GTK_MENU(gtk_item_factory_get_widget (menu_item_factory,
+ "/Preferences"));
+#else
+ prefs_menu = GTK_MENU(gtk_ui_manager_get_widget (menu_manager,
+ "/MainMenu/PreferencesMenu"));
+#endif
+
+ /* options in the preferences menu */
+ for(i = 0; i <= RAPTOR_OPTION_LAST; i++) {
+ grapper_widget_data* sbdata;
+ raptor_option_description* od;
+
+ od = raptor_world_get_option_description(state->world,
+ RAPTOR_DOMAIN_PARSER,
+ (raptor_option)i);
+ if(!od)
+ break;
+
+ sbdata = (grapper_widget_data*)malloc(sizeof(grapper_widget_data));
+ sbdata->state = state;
+ sbdata->option = i;
+
+ /* add to the preferences menu */
+ option_items[i] = gtk_check_menu_item_new_with_label (od->label);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(option_items[i]),
+ state->options[i]);
+ gtk_menu_shell_append (GTK_MENU_SHELL(prefs_menu), option_items[i]);
+
+ g_signal_connect (G_OBJECT(option_items[i]), "toggled",
+ G_CALLBACK(option_menu_toggled), (gpointer)sbdata);
+ gtk_widget_show (option_items[i]);
+ }
+
+
+ /* syntax button in horizontal box */
+#ifdef SYNTAX_LIST_STORE
+ /* Create combo box with data model behind */
+
+ syntax_list_store = gtk_list_store_new (/* N columns */ 1, G_TYPE_STRING);
+ for(i = 0; 1; i++) {
+ const raptor_syntax_description* sd;
+
+ sd = raptor_world_get_parser_description(state->world, i);
+ if(!sd)
+ break;
+
+ gtk_list_store_append (syntax_list_store, &iter);
+ gtk_list_store_set (syntax_list_store, &iter,
+ /* column */ 0, (const gchar*)sd->label,
+ -1);
+ }
+
+ syntax_combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(syntax_list_store));
+
+ /* Remove our reference to the store to avoid memory leak */
+ g_object_unref ( G_OBJECT (syntax_list_store ) );
+
+ /* Create text cell renderer */
+ cell = gtk_cell_renderer_text_new ();
+
+ /* Pack it to the combo box */
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT ( syntax_combo_box ), cell, TRUE);
+
+ /* Connect renderer to data source: attr "text" is column 0 in data model */
+ gtk_cell_layout_set_attributes ( GTK_CELL_LAYOUT ( syntax_combo_box ),
+ cell,
+ /* attribute */ "text", /* column */ 0,
+ NULL);
+
+#else
+ /* Create combo box using text API */
+ syntax_combo_box = gtk_combo_box_new_text ();
+
+ for(i = 0; 1; i++) {
+ const raptor_syntax_description* sd;
+
+ sd = raptor_world_get_parser_description(state->world, i);
+ if(!sd)
+ break;
+
+ gtk_combo_box_append_text (GTK_COMBO_BOX (syntax_combo_box),
+ (const gchar*)sd->label);
+ }
+#endif
+
+ g_signal_connect (GTK_OBJECT(syntax_combo_box), "changed",
+ G_CALLBACK(syntax_menu_callback), state);
+
+ /* Default is item 0 (should be RDF/XML) */
+ gtk_combo_box_set_active (GTK_COMBO_BOX(syntax_combo_box), 0);
+
+#ifdef TOOL_TIPS
+ syntax_tooltips = gtk_tooltips_new ();
+ gtk_tooltips_set_tip (syntax_tooltips, syntax_combo_box,
+ "Choose the Syntax to parse", NULL);
+#else
+ gtk_widget_set_tooltip_text (GTK_WIDGET(syntax_combo_box),
+ "Choose the Syntax to parse");
+#endif
+
+ /* pack into the invisible box */
+ gtk_box_pack_start (GTK_BOX(prefs_box), syntax_combo_box, TRUE, TRUE, 0);
+
+ gtk_widget_show (syntax_combo_box);
+
+
+ /* add vbox to window */
+ gtk_container_add (GTK_CONTAINER (window), v_box);
+ gtk_widget_show (v_box);
+
+
+}
+
+
+
+static void
+grapper_gconfclient_notify(GConfClient* client, guint cnxn_id,
+ GConfEntry *entry, gpointer user_data)
+{
+ /* grapper_state* state = (grapper_state*)user_data; */
+ GError* err = NULL;
+ int width, height;
+
+ gtk_window_get_size (GTK_WINDOW(grapper_window), &width, &height);
+
+
+ width = gconf_client_get_int (gconf_client, width_gconf_key, &err);
+ if(err) {
+ g_error_free (err);
+ err = NULL;
+ width = -1;
+ } else
+ fprintf(stderr, "gconf width changed to %d\n", width);
+
+ height = gconf_client_get_int (gconf_client, height_gconf_key, &err);
+ if(err) {
+ g_error_free (err);
+ err = NULL;
+ height = -1;
+ } else
+ fprintf(stderr, "gconf height changed to %d\n", width);
+
+ /* let's not make it too small */
+ if(width < MIN_WINDOW_WIDTH)
+ width = MIN_WINDOW_WIDTH;
+ if(height < MIN_WINDOW_HEIGHT)
+ height = MIN_WINDOW_HEIGHT;
+
+ gtk_window_resize (GTK_WINDOW(grapper_window), width, height);
+}
+
+
+static void
+grapper_gconflient_free(gpointer user_data)
+{
+
+}
+
+
+static gint
+configure_callback(GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+ gint width, height;
+ GError* err = NULL;
+
+ gtk_window_get_size (GTK_WINDOW(grapper_window), &width, &height);
+
+ if(!gconf_client_set_int (gconf_client, width_gconf_key, width, &err)) {
+ fprintf(stderr, "gconf error writing width: %s\n", err->message);
+ g_error_free (err);
+ err = NULL;
+ }
+
+ if(!gconf_client_set_int (gconf_client, height_gconf_key, height, &err)) {
+ fprintf(stderr, "gconf error writing width: %s\n", err->message);
+ g_error_free (err);
+ err = NULL;
+ }
+
+ return FALSE;
+}
+
+
+
+int
+main(int argc, char *argv[])
+{
+ grapper_state state;
+ GError* err = NULL;
+ guint cnxn;
+ int width, height;
+
+ gtk_init (&argc, &argv);
+
+ g_set_application_name (application_name);
+
+ memset(&state, 0, sizeof(grapper_state));
+
+ state.world = raptor_new_world();
+
+ gconf_client = gconf_client_get_default();
+
+ cnxn = gconf_client_notify_add (gconf_client, gconf_namespace,
+ grapper_gconfclient_notify,
+ (gpointer)&state, /* user data */
+ grapper_gconflient_free,
+ &err);
+
+ /* create the main window */
+ grapper_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+ gtk_window_set_title (GTK_WINDOW(grapper_window), application_title);
+
+ init_grapper_window(grapper_window, &state);
+
+ width = gconf_client_get_int (gconf_client, width_gconf_key, &err);
+ if(err) {
+ fprintf(stderr, "gconf error reading width: %s\n", err->message);
+ g_error_free (err);
+ err = NULL;
+ width= -1;
+ }
+
+ height = gconf_client_get_int (gconf_client, height_gconf_key, &err);
+ if(err) {
+ fprintf(stderr, "gconf error reading height: %s\n", err->message);
+ g_error_free (err);
+ err = NULL;
+ height= -1;
+ }
+
+ /* let's not make it too small */
+ if(width < MIN_WINDOW_WIDTH)
+ width = MIN_WINDOW_WIDTH;
+ if(height < MIN_WINDOW_HEIGHT)
+ height = MIN_WINDOW_HEIGHT;
+
+ gtk_window_set_default_size (GTK_WINDOW(grapper_window), width, height);
+
+ /* Connect the window resize event to configure_callback */
+ g_signal_connect (G_OBJECT (grapper_window), "configure_event",
+ G_CALLBACK (configure_callback), &state);
+
+ /* finally make it all visible */
+ gtk_widget_show (grapper_window);
+
+ if(argc>1) {
+ if(!access(argv[1], R_OK)) {
+ /* it's a file - make a URL out of it */
+ unsigned char *uri_string = raptor_uri_filename_to_uri_string(argv[1]);
+ grapper_model_set_url(&state, uri_string);
+ free(uri_string);
+ } else
+ grapper_model_set_url(&state, (unsigned char*)argv[1]);
+
+ grapper_model_parse(&state);
+ }
+
+ /* main loop, exited when gtk_main_quit() is called */
+ gtk_main ();
+
+ raptor_free_world(state.world);
+
+ gconf_client_notify_remove (gconf_client, cnxn);
+
+ return 0;
+}
+
diff --git a/examples/raptor_abort.c b/examples/raptor_abort.c
new file mode 100644
index 0000000..d71fe9e
--- /dev/null
+++ b/examples/raptor_abort.c
@@ -0,0 +1,128 @@
+/* -*- Mode: c; c-basic-offset: 2 -*-
+ *
+ * raptor_abort.c - Raptor abort example code
+ *
+ * Copyright (C) 2003-2006, David Beckett http://purl.org/net/dajobe/
+ * Copyright (C) 2003-2004, University of Bristol, UK http://www.bristol.ac.uk/
+ *
+ * This package is Free Software and part of Redland http://librdf.org/
+ *
+ * It is licensed under the following three licenses as alternatives:
+ * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
+ * 2. GNU General Public License (GPL) V2 or any newer version
+ * 3. Apache License, V2.0 or any newer version
+ *
+ * You may not use this file except in compliance with at least one of
+ * the above three licenses.
+ *
+ * See LICENSE.html or LICENSE.txt at the top of this package for the
+ * complete terms and further detail along with the license texts for
+ * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
+ *
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <raptor_config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/* for the memory allocation functions */
+#if defined(HAVE_DMALLOC_H) && defined(RAPTOR_MEMORY_DEBUG_DMALLOC)
+#include <dmalloc.h>
+#endif
+
+/* Raptor includes */
+#include <raptor2.h>
+
+
+static void handle_statements(void *user_data, raptor_statement *statement);
+int main(int argc, char *argv[]);
+
+
+typedef struct
+{
+ raptor_parser *parser;
+ FILE *stream;
+ int count;
+ int max;
+ int stopped;
+} my_data;
+
+
+static void
+handle_statements(void *user_data, raptor_statement *statement)
+{
+ my_data* me=(my_data*)user_data;
+
+ me->count++;
+ if(me->count > me->max) {
+ fprintf(me->stream, "Reached %d statements, stopping\n", me->max);
+ raptor_parser_parse_abort(me->parser);
+ me->stopped=1;
+ return;
+ }
+
+ fprintf(me->stream, "Saw statement %d\n", me->count);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ raptor_world* world;
+ raptor_parser* rdf_parser;
+ raptor_uri* uri;
+ my_data* me;
+ const char *program;
+ int rc;
+
+ program=argv[0];
+
+ if(argc != 2) {
+ fprintf(stderr, "%s: USAGE [RDF-XML content URI]\n", program);
+ exit(1);
+ }
+
+ world = raptor_new_world();
+
+ me=(my_data*)malloc(sizeof(my_data));
+ if(!me) {
+ fprintf(stderr, "%s: Out of memory\n", program);
+ exit(1);
+ }
+
+ me->stream=stderr;
+ me->count = 0;
+ me->max=5;
+
+ uri = raptor_new_uri(world, (const unsigned char*)argv[1]);
+ rdf_parser = raptor_new_parser(world, "rdfxml");
+
+ me->parser = rdf_parser;
+
+ raptor_parser_set_statement_handler(rdf_parser, me, handle_statements);
+
+ me->stopped = 0;
+ rc = raptor_parser_parse_uri(rdf_parser, uri, NULL);
+
+ fprintf(stderr, "%s: Parser returned status %d, stopped? %s\n", program, rc,
+ (me->stopped ? "yes" : "no"));
+
+ free(me);
+
+ raptor_free_parser(rdf_parser);
+
+ raptor_free_uri(uri);
+
+ raptor_free_world(world);
+
+ return 0;
+}
diff --git a/examples/rdfcat.c b/examples/rdfcat.c
new file mode 100644
index 0000000..978a641
--- /dev/null
+++ b/examples/rdfcat.c
@@ -0,0 +1,55 @@
+#include <stdio.h>
+#include <raptor2.h>
+
+/* rdfcat.c: parse any RDF syntax and serialize to RDF/XML-Abbrev */
+
+static raptor_serializer* rdf_serializer;
+
+static void
+serialize_triple(void* user_data, raptor_statement* triple)
+{
+ raptor_serializer_serialize_statement(rdf_serializer, triple);
+}
+
+static void
+declare_namespace(void* user_data, raptor_namespace *nspace)
+{
+ raptor_serializer_set_namespace_from_namespace(rdf_serializer, nspace);
+}
+
+int
+main(int argc, char *argv[])
+{
+ raptor_world *world = NULL;
+ raptor_parser* rdf_parser = NULL;
+ unsigned char *uri_string;
+ raptor_uri *uri, *base_uri;
+
+ world = raptor_new_world();
+
+ uri_string = raptor_uri_filename_to_uri_string(argv[1]);
+ uri = raptor_new_uri(world, uri_string);
+ base_uri = raptor_uri_copy(uri);
+
+ /* Ask raptor to work out which parser to use */
+ rdf_parser = raptor_new_parser(world, "guess");
+ raptor_parser_set_statement_handler(rdf_parser, NULL, serialize_triple);
+ raptor_parser_set_namespace_handler(rdf_parser, NULL, declare_namespace);
+
+ rdf_serializer = raptor_new_serializer(world, "rdfxml-abbrev");
+
+ raptor_serializer_start_to_file_handle(rdf_serializer, base_uri, stdout);
+ raptor_parser_parse_file(rdf_parser, uri, base_uri);
+ raptor_serializer_serialize_end(rdf_serializer);
+
+ raptor_free_serializer(rdf_serializer);
+ raptor_free_parser(rdf_parser);
+
+ raptor_free_uri(base_uri);
+ raptor_free_uri(uri);
+ raptor_free_memory(uri_string);
+
+ raptor_free_world(world);
+
+ return 0;
+}
diff --git a/examples/rdfcount.c b/examples/rdfcount.c
new file mode 100644
index 0000000..9c899b1
--- /dev/null
+++ b/examples/rdfcount.c
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include <raptor2.h>
+
+/* rdfcount.c: parse any number of RDF/XML files and count the triples */
+
+static void
+count_triples(void* user_data, raptor_statement* triple)
+{
+ unsigned int* count_p = (unsigned int*)user_data;
+ (*count_p)++;
+}
+
+int
+main(int argc, char *argv[])
+{
+ raptor_world *world = NULL;
+ const char* program = "rdfcount";
+ raptor_parser* rdf_parser = NULL;
+ unsigned int i;
+ unsigned int count;
+ unsigned int files_count = 0;
+ unsigned int total_count = 0;
+
+ world = raptor_new_world();
+
+ /* just one parser is used and reused here */
+ rdf_parser = raptor_new_parser(world, "rdfxml");
+
+ raptor_parser_set_statement_handler(rdf_parser, &count, count_triples);
+
+ for(i = 1; argv[i]; i++) {
+ const char* filename = argv[i];
+ unsigned char *uri_string;
+ raptor_uri *uri, *base_uri;
+
+ uri_string = raptor_uri_filename_to_uri_string(filename);
+ uri = raptor_new_uri(world, uri_string);
+ base_uri = raptor_uri_copy(uri);
+
+ count = 0;
+ if(!raptor_parser_parse_file(rdf_parser, uri, base_uri)) {
+ fprintf(stderr, "%s: %s : %d triples\n", program, filename, count);
+ total_count += count;
+ files_count++;
+ } else {
+ fprintf(stderr, "%s: %s : failed to parse\n", program, filename);
+ }
+
+ raptor_free_uri(base_uri);
+ raptor_free_uri(uri);
+ raptor_free_memory(uri_string);
+ }
+
+ raptor_free_parser(rdf_parser);
+
+ raptor_free_world(world);
+
+ fprintf(stderr, "%s: Total count: %d files %d triples\n",
+ program, files_count, total_count);
+
+ return 0;
+}
diff --git a/examples/rdfguess.c b/examples/rdfguess.c
new file mode 100644
index 0000000..b636c0b
--- /dev/null
+++ b/examples/rdfguess.c
@@ -0,0 +1,102 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <raptor2.h>
+
+
+/* rdfguess.c: guess parser name from filename and its content */
+
+#define READ_BUFFER_SIZE 256
+
+static int
+rdfguess_guess_name(raptor_world* world, const char* filename)
+{
+ char *buffer[READ_BUFFER_SIZE];
+ raptor_iostream* iostr = NULL;
+ const char* name;
+ const unsigned char* identifier;
+ const char* label;
+ size_t read_len;
+ size_t count;
+
+ if(!strcmp(filename, "-")) {
+ iostr = raptor_new_iostream_from_file_handle(world, stdin);
+ identifier = NULL;
+ label = "<stdin>";
+ } else {
+ if(access(filename, R_OK)) {
+ fprintf(stderr, "rdfguess: file %s not found\n", filename);
+ return 1;
+ }
+
+ iostr = raptor_new_iostream_from_filename(world, filename);
+ identifier = (const unsigned char *)filename;
+ label = filename;
+ }
+
+ if(!iostr) {
+ fprintf(stderr, "rdfguess: Could not create iostream for %s\n", label);
+ goto tidy;
+ }
+
+ read_len = READ_BUFFER_SIZE;
+ count = raptor_iostream_read_bytes(buffer, 1, read_len, iostr);
+ if(count < 1) {
+ fprintf(stderr, "rdfguess: Failed to read any data from %s\n",
+ label);
+ goto tidy;
+ }
+
+ name = raptor_world_guess_parser_name(world,
+ /* uri*/ NULL,
+ /* mime_type */ NULL,
+ (const unsigned char*)buffer,
+ read_len,
+ identifier);
+
+ if(name)
+ fprintf(stdout, "rdfguess: %s guessed to be %s\n", label, name);
+ else
+ fprintf(stdout, "rdfguess: failed to guess parser for %s\n", label);
+
+ tidy:
+ raptor_free_iostream(iostr);
+
+ return 0;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ raptor_world *world = NULL;
+ const char *filename;
+ int rc = 0;
+
+ world = raptor_new_world();
+
+ if(argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
+ fprintf(stderr, "USAGE rdfguess [FILENAMES...]\n");
+ rc = 1;
+ goto tidy;
+ }
+
+ if(argc == 1) {
+ rc = rdfguess_guess_name(world, "-");
+ } else {
+ int i;
+
+ for(i = 1; (filename = (const char*)argv[i]); i++) {
+ rc = rdfguess_guess_name(world, filename);
+ if(rc)
+ break;
+ }
+ }
+
+ tidy:
+ raptor_free_world(world);
+
+ return rc;
+}
diff --git a/examples/rdfprint.c b/examples/rdfprint.c
new file mode 100644
index 0000000..093aa98
--- /dev/null
+++ b/examples/rdfprint.c
@@ -0,0 +1,42 @@
+#include <stdio.h>
+#include <raptor2.h>
+
+/* rdfprint.c: print triples from parsing RDF/XML */
+
+static void
+print_triple(void* user_data, raptor_statement* triple)
+{
+ raptor_statement_print_as_ntriples(triple, stdout);
+ fputc('\n', stdout);
+}
+
+int
+main(int argc, char *argv[])
+{
+ raptor_world *world = NULL;
+ raptor_parser* rdf_parser = NULL;
+ unsigned char *uri_string;
+ raptor_uri *uri, *base_uri;
+
+ world = raptor_new_world();
+
+ rdf_parser = raptor_new_parser(world, "rdfxml");
+
+ raptor_parser_set_statement_handler(rdf_parser, NULL, print_triple);
+
+ uri_string = raptor_uri_filename_to_uri_string(argv[1]);
+ uri = raptor_new_uri(world, uri_string);
+ base_uri = raptor_uri_copy(uri);
+
+ raptor_parser_parse_file(rdf_parser, uri, base_uri);
+
+ raptor_free_parser(rdf_parser);
+
+ raptor_free_uri(base_uri);
+ raptor_free_uri(uri);
+ raptor_free_memory(uri_string);
+
+ raptor_free_world(world);
+
+ return 0;
+}
diff --git a/examples/rdfserialize.c b/examples/rdfserialize.c
new file mode 100644
index 0000000..ecbc6b3
--- /dev/null
+++ b/examples/rdfserialize.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <raptor2.h>
+#include <stdlib.h>
+
+/* rdfserialize.c: serialize 1 triple to RDF/XML-Abbrev */
+
+int
+main(int argc, char *argv[])
+{
+ raptor_world *world = NULL;
+ raptor_serializer* rdf_serializer = NULL;
+ unsigned char *uri_string;
+ raptor_uri *base_uri;
+ raptor_statement* triple;
+
+ world = raptor_new_world();
+
+ uri_string = raptor_uri_filename_to_uri_string(argv[1]);
+ base_uri = raptor_new_uri(world, uri_string);
+
+ rdf_serializer = raptor_new_serializer(world, "rdfxml-abbrev");
+ raptor_serializer_start_to_file_handle(rdf_serializer, base_uri, stdout);
+
+ /* Make a triple with URI subject, URI predicate, literal object */
+ triple = raptor_new_statement(world);
+ triple->subject = raptor_new_term_from_uri_string(world, (const unsigned char*)"http://example.org/subject");
+ triple->predicate = raptor_new_term_from_uri_string(world, (const unsigned char*)"http://example.org/predicate");
+ triple->object = raptor_new_term_from_literal(world,
+ (const unsigned char*)"An example literal",
+ NULL,
+ (const unsigned char*)"en");
+
+ /* Write the triple */
+ raptor_serializer_serialize_statement(rdf_serializer, triple);
+
+ /* Delete the triple */
+ raptor_free_statement(triple);
+
+ raptor_serializer_serialize_end(rdf_serializer);
+ raptor_free_serializer(rdf_serializer);
+
+ raptor_free_uri(base_uri);
+ raptor_free_memory(uri_string);
+
+ raptor_free_world(world);
+ return 0;
+}