rasqal-0.9.33/0000755000175000017500000000000012443715253010100 500000000000000rasqal-0.9.33/build/0000755000175000017500000000000012443715251011175 500000000000000rasqal-0.9.33/build/ltversion.m40000644000175000017500000000126212311460143013374 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file 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. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) rasqal-0.9.33/build/pkg.m40000644000175000017500000001716712127570662012160 00000000000000# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR rasqal-0.9.33/build/missing0000755000175000017500000002415212311460147012513 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: rasqal-0.9.33/build/ltmain.sh0000644000175000017500000105202612311460143012732 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1.1" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 rasqal-0.9.33/build/config.sub0000755000175000017500000010532712311460147013103 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: rasqal-0.9.33/build/install-sh0000755000175000017500000003325612311460147013125 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: rasqal-0.9.33/build/compile0000755000175000017500000001615212311460147012473 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-03-05.13; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free # Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: rasqal-0.9.33/build/depcomp0000755000175000017500000005064312311460150012467 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: rasqal-0.9.33/build/ltsugar.m40000644000175000017500000001042412311460143013030 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file 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. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) rasqal-0.9.33/build/gtk-doc.m40000644000175000017500000000461112311460143012700 00000000000000dnl -*- mode: autoconf -*- # serial 1 dnl Usage: dnl GTK_DOC_CHECK([minimum-gtk-doc-version]) AC_DEFUN([GTK_DOC_CHECK], [ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first dnl check for tools we added during development AC_PATH_PROG([GTKDOC_CHECK],[gtkdoc-check]) AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true]) AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf]) dnl for overriding the documentation installation directory AC_ARG_WITH([html-dir], AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),, [with_html_dir='${datadir}/gtk-doc/html']) HTML_DIR="$with_html_dir" AC_SUBST([HTML_DIR]) dnl enable/disable documentation building AC_ARG_ENABLE([gtk-doc], AS_HELP_STRING([--enable-gtk-doc], [use gtk-doc to build documentation [[default=no]]]),, [enable_gtk_doc=no]) if test x$enable_gtk_doc = xyes; then ifelse([$1],[], [PKG_CHECK_EXISTS([gtk-doc],, AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))], [PKG_CHECK_EXISTS([gtk-doc >= $1],, AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build $PACKAGE_NAME]))]) dnl don't check for glib if we build glib if test "x$PACKAGE_NAME" != "xglib"; then dnl don't fail if someone does not have glib PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,) fi fi AC_MSG_CHECKING([whether to build gtk-doc documentation]) AC_MSG_RESULT($enable_gtk_doc) dnl enable/disable output formats AC_ARG_ENABLE([gtk-doc-html], AS_HELP_STRING([--enable-gtk-doc-html], [build documentation in html format [[default=yes]]]),, [enable_gtk_doc_html=yes]) AC_ARG_ENABLE([gtk-doc-pdf], AS_HELP_STRING([--enable-gtk-doc-pdf], [build documentation in pdf format [[default=no]]]),, [enable_gtk_doc_pdf=no]) if test -z "$GTKDOC_MKPDF"; then enable_gtk_doc_pdf=no fi AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes]) AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes]) AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes]) AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"]) AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"]) ]) rasqal-0.9.33/build/config.guess0000755000175000017500000012743212311460147013441 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: rasqal-0.9.33/build/ar-lib0000755000175000017500000001330312311460147012204 00000000000000#! /bin/sh # Wrapper for Microsoft lib.exe me=ar-lib scriptversion=2012-03-01.08; # UTC # Copyright (C) 2010, 2012 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # func_error message func_error () { echo "$me: $1" 1>&2 exit 1 } file_conv= # func_file_conv build_file # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv in mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin) file=`cygpath -m "$file" || echo "$file"` ;; wine) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_at_file at_file operation archive # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE # for each of them. # When interpreting the content of the @FILE, do NOT use func_file_conv, # since the user would need to supply preconverted file names to # binutils ar, at least for MinGW. func_at_file () { operation=$2 archive=$3 at_file_contents=`cat "$1"` eval set x "$at_file_contents" shift for member do $AR -NOLOGO $operation:"$member" "$archive" || exit $? done } case $1 in '') func_error "no command. Try '$0 --help' for more information." ;; -h | --h*) cat <='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS rasqal-0.9.33/build/ltoptions.m40000644000175000017500000003007312311460143013404 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file 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. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) rasqal-0.9.33/ChangeLog0000644000175000017500000016064012443715213011575 000000000000002014-12-15 Dave Beckett * Snapshotted rasqal_0_9_33 for 0.9.33 release (GIT 75040ce428844b5ad6f0f9d0ba2b9ff2d75d3c45) 2014-12-14 Dave Beckett * NEWS.html, RELEASE.html: 0.9.33 * src/rasqal_query_results.c: Skip only one triple in CONSTRUCT with unbound vars (rasqal_query_results_get_triple): Alter skipping to use rasqal_query_results_next_triple rather than reset to next result when a triple has an unbound or non-RDF part. Fixes Issue #0000583 http://bugs.librdf.org/mantis/view.php?id=583 2014-12-07 Dave Beckett * docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-unused.sgml: Update tmpls * src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_result_formats.c, src/rasqal_update.c, utils/check_query.c, utils/roqet.c, utils/to-ntriples.c: Revert 8e53443f3333ce907d3c78647036d5bb36a96aaf - adding default cases Too noisy for unreachable code. * ChangeLog, NEWS.html, RELEASE.html: 0.9.33 * utils/roqet.1, utils/roqet.c: Add support for protocol queries against a local file Added format -p [base URI] Fixes Issue #0000546 http://bugs.librdf.org/mantis/view.php?id=546 * utils/roqet.c: Replace a bunch of help printf with puts and simply 2014-12-05 Dave Beckett * ChangeLog, RELEASE.html: 0.9.33 2014-11-27 Dave Beckett * src/rasqal_format_sparql_xml.c, src/rasqal_rowsource_service.c: Fix variables count for SPARQL XML results (rasqal_service_rowsource_ensure_variables): Copy variables in (rasqal_sparql_xml_sax2_end_element_handler): Take variables count from rowsource size, not vars_table size. Fixes Issue #0000588 http://bugs.librdf.org/mantis/view.php?id=588 * src/rasqal_rowsource.c: rasqal_rowsource_copy_variables add debug error report * Merge pull request #5 from rhmccullough/mkr-table mKR relation CSV output for bindings results 2014-11-24 Richard H. McCullough * src/rasqal_format_sv.c: append ";" to end of variable list * src/rasqal_algebra.c, src/rasqal_data_graph.c, src/rasqal_decimal.c, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_literal.c, src/rasqal_query_write.c, src/rasqal_results_compare.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_triples.c, src/rasqal_variable.c, src/strcasecmp.c: Replace type %d (for enums) with %u in error messages (-Wformat) 2014-11-23 Richard H. McCullough * src/rasqal_format_sv.c: mKR relation output for select commands 2014-11-23 Dave Beckett * src/rasqal_regex.c: pcre regex offset casts (-Wconversion) * src/snprintf.c: Remove not needed cast for snprintf (-Wconversion) * src/rasqal_result_formats.c: sequnce index casts (-Wconversion) * src/rasqal_random.c: mtwist_u32rand cast (-Wconversion) * src/rasqal_query_transform.c: memcpy cast (-Wconversion) * src/rasqal_random.c: getpid cast (-Wconversion) * src/rasqal_query_transform.c, src/rasqal_row.c: unsigned flag casts (-Wconversion) * src/rasqal_query_transform.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_row_compatible.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_variable.c: calloc casts (-Wconversion) * src/rasqal_general.c: Unicode character width casts (-Wconversion) * src/rasqal_format_table.c: Table widths casts (-Wconversion) * src/rasqal_format_sparql_xml.c: raptor_stringbuffer_append_counted_string cast -bad (-Wconversion) * src/rasqal_digest.c: rasqal_digest_buffeer casts for mash (-Wconversion) * src/rasqal_decimal.c: snprintf cast (-Wconversion) * src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c: raptor_iostream_read_bytes casts - bad (-Wconversion) * src/rasqal_format_sv.c, src/rasqal_literal.c, src/rasqal_result_formats.c: char casts (-Wconversion) * src/rasqal_graph_pattern.c, src/rasqal_map.c, src/rasqal_query_write.c, src/rasqal_rowsource.c: Indent casts (-Wconversion) * src/rasqal_format_rdf.c, src/rasqal_format_sv.c, src/rasqal_general.c, src/rasqal_query_results.c: Loop var casts (-Wconversion) * src/rasqal_format_sv.c: Signed SV results score (-Wconversion) * utils/check_query.c, utils/roqet.c: Unsigned indent (-Wconversion) * src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_projection.c, src/rasqal_query.c: distinct, limit, offset are ints. wildcard is 0 or 1 (-Wconversion) * src/rasqal_results_compare.c: Casts for results compare (-Wconversion) * src/rasqal.h.in, src/rasqal_data_graph.c: Data graph takes unsigned flags (-Wconversion) * src/rasqal_sort.c: Casts for sorting (-Wconversion) * src/rasqal_xsd_datatypes.c: Casts for xsd (-Wconversion) * src/rasqal_datetime.c: Casts for datetime formatting (-Wconversion) * configure.ac: Remove -Wswitch-bool enabled by default in gcc * tests/engine/rasqal_construct_test.c, tests/engine/rasqal_limit_test.c, tests/engine/rasqal_order_test.c: Disable "-Wformat-nonliteral" with GCC pragma for test codes 2014-11-22 Dave Beckett * src/rasqal_query_test.c, src/rasqal_rowsource_triples.c: Disable "-Wformat-nonliteral" with GCC pragma for test code * configure.ac: Document -Wconversion disabled * src/rasqal_algebra.c, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_expr_strings.c: Cast macros for -Wconversion (work in progress; many to go) * src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_query.c: Make internal limit, offset and distinct vars be unsigned (-Wconversion) (rasqal_new_orderby_algebra_node, rasqal_new_slice_algebra_node): Take unsigned vars. (rasqal_algebra_query_add_slice, rasqal_query_print): Fix checks for <= 0 that now can be just = 0 * src/rasqal.h.in, src/rasqal_expr.c: (rasqal_new_group_concat_expression): Unsigned bit flags * configure.ac: Document -Wcast-qual is noisy * configure.ac: Remove gcc warnings included in -Wall -Wlogical-not-parentheses -Wsizeof-array-argument -Wbool-compare * configure.ac: Disable -Wswitch-default again * src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_result_formats.c, src/rasqal_update.c, utils/check_query.c, utils/roqet.c, utils/to-ntriples.c: Add some default: cases (-Wswitch-default) * configure.ac: Add -Wswitch-default * configure.ac: Enable -Wconversion * src/rasqal_format_sv.c: Use size_t for sv size (-Wconversion) rasqal_rowsource_sv_context field variables_count changes to size_t to capture full sv size * .travis.yml: Travis CI: Try to exclude some matrix combinations * configure.ac: Enable -Wformat=2 for gcc * utils/check_query.c, utils/roqet.c, utils/srxread.c, utils/testrunner.c: Remove static string printfs in utilities (-Wformat) * .travis.yml, scripts/install-bison3.sh: Travis-CI fixes - apt-get update * src/rasqal_rowsource_join.c: Trailing , * src/rasqal_format_html.c: C style comment * src/rasqal.h.in, src/rasqal_internal.h: Remove trailing ,s (C90) 2014-11-21 Dave Beckett * scripts/install-raptor.sh: Tidy code * docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-unused.sgml: Update tmpls * src/rasqal.h.in: Document arg4 for rasqal_expression * src/rasqal_format_sv.c: De-comment * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_triples): Put decl first (C90) * scripts/fix-bison.pl, scripts/fix-flex.pl, scripts/fix-groff-xhtml.pl, scripts/fix-gtkdoc-header.pl: Update scripts 2014-11-03 Dave Beckett * Merge pull request #4 from dajobe/multi-expr-unroll Evaluate expressions in document order left-to-right 2014-11-02 Dave Beckett * src/sparql_parser.y: ME2 to MuExOpUnaryExpression * src/sparql_parser.y: Make debug expr conditionalized * src/sparql_parser.y: More debug prints. Join AE2List and AE2 sequences * src/rasqal_internal.h, src/sparql_parser.y: Refactoring seems ok * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_triples): Declare vars first (C90) * src/sparql_parser.y: (sparql_parse): Fix debug set variable * src/rasqal_expr.c: debug message for expr is constant * .travis.yml: raptor 2.0.15 is latest * src/rasqal_xsd_datatypes.c: (rasqal_xsd_check_integer_format): Write check, no need for strtol() 2014-10-19 Dave Beckett * docs/rasqal-changes.tsv: Fix fields count * scripts/process-changes.pl: Make process-changes.pl report wrong fields count * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Add new methods to changelog * Merge pull request #1 from cosminbasca/master new getter functions: rasqal_graph_pattern_get_triples, rasqal_literal_get_type, rasqal_literal_get_language * scripts/install-raptor.sh: fix install names * .travis.yml: -; * .travis.yml, scripts/install-raptor.sh: Try to install raptor if it's not there * .travis.yml, scripts/install-bison3.sh: Travis CI 2014-10-10 Dave Beckett * scripts/fix-bison.pl, scripts/fix-gtkdoc-header.pl: perms * utils/Makefile.am: fix-groff-xhtml.pl 2014-10-09 Dave Beckett * src/Makefile.am: Further fix flex/bison rules to silence them in normal runs * src/Makefile.am: Add use of AM_V_GEN to make make V=0 look good After change to Raptor's turtle parser/lexer rules * docs/Makefile.am, scripts/Makefile.am, scripts/fix-bison, scripts/fix-bison.pl, scripts/fix-flex, scripts/fix-flex.pl, scripts/fix-groff-xhtml, scripts/fix-groff-xhtml.pl, src/Makefile.am: Rename scripts/fix-* to add .pl suffix * configure.ac: Add some GCC5 warning flags * configure.ac, src/rasqal_internal.h: Use __FUNCTION__ (c99) replacing __func__ (c90) * Merge pull request #3 from hroptatyr/compiler-support Intel C compiler (icc) support 2014-10-09 Sebastian Freundt * configure.ac: Always use AC_LANG_WERROR when checking for compiler warning flags Many gcc-compatible compilers (icc, clang, etc.) verbosely ignore gcc command line flags issuing a warning of some sort. Catch these warnings and turn them into errors when checking for support of specific warning flags. 2014-10-06 Dave Beckett * ChangeLog, RELEASE.html: 0.9.33 2014-08-02 Dave Beckett * INSTALL.html: Fix flex url * INSTALL.html, README.html: Bye bye sf 2014-07-06 Dave Beckett * src/rasqal_rowsource.c: (rasqal_new_rowsource_from_handler): Init default size to 0 (rasqal_rowsource_add_variable): Remove workaround needed for above. * tests/sparql/warnings/manifest.ttl: there is no test_4 * src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_row.c, utils/check_query.c, utils/manifest.c: rasqal_query_results_sort simplified (rasqal_query_results_sort): Switch to use of internal helper for sorting and rasqal_variables_table_get_order() to order the variables in a result by name. (rasqal_query_results_sort_compare_row): replaces rasqal_row_compare_arg() and uses a private context struct rqr_context. Update callers of rasqal_query_results_sort() * src/rasqal_internal.h, src/rasqal_variable.c: (rasqal_variables_table_get_order): Added * src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_array_compare_by_order): Added sort+arg helper * src/rasqal_literal.c: docs * src/rasqal_internal.h, src/rasqal_row.c, utils/check_query.c, utils/manifest.c: (rasqal_row_compare_arg): Renamed from rasqal_row_compare Update callers * utils/Makefile.am: Add all-programs rule for testing * src/rasqal_query_results.c, utils/check_query.c: (rasqal_query_results_sort): Add user_data arg If raptor is 2.0.15 or newer, uses raptor_sequence_sort_r otherwise uses internal rasqal_sequence_as_sorted() to alter the result sequence directly. Update callers * configure.ac, src/Makefile.am, src/rasqal_internal.h, src/rasqal_sort.c: (rasqal_sequence_as_sorted): Added if raptor < 2.0.15 Uses inline static rasqal_ssort_r() * src/Makefile.am, src/ssort.h: Add ssort.h defining static rasqal_ssort_r() public domain 2014-06-21 Dave Beckett * src/rasqal_internal.h, src/rasqal_query_results.c, utils/manifest.c: Revert "(rasqal_query_results_sort): Takes just result arg" This reverts commit 4a8bbb35926c6a27b0a217bbbe6910ca95ef1426. * src/rasqal_internal.h, src/rasqal_query_results.c, utils/manifest.c: (rasqal_query_results_sort): Takes just result arg * utils/manifest.c: (manifest_testsuite_run_suite): Take copy of test into result seqs * utils/manifest.c, utils/manifest.h: Add reference count model for manifest_test (manifest_new_test_from_test): Added * utils/testrunner.c: free result after getting state 2014-06-19 Dave Beckett * utils/manifest.c: (manifest_manifests_run): Do not leak ts->tests sequence 2014-06-15 Dave Beckett * tests/sparql/SyntaxFull/manifest.ttl: Remove syntax-bnodes-03.rq and syntax-bnodes-04.rq from manifest too * tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprBuiltins/data-builtin-1.ttl, tests/sparql/ExprBuiltins/result-datatype-1.ttl: Fix data-builtin-1.ttl result-datatype-1.ttl to match upstream * src/rasqal_results_compare.c: (rasqal_results_compare_compare): If no vars, don't compare var sets * src/rasqal_format_rdf.c: Remove all vars from empty results files (no rows) (rasqal_rowsource_rdf_process): If a result set is found with no rows, remove all vars too. * src/rasqal_internal.h, src/rasqal_rowsource.c: (rasqal_rowsource_remove_all_variables): Added - internal * utils/manifest.c: (manifest_new_test): Fix approval URI check * utils/manifest.c: (manifest_test_print): Make test flag printing more compact. * tests/sparql/SyntaxFull/Makefile.am, tests/sparql/SyntaxFull/syntax-bnodes-03.rq, tests/sparql/SyntaxFull/syntax-bnodes-04.rq: Remove never approved tests SyntaxFull/syntax-bnodes-0[34].rq * tests/sparql/SyntaxFull/manifest.ttl: syntax-bnodes-03.rq and syntax-bnodes-04.rq were never approved * tests/sparql/federated/Makefile.am, tests/sparql/federated/manifest.ttl: Add manifest.ttl to tests/sparql/federated * tests/sparql/update/Makefile.am, tests/sparql/update/manifest.ttl: Add manifest.ttl to tests/sparql/update/ * utils/manifest.c: (manifest_test_print): Tidy and indent test printing * utils/manifest.c: (manifest_test_print): Add all flags * utils/manifest.c: (manifest_testsuite_run): Fix default state for non-syntax tests * utils/testrunner.c: Testrunner result state is based on testsuite result state Now ignores error/warning counts as these may be OK if the tests are expected to fail. * utils/manifest.c: More debug test result reporting * utils/manifest.c: (manifest_testsuite_run_suite): Return state based on failures * utils/manifest.c: Handle syntax tests: do not try to run query. (manifest_test_run): After prepare/parse, end for a syntax test. For non-syntax tests, log error and stop. * utils/manifest.c: XFAIL and UXPASS are now internal; do not report them * utils/manifest.c: Print debug test result state * utils/manifest.c, utils/manifest.h, utils/testrunner.c: Enable running only approved tests. (manifest_testsuite_run_suite): Add approved arg and check it. (manifest_manifests_run): Add approved arg and use to run suite with it above. Add -a/--approved arg to testrunner utility * utils/manifest.c: (manifest_testsuite_result_format): Print verbose uxpass * utils/manifest.c: (manifest_testsuite_result_format): Format uxpass better * utils/manifest.c: Count and repott skipped tests (update/protocol) Report STATE_LAST (SKIP) in summaries 2014-06-11 Dave Beckett * utils/manifest.c: (manifest_test_run): Print expected graph triples using rasqal_dataset_print() in debug mode. Do not fail with an actual graph result at results stage. * utils/manifest.c: Handle reading RDF graph results: default to guess and set a base URI * src/rasqal_dataset.c: (rasqal_dataset_print): Added * src/rasqal_dataset.c, src/rasqal_internal.h: Added rasqal_dataset_triples iterator class (rasqal_dataset_get_triples_iterator, rasqal_free_dataset_triples_iterator): Added constructor and destructor. (rasqal_dataset_triples_iterator_get) (rasqal_dataset_triples_iterator_next): Added methods to get and move * utils/manifest.c: (manifest_test_run): Warn and return if there is no query. * utils/manifest.c: (manifest_test_print): Handle non-querys * src/rasqal_literal.c: (rasqal_literal_as_uri): Just return NULL when it's not a URI * src/rasqal_query_results.c: (rasqal_query_results_sort): Survive being asked to sort a NULL sequence. 2014-06-10 Dave Beckett * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_concat): Fix SPARQL concat() types and languages 2014-06-08 Dave Beckett * src/rasqal_results_compare.c: (rasqal_results_compare_compare): Blanks compare equal always * configure.ac: Prefer PCRE regex library since it works with Unicode * utils/manifest.c: (manifest_new_test): Add print handler for data graphs sequence * utils/manifest.c: nl * src/rasqal_internal.h, src/rasqal_row.c: Ensure weak rowsource reference is never freed rasqal_row gains flags field. loses unused variable_names field too. (rasqal_row_set_rowsource, rasqal_row_set_weak_rowsource): Set / reset the weak rowosource flag to ensure only strong references are freed. 2014-06-04 Dave Beckett * utils/manifest.c: Block out debug print blocks * src/rasqal_query_results.c: code style * src/sparql_parser.y: Set eval context base URI when BASE is parsed 2014-06-02 Dave Beckett * utils/manifest.c: formatting * src/rasqal_literal.c: (rasqal_literal_as_uri): Do not lookup NULL variable value * utils/manifest.c: (manifest_test_run): Split reporting actual vs checking actual Allows tests with no expected value to pass. * utils/manifest.c: Split out reporting expected (if present) and checking it matches * utils/manifest.c: Report test details during run (manifest_test_print): Added (manifest_test_run): Call above in debug mode * utils/manifest.c: less debug * utils/manifest.c: NL * src/rasqal_rowsource_aggregation.c: Handle missing aggregation total for AVG (rasqal_builtin_agg_expression_execute_result): If there is no total literal, do not do a divide. * utils/manifest.c: Support results no expected results for e.g. syntax tests (manifest_new_test): Handle qt:query for just a query URI, no data or results. (manifest_test_run): Handle NULL expected or actual results and compare them either is NULL. * src/sparql_parser.y: Set base URI after query parsing to get it from BASE (rasqal_sparql_query_language_prepare): Call rasqal_evaluation_context_set_base_uri() 2014-06-01 Dave Beckett * src/rasqal_expr_strings.c: Make strbefore and strafter preserve, check languages and operate on strings (rasqal_expression_evaluate_strbefore, rasqal_expression_evaluate_strafter): Check rasqal_literal_is_string() on both needle and haystack. If haystack has a language, make sure it matches needle with rasqal_literal_string_languages_compare(). Copy needle language to result. * src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_is_string): Added helper * src/rasqal_internal.h, src/rasqal_literal.c: Add helpers for comparing string datatypes and languages (rasqal_literal_string_datatypes_compare, rasqal_literal_string_languages_compare): Added, pulled out of rasqal_literal_string_compare(). (rasqal_literal_string_compare): Updated to use them. Now does case independent language compare. (rasqal_literal_string_equals_flags): Use rasqal_literal_string_languages_compare(). 2014-06-01 Dave Beckett * src/rasqal_datetime.c: Fix datetime timezone issues (rasqal_xsd_datetime_normalize, rasqal_xsd_datetime_parse, rasqal_xsd_timezone_format): Store -/+ timezone minutes correctly (rasqal_xsd_datetime_get_timezone_as_counted_string): Handle no TZ 2014-05-31 Dave Beckett * src/rasqal_format_sparql_xml.c: (rasqal_rowsource_sparql_xml_get_boolean): Get value before freeing context. Coverity CID 65381 2014-05-27 Dave Beckett * src/rasqal_format_sparql_xml.c: (rasqal_sparql_xml_sax2_end_element_handler): Set row offset 2014-05-26 Dave Beckett * src/rasqal_row.c: (rasqal_row_compare): Less debugging, now RASQAL_DEBUG > 1 * src/rasqal_literal.c: Less literal comparison debugging, now RASQAL_DEBUG > 1 * src/rasqal_format_sparql_xml.c: less debugging, protected by TRACE_XML or higher RASQAL_DEBUG * src/rasqal_format_sparql_xml.c: Fix chunked parsing of literals in literal body Switch to use an appending stringbuffer to avoid truncated/overwritten literals when the element content was delivered in multiple literal chunks - especially a problem near unicode. (rasqal_sparql_xml_sax2_start_element_handler): Initialise sb. (rasqal_sparql_xml_sax2_characters_handler): Add content to sb (rasqal_sparql_xml_sax2_end_element_handler): Form single value / value_len vars from sb content. Use it for literal values and checking boolean. Reset sb at end (rasqal_sparql_xml_free_context): Free any sb. * src/rasqal_result_formats.c: (rasqal_query_results_formatter_read): Refactor to use switch * utils/check_query.c: Support boolean results in check-query and check for pass/fail. * utils/manifest.c: Support boolean results in manifest code and check for pass/fail. * src/rasqal_format_sparql_xml.c: Add boolean result format support for SPARQL XML Refactor XMl parsing code to handle bindings / boolean (rasqal_sparql_xml_start): Added to init XML parsing (rasqal_sparql_xml_sax2_start_element_handler): Handle boolean element start (NOP). (rasqal_sparql_xml_sax2_characters_handler): Handle boolean element content - save it. (rasqal_sparql_xml_sax2_end_element_handler): Handle boolean element content: - allow to end with no variables - check string for 'true' or 'false'. FIXME: handle case independent? (rasqal_rowsource_sparql_xml_init): Move most of it to rasqal_sparql_xml_start() (rasqal_rowsource_sparql_xml_finish): Move most of it to rasqal_sparql_xml_free_context() (rasqal_sparql_xml_init_context): Added, pulled out of rasqal_query_results_get_rowsource_sparql_xml() (rasqal_sparql_xml_free_context): Added, pulled out of rasqal_rowsource_sparql_xml_finish() (rasqal_rowsource_sparql_xml_get_boolean): Added new factory method to do all the XML work right here. (rasqal_query_results_get_rowsource_sparql_xml): Slimmed down calling rasqal_sparql_xml_init_context() to do most init working. (rasqal_query_results_sparql_xml_register_factory): Register get_boolean method. * src/rasqal_result_formats.c: (rasqal_query_results_formatter_read): Allow boolean results * src/rasqal_internal.h, src/rasqal_result_formats.c: Add support for boolean results from a query result format. rasqal_query_results_get_boolean_func handler func added. struct rasqal_query_results_format_factory_s gains factory method get_boolean with type above. (rasqal_query_results_formatter_get_boolean): Added to call method get_boolean if not NULL. * src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_query_results_set_boolean): Added internal method * utils/manifest.c: Turn "not supported" debug messages into rasqal logged messages * utils/manifest.c: debug messages * src/rasqal_query_results.c: (rasqal_query_results_update_query_bindings): Handle NULL v [coverity CID 63531] Although the logic makes this very unlikely * utils/manifest.c: nl * utils/manifest.c: (manifest_testsuite_result_format): Handle empty t->result * src/rasqal.h.in, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_service.c, utils/results.c, utils/srxread.c, utils/srxwrite.c: rasqal_query_results manages it's own variables table now (rasqal_new_query_results2): Deprecated for rasqal_new_query_results without the vars_table parameter that is now ignored. (rasqal_query_results_ensure_have_row_internal): Ensure the vars table is built once from the first row seen. (rasqal_query_results_get_binding_name): Get binding name from query results vars table rather than row. (rasqal_query_execute_with_engine, rasqal_new_query_results_from_string, rasqal_service_execute, srxread, srxwrite): Updated all callers of rasqal_new_query_results() to use rasqal_new_query_results2() with no vars table. * src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_row.c: Use query results vars table to get names (rasqal_query_results_get_bindings): Use rasqal_variables_table_get_names() on query results vars table. (rasqal_row_get_names): Removed since no longer used. * src/rasqal_query_results.c: Copy row values from query results vars table to query. (rasqal_query_results_update_query_bindings): Renamed from rasqal_query_results_update_bindings and now reads from query results vars table and copies row values into query vars table. Primary for CONSTRUCT * src/rasqal_internal.h, src/rasqal_variable.c: Revert "(rasqal_variables_table_get_names): Remove and variable_names field" This reverts commit 71a1110913c2c57245fc4106586e7910cd83c758. * docs/tmpl/section-query_results_formatter.sgml: update tmpl * src/rasqal_bindings.c: (rasqal_new_bindings_from_var_values): Init size to 0 * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_result_formats.c, utils/results.c, utils/roqet.c: Fix rasqal_query_results_formats_check return value. (rasqal_query_results_formats_check2): Added implementing specification correctly; non-0 if format exists. (rasqal_query_results_formats_check): Deprecated Updated callers to use the logic. * Merge pull request #2 from hroptatyr/fix/formats_check Fix r_g_q_results_formatter_factory() to produce the result advertised in 130fa83 2014-05-24 Dave Beckett * docs/tmpl/section-query_results.sgml, docs/tmpl/section-row.sgml, docs/tmpl/section-triples_source.sgml, docs/tmpl/section-variables-table.sgml: Update tmpls * src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_row.c: Allow getting variables from a row (rasqal_row_get_variable_by_offset): Added (rasqal_query_results_get_binding_name): Use above instead of variables table. * src/rasqal_row.c: Add rowsource reference counting to rasqal_row * src/rasqal_bindings.c: (rasqal_new_bindings_from_var_values): Hanle NULL values sequence * src/rasqal_internal.h, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_distinct.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_union.c: Let rows change their rowsource (rasqal_row_set_rowsource): Added for general internal use (rasqal_row_set_weak_rowsource): Added for rowsource_rowsequence so it does not hold circular references to itself in the rows it stores in it's sequence. * src/rasqal_query.c: (rasqal_query_get_variable): docs * src/rasqal_results_compare.c: (rasqal_new_results_compare): free v2 only if new * src/rasqal_results_compare.c: (rasqal_new_results_compare): free v2 after last use * src/rasqal_rowsource_aggregation.c: (main): Fix output_var_name leak using rasqal_variables_table_add2() * src/rasqal_results_compare.c: (rasqal_new_results_compare): Fix leak of vars * src/rasqal_row.c: docs * src/rasqal_rowsource.c: (rasqal_new_rowsource_from_handler): set usage earlier * src/rasqal_internal.h, src/rasqal_rowsource.c: Make rowsource usage counted (rasqal_new_rowsource_from_rowsource): Added * src/rasqal_internal.h, src/rasqal_variable.c: (rasqal_variables_table_get_names): Remove and variable_names field * src/rasqal_query_results.c: (rasqal_query_results_get_bindings): Use rasqal_row_get_names() * src/rasqal_internal.h, src/rasqal_row.c: Compute sequence of variable names for row on demand (rasqal_row_get_names): Added internal method 2014-05-21 Dave Beckett * src/rasqal_results_compare.c: (rasqal_new_results_compare): Allocate defined_in_map 2x larger 2014-05-11 Dave Beckett * docs/rasqal-changes.tsv: remove spaces * docs/rasqal-changes.tsv: Added new enum values from 0.9.28 - 0.9.30 0.9.28: RASQAL_LITERAL_DATE 0.9.29: RASQAL_EXPR_STRUUID and RASQAL_EXPR_UUID 0.9.30: RASQAL_GRAPH_PATTERN_OPERATOR_VALUES * docs/rasqal-changes.tsv: rasqal_new_4op_expression was added in 0.9.28 * docs/rasqal-changes.tsv: RASQAL_EXPR_MD5 was added in 0.9.26 * docs/rasqal-docs.xml: 2014 2014-05-03 Dave Beckett * configure.ac: Handle flex not being installed 2014-04-29 Dave Beckett * scripts/fix-bison: Move fixup before line offset change 2014-04-28 Dave Beckett * ChangeLog, RELEASE.html: 0.9.33 * Remove dead code from bison output * scripts/fix-bison: Remove dead code from bison output 2014-04-26 Dave Beckett * src/sparql_parser.y: YYYERR_MSG_GOTO always sets errmsg Also fix YYDEBUG undef * src/sparql_parser.y: (Collection, GrpahNodeListNotEmpty): Tidy error path * src/rasqal_literal.c: (rasqal_literal_cast): Handle more failure conditions [coverity CID 48453] * src/sparql_lexer.l: (sparql_skip_c_comment): Simplify and remove dead code [coverity CID 43033] * utils/results.c: (rasqal_cmdline_read_results): Error path dead code [coverity CID 43032] * src/rasqal_literal.c: (rasqal_literal_divide): Dead code [coverity CID 43031] * src/rasqal_expr_datetimes.c: (rasqal_expression_evaluate_datetime_part): dead code [coverity CID 43030] * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_read_row): dead code [coverity CID 43029] * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_read_row): dead code [coverity CID 43028] * src/rasqal_algebra.c: (rasqal_algebra_graph_graph_pattern_to_algebra): dead code elimination [coverity CID 43025] * src/rasqal_algebra.c: (rasqal_algebra_filter_graph_pattern_to_algebra): dead code elimination [coverity CID 43016] * src/rasqal_algebra.c: (rasqal_algebra_basic_graph_pattern_to_algebra): dead code elimination [coverity CID 43015] * src/rasqal_rowsource_aggregation.c: (rasqal_builtin_agg_expression_execute_init): cleanup on error path [coverity CID 43027] * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_concat): unused var result * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_concat): dead code in cleanup [coverity CID 43026] * src/rasqal_algebra.c: (rasqal_algebra_service_graph_pattern_to_algebra): Dead code in cleanup [coverity CID 43024] * src/rasqal_row.c: (rasqal_new_row_sequence): Tidy error path - dead code [coverity CID 43022] * src/rasqal_algebra.c: (rasqal_algebra_let_graph_pattern_to_algebra): Simplify and fix error path [coverity CID 43021] * src/rasqal_datetime.c: (rasqal_xsd_datetime_compare2): Fix NULL datetime compares [coverity CID 43020] * src/rasqal_datetime.c: (rasqal_xsd_date_compare): Fix NULL date compares [coverity CID 43019] * src/rasqal_datetime.c: (rasqal_xsd_timezone_format): Dead code [coverity CID 43018] * src/rasqal_algebra.c: (rasqal_algebra_filter_graph_pattern_to_algebra): Dead code [coverity CID 43016] * src/rasqal_algebra.c: (rasqal_algebra_basic_graph_pattern_to_algebra): Dead code [coverity CID 43015] * src/rasqal_literal.c: (rasqal_literal_cast): Handle NULL error_p [coverity CID 45071] * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_concat): Handle NULL error_p [coverity CID 45070] * src/rasqal_literal.c: (rasqal_literal_as_boolean): Handle NULL error_p [coverity CID 45069] * src/rasqal_rowsource_aggregation.c: (rasqal_builtin_agg_expression_execute_reset): Error path [coverity CID 43076] * src/rasqal_raptor.c: (rasqal_raptor_init_triples_source_common): ! * src/rasqal_engine_algebra.c: fix error_p path 2014-04-24 Dave Beckett * src/rasqal_engine_algebra.c, src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_expr_strings.c, src/rasqal_literal.c: Fix multiple checks where error_p may be NULL * src/rasqal_literal.c: (rasqal_literal_set_typed_value): double/float always free string [coverity CID 43051] * src/rasqal_rowsource_assignment.c: (rasqal_assignment_rowsource_read_row): NULL row [coverity CID 43039] * src/rasqal_raptor.c: (rasqal_raptor_init_triples_source_common): Error path [coverity CID 43038] (rasqal_raptor_init_triples_source_common): Shortcut return path when there are no source literals or error path [coverity CID 43038] * src/rasqal_graph_pattern.c: (rasqal_new_values_graph_pattern): NULL pointer [coverity CID 43037] * src/rasqal_literal.c: Cast to int before type diff of enums [coverity CID 43036] (rasqal_literal_compare): Cast to int before type diff of enums [coverity CID 43036] 2014-04-23 Dave Beckett * src/rasqal_literal.c: Cast to int before type diff of enums [coverity CID 43036] (rasqal_literal_compare): Cast to int before type diff of enums [coverity CID 43036] 2014-04-20 Dave Beckett * src/rasqal_rowsource_sort.c: (rasqal_sort_rowsource_process): con->map is never NULL [coverity CID 43035] * src/rasqal_literal.c: not static * src/rasqal_internal.h: meh * src/rasqal_internal.h: extern static for boolean consts * src/rasqal_engine_algebra.c: (rasqal_algebra_filter_algebra_node_to_rowsource): error path cleanup [coverity CID 43042] * src/rasqal_expr.c: (rasqal_expression_convert_aggregate_to_variable): Free output expr on error path [coverity CID 43041] * src/rasqal_engine_algebra.c: (rasqal_algebra_graph_algebra_node_to_rowsource): error path [coverity CID 43044 43043] * src/rasqal_algebra.c: (rasqal_algebra_group_graph_pattern_to_algebra): use goto fail for cleanup [coverity CID 43044 43045] * src/rasqal_format_rdf.c: (rasqal_rowsource_rdf_process): error path leak [coverity CID 43046] * src/rasqal_format_rdf.c: (rasqal_rowsource_rdf_process): error path leak [coverity CID 43047] * src/rasqal_result_formats.c: (rasqal_world_guess_query_results_format_name): error path leak [coverity CID 43048] * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_ensure_variables): loop 0 to size-1 [coverity CID 43040] This would never overrun since raptor_sequence_get_at() would cause the loop exit first. * src/rasqal_bindings.c: (rasqal_new_bindings_from_var_values) error path leak [coverity CID 43049] * src/rasqal_rowsource_service.c: (rasqal_new_service_rowsource): error path leak [coverity CID 43050] * src/rasqal_datetime.c: Initialize datetime time_on_timeline [coverity CID 43082 43083] * src/rasqal_query_write.c: (rasqal_query_write_data_format_comment): copy paste error [coverity CID 43014] * src/rasqal_format_sparql_xml.c, src/rasqal_internal.h, src/rasqal_literal.c: Define statics for true/false so object compare is ok [coverity CID 43012] * scripts/fix-bison: Import from raptor * scripts/fix-flex: Import from raptor * configure.ac, src/sparql_lexer.l: Define FLEX_VERSION_DECIMAL and use to not duplicate column prototypes. 2014-04-07 Dave Beckett * utils/manifest.c: (manifest_indent_multiline): Use max_lines_count 2014-04-04 Dave Beckett * utils/Makefile.am, utils/check_query.c, utils/compare_results.c, utils/manifest.c, utils/rasqalcmdline.h: Switch to rasqal_results_compare API * src/rasqal_results_compare.c: (rasqal_results_compare_compare): Use binding mapping. Reports slight better messages about different variable sets. * src/rasqal_internal.h, src/rasqal_results_compare.c: Start porting compare_results api to rsaqal_results_compare (rasqal_new_results_compare): Add label args (struct rasqal_results_compare_s): Store world, query results, labels and log data. (rasqal_results_compare_set_log_handler): Added (rasqal_results_compare_compare): Added. Name needs to change Update test code * src/rasqal_internal.h, src/rasqal_results_compare.c: Hide rasqal_results_compare internals * src/rasqal_internal.h, src/rasqal_results_compare.c: (rasqal_results_compare_variables_equal): Renamed from rasqal_results_compare_equal * src/rasqal_results_compare.c: ws * src/rasqal_internal.h, src/rasqal_results_compare.c: make rasqal_results_compare internal * src/Makefile.am, src/rasqal_internal.h, src/rasqal_results_compare.c, src/rasqal_results_compatible.c: Rename module / class name to rasqal_results_compare * docs/rasqal-changes.tsv: tab * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Added rasqal_new_query_results_from_string to docs and changes * src/rasqal_results_compatible.c: (rasqal_new_results_compatible): index is i not size * src/Makefile.am, src/rasqal_query_results.c: Add query results tests for from string module * src/rasqal_internal.h, src/rasqal_results_compatible.c: Added tests for rasqal_results_compatible module - Removed duplicate variables_table field; use vt. - Made counts into unsigned. (rasqal_new_results_compatible): Init all offsets to -1 not 0. (rasqal_free_results_compatible): Free map and variables table. (rasqal_results_compatible_equal): look for non-negative offsets for equality. (main): Added tests * src/rasqal_query_results.c: (rasqal_new_query_results_from_string): Make string_len optional. * src/rasqal.h.in, src/rasqal_query_results.c: (rasqal_new_query_results_from_string): Always guess formatter from data Remove formatter arg. * src/rasqal_query_results.c: (rasqal_new_query_results_from_string): Guess formatter from data If @formatter is NULL guess it using input data via rasqal_world_guess_query_results_format_name() 2014-03-30 Dave Beckett * src/Makefile.am, src/rasqal_internal.h, src/rasqal_results_compatible.c: Added rasqal_results_compatible class and skeleton tests Needs a way to initialise rasqal_query_results * src/rasqal.h.in, src/rasqal_query_results.c: (rasqal_new_query_results_from_string): Added 2014-03-29 Dave Beckett * src/rasqal_rowsource_aggregation.c: (main): Use rasqal_variables_table_add2 * docs/rasqal-changes.tsv: fix old/new vers * docs/rasqal-sections.txt: Add rasqal_triples_error_handler2 * docs/rasqal-changes.tsv: Add 0.9.33 typedefs to docs * docs/rasqal-changes.tsv: Sort blocks correctly * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Add rasqal_variables_table_add2 to docs 2014-03-27 Dave Beckett * src/rasqal.h.in: Set RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION 3 after earlier change * libsv, src/rasqal_format_sv.c, src/sv_config.h: Update libsv and rename sv_init to sv_new * src/rasqal_expr_numerics.c: Handle byte/word alignment with RASQAL_UUID_INTERNAL (clang) 2014-03-26 Dave Beckett * utils/manifest.c, utils/manifest.h: Pull test_string arg out of manifest_testsuite_run_suite (manifest_test_matches_string): Moved test matching here (manifest_testsuite_select_tests_by_string): Use manifest_test_matches_string to select a test. (manifest_testsuite_run_suite): Remove matching (manifest_manifests_run): Use manifest_testsuite_select_tests_by_string() to match before running. 2014-03-24 Dave Beckett * ChangeLog, ChangeLog.11, Makefile.am: ChangeLog.11 for 2013 2014-03-22 Dave Beckett * utils/manifest.c, utils/manifest.h, utils/testrunner.c: Pass in test_string arg to allow running one test out of suite (manifest_testsuite_run_suite): Add test_string arg and use it to check for test name or test literal match. (manifest_manifests_run): Add test_string arg for above. (main): Add -t / --test arg for setting a test to run. * utils/testrunner.c: Do not break out early if argc count is wrong * utils/testrunner.c: Get Base URI from right arg * utils/manifest.c: Add testsuite reporting and multi-line reporting (manifest_indent_multiline): Add to indent multi-line strings. (manifest_testsuite_result_format): Added to format a testsuite result in the desired style. Use manifest_indent_multiline. 2014-03-17 Dave Beckett * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_sv.c: Remove decl inside switch (clang -Wunreachable-code) The above is probably a clang mis-warning since the decls work fine before first case. * src/rasqal_literal.c, src/rasqal_query_write.c: Remove return after break (clang -Wunreachable-code) 2014-03-16 Dave Beckett * utils/manifest.c: Free acutal_results * utils/compare_results.c: (compare_query_results_compare): Do not leak row memory * utils/check_query.c: (compare_query_results_compare): Do not leak row memory 2014-03-15 Dave Beckett * utils/manifest.c, utils/manifest.h: (manifest_test_run): Enable comparing bindings results ISSUE: leaks memory since freeing rasqal_query_result* actual_results causes a crash due to raptor genid handler * utils/results.c: (rasqal_rowsource_rdf_process): Free base URI on success * utils/manifest.c: Comment in reading bindings results * src/rasqal_format_rdf.c: (rasqal_rowsource_rdf_process): Free literals used in reading * utils/results.c: (rasqal_cmdline_read_results): Handle rasqal_query_results_formatter_read fail * utils/manifest.c: (manifest_test_run): Read expected result files. - Add error logging to replace RASQAL_DEBUG* - Handle NULL result * utils/results.c: (rasqal_cmdline_read_results): Free base URI string * utils/manifest.c: (manifest_manifests_run): Fix joining results. Handle NULL result. 2014-03-13 Dave Beckett * utils/read_files.c: docs * src/sparql_parser.y: (VarName): Free variable name after rasqal_variables_table_add2 * utils/manifest.c: free query_filename * utils/srxwrite.c: Use rasqal_variables_table_add2() in srxwrite * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_query_transform.c, src/rasqal_row.c, src/rasqal_variable.c, src/sparql_parser.y: (rasqal_variables_table_add2): Added deprecating rasqal_variables_table_add Added rasqal_variables_table_add2 to take a more sensible argument style with copying the input parameters name and value, and allowing name length to be optionally given. Results in smaller calling code and better ownership semantics. 2014-03-11 Dave Beckett * utils/manifest.c, utils/manifest.h: Store background and named graphs in sequence manifest_test gains a single raptor_sequence of rasqal_data_graph and loses the 'data' and 'data_graph' fields. * utils/check_query.c, utils/roqet.c: Make utils use rasqal_cmdline_read_data_graph() shared code * utils/read_files.c: (rasqal_cmdline_read_data_graph): Now handles stdin "-" from roqet. * utils/rasqalcmdline.h, utils/read_files.c: (rasqal_cmdline_read_data_graph): Added from arg handling for graphs * utils/manifest.c: (manifest_test_run): Read and parse queries * utils/manifest.c, utils/manifest.h: (manifest_test_get_query_language): Added * utils/Makefile.am: Add _DEPENDENCIES rules for programs so they will rebuild libraries * utils/testrunner.c: make seq own the URIs so it frees them correctly * utils/testrunner.c: (testrunner_log_handler): data arg is rasqal_world (and unused) Do not try to abort thing that is not a parser 2014-03-08 Dave Beckett * utils/manifest.c: (manifest_manifests_run): Total failure if cannot create test suite * utils/manifest.c: Read query string files * utils/manifest.c, utils/manifest.h: Save manifest_world* in manifest_test * utils/manifest.c: (manifest_test_run): Handle test result being NULL * utils/check_query.c, utils/rasqalcmdline.h, utils/read_files.c, utils/roqet.c: Remove program args from rasqal_cmdline_read* methods Replace with use of rasqal_world and log handler * utils/read_files.c: Use rasqal_alloc_memory / rasqal_free_memory * utils/manifest.c: remove dummy code * utils/manifest.c: (manifest_test_run): Renamed from manifest_testsuite_run_test Remove testsuite parameter and pass in PATH (for now) * utils/manifest.c: ws * utils/Makefile.am, utils/check_query.c, utils/compare_results.c, utils/rasqalcmdline.h: Add compare_results.c module Move code from check_query.c into librasqalcmdline.la 2014-03-07 Dave Beckett * utils/manifest.c: Move UPDATE / PROTOCOL test checking to running of tests (manifest_new_testsuite): Remove check (manifest_testsuite_run_test, manifest_testsuite_run_suite): Add check 2014-03-06 Dave Beckett * utils/manifest.c: Conditionalize RASQAL_DEBUG 2014-03-04 Dave Beckett * utils/manifest.c: Move declarations to start of block (C90) * utils/testrunner.c: Move declarations to start of block (C90) * utils/manifest.c: Fixes for C++ Add compare around return value of strstr (manifest_new_testsuite): Remove unused rc variable, and reset ts on failure. * utils/manifest.c: Fixes for C++ * utils/manifest.c, utils/manifest.h, utils/testrunner.c: (manifest_testsuite_run_suite): Takes a sequence of manifest URIs 2014-03-03 Dave Beckett * utils/manifest.c, utils/testrunner.c: docs 2014-03-02 Dave Beckett * utils/testrunner.c: Add testrunner utility arg handling * utils/.gitignore, utils/Makefile.am, utils/manifest.c, utils/manifest.h, utils/testrunner.c: Split into testrunner main and manifest.c / manifest.h headers * utils/manifest.c: Naming convention of methods * utils/manifest.c: ws * utils/manifest.c: Move all test result details into manifest_test_result. (manfest_run_test): Add skeleton code * utils/manifest.c: Add support for qt:query for test query URI Also rename tq_ to qt_ to match turtle usage * utils/manifest.c: Remove unused ent:entailmentRegime and namespace ent: * utils/manifest.c: Add checks for entailmentRegime * utils/manifest.c: Decode test approval and withdrawn state * utils/manifest.c: Added dawgt: namespace and dawgt:approval URI and literal * utils/manifest.c: Fix null test type test * utils/manifest.c: Move all test graph reading to manifest_new_test() * utils/manifest.c: Added manifest_world object to hold shared uris and literals * utils/manifest.c: Add decoding of mf:resultCardinality into a test flag * utils/manifest.c: (manifest_decode_test_type): Move error checking outside function * utils/manifest.c: Store decoded type flags in test object (manifest_new_test): Lose expect arg and add flags arg. Set expect field from flags. * utils/manifest.c: Adjust debug levels * utils/manifest.c: Fix error paths to not use uninitialized testsuite data * utils/manifest.c: Decode test type into flags and use it (manifest_decode_test_type): Added for decoding a test URI (manifest_new_testsuite): Handle failure, skipping update and protocol tests. * utils/manifest.c: Store test data URI and data graph URIs from manifest Reads qt:data qt:dataGraph fields from action node. Do not store action node itself. * utils/manifest.c: Debug messages * utils/manifest.c: Store test query result URI (file) in manifest_test * utils/manifest.c: Fix ownership for test parameters and fields 2014-03-01 Dave Beckett * utils/manifest.c: ws * utils/manifest.c: Finished decoding of manifests (manifest_new_test): Added; uses a rasqal_literal as ID, not a uri-like string that might be a blank node either. (manifest_free_test): Add rest of fields. (manifest_new_testsuite): Added mf:name, mf:action, rdf:first, rdf:rest and rdf:nil Decode RDF collection of tests into test objects. * utils/manifest.c: fix fputc wrong order * utils/manifest.c: Add start of testsuite runner Added states for xfail, uxpass, skip (manifest_test_state_char, manifest_test_state_label): Added to turn states into labels. (manifest_new_test_result): Added to create test result with a sequence of tests per state. (manifest_free_test_result): Free sequence of tests/state (manifest_free_test): Added to support above. (manifest_indent): Added for indenting. (manifest_run_testsuite): Added doing test counting but no actual running yet. (manifest_test_manifests): create a test result and manipulate aggregating tests. * utils/manifest.c: ws * utils/manifest.c: Fix testsuite alloc/frees * utils/manifest.c: (manifest_free_testsuite): Free more fields * utils/manifest.c: free URI and concept literals * utils/manifest.c: Fix node cleanup * utils/manifest.c: Add tidying for test results (manifest_free_test_result): Added * utils/manifest.c: docs * utils/manifest.c: Added manifest_testsuite constructor and destructor (manifest_new_testsuite): Added, based on manifest_read_plan() that builds it from a manifest file. (manifest_free_testsuite): Added. (manifest_test_manifests): Added to test a sequence of manifest docs (main): Use manifest_test_manifests() 2014-02-28 Dave Beckett * utils/manifest.c: Rename enum 2014-02-25 Dave Beckett * utils/manifest.c: Decode manifest, description, path, entries 2014-02-24 Dave Beckett * src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_raptor.c, utils/check_query.c: Fix unreachable code - break after return mostly. (rasqal_expression_visit): More substantial update to set result var and return in one place. * configure.ac: Add -Wunreachable-code * src/rasqal_dataset.c, src/rasqal_internal.h: (rasqal_dataset_load_graph_uri): Added * tests/improve: Replace expect_fail with expect=value * tests/sparql/check-sparql: Import check-sparql changes from testing repo 7113a34565409463b9804f1381b5d1ea7ebc95f6 - Back out of negative logic: replace expect_fail with expect=value c25354ad2dcb4635906e5c9729bee1f588108b62 - fix yesno 9ca0b6cc1f74e3972039ba6d019e494902b957ec - Report all config vars used. * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.33 2014-02-23 Dave Beckett * tests/improve: Put indent, verbose, dryun as arguments not in testsuite obj. * utils/.gitignore, utils/Makefile.am, utils/manifest.c: Add manifest utility * Snapshotted rasqal_0_9_32 for 0.9.32 release (GIT cdb85abbfe2dc7c740970a92399b734be544cc1c) 2014-02-22 Dave Beckett * tests/algebra/Makefile.am: Restore t:path with current dir so that convert_graph_pattern is found * tests/algebra/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/aggregate/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/bugs/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, tests/sparql/warnings/Makefile.am: No need for manifest ttl t:precondition now that XML::DOM is not needed * INSTALL.html: No need for XML::DOM check * src/rasqal_expr_numerics.c: Fix OSSP UUID include * configure.ac, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/aggregate/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/bugs/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, tests/sparql/warnings/Makefile.am: Remove use of rapper, RAPPER_PATH and t:path in test ttl config * tests/improve, tests/sparql/check-sparql: Make improve and check-sparql use to-ntriples instead of rapper * utils/.gitignore, utils/Makefile.am, utils/to-ntriples.c: Add to-ntriples utility for use by test scripts * tests/improve: Make improve not use undefined array references * configure.ac: Reword raptor version message since RAPTOR_MIN_VERSION is a minimum (>=) * configure.ac: Improve raptor2 check to distinguish raptor too old from not present. * src/sparql_parser.y: Alter SPARQL disabled feature messages to point to SPARQL 1.1 * src/sparql_common.h, src/sparql_parser.y: Adjust SPARQL 1.0 and SPARQL 1.1 feature flags Fixes Issue #0000558 http://bugs.librdf.org/mantis/view.php?id=558 2014-02-19 Dave Beckett * src/sparql_parser.y: (rasqal_sparql_query_language_init): Handle NULL name Fixes Issue #0000567 http://bugs.librdf.org/mantis/view.php?id=567 2014-02-18 Dave Beckett * ChangeLog, NEWS.html, RELEASE.html: 0.9.32 2014-02-08 Dave Beckett * src/rasqal_algebra.c, src/rasqal_datetime.c, src/rasqal_decimal.c, src/rasqal_expr.c, src/rasqal_literal.c, src/rasqal_random.c, src/rasqal_regex.c, src/rasqal_row_compatible.c, src/rasqal_rowsource.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_service.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c, src/sparql_lexer.l, src/sparql_parser.y, src/strcasecmp.c: Add STANDALONE if/ifndef STANDALONE ... endif comments * src/rasqal_decimal.c: Wrap more xsd_decimal code for internal use, not in test runner * src/rasqal_decimal.c: Rewrite test code to use usual xsd decimal constructor / destructors * src/rasqal_xsd_datatypes.c: Add STANDALONE wrappers to prevent 'main' symbol appearing in library Make rasqal_xsd_check_double_format an internal non-static symbol Fixes Issue #0000564 http://bugs.librdf.org/mantis/view.php?id=564 * src/strcasecmp.c: Protect rasqal_strcasecmp* from appearing in standalone compile 2014-01-26 Dave Beckett * libsv: update libsv * configure.ac: Reverting "Make libsv into a config subdir" Revert "Make libsv into a config subdir" This reverts commit a453c53656de630709a9b61854b90f8aa6d1c32b. * configure.ac: Make libsv into a config subdir 2014-01-25 Dave Beckett * tests/sparql/check-sparql: Tidy redirect syntax 2014-01-22 Dave Beckett * INSTALL.html, LICENSE.html, NEWS.html, README.html, RELEASE.html, TODO.html: 2014 2014-01-19 Dave Beckett * libsv: Update libsv 2014-01-15 Dave Beckett * autogen.sh: Create NEWS and README 2014-01-14 Dave Beckett * libmtwist, libsv: Update submodules * Makefile.am: Fix HTML rules 2014-01-12 Dave Beckett * .travis.yml: travis CI 2014-01-07 Dave Beckett * NEWS.html, RELEASE.html: 0.9.32 * configure.ac: Make ossp work as a uuid library option --with-uuid-library=ossp and automatic discovery of ossp UUID now work * configure.ac: Use AC_CHECK_PROGS to find pcre-config and libgcrypt-config AC_CHECK_PROG doesn't default to setting it as found! 2014-01-04 Dave Beckett * src/rasqal_general.c, src/sparql_lexer.l, src/sparql_parser.y: 2014 * src/sparql_parser.y: Remove lots of (rasqal_query*)rq casts no longer needed * src/sparql_lexer.l: docs * src/sparql_lexer.l: Remove YY_NO_INPUT - do need yyinput() / input() * src/sparql_lexer.l: Set YY_NO_INPUT * src/sparql_lexer.l: Add missing get/set column prototypes. debian flex 2.5.35-10.1 added these column header prototypes in re-entrant mode. standard flex omits them 2014-01-03 Dave Beckett * configure.ac, src/Makefile.am, src/sparql_lexer.l, src/sparql_parser.y: Update to use Bison 3.0 Update configure check to accept only Bison (not yacc) 3.0.0 or newer Updated sparql parser with 3.0 directives Updated sparql lexer to add bison bridge rasqal-0.9.33/rasqal.pc.in0000644000175000017500000000064111513006052012220 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/@PACKAGE@ have_raptor2_api=1 Name: Rasqal RDF Query Library Description: Rasqal RDF Query parsing and execution library Requires: raptor2 >= @RAPTOR_MIN_VERSION@ Requires.private: @PKGCONFIG_REQUIRES@ Version: @VERSION@ Libs: -L${libdir} -lrasqal Libs.private: @LIBS@ @PKGCONFIG_LIBS@ @RASQAL_EXTERNAL_LIBS@ Cflags: -I${includedir} rasqal-0.9.33/README.html0000644000175000017500000002033612414554773011655 00000000000000 Rasqal RDF Query Library

Rasqal RDF Query Library

Dave Beckett

Overview

Rasqal is a free software / Open Source C library that handles Resource Description Framework (RDF) query language syntaxes, query construction and execution of queries returning results as bindings, boolean, RDF graphs/triples or syntaxes. The supported query languages are SPARQL Query 1.0, SPARQL Query 1.1, SPARQL Update 1.1 (no executing) and the Experimental SPARQL extensions (LAQRS). Rasqal can write binding query results in the SPARQL XML, SPARQL JSON, CSV, TSV, HTML, ASCII tables, RDF/XML and Turtle / N3 and read them in SPARQL XML, CSV, TSV, RDF/XML and Turtle / N3.

Rasqal was designed to work closely with the Redland RDF library and the Raptor RDF Syntax Library but is entirely separate from both.

This is a beta quality library - the code is mature, the API is mostly stable but changing slowly. Rasqal supports all of SPARQL 1.0 query and most of SPARQL 1.1 query. It is a portable library and has been tested on multiple POSIX systems and architectures. Rasqal has no known memory leaks.

A summary of the changes can be found in the NEWS file and detailed API changes in the release notes.

Rasqal provides:

  • An RDF query construction and access API.
  • Query language support for SPARQL 1.0 Query.
  • Query language support for most of SPARQL 1.1 Query.
  • A query execution engine executing sub-queries, aggregate expressions and grouping.
  • The complete SPARQL 1.1 (draft) built-in function and operator library
  • A query result binding API.
  • Query result bindings formatting into SPARQL XML, SPARQL JSON, CSV, TSV, HTML, ASCII tables, RDF/XML, Turtle / N3 and from SPARQL XML, RDF/XML and Turtle / N3.
  • Triple store querying APIs to support running over external RDF graphs.
  • No memory leaks.
  • roqet standalone command line RDF query utility program

Known bugs and issues are recorded in the Redland issue tracker.

Rasqal does not provide an RDF API or triple store, but relies on external libraries implementing the triple store API providing matched RDF data originally from a specified content URI. Rasqal ships with a triple store implementation using the output of an RDF parser from Raptor. This can be called using the standalone command line roqet query utility giving a query language identifier (default sparql), the query string and optionally the data to use unless it is declared in the query string.

Rasqal is used inside Redland to provide support for query languages, a query API and a result bindings API over graphs stored in indexed Redland triple stores. Since this can index the triples it will be faster than the default rasqal triple store of reading the triples from Raptor into memory when the queries are complex.

Supported Query Languages

SPARQL Query Language for RDF

Rasqal provides complete support for the W3C SPARQL Query Language 1.0 developed by the W3C RDF Data Access Working Group, as defined in SPARQL Query Language for RDF (1.0), W3C Recommendation 15 January 2008.

Rasqal implements most of the SPARQL 1.1 Query Language and SPARQL 1.1 Update W3C Recommendations 21 March 2013 including aggregates, subqueries, expression in SELECT, assignment, short form for CONSTRUCT and all the new set of builtin functions and operators.

Unimplemented parts of SPARQL 1.1:

  • BIND scope
  • VALUES: part of federated query
  • Decimal and double canonical format details
  • EXISTS / NOT EXISTS
  • JSON result format reading
  • MINUS
  • Property Paths: These are likely never be supported since it is a lot of work (estimate: 3 months full time) and might need multiple new APIs to talk to the storage layer.
  • SERVICE: Part of federated query

Out of scope parts of SPARQL 1.1:

  • Entailment and inference: Rasqal is not an inference engine
  • SPARQL Federated Query
  • SPARQL Update (also called SPARQL Protocol): The Update syntax is parsed with parser name 'sparql-update' but nothing is executed inside Rasqal. Supporting SPARQL Update requires a protocol server that responds to requests to perform operations on a graph store. Rasqal is a query library and does not have an event loop or triple store. Redstore is a system supporting SPARQL Update and Service Description built with Rasqal by using Redland librdf for graph storage and query.

The details on the Rasqal support for SPARQL 1.1 can be found at the rasqal testing SPARQL 1.1 page which shows the SPARQL 1.1 tests that fail and any diagnosis.

LAQRS Adds to Querying RDF in SPARQL (LAQRS)

LAQRS is an experimental set of syntax extensions for SPARQL. The syntax and features may change at any time. At present Rasqal provides parsing and API support for alternate update syntaxes, the EXPLAIN keyword, plus executing a few experimental extension functions: NOW() / CURRENT_DATETIME(), FROM_UNIXTIME() and TO_UNIXTIME().

Installation and Documentation

The public API is described in the API reference. It is demonstrated in the roqet utility program which shows how to call the query engine and operate over the query results. When Rasqal is used inside Redland, the Redland documentation explains how to call the query engine and contains several example programs.

To build and install Rasqal from sources see the Installation document.

Sources

The packaged sources are available from http://download.librdf.org/source/. The development GIT sources can also be browsed on GitHub or checked out at git://github.com/dajobe/rasqal.git

Rasqal requires Raptor 2.0.7 or newer to build and run, which can be downloaded from the same area as the Rasqal source and binaries.

License

This library is free software / open source software released under the LGPL (GPL) or Apache 2.0 licenses. See LICENSE.html for full details.

Mailing Lists

The Redland mailing lists discusses the development and use of Rasqal and Redland as well as future plans and announcement of releases.


Copyright (C) 2003-2014 Dave Beckett
Copyright (C) 2003-2005 University of Bristol

rasqal-0.9.33/README0000644000175000017500000001447312421006677010710 00000000000000 #DOAP Rasqal RDF Query Library Dave Beckett Overview Rasqal is a free software / Open Source C library that handles Resource Description Framework (RDF) query language syntaxes, query construction and execution of queries returning results as bindings, boolean, RDF graphs/triples or syntaxes. The supported query languages are SPARQL Query 1.0, SPARQL Query 1.1, SPARQL Update 1.1 (no executing) and the Experimental SPARQL extensions (LAQRS). Rasqal can write binding query results in the SPARQL XML, SPARQL JSON, CSV, TSV, HTML, ASCII tables, RDF/XML and Turtle / N3 and read them in SPARQL XML, CSV, TSV, RDF/XML and Turtle / N3. Rasqal was designed to work closely with the Redland RDF library and the Raptor RDF Syntax Library but is entirely separate from both. This is a beta quality library - the code is mature, the API is mostly stable but changing slowly. Rasqal supports all of SPARQL 1.0 query and most of SPARQL 1.1 query. It is a portable library and has been tested on multiple POSIX systems and architectures. Rasqal has no known memory leaks. A summary of the changes can be found in the NEWS file and detailed API changes in the release notes. Rasqal provides: * An RDF query construction and access API. * Query language support for SPARQL 1.0 Query. * Query language support for most of SPARQL 1.1 Query. * A query execution engine executing sub-queries, aggregate expressions and grouping. * The complete SPARQL 1.1 (draft) built-in function and operator library * A query result binding API. * Query result bindings formatting into SPARQL XML, SPARQL JSON, CSV, TSV, HTML, ASCII tables, RDF/XML, Turtle / N3 and from SPARQL XML, RDF/XML and Turtle / N3. * Triple store querying APIs to support running over external RDF graphs. * No memory leaks. * roqet standalone command line RDF query utility program Known bugs and issues are recorded in the Redland issue tracker. Rasqal does not provide an RDF API or triple store, but relies on external libraries implementing the triple store API providing matched RDF data originally from a specified content URI. Rasqal ships with a triple store implementation using the output of an RDF parser from Raptor. This can be called using the standalone command line roqet query utility giving a query language identifier (default sparql), the query string and optionally the data to use unless it is declared in the query string. Rasqal is used inside Redland to provide support for query languages, a query API and a result bindings API over graphs stored in indexed Redland triple stores. Since this can index the triples it will be faster than the default rasqal triple store of reading the triples from Raptor into memory when the queries are complex. Supported Query Languages SPARQL Query Language for RDF Rasqal provides complete support for the W3C SPARQL Query Language 1.0 developed by the W3C RDF Data Access Working Group, as defined in SPARQL Query Language for RDF (1.0), W3C Recommendation 15 January 2008. Rasqal implements most of the SPARQL 1.1 Query Language and SPARQL 1.1 Update W3C Recommendations 21 March 2013 including aggregates, subqueries, expression in SELECT, assignment, short form for CONSTRUCT and all the new set of builtin functions and operators. Unimplemented parts of SPARQL 1.1: * BIND scope * VALUES: part of federated query * Decimal and double canonical format details * EXISTS / NOT EXISTS * JSON result format reading * MINUS * Property Paths: These are likely never be supported since it is a lot of work (estimate: 3 months full time) and might need multiple new APIs to talk to the storage layer. * SERVICE: Part of federated query Out of scope parts of SPARQL 1.1: * Entailment and inference: Rasqal is not an inference engine * SPARQL Federated Query * SPARQL Update (also called SPARQL Protocol): The Update syntax is parsed with parser name 'sparql-update' but nothing is executed inside Rasqal. Supporting SPARQL Update requires a protocol server that responds to requests to perform operations on a graph store. Rasqal is a query library and does not have an event loop or triple store. Redstore is a system supporting SPARQL Update and Service Description built with Rasqal by using Redland librdf for graph storage and query. The details on the Rasqal support for SPARQL 1.1 can be found at the rasqal testing SPARQL 1.1 page which shows the SPARQL 1.1 tests that fail and any diagnosis. LAQRS Adds to Querying RDF in SPARQL (LAQRS) LAQRS is an experimental set of syntax extensions for SPARQL. The syntax and features may change at any time. At present Rasqal provides parsing and API support for alternate update syntaxes, the EXPLAIN keyword, plus executing a few experimental extension functions: NOW() / CURRENT_DATETIME(), FROM_UNIXTIME() and TO_UNIXTIME(). Installation and Documentation The public API is described in the API reference. It is demonstrated in the roqet utility program which shows how to call the query engine and operate over the query results. When Rasqal is used inside Redland, the Redland documentation explains how to call the query engine and contains several example programs. To build and install Rasqal from sources see the Installation document. Sources The packaged sources are available from http://download.librdf.org/source/. The development GIT sources can also be browsed on GitHub or checked out at git://github.com/dajobe/rasqal.git Rasqal requires Raptor 2.0.7 or newer to build and run, which can be downloaded from the same area as the Rasqal source and binaries. License This library is free software / open source software released under the LGPL (GPL) or Apache 2.0 licenses. See LICENSE.html for full details. Mailing Lists The Redland mailing lists discusses the development and use of Rasqal and Redland as well as future plans and announcement of releases. __________________________________________________________________ Copyright (C) 2003-2014 Dave Beckett Copyright (C) 2003-2005 University of Bristol rasqal-0.9.33/Makefile.am0000644000175000017500000000375312315200222012043 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal RDF query language library # # 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. # noinst_SCRIPTS = rasqal-src-config ACLOCAL_AMFLAGS = -I build SUBDIRS = libsv if RASQAL_MTWIST SUBDIRS += libmtwist endif if GETOPT SUBDIRS += getopt endif SUBDIRS += src utils tests docs data win32 scripts DIST_SUBDIRS=libsv libmtwist getopt src utils tests docs data win32 scripts pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = rasqal.pc EXTRA_DIST=\ ChangeLog.1 ChangeLog.2 ChangeLog.3 ChangeLog.4 ChangeLog.5 \ ChangeLog.6 ChangeLog.7 ChangeLog.8 ChangeLog.9 ChangeLog.10 \ ChangeLog.11 \ README LICENSE.txt \ README.html NEWS.html LICENSE.html INSTALL.html \ RELEASE.html \ LICENSE-2.0.txt NOTICE \ rasqal.rdf.in \ autogen.sh \ rasqal-src-config.in \ rasqal.spec.in \ $(man_MANS) \ rasqal.pc.in DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc if MAINTAINER_MODE # Create some text files from HTML sources LYNX=lynx HTML_TO_TEXT=TERM=vt100 $(LYNX) -dump -nolist SUFFIXES = .html .txt .html.txt: $(HTML_TO_TEXT) $< > $@ $(srcdir)/README: $(srcdir)/README.html $(HTML_TO_TEXT) $< > $@ $(srcdir)/NEWS: $(srcdir)/NEWS.html $(HTML_TO_TEXT) $< > $@ endif # Some people need a little help ;-) test: check rasqal-0.9.33/COPYING.LIB0000644000175000017500000006363710254306540011470 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! rasqal-0.9.33/ChangeLog.90000644000175000017500000035045711754356266011770 000000000000002011-12-14 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_remove_empty_group_graph_patterns): Only for GROUP 2011-12-13 Dave Beckett * src/rasqal_datetime.c: Size of xsd:Date prefix is 6 not 7 2012-02-13 Lauri Aalto * autogen.sh: require automake 1.11.2+ for -Wextra-portability 2012-02-11 Dave Beckett * configure.ac: Report raptor version in build summary 2012-02-09 Dave Beckett * src/rasqal_digest_md5.c, src/rasqal_digest_sha1.c, src/rasqal_internal.h: Added RASQAL_BAD_CAST RASQAL_GOOD_CAST after raptor Added it to MD5 and SHA1 calls where a len turns into a size_t * build/.gitignore: ar-lib * configure.ac: Add automake option -Wextra-portability and AM_PROG_AR to make it happy 2012-02-05 Dave Beckett * INSTALL.html, LICENSE.html, NEWS.html, README.html, RELEASE.html, TODO.html: 2012 * src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_literal.c, src/rasqal_query_results.c, src/rasqal_query_write.c, src/rasqal_xsd_datatypes.c: Added RASQAL_LITERAL_DATE for xsd:Date rasqal_literal_type gains RASQAL_LITERAL_DATE but it is unfortunately not in the FIRST_XSD to LAST_XSD range so needs it's own handling. (rasqal_new_xsd_date): Fix call to rasqal_xsd_datetime_parse() to unset isDateTime flag. (rasqal_xsd_check_date_format): Added. Add xsd:date to recognized datatype URIs in XSD module. (rasqal_xsd_datatype_uri_to_type, rasqal_xsd_datatype_type_to_uri) (rasqal_xsd_datatype_check, rasqal_xsd_datatype_parent_type): Add date support as an XSD type that is not in the FIRST..LAST range. (rasqal_new_numeric_literal): Handle RASQAL_LITERAL_DATE via rasqal_new_xsd_date() (rasqal_free_literal): Updated for date Updated many other methods to pretty much do the same thing as RASQAL_LITERAL_DATETIME for RASQAL_LITERAL_DATE. (rasqal_literal_compare): Use new rasqal_xsd_date_compare (rasqal_literal_equals_flags): Use new rasqal_xsd_date_equals (rasqal_literal_cast): Allow casting string to date and date to string. 2011-12-04 Dave Beckett * src/Makefile.am, src/rasqal_xsd_datatypes.c: Eliminate never used code in rasqal_xsd_datatypes.c Removed empty test code * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_internal.h: Add rasqal_xsd_date for XSD:Date (rasqal_new_xsd_date, rasqal_free_xsd_datetime): Added constructor and destructor (rasqal_xsd_date_to_counted_string, rasqal_xsd_date_to_string) (rasqal_xsd_date_equals, rasqal_xsd_date_compare): Added core methods 2011-12-03 Dave Beckett * src/rasqal_query_results.c: Fix blank node generation for constructs (rasqal_literal_to_result_term): Added, pulled out of rasqal_query_results_get_triple(). Rewrite blank node IDs to be prefixed by the result number, only if the original value was a blank node from the CONSTRUCT otherwise leave it alone. (rasqal_query_results_get_triple): Use above to turn rasqal values into raptor terms and constrain to the RDF rules. 2011-11-20 Dave Beckett * configure.ac: search for AWK and use it 2011-11-18 Dave Beckett * src/rasqal.h.in: this is rasqal 2011-11-17 Dave Beckett * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.29 * Snapshotted rasqal_0_9_28 for 0.9.28 release (GIT 6618f96e1be4693f1f73be138dd94c46ecc98376) 2011-11-16 Dave Beckett * configure.ac: Make sure raptor is new enough or fail configure 2011-11-15 Dave Beckett * .gitmodules, autogen.sh, configure.ac, libmtwist, src/Makefile.am, src/mtwist_config.h, src/rasqal_random.c: Add libmtwist as a submodule to implement random * RELEASE.html: 0.9.28 * src/Makefile.am: Made git-version.h a non-distributable source file. 2011-11-14 Dave Beckett * src/rasqal_general.c: (rasqal_log_error_varargs): Use raptor_vasprintf for raptor >= 2.0.5 2011-10-24 Dave Beckett * src/rasqal_mt_rand.c: Remove rasqal includes * src/rasqal_mt_rand.c: multiple code style fixes. 2011-10-23 Dave Beckett * src/rasqal_mt_rand.c: RASQAL_MT_MATRIX_A * src/Makefile.am, src/rasqal_mt_rand.c, src/rasqal_random.c: Mersenne Twister functions * configure.ac, src/rasqal_random.c: Use GNU MP random routines if GMP was configured * src/rasqal_random.c: Do not cast int to double, let arithmetic promote it * src/rasqal_random.c: (rasqal_new_random): Set initial seed from system * src/rasqal_expr.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_random.c: Rename random methods; add double function (rasqal_random_seed): Renamed from rasqal_random_srand (rasqal_random_irand): Renamed from rasqal_random_rand (rasqal_random_drand): Added returning a double Updated callers to use new names. 2011-10-23 Dave Beckett * INSTALL.html, configure.ac: Make random approach configurable Added --with-random-approach=ALGO to select from the choices It is still an error to have nothing, since rand() is always available in POSIX. 2011-10-19 Dave Beckett * src/rasqal_random.c: RASQAL_RANDOM_STATE_SIZE * src/rasqal_random.c: fixes for initstate_r and random_r * src/Makefile.am, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_random.c: Switch random to an object and add tests rasqal_random: added new structure with RNG state (rasqal_random_get_system_seed): Takes a world pointer. (rasqal_new_random): Renamed from rasqal_random_init (rasqal_free_random): Renamed from rasqal_random_finish (rasqal_random_rand): Document range is 0..RAND_MAX inclusive. (rasqal_new_evaluation_context): Create RNG object. (rasqal_evaluation_context_set_rand_seed) (rasqal_expression_evaluate_rand, rasqal_query_prepare): Use RNG object to set seed and get a number. 2011-10-19 Nicholas J Humfrey * src/rasqal_format_sv.c: Added W3C Format URIs for SPARQL 1.1 Query Results CSV and TSV Formats. Added See Also URIs for CSV format. 2011-10-18 Dave Beckett * configure.ac, src/rasqal.h.in, src/rasqal_random.c: Add support for glibc random_r() and prefer re-entrant random routines random_r() is a glibc extension Prefer the re-entrant random number generators in order: random_r(), rand_r() then the portable but not so safe: random() and rand(). 2011-10-17 Dave Beckett * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_random.c: With initstate(), save old state rasqal_evaluation_context gains a field old_random_state (rasqal_random_init): Altered to be an initializer (rasqal_random_finished): Added to be a finisher (rasqal_random_srand): Renamed from rasqal_random_init. Updated callers 2011-10-16 Dave Beckett * configure.ac, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_random.c: Update random support to enable use of BSD random() and prefer it rasqal_evaluation_context gains a buffer for BSD random to use. configure checks for srandom() and initstate() and if both are present, prefers that over rand_r and rand for a RNG. (rasqal_random_get_system_seed): Now takes rasqal_evaluation_context arg. (rasqal_random_init): Added to init the random state with seed. (rasqal_random_rand): Added to get the random number from the RNG. (rasqal_evaluation_context_set_rand_seed): Now just calls rasqal_random_init(). (rasqal_expression_evaluate_rand): Now calls rasqal_random_rand(). 2011-10-13 Nicholas J Humfrey * src/rasqal_format_json.c: Added URI for W3C Working Draft to SPARQL JSON Result Format. * src/rasqal_format_json.c, src/rasqal_format_sparql_xml.c: Added W3C Format URIs to the JSON and XML SPARQL result formats. 2011-10-12 Dave Beckett * src/rasqal_regex.c: POSIX regex implementation of replace (rasqal_regex_match): Set extended regex syntax. (rasqal_regex_replace_posix): Rewrote based on rasqal_regex_replace_pcre approach. (rasqal_regex_replace): Add an extra outer capturing ()s for POSIX regexes so that we always know what was matched. * configure.ac: Set RASQAL_REGEX_POSIX in test not PCRE 2011-10-11 Lauri Aalto * utils/roqet.c: (main): Remove obsolete -w from roqet --help. Already removed from code in 0df20a7c4cff1c73640b42fc8b8d5a5fa33d99ba. Fixes Issue 0000474 http://bugs.librdf.org/mantis/view.php?id=474 2011-10-09 Dave Beckett * src/rasqal_regex.c: Use UTF-8 for pcre matching and set compile and exec options correctly (rasqal_regex_match, rasqal_regex_replace): Split regex compile and regex exec options. Set UTF-8 mode for compiling PCRE regexes so that characters are matched not bytes. * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_replace): Copy lang and datatype to result * src/rasqal_regex.c: Implement replace all for rasqal_regex_replace (PCRE) (rasqal_regex_replace_pcre): Replaced with a looping construct that replaces all matches with the replacement. (main): Add tests for PCRE with above * tests/algebra/convert_graph_pattern.c: (file_read_string): prevent gcc stack size warning in test code * src/sparql_parser.y: (main): prevent gcc stack size warning in test code * src/rasqal_regex.c: doc comments * src/rasqal_expr.c, src/rasqal_expr_strings.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_regex.c, src/rasqal_variable.c: Move all regex code to rasqal_regex.c (rasqal_regex_match): Added. * src/rasqal_expr_strings.c, src/rasqal_internal.h, src/rasqal_regex.c: (rasqal_regex_replace*): Renamed to match module name * src/rasqal_regex.c: (rasqal_string_replace): reset default posix flags * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_strmatch): reset default posix flags * src/rasqal_regex.c: (rasqal_string_replace): rc is only used for posix regex * src/Makefile.am, src/rasqal_expr_strings.c, src/rasqal_internal.h, src/rasqal_regex.c: Move replace regex code to new rasqal_regex.c module * src/rasqal_expr_strings.c: (rasqal_regex_get_ref_number): Added * src/rasqal_expr_strings.c: (rasqal_string_replace_pcre, rasqal_string_replace_posix): set result_len_p * src/rasqal_expr_strings.c: Tidy rasqal_string_replace internals (rasqal_string_replace_pcre, rasqal_string_replace_posix): Added. Pulled out of rasqal_string_replace * src/rasqal_expr_strings.c: PCRE compile fixes * src/rasqal_expr_strings.c: (rasqal_string_replace): Added pulled out of rasqal_expression_evaluate_replace() * src/rasqal_expr_strings.c: actually set options 2011-10-07 Dave Beckett * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_replace): Partial REPLACE implementation 2011-10-04 Dave Beckett * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Add support for SPARQL 1.1 STRBEFORE, STRAFTER, REPLACE rasqal_op gains new tokens RASQAL_EXPR_STRBEFORE, RASQAL_EXPR_STRAFTER and RASQAL_EXPR_REPLACE. Add parsing for STRBEFORE (2 args), STRAFTER (2 args) and REPLACE (3 or 4 args) (rasqal_expression_evaluate_strbefore) (rasqal_expression_evaluate_strafter): Add expression evaluation for RASQAL_EXPR_STRBEFORE and RASQAL_EXPR_STRAFTER. (rasqal_expression_evaluate_replace): Add skeleton code to evaluate RASQAL_EXPR_REPLACE - currently always fails. * src/rasqal.h.in, src/rasqal_expr.c: Support builtin functions with up to 4 arguments rasqal_expression gains arg4 for 4th expression argument (rasqal_new_4op_expression): Added to construct 3/4-arg expressions. 2011-09-13 Dave Beckett * src/rasqal_literal.c, src/rasqal_xsd_datatypes.c: Clear errno before calling strtol() and checking the result 2011-09-12 Dave Beckett * src/rasqal_query_write.c: (rasqal_query_write_sparql_20060406): Correct output of LIMIT, OFFSET 2011-09-11 Dave Beckett * src/sparql_parser.y: Switch language 'sparql' to SPARQL 1.1 * configure.ac: Use strtod() to convert runtime environ name that can't be optimized away. * configure.ac: Need stdlib for atof() in test 2011-09-08 Dave Beckett * configure.ac: Use 0.000 to get a 0 exit code * configure.ac: Improve ceil, floor and round configure test Use a more comprehensive configure build and run test for ceil(), floor() and round() to prevent GCC optimizing it away and getting the wrong answer when checking whether to link with -lm 2011-09-05 Lauri Aalto * src/rasqal_result_formats.c: (rasqal_world_guess_query_results_format_name): Fix for compiling with RASQAL_DEBUG > 2 * src/rasqal_general.c, src/rasqal_result_formats.c: (rasqal_query_language_register_factory rasqal_world_register_query_results_format_factory): Fixes for compiling with RASQAL_DEBUG > 1 Fixes Issue #0000471 http://bugs.librdf.org/mantis/view.php?id=471 2011-08-30 Dave Beckett * src/rasqal_format_sparql_xml.c: Handle as empty literal in reading XML results 2011-08-28 Dave Beckett * src/Makefile.am, src/rasqal_datetime.c, src/rasqal_internal.h, src/snprintf.c: Remove all use of snprintf for xsd:datetime and xsd:date formatting. (rasqal_format_integer): Added like snprintf() args but with options for width and padding. (rasqal_xsd_datetime_timezone_format): Now returns bytes or <0 on failure. (rasqal_xsd_format_microseconds): Added to format microseconds as fractions of a second with no trailing 0s. (rasqal_xsd_datetime_to_counted_string): Use rasqal_format_integer() and rasqal_xsd_format_microseconds() to do the formatting here and remove a loop calling snprintf() twice with a NULL arg first. (rasqal_xsd_date_to_string): Use rasqal_format_integer(). (rasqal_xsd_datetime_get_tz_as_counted_string): Use updated calling convention of rasqal_xsd_datetime_timezone_format(). * src/rasqal_datetime.c: (rasqal_xsd_date_to_string): Remove use of snprintf 2011-08-27 Dave Beckett * src/rasqal_datetime.c: (rasqal_xsd_datetime_timezone_format): Remove one snprintf() 2011-08-25 Dave Beckett * tests/algebra/check-algebra, tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Set DIFF envariable for check tests to allow use off GNU Diff Thanks to Peter O'Gorman (pogma) for the patch Fixes Issue#0000467 http://bugs.librdf.org/mantis/view.php?id=467 * src/rasqal_algebra.c, src/rasqal_general.c, src/rasqal_graph.c, src/rasqal_query_transform.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_triples.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c: Code style: use calloc(type, count, size) form on one line * src/rasqal_row.c: Do not calloc with 0 count - not portable (rasqal_new_row_common): Add a condition around the if using code from patch in bug. Thanks to Peter O'Gorman (pogma) Fixes Issue#0000466 http://bugs.librdf.org/mantis/view.php?id=466 * src/sparql_lexer.l, src/sparql_parser.y: debug level doc 2011-08-24 Dave Beckett * utils/check_query.c: Use rasqal_literal_string_to_native to just make it work * utils/check_query.c: Use rasqal_query_results_sort() to sort results. * src/rasqal_internal.h, src/rasqal_query_results.c: Added internal function to sort saved rows by some function (rasqal_query_results_sort): Added calling rasqal_query_results_execute_and_store_results if there is a factory and no results sequence. Sorts the internal results sequence * src/rasqal_internal.h, src/rasqal_row.c: Added rasqal_row_compare() internal function for sorting 2011-08-23 Dave Beckett * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.28 * INSTALL.html: ws * Snapshotted rasqal_0_9_27 for 0.9.27 release (GIT 2371992e6bc8d4573576dd90ea172626948a11f1) * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, docs/tmpl/section-variables-table.sgml, src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_variable.c: Added rasqal_variables_table_contains to the public API (rasqal_variables_table_contains): Added, renamed from the internal function rasqal_variables_table_has(). * configure.ac: Do not enable debug messages by default for --enable-maintainer-mode This now requires the extra --enable-debug option to configure or autogen.sh * configure.ac: Added --with-gmp option to configure for GMP * README.html, RELEASE.html: Document rassqal 0.9.27 requires raptor 2.0.4 or newer * configure.ac: RAPTOR_MIN_VERSION is now 2.0.4 2011-08-23 Lauri Aalto * src/rasqal_algebra.c: (rasqal_algebra_extract_aggregate_expressions): Do not attempt to traverse NULL projection->variables 2011-08-22 Dave Beckett * RELEASE.html: 0.9.27 * src/rasqal_expr_evaluate.c: Enable evaluation debugging only if RASQAL_DEBUG_EVAL is set * src/Makefile.am: Add rule so git-version.h is always checked/built This is found in cases such as a fresh GIT checkout (or a make distclean). During compilation gcc will add the .deps files that ensure the complete dependencies are recorded. * .gitignore, src/Makefile.am, src/rasqal_general.c, src/rasqal_internal.h: Build a git-version.h in maintainer mode and add to string version * configure.ac: Define -DMAINTAINER_MODE when in maintainer mode 2011-08-21 Dave Beckett * src/gettimeofday.c: header * src/timegm.c: (rasqal_timegm): Add a Windows version using _mkgmtime() * src/win32_rasqal_config.h.in: Undefine DELETE, IN, GROUP tokens for windows * configure.ac, src/Makefile.am, src/gettimeofday.c, src/rasqal_general.c, src/win32_rasqal_config.h.in: Add gettimeofday() for windows * src/win32_rasqal_config.h.in: Add timeval definition and round() * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_read_row): Remove temporary assert; not needed. * src/rasqal_rowsource_graph.c: Revert previous commit 67548342ca93d70d834e10483f3ae9e4974a622a (rasqal_graph_rowsource_read_row): Input row size is correct, do not lose last input row var. * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_read_row): Copy correct number of input row vars * ChangeLog, NEWS.html, RELEASE.html: 0.9.27 * src/rasqal_format_sv.c: use eol_str as parameter * src/rasqal_format_sv.c: Generate CRLF for TSV and LF for CSV following draft * src/rasqal_format_sv.c: Generate CSV/TSV following draft SPARQL 1.1 CSV/TSV results format http://www.w3.org/2009/sparql/docs/csv-tsv-results/results-csv-tsv.html * src/rasqal_rowsource_union.c: More row debug printing * src/rasqal_rowsource_join.c: Made join properly reset when doing extra rows (rasqal_join_rowsource_reset): Start at JS_START More row debug printing * src/rasqal_rowsource_graph.c: Handle GRAPH ?g returning an empty when there is just the default graph. (rasqal_graph_rowsource_init): Do not pass on finished flag state to result of init, it is not an init error to finish now. 2011-08-20 Dave Beckett * tests/sparql/check-sparql: fix graph compare with dup triples * src/rasqal_query_results.c: Handle skipping unbound variables in CONSTRUCT properly (rasqal_query_results_get_triple): Use rasqal_query_results_next_internal to not fail check and Reset skipped flag. * src/rasqal_query_results.c: Do not duplicate code for moving to next result (unchecked) (rasqal_query_results_next_internal): Added (rasqal_query_results_next): Use rasqal_query_results_next_internal() after verb check (rasqal_query_results_next_triple): Use rasqal_query_results_next_internal so that CONSTRUCT does not fail after first result row when this check happens. * src/rasqal_rowsource_join.c: Fix bogus join test to test natural and left correctly It was bad because the join variable 'b' had a full match between left and right tables. Now the natural join returns 2 rows wheras the left join returns 3 since there are no values for b='green' in the right table. * src/rasqal_query_transform.c, src/rasqal_rowsource_join.c: project all variables in group and optional sub-GPs (rasqal_query_graph_pattern_build_variables_use_map_binds): Pass GROUP and OPTIONAL through the binding also done for UNION using the existing rasqal_query_union_build_variables_use_map_binds() (rasqal_join_rowsource_read_row): Requires a change here to prevent generating too many rows in a left join when rows are not compatible. Not entirely clear why yet. 2011-08-20 Dave Beckett * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): Bind variables when a row is generated. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): Code tidy - no semantic changes. 2011-08-19 Dave Beckett * src/rasqal_rowsource_distinct.c: (rasqal_distinct_rowsource_init): do not set unused var con 2011-08-18 Dave Beckett * src/rasqal_internal.h, src/rasqal_rowsource.c: rowsource class implements saving rows when required Added internal flags when the rowsource class must do the work RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS - in process of saving rows RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS - have saved rows for replay (rasqal_rowsource_read_row): When saving, store the rows in rowsource rows_sequence (and keep a reference). When replaying, read them out and make a new reference. When using read_all_rows to implement read_row, copy the entire sequence. When the last row is seen, set the RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS flag and reset he RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS flag. Adjust messaging to note when a saved row is being returned (rasqal_rowsource_read_all_rows): Implement saving for entire sueqneces of rows copying the entire sequence and copying it again to replay. (rasqal_rowsource_reset): If the rowsource does not implement reset and the rows are saved, reset the offset. (rasqal_rowsource_visitor_set_requirements): When resets are required but the rowsource does not implement it, set the RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS flag so this module does the work. * src/sparql_parser.y: word * src/sparql_parser.y: Add syntax support for CONSTRUCT WHERE { triples } * src/rasqal_graph_pattern.c: docs 2011-08-16 Dave Beckett * src/rasqal_rowsource_slice.c: Reset slice rowsource properly and use result numbers (offsets) from 1 (rasqal_slice_rowsource_init): Added to set initial result offset to 1. (rasqal_distinct_rowsource_reset): Reset result offset to 1. (rasqal_slice_rowsource_read_row): Some debug messaging * src/rasqal_rowsource_distinct.c: Reset distinct rowsource properly; empty map and zero offset (rasqal_distinct_rowsource_init_common): Added (rasqal_distinct_rowsource_init): Added to call above to make it clear; with calloc()ed memory this is not actually necessary. (rasqal_distinct_rowsource_reset): Call above. 2011-08-15 Dave Beckett * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_union.c: Allow rowsources to set requirements on inner rowsources. (rasqal_rowsource_set_requirements): Added to do the visit using rasqal_rowsource_visitor_set_requirements(). Added flag RASQAL_ROWSOURCE_REQUIRE_RESET to indicate requiring the ability to do rasqal_rowsource_reset() on an inner rowsource. * src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_distinct.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_having.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_slice.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c: Replace unused rowsource set_preserve method with set_requirements Delete all rowsource implementations of the unused set_preserve method and all calls to rasqal_rowsource_set_preserve() that did nothing. * src/rasqal_rowsource_triples.c: Remove unused preserve_on_all_finished from triples rowsource * src/rasqal_rowsource.c: (rasqal_rowsource_visit): Allow truncation of recursive visits. * src/rasqal_internal.h, src/rasqal_row.c: (rasqal_row_sequence_copy): Added 2011-08-14 Dave Beckett * src/rasqal_rowsource_graph.c: Store number of data graphs rasqal_graph_rowsource_context gains a dg_size field. (rasqal_graph_rowsource_reset): Calculate dg_size once. * src/rasqal_rowsource_join.c: Remove reading rows from join rowsource init Label enum states with JS_prefix. Add state JS_INIT for once-only setup. (rasqal_join_rowsource_init): Set initial state to JS_INIT and delete setup that reads rows (rasqal_join_rowsource_read_row): Handle JS_INIT. Rename states with JS_ prefix. (rasqal_join_rowsource_reset): Rename state with JS_ prefix. * src/rasqal_rowsource_join.c: Make rasqal_join_state an enum * src/rasqal_rowsource_join.c: Use FINISHED not 2 for state * src/rasqal_rowsource_graph.c: Do not call reset in graph init (rasqal_graph_rowsource_init): Inline and just call rasqal_graph_next_dg() * src/rasqal_raptor.c: Save and use which parts of triples are bound and reset those vars rasqal_raptor_triples_match_context gains bind_parts field (rasqal_raptor_next_match): Add debug print when matches end (rasqal_raptor_init_triples_match): Save parts that are bind and then use it to reset variables we are about to bind to NULL, to ensure that the triples match gets the proper NULL values. * src/rasqal_rowsource.c: (rasqal_rowsource_reset): Debug warning when reset cannot be done * src/rasqal_engine_sort.c, src/rasqal_internal.h, src/rasqal_rowsource_sort.c: Make rasqal_engine_rowsort_calculate_order_values not use query fields (rasqal_engine_rowsort_calculate_order_values): Add order_seq arg rather than use rasqal_query_get_order_conditions_sequence(). (rasqal_sort_rowsource_process): Pass in order sequence to rasqal_engine_rowsort_calculate_order_values() * tests/algebra/convert_graph_pattern.c: Use rasqal_algebra_query_add_orderby with projection arg. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Pass order sequence and distinct flag to algebra nodes rasqal_algebra_node: Add distinct field. (rasqal_new_orderby_algebra_node): Add distinct flag and store it. (rasqal_algebra_query_add_orderby): Renamed from rasqal_algebra_query_add_modifiers since it only does ORDERBY and DISTINCT. Add projection arg to get distinct info. Use it to get distinct flag for calling rasqal_new_orderby_algebra_node() (rasqal_algebra_select_graph_pattern_to_algebra): Use rasqal_algebra_query_add_orderby with projection arg for distinct. (rasqal_query_engine_algebra_execute_init): Pass in projection arg to rasqal_algebra_query_add_orderby. * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_sort.c: rasqal_new_sort_rowsource gets order/distinct from args not query fields rasqal_sort_rowsource_context: Add order_seq and distinct fields. (rasqal_sort_rowsource_init): Get order seq from context not direct from query object. (rasqal_new_sort_rowsource): Add order seq and distinct args and store them. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Implement slice algebra node rasqal_algebra_node: Renamed slice fields to limit, offset (rasqal_new_slice_algebra_node): Added (rasqal_algebra_algebra_node_write_internal): Adjust for field rename. (rasqal_algebra_select_graph_pattern_to_algebra): Apply slices in sub-SELECT. (rasqal_algebra_query_add_slice): Added (rasqal_algebra_slice_algebra_node_to_rowsource): Added. (rasqal_algebra_node_to_rowsource): Call above to handle RASQAL_ALGEBRA_OPERATOR_SLICE. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_rowsource_slice.c: Add slice rowsource (rasqal_new_slice_rowsource): Added. * src/rasqal_internal.h, src/rasqal_query_results.c: Pull limit/offset checkint out of rasqal_query_check_limit_offset() (rasqal_query_check_limit_offset_core): Added with just limit and offset parameters. (rasqal_query_check_limit_offset): Now calls above with fields from query. * tests/algebra/convert_graph_pattern.c: (main): Update call to rasqal_algebra_query_add_distinct 2011-08-13 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_query_add_distinct): Handle NULL projection * src/rasqal_query_transform.c: Walk sub-SELECT graph pattern once. (rasqal_query_graph_pattern_build_variables_use_map_binds): Do not bind SELECT inner GP multiple times; skip the sub-GP loop. * src/rasqal_query_transform.c: More debugging of vars scope * src/rasqal_query_transform.c: (rasqal_query_dump_vars_scope): Added for debuggin vars scope * src/rasqal_query_transform.c: DEBUG_FH * src/rasqal_query_transform.c: Make rasqal_query_build_variables_use_map_binds take a graph pattern arg (rasqal_query_build_variables_use_map_binds): Add gp arg like the use function rasqal_query_build_variables_use_map() does. (rasqal_query_build_variables_use_map): Update call to above. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Use projection to get distinct flag (rasqal_algebra_query_add_distinct): Add projection arg for distinct flag. (rasqal_algebra_select_graph_pattern_to_algebra, rasqal_query_engine_algebra_execute_init): Update callers * src/rasqal_algebra.c: (rasqal_algebra_select_graph_pattern_to_algebra): Implement sub-SELECTs 2011-08-11 Dave Beckett * RELEASE.html: 0.9.27 * src/rasqal_query.c: word * src/rasqal_query.c: (rasqal_query_set_variable): set named variables like old behaviour * src/rasqal_query.c: (rasqal_query_has_variable): autodocs - any type * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, docs/tmpl/section-query.sgml, docs/tmpl/section-variables-table.sgml, src/rasqal_query.c: docs for 0.9.27 new functions * src/rasqal.h.in: Edit header rasqal.h.in not generated header * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_project.c, src/rasqal_variable.c: Use variable name with type to distinguish _:foo / ?foo in same query (rasqal_query_has_variable2): Added with type arg deprecating rasqal_query_has_variable(). Note warning about use of RASQAL_VARIABLE_TYPE_UNKNOWN as ambiguous. (rasqal_query_has_variable): Deprecated for above. Lookup by any type. (rasqal_query_set_variable2): Added with type arg deprecating rasqal_query_set_variable(). Note warning about use of RASQAL_VARIABLE_TYPE_UNKNOWN as ambiguous. (rasqal_query_set_variable): Deprecated for above. Lookup by any type. (rasqal_variables_table_get_by_name): Added with type arg. (rasqal_variables_table_has, rasqal_variables_table_set): Internal functions for var lookup get type args. (rasqal_variables_table_add_variable): pass on type to lookup functions. (rasqal_query_add_variable): Always lookup a named variable since this is projection. (rasqal_query_results_get_binding_value_by_name): Get named variables since this is in results and thus projected/binding named vars. (Various unit tests): Lookup named vars. Fixes Issue #0000459 http://bugs.librdf.org/mantis/view.php?id=459 2011-08-11 Nicholas J Humfrey * tests/sparql/bugs/459-result.ttl, tests/sparql/bugs/459.rq, tests/sparql/bugs/459.ttl, tests/sparql/bugs/Makefile.am, tests/sparql/bugs/manifest.ttl: Added a test for bug number 459 - selecting a variable with the same name as a bnode 2011-08-09 Dave Beckett * src/rasqal_expr_strings.c: Use raptor_unicode_utf8_strlen and raptor_unicode_utf8_substr for raptor 2.0.5+ * src/rasqal_expr_strings.c: Update utf8 strlen call to match code in raptor2 GIT HEAD * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, tests/algebra/convert_graph_pattern.c: Split CONSTRUCT projection out of SELECT/projection option (rasqal_algebra_query_add_projection): Just do projection, no construct or peeking into query structure. (rasqal_algebra_query_add_construct_projection): Add a projection of all mentioned variables for CONSTRUCT. (rasqal_query_engine_algebra_execute_init): Call correct function above depending on query verb. (convert_graph_pattern main): ditto 2011-08-08 Dave Beckett * tests/algebra/convert_graph_pattern.c: Update calls to rasqal_algebra_query_add_modifiers/projection * src/rasqal_query_write.c: Add rasqal_query_write_sparql_projection to write a formatted projection (rasqal_query_write_sparql_projection): Added. (rasqal_query_write_sparql_20060406): Use above and fix else if sequence for DESCRIBE that probably never worked * src/rasqal_algebra.c: (rasqal_algebra_query_prepare_aggregates): Use projection for debug vars. * src/rasqal_algebra.c: Pass projection to rasqal_algebra_extract_aggregate_expressions (rasqal_algebra_extract_aggregate_expressions): Add projection arg and use that to get list of projection variables. Lose check for query verb; the projection should be enough (rasqal_algebra_query_prepare_aggregates): Call above with projection. * src/rasqal_algebra.c: (rasqal_algebra_query_add_having): check modifier * src/rasqal_algebra.c: docs * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: When constructing order by, pass in modifier arg (rasqal_algebra_query_add_modifiers): Add modifier arg. (rasqal_query_engine_algebra_execute_init): Call above with modifier arg. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: When constructing projection algebra node, use projection as arg. (rasqal_algebra_query_add_projection): Add projection arg. (rasqal_query_engine_algebra_execute_init): Call above with query projection. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: When computing HAVING, use modifier as an arg (rasqal_algebra_query_add_having): Add modifier arg. (rasqal_query_engine_algebra_execute_init): Call above with query modifier. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: When computing aggregation, use projection and modifier as args (rasqal_algebra_query_prepare_aggregates): Add projection and modifier args. (rasqal_query_engine_algebra_execute_init): Declare and set projection and modifier vars from query structure. Call rasqal_algebra_query_prepare_aggregates() with those. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Use modifier as arg when transforming algebra GROUP BY (rasqal_algebra_query_add_group_by): Add modifier arg; do not look into query->modifier. (rasqal_query_engine_algebra_execute_init): Pass in query->modifier. 2011-08-07 Dave Beckett * utils/check_query.c: options update and help fixes * utils/roqet.c: order help so -d/--dump-query list appears after option * tests/sparql/check-sparql: Attempt at reading CSV and TSV * src/rasqal_internal.h, src/rasqal_query.c, src/sparql_parser.y: Do not mix query and graph pattern internals (rasqal_query_store_select_query): Renamed from rasqal_query_store_select_graph_pattern() and just stores args it gets from the sparql parser (SPARQL ReportFormat): Decode graph pattern fields and pass to rasqal_query_store_select_query() * src/rasqal_query.c: (rasqal_query_store_select_graph_pattern): Approach ok here now * src/rasqal_query_transform.c: (rasqal_query_expand_wildcards): Do nothing with NULL projection * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rdql_parser.y, src/sparql_parser.y: Eliminated query wildcard field rasqal_query loses wildcard field (now unused12) (rasqal_query_set_wildcard): Added public API call (rasqal_query_expand_wildcards): Gains a projection arg to use for wildcard check. (rasqal_query_get_wildcard): returns 0 for no projection. (rasqal_query_store_select_graph_pattern): Use projection has wildcard flag too. (rasqal_query_write_sparql_20060406): Use projection and if not NULL, check for distinct and wildcard flags) (RDQL SelectClause): Use rasqal_query_set_wildcard (rasqal_rdql_query_language_prepare) (rasqal_sparql_query_language_prepare): Pass in projection to rasqal_query_expand_wildcards. * src/rasqal_query_transform.c: kill last selects mentions * src/rasqal_query_transform.c: (rasqal_query_remove_duplicate_select_vars): Empty selection can have no dups. * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): Only check non-empty projections. * tests/improve: fail if there are no failures except expected failures * src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c: Removed query selects field rasqal_query loses selects and select_variables_count fields. (rasqal_free_query): Remove freeing selects sequence. (rasqal_query_add_variable): Remove adding to selects sequence. (rasqal_query_remove_duplicate_select_vars): Gains projection arg. Uses projection variables. (rasqal_query_build_variables_use_map): Gains projection arg. Use it to call rasqal_query_build_variables_sequence_use_map_row with projected variables. (rasqal_query_build_variables_use): Gains projection arg. Use it to call rasqal_query_build_variables_use_map(). (rasqal_query_prepare_common): Use projection to call rasqal_query_remove_duplicate_select_vars() and rasqal_query_build_variables_use() (rasqal_algebra_query_prepare_aggregates): Use projection when calling rasqal_query_build_variables_use() (rasqal_query_store_select_graph_pattern): Set query projection. query->wildcard remains a duplicate for now. (rasqal_query_expand_wildcards): Use rasqal_query_add_variable() rather than add to selects. * src/rasqal_algebra.c: (rasqal_algebra_query_add_projection): Use query projection to get vars. * src/rasqal_algebra.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_write.c: Use rasqal_query_get_bound_variable_sequence() for more query->selects (rasqal_algebra_extract_aggregate_expressions) (rasqal_algebra_query_prepare_aggregates) (rasqal_algebra_query_add_projection, rasqal_query_print) (rasqal_query_results_get_binding_name) (rasqal_query_write_sparql_20060406): Use rasqal query_get_bound_variable_sequence() (rasqal_query_get_bound_variable_sequence): Return projection variables. * src/rdql_parser.y: (RDQL Query): Use rasqal_query_add_variable to form projection. * src/rasqal_query.c: Make rasqal_query_add_variable handle empty select, vars cases (rasqal_query_add_variable): Add variable if missing and add query->selects if NULL. * src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_write.c, src/rasqal_rowsource_sort.c: Replace query distinct field with query's projection object distinct rasqal_query struct distinct field is now unused9 (rasqal_query_get_distinct): Get flag from projection object. (rasqal_query_set_distinct): Set flag in projection object, creating it if it does not exist. (rasqal_algebra_query_add_distinct, rasqal_query_print, rasqal_query_results_execute_with_engine, rasqal_query_write_sparql_20060406, rasqal_sort_rowsource_init): Use rasqal_query_get_distinct() (rasqal_query_store_select_graph_pattern): Use rasqal_query_set_distinct(). * src/rasqal_query.c: (rasqal_query_add_variable): Move var reference taking next to sequence * src/rasqal_query.c: (rasqal_query_add_variable): Add projected var to query projection. * src/rasqal_internal.h, src/rasqal_query.c: Add projection field to query object struct rasqal_query_s gains projection. (rasqal_query_get_projection, rasqal_query_set_projection): Added * src/rasqal_query.c: Tidy docs to use projected only when it is meant it in rasqal_query methods (rasqal_query_get_variable, rasqal_query_has_variable): Return all variables not just projected. * src/rasqal_internal.h, src/rasqal_projection.c: (rasqal_projection_add_variable): Added * src/rasqal_query.c: (rasqal_query_add_variable): Restore adding var to selects * src/rasqal_query.c: (rasqal_query_add_variable): Use rasqal_variables_table_add_variable * src/rasqal.h.in, src/rasqal_variable.c: (rasqal_variables_table_add_variable): Added to add an existing variable. * src/sparql_parser.y: %type SelectQuery * src/rasqal_query.c: (rasqal_query_set_variable): Just use rasqal_variables_table_set() * src/rasqal_query.c: (rasqal_query_get_variable): Remove irrelevant check for query->selects * src/sparql_parser.y: (ReportFormat): Use rasqal_query_store_select_graph_pattern() to store away incoming SELECT rasqal_graph_pattern as main query GP. (SelectQuery): returns a SELECT rasqal_graph_pattern. Moved storing logic to rasqal_query_store_select_graph_pattern() * src/rasqal_internal.h, src/rasqal_query.c: Added rasqal_query_store_select_graph_pattern (rasqal_query_store_select_graph_pattern): Added to store a select graph pattern as the query's top level graph pattern and write all the old fields, pull apart projection and gp fields. * src/rasqal_internal.h: unsigned int distinct flag * src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/sparql_parser.y: Select graph pattern now can record an optional data_graphs rasqal_graph_pattern gains data_graphs_field (rasqal_new_select_graph_pattern): Added data_graphs arg. (SPARQL SubSelect): Update to pass in NULL data graph * src/rasqal_internal.h: unsigned int for distinct flag in rasqal_projection 2011-08-05 Dave Beckett * src/rasqal_internal.h, src/rasqal_result_formats.c, src/rasqal_service.c: Rasqal service can return a read rowsource (rasqal_query_results_formatter_get_read_rowsource): Added, pulled out of rasqal_service_execute() that returns a rowsource from a syntax, managing ownership of the intermediate iostream and data via rasqal_new_iostream_from_stringbuffer(). (rasqal_service_execute): Refactored to call above. * src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_internal.h: Enable rowsource factory to own the iostream. rasqal_query_results_get_rowsource_func function pointer typedef gains an unsigned int arg Updated all rowsource factory implementions of get_rowsource to store flag and if present, close the iostream passed in when the rowsource is destroyed. struct rasqal_rowsource_rdf_context gains flags field. (rasqal_query_results_rdf_get_rowsource, rasqal_rowsource_rdf_finish): RDF rowsource adds flag arg, closes iostr if set on finish. struct rasqal_rowsource_sparql_xml_context gains flags field. (rasqal_query_results_get_rowsource_sparql_xml, rasqal_rowsource_sparql_xml_finish); SPARQL XML rowsource adds flag arg, closes iostr if set on finish. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_iostream.c: (rasqal_new_iostream_from_stringbuffer): Added 2011-07-31 Dave Beckett * utils/check_query.c: Make help/usage/options string match code 2011-07-31 Dave Beckett * utils/check_query.c: casts 2011-07-31 Dave Beckett * src/rasqal_algebra.c, src/rasqal_bindings.c, src/rasqal_data_graph.c, src/rasqal_dataset.c, src/rasqal_datetime.c, src/rasqal_decimal.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_expr_strings.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_formula.c, src/rasqal_general.c, src/rasqal_graph.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_prefix.c, src/rasqal_projection.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_test.c, src/rasqal_query_transform.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_row_compatible.c, src/rasqal_rowsource.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_distinct.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_having.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_service.c, src/rasqal_solution_modifier.c, src/rasqal_triple.c, src/rasqal_triples_source.c, src/rasqal_update.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y, src/timegm.c, tests/engine/rasqal_construct_test.c, tests/engine/rasqal_limit_test.c, tests/engine/rasqal_order_test.c: Code style change and cleanup for alloc/free macros Code style: 1. var = RASQAL_CALLOC(type, nmem, size) Prefering: var = RASQAL_CALLOC(type, 1, sizeof(*var)) when nmem = 1 2. var = RASQAL_CALLOC(type, size) 3. RASQAL_FREE(type, var) The consequence here is allocs that mostly fit into 1 line without so much boilerplate and duplication of types. The RASQAL_MALLOC and RASQAL_CALLOC now do the cast to the return type. RASQAL_FREE takes the object type too but always casts arg to void This certainly contains many wrong types to the arg but might be used later in some kind of smart type-aware debugging allocator. 2011-07-30 Dave Beckett * src/rasqal_service.c: code style: len = strlen(); malloc(..., len+1) and memcmp(..., len+1) * src/rasqal_raptor.c: (raptor_statement_as_rasqal_triple): Use raptor blank and literal length fields * src/rasqal_row.c: (rasqal_new_row_sequence): Handle long ints * src/rasqal_literal.c: (rasqal_new_literal_sequence_of_sequence_from_data): Handle long ints 2011-07-28 Dave Beckett * src/rasqal_datetime.c: (rasqal_xsd_datetime_to_counted_string): size_t for strlen result * src/rasqal_datetime.c: (rasqal_xsd_datetime_parse): Cast small ptr diffs to unsigned int. * src/rasqal_format_sparql_xml.c: (rasqal_rowsource_sparql_xml_process): Do not bother with locator byte. * src/rasqal_decimal.c: (rasqal_xsd_decimal_abs): use fabs for decimal as double * src/rasqal_literal.c: (rasqal_literal_sequence_sort_map_compare): Use ptrdiff_t for ptr arithmetic and then convert to int. * configure.ac: Look for stddef.h * src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_as_floating): Added internal method. * src/rasqal_expr_strings.c: Use rasqal_unicode_utf8_substr return (rasqal_unicode_utf8_substr): Document return value 0 is failure.. (rasqal_expression_evaluate_substr): Check for 0. * src/rasqal_general.c: (rasqal_world_default_generate_bnodeid_handler): size_t length * src/rasqal.h.in: Add RASQAL_API for rasqal_row functions (Win32) 2011-07-27 Dave Beckett * docs/tmpl/section-literal.sgml, docs/tmpl/section-xsd.sgml: update tmpls * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Docs for rasqal_new_numeric_literal_from_long and rasqal_xsd_decimal_get_long 2011-07-26 Dave Beckett * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_float): Use unsigned int for offsets not lengths. * src/sparql_parser.y: (main): use size_t read_len * src/rasqal_rowsource_aggregation.c: (make_test_expr): Cast for c++ * src/rasqal_rowsource_groupby.c: (main): Cast for c++ * src/rasqal_literal.c: (rasqal_new_numeric_literal): return int if it will fit, otherwise decimal. * src/rasqal_literal.c: Cast when assigning to unsigned int string_len * src/rasqal_rowsource.c: (rasqal_rowsource_write_internal): use unsigned int for indent_delta. * src/rasqal_raptor.c: rasqal_raptor_triples_source_user_data: use size_t for mapped_id_base_len * src/rasqal_internal.h: struct rasqal_query_s uses size_t for query_string_length * src/rasqal_format_html.c: (rasqal_query_results_write_html_bindings): Use size_t len * src/rasqal_query.c: (rasqal_query_prepare, rasqal_query_get_genid): use size_t for lengths * src/rasqal_digest.c: (rasqal_digest_buffer): Cast mhash arg calls/return sizes * src/rasqal_random.c: (rasqal_random_get_system_seed): Casts from time_t to uint32_t * src/sparql_parser.y: (PrefixDeclListOpt): cast prefix length; will fit into an int. * src/rasqal_format_table.c: Use size_t for string lengths and column widths (rasqal_iostream_write_counted_string_padded) (rasqal_query_results_write_table_bindings): Replace several int with size_t for string length computations. * configure.ac: No -Wundef * src/rasqal_query_transform.c: (rasqal_query_print_triples_use_map): fix chars array for c++ * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Eliminate a strlen() from rasqal_algebra_algebra_node_write_internal (rasqal_algebra_node_operator_as_counted_string): Added to replace rasqal_algebra_node_operator_as_string and return length. (rasqal_algebra_algebra_node_write_internal): Use above. Replace other calls. * src/rasqal_decimal.c: (rasqal_xsd_decimal_get_long): for mpfr * src/rasqal_literal.c: (rasqal_literal_as_floating): Call rasqal_literal_as_floating() inside. * src/rasqal_literal.c: make rasqal_xsd_decimal_get_long handle overflow in decimal conversion. (rasqal_literal_as_integer): Use rasqal_xsd_decimal_get_long() and set error on overflow. * src/rasqal.h.in, src/rasqal_decimal.c: (rasqal_xsd_decimal_get_long): Added to convert decimal to long with overflow error flag * src/rasqal_internal.h, src/rasqal_raptor.c: (rasqal_raptor_triple_match): parts arg is now unsigned int as xor of #rasqal_triple_parts enum bits * configure.ac: Are using -Wmissing-noreturn * configure.ac: No -Wfloat-equal * utils/roqet.c: reduce stack size * src/sparql_parser.y: (sparql_parse): remove unused bufer var * utils/roqet.c: Test stdin fread value. * utils/roqet.c: Query string is now unsigned char* (main): Casts for C++ and use fread() result as size_t * src/rasqal.h.in, src/rasqal_service.c: (rasqal_new_service): query_string arg now unsigned char* * src/rdql_parser.y: (rdql_parse): remove unused bufer var * src/rasqal_dataset.c: rasqal_dataset_term_iterator_s field parts is unsigned int not enum. * src/rasqal_datetime.c: Casts for C++ in rasqal_xsd_datetime module (rasqal_xsd_datetime_get_as_timeval) (rasqal_xsd_datetime_get_timezone_as_counted_string): Casts of malloc returns for C++ * src/rasqal_query.c: (rasqal_query_variable_bound_in_triple): Cast for C++ (when RASQAL_DEBUG) * src/rdql_lexer.l: (rdql_lexer_fatal_error): Mark as RASQAL_NORETURN * src/rasqal_internal.h: Added RASQAL_NORETURN macro * src/rasqal_expr_strings.c: (rasqal_unicode_utf8_substr): Alter arg src_length to a size_t - internal. * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_strlen): Use rasqal_new_numeric_literal_from_long() * src/rasqal_expr_numerics.c: (rasqal_expression_evaluate_rand): Force double arithmetic a better way. * src/rasqal_expr_datetimes.c: Do not try to fit a potentially truncate a long int time_t into an int. (rasqal_expression_evaluate_to_unixtime): Use rasqal_new_numeric_literal_from_long() to avoid potential int range truncation. * src/rasqal.h.in, src/rasqal_literal.c: (rasqal_new_numeric_literal_from_long): Added to make an integer or decimal literal depending if it fits in range * src/rasqal_algebra.c: (rasqal_algebra_algebra_node_write_internal): Use unsigned int indent. * src/rasqal_algebra.c, src/rasqal_bindings.c, src/rasqal_data_graph.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_query_write.c, src/rasqal_rowsource.c, src/rasqal_service.c, src/sparql_parser.y: Casts for C++ * configure.ac: Update compiler warnings like Raptor 2.0.4 2011-07-14 Dave Beckett * src/rasqal_literal.c, src/rasqal_query_write.c: Handle returning xsd:integer subtypes (rasqal_literal_set_typed_value): Call rasqal_xsd_datatype_type_to_uri only for atomic XSD types. (rasqal_literal_as_node): Call rasqal_xsd_datatype_type_to_uri only for atomic XSD types. Otherwise use the datatype from the source literal. (rasqal_query_write_sparql_literal): Handle writing non atomic XSD types such as integer subtypes. Fixes Issue #0000454 http://bugs.librdf.org/mantis/view.php?id=454 2011-07-09 Dave Beckett * src/sparql_parser.y: Handle SILENT for SERVICE. * src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query_transform.c: Add silent flag to graph pattern rasqal_graph_pattern gains silent bit field. (rasqal_graph_patterns_join): Copy silent flag. (rasqal_graph_pattern_write_internal): Print silent flag. * src/sparql_parser.y: (ClearQuery, DropQuery): Handle NULL graph URI for default graph 2011-06-28 Dave Beckett * configure.ac: Always check for where ceil(), floor() and round() can be found. * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.27 2011-06-27 Dave Beckett * Snapshotted rasqal_0_9_26 for 0.9.26 release (GIT 44f4b1d74abe6c741e9a9c4bc8465921d7b3691f) * src/rasqal_format_rdf.c: Fix a bunch of lost term objects for 'rdfxml' formatter. * src/rasqal_format_rdf.c: (rasqal_rowsource_rdf_process): Fix leak of variable. * src/rasqal_format_sparql_xml.c: (rasqal_sparql_xml_sax2_start_element_handler): Fix leak of variable. * src/rasqal_service.c: (rasqal_service_content_type_handler): Handle getting multiple Content-Type:s * src/rasqal_query_results.c: (rasqal_query_results_get_count): Handle no query * NEWS.html, RELEASE.html: 0.9.26 * src/rasqal_query_transform.c: (rasqal_graph_pattern_tree_binds_variable, rasqal_graph_pattern_binds_variable): Removed unused functions 2011-06-26 Dave Beckett * tests/sparql/check-sparql: Handle var=xsdstring(val) roqet output * src/rasqal_query_transform.c: (rasqal_query_union_build_variables_use_map_binds): Restore outer var scope each time. * tests/sparql/warnings/Makefile.am: data is empty.nt * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map_binds): Recalculate triple BGP after selecting variables to bind * tests/sparql/warnings/Makefile.am, tests/sparql/warnings/warning-4.rq: Remove unsupported check for multiple FROM * tests/improve: count expected fails * tests/improve: Handle countiing expecting failures * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-bound (UNION) passes * tests/sparql/survey/Makefile.am: test survey-3 UNION passes * src/rasqal_query_transform.c: Calculate binds for BGPs correctly (rasqal_query_triples_build_variables_use_map_binds); Bind s/p/o/g if bit flag set not when ONLY that bit set. Update row to mark bound here. * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): Do not turn any SELECTed variables that are never mentioned into binds * src/rasqal_internal.h, src/rasqal_query_transform.c: Made selecting an unbound a serious warning (RDQL, SPARQL 1.0 require not-error) Added internal RASQAL_WARNING_LEVEL_SELECTED_NEVER_BOUND warning level. * configure.ac, tests/sparql/Makefile.am, tests/sparql/warnings/Makefile.am, tests/sparql/warnings/empty.nt, tests/sparql/warnings/manifest.ttl, tests/sparql/warnings/warning-1.rq, tests/sparql/warnings/warning-2.rq, tests/sparql/warnings/warning-3.rq, tests/sparql/warnings/warning-4.rq: Add warnings tests * src/rasqal_general.c: (rasqal_log_warning_simple): Invert test again 2011-06-23 Lauri Aalto * src/rasqal_query_transform.c: const qualified for const data 2011-06-22 Lauri Aalto * src/rasqal_general.c: #docs 2011-06-20 Dave Beckett * tests/sparql/check-sparql: Add -W/--warnings option to set warning level (default none: 0) * tests/sparql/check-sparql: Use perl to find any core dumps in output portably. * configure.ac: Really remove --with-redland-config and --with-redland from configure 2011-06-18 Dave Beckett * src/rasqal_algebra.c: nl * src/rasqal_query_transform.c: Expand sub-SELECT * to variables (rasqal_graph_pattern_mentions_variable): Added (rasqal_graph_pattern_tree_mentions_variable): Added using above to return if a GP tree mentions a variable (rasqal_query_select_build_variables_use_map): Expand sub-SELECT * into list of variables during use_map walk. * src/rasqal_query_transform.c: (rasqal_graph_patterns_join): Handle select GP merging * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_write_internal): Handle sub-SELECT * * src/rasqal_query_transform.c: (rasqal_query_select_build_variables_use_map): Do not scan sub-GPs * tests/sparql/check-sparql: look for core dump 2011-06-17 Dave Beckett * src/rasqal_query_transform.c: (rasqal_graph_pattern_promote_variable_mention_to_bind): Add bind flag Should stop some of the unused variable warnings. 2011-06-16 Dave Beckett * src/rasqal_variable.c: (main): use rc [clang] * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map_binds): Remove unused gp_offset var. * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map_binds): Remove unused row var. * src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_rowsource_triples.c: Replace triples bound_in with more accurate triples_use_map Removes assumption that a variable can be only bound in one triple. struct rasqal_query: array triples_use_map replaces variables_bound_in (rasqal_graph_pattern_variable_bound_in): Use the variables_use_map to calculate result. (rasqal_free_query): Free triples_use_map replacing variables_bound_in. (rasqal_query_variable_is_bound): Added to partially replace rasqal_graph_pattern_variable_bound_in(). (rasqal_query_variable_bound_in_triple): Added to replace rest of rasqal_query_get_bound_in_column_for_variable. (rasqal_query_get_bound_in_column_for_variable): Deleted (rasqal_query_graph_pattern_bgp_build_bound_in): Deleted (rasqal_query_graph_pattern_build_bound_in): Deleted (rasqal_query_build_bound_in_triples): Deleted. (rasqal_query_check_unused_variables): Use rasqal_query_variable_is_bound() and simplify. (rasqal_query_build_variables_use): Remove call to deleted rasqal_query_build_bound_in_triples(). (rasqal_query_graph_build_variables_use_map): Added to build variables use in a GRAPH GP. (rasqal_query_select_build_variables_use_map): Add width and gp args. (rasqal_query_graph_pattern_build_variables_use_map): Call above for GRAPH GP. Update call to rasqal_query_select_build_variables_use_map() for changed args. (rasqal_graph_pattern_mentions_variable): Deleted (rasqal_graph_pattern_promote_variable_mention_to_bind): Add vars_scope arg and use it to test and set scope flag. (rasqal_query_triples_build_variables_use_map_binds): Added to mark variables bound in a triple/basic GP. Rewrote body to use scope and calculate mention, use and handle cases where a triple pattern binds the same variable more than 1 time. (rasqal_query_triples_build_variables_use_map_binds): Added to bind variables for triples/basic GP. (rasqal_query_graph_pattern_build_variables_use_map_binds): Added pulled out of older rasqal_query_build_variables_use_map_binds. Use rasqal_query_triples_build_variables_use_map_binds() and rasqal_query_union_build_variables_use_map_binds(). Bind sub graph patterns after doing variables at head (such as UNION) so that binding is in query document order. (rasqal_query_build_variables_use_map_binds): Added to wrap rasqal_query_graph_pattern_build_variables_use_map_binds(). (rasqal_query_print_triples_use_map): Added debug function to print triples variable use map. (rasqal_query_build_variables_use_map): Allocate triples_use_map. Use rasqal_query_build_variables_use_map_binds(). Print triples use map after binding is done. (rasqal_query_graph_build_variables_use_map_binds): Make bound variables in GRAPH gp. (rasqal_query_let_build_variables_use_map_binds): Add vars_scope args. (rasqal_query_select_build_variables_use_map): Add width and gp args. (rasqal_query_select_build_variables_use_map_binds): Added to bind sub-SELECT patterns using an inner scope. Mark projected variables into outer scope. (rasqal_query_union_build_variables_use_map_binds0: Added to bind UNION patterns with inner scopes for each sub-graph pattern. * src/rasqal_algebra.c, src/rasqal_internal.h) (src/rasqal_query_transform.c: Switch short maps to unsigned short maps * src/rasqal_algebra.c, src/rasqal_internal.h) (src/rasqal_query_transform.c: Switch short maps to unsigned short maps * src/rasqal_query_transform.c: Build variable scoping in two pass USE and BIND scans Remove all binding code from the rasqal_query_graph*_use_map functions. Add new binding marking approach; pass down an array of in-scope variables in current context and mark first variable unseen as binding it. UNION and sub-SELECT introduce new scopes. FIXME: bound_in code still does a separate and wrong calculation that assumes a variable can only be bound in one GP; that is no longer true and never has been as long as UNION existed. (rasqal_query_graph_build_variables_use_map): Added to mark variables mentioned in GRAPH GP (zero one one) (rasqal_query_graph_pattern_build_variables_use_map): Call above for GRAPH gp and adjust call to rasqal_query_select_build_variables_use_map(). (rasqal_graph_pattern_promote_variable_mention_to_bind): Add vars_scope param to know when to bind; does nothing if variable passed in is already bound in scope. (rasqal_query_graph_pattern_build_variables_use_map_binds): Added based on older rasqal_query_build_variables_use_map_binds() to perform the binding approach as above moving most code into per-GP type functions. Move binding sub graph patterns to AFTER binding variables in the GP itself; so GRAPH ?var etc. works. (rasqal_query_build_variables_use_map_binds): Made a skeleton around above function. (rasqal_query_build_variables_use_map): Call rasqal_query_build_variables_use_map_binds(). (rasqal_query_graph_build_variables_use_map_binds): Use vars scope. (rasqal_query_let_build_variables_use_map): Use vars scope. (rasqal_query_select_build_variables_use_map): Scan selected / projected variables for mentions. (rasqal_query_select_build_variables_use_map_binds): Added to use vars scope, make an inner scope for the sub-SELECT and mark project variables for binding if unbound in outer scope. (rasqal_query_union_build_variables_use_map_binds): Added to use vars scope and and make a new scope for each sub-UNION GP tree. 2011-06-14 Dave Beckett * configure.ac: Add --enable-debug option like raptor has * src/rasqal_query_transform.c: Lose the . 2011-06-11 Dave Beckett * docs/tmpl/section-general.sgml, docs/tmpl/section-unused.sgml: Update tmpls * docs/rasqal-sections.txt: Add support_feature to unused section. * src/rasqal_general.c: autodocs * INSTALL.html, configure.ac, src/rasqal_general.c, src/rasqal_redland.c: Remove redland triples store that has not worked for some time. configure: Remove --with-triples-source and --with-redland-config options Removed src/rasqal_redland.c module. * src/rasqal_raptor.c: Allow no data graphs in the query * src/rasqal_general.c, src/rasqal_internal.h, src/rdql_parser.y, src/sparql_parser.y: Adjust warning levels so 50 does not warn strict. Invert tests so that 0 does nothing * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_service.c, src/rdql_parser.y, src/sparql_parser.y, tests/sparql/check-sparql, utils/getopt.c, utils/roqet.1, utils/roqet.c: Add rasqal_world_set_warning_level() and use with roqet -W LEVEL (rasqal_world_set_warning_level): Added to set warning level in 0...100 range where 0 is no warnings, 50 is the default and 100 is all warnings. roqet gains a -W LEVEL argument check-sparql: use roqet -W 0 2011-06-06 Dave Beckett * configure.ac, src/Makefile.am, src/rasqal_datetime.c, src/rasqal_internal.h, src/timegm.c: Add portable version of timegm when not present Fixes Issue#0000438 http://bugs.librdf.org/mantis/view.php?id=438 2011-06-05 Dave Beckett * src/rasqal_xsd_datatypes.c: Check for int overflow in strtol() and turn into a decimal. (rasqal_xsd_check_integer_format): Check for overflow when checking string and return failure for integers that are too large. * src/rasqal_literal.c: Check for int overflow in strtol() and turn into a decimal. (rasqal_literal_set_typed_value): Check for overflow when converting a string to int and if resulting long won't fit in an int, turn it into a decimal. Fixes Issue#0000436 http://bugs.librdf.org/mantis/view.php?id=436 * configure.ac: Check for limits.h and error.h * configure.ac: Add cross-compile case to AC_RUN_IFELSE * configure.ac: * configure.ac: Use AC_RUN_IFELSE to actually run ceil, floor, round test * configure.ac: Add tests for ceil, floor and round that look in libc or libm Fixes Issue#0000446 http://bugs.librdf.org/mantis/view.php?id=446 * src/rasqal_service.c: warning text 2011-06-04 Dave Beckett * tests/sparql/check-sparql: skip both types of UpdateEvaluationTest * tests/sparql/check-sparql: Ignore update tests * utils/roqet.c: tidy help * utils/roqet.1: Document -W and -E 2011-06-03 Nicholas J Humfrey * Added -W and -E command line options to ignore warning and errors respectively. Made the roqet error log handling behave more like rapper. 2011-05-24 Dave Beckett * docs/Makefile.am: Remove README from CLEANFILES. 2011-05-22 Dave Beckett * docs/Makefile.am: Restore README to CLEANFILES after f1749351cb30de99efc6c0f0819c1a4a7da8b6f0 * src/rasqal_literal.c: Fix rasqal_literal_string_compare [CLANG] (rasqal_literal_string_compare): Simplyify calling convention; no need to ever return incomparable. Adjust logic to match raptor_term_compare() order. (rasqal_literal_compare): Protect error_p assignment [CLANG] Call rasqal_literal_string_compare to get result - no error arg. * src/rasqal_literal.c: Fix rasqal_literal_array_compare with NULLs. [CLANG] (rasqal_literal_array_compare): Remove duplicate NULL compare code and return NULL literal results earlier. * src/rasqal_literal.c: Fix rasqal_literal_sequence_compare literal NULL case [CLANG] (rasqal_literal_sequence_compare): calculate equality result earlier if both are NULL literals in the sequence. * src/rasqal_literal.c: Fix rasqal_literal_equals_flags with RASQAL_LITERAL_VARIABLE [CLANG] (rasqal_literal_equals_flags): In RASQAL_LITERAL_VARIABLE case, break case when result is calculated rather than fallthrough. This can never have worked; this case may have always been handled before calling this internal function. * src/rasqal_xsd_datatypes.c: Fixes [CLANG] (rasqal_xsd_check_double_format, rasqal_xsd_check_float_format) (rasqal_xsd_check_integer_format): Cast unused results to void and remove assignment to unused vars. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_init): Remove unused 'con' var [CLANG] * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_init): Remove unused 'con' var [CLANG] * src/rasqal_rowsource_having.c: (rasqal_having_rowsource_init): Remove unused 'con' var [CLANG] * src/rasqal_rowsource_filter.c: (rasqal_filter_rowsource_init): Remove unused 'con' var [CLANG] * src/rasqal_random.c: Fixes [CLANG] (rasqal_random_get_system_seed): Removed un-necessary final variable calculations and assignments that never get used * src/rasqal_query_transform.c: Fixes [CLANG] (rasqal_query_graph_pattern_build_variables_use_map_binds): Remove bad error freeing of 'var_is_bound' array that is never allocated before this point. * src/rasqal_query_results.c: Fixes [CLANG] (rasqal_query_results_execute_and_store_results): Remove unused 'query' var * src/rasqal_format_table.c: (rasqal_query_results_write_table_bindings): Return rc [CLANG] * src/rasqal_digest_sha1.c: Fixes [CLANG] (SHA1Transform): Removed useless zeroing out locals at end of scope (SHA1Final): Removed usless assignment to i * src/rasqal_algebra.c: Fixes [CLANG] (rasqal_algebra_algebra_node_write_internal): Remove useless final arg_count++ (rasqal_algebra_query_to_algebra) (rasqal_algebra_query_prepare_aggregates) (rasqal_algebra_query_add_group_by) (rasqal_algebra_query_add_modifiers) (rasqal_algebra_query_add_aggregation) (rasqal_algebra_query_add_projection) (rasqal_algebra_query_add_distinct) (rasqal_algebra_query_add_having): Removed useless 'modified' variable that always has the same value in the debug message. * src/Makefile.am: Add analyze target for maintainer to run clang on sources * src/.gitignore: Ignore clang .plist files 2011-05-20 Dave Beckett * src/sparql_lexer.l: Do not report failure twice for sparql_copy_name (sparql_copy_name, sparql_copy_qname): Report failure to decode once and end * utils/roqet.c: (roqet_log_handler): Handle output with no locator nicer * src/rasqal_general.c: (rasqal_world_set_log_handler): Set raptor log handler too. 2011-05-19 Dave Beckett * src/sparql_lexer.l: Make lexing failing a regular error, not fatal with abort(). Adjust flex error returns as much as possible to return a regular log error event and setjmp / longjmp to start of lexing. (sparql_lexer_log_error): Renamed from sparql_lexer_fatal_error and takes a log level. Use YY_FATAL_ERROR_EOF in lexing failures to return an error and then yyterminate() the lexing. No abort. That mostly leaves fatal errors in out of memory situations or when the lexer is jammed. Hard to fix futrher without post-processing the flex generated C. 2011-05-14 Nicholas J Humfrey * src/rasqal_format_json.c: Added the 'application/sparql-results+json' mime type, as specified in http://www.w3.org/TR/rdf-sparql-json-res/ 2011-04-15 Nicholas J Humfrey * docs/Makefile.am: Moved rasqal-fake.i from CLEANFILES to DISTCLEANFILES. 2011-04-06 Dave Beckett * docs/tmpl/section-xsd.sgml: datetime and decimal 2011-03-13 Dave Beckett * src/rasqal_query_transform.c: Fix mention / bind walking to handle single triple BGPs that are not in a Group GP (rasqal_query_graph_pattern_build_variables_use_map_binds): Split recursive walk and walk to bind vars. Use utility functions to make code more readable. Rename 'seen' to 'var_is_bound' to match the variable use. On second round of binding if the query graph pattern is a BGP, bind the variables now. (rasqal_query_build_variables_use_map): After calculating map, if there are variables SELECTEd but never bound, mark them as bound in the verb so that no error is reported. 2011-03-13 Dave Beckett * src/rasqal_query_transform.c: (rasqal_graph_pattern_promote_variable_mention_to_bind): Added utility function to turn a mention into a bind. * src/rasqal_query_transform.c: Add utility functions to test var bound / mentioned in GP tree (rasqal_graph_pattern_binds_variable) (rasqal_graph_pattern_mentions_variable): Added to test if a variable is bound/mentioned in this GP, not any sub-GP (rasqal_graph_pattern_tree_binds_variable): Added to test if a variable is bound in this GP or any lower sub-GP. * src/rasqal_query_transform.c: Split variable mention and binding marking into 2 steps (rasqal_query_graph_pattern_build_variables_use_map): Remove binding marking. (rasqal_query_graph_pattern_build_variables_use_map_binds): Added, doing recording of variables that bind. For basic graph patterns (BGPs), do that work in the group that surrounds them, which leaves just single BGPs to do. (rasqal_query_build_variables_use_map): Call rasqal_query_graph_pattern_build_variables_use_map_binds() after rasqal_query_graph_pattern_build_variables_use_map(). (rasqal_query_graph_build_variables_use_map_binds): Renamed from rasqal_query_graph_build_variables_use_map_in_internal. (rasqal_query_let_build_variables_use_map): Renamed from rasqal_query_let_build_variables_use_map_in_internal. (rasqal_query_let_build_variables_use_map_binds): Added to do binding for LET/BIND GPs. (rasqal_query_select_build_variables_use_map): Renamed from rasqal_query_select_build_variables_use_map_in_internal. * src/rasqal_query_transform.c: (rasqal_query_build_variables_use): Return number of errors 2011-03-12 Dave Beckett * src/rasqal_query_transform.c: Use query->variables_use_map to find unused, unbound or both vars. (rasqal_query_build_variable_agg_use): Added. (rasqal_query_build_variables_use): Call above and walk returned list to find variables that are bound+not used, used and not bound or neither used nor bound which is probably a parsing error. 2011-03-08 Lauri Aalto * src/rasqal_format_html.c: (rasqal_iostream_write_html_literal): Support writing additional literal types. Fixes issue #0000431 http://bugs.librdf.org/mantis/view.php?id=431 2011-03-08 Lauri Aalto * src/rasqal_format_html.c: (rasqal_iostream_write_html_literal): Fixed incorrect HTML generated with unknown literal types. Fixes Issue #0000430 http://bugs.librdf.org/mantis/view.php?id=430 2011-03-05 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map_row): Set RASQAL_VAR_USE_MENTIONED_HERE to make tests work. 2011-03-03 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_print_variables_use_map): Tidy formatting * src/rasqal_query_transform.c: Generate bind flags for triple pattern in query variables use-map (rasqal_query_triples_build_variables_use_map_row): Set bound or mentioned for variables for this triple pattern. * src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c: Tidy query transforming code building "bound-in-triple" array. (rasqal_query_variable_bound_in_triple): Removed, unused (rasqal_query_check_unused_variables): Use rasqal_query_get_bound_in_column_for_variable() instead of accessing query fields. (rasqal_query_build_bound_in_triples): Renamed from rasqal_query_build_bound_in * src/rasqal_query_transform.c: (rasqal_query_graph_pattern_bgp_build_bound_in): renamed from rasqal_query_triples_build_bound_in_internal * src/rasqal_internal.h, src/rasqal_query_transform.c: (rasqal_query_triples_build_bound_in): Removed, unused 2011-03-02 Dave Beckett * utils/srxread.c: report error with failure to read format 2011-03-01 Dave Beckett * src/rasqal_query.c, src/rasqal_query_transform.c: Remove unused, undefined RASQAL_NO_GP_MERGE 2011-02-28 Dave Beckett * src/rasqal_digest.c: Include mhash.h unconditionally for RASQAL_DIGEST_MHASH 2011-02-28 Lauri Aalto * src/rasqal_digest.c: (rasqal_digest_buffer): Fixed integer conversion warning 2011-02-28 Nicholas J Humfrey * src/rasqal_format_html.c: Corrected incorrect string length in rasqal_iostream_write_html_literal() that was causing it to generate invalid HTML. 2011-02-27 Dave Beckett * utils/roqet.c: Remove internal -g/ --engine NAME for selecting query engine * scripts/process-changes.pl: caps names can have 0-9 * scripts/process-changes.pl: caps names can have _ * docs/tmpl/section-expression.sgml: Updated tmpls * docs/rasqal-changes.tsv: Added digest EXPRs for 0.9.26 * configure.ac, src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c: Removed Query Engine V1 configure loses --with-query-engine-version option. 2011-02-26 Dave Beckett * tests/sparql/check-sparql: exist check for output triples * src/rasqal_expr_numerics.c, src/sparql_lexer.l, src/sparql_parser.y: Lowercase hex needed for digest functions * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query_write.c: Implement SPARQL 1.1 message digest expressions rasqal_op gains RASQAL_EXPR_MD5, RASQAL_EXPR_SHA1, RASQAL_EXPR_SHA224, RASQAL_EXPR_SHA256, RASQAL_EXPR_SHA384 and RASQAL_EXPR_SHA512. (rasqal_expression_evaluate_digest): Added to evaluate the above using rasqal_digest_buffer(). (rasqal_expression_evaluate2): Call above. * src/rasqal_digest_md5.c, src/rasqal_digest_sha1.c: Include rasqal_internal.h * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_substr, rasqal_expression_evaluate_set_case): Free l1 * configure.ac, src/Makefile.am, src/rasqal_digest.c, src/rasqal_digest_md5.c, src/rasqal_digest_sha1.c, src/rasqal_internal.h: Add message digest support internally (MD5, SHA1) or mhash (lots) (rasqal_digest_buffer): Added internal function. Skeleton gcrypt support also present, not yet enabled in configure. 2011-02-24 Dave Beckett * NEWS.html: 0.9.25 release pointer 2011-02-23 Dave Beckett * src/rasqal_decimal.c: (rasqal_xsd_decimal_round): Work around lack of mpf_round() in GMP 2011-02-22 Dave Beckett * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.26 * Snapshotted rasqal_0_9_25 for 0.9.25 release (GIT ab36ddfe4189f24dde4f3a0bdaac5459fe9a91d9) 2011-02-21 Dave Beckett * src/Makefile.am, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_feature.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_random.c: Add user API to set random seed for a query rasqal_feature gains RASQAL_FEATURE_RAND_SEED for setting the seed for use with rand() or rand_r(). (rasqal_evaluation_context_set_rand_seed): Added for setting seed in a standalone expression evaluation context. (rasqal_random_get_system_seed): Added as an internal function for getting a seed from system sources. * src/rasqal_internal.h: docs for internal query fields * tests/sparql/check-sparql: warnings for bad manifest data * src/rasqal_algebra.c: (rasqal_algebra_graph_pattern_to_algebra): Remove abort() in debug mode. * src/rasqal_query_transform.c: (rasqal_graph_pattern_join): Handle join of var field (OK when merging with empty GP) 2011-02-21 Lauri Aalto * src/rasqal_query.c: (rasqal_query_prepare): Fixed build without HAVE_RAND_R. * src/sparql_parser.y: #comment typo 2011-02-19 Dave Beckett * src/rasqal_decimal.c: Fix MPFR floor, round, trunc * configure.ac, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Added ABS, ROUND, CEIL, FLOOR expression support and execution. rasqal_op gains RASQAL_EXPR_ABS, RASQAL_EXPR_ROUND, RASQAL_EXPR_CEIL, and RASQAL_EXPR_FLOOR Update all expression callers. (rasqal_expression_evaluate_abs, rasqal_expression_evaluate_round, rasqal_expression_evaluate_ceil, rasqal_expression_evaluate_floor): Added. * src/rasqal_internal.h, src/rasqal_literal.c: Add abs, round, ceil, floor methods to literal class. (rasqal_literal_abs, rasqal_literal_round, rasqal_literal_ceil, rasqal_literal_floor): Added. * src/rasqal.h.in, src/rasqal_decimal.c: Add abs, round, ceil and floor for decimal class (rasqal_xsd_decimal_abs, rasqal_xsd_decimal_round, rasqal_xsd_decimal_ceil, rasqal_xsd_decimal_floor): Added. * configure.ac: Add test for stdint.h * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Numbers with no trailing 0s no longer fail 2011-02-18 Dave Beckett * src/rasqal_query.c: Mix random seed sources for RAND() (rasqal_query_prepare): Use mix public domain code from http://www.burtleburtle.net/bob/c/lookup3.c to mix processor clock, wall clock time and process ID to get a better random seed. This code should definitely be elsewhere rather than in query prepare! * src/rasqal_query.c: syntax * src/rasqal_query.c: autodocs * src/rasqal_expr_numerics.c, src/rasqal_query.c: Init random seed from some C standard function sources * src/rasqal_expr_numerics.c: (rasqal_expression_evaluate_rand): Generate a double in range [0, 1) * src/rasqal.h.in: fix rasqal_evaluation_context_set_base_uri prototype * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c: Turn rasqal_evaluation_context into a simple class. (rasqal_new_evaluation_context, rasqal_free_evaluation_context, rasqal_evaluation_context_set_base_uri): Added. The constructor takes the simple common args - world, locator and flags (none of which are shared). Most fields such as seed can be set directly (not referenced counted; shared). The single method rasqal_new_evaluation_context_set_base_uri manages the reference counted base URI. Updated callers and initialise when a query is constructed in rasqal_new_query() * src/sparql_parser.y: (Query): Move BindingsClauseOpt here to allow with any verb * src/sparql_parser.y: docs * src/sparql_parser.y: NOW() is part of SPARQL 1.1 * src/rasqal_expr.c: (rasqal_expression_visit): Do not fail when visiting BNODE() * src/rasqal.h.in, src/rasqal_expr.c: Support BNODE() with no args. Note RASQAL_EXPR_BNODE handles BNODE() (rasqal_new_1op_expression): Allow BNODE() to have a NULL arg. * src/sparql_parser.y: Use rasqal_new_0op_expression to make RASQAL_EXPR_RAND * src/sparql_lexer.l, src/sparql_parser.y: Add SPARQL 1.1 BIND() * src/rasqal_query_write.c: Add BIND to rasqal_sparql_op_labels. * docs/tmpl/section-expression.sgml, docs/tmpl/section-literal.sgml: Update tmpls 2011-02-15 Dave Beckett * utils/check_query.c: Find and print differences in query result rows (new_compare_query_results): Add world parameter (compare_query_results_compare): Check number of bindings match. For each row, check values match for each binding and print out a formatted message with the difference. Print an error message once if there were any row differences. Tidy the other error messages. (main): Set executed query results to be stored/rewindable. Set the expected results to be stored/rewindable. 2011-02-15 Dave Beckett * src/rasqal_query.c: (rasqal_query_set_store_results): Make this actually work after a prepare. * utils/check_query.c: check rows are the same width * src/rasqal_dataset.c: autodocs 2011-02-14 Dave Beckett * src/rasqal_format_rdf.c: Do not emit rs:binding if there is no value. * src/rasqal_format_table.c: Handle printing NULL values * src/sparql_common.h, src/sparql_lexer.l, src/sparql_parser.y: Update SPARQL """-quoted and '''-quoted strings to Turtle spec. Now support @lang suffix and do not suffer from grabbing too much data. (STRING_LITERAL): Removed token from lexer. (STRING): Added as a simple lexer string (HATHAT): Added lexer token for '^^'. (RDFLiteral): Added to parser handling the string, lang string or datatyped string alternatives. Uses STRING (SeparatorOpt): Updated to use STRING. (BindingValue, GraphTerm): Updated to use RDFLiteral. (sparql_stringbuffer_append_sparql_string): Added based on turtle_stringbuffer_append_turtle_string adding \f and \b escapes and adjusting error handling to go direct to a rasqal function. Fixes Issue#0000427 http://bugs.librdf.org/mantis/view.php?id=427 and Issue#0000428 http://bugs.librdf.org/mantis/view.php?id=428 * tests/sparql/update/Makefile.am, tests/sparql/update/insert-data-2.rq, tests/sparql/update/insert-data-3.rq, tests/sparql/update/insert-data-4.rq: Add tests from Issue#0000427 http://bugs.librdf.org/mantis/view.php?id=427 2011-02-14 Lauri Aalto * src/sparql_parser.y: (ClearQuery): Quick fix to avoid raptor_uri_copy(NULL) assertion failures and make tests pass. * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_strmatch): Fixed build with RASQAL_REGEX_{NONE,PCRE} 2011-02-13 Dave Beckett * src/rasqal_internal.h, src/sparql_parser.y: Fix SPARQL 1.1 CLEAR and DROP to allow optional SILENT Add internal sparql_uri_applies typedef to hold the pair of URI and applies destination enum. (new_uri_applies, free_uri_applies): Added internal to sparql parser. (GraphRefAll): Returns a sparql_uri_applies value token. Merge in the legacy GRAPH DEFAULT check here. (ClearQuery, DropQuery): Simplify using GraphRefAll returning both the optional graph URI and the applies enum. * tests/sparql/check-sparql: fix GIT earl output * src/rasqal_algebra.c, src/rasqal_engine_algebra.c: Add support for FILTER graph pattern execution on it's own. Previously all FILTER GPs were merged with Basic GP and then executed as part of the triples rowsource. This fails when FILTER is used alone like ... ASK WHERE { FILTER ( TRUE ) } which returns TRUE. (rasqal_new_filter_algebra_node): May now take NULL node. (rasqal_algebra_filter_graph_pattern_to_algebra): Added to use above to make a FILTER over no node. (rasqal_algebra_graph_pattern_to_algebra): Turn FILTER GP into algebra with above function. (rasqal_algebra_filter_algebra_node_to_rowsource): if the inner node is NULL, use an empty rowsource to 'filter' over. This could be optimized out in future but is sufficient and correct. * src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c: Guard all returns from rasqal_expression_evaluate2() to check handle NULL value if not supported * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_read_row): Ignore errors in project AS Vars. Need to check this against the spec, but tests seem to require it such as SPARQL 1.1 project-expression test 'Expression raise an error' * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_literal.c: Update literal type error returns. (rasqal_literal_as_integer, rasqal_literal_as_floating): NULL evaluated is a type error not an assertion failure/abort (debug mode). (rasqal_literal_as_counted_string, rasqal_literal_as_string_flags, rasqal_literal_compare, rasqal_literal_as_boolean, rasqal_literal_as_integer, rasqal_literal_as_floating): Alter parameter names for error return to be error_p and update autodocs. * src/rasqal_literal.c: (rasqal_literal_as_boolean): NULL evaluated is a type error. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate2): Handle AND, OR literal error returns 2011-02-12 Dave Beckett * src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c: Replace literal NULL test with error_p return tests * src/rasqal_literal.c: (rasqal_literal_value): Return NULL on NULL arg; tidy code * src/rasqal_literal.c: (rasqal_literal_compare): Return error on any NULL pointer arg * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_str): Return on success * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h, src/rasqal_query_transform.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c: rasqal_expression_evaluate2 updated to add an error pointer return arg. (rasqal_expression_evaluate2): Add an error_p pointer to an error flag to return an error since NULL is a valid expression evalution in some cases; like STRLANG() on non-simple literals. Update all callers to set error_p on error/failure case. (rasqal_engine_rowsort_calculate_order_values): Tidy cody when an error happens. (rasqal_expression_sequence_evaluate): Pass down error return. (rasqal_expression_evaluate): If error is returned, pass on NULL. (rasqal_expression_foreach_fold): If evaluation fails, break loop and return error. (rasqal_project_rowsource_read_row): Add failed cleanup. On evaluation failure in loop, fail and return. * src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c: use goto failed on errors * src/rasqal_expr_evaluate.c: autodocs * src/rasqal_expr_evaluate.c: Rename expr_context to eval_context * src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c: Update internal autodocs for rasqal_evaluation_context API change * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_query.c: (rasqal_evaluation_context_init): Renamed from rasqal_expression_context_init 2011-02-11 Dave Beckett * configure.ac, src/Makefile.am, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Add RASQAL_EXPR_RAND for SPARQL 1.1 RAND() rasqal_op gains RASQAL_EXPR_RAND rasqal_world gains seed field. Check for rand_r and use it if available. (rasqal_expression_evaluate_rand): Added TODO: Initialise seed with srandom() or with assignment (if srand_r is present) and provide API to do so too. 2011-02-10 Dave Beckett * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c: Perform all expression evaluation with rasqal_evaluation_context Added new typedef rasqal_evaluation_context to wrap context needed for expression evaluation, adding an optional base URI. rasqal_query gains a static rasqal_evaluation_context. (rasqal_expression_evaluate2): Added taking just an expression and an evaluation context. Deprecates rasqal_expression_evaluate(). (rasqal_expression_evaluate): Deprecated for above. Change all expression evaluation code to use rasqal_expression_evaluate() and pass around an expression evaluation context eval_context. (rasqal_query_prepare): Initialise the query eval_context field. 2011-02-09 Dave Beckett * src/rasqal_rowsource_empty.c, tests/sparql/syntax/result-0triples.n3: Alter empty rowsource to return 1 row of no bindings. (rasqal_empty_rowsource_read_row): Return a single empty row, then NULL. (rasqal_empty_rowsource_read_all_rows): Return a seq with one empty row (main): Adjust tests to expect above. Alter syntax test result-0triples.n3 to expect change. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_strdt): Free l1 and l2 after done with contents. * src/rasqal_expr_evaluate.c: Return no value for STRDT() and STRLANG() on non-simple literals. * src/rasqal_expr_strings.c: SPARQL 1.1 ENCODE_FOR_URI() does not preserve language and datatype of input (rasqal_expression_evaluate_encode_for_uri): Remove copy of language and datatype URI * src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_expr.c, src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Added RASQAL_EXPR_TZ for SPARQL 1.1 TZ() (rasqal_expression_evaluate_datetime_timezone): Tidy. (rasqal_expression_evaluate_datetime_tz): Added, returning the timezone string using rasqal_xsd_datetime_get_tz_as_counted_string(). (rasqal_expression_evaluate): Evaluate RASQAL_EXPR_TZ * src/rasqal_datetime.c, src/rasqal_internal.h: Add support getting timezone string raw (not as day duration) (rasqal_xsd_datetime_timezone_format): Added, pulled out of rasqal_xsd_datetime_to_counted_string(). Define #TIMEZONE_STRING_LEN for use throughtout the file. (rasqal_xsd_datetime_to_counted_string): Call above. (rasqal_xsd_datetime_get_ta_as_counted_string): Added to get back the TZ string component. * src/sparql_lexer.l: Add TZ as synonym for TIMEZONE. Until otherwise informed. * src/rasqal_expr_datetimes.c: (rasqal_expression_evaluate_datetime_timezone): Add xsd:dayTimeDuration datatype to result. * src/rasqal_datetime.c: (rasqal_xsd_datetime_get_seconds_as_decimal): Correctly get decimal. * src/sparql_parser.y: Allow GROUP BY to have an optional AS ?var (AsVarOpt): Added, pulled out of GroupCondition (GroupCondition): Handle optional var, returning just an expression 2011-02-08 Dave Beckett * src/rasqal_query.c: rasqal_query_get_bound_in_column_for_variable autodocs 2011-02-08 Lauri Aalto * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rdql_parser.y, src/sparql_parser.y: Removed remaining raptor_syntax_description mime_types_count and uri_strings_count initialization after commit e8d0043. The counts are initialized by raptor_syntax_description_validate(). Changed mime_types/uri_strings arrays to be implicitly sized. 2011-02-06 Dave Beckett * LICENSE.html: Make GPL V2 or newer explicit. 2011-02-03 Nicholas J Humfrey * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_result_formats.c: Use raptor_syntax_description_validate() to check query result descriptions and query syntax descriptions, instead of duplicating code. 2011-02-03 Dave Beckett * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.25 2011-02-01 Dave Beckett * rasqal.spec.in: Rasqal using raptor2 attempt 2011-01-31 Dave Beckett * INSTALL.html: Update INSTALL notes for pkg-config help, remove --with-raptor 2011-01-31 Lauri Aalto * src/sparql_parser.y: (ClearQuery, DropQuery): Cast away enum-int conversion warnings. 2011-01-30 Dave Beckett * Snapshotted rasqal_0_9_24 for 0.9.24 release (GIT commit 17c89f4f3643385e61e25afec9a3599cacf6dedd) * tests/sparql/update/Makefile.am, tests/sparql/update/add-3.rq, tests/sparql/update/copy-3.rq, tests/sparql/update/move-3.rq: Add tests for ADD, COPY, MOVE with 2 DEFAULT args * src/rasqal_update.c: (rasqal_new_update_operation): Allow ADD, COPY, MOVE to have 2 NULL args. * RELEASE.html, docs/rasqal-changes.tsv, src/rasqal.h.in: Documentation fixes for 0.9.24 Add ADD, MOVE, COPY notes about source/dest graphs Add rasqal_graph_pattern_get_flattened_triples and new enums to API changes 2011-01-29 Dave Beckett * src/rasqal_expr.c: (rasqal_new_group_concat_expression): Add RASQAL_EXPR_FLAG_AGGREGATE * src/sparql_parser.y, tests/sparql/update/Makefile.am, tests/sparql/update/multiple-1.rq: Support SPARQL 1.1 Update DELETE WHERE { } (DeleteQuery): Add DELETE WHERE { } storing the triples in update->delete_templates Add and enable DELETE WHERE tests delete-where-1.rq and delete-where-2.rq which were in GIT already but not called. * src/sparql_lexer.l, src/sparql_parser.y, tests/sparql/update/Makefile.am, tests/sparql/update/delete-data-2.rq, tests/sparql/update/insert-2.rq, tests/sparql/update/multiple-1.rq: Require ; between update operations Add test for multiple operations in one update Adjust tests to match new syntax: delete-data-2.rq insert-2.rq Alter sparql lexer and parser test buffer size to 4K * src/rasqal_literal.c: (rasqal_free_literal): Free datetime datatype URI * docs/tmpl/section-updates.sgml: Update tmpls * src/rasqal_algebra.c: (rasqal_algebra_extract_aggregate_expression_visit): Correct variable references for aggregate work: give map a reference. * src/rasqal_rowsource_aggregation.c: autodocs * src/rasqal_rowsource.c: autodocs 2011-01-28 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_query_add_aggregation): Clean up ae if no aggregation in query. * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_finish): Free con->expr_data * src/rasqal_solution_modifier.c: (rasqal_free_solution_modifier): Free having conditions * src/rasqal_algebra.c, src/rasqal_dataset.c, src/rasqal_engine.c, src/rasqal_format_table.c, src/rasqal_formula.c, src/rasqal_general.c, src/rasqal_graph.c, src/rasqal_graph_pattern.c, src/rasqal_map.c, src/rasqal_result_formats.c, src/rasqal_row_compatible.c, src/rasqal_rowsource.c, src/rasqal_triples_source.c, src/rasqal_update.c: Make all object destructors simply return on a NULL object pointer * src/rasqal_projection.c: (rasqal_free_projection): Free if pointer NOT NULL * src/rasqal_literal.c: (rasqal_new_variable_literal): Only free variable if calloc fails * docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_query_write.c, src/rasqal_update.c, src/sparql_lexer.l, src/sparql_parser.y, tests/sparql/update/Makefile.am, tests/sparql/update/add-1.rq, tests/sparql/update/add-2.rq, tests/sparql/update/copy-1.rq, tests/sparql/update/copy-2.rq, tests/sparql/update/move-1.rq, tests/sparql/update/move-2.rq: Added support for SPARQL 1.1 Update draft ADD, MOVE, COPY parsing. rasqal_update_type gains new enum values RASQAL_UPDATE_TYPE_ADD, RASQAL_UPDATE_TYPE_MOVE and RASQAL_UPDATE_TYPE_COPY Added new enum rasqal_update_graph_applies rasqal_update_operation gains new applies field for CLEAR and DROP to signify they apply to multiple graphs. (rasqal_query_write_graphref): Added method for writing uri or DEFAULT or Named or ALL (rasqal_query_write_sparql_20060406): Write out new tokens and use rasqal_query_write_graphref() for terms. Refactor. SPARQL lexer/parser adds the new tokens ADD, MOVE, COPY and TO. (AddQuery, MoveQuery, CopyQuery): Added. (UpdateOperation): Add above alternatives to updates. (SilentOpt): Added to return silent flag. (CreateQuery, DropQuery, LoadQuery): Refactored to use above flag and save several code blocks. Move around the warnings for deprecated SPARQL 1.1 and LAQRS syntax. (GraphRefAll): Added for Clear and Drop (excluding GraphRef) (rasqal_new_update_operation): Add applies arg. (rasqal_update_operation_print): Print new ops, document URI and applies. Added tests for SPARQL 1.1 Update ADD, MOVE, COPY * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.24 * src/rasqal_literal.c: Free a few more variable references (rasqal_new_variable_literal): Free passed in variable on error (rasqal_free_literal): Free variable if not NULL. * src/rasqal_literal.c: (rasqal_free_literal): Free reference-counted variables * utils/roqet.c: Make tidy_query free the query 2011-01-27 Dave Beckett * Snapshotted rasqal_0_9_23 for 0.9.23 release (GIT c2105bc8f4ccc77bb407213aa19c2a9e57c42531) * tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am: Mark 4 SPARQL 1.0 tests as passing after NULL literal comparison fixes. Expr1: Tests "OPTIONAL-FILTER" and "OPTIONAL - Outer FILTER" now pass Expr2: Tests "Test 'boolean effective value' - optional" and "Test 'boolean effective value' - unknown types" now pass * NEWS.html, RELEASE.html, src/rasqal_literal.c: (rasqal_literal_equals_flags): Make comparisons with one or more NULLs work. Fixes Issue#0000417 http://bugs.librdf.org/mantis/view.php?id=417 2011-01-26 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_array_compare): Sort NULLs earlier in SPARQL ordering. Fixes Issue#0000407 http://bugs.librdf.org/mantis/view.php?id=407 * docs/tmpl/section-graph_pattern.sgml: Update tmpls * scripts/process-changes.pl: Sort by new version, newest first. Put package title in section only. Handle multiple old/new version pairs * docs/Makefile.am: Rasqal name * ChangeLog, ChangeLog.8, Makefile.am: Add ChangeLog.8 for 2010 * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Add rasqal_graph_pattern_get_flattened_triples * scripts/process-changes.pl: Update to version from librdf 2011-01-25 Dave Beckett * src/rasqal_query_write.c: (rasqal_query_write_sparql_triple_data): Emit GRAPH lit { ... } correctly * src/sparql_parser.y: (GraphTemplate): Tidy conditions and do cleanup * src/sparql_parser.y: (GraphTemplate): Apply GRAPH to triples sequence directly * src/rasqal_query_write.c: (rasqal_query_write_sparql_triple_data): Handle triples templates * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_flattened_triples_visit): Handle empty seq. * src/sparql_parser.y: Return flat triples in update insert/delete templates (GraphTriples, UpdateQuery): Use rasqal_triples_sequence_set_origin() to expand BGP/GGP into a flat sequence of triples for caller. * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_flattened_triples_visit): Use rasqal_triples_sequence_set_origin(). * src/rasqal_internal.h, src/rasqal_triple.c: (rasqal_triples_sequence_set_origin): Added to set the same graph URI origin for a sequence of rasqal_triple * src/sparql_parser.y: Make update operations insert/delete_template fields store seq of triples. (GraphTemplate, ModifyTemplate): Now seq of rasqal_triple (GraphTemplate): Use rasqal_graph_pattern_get_flattened_triples() to turn a basic graph pattern or one with GRAPH gp into a sequence of triples. * src/rasqal.h.in, src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_flattened_triples): Added to flatten triple templates * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.23 * src/rasqal_update.c: (rasqal_new_update_operation): Correct internal docs * src/rasqal.h.in: rasqal_update_operation docs 2011-01-21 Dave Beckett * src/rasqal_expr.c: (rasqal_expression_compare): Compare op to RASQAL_EXPR_UNKNOWN 2011-01-17 Dave Beckett * src/sparql_parser.y: When language feature is not allowed, use YYERROR to unwind stack and abort query cleanly 2011-01-12 Dave Beckett * Snapshotted rasqal_0_9_22 for 0.9.22 release (GIT b2b04e39695cced136e1d24d00d84066868d0c89) * docs/librasqal.3: skeleton * utils/Makefile.am: move check-query to EXTRA for now * utils/roqet.1: formatting * src/rasqal_general.c: 2011 * configure.ac, src/.gitignore, src/rasqal.h.in, src/win32_rasqal_config.h, src/win32_rasqal_config.h.in: Substitute rasqal versions into src/rasqal.h.in and src/win32_rasqal_config.h.in * rasqal-src-config.in: pkg-config raptor2 only * configure.ac: RAPTOR_MIN_VERSION 2.0.0 * configure.ac: AC_SUBST(RAPTOR_MIN_VERSION) * configure.ac: RASQAL_LIBTOOL_VERSION 3:0:0 causing soname bump 2011-01-11 Dave Beckett * scripts/process-changes.pl: Make changes generate 1 page per changeset. Sort output by function, type or enum name * docs/rasqal-changes.tsv: 0.9.22 changes * src/rasqal.h.in: code style * docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-query_results_formatter.sgml, docs/tmpl/section-unused.sgml, docs/tmpl/section-variable.sgml, docs/tmpl/section-xsd.sgml: Update tmpls * src/rasqal.h.in: document rasqal_generate_bnodeid_handler. Added enum rasqal_query_results_format_flags for bitflags * docs/rasqal-sections.txt: Added rasqal_generate_bnodeid_handler, rasqal_query_results_format_flags. Removed rasqal_query_results_formatter_get_mime_type, raptor_message_handler * docs/rasqal-sections.txt: updated sections 2011-01-11 Lauri Aalto * src/rasqal.h.in: (rasqal_new_query_results_formatter, rasqal_new_query_results_formatter_for_content): Added RASQAL_API exports to public API functions. 2011-01-10 Dave Beckett * src/rasqal.h.in: Removed raptor_message_handler * docs/.gitignore, docs/Makefile.am, docs/rasqal-changes.tsv, docs/rasqal-docs.xml, scripts/Makefile.am, scripts/process-changes.pl: Generate Rasqal changes doc sections Generate the changes using an update version process-changes.pl from raptor V2 that can handle multiple sections for different old/new versions as well as omitting sections that have no content. * src/rasqal.h.in, src/rasqal_data_graph.c, src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_service.c, src/rasqal_variable.c, src/rdql_parser.y, src/sparql_parser.y, tests/engine/rasqal_graph_test.c, tests/engine/rasqal_triples_test.c, utils/check_query.c, utils/roqet.1, utils/roqet.c, utils/srxread.c, utils/srxwrite.c: Remove all deprecated functions and rename foo2() to foo() rasqal_generate_bnodeid_handler takes a world object (was rasqal_generate_bnodeid_handler2) (rasqal_world_set_generate_bnodeid_handler): takes a rasqal_generate_bnodeid_handler arg (was rasqal_generate_bnodeid_handler2) Removed deprecated: rasqal_query_set_fatal_error_handler, rasqal_query_set_error_handler, rasqal_query_set_warning_handler, rasqal_query_set_default_generate_bnodeid_parameters, rasqal_query_set_generate_bnodeid_handler, rasqal_query_results_formats_enumerate, rasqal_new_query_results_formatter_by_mime_type, rasqal_query_results_formatter_get_mime_type, rasqal_new_data_graph, rasqal_new_coalesce_expression, rasqal_new_variable_typed, rasqal_new_variable. (rasqal_query_add_data_graph): Takes a data_graph arg instead of uri, name and flags (renamed from rasqal_query_add_data_graph2) (rasqal_query_results_write, rasqal_query_results_read): Take a name, mime_type, format_uri, base_uri args instead of format_uri, base_uri. (Renamed from rasqal_query_results_write2 and rasqal_query_results_read2 respectively). (rasqal_query_results_formats_check): Takes name, format URI, mime_type flags instead of name, uri and type. (Renamed from rasqal_query_results_formats_check2) (rasqal_new_query_results_formatter): Takes name, format type, format URI args instead of just name, format URI (renamed from rasqal_new_query_results_formatter2) (rasqal_new_query_results_formatter_for_content): Replaces rasqal_new_query_results_formatter_by_mime_type and takes optional buffer with length and identifer. (rasqal_new_function_expression): Added params and flags args to handle aggregate expressions. (Renamed from rasqal_new_function_expression2) roqet: delete deprecated -w arg. Use -d structure instead. * src/rasqal.h.in, src/rasqal_data_graph.c, src/rasqal_expr.c, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_variable.c: Add if !defined(RASQAL_DISABLE_DEPRECATED) around remaining deprecated functions 2011-01-06 Dave Beckett * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_query.c: Added RASQAL_DISABLE_DEPRECATED macros around things that are going away 2011-01-04 Dave Beckett * INSTALL.html, configure.ac, rasqal.pc.in, src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_dataset.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_service.c, src/rasqal_variable.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y, utils/Makefile.am, utils/check_query.c, utils/roqet.c: Kill support for Raptor V1 2011-01-04 Lauri Aalto * src/rasqal_expr_strings.c: (rasqal_unicode_utf8_substr): Fixed integer conversion resulting in change of sign 2011-01-03 Dave Beckett * src/rasqal_expr_strings.c: (rasqal_unicode_utf8_substr): End substr after length unichars * RELEASE.html, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: Execute SUBSTR() 2 and 3-arg versions (rasqal_unicode_utf8_substr): Added to do unicode UTF-8 substr using 0-offset index. (rasqal_expression_evaluate_substr): Added to implement SPARQL 1.1 draft SUBSTR() using above. Adjust XSD string 1-offset indexes. (rasqal_expression_evaluate): Call above for RASQAL_EXPR_SUBSTR * RELEASE.html, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: Execute ENCODE_FOR_URI() (rasqal_expression_evaluate_encode_for_uri): Added to implement SPARQL 1.1 draft ENCODE_FOR_URI() (rasqal_expression_evaluate): Call above for RASQAL_EXPR_ENCODE_FOR_URI. * INSTALL.html, LICENSE.html, NEWS.html, README.html, RELEASE.html, TODO.html, docs/rasqal-docs.xml: #2011 * docs/tmpl/section-query_results.sgml: Update tmpls * utils/check_query.c: Raptor V1 support by importing V2 stuff. Sigh. * src/rasqal.h.in, src/rasqal_query_results.c: (rasqal_query_results_get_row_by_offset): Added to access stored query result rows * src/rasqal_query_results.c: (rasqal_query_check_limit_offset): negative offsets are errors * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_query_check_limit_offset): Renamed from rasqal_query_results_check_limit_offset Renamed since this no longer uses (reads/writes) any query result state Updated callers. * src/rasqal_query_results.c: (rasqal_query_results_check_limit_offset): Just check, do not set finished flag * src/rasqal_engine.c, src/rasqal_query_results.c: Adjust callers of rasqal_query_results_check_limit_offset() to set finished flag explicitly 2011-01-03 Lauri Aalto * src/rasqal_format_rdf.c: Eliminated initialized data - added const to ptr that does not need to be modified * src/rasqal_expr_strings.c, src/rasqal_query_results.c: (rasqal_expression_evaluate_concat,rasqal_query_results_rewind): Init variables before using them * src/rasqal_dataset.c, src/rasqal_query_results.c: (rasqal_dataset_init_match_internal,rasqal_query_results_get_type): Fixed int-enum warnings * src/rasqal_expr.c: fixed non-ascii comment * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_set_case): Fixed compiler warnings 2011-01-02 Dave Beckett * utils/check_query.c: (compare_query_results_compare): renamed to match code style * src/rasqal.h.in, src/rasqal_query_results.c: Added rewindable query results (rasqal_query_results_rewind): Added. (rasqal_query_results_execute_and_store_results): Calls above to reset the state after execution of all rows. Adjust return to be failure so that empty result sets are not an error. (rasqal_query_results_get_row_from_saved): Return a copy of a row from a sequence rather then use the raptor_sequence_delete_at to allow rewinding to work. * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_query.c: (rasqal_query_set_store_results): Moved to public API. Resets to unset after a prepare * tests/sparql/check-sparql: protect test for undef var * src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: Alter rasqal_query_execute_with_engine to allow storing query results (rasqal_query_execute_with_engine): Construct a query result and then call rasqal_query_results_execute_with_engine() to execute it, passing in any query store_results flag directly. (rasqal_query_results_execute_with_engine): Alter signature to become a method query_results class, adding a store_results flag argument and just do executing not construction and executing - misnamed by code style. Result is now a success int value. * utils/check_query.c: Add query results comparison local class (check_query_log_handler, check_query_error_handler): Tidy to print nicer messages if there is no locator (new_compare_query_results, free_compare_query_results, compare_query_results_set_log_handler, compare_compare_query_results): Added skeleton of a query results comparison class. * utils/check_query.c: (check_query_read_results): Added for code tidy. * utils/check_query.c: Allow -F/--format to set parser or query results format name. * utils/check_query.c: Print out expected and actual bindings result * utils/check_query.c: Init ds to NULL * src/rasqal_internal.h: Add V1 raptor_new_iostream_from_filename macro * utils/check_query.c: Read expected result * src/rasqal.h.in: raptor_uri * src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c: Add query results recongising for 'rdf', 'turtle' and 'xml' formatters. (rasqal_query_results_rdfxml_recognise_syntax, rasqal_query_results_turtle_recognise_syntax, rasqal_query_results_xml_recognise_syntax): Added. All recognising just a few suffixes. * src/rasqal_internal.h: recognise not recognize * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_result_formats.c: Add query results format guessing. (rasqal_world_guess_query_results_format_name): Added to guess format based on format URI, mime type, some sample content or an identifier. (rasqal_new_query_results_formatter_for_content): Added to use above to construct a formatter from content. Typedef rasqal_query_results_recognize_syntax_func added rasqal_query_results_format_factory gains recognize_syntax optional factory method. * utils/roqet.c: (roqet_init_query): Remove unused results variable * utils/check_query.c: Use iostream and dataset to read graph results. * utils/check_query.c: (check_query_init_query): Added to pull init query code out of main * utils/.gitignore, utils/Makefile.am, utils/check_query.c: Add start of check_query utility * src/rasqal_query_results.c: Use rasqal_query_get_result_type in query engine execution (rasqal_query_results_execute_with_engine): Call rasqal_query_get_result_type() to get expected type and use RASQAL_QUERY_RESULTS_UNKNOWN for error case. * src/rasqal.h.in, src/rasqal_query.c: (rasqal_query_get_result_type): Added to determine expected result type from query structure Based on logic from rasqal_query_results_execute_with_engine() * src/rasqal.h.in: rasqal_query_results_type gains RASQAL_QUERY_RESULTS_UNKNOWN * src/rasqal.h.in, src/rasqal_query_results.c: (rasqal_query_results_get_type): Added 2011-01-01 Dave Beckett * docs/tmpl/section-expression.sgml: Update tmpls * tests/sparql/check-sparql: Handle file: URIs properly for reading rdf results * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Document l->string ownership for decimal. * src/rasqal_decimal.c: (rasqal_xsd_decimal_set_string): Strip leading '+' from decimal string for MPFR and GMP * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_datatype): Free literal after getting a reference to dt_uri * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate): Fix RASQAL_EXPR_DATATYPE return value. * src/rasqal_format_sparql_xml.c, src/rasqal_general.c, src/rasqal_query.c, src/rasqal_redland.c: Replace strcpy with memcpy since strcpy() special features are not needed * src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_format_rdf.c, src/rasqal_literal.c: Replace rasqal_literal_as_string + strlen() on result with rasqal_literal_as_counted_string() call * src/rasqal_internal.h, src/rasqal_literal.c: Ensure true/false literal strings have lengths set consistently * src/rasqal.h.in, src/rasqal_literal.c: (rasqal_literal_as_counted_string): Added to get the literal string with length. * src/rasqal_expr_datetimes.c: autodocs * src/rasqal_expr_datetimes.c: (rasqal_expression_evaluate_datetime_timezone): No need to use len * src/rasqal_datetime.c: (rasqal_xsd_datetime_get_timezone_as_counted_string): Remove sprintf for small integers. * src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_internal.h: (rasqal_expression_evaluate_datetime_timezone): Added to execute TIMEZONE() * src/rasqal.h.in, src/rasqal_datetime.c: (rasqal_xsd_datetime_get_timezone_as_counted_string): Added to turn a timezone into a duration string rasqal-0.9.33/Makefile.in0000644000175000017500000007361312434455633012102 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal RDF query language library # # 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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ @RASQAL_MTWIST_TRUE@am__append_1 = libmtwist @GETOPT_TRUE@am__append_2 = getopt subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/rasqal-src-config.in \ $(srcdir)/rasqal.pc.in $(srcdir)/rasqal.rdf.in \ $(srcdir)/rasqal.spec.in $(top_srcdir)/configure AUTHORS \ COPYING COPYING.LIB ChangeLog INSTALL NEWS build/ar-lib \ build/compile build/config.guess build/config.sub \ build/depcomp build/install-sh build/ltmain.sh build/missing \ mkinstalldirs 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) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = rasqal.spec rasqal.rdf rasqal.pc \ rasqal-src-config CONFIG_CLEAN_VPATH_FILES = SCRIPTS = $(noinst_SCRIPTS) 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ noinst_SCRIPTS = rasqal-src-config ACLOCAL_AMFLAGS = -I build SUBDIRS = libsv $(am__append_1) $(am__append_2) src utils tests docs \ data win32 scripts DIST_SUBDIRS = libsv libmtwist getopt src utils tests docs data win32 scripts pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = rasqal.pc EXTRA_DIST = \ ChangeLog.1 ChangeLog.2 ChangeLog.3 ChangeLog.4 ChangeLog.5 \ ChangeLog.6 ChangeLog.7 ChangeLog.8 ChangeLog.9 ChangeLog.10 \ ChangeLog.11 \ README LICENSE.txt \ README.html NEWS.html LICENSE.html INSTALL.html \ RELEASE.html \ LICENSE-2.0.txt NOTICE \ rasqal.rdf.in \ autogen.sh \ rasqal-src-config.in \ rasqal.spec.in \ $(man_MANS) \ rasqal.pc.in DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc # Create some text files from HTML sources @MAINTAINER_MODE_TRUE@LYNX = lynx @MAINTAINER_MODE_TRUE@HTML_TO_TEXT = TERM=vt100 $(LYNX) -dump -nolist @MAINTAINER_MODE_TRUE@SUFFIXES = .html .txt all: all-recursive .SUFFIXES: .SUFFIXES: .html .txt am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): rasqal.spec: $(top_builddir)/config.status $(srcdir)/rasqal.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ rasqal.rdf: $(top_builddir)/config.status $(srcdir)/rasqal.rdf.in cd $(top_builddir) && $(SHELL) ./config.status $@ rasqal.pc: $(top_builddir)/config.status $(srcdir)/rasqal.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ rasqal-src-config: $(top_builddir)/config.status $(srcdir)/rasqal-src-config.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @case `sed 15q $(srcdir)/NEWS` in \ *"$(VERSION)"*) : ;; \ *) \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1;; \ esac $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: 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-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgconfigDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck 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-pkgconfigDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-pkgconfigDATA @MAINTAINER_MODE_TRUE@.html.txt: @MAINTAINER_MODE_TRUE@ $(HTML_TO_TEXT) $< > $@ @MAINTAINER_MODE_TRUE@$(srcdir)/README: $(srcdir)/README.html @MAINTAINER_MODE_TRUE@ $(HTML_TO_TEXT) $< > $@ @MAINTAINER_MODE_TRUE@$(srcdir)/NEWS: $(srcdir)/NEWS.html @MAINTAINER_MODE_TRUE@ $(HTML_TO_TEXT) $< > $@ # Some people need a little help ;-) test: check # 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: rasqal-0.9.33/getopt/0000755000175000017500000000000012443715251011400 500000000000000rasqal-0.9.33/getopt/Makefile.am0000644000175000017500000000145712241743242013360 00000000000000# -*- Mode: Makefile -*- # # Makefile for libgetopt convienience library # ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = libgetopt.la libgetopt_la_SOURCES = \ getopt.c \ rasqal_getopt.h CLEANFILES= \ *.plist if MAINTAINER_MODE # Run Clang static analyzer over sources. analyze: $(SOURCES) @list='$(SOURCES)'; \ result=0; \ for file in $$list; do \ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ $(RECHO) "Analyzing $$file"; \ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ status=$$?; \ if test $$status != 0; then \ result=1; \ fi; \ fi; \ done; \ set -e; exit $$result endif rasqal-0.9.33/getopt/Makefile.in0000644000175000017500000004370612434455632013403 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 for libgetopt convienience library # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = getopt DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libgetopt_la_LIBADD = am_libgetopt_la_OBJECTS = getopt.lo libgetopt_la_OBJECTS = $(am_libgetopt_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libgetopt_la_SOURCES) DIST_SOURCES = $(libgetopt_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = libgetopt.la libgetopt_la_SOURCES = \ getopt.c \ rasqal_getopt.h CLEANFILES = \ *.plist 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 getopt/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu getopt/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libgetopt.la: $(libgetopt_la_OBJECTS) $(libgetopt_la_DEPENDENCIES) $(EXTRA_libgetopt_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libgetopt_la_OBJECTS) $(libgetopt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Plo@am__quote@ .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 $< .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 `$(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 $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 $(LTLIBRARIES) 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 clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags 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 uninstall uninstall-am # Run Clang static analyzer over sources. @MAINTAINER_MODE_TRUE@analyze: $(SOURCES) @MAINTAINER_MODE_TRUE@ @list='$(SOURCES)'; \ @MAINTAINER_MODE_TRUE@ result=0; \ @MAINTAINER_MODE_TRUE@ for file in $$list; do \ @MAINTAINER_MODE_TRUE@ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ @MAINTAINER_MODE_TRUE@ $(RECHO) "Analyzing $$file"; \ @MAINTAINER_MODE_TRUE@ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ @MAINTAINER_MODE_TRUE@ status=$$?; \ @MAINTAINER_MODE_TRUE@ if test $$status != 0; then \ @MAINTAINER_MODE_TRUE@ result=1; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ done; \ @MAINTAINER_MODE_TRUE@ set -e; exit $$result # 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: rasqal-0.9.33/getopt/rasqal_getopt.h0000644000175000017500000000044312241743242014334 00000000000000/* * Public Domain getopt header * */ #ifndef RASQAL_GETOPT_H #define RASQAL_GETOPT_H #ifdef __cplusplus extern "C" { #endif int getopt(int argc, char * const argv[], const char *optstring); extern char *optarg; extern int optind, opterr, optopt; #ifdef __cplusplus } #endif #endif rasqal-0.9.33/getopt/getopt.c0000644000175000017500000000713012241743242012764 00000000000000/* * Public Domain getopt - history below * */ /* * From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.sources * Subject: getopt library routine Date: 30 Mar 85 04:45:33 GMT */ /* * getopt -- public domain version of standard System V routine * * Strictly enforces the System V Command Syntax Standard; provided by D A * Gwyn of BRL for generic ANSI C implementations * * #define STRICT to prevent acceptance of clustered options with arguments * and ommision of whitespace between option and arg. */ /* * Modified by Manuel Novoa III on 1/5/01 to use weak symbols. * Programs needing long options will link gnu_getopt instead. */ /* * Last public domain version 1.5 downloaded from uclibc CVS: * http://www.uclibc.org/cgi-bin/cvsweb/uClibc/libc/unistd/getopt.c * on 2003-02-18 by Dave Beckett and tidied: * Ran through "indent getopt.c -gnu" then fixed up the mess * Removed register - compilers are smart these days * ANSI-fied the declarations * Prefixed with raptor_ so that it doesn't clash with any getopt * linked in later. */ #include #include #include int opterr; /* error => print message */ int optind; /* next argv[] index */ int optopt; /* Set for unknown arguments */ char *optarg; /* option parameter if any */ /* * Err: * program name argv[0] * specific message * defective option letter */ static int Err (char *name, const char *mess, int c) /* returns '?' */ { optopt = c; if (opterr) { (void) fprintf (stderr, "%s: %s -- %c\n", name, mess, c); } return '?'; /* erroneous-option marker */ } int getopt (int argc, char * const argv[], const char *optstring) { static int sp = 1; /* position within argument */ int osp; /* saved `sp' for param test */ #ifndef STRICT int oind; /* saved `optind' for param test */ #endif int c; /* option letter */ char *cp; /* -> option in `optstring' */ optarg = NULL; /* initialise getopt vars */ if (optind == 0) { optind = 1; opterr = 1; optopt = 1; optarg = NULL; } if (sp == 1) { /* fresh argument */ if (optind >= argc /* no more arguments */ || argv[optind][0] != '-' /* no more options */ || argv[optind][1] == '\0' /* not option; stdin */ ) return EOF; else if (strcmp (argv[optind], "--") == 0) { ++optind; /* skip over "--" */ return EOF; /* "--" marks end of options */ } } c = argv[optind][sp]; /* option letter */ osp = sp++; /* get ready for next letter */ #ifndef STRICT oind = optind; /* save optind for param test */ #endif if (argv[optind][sp] == '\0') { /* end of argument */ ++optind; /* get ready for next try */ sp = 1; /* beginning of next argument */ } if (c == ':' || c == '?' /* optstring syntax conflict */ || (cp = strchr (optstring, c)) == NULL) /* not found */ { return Err (argv[0], "illegal option", c); } if (cp[1] == ':') { /* option takes parameter */ #ifdef STRICT if (osp != 1) { return Err (argv[0], "option must not be clustered", c); } /* reset by end of argument */ if (sp != 1) { return Err (argv[0], "option must be followed by white space", c); } #else if (oind == optind) { /* argument w/o whitespace */ optarg = &argv[optind][sp]; sp = 1; /* beginning of next argument */ } else #endif if (optind >= argc) { return Err (argv[0], "option requires an argument", c); } else /* argument w/ whitespace */ optarg = argv[optind]; ++optind; /* skip over parameter */ } return c; } rasqal-0.9.33/tests/0000755000175000017500000000000012443715253011242 500000000000000rasqal-0.9.33/tests/Makefile.am0000644000175000017500000000175711754356266013241 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # SUBDIRS= algebra engine if RASQAL_QUERY_SPARQL SUBDIRS += sparql endif if RASQAL_QUERY_LAQRS SUBDIRS += laqrs endif EXTRA_DIST=improve rasqal-0.9.33/tests/Makefile.in0000644000175000017500000004764112434455632013245 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ @RASQAL_QUERY_SPARQL_TRUE@am__append_1 = sparql @RASQAL_QUERY_LAQRS_TRUE@am__append_2 = laqrs subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = algebra engine sparql laqrs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SUBDIRS = algebra engine $(am__append_1) $(am__append_2) EXTRA_DIST = improve all: all-recursive .SUFFIXES: $(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 tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: 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-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: rasqal-0.9.33/tests/sparql/0000755000175000017500000000000012443715253012544 500000000000000rasqal-0.9.33/tests/sparql/aggregate/0000755000175000017500000000000012443715253014472 500000000000000rasqal-0.9.33/tests/sparql/aggregate/Makefile.am0000644000175000017500000000760112302411034016432 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL aggregate tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data-1.ttl \ data-2.ttl SPARQL_TEST_FILES= \ agg-1.rq \ agg-2.rq \ agg-3.rq \ group-concat-1.rq \ group-concat-2.rq \ group-concat-3.rq \ group-concat-4.rq EXPECTED_SPARQL_CORRECT= \ "Aggregate 1 - SUM with GROUP BY and HAVING" \ "Aggregate 2 - SUM" \ "Aggregate 3 - SAMPLE and GROUP BY" \ "Group Concat 1 - Newline separator" \ "Group Concat 2 - default separator" \ "Group Concat 3 - HAVING" \ "Group Concat 4 - DISTINCT" SPARQL_BAD_TEST_FILES= \ bad-1.rq SPARQL_RESULT_FILES= \ agg-1.ttl \ agg-2.ttl \ agg-3.ttl \ group-concat-1.ttl \ group-concat-2.ttl \ group-concat-3.ttl \ group-concat-4.ttl EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_BAD_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good sparql-parse-bad sparql-query" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Query aggregates legal parsing\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-parse-bad: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Query aggregates illegal parsing\"; mf:entries ("; \ for test in $(SPARQL_BAD_TEST_FILES); do \ comment="sparql failing to parse of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Query Aggregates\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -i sparql11 -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/aggregate/group-concat-2.rq0000644000175000017500000000032111476100736017511 00000000000000# Test GROUP_CONCAT() with default separator PREFIX ex: SELECT ?state (GROUP_CONCAT(?name) AS ?residents) WHERE { ?person ex:name ?name . ?person ex:livesIn ?state } GROUP BY ?state rasqal-0.9.33/tests/sparql/aggregate/Makefile.in0000644000175000017500000003764212434455633016476 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL aggregate tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/aggregate DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data-1.ttl \ data-2.ttl SPARQL_TEST_FILES = \ agg-1.rq \ agg-2.rq \ agg-3.rq \ group-concat-1.rq \ group-concat-2.rq \ group-concat-3.rq \ group-concat-4.rq EXPECTED_SPARQL_CORRECT = \ "Aggregate 1 - SUM with GROUP BY and HAVING" \ "Aggregate 2 - SUM" \ "Aggregate 3 - SAMPLE and GROUP BY" \ "Group Concat 1 - Newline separator" \ "Group Concat 2 - default separator" \ "Group Concat 3 - HAVING" \ "Group Concat 4 - DISTINCT" SPARQL_BAD_TEST_FILES = \ bad-1.rq SPARQL_RESULT_FILES = \ agg-1.ttl \ agg-2.ttl \ agg-3.ttl \ group-concat-1.ttl \ group-concat-2.ttl \ group-concat-3.ttl \ group-concat-4.ttl EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_BAD_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/aggregate/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/aggregate/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good sparql-parse-bad sparql-query" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Query aggregates legal parsing\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-parse-bad: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Query aggregates illegal parsing\"; mf:entries ("; \ for test in $(SPARQL_BAD_TEST_FILES); do \ comment="sparql failing to parse of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Query Aggregates\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -i sparql11 -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/aggregate/group-concat-3.rq0000644000175000017500000000033311471421333017507 00000000000000# Test GROUP with HAVING condition PREFIX ex: SELECT ?state WHERE { ?person ex:name ?name . ?person ex:livesIn ?state } GROUP BY ?state HAVING ( ?state != 'California' ) ( ?state != 'Florida') rasqal-0.9.33/tests/sparql/aggregate/group-concat-1.ttl0000644000175000017500000004234011470576400017677 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "state" ; rs:resultVariable "residents" ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alabama" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alaska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Lisa Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arizona" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Jon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arkansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Blanche Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "California" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara Dianne" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Colorado" ] ; rs:binding [ rs:variable "residents" ; rs:value "Mark Michael" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Connecticut" ] ; rs:binding [ rs:variable "residents" ; rs:value "Christopher Joe" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Delaware" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ted Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Florida" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bill George" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Georgia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Johnny Saxby" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Hawaii" ] ; rs:binding [ rs:variable "residents" ; rs:value "Daniel Daniel" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Idaho" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mike" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Illinois" ] ; rs:binding [ rs:variable "residents" ; rs:value "Dick Roland" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Indiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Evan Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Iowa" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Pat Sam" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kentucky" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mitch" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Louisiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "David Mary" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maine" ] ; rs:binding [ rs:variable "residents" ; rs:value "Olympia Susan" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maryland" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara Ben" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Massachusetts" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Scott" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Michigan" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carl Debbie" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Minnesota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Al Amy" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Mississippi" ] ; rs:binding [ rs:variable "residents" ; rs:value "Roger Thad" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Missouri" ] ; rs:binding [ rs:variable "residents" ; rs:value "Claire Kit" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Montana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jon Max" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nebraska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ben Mike" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nevada" ] ; rs:binding [ rs:variable "residents" ; rs:value "Harry John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Hampshire" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeanne Judd" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Jersey" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Frank" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Mexico" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New York" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck Kirsten" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Kay Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Byron Kent" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Ohio" ] ; rs:binding [ rs:variable "residents" ; rs:value "George Sherrod" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oklahoma" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oregon" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Ron" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Pennsylvania" ] ; rs:binding [ rs:variable "residents" ; rs:value "Arlen Bob" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Rhode Island" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jack Sheldon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Lindsey" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Tim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Tennessee" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Lamar" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Texas" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Kay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Utah" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Orrin" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Vermont" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bernie Patrick" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Washington" ] ; rs:binding [ rs:variable "residents" ; rs:value "Maria Patty" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "West Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carte Jay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wisconsin" ] ; rs:binding [ rs:variable "residents" ; rs:value "Herb Russ" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wyoming" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Mike" ] ] . rasqal-0.9.33/tests/sparql/aggregate/agg-2.ttl0000644000175000017500000000052012251256674016035 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "sum" ; rs:solution [ rs:binding [ rs:variable "sum" ] ] . rasqal-0.9.33/tests/sparql/aggregate/data-2.ttl0000644000175000017500000001521411464564345016220 00000000000000@prefix ex: . # US Senators (Oct 2010) first name, state and year of birth _:person00 ex:name "Al"; ex:livesIn "Minnesota"; ex:year 1951 . _:person01 ex:name "Amy"; ex:livesIn "Minnesota"; ex:year 1960 . _:person02 ex:name "Arlen"; ex:livesIn "Pennsylvania"; ex:year 1930 . _:person03 ex:name "Barbara"; ex:livesIn "California"; ex:year 1940 . _:person04 ex:name "Barbara"; ex:livesIn "Maryland"; ex:year 1936 . _:person05 ex:name "Ben"; ex:livesIn "Maryland"; ex:year 1943 . _:person06 ex:name "Ben"; ex:livesIn "Nebraska"; ex:year 1941 . _:person07 ex:name "Bernie"; ex:livesIn "Vermont"; ex:year 1941 . _:person08 ex:name "Bill"; ex:livesIn "Florida"; ex:year 1942 . _:person09 ex:name "Blanche"; ex:livesIn "Arkansas"; ex:year 1960 . _:person10 ex:name "Bob"; ex:livesIn "Utah"; ex:year 1933 . _:person11 ex:name "Bob"; ex:livesIn "Pennsylvania"; ex:year 1960 . _:person12 ex:name "Bob"; ex:livesIn "Tennessee"; ex:year 1952 . _:person13 ex:name "Bob"; ex:livesIn "New Jersey"; ex:year 1954 . _:person14 ex:name "Byron"; ex:livesIn "North Dakota"; ex:year 1942 . _:person15 ex:name "Carl"; ex:livesIn "Michigan"; ex:year 1934 . _:person16 ex:name "Carte"; ex:livesIn "West Virginia"; ex:year 1974 . _:person17 ex:name "Christopher"; ex:livesIn "Connecticut"; ex:year 1944 . _:person18 ex:name "Chuck"; ex:livesIn "Iowa"; ex:year 1933 . _:person19 ex:name "Chuck"; ex:livesIn "New York"; ex:year 1950 . _:person20 ex:name "Claire"; ex:livesIn "Missouri"; ex:year 1953 . _:person21 ex:name "Daniel"; ex:livesIn "Hawaii"; ex:year 1924 . _:person22 ex:name "Daniel"; ex:livesIn "Hawaii"; ex:year 1924 . _:person23 ex:name "David"; ex:livesIn "Louisiana"; ex:year 1961 . _:person24 ex:name "Debbie"; ex:livesIn "Michigan"; ex:year 1950 . _:person25 ex:name "Dianne"; ex:livesIn "California"; ex:year 1933 . _:person26 ex:name "Dick"; ex:livesIn "Illinois"; ex:year 1944 . _:person27 ex:name "Evan"; ex:livesIn "Indiana"; ex:year 1955 . _:person28 ex:name "Frank"; ex:livesIn "New Jersey"; ex:year 1924 . _:person29 ex:name "George"; ex:livesIn "Florida"; ex:year 1969 . _:person30 ex:name "George"; ex:livesIn "Ohio"; ex:year 1936 . _:person31 ex:name "Harry"; ex:livesIn "Nevada"; ex:year 1939 . _:person32 ex:name "Herb"; ex:livesIn "Wisconsin"; ex:year 1935 . _:person33 ex:name "Jack"; ex:livesIn "Rhode Island"; ex:year 1949 . _:person34 ex:name "Jay"; ex:livesIn "West Virginia"; ex:year 1937 . _:person35 ex:name "Jeanne"; ex:livesIn "New Hampshire"; ex:year 1947 . _:person36 ex:name "Jeff"; ex:livesIn "New Mexico"; ex:year 1943 . _:person37 ex:name "Jeff"; ex:livesIn "Oregon"; ex:year 1956 . _:person38 ex:name "Jeff"; ex:livesIn "Alabama"; ex:year 1946 . _:person39 ex:name "Jim"; ex:livesIn "Kentucky"; ex:year 1931 . _:person40 ex:name "Jim"; ex:livesIn "South Carolina"; ex:year 1951 . _:person41 ex:name "Jim"; ex:livesIn "Oklahoma"; ex:year 1934 . _:person42 ex:name "Jim"; ex:livesIn "Idaho"; ex:year 1943 . _:person43 ex:name "Jim"; ex:livesIn "Virginia"; ex:year 1946 . _:person44 ex:name "Joe"; ex:livesIn "Connecticut"; ex:year 1942 . _:person45 ex:name "John"; ex:livesIn "Wyoming"; ex:year 1952 . _:person46 ex:name "John"; ex:livesIn "Texas"; ex:year 1952 . _:person47 ex:name "John"; ex:livesIn "Nevada"; ex:year 1958 . _:person48 ex:name "John"; ex:livesIn "Massachusetts"; ex:year 1943 . _:person49 ex:name "John"; ex:livesIn "Arizona"; ex:year 1936 . _:person50 ex:name "John"; ex:livesIn "South Dakota"; ex:year 1961 . _:person51 ex:name "Johnny"; ex:livesIn "Georgia"; ex:year 1944 . _:person52 ex:name "Jon"; ex:livesIn "Arizona"; ex:year 1942 . _:person53 ex:name "Jon"; ex:livesIn "Montana"; ex:year 1956 . _:person54 ex:name "Judd"; ex:livesIn "New Hampshire"; ex:year 1947 . _:person55 ex:name "Kay"; ex:livesIn "Texas"; ex:year 1943 . _:person56 ex:name "Kay"; ex:livesIn "North Carolina"; ex:year 1953 . _:person57 ex:name "Kent"; ex:livesIn "North Dakota"; ex:year 1948 . _:person58 ex:name "Kirsten"; ex:livesIn "New York"; ex:year 1966 . _:person59 ex:name "Kit"; ex:livesIn "Missouri"; ex:year 1939 . _:person60 ex:name "Lamar"; ex:livesIn "Tennessee"; ex:year 1940 . _:person61 ex:name "Lindsey"; ex:livesIn "South Carolina"; ex:year 1955 . _:person62 ex:name "Lisa"; ex:livesIn "Alaska"; ex:year 1957 . _:person63 ex:name "Maria"; ex:livesIn "Washington"; ex:year 1958 . _:person64 ex:name "Mark"; ex:livesIn "Alaska"; ex:year 1962 . _:person65 ex:name "Mark"; ex:livesIn "Arkansas"; ex:year 1963 . _:person66 ex:name "Mark"; ex:livesIn "Colorado"; ex:year 1950 . _:person67 ex:name "Mark"; ex:livesIn "Virginia"; ex:year 1954 . _:person68 ex:name "Mary"; ex:livesIn "Louisiana"; ex:year 1955 . _:person69 ex:name "Max"; ex:livesIn "Montana"; ex:year 1941 . _:person70 ex:name "Michael"; ex:livesIn "Colorado"; ex:year 1964 . _:person71 ex:name "Mike"; ex:livesIn "Idaho"; ex:year 1951 . _:person72 ex:name "Mike"; ex:livesIn "Wyoming"; ex:year 1944 . _:person73 ex:name "Mike"; ex:livesIn "Nebraska"; ex:year 1950 . _:person74 ex:name "Mitch"; ex:livesIn "Kentucky"; ex:year 1942 . _:person75 ex:name "Olympia"; ex:livesIn "Maine"; ex:year 1947 . _:person76 ex:name "Orrin"; ex:livesIn "Utah"; ex:year 1934 . _:person77 ex:name "Pat"; ex:livesIn "Kansas"; ex:year 1936 . _:person78 ex:name "Patrick"; ex:livesIn "Vermont"; ex:year 1940 . _:person79 ex:name "Patty"; ex:livesIn "Washington"; ex:year 1950 . _:person80 ex:name "Richard"; ex:livesIn "North Carolina"; ex:year 1955 . _:person81 ex:name "Richard"; ex:livesIn "Indiana"; ex:year 1932 . _:person82 ex:name "Richard"; ex:livesIn "Alabama"; ex:year 1934 . _:person83 ex:name "Roger"; ex:livesIn "Mississippi"; ex:year 1951 . _:person84 ex:name "Roland"; ex:livesIn "Illinois"; ex:year 1937 . _:person85 ex:name "Ron"; ex:livesIn "Oregon"; ex:year 1949 . _:person86 ex:name "Russ"; ex:livesIn "Wisconsin"; ex:year 1953 . _:person87 ex:name "Sam"; ex:livesIn "Kansas"; ex:year 1956 . _:person88 ex:name "Saxby"; ex:livesIn "Georgia"; ex:year 1943 . _:person89 ex:name "Scott"; ex:livesIn "Massachusetts"; ex:year 1959 . _:person90 ex:name "Sheldon"; ex:livesIn "Rhode Island"; ex:year 1955 . _:person91 ex:name "Sherrod"; ex:livesIn "Ohio"; ex:year 1952 . _:person92 ex:name "Susan"; ex:livesIn "Maine"; ex:year 1952 . _:person93 ex:name "Ted"; ex:livesIn "Delaware"; ex:year 1939 . _:person94 ex:name "Thad"; ex:livesIn "Mississippi"; ex:year 1937 . _:person95 ex:name "Tim"; ex:livesIn "South Dakota"; ex:year 1946 . _:person96 ex:name "Tom"; ex:livesIn "Delaware"; ex:year 1947 . _:person97 ex:name "Tom"; ex:livesIn "Oklahoma"; ex:year 1948 . _:person98 ex:name "Tom"; ex:livesIn "Iowa"; ex:year 1939 . _:person99 ex:name "Tom"; ex:livesIn "New Mexico"; ex:year 1948 . rasqal-0.9.33/tests/sparql/aggregate/group-concat-2.ttl0000644000175000017500000004234011470576400017700 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "state" ; rs:resultVariable "residents" ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alabama" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alaska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Lisa Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arizona" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Jon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arkansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Blanche Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "California" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara Dianne" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Colorado" ] ; rs:binding [ rs:variable "residents" ; rs:value "Mark Michael" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Connecticut" ] ; rs:binding [ rs:variable "residents" ; rs:value "Christopher Joe" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Delaware" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ted Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Florida" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bill George" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Georgia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Johnny Saxby" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Hawaii" ] ; rs:binding [ rs:variable "residents" ; rs:value "Daniel Daniel" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Idaho" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mike" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Illinois" ] ; rs:binding [ rs:variable "residents" ; rs:value "Dick Roland" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Indiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Evan Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Iowa" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Pat Sam" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kentucky" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mitch" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Louisiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "David Mary" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maine" ] ; rs:binding [ rs:variable "residents" ; rs:value "Olympia Susan" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maryland" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara Ben" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Massachusetts" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Scott" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Michigan" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carl Debbie" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Minnesota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Al Amy" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Mississippi" ] ; rs:binding [ rs:variable "residents" ; rs:value "Roger Thad" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Missouri" ] ; rs:binding [ rs:variable "residents" ; rs:value "Claire Kit" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Montana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jon Max" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nebraska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ben Mike" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nevada" ] ; rs:binding [ rs:variable "residents" ; rs:value "Harry John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Hampshire" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeanne Judd" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Jersey" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Frank" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Mexico" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New York" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck Kirsten" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Kay Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Byron Kent" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Ohio" ] ; rs:binding [ rs:variable "residents" ; rs:value "George Sherrod" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oklahoma" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oregon" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Ron" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Pennsylvania" ] ; rs:binding [ rs:variable "residents" ; rs:value "Arlen Bob" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Rhode Island" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jack Sheldon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Lindsey" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Tim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Tennessee" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Lamar" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Texas" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Kay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Utah" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Orrin" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Vermont" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bernie Patrick" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Washington" ] ; rs:binding [ rs:variable "residents" ; rs:value "Maria Patty" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "West Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carte Jay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wisconsin" ] ; rs:binding [ rs:variable "residents" ; rs:value "Herb Russ" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wyoming" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Mike" ] ] . rasqal-0.9.33/tests/sparql/aggregate/agg-2.rq0000644000175000017500000000031511423502022015633 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-query-20100601/#aggregate-mapping PREFIX rdf: SELECT (SUM(?val) AS ?sum) WHERE { ?a rdf:value ?val . } GROUP BY ?a rasqal-0.9.33/tests/sparql/aggregate/manifest.n30000644000175000017500000000341611476100736016465 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "SPARQL 1.1 Aggregation test cases" ; mf:entries ( [ mf:name "Aggregate 1 - SUM with GROUP BY and HAVING" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Aggregate 2 - SUM" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Aggregate 3 - SAMPLE and GROUP BY" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Group Concat 1 - Newline separator" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Group Concat 2 - default separator" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Group Concat 3 - HAVING" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Group Concat 4 - DISTINCT" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ). rasqal-0.9.33/tests/sparql/aggregate/data-1.ttl0000644000175000017500000000040711423502022016170 00000000000000@prefix : . :org1 :affiliates :auth1, :auth2 . :auth1 :writesBook :book1, :book2 . :book1 :price 9 . :book2 :price 5 . :auth2 :writesBook :book3 . :book3 :price 7 . :org2 :affiliates :auth3 . :auth3 :writesBook :book4 . :book4 :price 7 . rasqal-0.9.33/tests/sparql/aggregate/group-concat-4.rq0000644000175000017500000000043511476100736017521 00000000000000# Test GROUP_CONCAT() with DISTINCT and default separator PREFIX ex: # Pick unique names per state; Hawaii has two Daniels SELECT ?state (GROUP_CONCAT(DISTINCT ?name) AS ?residents) WHERE { ?person ex:name ?name . ?person ex:livesIn ?state } GROUP BY ?state rasqal-0.9.33/tests/sparql/aggregate/agg-3.ttl0000644000175000017500000004171111470576400016037 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "state" ; rs:resultVariable "residents" ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alabama" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alaska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Lisa" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arizona" ] ; rs:binding [ rs:variable "residents" ; rs:value "John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arkansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Blanche" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "California" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Colorado" ] ; rs:binding [ rs:variable "residents" ; rs:value "Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Connecticut" ] ; rs:binding [ rs:variable "residents" ; rs:value "Christopher" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Delaware" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ted" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Florida" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bill" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Georgia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Johnny" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Hawaii" ] ; rs:binding [ rs:variable "residents" ; rs:value "Daniel" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Idaho" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Illinois" ] ; rs:binding [ rs:variable "residents" ; rs:value "Dick" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Indiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Evan" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Iowa" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Pat" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kentucky" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Louisiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "David" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maine" ] ; rs:binding [ rs:variable "residents" ; rs:value "Olympia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maryland" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Massachusetts" ] ; rs:binding [ rs:variable "residents" ; rs:value "John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Michigan" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carl" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Minnesota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Al" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Mississippi" ] ; rs:binding [ rs:variable "residents" ; rs:value "Roger" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Missouri" ] ; rs:binding [ rs:variable "residents" ; rs:value "Claire" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Montana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nebraska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ben" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nevada" ] ; rs:binding [ rs:variable "residents" ; rs:value "Harry" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Hampshire" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeanne" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Jersey" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Mexico" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New York" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Kay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Byron" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Ohio" ] ; rs:binding [ rs:variable "residents" ; rs:value "George" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oklahoma" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oregon" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Pennsylvania" ] ; rs:binding [ rs:variable "residents" ; rs:value "Arlen" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Rhode Island" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jack" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Tennessee" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Texas" ] ; rs:binding [ rs:variable "residents" ; rs:value "John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Utah" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Vermont" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bernie" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Washington" ] ; rs:binding [ rs:variable "residents" ; rs:value "Maria" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "West Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carte" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wisconsin" ] ; rs:binding [ rs:variable "residents" ; rs:value "Herb" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wyoming" ] ; rs:binding [ rs:variable "residents" ; rs:value "John" ] ] . rasqal-0.9.33/tests/sparql/aggregate/group-concat-3.ttl0000644000175000017500000004116511471421333017700 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "state" ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alabama" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alabama" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alaska" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alaska" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arizona" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arizona" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arkansas" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arkansas" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Colorado" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Colorado" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Connecticut" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Connecticut" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Delaware" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Delaware" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Georgia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Georgia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Hawaii" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Hawaii" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Idaho" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Idaho" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Illinois" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Illinois" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Indiana" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Indiana" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Iowa" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Iowa" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kansas" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kansas" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kentucky" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kentucky" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Louisiana" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Louisiana" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maine" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maine" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maryland" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maryland" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Massachusetts" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Massachusetts" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Michigan" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Michigan" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Minnesota" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Minnesota" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Mississippi" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Mississippi" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Missouri" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Missouri" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Montana" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Montana" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nebraska" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nebraska" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nevada" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nevada" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Hampshire" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Hampshire" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Jersey" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Jersey" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Mexico" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Mexico" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New York" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New York" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Carolina" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Carolina" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Dakota" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Dakota" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Ohio" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Ohio" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oklahoma" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oklahoma" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oregon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oregon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Pennsylvania" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Pennsylvania" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Rhode Island" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Rhode Island" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Carolina" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Carolina" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Dakota" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Dakota" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Tennessee" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Tennessee" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Texas" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Texas" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Utah" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Utah" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Vermont" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Vermont" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Virginia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Virginia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Washington" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Washington" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "West Virginia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "West Virginia" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wisconsin" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wisconsin" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wyoming" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wyoming" ] ] . rasqal-0.9.33/tests/sparql/aggregate/agg-1.rq0000644000175000017500000000042411423502022015633 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-query-20100601/#aggregateExample PREFIX : SELECT (SUM(?lprice) AS ?totalPrice) WHERE { ?org :affiliates ?auth . ?auth :writesBook ?book . ?book :price ?lprice . } GROUP BY ?org HAVING (SUM(?lprice) > 10) rasqal-0.9.33/tests/sparql/aggregate/bad-1.rq0000644000175000017500000000002011521046600015617 00000000000000SELECT GROUP BY rasqal-0.9.33/tests/sparql/aggregate/agg-3.rq0000644000175000017500000000030011463646673015657 00000000000000# Test GROUP BY PREFIX ex: SELECT ?state (SAMPLE(?name) AS ?residents) FROM WHERE { ?person ex:name ?name . ?person ex:livesIn ?state } GROUP BY ?state rasqal-0.9.33/tests/sparql/aggregate/group-concat-4.ttl0000644000175000017500000004233111476100736017703 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "state" ; rs:resultVariable "residents" ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alabama" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Alaska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Lisa Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arizona" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Jon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Arkansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Blanche Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "California" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara Dianne" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Colorado" ] ; rs:binding [ rs:variable "residents" ; rs:value "Mark Michael" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Connecticut" ] ; rs:binding [ rs:variable "residents" ; rs:value "Christopher Joe" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Delaware" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ted Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Florida" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bill George" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Georgia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Johnny Saxby" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Hawaii" ] ; rs:binding [ rs:variable "residents" ; rs:value "Daniel" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Idaho" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mike" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Illinois" ] ; rs:binding [ rs:variable "residents" ; rs:value "Dick Roland" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Indiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Evan Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Iowa" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kansas" ] ; rs:binding [ rs:variable "residents" ; rs:value "Pat Sam" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Kentucky" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mitch" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Louisiana" ] ; rs:binding [ rs:variable "residents" ; rs:value "David Mary" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maine" ] ; rs:binding [ rs:variable "residents" ; rs:value "Olympia Susan" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Maryland" ] ; rs:binding [ rs:variable "residents" ; rs:value "Barbara Ben" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Massachusetts" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Scott" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Michigan" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carl Debbie" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Minnesota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Al Amy" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Mississippi" ] ; rs:binding [ rs:variable "residents" ; rs:value "Roger Thad" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Missouri" ] ; rs:binding [ rs:variable "residents" ; rs:value "Claire Kit" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Montana" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jon Max" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nebraska" ] ; rs:binding [ rs:variable "residents" ; rs:value "Ben Mike" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Nevada" ] ; rs:binding [ rs:variable "residents" ; rs:value "Harry John" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Hampshire" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeanne Judd" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Jersey" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Frank" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New Mexico" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "New York" ] ; rs:binding [ rs:variable "residents" ; rs:value "Chuck Kirsten" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Kay Richard" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "North Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "Byron Kent" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Ohio" ] ; rs:binding [ rs:variable "residents" ; rs:value "George Sherrod" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oklahoma" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Tom" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Oregon" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jeff Ron" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Pennsylvania" ] ; rs:binding [ rs:variable "residents" ; rs:value "Arlen Bob" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Rhode Island" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jack Sheldon" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Carolina" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Lindsey" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "South Dakota" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Tim" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Tennessee" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Lamar" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Texas" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Kay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Utah" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bob Orrin" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Vermont" ] ; rs:binding [ rs:variable "residents" ; rs:value "Bernie Patrick" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Jim Mark" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Washington" ] ; rs:binding [ rs:variable "residents" ; rs:value "Maria Patty" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "West Virginia" ] ; rs:binding [ rs:variable "residents" ; rs:value "Carte Jay" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wisconsin" ] ; rs:binding [ rs:variable "residents" ; rs:value "Herb Russ" ] ] ; rs:solution [ rs:binding [ rs:variable "state" ; rs:value "Wyoming" ] ; rs:binding [ rs:variable "residents" ; rs:value "John Mike" ] ] . rasqal-0.9.33/tests/sparql/aggregate/group-concat-1.rq0000644000175000017500000000033411434023730017504 00000000000000# Test GROUP_CONCAT() with SEPARATOR PREFIX ex: SELECT ?state (GROUP_CONCAT(?name ; SEPARATOR = '\n') AS ?residents) WHERE { ?person ex:name ?name . ?person ex:livesIn ?state } GROUP BY ?state rasqal-0.9.33/tests/sparql/aggregate/agg-1.ttl0000644000175000017500000000075111471421333016027 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "totalPrice" ; rs:solution [ rs:binding [ rs:variable "totalPrice" ; rs:value "21"^^ ] ] . rasqal-0.9.33/tests/sparql/Expr2/0000755000175000017500000000000012443715252013543 500000000000000rasqal-0.9.33/tests/sparql/Expr2/Makefile.am0000644000175000017500000001010212302411034015472 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax SPARQL tests # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data-1.ttl data-2.ttl SPARQL_TEST_FILES= \ query-bev-1.rq query-bev-2.rq query-bev-3.rq \ query-bev-4.rq query-bev-5.rq query-bev-6.rq SPARQL_TEST_NAMES= \ "Test 'boolean effective value' - true" \ "Test 'boolean effective value' - false" \ "Test 'boolean effective value' - &&" \ "Test 'boolean effective value' - ||" \ "Test 'boolean effective value' - optional" \ "Test 'boolean effective value' - unknown types" EXPECTED_SPARQL_CORRECT= $(SPARQL_TEST_NAMES) EXPECTED_SPARQL_CORRECT_FAILURES= SPARQL_RESULT_FILES= \ result-bev-1.ttl result-bev-2.ttl result-bev-3.ttl \ result-bev-4.ttl result-bev-5.ttl result-bev-6.ttl EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/Expr2/Makefile.in0000644000175000017500000004013112434455633015533 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax SPARQL tests # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/Expr2 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data-1.ttl data-2.ttl SPARQL_TEST_FILES = \ query-bev-1.rq query-bev-2.rq query-bev-3.rq \ query-bev-4.rq query-bev-5.rq query-bev-6.rq SPARQL_TEST_NAMES = \ "Test 'boolean effective value' - true" \ "Test 'boolean effective value' - false" \ "Test 'boolean effective value' - &&" \ "Test 'boolean effective value' - ||" \ "Test 'boolean effective value' - optional" \ "Test 'boolean effective value' - unknown types" EXPECTED_SPARQL_CORRECT = $(SPARQL_TEST_NAMES) EXPECTED_SPARQL_CORRECT_FAILURES = SPARQL_RESULT_FILES = \ result-bev-1.ttl result-bev-2.ttl result-bev-3.ttl \ result-bev-4.ttl result-bev-5.ttl result-bev-6.ttl EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/Expr2/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/Expr2/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/Expr2/query-bev-4.rq0000644000175000017500000000025110362621550016100 00000000000000PREFIX xsd: PREFIX : SELECT ?a WHERE { ?a :p ?v . FILTER ("false"^^xsd:boolean || ?v) . } rasqal-0.9.33/tests/sparql/Expr2/data-2.ttl0000644000175000017500000000073410362621550015257 00000000000000@prefix : . @prefix xsd: . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean . # Optionals :x1 :q "true"^^xsd:boolean . :x2 :q "false"^^xsd:boolean . :x3 :q "foo"^^:unknown . rasqal-0.9.33/tests/sparql/Expr2/result-bev-4.ttl0000644000175000017500000000176510362621550016445 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "a" ; rs:solution [ rs:binding [ rs:value :x1 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x2 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x4 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x3 ; rs:variable "a" ] ] . rasqal-0.9.33/tests/sparql/Expr2/result-bev-1.ttl0000644000175000017500000000176510362621550016442 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "a" ; rs:solution [ rs:binding [ rs:value :x4 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x1 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x3 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x2 ; rs:variable "a" ] ] . rasqal-0.9.33/tests/sparql/Expr2/result-bev-6.ttl0000644000175000017500000000123510362621550016437 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "w" ; rs:resultVariable "a" ; rs:solution [ rs:binding [ rs:value :x2 ; rs:variable "a" ] ; rs:binding [ rs:value "false"^^xsd:boolean ; rs:variable "w" ] ] . rasqal-0.9.33/tests/sparql/Expr2/query-bev-5.rq0000644000175000017500000000027010362621550016102 00000000000000PREFIX xsd: PREFIX : SELECT ?a WHERE { ?a :p ?v . OPTIONAL { ?a :q ?w } . FILTER (?w) . } rasqal-0.9.33/tests/sparql/Expr2/manifest.n30000644000175000017500000000316710362621550015535 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Test of boolean expressions" ; mf:entries ( [ mf:name "Test 'boolean effective value' - true" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Test 'boolean effective value' - false" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Test 'boolean effective value' - &&" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Test 'boolean effective value' - ||" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Test 'boolean effective value' - optional" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Test 'boolean effective value' - unknown types" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ). rasqal-0.9.33/tests/sparql/Expr2/query-bev-1.rq0000644000175000017500000000022110362621550016072 00000000000000PREFIX xsd: PREFIX : SELECT ?a WHERE { ?a :p ?v . FILTER (?v) . } rasqal-0.9.33/tests/sparql/Expr2/query-bev-3.rq0000644000175000017500000000025010362621550016076 00000000000000PREFIX xsd: PREFIX : SELECT ?a WHERE { ?a :p ?v . FILTER ("true"^^xsd:boolean && ?v) . } rasqal-0.9.33/tests/sparql/Expr2/data-1.ttl0000644000175000017500000000056210362621550015255 00000000000000@prefix : . @prefix xsd: . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean . rasqal-0.9.33/tests/sparql/Expr2/result-bev-3.ttl0000644000175000017500000000176510362621550016444 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "a" ; rs:solution [ rs:binding [ rs:value :x4 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x1 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x3 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :x2 ; rs:variable "a" ] ] . rasqal-0.9.33/tests/sparql/Expr2/query-bev-2.rq0000644000175000017500000000022510362621550016077 00000000000000PREFIX xsd: PREFIX : SELECT ?a WHERE { ?a :p ?v . FILTER ( ! ?v ) . } rasqal-0.9.33/tests/sparql/Expr2/result-bev-5.ttl0000644000175000017500000000074210362621550016440 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "a" ; rs:solution [ rs:binding [ rs:value :x1 ; rs:variable "a" ] ] . rasqal-0.9.33/tests/sparql/Expr2/query-bev-6.rq0000644000175000017500000000027710362621550016112 00000000000000PREFIX xsd: PREFIX : SELECT ?a ?w WHERE { ?a :p ?v . OPTIONAL { ?a :q ?w } . FILTER ( ! ?w ) . } rasqal-0.9.33/tests/sparql/Expr2/result-bev-2.ttl0000644000175000017500000000176510362621550016443 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "a" ; rs:solution [ rs:binding [ rs:value :y2 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :y4 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :y3 ; rs:variable "a" ] ] ; rs:solution [ rs:binding [ rs:value :y1 ; rs:variable "a" ] ] . rasqal-0.9.33/tests/sparql/Makefile.am0000644000175000017500000000337011602004306014505 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # SUBDIRS=simple part1 examples bound syntax survey SyntaxFull sort \ ValueTesting \ regex Expr1 Expr2 ExprBuiltins ExprEquals \ SyntaxDev \ update \ bugs \ aggregate \ sparql11 \ federated \ warnings EXTRA_DIST=check-sparql check-sparql-lexer: check-sparql-lexer-recursive check-sparql-parser: check-sparql-parser-recursive check-sparql-correct: check-sparql-correct-recursive check-sparql-lexer-recursive check-sparql-parser-recursive check-sparql-correct-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" != "."; then \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target ) \ || eval $$failcom; \ fi; \ done; \ test -z "$$fail" rasqal-0.9.33/tests/sparql/federated/0000755000175000017500000000000012443715253014467 500000000000000rasqal-0.9.33/tests/sparql/federated/data-4.ttl0000644000175000017500000000077711456455424016225 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2.1 # Data in default graph at service: http://GABBR1.example/SPARQL @prefix iuphar: . @prefix entrez: . _:GABBR1 iuphar:code "2.3:GABA:1:GABAB1:" . _:GABBR1 iuphar:ligand "GABA" . _:GABBR1 iuphar:species entrez:h2550 . entrez:h2550 iuphar:name "GABBR1" . entrez:h2550 entrez:id 2550 . rasqal-0.9.33/tests/sparql/federated/service-1.rq0000644000175000017500000000144511456455424016561 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2 PREFIX iuphar: PREFIX entrez: PREFIX med: PREFIX study: SELECT ?med ?species ?iuphar WHERE { SERVICE { ?receptor iuphar:ligand "GABA" . ?receptor iuphar:species ?species . ?species iuphar:name ?iuphar . ?species entrez:id ?id . } SERVICE { ?study entrez:id ?id . ?study study:species ?species . ?study med:ication ?med . ?study study:change ?change . FILTER (?change < -.2) } } rasqal-0.9.33/tests/sparql/federated/Makefile.am0000644000175000017500000000437312350617062016446 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL Federated Query tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= \ data-1.ttl \ data-2.ttl \ data-3.ttl \ data-4.ttl \ data-5.ttl EXPECTED_SPARQL_CORRECT= \ bindings-1.rq \ bindings-2.rq \ bindings-3.rq \ service-1.rq \ service-2.rq EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(EXPECTED_SPARQL_CORRECT) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Federated queries legal parsing\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/federated/Makefile.in0000644000175000017500000003435012434455633016464 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL Federated Query tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/federated DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = \ data-1.ttl \ data-2.ttl \ data-3.ttl \ data-4.ttl \ data-5.ttl EXPECTED_SPARQL_CORRECT = \ bindings-1.rq \ bindings-2.rq \ bindings-3.rq \ service-1.rq \ service-2.rq EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(EXPECTED_SPARQL_CORRECT) all: all-am .SUFFIXES: $(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 tests/sparql/federated/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/federated/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Federated queries legal parsing\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/federated/bindings-2.rq0000644000175000017500000000022112134607457016705 00000000000000# Just construct a result table here SELECT * WHERE { } VALUES (?a ?b ?c) { (UNDEF "b1" "c1") ("a1" UNDEF "c2") ("a2" "b2" UNDEF ) } rasqal-0.9.33/tests/sparql/federated/data-5.ttl0000644000175000017500000000077611456455424016225 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2.1 # Data in default graph at service: http://GABBR2.example/SPARQL @prefix iuphar: . @prefix entrez: . _:GABBR2 iuphar:code "2.3:GABA:1:GABAB2:" . _:GABBR2 iuphar:ligand "GABA" . _:GABBR2 iuphar:species entrez:h9568 . entrez:h9568 iuphar:name "GABBR2" . entrez:h9568 entrez:id 9568 . rasqal-0.9.33/tests/sparql/federated/data-2.ttl0000644000175000017500000000106611456455424016213 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2 # Data in default graph at service: http://study.example/analyzed @prefix med: . @prefix entrez: . @prefix study: . _:study9 entrez:id 2550 . _:study9 med:ication "Illudium Phosdex" _:study9 study:change -.23 . _:study10 entrez:id 2986 . _:study10 med:ication "Illudium Phosdex" _:study10 study:change +.38 . rasqal-0.9.33/tests/sparql/federated/manifest.ttl0000644000175000017500000000241712350617062016742 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . <> a mf:Manifest ; rdfs:comment "SPARQL 1.1 Federated queries parsing" ; mf:entries ([ a mf:PositiveUpdateSyntaxTest11 ; rdfs:comment "sparql parsing of bindings-1.rq" ; mf:action ; mf:name "bindings-1.rq" ] [ a mf:PositiveUpdateSyntaxTest11 ; rdfs:comment "sparql parsing of bindings-2.rq" ; mf:action ; mf:name "bindings-2.rq" ] [ a mf:PositiveUpdateSyntaxTest11 ; rdfs:comment "sparql parsing of bindings-3.rq" ; mf:action ; mf:name "bindings-3.rq" ] [ a mf:PositiveUpdateSyntaxTest11 ; rdfs:comment "sparql parsing of service-1.rq" ; mf:action ; mf:name "service-1.rq" ] [ a mf:PositiveUpdateSyntaxTest11 ; rdfs:comment "sparql parsing of service-2.rq" ; mf:action ; mf:name "service-2.rq" ] ) . rasqal-0.9.33/tests/sparql/federated/bindings-1.rq0000644000175000017500000000110012134607457016701 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 3 PREFIX entrez: PREFIX med: PREFIX study: SELECT ?med ?species ?iuphar WHERE { ?study entrez:id ?id . ?study study:species ?species . ?study med:ication ?med . ?study study:change ?change . FILTER (?change < -.2) } VALUES ( ?species ?iuphar ?id ) { ("human" "GABBR1" "2550") ("human" "GABBR2" "9568") } rasqal-0.9.33/tests/sparql/federated/data-1.ttl0000644000175000017500000000125011456455424016205 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2 # Data in default graph at service: http://bio.example/receptors @prefix iuphar: . @prefix entrez: . _:GABBR1 iuphar:code "2.3:GABA:1:GABAB1:" . _:GABBR1 iuphar:ligand "GABA" . _:GABBR1 iuphar:species _:h2550 . _:h2550 iuphar:name "GABBR1" . _:h2550 entrez:id 2550 . _:GABBR2 iuphar:code "2.3:GABA:1:GABAB2:" . _:GABBR2 iuphar:ligand "GABA" . _:GABBR2 iuphar:species _:h9568 . _:h9568 iuphar:name "GABBR2" . _:h9568 entrez:id 9568 . rasqal-0.9.33/tests/sparql/federated/bindings-3.rq0000644000175000017500000000007712134607457016717 00000000000000# Most useless binding query SELECT * WHERE { } VALUES ?a { } rasqal-0.9.33/tests/sparql/federated/data-3.ttl0000644000175000017500000000104511456455424016211 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2.1 # Default graph @prefix void: . @prefix dcterms: . @prefix entrez: <http://entrez.example/ns#> . [] dcterms:subject entrez:h2550 ; void:sparqlEndpoint [] dcterms:subject entrez:h9568 ; void:sparqlEndpoint [] dcterms:subject entrez:h33248 . void:sparqlEndpoint # ... rasqal-0.9.33/tests/sparql/federated/service-2.rq0000644000175000017500000000127311456455424016561 00000000000000# http://www.w3.org/2009/sparql/docs/fed/service # Revision 1.13 2010/08/06 12:06:52 aseaborne # Section 2 PREFIX iuphar: PREFIX entrez: PREFIX void: PREFIX dcterms: SELECT ?service ?id ?iuphar WHERE { # Find the service with the expertise. [] dcterms:subject ?gene ; void:sparqlEndpoint ?service FILTER (?gene = entrez:h2550 || ?gene = entrez:h9568) # Query that service for species and iuphar. SERVICE ?service { ?receptor iuphar:species ?species . ?species iuphar:name ?iuphar . ?species entrez:id ?id . } } rasqal-0.9.33/tests/sparql/Makefile.in0000644000175000017500000005121612434455633014541 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SUBDIRS = simple part1 examples bound syntax survey SyntaxFull sort \ ValueTesting \ regex Expr1 Expr2 ExprBuiltins ExprEquals \ SyntaxDev \ update \ bugs \ aggregate \ sparql11 \ federated \ warnings EXTRA_DIST = check-sparql all: all-recursive .SUFFIXES: $(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 tests/sparql/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: 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-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am check-sparql-lexer: check-sparql-lexer-recursive check-sparql-parser: check-sparql-parser-recursive check-sparql-correct: check-sparql-correct-recursive check-sparql-lexer-recursive check-sparql-parser-recursive check-sparql-correct-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" != "."; then \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target ) \ || eval $$failcom; \ fi; \ done; \ test -z "$$fail" # 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: rasqal-0.9.33/tests/sparql/check-sparql0000755000175000017500000007034612311460057014772 00000000000000#!/usr/bin/perl -w # # check-sparql - Run Rasqal against W3C SPARQL testsuites # # USAGE: check-sparql [options] [TEST] # # Copyright (C) 2004-2014, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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: # roqet (from rasqal) compiled in the parent directory # # Depends on a variety of rasqal internal debug print formats # use strict; use File::Basename; use Getopt::Long; use Pod::Usage; use Cwd; use POSIX qw(WIFSIGNALED WIFEXITED WTERMSIG WEXITSTATUS); # We really want WCOREDUMP too sub WCOREDUMP($) { return $_[0] & 0200; } my $CURDIR = getcwd; sub get_utils_dir() { my $dir = $CURDIR; while($dir ne '' && ! -d "$dir/utils") { $dir =~ s{/[^/]+$}{}; } if($dir eq '') { die "$0: Could not find 'utils' dir in parent directories\n"; } $dir . "/utils"; } our $UTILS_DIR = get_utils_dir(); our $TO_NTRIPLES = $ENV{TO_NTRIPLES} || $UTILS_DIR. '/to-ntriples'; our $ROQET = $ENV{ROQET} || $UTILS_DIR . '/roqet'; my $rasqal_url="http://librdf.org/rasqal/"; my $diff_cmd=$ENV{DIFF} || "diff"; my $rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'; my $rs='http://www.w3.org/2001/sw/DataAccess/tests/result-set#'; my $resultVariable_predicate="<${rs}resultVariable>"; my $variable_predicate="<${rs}variable>"; my $value_predicate="<${rs}value>"; my $binding_predicate="<${rs}binding>"; my $solution_predicate="<${rs}solution>"; my $index_predicate="<${rs}index>"; my(@manifest_files)=qw(manifest.ttl manifest.n3); my $mf='http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#'; my $mfx='http://jena.hpl.hp.com/2005/05/test-manifest-extra#'; my $qt='http://www.w3.org/2001/sw/DataAccess/tests/test-query#'; my $dawgt='http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#'; my $ut='http://www.w3.org/2009/sparql/tests/test-update#'; my $sd='http://www.w3.org/ns/sparql-service-description#'; my $ent='http://www.w3.org/ns/entailment/'; my $program=basename $0; my $debug=0; my $srcdir='.'; $debug=1 if defined $ENV{'RASQAL_DEBUG'}; # Temporary file names our $roqet_out = "roqet.out"; our $result_out = "result.out"; our $roqet_tmp = 'roqet.tmp'; our $roqet_err = 'roqet.err'; our $diff_out = 'diff.out'; our $to_ntriples_err = 'to_ntriples.err'; # plural('result', 's', 2); sub plural($$$) { my($word,$multiple,$count)=@_; return ($count == 1) ? $count." ".$word : $count." ".$word.$multiple; } sub toDebug($) { my $str=shift; return undef if !defined $str; return "NULL" if $str eq "<${rs}undefined>"; return $str if $str =~ s/^("[^"]*")(@.*)(\^\^<.*>)$/string($1$2$3)/; return $str if $str =~ s/^("[^"]*"\^\^<.*>)$/string($1)/; return $str if $str =~ s/^("[^"]*"@.*)$/string($1)/; return $str if $str =~ s/^("[^"]*")$/string($1)/; return $str if $str =~ s/^(<.*>)$/uri$1/; #return $str if $str =~ s/^_:(.*)$/blank $1/; return $str if $str =~ s/^_:(.*)$/blank _/; return qq{string("$str")}; } sub read_query_results_file($$) { my($result_file,$results_input_format)=@_; my(%results)=(rows => []); my $cmd="$ROQET -q -R $results_input_format -r simple -t '$result_file'"; warn "$program: (read_query_results_file): Running $cmd\n" if $debug; open(PIPE, "$cmd 2>'$roqet_err' |"); my(@vars)=(); while() { chomp; next unless /^row: \[(.*)\]$/; my(@row_vars)=(); my(@values)=(); for my $col (split(/, /, $1)) { my($var,$val)=split(/=/, $col, 2); push(@row_vars, $var); push(@values, $val); } if(!@vars) { @vars = @row_vars; warn "$program: results variables are @vars\n" if $debug; } my($row) = {}; for my $i (0..$#vars) { my($variable) = $vars[$i]; my $value = $values[$i]; $value =~ s/blank \w+/blank _/; $row->{$variable} = $value; warn "$variable : ".(defined $value ? $value : "(undefined)")."\n" if $debug; } push(@{$results{rows}}, $row); } close(PIPE); return \%results; } sub read_rdf_graph_file($$) { my($result_file, $base_uri)=@_; my $cmd="$TO_NTRIPLES '$result_file' '$base_uri'"; warn "$program: (read_rdf_graph_file): Running $cmd\n" if $debug; my $result_string=''; open(PIPE, "$cmd 2>'$to_ntriples_err' |"); while() { $result_string .= $_; } close(PIPE); open(ERR, "<", $to_ntriples_err) or die "$program: Cannot open $to_ntriples_err - $!\n"; my(@errs)=(); while() { chomp; push(@errs, "$result_file: $1") if m{to-ntriples: Error - (.*)$}; } close(ERR); if(@errs) { warn "$program: parsing RDF graph result file '$result_file' FAILED - to_ntriples returned errors:\n ".join("\n ",@errs)."\n"; warn "Failing program was:\n"; warn " $cmd\n"; my $r=$cmd; $r =~ s,file:[^ ]+/,,g; $r =~ s,$CURDIR/,,g; warn " OR $r\n"; return undef; } unlink $to_ntriples_err; my(%results)=(graph_ntriples => $result_string); return \%results; } sub compare_rdf_graphs($$$) { my($file1, $file2, $out)=@_; my $cmd; my $rc; my $errors; if(defined $ENV{NTC}) { my $ntc = $ENV{NTC}; $cmd="$ntc '$file1' '$file2' >'$out' 2>&1"; $rc = system($cmd); } elsif(defined $ENV{JENAROOT}) { my $j = $ENV{JENAROOT}; my $classpath=join(':',glob("$j/lib/*jar")); $cmd = qq{java -cp $classpath jena.rdfcompare '$file1' '$file2' N-TRIPLE N-TRIPLE >'$out'}; $rc = system($cmd); if($rc) { $cmd = "$diff_cmd -u '$file1' '$file2' >'$out'"; system($cmd); } } else { $cmd = "$diff_cmd -u '$file1' '$file2' >'$out'"; $rc = system($cmd); } return $rc; } sub defined_or_NULL($) { return defined($_[0]) ? $_[0] : 'NULL'; } sub slurp_file($) { my $file=shift; return do { local $/ = undef; open my $fh, "<", $file or die "$program: Could not read $file - $!\n"; <$fh>; } } sub cat_file($) { my $file=shift; my $fh; open $fh, "<", $file or die "$program: Could not read $file - $!\n"; print <$fh>; } sub yesno($) { $_[0] ? "yes" : "no"; } sub run_test { my($config)=@_; my($name,$dir,$test_file,$result_file,$expect,$language, $warning_level,$cardinality_mode) = ($config->{name}, $config->{dir}, $config->{test_file}, $config->{result_file}, $config->{expect}, $config->{language}, $config->{warning_level}, $config->{cardinality_mode}); my($test_uri)=$config->{test_uri}; my(@data_files)=@{$config->{data_files}}; my(@named_data_files)=@{$config->{named_data_files}}; my $test_type = $config->{test_type}; my $execute = $config->{execute}; # Make sure we don't use any more config $config = undef; $language ||= 'sparql'; my $test_result = { 'name' => $name, 'uri' => $test_uri, }; $name ||= $test_uri; warn "run_test(\n name : $name\n dir : $dir\n language : $language\n query : $test_file\n data : ",join("; ",@data_files),"\n named data : ",join("; ",@named_data_files),"\n result : ",($result_file||"none"),"\n expect : $expect\n card mode : $cardinality_mode\n execute : ".yesno($execute).")\n" if $debug; my(@args)=(); push(@args, "-i", $language); # http://www.w3.org/2009/sparql/docs/tests/README.html#csvtests if(defined $test_type && $test_type eq "${mf}CSVResultFormatTest") { push(@args, "-r", "csv"); } else { push(@args, "-d", "debug"); } push(@args, "-W", $warning_level); for my $df (@data_files) { $df =~ s,^$CURDIR/,,; push(@args, "-D", $df); } for my $ndf (@named_data_files) { $ndf =~ s,^$CURDIR/,,; push(@args, "-G", $ndf); } push(@args, "-n") unless $execute; my $tf = $test_file; $tf =~ s,^$CURDIR/,,; my $args_s = join(" ",@args); my $roqet_cmd="$ROQET $args_s '$tf' 2>'$roqet_err' >'$roqet_tmp'"; my $sort="sort"; warn "$program: Running $roqet_cmd\n" if $debug; my $start_time = time; system($roqet_cmd); my $end_time = time; my $rc = $?; my $core_dumped = WCOREDUMP($rc); $test_result->{'elapsed-time'}= $end_time - $start_time; $test_result->{'roqet-status-code'}= WIFEXITED($rc) ? WEXITSTATUS($rc) : undef; $test_result->{'stdout'} = slurp_file($roqet_tmp); $test_result->{'stderr'} = slurp_file($roqet_err); $test_result->{'query'}=$roqet_cmd; if(WIFSIGNALED($rc)) { # exec()ed but died on a signal my $signal = WTERMSIG($rc); $rc = "died with signal $signal"; } elsif(WIFEXITED($rc)) { $rc = WEXITSTATUS($rc); if($rc) { # exec()ed and exited with non-0 $rc = "exited with status $rc"; } } else { $rc = "system() returned unknown status code $rc"; } $rc .=" with coredump" if $core_dumped; warn "$program: roqet returned code $rc\n" if $debug; if($rc) { $test_result->{'result'}='failure'; if($expect eq "fail" && !$core_dumped) { warn "$program: '$name' ok - got expected failure\n"; } else { warn "$program: '$name' FAILED ($rc)\n"; print STDERR "Failing program was:\n"; print STDERR " $roqet_cmd\n"; print STDERR $test_result->{'stderr'}; } return $test_result; } if(defined $test_type && $test_type eq "${mf}CSVResultFormatTest") { my $file = $result_file; my $cmd = "$diff_cmd -u '$roqet_tmp' '$file' >'$diff_out'"; $rc = system($cmd); if($rc) { warn "$program: '$name' FAILED\n"; print STDERR "Failing program was:\n"; print STDERR " $roqet_cmd\n"; warn "Difference is:\n"; cat_file($diff_out); $test_result->{'result'}='failure'; return $test_result; } warn "$program: '$name' ok\n"; $test_result->{'result'}='success'; return $test_result; } unlink $roqet_tmp; my $sorted=0; my $first_result=1; my $roqet_results_count=0; my $result_type='bindings'; my(@vars_order); my(%vars_seen); for (split(/\n/, $test_result->{'stdout'})) { if(/^projected variable names: (.*)$/) { for my $vname (split(/,\s*/, $1)) { unless($vars_seen{$vname}) { push(@vars_order, $vname); $vars_seen{$vname}=1; } } warn "$program: Set vars order to @vars_order\n" if $debug; } if(/^query verb:\s+(\S+)/) { my $verb = $1; $result_type='graph' if $verb eq 'CONSTRUCT'; $result_type='boolean' if $verb eq 'ASK'; } s/blank \w+/blank _/g; if (m/query order conditions:/) { $sorted=1; $sort=$sorted ? "cat " : "sort "; } if (m/^(?:row|result): \[(.*)\]$/) { s/=INV:/=/g; s/=udt/=string/g; s%=xsdstring\((.*?)\)%=string("$1"^^)%g; my $line=$_; if($first_result) { open(OUT, "|$sort >'$roqet_out'") or die "$program: Cannot create pipe to $roqet_out - $!\n"; $first_result=0; } print OUT "$line\n"; $roqet_results_count++; } # RDF Graph result - seen N-Triple; sort -u to attempt to get canonical graph if(m/^[_<]/) { my $line = $_; if($first_result) { open(OUT, "|$sort -u >'$roqet_out'") or die "$program: Cannot create pipe to $roqet_out - $!\n"; $first_result=0; } print OUT "$line\n"; } } if($first_result) { open(OUT, ">", $roqet_out) or die "$program: Cannot create pipe to $roqet_out - $!\n"; } close(OUT); $test_result->{'result-type'} = $result_type; open(ERR, "<", $roqet_err) or die "$program: Cannot open $roqet_err - $!\n"; my(@errs)=(); while() { chomp; push(@errs, "$test_file:$1: $2") if /(\d+) rasqal error - (.*)$/; } close(ERR); if(@errs) { warn "$program: '$name' FAILED (query returned errors)\n$program: ".join("\n$program: ",@errs)."\n"; $test_result->{'errors'} = join("\n", @errs); print STDERR "Failing program was:\n"; print STDERR " $roqet_cmd\n"; print STDERR $test_result->{'stderr'}; $test_result->{'result'}='failure'; return $test_result; } my $cmd; my $results = {expect_empty => 1}; my $result_file_base_uri; if(defined $result_file) { $result_file_base_uri = "file://$result_file"; $result_file =~ s,^$CURDIR/,,; } if($result_type eq 'graph') { warn "$program: Reading RDF graph result file $result_file\n" if $debug; if(defined $result_file) { $results = read_rdf_graph_file($result_file, $result_file_base_uri); } } else { if(defined $result_file) { if($result_file =~ /\.srx$/) { warn "$program: Reading SPARQL XML bindings result file $result_file\n" if $debug; $results = read_query_results_file($result_file, 'xml'); } elsif($result_file =~ /\.srj$/) { warn "$program: '$name' FAILED (Cannot read SPARQL results in JSON)\n"; $test_result->{'result'}='failure'; return $test_result; } elsif($result_file =~ /\.(csv|tsv)$/) { my $result_format = $1; warn "$program: Reading CSV/TSV bindings result file $result_file\n" if $debug; $results = read_query_results_file($result_file, $result_format); } else { warn "$program: Reading RDF syntax encoding bindings result file $result_file\n" if $debug; my $result_format = ($result_file =~ /\.rdf/ ? 'rdfxml' : 'turtle'); $results = read_query_results_file($result_file, $result_format); } } } if(!defined $results) { $test_result->{'result'}='failure'; return $test_result; } if(exists $results->{expect_empty}) { warn "$program: '$name' ok (no result)\n"; $test_result->{'result'} = ($expect eq 'fail') ? 'failure' : 'success'; return $test_result; } my $count; if($result_type eq 'bindings') { open(OUT, "|$sort >'$result_out'") or die "$program: Cannot create pipe to $result_out - $!\n"; $count=0; for my $row (@{$results->{rows}}) { my(@vals) = map { $_ . '=' . defined_or_NULL($row->{$_}) } @vars_order; print OUT "row: [", join(", ", @vals), "]\n"; $count++; } close(OUT); $test_result->{'expected-results-count'} = $count; $test_result->{'actual-results-count'} = $roqet_results_count; } else { # graph: sort N-Triples in attempt to get canonical graph open(OUT, "| sort -u >'$result_out'") or die "$program: Cannot create pipe to $result_out - $!\n"; print OUT $results->{graph_ntriples} if exists $results->{graph_ntriples}; close(OUT); } if($result_type eq 'graph') { $rc = compare_rdf_graphs($result_out, $roqet_out, $diff_out); } else { $cmd = "$diff_cmd -u '$result_out' '$roqet_out' >'$diff_out'"; $rc = system($cmd); } if($rc && $result_type eq 'bindings' && $roqet_results_count <= $count && $cardinality_mode eq 'lax') { warn "$program: Cardinality lax - letting $roqet_results_count result match [1, $count] expected results\n" if $debug; $rc = 0; } if($rc) { if($result_type eq 'bindings' && $count != $roqet_results_count) { warn "$program: '$name' FAILED (Expected ".plural("result","s",$count).", got $roqet_results_count)\n"; } else { warn "$program: '$name' FAILED\n"; } print STDERR "Failing program was:\n"; print STDERR " $roqet_cmd\n"; warn "Difference is:\n"; cat_file($diff_out); $test_result->{'result'}='failure'; return $test_result; } warn "$program: '$name' ok\n"; $test_result->{'result'}='success'; return $test_result; } sub html_escape($) { my($str)=@_; return undef if !defined $str; $str =~ s/\&/\&/gs; $str =~ s//\>/gs; return $str; } # Argument handling my $usage=0; my $manifest_file=undef; my $earl_report_file=undef; my $junit_report_file=undef; my $suite_name=undef; my $approved=0; my $language='sparql'; my $warning_level=0; GetOptions( 'debug|d+' => \$debug, # incremental 'srcdir|s=s' => \$srcdir, 'input|i=s' => \$language, 'manifest|m=s' => \$manifest_file, 'earl|e=s' => \$earl_report_file, 'junit|j=s' => \$junit_report_file, 'suite|u=s' => \$suite_name, 'help|h|?' => \$usage, 'approved|a' => \$approved, 'warnings|W=i' => \$warning_level, # integer 0..100 ) || pod2usage(2); pod2usage(-verbose => 2) if $usage; pod2usage("$0: Too many tests given.\n") if (@ARGV > 1); my $unique_test=$ARGV[0]; $suite_name ||= 'testsuite'; $srcdir.="/" unless $srcdir =~ m%/$%; if(!defined $manifest_file) { for my $file (@manifest_files) { next unless -r $srcdir.$file; $manifest_file=$file; } } die "$program: No manifest file found in $srcdir\n" unless defined $manifest_file; my(%triples); my $entries_node; my $cmd="$TO_NTRIPLES '$srcdir$manifest_file'"; open(MF, "$cmd |") or die "Cannot open pipe from '$cmd' - $!\n"; while() { chomp; s/\s+\.$//; my($s,$p,$o)=split(/ /,$_,3); die "no p in '$_'\n" unless defined $p; die "no o in '$_'\n" unless defined $o; push(@{$triples{$s}->{$p}}, $o); $entries_node=$o if $p eq "<${mf}entries>"; } close(MF); warn "Entries node is '$entries_node'\n" if $debug > 1; my $list_node=$entries_node; my(@tests); while($list_node) { warn "List node is '$list_node'\n" if $debug > 1; my $entry_node=$triples{$list_node}->{"<${rdf}first>"}->[0]; warn "Entry node is '$entry_node'\n" if $debug > 1; if(!defined $triples{$entry_node}) { warn "$program: No triples in manifest for test URI $entry_node\n"; goto next_list_node; } my $name=$triples{$entry_node}->{"<${mf}name>"}->[0]; $name =~ s/^\"(.*)\"$/$1/ if defined $name; warn "Entry name=$name\n" if $debug > 1; my $result_node=$triples{$entry_node}->{"<${mf}result>"}->[0]; my $result_file=undef; if(defined $result_node) { $result_file=($result_node =~ /^<(.+)>$/, $1); $result_file =~ s,^file:/+,/,; } warn "Entry result_file=".($result_file || "NONE")."\n" if $debug > 1; my $action_node=$triples{$entry_node}->{"<${mf}action>"}->[0]; warn "Entry action_node $action_node\n" if $debug > 1; my(@data_files)=(); my(@named_data_files)=(); for my $data_node (@{$triples{$action_node}->{"<${qt}data>"}}) { warn "Entry graph data_node $data_node\n" if $debug > 1; my $data_file=($data_node =~ /^<(.+)>$/, $1); $data_file =~ s,^file:/+,/,; push(@data_files, $data_file); } for my $data_node (@{$triples{$action_node}->{"<${qt}graphData>"}}) { warn "Entry named graph data_node $data_node\n" if $debug > 1; my $data_file=($data_node =~ /^<(.+)>$/, $1); $data_file =~ s,^file:/+,/,; push(@named_data_files, $data_file); } my $query_type=$triples{$entry_node}->{"<${rdf}type>"}->[0]; warn "Query type is ".($query_type ? $query_type : "NONE")."\n" if $debug > 1; my $query_node; my $expect='pass'; my $execute=1; if(defined $query_type && ($query_type eq "<${ut}UpdateEvaluationTest>" || $query_type eq "<${mf}UpdateEvaluationTest>" || $query_type eq "<${mf}ProtocolTest>" )) { warn "Skipping query type $query_type - not supported\n" if $debug > 1; goto next_list_node; } my $lang = 'sparql'; if($query_type && ($query_type eq "<${mf}PositiveSyntaxTest>" || $query_type eq "<${mf}PositiveSyntaxTest11>" || $query_type eq "<${mf}PositiveUpdateSyntaxTest11>" || $query_type eq "<${mfx}TestSyntax>" || $query_type eq "<${mf}NegativeSyntaxTest>" || $query_type eq "<${mf}NegativeSyntaxTest11>" || $query_type eq "<${mf}NegativeUpdateSyntaxTest11>" || $query_type eq "<${mfx}TestBadSyntax>")) { $lang = 'sparql11' if $query_type =~ /Test11>$/; $query_node=$action_node; $execute=0; # Syntax checks do not need execution, just parsing $expect='fail' if $query_type =~ /^<${mf}Negative/ || $query_type eq "<${mf}NegativeSyntaxTest>" || $query_type eq "<${mfx}TestBadSyntax>"; } else { $query_node=$triples{$action_node}->{"<${qt}query>"}->[0]; } my $resultCardinality = $triples{$entry_node}->{"<${mf}resultCardinality>"}->[0]; my $cardinality_mode = (defined $resultCardinality && $resultCardinality eq "<${mf}LaxCardinality>") ? 'lax' : 'strict'; warn "Cardinality mode is $cardinality_mode\n" if $debug > 1; my $test_uri=$entry_node; $test_uri =~ s/^<(.+)>$/$1/; my $test_type=$query_type; $test_type =~ s/^<(.+)>$/$1/ if defined $test_type; my $test_approval=$triples{$entry_node}->{"<${dawgt}approval>"}->[0]; my $is_approved = 0; my $is_withdrawn = 0; if($test_approval) { warn "Test $name ($test_uri) state $test_approval\n" if $debug > 1; if($test_approval eq "<${dawgt}Withdrawn>") { warn "Test $name ($test_uri) was withdrawn\n" if $debug; $is_withdrawn = 1; } if($test_approval eq "<${dawgt}Approved>") { $is_approved = 1; } } my $has_entailment_regime = exists $triples{$action_node}->{"<${ent}entailmentRegime>"} || $triples{$action_node}->{"<${sd}entailmentRegime>"};; my $query_file=undef; if($query_node) { $query_file=($query_node =~ /^<(.+)>$/, $1); $query_file =~ s,^file:/*,/,; warn "Entry data_files=",join(", ",@data_files),"\n" if $debug > 1; warn "Entry named data_files=",join(", ",@named_data_files),"\n" if $debug > 1; warn "Entry query_file=$query_file\n" if $debug > 1; } if (!$unique_test || ($unique_test && (($name eq $unique_test) || ($test_uri =~ /$unique_test/)))) { push(@tests, {name => $name, dir => $srcdir, test_file => $query_file, data_files => \@data_files, named_data_files => \@named_data_files, result_file => $result_file, expect => $expect, test_type => $test_type, test_uri => $test_uri, execute => $execute, language => $lang, cardinality_mode => $cardinality_mode, is_withdrawn => $is_withdrawn, is_approved => $is_approved, has_entailment_regime => $has_entailment_regime } ); last if $unique_test; } next_list_node: $list_node=$triples{$list_node}->{"<${rdf}rest>"}->[0]; last if $list_node eq "<${rdf}nil>"; } die "$program: Test $unique_test not found\n" if $unique_test && !@tests; my(@failed); my(@passed); my(@skipped); my(@test_results); my $result=0; my $start_time = time; for my $test (@tests) { my($config)=$test; $config->{language} = $language; $config->{warning_level} = $warning_level; my $test_uri = $config->{test_uri}; my $name = $config->{name} || $test_uri; if($config->{is_withdrawn}) { warn "$program: Test $name ($test_uri) was withdrawn - skipping\n" if $debug; push(@skipped, $test); next; } if($approved && !$config->{is_approved}) { warn "$program: Test $name ($test_uri) not approved - skipping\n" if $debug; push(@skipped, $test); next; } if($config->{has_entailment_regime}) { warn "$program: Test $name ($test_uri) has entailment - skipping\n" if $debug > 1; push(@skipped, $test); next; } my $test_result = run_test($config); my $is_success = ($test_result->{'result'} eq 'success'); $is_success = !$is_success if $config->{expect} eq 'fail'; $test_result->{'is-success'} = $is_success; push(@test_results, $test_result); if($is_success) { push(@passed, $config); } else { push(@failed, $config); } } my $end_time = time; my $elapsed_time = ($end_time - $start_time); unlink $roqet_out, $result_out, $roqet_tmp, $roqet_err, $diff_out, $to_ntriples_err unless $unique_test; my $rasqal_version=`$ROQET -v`; chomp $rasqal_version; if($earl_report_file) { my $is_new=(!-r $earl_report_file); my(@t)=gmtime; my $rasqal_date=sprintf("%04d-%02d-%02d", 1900+$t[5], 1+$t[4], $t[3]); my $rasqal_name="Rasqal $rasqal_version"; open(OUT, ">>", $earl_report_file) or die "Cannot write to $earl_report_file - $!\n"; print OUT <<"EOT" \@prefix doap: . \@prefix earl: . \@prefix foaf: . \@prefix xsd: . _:author a foaf:Person; foaf:homepage ; foaf:name "Dave Beckett". <${rasqal_url}> a doap:Project; doap:name "Rasqal"; doap:homepage <${rasqal_url}>; doap:release [ a doap:Version; doap:created "$rasqal_date"^^xsd:date ; doap:name "${rasqal_name}"]. EOT if $is_new; for my $config (@failed) { my $test_uri=$config->{test_uri}; print OUT <<"EOT"; [] a earl:Assertion; earl:assertedBy _:author; earl:result [ a earl:TestResult; earl:outcome earl:fail ]; earl:subject <${rasqal_url}>; earl:test <$test_uri> . EOT } for my $config (@passed) { my $test_uri=$config->{test_uri}; print OUT <<"EOT"; [] a earl:Assertion; earl:assertedBy _:author; earl:result [ a earl:TestResult; earl:outcome earl:pass ]; earl:subject <${rasqal_url}>; earl:test <$test_uri> . EOT } close(OUT); } if($junit_report_file) { my(@t)=gmtime; my $timestamp=sprintf("%04d-%02d-%02dT%02d:%02d:%02d", 1900+$t[5], 1+$t[4], $t[3], $t[2], $t[1], $t[0]); my $rasqal_name="Rasqal $rasqal_version"; my $hostname="localhost"; my $name = $suite_name; my $tests_count = scalar(@passed) + scalar(@failed); my $failures_count = scalar(@failed); my $errors_count = 0; my $runtime = $elapsed_time; my $id = 0; # this has only 1 testsuite open(OUT, ">", $junit_report_file) or die "Cannot write to $junit_report_file - $!\n"; print OUT <<"EOT"; EOT my $system_out = ''; my $system_err = ''; for my $test_result (@test_results) { my $test_uri = $test_result->{uri}; my $test_name = $test_result->{name} || "unknown"; my $class_name = $test_uri; my $is_success = $test_result->{'is-success'}; my $elapsed = $test_result->{'elapsed-time'}; my $test_stdout = $test_result->{'stdout'} || ''; my $test_stderr = $test_result->{'stderr'} || ''; print OUT <<"EOT"; EOT if(!$is_success) { my $message = html_escape("Failed"); my $type = "org.librdf.fake"; my $text = html_escape($test_stdout . $test_stderr); print OUT <<"EOT"; $text EOT } # $system_out .= $test_stdout; # $system_err .= $test_stderr; print OUT <<"EOT"; EOT } # test_result loop $system_out = html_escape($system_out); $system_err = html_escape($system_err); print OUT <<"EOT"; $system_out $system_err EOT close(OUT); } my $failed_count=scalar(@failed); if($debug) { warn "$program: $failed_count FAILED tests:\n$program: " . join("\n$program: ", map { ($_->{name} || $_->{test_uri}). ($debug ? " (".$_->{test_uri}.")" : "") } @failed) . "\n" if $failed_count; } warn "$program: Summary: ".scalar(@passed)." tests passed ".scalar(@failed)." tests failed ".scalar(@skipped)." tests skipped\n"; exit $failed_count; __END__ =head1 NAME check-sparql - run SPARQL tests =head1 SYNOPSIS check-sparql [options] [test ...] =head1 OPTIONS =over 8 =item B<--debug> Enable extra debugging output. =item B<--help> Give command help summary. =item B<--manifest> MANIFEST Set the input test MANIFEST file =item B<--earl> EARL Set the output test EARL summary file. =item B<--junit> JUNIT Set the output Ant Junit XML results file. =item B<--suite> SUITE Set the test suite name =back =head1 DESCRIPTION Run SPARQL tests from a manifest file. =cut rasqal-0.9.33/tests/sparql/ValueTesting/0000755000175000017500000000000012443715252015155 500000000000000rasqal-0.9.33/tests/sparql/ValueTesting/boolean-EBV-canonical.rq0000644000175000017500000000042010361577754021425 00000000000000# Lexical form of EBV # $Id: boolean-EBV-canonical.rq,v 1.2 2006/01/13 01:18:36 eric Exp $ PREFIX rdfs: PREFIX xsd: SELECT ?s WHERE { ?s ?p ?o FILTER ( str(TRUE || FALSE) = str(?o) ) } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-EBV-canonical-result.n30000644000175000017500000000107210361506243022624 00000000000000# $Id: boolean-EBV-canonical-result.n3,v 1.1 2006/01/12 17:06:43 eric Exp $ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "s" ; rs:solution [ rs:binding [ rs:value ; rs:variable "s" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-ne-fail.rq0000644000175000017500000000105610273564313021415 00000000000000# Opaque types can not be tested for != . # $Id: extendedType-ne-fail.rq,v 1.3 2005/08/02 03:30:20 eric Exp $ PREFIX loc: PREFIX wgs: PREFIX air: SELECT ?a1 ?a2 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?rot1 . ?a2 air:name ?name2 ; loc:location ?l2 . ?l2 loc:rotational ?rot2 . FILTER (?rot1 != ?rot2) } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-false-canonical-result.n30000644000175000017500000000107410361577754023323 00000000000000# $Id: boolean-false-canonical-result.n3,v 1.1 2006/01/13 01:18:36 eric Exp $ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "s" ; rs:solution [ rs:binding [ rs:value ; rs:variable "s" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-graph-result.n30000644000175000017500000000116310273564313022414 00000000000000# Test graph match on extended type. # $Id: extendedType-graph-result.n3,v 1.1 2005/08/02 03:30:19 eric Exp $ @prefix rdf: . @prefix rs: . @prefix loc: . [] rs:ResultSet ; rs:resultVariable "a1" ; rs:solution [ rs:binding [ rs:value loc:b ; rs:variable "a1" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/Makefile.am0000644000175000017500000001155612302411034017122 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ boolean-0.n3 \ extendedType-0.n3 \ typePromotion-0.n3 SPARQL_TEST_FILES= \ boolean-EBV-canonical.rq \ boolean-equiv-FALSE.rq \ boolean-equiv-TRUE.rq \ boolean-equiv-xsdType.rq \ boolean-false-canonical.rq \ boolean-logical-OR.rq \ boolean-true-canonical.rq \ extendedType-eq-pass.rq \ extendedType-graph.rq \ extendedType-literal-eq.rq \ extendedType-literal-ne.rq \ extendedType-ne-fail.rq \ typePromotion-decimal-decimal-fail.rq \ typePromotion-decimal-decimal-pass.rq EXPECTED_SPARQL_CORRECT= \ "extendedType-eq-pass" \ "extendedType-ne-fail" \ "extendedType-literal-eq" \ "extendedType-literal-ne" \ "extendedType-graph" \ "typePromotion-decimal-decimal-fail" \ "boolean-equiv-FALSE" \ "boolean-equiv-TRUE" \ "boolean-equiv-xsdType" \ "boolean-logical-OR" # Test failures EXPECTED_SPARQL_CORRECT_FAILURES= \ typePromotion-decimal-decimal-pass \ boolean-false-canonical \ boolean-true-canonical \ boolean-EBV-canonical SPARQL_RESULT_FILES= \ boolean-EBV-canonical-result.n3 \ boolean-equiv-FALSE-result.n3 \ boolean-equiv-TRUE-result.n3 \ boolean-equiv-xsdType-result.n3 \ boolean-false-canonical-result.n3 \ boolean-logical-OR-result.n3 \ boolean-true-canonical-result.n3 \ extendedType-eq-pass-result.n3 \ extendedType-graph-result.n3 \ extendedType-literal-eq-result.n3 \ extendedType-literal-ne-result.n3 \ extendedType-ne-fail-result.n3 \ typePromotion-decimal-decimal-fail-result.n3 \ typePromotion-decimal-decimal-pass-result.n3 EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-graph.rq0000644000175000017500000000057510273564313021210 00000000000000# Test graph match on extended type. # $Id: extendedType-graph.rq,v 1.1 2005/08/02 03:30:19 eric Exp $ PREFIX loc: PREFIX air: SELECT ?a1 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational "-7420507.1"^^loc:ECEF_X } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-0.n30000644000175000017500000000065511317766506017130 00000000000000# $Id$ @prefix rdf: . @prefix xsd: . @prefix t: . # test values from http://www.w3.org/TR/xmlschema-2/#boolean t:fdigit rdf:value "0"^^xsd:boolean . t:ftext rdf:value "false"^^xsd:boolean . t:tdigit rdf:value "1"^^xsd:boolean . t:ttext rdf:value "true"^^xsd:boolean . rasqal-0.9.33/tests/sparql/ValueTesting/Makefile.in0000644000175000017500000004163312434455633017155 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/ValueTesting DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ boolean-0.n3 \ extendedType-0.n3 \ typePromotion-0.n3 SPARQL_TEST_FILES = \ boolean-EBV-canonical.rq \ boolean-equiv-FALSE.rq \ boolean-equiv-TRUE.rq \ boolean-equiv-xsdType.rq \ boolean-false-canonical.rq \ boolean-logical-OR.rq \ boolean-true-canonical.rq \ extendedType-eq-pass.rq \ extendedType-graph.rq \ extendedType-literal-eq.rq \ extendedType-literal-ne.rq \ extendedType-ne-fail.rq \ typePromotion-decimal-decimal-fail.rq \ typePromotion-decimal-decimal-pass.rq EXPECTED_SPARQL_CORRECT = \ "extendedType-eq-pass" \ "extendedType-ne-fail" \ "extendedType-literal-eq" \ "extendedType-literal-ne" \ "extendedType-graph" \ "typePromotion-decimal-decimal-fail" \ "boolean-equiv-FALSE" \ "boolean-equiv-TRUE" \ "boolean-equiv-xsdType" \ "boolean-logical-OR" # Test failures EXPECTED_SPARQL_CORRECT_FAILURES = \ typePromotion-decimal-decimal-pass \ boolean-false-canonical \ boolean-true-canonical \ boolean-EBV-canonical SPARQL_RESULT_FILES = \ boolean-EBV-canonical-result.n3 \ boolean-equiv-FALSE-result.n3 \ boolean-equiv-TRUE-result.n3 \ boolean-equiv-xsdType-result.n3 \ boolean-false-canonical-result.n3 \ boolean-logical-OR-result.n3 \ boolean-true-canonical-result.n3 \ extendedType-eq-pass-result.n3 \ extendedType-graph-result.n3 \ extendedType-literal-eq-result.n3 \ extendedType-literal-ne-result.n3 \ extendedType-ne-fail-result.n3 \ typePromotion-decimal-decimal-fail-result.n3 \ typePromotion-decimal-decimal-pass-result.n3 EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/ValueTesting/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/ValueTesting/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-literal-ne.rq0000644000175000017500000000065410273564313022141 00000000000000# Test FILTER negative match on extended type. # $Id: extendedType-literal-ne.rq,v 1.1 2005/08/02 03:30:19 eric Exp $ PREFIX loc: PREFIX air: SELECT ?a1 ?a2 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?r . FILTER (?r != "-7420507.1"^^loc:ECEF_X) } rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-eq-pass-result.n30000644000175000017500000000206110273444060022656 00000000000000# Only opaque types with identical lexical and datatypes can be tested for = . # $Id: extendedType-eq-pass-result.n3,v 1.2 2005/08/01 16:05:04 eric Exp $ @prefix rdf: . @prefix rs: . @prefix loc: . [] rs:ResultSet ; rs:resultVariable "a1", "a2" ; rs:solution [ rs:binding [ rs:value loc:a ; rs:variable "a1" ] ; rs:binding [ rs:value loc:a ; rs:variable "a2" ] ] ; rs:solution [ rs:binding [ rs:value loc:b ; rs:variable "a1" ] ; rs:binding [ rs:value loc:b ; rs:variable "a2" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-literal-eq-result.n30000644000175000017500000000117110273564313023351 00000000000000# Test FILTER match on extended type. # $Id: extendedType-literal-eq-result.n3,v 1.1 2005/08/02 03:30:19 eric Exp $ @prefix rdf: . @prefix rs: . @prefix loc: . [] rs:ResultSet ; rs:resultVariable "a1" ; rs:solution [ rs:binding [ rs:value loc:b ; rs:variable "a1" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-eq-pass.rq0000644000175000017500000000133610273564313021454 00000000000000# Only extended types with identical lexical rep and datatypes can be = . # $Id: extendedType-eq-pass.rq,v 1.5 2005/08/02 03:30:19 eric Exp $ PREFIX loc: PREFIX wgs: PREFIX air: #PREFIX xsd: #SELECT ?a1 (xsd:float(xsd:string(?rot1))-5.5) ?a2 SELECT ?a1 ?a2 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?rot1 . ?a2 air:name ?name2 ; loc:location ?l2 . ?l2 loc:rotational ?rot2 . FILTER (?rot1 = ?rot2)} # FILTER (str(?rot1) = "-7420507.1")} rasqal-0.9.33/tests/sparql/ValueTesting/typePromotion-decimal-decimal-pass.rq0000644000175000017500000000067411317766506024303 00000000000000# Positive test: product of type promotion within the xsd:decimal type tree. # $Id$ PREFIX rdfs: PREFIX xsd: SELECT ?one ?two WHERE { ?one rdfs:value ?oneL . ?two rdfs:value ?twoL . FILTER ( datatype(?oneL) = xsd:unsignedByte && datatype(?twoL) = xsd:unsignedShort && datatype(?oneL + ?twoL) = xsd:decimal ) } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-equiv-xsdType.rq0000644000175000017500000000043711317766506021660 00000000000000# Various lexical forms of xsd:boolean equal each other # $Id$ PREFIX rdf: PREFIX xsd: SELECT ?one ?two WHERE { ?one rdf:value ?oneL . ?two rdf:value ?twoL . FILTER ( ?oneL = ?twoL ) } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-logical-OR.rq0000644000175000017500000000043111317766506021013 00000000000000# Positive test: product of type promotion within the xsd:decimal type tree. # $Id$ PREFIX rdf: PREFIX xsd: SELECT ?one WHERE { ?one rdf:value ?oneL . FILTER ( (TRUE || FALSE) = ?oneL ) } rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-literal-eq.rq0000644000175000017500000000064010273564313022137 00000000000000# Test FILTER match on extended type. # $Id: extendedType-literal-eq.rq,v 1.1 2005/08/02 03:30:19 eric Exp $ PREFIX loc: PREFIX air: SELECT ?a1 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?r1 . FILTER (?r1 = "-7420507.1"^^loc:ECEF_X) } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-true-canonical-result.n30000644000175000017500000000107310361577754023207 00000000000000# $Id: boolean-true-canonical-result.n3,v 1.1 2006/01/13 01:18:36 eric Exp $ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "s" ; rs:solution [ rs:binding [ rs:value ; rs:variable "s" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/boolean-equiv-FALSE-result.n30000644000175000017500000000133511317766506022262 00000000000000# $Id$ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "one" ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-ne-fail-result.n30000644000175000017500000000075010273564313022627 00000000000000# Opaque types can not be tested for != . # $Id: extendedType-ne-fail-result.n3,v 1.2 2005/08/02 03:30:19 eric Exp $ @prefix rdf: . @prefix rs: . @prefix loc: . [] rs:ResultSet ; rs:resultVariable "a1", "a2" . rasqal-0.9.33/tests/sparql/ValueTesting/manifest.n30000644000175000017500000001313710361577754017164 00000000000000# $Id: manifest.n3,v 1.11 2006/01/13 01:18:37 eric Exp $ @prefix rdf: . @prefix rdfs: . @prefix dawgt: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Value Testing Tests" ; mf:entries ([ mf:name "extendedType-eq-pass" ; rdfs:comment "Only extended types with identical lexical and datatypes can be tested for = ." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:Approved ; dawgt:approvedBy ] [ mf:name "extendedType-ne-fail" ; rdfs:comment "Opaque types can not be tested for != ." ; rdfs:seeAlso ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:Approved ; dawgt:approvedBy ] [ mf:name "extendedType-literal-eq" ; rdfs:comment "Test FILTER match on extended type." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "extendedType-literal-ne" ; rdfs:comment "Test FILTER negative match on extended type." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "extendedType-graph" ; rdfs:comment "Test graph match on extended type." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "typePromotion-decimal-decimal-pass" ; rdfs:comment "Positive test: product of type promotion within the xsd:decimal type tree." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ rdf:type mf:TestBadSyntax ; mf:name "typePromotion-decimal-decimal-fail" ; rdfs:comment "Negative test: product of type promotion within the xsd:decimal type tree." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-equiv-FALSE" ; rdfs:comment "FALSE = legal boolean values." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-equiv-TRUE" ; rdfs:comment "TRUE = legal boolean values." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-equiv-xsdType" ; rdfs:comment "Various lexical forms of xsd:boolean equal each other." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-logical-OR" ; rdfs:comment "Various lexical forms of xsd:boolean equal an EBV." ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-false-canonical" ; rdfs:comment "Lexical form of FALSE" ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-true-canonical" ; rdfs:comment "Lexical form of TRUE" ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] [ mf:name "boolean-EBV-canonical" ; rdfs:comment "Lexical form of EBV" ; mf:action [ qt:data ; qt:query ] ; mf:result ; dawgt:approval dawgt:NotApproved ] # End of tests ). rasqal-0.9.33/tests/sparql/ValueTesting/boolean-logical-OR-result.n30000644000175000017500000000142111317766506022225 00000000000000# Various lexical forms of xsd:boolean equal an EBV # $Id$ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "one" ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/boolean-false-canonical.rq0000644000175000017500000000035210361577754022107 00000000000000# Canonical format of FALSE # $Id: boolean-false-canonical.rq,v 1.1 2006/01/13 01:18:36 eric Exp $ PREFIX rdfs: PREFIX xsd: SELECT ?s WHERE { ?s ?p FALSE } rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-0.n30000644000175000017500000000112410265220044020122 00000000000000@prefix r: . @prefix loc: . @prefix air: . loc:a air:name "Austin Bergstrom International" ; loc:location [ r:type loc:geodetic ; loc:rotational "30.300000"^^loc:latitude ; loc:orthogonal "-97.700000"^^loc:longitude ] . loc:b air:name "Austin Bergstrom International" ; loc:location [ r:type loc:EarthCenteredEarthFixed ; loc:rotational "-7420507.1"^^loc:ECEF_X ; loc:orthogonal "-5462738.5"^^loc:ECEF_Y ] . rasqal-0.9.33/tests/sparql/ValueTesting/typePromotion-decimal-decimal-pass-result.n30000644000175000017500000000122710362621550025474 00000000000000@prefix rdf: . @prefix rs: . @prefix t: . [] rs:ResultSet ; rs:resultVariable "one", "two" ; rs:solution [ rs:binding [ rs:value t:one ; rs:variable "one" ] , [ rs:value t:two ; rs:variable "two" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/boolean-true-canonical.rq0000644000175000017500000000034710361577754022000 00000000000000# Canonical format of TRUE # $Id: boolean-true-canonical.rq,v 1.1 2006/01/13 01:18:37 eric Exp $ PREFIX rdfs: PREFIX xsd: SELECT ?s WHERE { ?s ?p TRUE } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-equiv-TRUE-result.n30000644000175000017500000000133511317766506022207 00000000000000# $Id$ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "one" ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] ] . rasqal-0.9.33/tests/sparql/ValueTesting/boolean-equiv-TRUE.rq0000644000175000017500000000033711317766506020776 00000000000000# TRUE = legal boolean values # $Id$ PREFIX rdf: PREFIX xsd: SELECT ?one WHERE { ?one rdf:value ?oneL . FILTER ( ?oneL = TRUE ) } rasqal-0.9.33/tests/sparql/ValueTesting/boolean-equiv-FALSE.rq0000644000175000017500000000034111317766506021044 00000000000000# FALSE = legal boolean values # $Id$ PREFIX rdf: PREFIX xsd: SELECT ?one WHERE { ?one rdf:value ?oneL . FILTER ( ?oneL = FALSE ) } rasqal-0.9.33/tests/sparql/ValueTesting/typePromotion-decimal-decimal-fail-result.n30000644000175000017500000000042510362621550025440 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "one", "two" . rasqal-0.9.33/tests/sparql/ValueTesting/typePromotion-decimal-decimal-fail.rq0000644000175000017500000000070211317766506024240 00000000000000# Negative test: product of type promotion within the xsd:decimal type tree. # $Id$ PREFIX rdfs: PREFIX xsd: SELECT ?one ?two WHERE { ?one rdfs:value ?oneL . ?two rdfs:value ?twoL . FILTER ( datatype(?oneL) = xsd:unsignedByte && datatype(?twoL) = xsd:unsignedShort && datatype(?oneL + ?twoL) = xsd:unsignedShort ) } rasqal-0.9.33/tests/sparql/ValueTesting/typePromotion-0.n30000644000175000017500000000043610362621550020362 00000000000000@prefix rdfs: . @prefix xsd: . @prefix t: . t:one rdfs:value "1"^^xsd:unsignedByte . t:two rdfs:value "2"^^xsd:unsignedShort . rasqal-0.9.33/tests/sparql/ValueTesting/extendedType-literal-ne-result.n30000644000175000017500000000062110273564313023345 00000000000000# Test FILTER negative match on extended type. # $Id: extendedType-literal-ne-result.n3,v 1.1 2005/08/02 03:30:19 eric Exp $ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "a1", "a2" . rasqal-0.9.33/tests/sparql/ValueTesting/boolean-equiv-xsdType-result.n30000644000175000017500000000730511317766506023073 00000000000000# $Id$ @prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "one", "two" ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "one" ] , [ rs:value ; rs:variable "two" ] ] . rasqal-0.9.33/tests/sparql/update/0000755000175000017500000000000012443715253014026 500000000000000rasqal-0.9.33/tests/sparql/update/insert-1.rq0000644000175000017500000000062111423136561015747 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t415 PREFIX dc: PREFIX xsd: INSERT { GRAPH { ?book ?p ?v } } WHERE { GRAPH { ?book dc:date ?date . FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime ) ?book ?p ?v } } rasqal-0.9.33/tests/sparql/update/copy-3.rq0000644000175000017500000000011111521361052015403 00000000000000# Check that 2 NULL graph/document uri args work COPY DEFAULT TO DEFAULT rasqal-0.9.33/tests/sparql/update/Makefile.am0000644000175000017500000000664212350617062016006 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL Update tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= \ data.ttl EXPECTED_SPARQL_CORRECT= \ insert-data-1.rq \ insert-data-2.rq \ insert-data-3.rq \ insert-data-4.rq \ delete-data-1.rq \ delete-data-2.rq \ delete-1.rq \ delete-2.rq \ insert-1.rq \ insert-2.rq \ insert-3.rq \ load-1.rq \ load-2.rq \ load-3.rq \ load-4.rq \ clear-1.rq \ clear-2.rq \ clear-3.rq \ clear-4.rq \ create-1.rq \ create-2.rq \ delete-1.rq \ drop-1.rq \ drop-2.rq \ delete-insert-1.rq \ copy-1.rq \ copy-2.rq \ copy-3.rq \ move-1.rq \ move-2.rq \ move-3.rq \ add-1.rq \ add-2.rq \ add-3.rq \ multiple-1.rq \ delete-where-1.rq \ delete-where-2.rq SPARQL_BAD_TEST_FILES= \ bad-1.rq EXPECTED_SPARQL_CORRECT_FAILURES= EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(EXPECTED_SPARQL_CORRECT) \ $(SPARQL_BAD_TEST_FILES) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good sparql-parse-bad" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Update legal parsing\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-parse-bad: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Update illegal parsing\"; mf:entries ("; \ for test in $(SPARQL_BAD_TEST_FILES); do \ comment="sparql failing to parse of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/update/Makefile.in0000644000175000017500000003660512434455633016030 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL Update tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/update DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = \ data.ttl EXPECTED_SPARQL_CORRECT = \ insert-data-1.rq \ insert-data-2.rq \ insert-data-3.rq \ insert-data-4.rq \ delete-data-1.rq \ delete-data-2.rq \ delete-1.rq \ delete-2.rq \ insert-1.rq \ insert-2.rq \ insert-3.rq \ load-1.rq \ load-2.rq \ load-3.rq \ load-4.rq \ clear-1.rq \ clear-2.rq \ clear-3.rq \ clear-4.rq \ create-1.rq \ create-2.rq \ delete-1.rq \ drop-1.rq \ drop-2.rq \ delete-insert-1.rq \ copy-1.rq \ copy-2.rq \ copy-3.rq \ move-1.rq \ move-2.rq \ move-3.rq \ add-1.rq \ add-2.rq \ add-3.rq \ multiple-1.rq \ delete-where-1.rq \ delete-where-2.rq SPARQL_BAD_TEST_FILES = \ bad-1.rq EXPECTED_SPARQL_CORRECT_FAILURES = EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(EXPECTED_SPARQL_CORRECT) \ $(SPARQL_BAD_TEST_FILES) all: all-am .SUFFIXES: $(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 tests/sparql/update/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/update/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good sparql-parse-bad" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Update legal parsing\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-parse-bad: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 Update illegal parsing\"; mf:entries ("; \ for test in $(SPARQL_BAD_TEST_FILES); do \ comment="sparql failing to parse of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/update/insert-data-1.rq0000644000175000017500000000034211423136561016656 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t411 PREFIX dc: INSERT DATA { dc:title "A new book" ; dc:creator "A.N.Other" . } rasqal-0.9.33/tests/sparql/update/clear-3.rq0000644000175000017500000000020311423136561015527 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t418 # (no example given in doc) CLEAR GRAPH rasqal-0.9.33/tests/sparql/update/move-3.rq0000644000175000017500000000011111521361052015377 00000000000000# Check that 2 NULL graph/document uri args work MOVE DEFAULT TO DEFAULT rasqal-0.9.33/tests/sparql/update/insert-data-4.rq0000644000175000017500000000020511526311650016655 00000000000000# From bug http://bugs.librdf.org/mantis/view.php?id=427 # # Ensure """ and lang tags work INSERT DATA { """foo"""@en-GB } rasqal-0.9.33/tests/sparql/update/copy-1.rq0000644000175000017500000000034711520703556015424 00000000000000# S3.2.3 of http://www.w3.org/2009/sparql/docs/update-1.1/Overview.xml # as of Sat Jan 29 02:31:47 GMT 2011 # An example to copy all statements from the default graph into a named graph. COPY DEFAULT TO rasqal-0.9.33/tests/sparql/update/add-3.rq0000644000175000017500000000011011521361052015160 00000000000000# Check that 2 NULL graph/document uri args work ADD DEFAULT TO DEFAULT rasqal-0.9.33/tests/sparql/update/load-4.rq0000644000175000017500000000024011352051521015353 00000000000000# http://lists.w3.org/Archives/Public/public-rdf-dawg/2010JanMar/0569.html LOAD INTO rasqal-0.9.33/tests/sparql/update/multiple-1.rq0000644000175000017500000000711111521077565016306 00000000000000# Multiple update operations in one file with ;s to separate ADD DEFAULT TO ; ADD SILENT TO ; WITH DELETE { ?s ?p ?o } WHERE { ?s ?p ?o } ; CLEAR GRAPH ; COPY DEFAULT TO ; COPY SILENT TO ; PREFIX dc: PREFIX xsd: DELETE { ?book ?p ?v } WHERE { ?book dc:date ?date . FILTER ( ?date < "2000-01-01T00:00:00-02:00"^^xsd:dateTime ) ?book ?p ?v } ; PREFIX foaf: WITH DELETE { ?person foaf:firstName 'Fred'; ?property ?value } ; # Defined above # PREFIX dc: DELETE DATA { dc:title "David Copperfield" ; dc:creator "Edmund Wells" . } ; # Defined above # PREFIX dc: DELETE DATA { GRAPH { dc:title "Fundamentals of Compiler Desing" } } ; INSERT DATA { GRAPH { dc:title "Fundamentals of Compiler Design" } } ; # Defined above # PREFIX foaf: WITH DELETE { ?person foaf:firstName 'Bill' } INSERT { ?person foaf:firstName 'William' } WHERE { ?person a foaf:Person . ?person foaf:firstName 'Bill' } ; PREFIX foaf: DELETE WHERE { ?person foaf:firstName 'Fred'; ?property ?value } ; PREFIX foaf: DELETE WHERE { GRAPH { ?person foaf:firstName 'Fred' } . GRAPH { ?person ?property ?value } } ; DROP GRAPH ; DROP SILENT GRAPH ; # Defined above # PREFIX dc: # PREFIX xsd: INSERT { GRAPH { ?book ?p ?v } } WHERE { GRAPH { ?book dc:date ?date . FILTER ( ?date < "2000-01-01T00:00:00-02:00"^^xsd:dateTime ) ?book ?p ?v } } ; # Defined above # PREFIX dc: PREFIX dcmitype: # PREFIX xsd: INSERT { GRAPH { ?book ?p ?v } } WHERE { GRAPH { ?book dc:date ?date . FILTER ( ?date < "2000-01-01T00:00:00-02:00"^^xsd:dateTime ) ?book ?p ?v } } ; WITH DELETE { ?book ?p ?v } WHERE { ?book dc:date ?date ; dc:type dcmitype:PhysicalObject . FILTER ( ?date < "2000-01-01T00:00:00-02:00"^^xsd:dateTime ) ?book ?p ?v } ; INSERT { } ; # Defined above # PREFIX dc: INSERT DATA { dc:title "A new book" ; dc:creator "A.N.Other" . } ; LOAD ; LOAD INTO ; LOAD INTO DEFAULT ; LOAD INTO ; MOVE DEFAULT TO ; MOVE SILENT TO ; rasqal-0.9.33/tests/sparql/update/move-1.rq0000644000175000017500000000034711520703556015420 00000000000000# S3.2.4 of http://www.w3.org/2009/sparql/docs/update-1.1/Overview.xml # as of Sat Jan 29 02:31:47 GMT 2011 # An example to move all statements from the default graph into a named graph. MOVE DEFAULT TO rasqal-0.9.33/tests/sparql/update/delete-2.rq0000644000175000017500000000033411423136561015707 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t414 PREFIX foaf: WITH DELETE { ?person foaf:firstName 'Fred'; ?property ?value } rasqal-0.9.33/tests/sparql/update/manifest.ttl0000644000175000017500000001663512350617062016310 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . <> a mf:Manifest ; rdfs:comment "SPARQL 1.1 Update syntax parsing" ; mf:entries ([ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-data-1.rq" ; mf:action ; mf:name "insert-data-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-data-2.rq" ; mf:action ; mf:name "insert-data-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-data-3.rq" ; mf:action ; mf:name "insert-data-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-data-4.rq" ; mf:action ; mf:name "insert-data-4.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-data-1.rq" ; mf:action ; mf:name "delete-data-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-data-2.rq" ; mf:action ; mf:name "delete-data-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-1.rq" ; mf:action ; mf:name "delete-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-2.rq" ; mf:action ; mf:name "delete-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-1.rq" ; mf:action ; mf:name "insert-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-2.rq" ; mf:action ; mf:name "insert-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of insert-3.rq" ; mf:action ; mf:name "insert-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of load-1.rq" ; mf:action ; mf:name "load-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of load-2.rq" ; mf:action ; mf:name "load-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of load-3.rq" ; mf:action ; mf:name "load-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of load-4.rq" ; mf:action ; mf:name "load-4.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of clear-1.rq" ; mf:action ; mf:name "clear-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of clear-2.rq" ; mf:action ; mf:name "clear-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of clear-3.rq" ; mf:action ; mf:name "clear-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of clear-4.rq" ; mf:action ; mf:name "clear-4.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of create-1.rq" ; mf:action ; mf:name "create-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of create-2.rq" ; mf:action ; mf:name "create-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-1.rq" ; mf:action ; mf:name "delete-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of drop-1.rq" ; mf:action ; mf:name "drop-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of drop-2.rq" ; mf:action ; mf:name "drop-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-insert-1.rq" ; mf:action ; mf:name "delete-insert-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of copy-1.rq" ; mf:action ; mf:name "copy-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of copy-2.rq" ; mf:action ; mf:name "copy-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of copy-3.rq" ; mf:action ; mf:name "copy-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of move-1.rq" ; mf:action ; mf:name "move-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of move-2.rq" ; mf:action ; mf:name "move-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of move-3.rq" ; mf:action ; mf:name "move-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of add-1.rq" ; mf:action ; mf:name "add-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of add-2.rq" ; mf:action ; mf:name "add-2.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of add-3.rq" ; mf:action ; mf:name "add-3.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of multiple-1.rq" ; mf:action ; mf:name "multiple-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-where-1.rq" ; mf:action ; mf:name "delete-where-1.rq" ] [ a mf:PositiveSyntaxTest11 ; rdfs:comment "sparql parsing of delete-where-2.rq" ; mf:action ; mf:name "delete-where-2.rq" ] [ a mf:NegativeSyntaxTest11; rdfs:comment "sparql failing to parse of bad-1.rq" ; mf:action ; mf:name "bad-1.rq" ] ) . rasqal-0.9.33/tests/sparql/update/move-2.rq0000644000175000017500000000023211520703556015412 00000000000000# An example to move all statements from one named graph into another named graph. MOVE SILENT TO rasqal-0.9.33/tests/sparql/update/insert-3.rq0000644000175000017500000000014711444717761015766 00000000000000INSERT { } rasqal-0.9.33/tests/sparql/update/copy-2.rq0000644000175000017500000000023211520703556015416 00000000000000# An example to copy all statements from one named graph into another named graph. COPY SILENT TO rasqal-0.9.33/tests/sparql/update/load-3.rq0000644000175000017500000000016411352051521015357 00000000000000# http://lists.w3.org/Archives/Public/public-rdf-dawg/2010JanMar/0569.html LOAD INTO DEFAULT rasqal-0.9.33/tests/sparql/update/delete-data-1.rq0000644000175000017500000000035511423136561016620 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t412 PREFIX dc: DELETE DATA { dc:title "David Copperfield" ; dc:creator "Edmund Wells" . } rasqal-0.9.33/tests/sparql/update/insert-data-2.rq0000644000175000017500000000022611526311650016656 00000000000000# From bug http://bugs.librdf.org/mantis/view.php?id=427 # # Ensure 2 triples are returned INSERT DATA { """foo""" . """bar""" } rasqal-0.9.33/tests/sparql/update/drop-2.rq0000644000175000017500000000020211423136561015403 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t422 # (no example in doc) DROP SILENT GRAPH rasqal-0.9.33/tests/sparql/update/delete-where-1.rq0000644000175000017500000000031111423136561017011 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t416 PREFIX foaf: DELETE WHERE { ?person foaf:firstName 'Fred'; ?property ?value } rasqal-0.9.33/tests/sparql/update/create-2.rq0000644000175000017500000000020411423136561015704 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t421 # (no example in doc) CREATE SILENT GRAPH rasqal-0.9.33/tests/sparql/update/insert-2.rq0000644000175000017500000000122211521072063015741 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t415 PREFIX dc: PREFIX dcmitype: PREFIX xsd: INSERT { GRAPH { ?book ?p ?v } } WHERE { GRAPH { ?book dc:date ?date . FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime ) ?book ?p ?v } } ; WITH DELETE { ?book ?p ?v } WHERE { ?book dc:date ?date ; dc:type dcmitype:PhysicalObject . FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime ) ?book ?p ?v } rasqal-0.9.33/tests/sparql/update/data.ttl0000644000175000017500000000012111333362166015374 00000000000000@prefix ex: . ex:foo ex:bar ex:baz . ex:foo ex:bar "10" . rasqal-0.9.33/tests/sparql/update/insert-data-3.rq0000644000175000017500000000022211526311650016653 00000000000000# From bug http://bugs.librdf.org/mantis/view.php?id=427 # # Ensure 2 triples are returned INSERT DATA { """foo""" . "bar" } rasqal-0.9.33/tests/sparql/update/clear-1.rq0000644000175000017500000000024211423136561015530 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100126/#t417 # (no example given in doc) # This 2010-01-26 draft syntax is DEPRECATED and gives a warning CLEAR rasqal-0.9.33/tests/sparql/update/add-1.rq0000644000175000017500000000034511520703556015200 00000000000000# S3.2.5 of http://www.w3.org/2009/sparql/docs/update-1.1/Overview.xml # as of Sat Jan 29 02:31:47 GMT 2011 # An example to add all statements from the default graph into a named graph. ADD DEFAULT TO rasqal-0.9.33/tests/sparql/update/delete-1.rq0000644000175000017500000000044711423136561015713 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t414 PREFIX dc: PREFIX xsd: DELETE { ?book ?p ?v } WHERE { ?book dc:date ?date . FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime ) ?book ?p ?v } rasqal-0.9.33/tests/sparql/update/load-1.rq0000644000175000017500000000016711423136561015367 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t417 # (no example given in doc) LOAD rasqal-0.9.33/tests/sparql/update/drop-1.rq0000644000175000017500000000017311423136561015411 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t422 # (no example in doc) DROP GRAPH rasqal-0.9.33/tests/sparql/update/clear-4.rq0000644000175000017500000000014111423136561015531 00000000000000# http://lists.w3.org/Archives/Public/public-rdf-dawg/2010JanMar/0569.html CLEAR GRAPH DEFAULT rasqal-0.9.33/tests/sparql/update/delete-where-2.rq0000644000175000017500000000042311423136561017016 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t416 PREFIX foaf: DELETE WHERE { GRAPH { ?person foaf:firstName 'Fred' } . GRAPH { ?person ?property ?value } } rasqal-0.9.33/tests/sparql/update/load-2.rq0000644000175000017500000000022711423136561015365 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t417 # (no example given in doc) LOAD INTO rasqal-0.9.33/tests/sparql/update/delete-insert-1.rq0000644000175000017500000000045111423136561017210 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t413 PREFIX foaf: WITH DELETE { ?person foaf:firstName 'Bill' } INSERT { ?person foaf:firstName 'William' } WHERE { ?person a foaf:Person . ?person foaf:firstName 'Bill' } rasqal-0.9.33/tests/sparql/update/bad-1.rq0000644000175000017500000000003611325405624015171 00000000000000# Placeholder bad query FAIL rasqal-0.9.33/tests/sparql/update/clear-2.rq0000644000175000017500000000026611423136561015537 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t418 # (no example given in doc) # CLEAR equivalent WITH DELETE { ?s ?p ?o } WHERE { ?s ?p ?o } rasqal-0.9.33/tests/sparql/update/add-2.rq0000644000175000017500000000023011520703556015172 00000000000000# An example to add all statements from one named graph into another named graph. ADD SILENT TO rasqal-0.9.33/tests/sparql/update/delete-data-2.rq0000644000175000017500000000054411521072063016614 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t412 PREFIX dc: DELETE DATA { GRAPH { dc:title "Fundamentals of Compiler Desing" } } ; INSERT DATA { GRAPH { dc:title "Fundamentals of Compiler Design" } } rasqal-0.9.33/tests/sparql/update/create-1.rq0000644000175000017500000000017511423136561015712 00000000000000# http://www.w3.org/TR/2010/WD-sparql11-update-20100601/#t421 # (no example in doc) CREATE GRAPH rasqal-0.9.33/tests/sparql/survey/0000755000175000017500000000000012443715252014100 500000000000000rasqal-0.9.33/tests/sparql/survey/query-survey-10.rq0000644000175000017500000000013410362621550017273 00000000000000select DISTINCT ?R where { ?R ?x ?y. FILTER ( regex(str(?R), "http://example.org/") ) } rasqal-0.9.33/tests/sparql/survey/Makefile.am0000644000175000017500000001025512302411034016040 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests - examples # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= \ survey-sample.ttl SPARQL_TEST_FILES= \ query-survey-1.rq query-survey-2.rq query-survey-3.rq \ query-survey-8.rq query-survey-9.rq query-survey-10.rq \ query-survey-11.rq query-survey-12.rq query-survey-13.rq SPARQL_RESULT_FILES= \ result-survey-1.ttl result-survey-2.ttl result-survey-3.ttl \ result-survey-8.ttl result-survey-9.ttl result-survey-10.ttl \ result-survey-11.ttl result-survey-12.ttl result-survey-13.ttl EXPECTED_SPARQL_CORRECT= \ survey-1 \ survey-2 \ survey-3 \ survey-8 \ survey-9 \ survey-10 \ survey-11 \ survey-12 \ survey-13 # Test failures EXPECTED_SPARQL_CORRECT_FAILURES= EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ expect="NegativeTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/survey/Makefile.in0000644000175000017500000004031012434455633016067 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests - examples # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/survey DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = \ survey-sample.ttl SPARQL_TEST_FILES = \ query-survey-1.rq query-survey-2.rq query-survey-3.rq \ query-survey-8.rq query-survey-9.rq query-survey-10.rq \ query-survey-11.rq query-survey-12.rq query-survey-13.rq SPARQL_RESULT_FILES = \ result-survey-1.ttl result-survey-2.ttl result-survey-3.ttl \ result-survey-8.ttl result-survey-9.ttl result-survey-10.ttl \ result-survey-11.ttl result-survey-12.ttl result-survey-13.ttl EXPECTED_SPARQL_CORRECT = \ survey-1 \ survey-2 \ survey-3 \ survey-8 \ survey-9 \ survey-10 \ survey-11 \ survey-12 \ survey-13 # Test failures EXPECTED_SPARQL_CORRECT_FAILURES = EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/survey/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/survey/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ expect="NegativeTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/survey/query-survey-1.rq0000644000175000017500000000017510362621550017220 00000000000000prefix ex: SELECT ?n WHERE { ?x ex:author [ ?li [ ex:name ?n] ]. } rasqal-0.9.33/tests/sparql/survey/survey-sample.ttl0000644000175000017500000000546310362621550017364 00000000000000@prefix rdf: . @prefix rdfs: . @prefix ex: . @prefix : . @prefix dc: . @prefix acm: . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range . a acm:Topic ; acm:SubTopic ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . acm:SubTopic ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . a acm:Topic ; acm:SubTopic ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range . rasqal-0.9.33/tests/sparql/survey/query-survey-9.rq0000644000175000017500000000027210362621550017226 00000000000000prefix rdf: prefix ex: SELECT ?n WHERE { ?y ex:author [ rdf:_1 [ ex:name ?n] ]. } rasqal-0.9.33/tests/sparql/survey/result-survey-13.ttl0000644000175000017500000000101210362621550017624 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix ex: . [] rdf:type rs:ResultSet ; rs:resultVariable "PUB" ; rs:solution [ rs:binding [ rs:value ; rs:variable "PUB" ] ] . rasqal-0.9.33/tests/sparql/survey/result-survey-10.ttl0000644000175000017500000001047010362621550017631 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix ex: . [] rdf:type rs:ResultSet ; rs:resultVariable "R" ; rs:solution [ rs:binding [ rs:value ex:Publication ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:InProceedings ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:Person ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:Human ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:Topic ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:author ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:title ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:pages ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:year ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:isAbout ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:name ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:email ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ex:reified_triple ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "R" ] ] . rasqal-0.9.33/tests/sparql/survey/query-survey-2.rq0000644000175000017500000000027310362621550017220 00000000000000prefix ex: SELECT ?n ?addr WHERE { ?y ex:author [ ?li ?who ]. ?who ex:name ?n. OPTIONAL { ?who ex:email ?addr } } rasqal-0.9.33/tests/sparql/survey/manifest.ttl0000644000175000017500000001200610362621550016345 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Survey test cases" ; rdfs:comment "See http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0023.html" ; mf:entries ( [ mf:name "survey-1" ; rdfs:label "Survey q1: Path expression" ; rdfs:comment "Return the names of the authors of publication X" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-2" ; rdfs:label "Survey q2: optional path expression"; rdfs:comment "Return the name and, if known, the e-mail of the author of publication X" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-3" ; rdfs:label "Survey q3: Union "; rdfs:comment "Return the labels of all topics and (union) the titles of all publications." ; mf:action [ qt:query ; qt:data ] ; mf:result ] # [ mf:name "survey-4" ; # rdfs:label "Survey q4: Difference" ; # rdfs:comment "Return the labels of all topics that are not titles of publications." ; # mf:action # [ qt:query ; # qt:data ] ; # mf:result # ] # [ mf:name "survey-5" ; # rdfs:label "Survey q5: Quantification" ; # rdfs:comment "Return the persons who are authors of all publications." ; # mf:action # [ qt:query ; # qt:data ] ; # mf:result # ] # [ mf:name "survey-6" ; # rdfs:label "Survey q6: Aggregation" ; # rdfs:comment "Count the number of authors of a publication." ; # mf:action # [ qt:query ; # qt:data ] ; # mf:result # ] # [ mf:name "survey-7" ; # rdfs:label "Survey q7: Recursion" ; # rdfs:comment "Return all subtopics of topic "Information Systems", recursively." ; # mf:action # [ qt:query ; # qt:data ] ; # mf:result # ] [ mf:name "survey-8" ; rdfs:label "Survey q8: Reification" ; rdfs:comment "Return the person who has classified the publication X." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-9" ; rdfs:label "Survey q9: Collections and Containers" ; rdfs:comment "Return the first author of Publication X." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-10" ; rdfs:label "Survey q10: Namespace" ; rdfs:comment "Return all resources whose namespace starts with http://example.org/survey-sample/." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-11" ; rdfs:label "Survey q11: Language" ; rdfs:comment "Return the German label of the topic whose English label is 'Database Management'." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-12" ; rdfs:label "Survey q12: Lexical space" ; rdfs:comment "Return all publications where the page number is the lexical value '08'." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "survey-13" ; rdfs:label "Survey q13: Value space" ; rdfs:comment "Return all publications where the page number is the integer value 8." ; mf:action [ qt:query ; qt:data ] ; mf:result ] # [ mf:name "survey-14" ; # rdfs:label "Survey q14: Entailment" ; # rdfs:comment "Return all instances of that are members of the class Publication." ; # mf:action # [ qt:query ; # qt:data ] ; # mf:result # ] ). rasqal-0.9.33/tests/sparql/survey/result-survey-9.ttl0000644000175000017500000000064710362621550017566 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "n" ; rs:solution [ rs:binding [ rs:value "John"; rs:variable "n" ] ] . rasqal-0.9.33/tests/sparql/survey/query-survey-3.rq0000644000175000017500000000042510362621550017220 00000000000000prefix ex: prefix acm: prefix rdfs: SELECT ?title WHERE { { [] a acm:Topic; rdfs:label ?title } UNION { [] ex:title ?title }} rasqal-0.9.33/tests/sparql/survey/result-survey-11.ttl0000644000175000017500000000077010362621550017634 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix ex: . [] rdf:type rs:ResultSet ; rs:resultVariable "de" ; rs:solution [ rs:binding [ rs:value "Datenbankmanagement"@de ; rs:variable "de" ] ] . rasqal-0.9.33/tests/sparql/survey/result-survey-2.ttl0000644000175000017500000000214710362621550017554 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "n" ; rs:resultVariable "addr" ; rs:solution [ rs:binding [ rs:value "John" ; rs:variable "n" ] ] ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "n" ] ] ; rs:solution [ rs:binding [ rs:value "Mary" ; rs:variable "n" ] ; rs:binding [ rs:value "mary@example.org" ; rs:variable "addr" ] ] ; rs:solution [ rs:binding [ rs:value "Willy" ; rs:variable "n" ] ] . rasqal-0.9.33/tests/sparql/survey/query-survey-13.rq0000644000175000017500000000026710362621550017305 00000000000000prefix ex: PREFIX xsd: SELECT ?PUB WHERE { ?PUB ex:pages ?n. FILTER ( xsd:integer(?n) = 8 ) } rasqal-0.9.33/tests/sparql/survey/query-survey-11.rq0000644000175000017500000000023110362621550017272 00000000000000prefix rdfs: SELECT ?de WHERE { [ rdfs:label ?de, "Database Management"@en ]. FILTER ( lang(?de) = "de" ) } rasqal-0.9.33/tests/sparql/survey/result-survey-12.ttl0000644000175000017500000000101210362621550017623 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix ex: . [] rdf:type rs:ResultSet ; rs:resultVariable "PUB" ; rs:solution [ rs:binding [ rs:value ; rs:variable "PUB" ] ] . rasqal-0.9.33/tests/sparql/survey/query-survey-12.rq0000644000175000017500000000014410362621550017276 00000000000000prefix ex: SELECT ?PUB WHERE { ?PUB ex:pages "08" } rasqal-0.9.33/tests/sparql/survey/result-survey-8.ttl0000644000175000017500000000072010362621550017555 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "who" ; rs:solution [ rs:binding [ rs:value ; rs:variable "who" ] ] . rasqal-0.9.33/tests/sparql/survey/result-survey-1.ttl0000644000175000017500000000165110362621550017552 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "n" ; rs:solution [ rs:binding [ rs:value "John" ; rs:variable "n" ] ] ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "n" ] ] ; rs:solution [ rs:binding [ rs:value "Mary" ; rs:variable "n" ] ] ; rs:solution [ rs:binding [ rs:value "Willy" ; rs:variable "n" ] ] . rasqal-0.9.33/tests/sparql/survey/query-survey-8.rq0000644000175000017500000000060510362621550017225 00000000000000prefix rdfs: prefix rdf: prefix ex: prefix acm: prefix dc: SELECT ?who WHERE { [ rdf:subject ?work; rdf:predicate ex:isAbout; rdf:object ?topic ] dc:creator ?who } rasqal-0.9.33/tests/sparql/survey/result-survey-3.ttl0000644000175000017500000000364510362621550017561 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "title" ; rs:solution [ rs:binding [ rs:value "Query Languages"@en ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Anfragesprachen"@de ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "An Overview of RDF Query Languages" ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Information Systems"@en ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Informationsysteme"@de ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Database Management"@en ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Datenbankmanagement"@de ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Languages"@en ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "Sprachen"@de ; rs:variable "title" ] ] . rasqal-0.9.33/tests/sparql/sparql11/0000755000175000017500000000000012443715253014210 500000000000000rasqal-0.9.33/tests/sparql/sparql11/Makefile.am0000644000175000017500000000417311476100737016171 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL 1.1 tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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. # SPARQL_MODEL_FILES= \ data-1.ttl \ subquery-1.ttl EXPECTED_SPARQL_CORRECT= \ isnumeric-1.rq \ subquery-1.rq EXPECTED_SPARQL_CORRECT_FAILURES= EXTRA_DIST= \ $(SPARQL_MODEL_FILES) \ $(EXPECTED_SPARQL_CORRECT) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 expressions legal parsing\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/sparql11/Makefile.in0000644000175000017500000003414712434455633016211 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL 1.1 tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/sparql11 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MODEL_FILES = \ data-1.ttl \ subquery-1.ttl EXPECTED_SPARQL_CORRECT = \ isnumeric-1.rq \ subquery-1.rq EXPECTED_SPARQL_CORRECT_FAILURES = EXTRA_DIST = \ $(SPARQL_MODEL_FILES) \ $(EXPECTED_SPARQL_CORRECT) all: all-am .SUFFIXES: $(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 tests/sparql/sparql11/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/sparql11/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-parse-good" get-testsuite-sparql-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL 1.1 expressions legal parsing\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql parsing of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i sparql11 $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/sparql11/subquery-1.rq0000644000175000017500000000033211456234706016511 00000000000000PREFIX : PREFIX : SELECT ?y ?minName WHERE { :alice :knows ?y . { SELECT ?y (MIN(?name) AS ?minName) WHERE { ?y :name ?name . } GROUP BY ?y } } rasqal-0.9.33/tests/sparql/sparql11/subquery-1.ttl0000644000175000017500000000030711456234706016674 00000000000000@prefix : . :alice :name "Alice", "Alice Foo", "A. Foo" . :alice :knows :bob, :carol . :bob :name "Bob", "Bob Bar", "B. Bar" . :carol :name "Carol", "Carol Baz", "C. Baz" . rasqal-0.9.33/tests/sparql/sparql11/isnumeric-1.rq0000644000175000017500000000013211456102041016610 00000000000000PREFIX : SELECT * WHERE { ?s ?p ?o . FILTER isNUMERIC(?o) } rasqal-0.9.33/tests/sparql/sparql11/data-1.ttl0000644000175000017500000000040711456102041015711 00000000000000@prefix : . :org1 :affiliates :auth1, :auth2 . :auth1 :writesBook :book1, :book2 . :book1 :price 9 . :book2 :price 5 . :auth2 :writesBook :book3 . :book3 :price 7 . :org2 :affiliates :auth3 . :auth3 :writesBook :book4 . :book4 :price 7 . rasqal-0.9.33/tests/sparql/ExprBuiltins/0000755000175000017500000000000012443715252015173 500000000000000rasqal-0.9.33/tests/sparql/ExprBuiltins/result-str-2.ttl0000644000175000017500000000122010362621550020111 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x" ] ; rs:binding [ rs:value 01 ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-str-3.rq0000644000175000017500000000024710662234514016666 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "zzz" ) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/result-iri-1.ttl0000644000175000017500000000121710327500610020063 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v" ] ; rs:binding [ rs:value :xu ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-langMatches-2.rq0000644000175000017500000000013610343573175020305 00000000000000PREFIX : SELECT * { :x ?p ?v . FILTER langMatches(lang(?v), "en") . } rasqal-0.9.33/tests/sparql/ExprBuiltins/Makefile.am0000644000175000017500000001024012350617062017141 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= \ data-builtin-1.ttl \ data-langMatches.ttl SPARQL_TEST_FILES= \ q-blank-1.rq q-datatype-1.rq q-str-1.rq q-str-2.rq q-str-3.rq \ q-str-4.rq q-uri-1.rq \ q-langMatches-1.rq q-langMatches-2.rq q-langMatches-3.rq q-langMatches-4.rq \ q-iri-1.rq q-uri-1.rq EXPECTED_SPARQL_CORRECT= \ str-1 \ str-2 \ str-3 \ str-4 \ isBlank-1 \ isURI-1 \ isIRI-1 \ LangMatches-1 \ LangMatches-2 \ LangMatches-3 \ LangMatches-4 EXPECTED_SPARQL_CORRECT_FAILURES= SPARQL_RESULT_FILES= \ result-blank-1.ttl result-datatype-1.ttl result-str-1.ttl \ result-str-2.ttl result-str-3.ttl result-str-4.ttl result-uri-1.ttl \ result-langMatches-1.ttl result-langMatches-2.ttl \ result-langMatches-3.ttl result-langMatches-4.ttl \ result-iri-1.ttl result-uri-1.ttl EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/ExprBuiltins/Makefile.in0000644000175000017500000004031412434455633017166 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/ExprBuiltins DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = \ data-builtin-1.ttl \ data-langMatches.ttl SPARQL_TEST_FILES = \ q-blank-1.rq q-datatype-1.rq q-str-1.rq q-str-2.rq q-str-3.rq \ q-str-4.rq q-uri-1.rq \ q-langMatches-1.rq q-langMatches-2.rq q-langMatches-3.rq q-langMatches-4.rq \ q-iri-1.rq q-uri-1.rq EXPECTED_SPARQL_CORRECT = \ str-1 \ str-2 \ str-3 \ str-4 \ isBlank-1 \ isURI-1 \ isIRI-1 \ LangMatches-1 \ LangMatches-2 \ LangMatches-3 \ LangMatches-4 EXPECTED_SPARQL_CORRECT_FAILURES = SPARQL_RESULT_FILES = \ result-blank-1.ttl result-datatype-1.ttl result-str-1.ttl \ result-str-2.ttl result-str-3.ttl result-str-4.ttl result-uri-1.ttl \ result-langMatches-1.ttl result-langMatches-2.ttl \ result-langMatches-3.ttl result-langMatches-4.ttl \ result-iri-1.ttl result-uri-1.ttl EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/ExprBuiltins/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/ExprBuiltins/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/ExprBuiltins/result-datatype-1.ttl0000644000175000017500000000246512350617062021131 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd1 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd3 ; rs:variable "x" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x" ] ; rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/result-langMatches-3.ttl0000644000175000017500000000241110472572770021546 00000000000000@prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "v" ; rs:resultVariable "p" ; rs:solution [ rs:binding [ rs:value "abc"@en ; rs:variable "v" ] ; rs:binding [ rs:value :p3 ; rs:variable "p" ] ] ; rs:solution [ rs:binding [ rs:value :p4 ; rs:variable "p" ] ; rs:binding [ rs:value "abc"@en-gb ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :p5 ; rs:variable "p" ] ; rs:binding [ rs:value "abc"@fr ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/data-langMatches.ttl0000644000175000017500000000017310327500610020763 00000000000000@prefix : . :x :p1 "abc" . :x :p2 . :x :p3 "abc"@en . :x :p4 "abc"@en-gb . :x :p5 "abc"@fr . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-str-1.rq0000644000175000017500000000024510662234514016662 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "1" ) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/result-langMatches-2.ttl0000644000175000017500000000167210327500610021534 00000000000000@prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "p" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value :p3 ; rs:variable "p" ] ; rs:binding [ rs:value "abc"@en ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value "abc"@en-gb ; rs:variable "v" ] ; rs:binding [ rs:value :p4 ; rs:variable "p" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/manifest.ttl0000644000175000017500000000527111317766506017462 00000000000000# $Id$ @prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:label "Expr: Built-ins" ; mf:entries ( [ mf:name "str-1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "str-2" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "str-3" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "str-4" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "isBlank-1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "datatype-1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "isURI-1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "isIRI-1" ; mf:action [ qt:query ; qt:data ] ; # NB same result as before. mf:result ] [ mf:name "LangMatches-1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "LangMatches-2" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "LangMatches-3" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "LangMatches-4" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ). rasqal-0.9.33/tests/sparql/ExprBuiltins/result-langMatches-4.ttl0000644000175000017500000000114510472572770021552 00000000000000@prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "v" ; rs:resultVariable "p" ; rs:solution [ rs:binding [ rs:value "abc" ; rs:variable "v" ] ; rs:binding [ rs:value :p1 ; rs:variable "p" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-langMatches-1.rq0000644000175000017500000000014110343573175020300 00000000000000PREFIX : SELECT * { :x ?p ?v . FILTER langMatches(lang(?v), "en-GB") . } rasqal-0.9.33/tests/sparql/ExprBuiltins/result-str-4.ttl0000644000175000017500000000124010327500610020107 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value "" ; rs:variable "v" ] ; rs:binding [ rs:value :xp2 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/result-langMatches-1.ttl0000644000175000017500000000115310327500610021525 00000000000000@prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "p" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value "abc"@en-gb ; rs:variable "v" ] ; rs:binding [ rs:value :p4 ; rs:variable "p" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/result-str-1.ttl0000644000175000017500000000312010362621550020111 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd3 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xp2 ; rs:variable "x" ] ; rs:binding [ rs:value "1" ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xi2 ; rs:variable "x" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v" ] ; rs:binding [ rs:value :xi1 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-uri-1.rq0000644000175000017500000000023510214264001016633 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER isURI(?v) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/result-str-3.ttl0000644000175000017500000000173310362621550020123 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v" ] ; rs:binding [ rs:value :xt1 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xp1 ; rs:variable "x" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-iri-1.rq0000644000175000017500000000023510327500610016623 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER isURI(?v) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/q-datatype-1.rq0000644000175000017500000000026110662234514017663 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( datatype(?v) = xsd:double ) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/q-blank-1.rq0000644000175000017500000000023710214264001017125 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER isBlank(?v) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/q-str-4.rq0000644000175000017500000000024510662234514016665 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "" ) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/result-uri-1.ttl0000644000175000017500000000121710362621550020105 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v" ] ; rs:binding [ rs:value :xu ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-str-2.rq0000644000175000017500000000024610662234514016664 00000000000000PREFIX xsd: PREFIX : SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "01" ) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/data-builtin-1.ttl0000644000175000017500000000054512350617062020354 00000000000000@prefix : . @prefix xsd: . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0e0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xp2 :p "" . :xu :p :z . :xb :p _:a . rasqal-0.9.33/tests/sparql/ExprBuiltins/q-langMatches-4.rq0000644000175000017500000000014110343573175020303 00000000000000PREFIX : SELECT * { :x ?p ?v . FILTER (! langMatches(lang(?v), "*")) . } rasqal-0.9.33/tests/sparql/ExprBuiltins/q-langMatches-3.rq0000644000175000017500000000013510343573175020305 00000000000000PREFIX : SELECT * { :x ?p ?v . FILTER langMatches(lang(?v), "*") . } rasqal-0.9.33/tests/sparql/ExprBuiltins/result-blank-1.ttl0000644000175000017500000000127710662234514020406 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:resultVariable "v" ; rs:solution [ rs:binding [ rs:value :xb ; rs:variable "x" ] ; rs:binding [ rs:value [ ] ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/sort/0000755000175000017500000000000012443715252013532 500000000000000rasqal-0.9.33/tests/sparql/sort/query-sort-3.rq0000644000175000017500000000024710362621550016306 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox } } ORDER BY ASC(?mbox) rasqal-0.9.33/tests/sparql/sort/Makefile.am0000644000175000017500000000726612302411034015502 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= \ data-sort-1.ttl data-sort-3.ttl data-sort-4.ttl data-sort-6.ttl \ data-sort-7.ttl data-sort-8.ttl SPARQL_TEST_FILES= \ query-sort-1.rq query-sort-2.rq query-sort-3.rq query-sort-4.rq \ query-sort-5.rq query-sort-6.rq EXPECTED_SPARQL_CORRECT= \ "sort-1" \ "sort-2" \ "sort-3" \ "sort-4" \ "sort-5" \ "sort-6" \ "sort-7" \ "sort-8" SPARQL_RESULT_FILES= \ result-sort-1.rdf result-sort-2.rdf result-sort-3.rdf \ result-sort-4.rdf result-sort-5.rdf result-sort-6.rdf \ result-sort-7.rdf result-sort-8.rdf EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/sort/result-sort-1.rdf0000644000175000017500000000262510362621550016610 00000000000000 name 1 name Alice 2 name Bob 3 name Eve 4 name Fred rasqal-0.9.33/tests/sparql/sort/Makefile.in0000644000175000017500000003731012434455633015527 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/sort DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = \ data-sort-1.ttl data-sort-3.ttl data-sort-4.ttl data-sort-6.ttl \ data-sort-7.ttl data-sort-8.ttl SPARQL_TEST_FILES = \ query-sort-1.rq query-sort-2.rq query-sort-3.rq query-sort-4.rq \ query-sort-5.rq query-sort-6.rq EXPECTED_SPARQL_CORRECT = \ "sort-1" \ "sort-2" \ "sort-3" \ "sort-4" \ "sort-5" \ "sort-6" \ "sort-7" \ "sort-8" SPARQL_RESULT_FILES = \ result-sort-1.rdf result-sort-2.rdf result-sort-3.rdf \ result-sort-4.rdf result-sort-5.rdf result-sort-6.rdf \ result-sort-7.rdf result-sort-8.rdf EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/sort/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/sort/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/sort/result-sort-8.rdf0000644000175000017500000000306410362621550016615 00000000000000 name emp 1 name John emp 2 name Dirk emp 3 name Eve emp 9 rasqal-0.9.33/tests/sparql/sort/query-sort-1.rq0000644000175000017500000000015110362621550016276 00000000000000PREFIX foaf: SELECT ?name WHERE { ?x foaf:name ?name } ORDER BY ?name rasqal-0.9.33/tests/sparql/sort/query-sort-5.rq0000644000175000017500000000031010362621550016277 00000000000000PREFIX foaf: PREFIX ex: SELECT ?name ?emp WHERE { ?x foaf:name ?name ; ex:empId ?emp } ORDER BY ?name DESC(?emp) rasqal-0.9.33/tests/sparql/sort/result-sort-6.rdf0000644000175000017500000000275210362621550016616 00000000000000 address 1 address 2 address 3 address Fascination Street 11 4 address fred@work.example rasqal-0.9.33/tests/sparql/sort/manifest.ttl0000644000175000017500000000521410362621550016002 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . @prefix dawgt: . <> rdf:type mf:Manifest ; rdfs:comment "Sorting test cases." ; mf:entries ( [ mf:name "sort-1" ; rdfs:comment "Alphabetic sort (ascending) on untyped literals" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "sort-2" ; rdfs:comment "Alphabetic sort (descending) on untyped literals" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sort-3" ; rdfs:comment "Sort on (possibly unbound) URIs" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sort-4" ; rdfs:comment "Sort on datatyped (integer) literals" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sort-5" ; rdfs:comment "Sort first on untyped literals (ascending), then on datatyped (integer) literals (descending" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sort-6" ; rdfs:comment "Sort on mixed result of uris and literals." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sort-7" ; rdfs:comment "Sort on comparable mixed typed literals (integer and float)" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sort-8" ; rdfs:comment "Sort on several mixed values (bnode, uri, literal)" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ). rasqal-0.9.33/tests/sparql/sort/query-sort-2.rq0000644000175000017500000000015710362621550016305 00000000000000PREFIX foaf: SELECT ?name WHERE { ?x foaf:name ?name } ORDER BY DESC(?name) rasqal-0.9.33/tests/sparql/sort/data-sort-1.ttl0000644000175000017500000000031610362621550016226 00000000000000@prefix rdf: . @prefix foaf: . _:a foaf:name "Eve". _:b foaf:name "Alice" . _:c foaf:name "Fred" . _:e foaf:name "Bob" . rasqal-0.9.33/tests/sparql/sort/result-sort-4.rdf0000644000175000017500000000517610362621550016617 00000000000000 name emp 1 name Eve emp 9 2 name Bob emp 23 3 name Fred emp 27 4 name Alice emp 29 5 name Bob emp 30 rasqal-0.9.33/tests/sparql/sort/data-sort-6.ttl0000644000175000017500000000106710362621550016237 00000000000000@prefix rdf: . @prefix foaf: . @prefix ex: . @prefix xsd: . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:address . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:address "Fascination Street 11" . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:address "fred@work.example" . _:e foaf:name "Bob" ; ex:address . rasqal-0.9.33/tests/sparql/sort/result-sort-5.rdf0000644000175000017500000000517710362621550016621 00000000000000 name emp 1 name Alice emp 29 2 name Bob emp 30 3 name Bob emp 23 4 name Eve emp 9 5 name Fred emp 27 rasqal-0.9.33/tests/sparql/sort/query-sort-6.rq0000644000175000017500000000016710362621550016312 00000000000000PREFIX ex: SELECT ?address WHERE { ?x ex:address ?address } ORDER BY ASC(?address) rasqal-0.9.33/tests/sparql/sort/query-sort-4.rq0000644000175000017500000000030410362621550016301 00000000000000PREFIX foaf: PREFIX ex: SELECT ?name ?emp WHERE { ?x foaf:name ?name ; ex:empId ?emp } ORDER BY ASC(?emp) rasqal-0.9.33/tests/sparql/sort/data-sort-8.ttl0000644000175000017500000000064010362621550016235 00000000000000@prefix rdf: . @prefix foaf: . @prefix ex: . @prefix xsd: . _:a foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:f foaf:name "John" ; ex:empId [ ex:number "29"^^xsd:integer ] . _:g foaf:name "Dirk" ; ex:empId . rasqal-0.9.33/tests/sparql/sort/result-sort-7.rdf0000644000175000017500000000477010362621550016621 00000000000000 name emp 1 name Eve emp 9 2 name Bob emp 23.0 3 name Fred emp 27 4 name Alice emp 29 rasqal-0.9.33/tests/sparql/sort/result-sort-3.rdf0000644000175000017500000000364210362621550016612 00000000000000 name mbox 1 name Bob 2 name Alice mbox 3 name Eve mbox 4 name Fred mbox rasqal-0.9.33/tests/sparql/sort/data-sort-7.ttl0000644000175000017500000000106210362621550016233 00000000000000@prefix rdf: . @prefix foaf: . @prefix ex: . @prefix xsd: . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:empId "29"^^xsd:integer . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:empId "27"^^xsd:integer . _:e foaf:name "Bob" ; ex:empId "23.0"^^xsd:float . rasqal-0.9.33/tests/sparql/sort/result-sort-2.rdf0000644000175000017500000000262510362621550016611 00000000000000 name 1 name Fred 2 name Eve 3 name Bob 4 name Alice rasqal-0.9.33/tests/sparql/sort/data-sort-3.ttl0000644000175000017500000000065110362621550016232 00000000000000@prefix rdf: . @prefix foaf: . _:a rdf:type foaf:Person ; foaf:name "Eve" ; foaf:mbox . _:b rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox . _:c rdf:type foaf:Person ; foaf:mbox ; foaf:name "Fred" . _:e foaf:name "Bob" . rasqal-0.9.33/tests/sparql/sort/data-sort-4.ttl0000644000175000017500000000111610362621550016230 00000000000000@prefix rdf: . @prefix foaf: . @prefix ex: . @prefix xsd: . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:empId "29"^^xsd:integer . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:empId "27"^^xsd:integer . _:e foaf:name "Bob" ; ex:empId "23"^^xsd:integer . _:f foaf:name "Bob" ; ex:empId "30"^^xsd:integer . rasqal-0.9.33/tests/sparql/SyntaxDev/0000755000175000017500000000000012443715253014471 500000000000000rasqal-0.9.33/tests/sparql/SyntaxDev/Makefile.am0000644000175000017500000000311411031047556016440 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SUBDIRS=Syntax-SPARQL Syntax-SPARQL2 Syntax-SPARQL3 check-sparql-lexer: check-sparql-lexer-recursive check-sparql-parser: check-sparql-parser-recursive check-sparql-correct: check-sparql-correct-recursive check-sparql-lexer-recursive check-sparql-parser-recursive check-sparql-correct-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" != "."; then \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target ) \ || eval $$failcom; \ fi; \ done; \ test -z "$$fail" rasqal-0.9.33/tests/sparql/SyntaxDev/Makefile.in0000644000175000017500000005077612434455633016500 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/SyntaxDev DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SUBDIRS = Syntax-SPARQL Syntax-SPARQL2 Syntax-SPARQL3 all: all-recursive .SUFFIXES: $(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 tests/sparql/SyntaxDev/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/SyntaxDev/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: 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-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am check-sparql-lexer: check-sparql-lexer-recursive check-sparql-parser: check-sparql-parser-recursive check-sparql-correct: check-sparql-correct-recursive check-sparql-lexer-recursive check-sparql-parser-recursive check-sparql-correct-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" != "."; then \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target ) \ || eval $$failcom; \ fi; \ done; \ test -z "$$fail" # 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: rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/0000755000175000017500000000000012443715253017041 500000000000000rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-04.rq0000644000175000017500000000015210362621550022507 00000000000000PREFIX : SELECT ?x FROM :g1 FROM :g2 FROM NAMED :graph1 FROM NAMED :graph2 WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-05.rq0000644000175000017500000000012610362621550022165 00000000000000PREFIX : SELECT * WHERE { :x :p :z GRAPH ?g { :x :b ?a } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct06.rq0000644000175000017500000000002610362621550023774 00000000000000CONSTRUCT {} WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-02.rq0000644000175000017500000000013110362621550022502 00000000000000PREFIX : SELECT ?x FROM NAMED WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-general-03.rq0000644000175000017500000000005510362621550022500 00000000000000SELECT * WHERE { _:x FILTER(_:x < 3) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am0000644000175000017500000001164012302411034020777 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_TEST_FILES= \ syntax-bnode-01.rq syntax-bnode-02.rq syntax-bnode-03.rq \ syntax-dataset-01.rq syntax-dataset-02.rq syntax-dataset-03.rq \ syntax-dataset-04.rq syntax-esc-01.rq syntax-esc-02.rq \ syntax-esc-03.rq syntax-esc-04.rq syntax-form-ask-01.rq \ syntax-form-ask-02.rq syntax-form-construct01.rq \ syntax-form-construct02.rq syntax-form-construct03.rq \ syntax-form-construct04.rq syntax-form-construct05.rq \ syntax-form-construct06.rq syntax-form-describe01.rq \ syntax-form-describe02.rq syntax-form-select-01.rq \ syntax-form-select-02.rq syntax-function-01.rq syntax-function-02.rq \ syntax-function-03.rq syntax-function-04.rq syntax-general-01.rq \ syntax-general-02.rq syntax-general-03.rq syntax-graph-01.rq \ syntax-graph-03.rq syntax-graph-04.rq \ syntax-graph-05.rq syntax-keywords-01.rq \ syntax-keywords-02.rq syntax-keywords-03.rq syntax-lists-01.rq \ syntax-lists-02.rq syntax-lists-03.rq syntax-lists-04.rq \ syntax-lists-05.rq EXPECTED_SPARQL_CORRECT= \ "syntax-general-01.rq" \ "syntax-general-02.rq" \ "syntax-general-03.rq" \ "syntax-keywords-01.rq" \ "syntax-keywords-02.rq" \ "syntax-keywords-03.rq" \ "syntax-lists-01.rq" \ "syntax-lists-02.rq" \ "syntax-lists-03.rq" \ "syntax-lists-04.rq" \ "syntax-lists-05.rq" \ "syntax-bnode-01.rq" \ "syntax-bnode-02.rq" \ "syntax-bnode-03.rq" \ "syntax-function-01.rq" \ "syntax-function-02.rq" \ "syntax-function-03.rq" \ "syntax-function-04.rq" \ "syntax-form-select-01.rq" \ "syntax-form-select-02.rq" \ "syntax-form-ask-01.rq" \ "syntax-form-ask-02.rq" \ "syntax-form-construct01.rq" \ "syntax-form-construct02.rq" \ "syntax-form-construct03.rq" \ "syntax-form-construct04.rq" \ "syntax-form-construct05.rq" \ "syntax-form-construct06.rq" \ "syntax-form-describe01.rq" \ "syntax-form-describe02.rq" \ "syntax-dataset-01.rq" \ "syntax-dataset-02.rq" \ "syntax-dataset-03.rq" \ "syntax-dataset-04.rq" \ "syntax-graph-01.rq" \ "syntax-graph-03.rq" \ "syntax-graph-04.rq" \ "syntax-graph-05.rq" \ "syntax-esc-01.rq" \ "syntax-esc-02.rq" \ "syntax-esc-03.rq" \ "syntax-esc-04.rq" EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out build-roqet: @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-lexer-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-roqet build-sparql-lexer-test build-sparql-parser-test @$(PERL) $(srcdir)/../../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.in0000644000175000017500000004175512434455633021045 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/SyntaxDev/Syntax-SPARQL2 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_TEST_FILES = \ syntax-bnode-01.rq syntax-bnode-02.rq syntax-bnode-03.rq \ syntax-dataset-01.rq syntax-dataset-02.rq syntax-dataset-03.rq \ syntax-dataset-04.rq syntax-esc-01.rq syntax-esc-02.rq \ syntax-esc-03.rq syntax-esc-04.rq syntax-form-ask-01.rq \ syntax-form-ask-02.rq syntax-form-construct01.rq \ syntax-form-construct02.rq syntax-form-construct03.rq \ syntax-form-construct04.rq syntax-form-construct05.rq \ syntax-form-construct06.rq syntax-form-describe01.rq \ syntax-form-describe02.rq syntax-form-select-01.rq \ syntax-form-select-02.rq syntax-function-01.rq syntax-function-02.rq \ syntax-function-03.rq syntax-function-04.rq syntax-general-01.rq \ syntax-general-02.rq syntax-general-03.rq syntax-graph-01.rq \ syntax-graph-03.rq syntax-graph-04.rq \ syntax-graph-05.rq syntax-keywords-01.rq \ syntax-keywords-02.rq syntax-keywords-03.rq syntax-lists-01.rq \ syntax-lists-02.rq syntax-lists-03.rq syntax-lists-04.rq \ syntax-lists-05.rq EXPECTED_SPARQL_CORRECT = \ "syntax-general-01.rq" \ "syntax-general-02.rq" \ "syntax-general-03.rq" \ "syntax-keywords-01.rq" \ "syntax-keywords-02.rq" \ "syntax-keywords-03.rq" \ "syntax-lists-01.rq" \ "syntax-lists-02.rq" \ "syntax-lists-03.rq" \ "syntax-lists-04.rq" \ "syntax-lists-05.rq" \ "syntax-bnode-01.rq" \ "syntax-bnode-02.rq" \ "syntax-bnode-03.rq" \ "syntax-function-01.rq" \ "syntax-function-02.rq" \ "syntax-function-03.rq" \ "syntax-function-04.rq" \ "syntax-form-select-01.rq" \ "syntax-form-select-02.rq" \ "syntax-form-ask-01.rq" \ "syntax-form-ask-02.rq" \ "syntax-form-construct01.rq" \ "syntax-form-construct02.rq" \ "syntax-form-construct03.rq" \ "syntax-form-construct04.rq" \ "syntax-form-construct05.rq" \ "syntax-form-construct06.rq" \ "syntax-form-describe01.rq" \ "syntax-form-describe02.rq" \ "syntax-dataset-01.rq" \ "syntax-dataset-02.rq" \ "syntax-dataset-03.rq" \ "syntax-dataset-04.rq" \ "syntax-graph-01.rq" \ "syntax-graph-03.rq" \ "syntax-graph-04.rq" \ "syntax-graph-05.rq" \ "syntax-esc-01.rq" \ "syntax-esc-02.rq" \ "syntax-esc-03.rq" \ "syntax-esc-04.rq" EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-roqet: @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-lexer-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-roqet build-sparql-lexer-test build-sparql-parser-test @$(PERL) $(srcdir)/../../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-04.rq0000644000175000017500000000007710362621550022226 00000000000000PREFIX : SELECT * WHERE { ( 1 2 ) :p 1 } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-bnode-03.rq0000644000175000017500000000007610362621550022155 00000000000000PREFIX : SELECT * WHERE { [ :p :q ] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-03.rq0000644000175000017500000000004110362621550021630 00000000000000SELECT * WHERE {

"\tx" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-keywords-03.rq0000644000175000017500000000016510362621550022734 00000000000000# use keyword UNION as a namespace prefix PREFIX UNION: SELECT * WHERE { ?x UNION:foo ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-keywords-01.rq0000644000175000017500000000020410362621550022724 00000000000000# use keyword FILTER as a namespace prefix PREFIX FILTER: SELECT * WHERE { ?x FILTER:foo ?z FILTER (?z) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct01.rq0000644000175000017500000000007010362621550023766 00000000000000CONSTRUCT { ?s . ?s ?o } WHERE {?s ?p ?o} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-ask-01.rq0000644000175000017500000000000710362621550022575 00000000000000ASK {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-describe02.rq0000644000175000017500000000004710362621550023527 00000000000000DESCRIBE ?u WHERE { ?u . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct03.rq0000644000175000017500000000026010362621550023771 00000000000000PREFIX rdf: CONSTRUCT { [] rdf:subject ?s ; rdf:predicate ?p ; rdf:object ?o } WHERE {?s ?p ?o} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-02.rq0000644000175000017500000000010610362621550022704 00000000000000PREFIX q: SELECT * WHERE { FILTER (q:name( )) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-04.rq0000644000175000017500000000011310362621550022160 00000000000000PREFIX : SELECT * WHERE { GRAPH ?g { :x :b ?a } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-03.rq0000644000175000017500000000013010362621550022502 00000000000000PREFIX : SELECT ?x FROM NAMED :graph1 FROM NAMED :graph2 WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-01.rq0000644000175000017500000000010510362621550022702 00000000000000PREFIX q: SELECT * WHERE { FILTER (q:name()) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct02.rq0000644000175000017500000000007110362621550023770 00000000000000CONSTRUCT { ?s . ?s ?o .} WHERE {?s ?p ?o} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-bnode-01.rq0000644000175000017500000000007310362621550022150 00000000000000PREFIX : SELECT * WHERE { [] :p [] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/manifest.ttl0000644000175000017500000001406510704476156021326 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix mfx: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Syntax tests 2" ; mf:entries ( [ mf:name "syntax-general-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-general-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-general-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-keywords-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-keywords-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-keywords-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnode-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnode-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnode-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-function-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-function-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-function-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-function-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-select-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-select-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-ask-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-ask-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-construct01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-construct02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-construct03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-construct04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-construct05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-construct06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-describe01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-form-describe02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-dataset-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-dataset-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-dataset-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-dataset-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-graph-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-graph-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-graph-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-graph-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-esc-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-esc-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-esc-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-esc-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] ) . rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct04.rq0000644000175000017500000000026210362621550023774 00000000000000PREFIX rdf: CONSTRUCT { [] rdf:subject ?s ; rdf:predicate ?p ; rdf:object ?o . } WHERE {?s ?p ?o} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-01.rq0000644000175000017500000000004010362621550021625 00000000000000SELECT * WHERE {

"x\t" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-02.rq0000644000175000017500000000007310362621550022220 00000000000000PREFIX : SELECT * WHERE { ( ) :p 1 } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-01.rq0000644000175000017500000000010210362621550022153 00000000000000PREFIX : SELECT * WHERE { GRAPH ?g { } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-keywords-02.rq0000644000175000017500000000016510362621550022733 00000000000000# use keyword FILTER as a local name PREFIX : SELECT * WHERE { ?x :FILTER ?z FILTER (?z) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-03.rq0000644000175000017500000000010210362621550022155 00000000000000PREFIX : SELECT * WHERE { GRAPH :a { } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-05.rq0000644000175000017500000000007210362621550022222 00000000000000PREFIX : SELECT * WHERE { ( 1 2 ) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct05.rq0000644000175000017500000000002610362621550023773 00000000000000CONSTRUCT {} WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/0000755000175000017500000000000012443715253017042 500000000000000rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-03.rq0000644000175000017500000000004710362621550021076 00000000000000# DOT, no triples SELECT * WHERE { . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am0000644000175000017500000000750012302411034021000 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_TEST_FILES= \ syn-01.rq syn-02.rq syn-03.rq syn-04.rq syn-05.rq syn-06.rq syn-07.rq \ syn-08.rq SPARQL_TEST_BAD_FILES= \ syn-bad-01.rq syn-bad-02.rq syn-bad-03.rq syn-bad-04.rq syn-bad-05.rq \ syn-bad-06.rq syn-bad-07.rq syn-bad-08.rq syn-bad-09.rq syn-bad-10.rq \ bnode-dot.rq bnodes-missing-pvalues-01.rq \ bnodes-missing-pvalues-02.rq empty-optional-01.rq \ empty-optional-02.rq filter-missing-parens.rq lone-list.rq \ lone-node.rq EXPECTED_SPARQL_CORRECT= \ "syn-01.rq" \ "syn-02.rq" \ "syn-03.rq" \ "syn-04.rq" \ "syn-05.rq" \ "syn-06.rq" \ "syn-07.rq" \ "syn-08.rq" \ "syn-bad-01.rq" \ "syn-bad-02.rq" \ "syn-bad-03.rq" \ "syn-bad-04.rq" \ "syn-bad-05.rq" \ "syn-bad-06.rq" \ "syn-bad-07.rq" \ "syn-bad-08.rq" \ "syn-bad-09.rq" \ "syn-bad-10.rq" \ "bnode-dot.rq" \ "bnodes-missing-pvalues-01.rq" \ "bnodes-missing-pvalues-02.rq" \ "empty-optional-01.rq" \ "empty-optional-02.rq" \ "filter-missing-parens.rq" \ "lone-list.rq" \ "lone-node.rq" EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_TEST_BAD_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out build-roqet: @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-lexer-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-roqet build-sparql-lexer-test build-sparql-parser-test @$(PERL) $(srcdir)/../../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.in0000644000175000017500000003761612434455633021047 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/SyntaxDev/Syntax-SPARQL3 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_TEST_FILES = \ syn-01.rq syn-02.rq syn-03.rq syn-04.rq syn-05.rq syn-06.rq syn-07.rq \ syn-08.rq SPARQL_TEST_BAD_FILES = \ syn-bad-01.rq syn-bad-02.rq syn-bad-03.rq syn-bad-04.rq syn-bad-05.rq \ syn-bad-06.rq syn-bad-07.rq syn-bad-08.rq syn-bad-09.rq syn-bad-10.rq \ bnode-dot.rq bnodes-missing-pvalues-01.rq \ bnodes-missing-pvalues-02.rq empty-optional-01.rq \ empty-optional-02.rq filter-missing-parens.rq lone-list.rq \ lone-node.rq EXPECTED_SPARQL_CORRECT = \ "syn-01.rq" \ "syn-02.rq" \ "syn-03.rq" \ "syn-04.rq" \ "syn-05.rq" \ "syn-06.rq" \ "syn-07.rq" \ "syn-08.rq" \ "syn-bad-01.rq" \ "syn-bad-02.rq" \ "syn-bad-03.rq" \ "syn-bad-04.rq" \ "syn-bad-05.rq" \ "syn-bad-06.rq" \ "syn-bad-07.rq" \ "syn-bad-08.rq" \ "syn-bad-09.rq" \ "syn-bad-10.rq" \ "bnode-dot.rq" \ "bnodes-missing-pvalues-01.rq" \ "bnodes-missing-pvalues-02.rq" \ "empty-optional-01.rq" \ "empty-optional-02.rq" \ "filter-missing-parens.rq" \ "lone-list.rq" \ "lone-node.rq" EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_TEST_BAD_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-roqet: @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-lexer-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-roqet build-sparql-lexer-test build-sparql-parser-test @$(PERL) $(srcdir)/../../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-06.rq0000644000175000017500000000010410362621550020347 00000000000000# DOT after non-triples SELECT * WHERE { FILTER (?o>5) . ?s ?p ?o } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-06.rq0000644000175000017500000000011110362621550021071 00000000000000# Broken ; PREFIX : SELECT * WHERE { :s ; :p :o } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-07.rq0000644000175000017500000000010610362621550021076 00000000000000# Broken ; PREFIX : SELECT * WHERE { :s :p ; } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-02.rq0000644000175000017500000000006210362621550020346 00000000000000# No dot after triple SELECT * WHERE { ?s ?p ?o } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-05.rq0000644000175000017500000000005310362621550021075 00000000000000# Broken ; SELECT * WHERE { ; FILTER(?x) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/empty-optional-01.rq0000644000175000017500000000010510362621550022513 00000000000000# NegativeSyntax/empty-optional.rq SELECT * { OPTIONAL FILTER (?x) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-04.rq0000644000175000017500000000006210362621550021074 00000000000000# DOT, no triples SELECT * WHERE { . FILTER(?x) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/filter-missing-parens.rq0000644000175000017500000000011210362621550023534 00000000000000# NegativeSyntax/filter-missing-parens.rq SELECT * { ?s ?p ?o FILTER ?x } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-05.rq0000644000175000017500000000007310362621550020353 00000000000000# DOT after non-triples SELECT * WHERE { FILTER (?o>5) . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/manifest.ttl0000644000175000017500000000717110362621550021315 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix mfx: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Syntax tests 4" ; mf:entries ( [ mf:name "syn-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-07.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-08.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syn-bad-01.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-02.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-03.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-04.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-05.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-06.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-07.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-08.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-09.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "syn-bad-10.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "bnode-dot.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "bnodes-missing-pvalues-01.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "bnodes-missing-pvalues-02.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "empty-optional-01.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "empty-optional-02.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "filter-missing-parens.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "lone-list.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] [ mf:name "lone-node.rq" ; rdf:type mfx:TestBadSyntax ; mf:action ; ] ) . rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-03.rq0000644000175000017500000000005110362621550020345 00000000000000SELECT * WHERE { ?s ?p ?o . ?s ?p ?o . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-08.rq0000644000175000017500000000011310362621550020351 00000000000000# Broken ; PREFIX : SELECT * WHERE { :s :p :o ; . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-01.rq0000644000175000017500000000006110362621550020344 00000000000000# Dot after triple SELECT * WHERE { ?s ?p ?o . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-07.rq0000644000175000017500000000012610362621550020354 00000000000000# Trailing ; PREFIX : SELECT * WHERE { :s :p :o ; FILTER(?x) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/lone-node.rq0000644000175000017500000000006310362621550021177 00000000000000# NegativeSyntax/lone-node.rq SELECT * WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-04.rq0000644000175000017500000000006010362621550020346 00000000000000# No dot SELECT * WHERE { ?s ?p ?o . ?s ?p ?o } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/bnode-dot.rq0000644000175000017500000000006510362621550021174 00000000000000# NegativeSyntax/bnode-dot.rq SELECT * WHERE {[] . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-02.rq0000644000175000017500000000014510362621550021074 00000000000000# Missing DOT between triples PREFIX : SELECT * { :s1 :p1 :o1 :s2 :p2 :o2 . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/bnodes-missing-pvalues-01.rq0000644000175000017500000000015310362621550024133 00000000000000# NegativeSyntax/bnodes-missing-pvalues.rq PREFIX : SELECT * WHERE { [,] :p [;] . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/bnodes-missing-pvalues-02.rq0000644000175000017500000000012010362621550024126 00000000000000# NegativeSyntax/bnodes-missing-pvalues-02.rq SELECT * WHERE {() . [,] . [,;] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/lone-list.rq0000644000175000017500000000006410362621550021226 00000000000000# NegativeSyntax/lone-list.rq SELECT * WHERE { () } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-09.rq0000644000175000017500000000011410362621550021077 00000000000000# Broken ; PREFIX : SELECT * WHERE { :s :p :o . ; } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-10.rq0000644000175000017500000000001310362621550021065 00000000000000CONSTRUCT rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-08.rq0000644000175000017500000000012110362621550021074 00000000000000# Broken ; PREFIX : SELECT * WHERE { :s :p ; FILTER(?x) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/empty-optional-02.rq0000644000175000017500000000013210362621550022514 00000000000000# NegativeSyntax/empty-optional-02.rq SELECT * { OPTIONAL GRAPH ?v OPTIONAL FILTER (?x) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-01.rq0000644000175000017500000000012510362621550021071 00000000000000# More a test that bad syntax tests work! PREFIX ex: SELECT * rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/0000755000175000017500000000000012443715253016757 500000000000000rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-01.rq0000644000175000017500000000011210362621550022104 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-03.rq0000644000175000017500000000011610362621550021567 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p "x\"y'z" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-03.rq0000644000175000017500000000012110362621550022054 00000000000000# No trailing dot PREFIX : SELECT * WHERE { ?x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-01.rq0000644000175000017500000000005710362621550021565 00000000000000PREFIX : SELECT * { } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-05.rq0000644000175000017500000000013310362621550022113 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY DESC(:func(?s, ?o)) rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-02.rq0000644000175000017500000000001410362621550022054 00000000000000SELECT * {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-01.rq0000644000175000017500000000011110362621550022314 00000000000000# Operator PREFIX : SELECT * { OPTIONAL { } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-01.rq0000644000175000017500000000007110362621550022076 00000000000000PREFIX : SELECT * { ?x :p ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-08.rq0000644000175000017500000000014010362621550022102 00000000000000BASE PREFIX : <#> PREFIX x.y: SELECT * WHERE { :a.b x.y: : . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-limit-offset-07.rq0000644000175000017500000000012210362621550023402 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o LIMIT 5 rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am0000644000175000017500000001377712302411034020732 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_TEST_FILES= \ syntax-basic-01.rq syntax-basic-02.rq syntax-basic-03.rq \ syntax-basic-04.rq syntax-basic-05.rq syntax-basic-06.rq \ syntax-bnodes-01.rq syntax-bnodes-02.rq \ syntax-bnodes-05.rq syntax-bnodes-06.rq \ syntax-bnodes-07.rq syntax-expr-01.rq syntax-expr-02.rq \ syntax-expr-03.rq syntax-expr-04.rq syntax-expr-05.rq \ syntax-forms-01.rq syntax-forms-02.rq syntax-limit-offset-07.rq \ syntax-limit-offset-08.rq syntax-limit-offset-09.rq \ syntax-lists-01.rq syntax-lists-02.rq syntax-lists-03.rq \ syntax-lists-04.rq syntax-lists-05.rq syntax-lit-01.rq \ syntax-lit-02.rq syntax-lit-03.rq syntax-lit-04.rq syntax-lit-05.rq \ syntax-lit-06.rq syntax-lit-07.rq syntax-lit-08.rq syntax-lit-09.rq \ syntax-lit-10.rq syntax-lit-11.rq syntax-lit-12.rq syntax-lit-13.rq \ syntax-lit-14.rq syntax-order-01.rq syntax-order-02.rq \ syntax-order-03.rq syntax-order-04.rq syntax-order-05.rq \ syntax-order-06.rq syntax-pat-01.rq syntax-pat-02.rq syntax-pat-03.rq \ syntax-pat-04.rq syntax-qname-01.rq syntax-qname-02.rq \ syntax-qname-03.rq syntax-qname-04.rq syntax-qname-05.rq \ syntax-qname-06.rq syntax-qname-07.rq syntax-qname-08.rq \ syntax-struct-01.rq syntax-struct-02.rq syntax-struct-03.rq \ syntax-struct-04.rq syntax-struct-05.rq syntax-struct-06.rq \ syntax-struct-07.rq syntax-struct-08.rq syntax-struct-09.rq \ syntax-struct-10.rq syntax-struct-11.rq syntax-struct-12.rq \ syntax-union-01.rq syntax-union-02.rq EXPECTED_SPARQL_CORRECT= \ "syntax-basic-01.rq" \ "syntax-basic-02.rq" \ "syntax-basic-03.rq" \ "syntax-basic-04.rq" \ "syntax-basic-05.rq" \ "syntax-basic-06.rq" \ "syntax-qname-01.rq" \ "syntax-qname-02.rq" \ "syntax-qname-03.rq" \ "syntax-qname-04.rq" \ "syntax-qname-05.rq" \ "syntax-qname-06.rq" \ "syntax-qname-07.rq" \ "syntax-qname-08.rq" \ "syntax-lit-01.rq" \ "syntax-lit-02.rq" \ "syntax-lit-03.rq" \ "syntax-lit-04.rq" \ "syntax-lit-05.rq" \ "syntax-lit-06.rq" \ "syntax-lit-07.rq" \ "syntax-lit-08.rq" \ "syntax-lit-09.rq" \ "syntax-lit-10.rq" \ "syntax-lit-11.rq" \ "syntax-lit-12.rq" \ "syntax-lit-13.rq" \ "syntax-lit-14.rq" \ "syntax-struct-01.rq" \ "syntax-struct-02.rq" \ "syntax-struct-03.rq" \ "syntax-struct-04.rq" \ "syntax-struct-05.rq" \ "syntax-struct-06.rq" \ "syntax-struct-07.rq" \ "syntax-struct-08.rq" \ "syntax-struct-09.rq" \ "syntax-struct-10.rq" \ "syntax-struct-11.rq" \ "syntax-struct-12.rq" \ "syntax-lists-01.rq" \ "syntax-lists-02.rq" \ "syntax-lists-03.rq" \ "syntax-lists-04.rq" \ "syntax-lists-05.rq" \ "syntax-bnodes-01.rq" \ "syntax-bnodes-02.rq" \ "syntax-bnodes-05.rq" \ "syntax-bnodes-06.rq" \ "syntax-bnodes-07.rq" \ "syntax-forms-01.rq" \ "syntax-forms-02.rq" \ "syntax-union-01.rq" \ "syntax-union-02.rq" \ "syntax-expr-01.rq" \ "syntax-expr-02.rq" \ "syntax-expr-03.rq" \ "syntax-expr-04.rq" \ "syntax-expr-05.rq" \ "syntax-order-01.rq" \ "syntax-order-02.rq" \ "syntax-order-03.rq" \ "syntax-order-04.rq" \ "syntax-order-05.rq" \ "syntax-order-06.rq" \ "syntax-limit-offset-07.rq" \ "syntax-limit-offset-08.rq" \ "syntax-limit-offset-09.rq" \ "syntax-pat-01.rq" \ "syntax-pat-02.rq" \ "syntax-pat-03.rq" \ "syntax-pat-04.rq" EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out build-roqet: @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-lexer-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-roqet build-sparql-lexer-test build-sparql-parser-test @$(PERL) $(srcdir)/../../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.in0000644000175000017500000004411012434455633020747 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/SyntaxDev/Syntax-SPARQL DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_TEST_FILES = \ syntax-basic-01.rq syntax-basic-02.rq syntax-basic-03.rq \ syntax-basic-04.rq syntax-basic-05.rq syntax-basic-06.rq \ syntax-bnodes-01.rq syntax-bnodes-02.rq \ syntax-bnodes-05.rq syntax-bnodes-06.rq \ syntax-bnodes-07.rq syntax-expr-01.rq syntax-expr-02.rq \ syntax-expr-03.rq syntax-expr-04.rq syntax-expr-05.rq \ syntax-forms-01.rq syntax-forms-02.rq syntax-limit-offset-07.rq \ syntax-limit-offset-08.rq syntax-limit-offset-09.rq \ syntax-lists-01.rq syntax-lists-02.rq syntax-lists-03.rq \ syntax-lists-04.rq syntax-lists-05.rq syntax-lit-01.rq \ syntax-lit-02.rq syntax-lit-03.rq syntax-lit-04.rq syntax-lit-05.rq \ syntax-lit-06.rq syntax-lit-07.rq syntax-lit-08.rq syntax-lit-09.rq \ syntax-lit-10.rq syntax-lit-11.rq syntax-lit-12.rq syntax-lit-13.rq \ syntax-lit-14.rq syntax-order-01.rq syntax-order-02.rq \ syntax-order-03.rq syntax-order-04.rq syntax-order-05.rq \ syntax-order-06.rq syntax-pat-01.rq syntax-pat-02.rq syntax-pat-03.rq \ syntax-pat-04.rq syntax-qname-01.rq syntax-qname-02.rq \ syntax-qname-03.rq syntax-qname-04.rq syntax-qname-05.rq \ syntax-qname-06.rq syntax-qname-07.rq syntax-qname-08.rq \ syntax-struct-01.rq syntax-struct-02.rq syntax-struct-03.rq \ syntax-struct-04.rq syntax-struct-05.rq syntax-struct-06.rq \ syntax-struct-07.rq syntax-struct-08.rq syntax-struct-09.rq \ syntax-struct-10.rq syntax-struct-11.rq syntax-struct-12.rq \ syntax-union-01.rq syntax-union-02.rq EXPECTED_SPARQL_CORRECT = \ "syntax-basic-01.rq" \ "syntax-basic-02.rq" \ "syntax-basic-03.rq" \ "syntax-basic-04.rq" \ "syntax-basic-05.rq" \ "syntax-basic-06.rq" \ "syntax-qname-01.rq" \ "syntax-qname-02.rq" \ "syntax-qname-03.rq" \ "syntax-qname-04.rq" \ "syntax-qname-05.rq" \ "syntax-qname-06.rq" \ "syntax-qname-07.rq" \ "syntax-qname-08.rq" \ "syntax-lit-01.rq" \ "syntax-lit-02.rq" \ "syntax-lit-03.rq" \ "syntax-lit-04.rq" \ "syntax-lit-05.rq" \ "syntax-lit-06.rq" \ "syntax-lit-07.rq" \ "syntax-lit-08.rq" \ "syntax-lit-09.rq" \ "syntax-lit-10.rq" \ "syntax-lit-11.rq" \ "syntax-lit-12.rq" \ "syntax-lit-13.rq" \ "syntax-lit-14.rq" \ "syntax-struct-01.rq" \ "syntax-struct-02.rq" \ "syntax-struct-03.rq" \ "syntax-struct-04.rq" \ "syntax-struct-05.rq" \ "syntax-struct-06.rq" \ "syntax-struct-07.rq" \ "syntax-struct-08.rq" \ "syntax-struct-09.rq" \ "syntax-struct-10.rq" \ "syntax-struct-11.rq" \ "syntax-struct-12.rq" \ "syntax-lists-01.rq" \ "syntax-lists-02.rq" \ "syntax-lists-03.rq" \ "syntax-lists-04.rq" \ "syntax-lists-05.rq" \ "syntax-bnodes-01.rq" \ "syntax-bnodes-02.rq" \ "syntax-bnodes-05.rq" \ "syntax-bnodes-06.rq" \ "syntax-bnodes-07.rq" \ "syntax-forms-01.rq" \ "syntax-forms-02.rq" \ "syntax-union-01.rq" \ "syntax-union-02.rq" \ "syntax-expr-01.rq" \ "syntax-expr-02.rq" \ "syntax-expr-03.rq" \ "syntax-expr-04.rq" \ "syntax-expr-05.rq" \ "syntax-order-01.rq" \ "syntax-order-02.rq" \ "syntax-order-03.rq" \ "syntax-order-04.rq" \ "syntax-order-05.rq" \ "syntax-order-06.rq" \ "syntax-limit-offset-07.rq" \ "syntax-limit-offset-08.rq" \ "syntax-limit-offset-09.rq" \ "syntax-pat-01.rq" \ "syntax-pat-02.rq" \ "syntax-pat-03.rq" \ "syntax-pat-04.rq" EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-roqet: @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-lexer-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-roqet build-sparql-lexer-test build-sparql-parser-test @$(PERL) $(srcdir)/../../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-04.rq0000644000175000017500000000003610362621550022137 00000000000000SELECT * WHERE { ( ( ?z ) ) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-01.rq0000644000175000017500000000002310362621550022053 00000000000000SELECT * WHERE { } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-07.rq0000644000175000017500000000013210362621550022325 00000000000000# Operator, no DOT PREFIX : SELECT * { OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-02.rq0000644000175000017500000000007610362621550022255 00000000000000PREFIX : SELECT * WHERE { [] :p :q } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-05.rq0000644000175000017500000000021610362621550021760 00000000000000PREFIX : PREFIX xsd: SELECT * WHERE { ?s ?p ?o . FILTER :myFunc(?s,?o) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-06.rq0000644000175000017500000000016110362621550022326 00000000000000# Triple, DOT, operator, DOT PREFIX : SELECT * { :p :q :r . OPTIONAL { :a :b :c } . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-04.rq0000644000175000017500000000023710362621550021570 00000000000000# No DOT between non-triples patterns PREFIX : SELECT * { OPTIONAL{:x :y :z} ?a :b :c { :x1 :y1 :z1 } UNION { :x2 :y2 :z2 } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-09.rq0000644000175000017500000000013410362621550021575 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p """Long "" Literal """ } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-04.rq0000644000175000017500000000015210362621550022324 00000000000000# Triple, DOT, operator PREFIX : SELECT * { :p :q :r . OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-03.rq0000644000175000017500000000007310362621550021757 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER REGEX(?o, "foo", "i") } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-05.rq0000644000175000017500000000005110362621550022100 00000000000000PREFIX : <> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-12.rq0000644000175000017500000000013310362621550021566 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p '''Long''\'Literal''' } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-03.rq0000644000175000017500000000023510362621550021565 00000000000000# No DOT between non-triples patterns PREFIX : SELECT * { ?a :b :c OPTIONAL{:x :y :z} { :x1 :y1 :z1 } UNION { :x2 :y2 :z2 } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-01.rq0000644000175000017500000000007610362621550022254 00000000000000PREFIX : SELECT * WHERE { [:p :q ] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-07.rq0000644000175000017500000000014010362621550022252 00000000000000PREFIX : SELECT * WHERE { _:a :p1 :q1 . _:a :p2 :q2 . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/manifest.ttl0000644000175000017500000002332110704475734021240 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix mfx: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Syntax tests 1" ; mf:entries ( [ mf:name "syntax-basic-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-basic-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-basic-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-basic-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-basic-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-basic-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-07.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-qname-08.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-07.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-08.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-09.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-10.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-11.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-12.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-13.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lit-14.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-07.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-08.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-09.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-10.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-11.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-struct-12.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-lists-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnodes-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnodes-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnodes-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnodes-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-bnodes-07.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-forms-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-forms-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-union-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-union-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-expr-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-expr-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-expr-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-expr-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-expr-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-order-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-order-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-order-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-order-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-order-05.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-order-06.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-limit-offset-07.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-limit-offset-08.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-limit-offset-09.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-pat-01.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-pat-02.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-pat-03.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] [ mf:name "syntax-pat-04.rq" ; rdf:type mfx:TestSyntax ; mf:action ; ] ) . rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-02.rq0000644000175000017500000000006610362621550021760 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER REGEX(?o, "foo") } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-02.rq0000644000175000017500000000012210362621550022317 00000000000000# Operator PREFIX : SELECT * { OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-limit-offset-08.rq0000644000175000017500000000013310362621550023405 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o LIMIT 5 OFFSET 3 rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-03.rq0000644000175000017500000000011010362621550022072 00000000000000PREFIX : SELECT * WHERE { :_1 :p.rdf :z.z . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-14.rq0000644000175000017500000000013310362621550021570 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p '''Long\'''Literal''' } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-11.rq0000644000175000017500000000013310362621550021565 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p """Long""\"Literal""" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-03.rq0000644000175000017500000000011710362621550022113 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ASC(?o) rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-05.rq0000644000175000017500000000010710362621550022062 00000000000000# Two triples : no trailing dot SELECT * WHERE { ?x ?y ?z . ?a ?b ?c } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-union-02.rq0000644000175000017500000000014410362621550022127 00000000000000PREFIX : SELECT * { { ?s ?p ?o } UNION { ?a ?b ?c } UNION { ?r ?s ?t } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-06.rq0000644000175000017500000000011310362621550022060 00000000000000# Two triples : with trailing dot SELECT * WHERE { ?x ?y ?z . ?a ?b ?c . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-04.rq0000644000175000017500000000011610362621550021570 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 'x"y\'z' } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-09.rq0000644000175000017500000000014310362621550022331 00000000000000# Operator, triple PREFIX : SELECT * { OPTIONAL { :a :b :c } ?x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-05.rq0000644000175000017500000000011310362621550021566 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p "x\"" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-05.rq0000644000175000017500000000011510362621550022252 00000000000000PREFIX : SELECT * WHERE { [ ?x ?y ] :p [ ?pa ?b ] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-02.rq0000644000175000017500000000011610362621550022111 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY (?o+5) rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-01.rq0000644000175000017500000000005210362621550021752 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER (?o) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-05.rq0000644000175000017500000000015210362621550022325 00000000000000# Triple, DOT, operator PREFIX : SELECT * { :p :q :r . OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-02.rq0000644000175000017500000000015410362621550021564 00000000000000# No DOT after optional PREFIX : SELECT * { ?a :b :c OPTIONAL{:x :y :z} :x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-01.rq0000644000175000017500000000011110362621550021560 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p "x" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-03.rq0000644000175000017500000000003210362621550022132 00000000000000SELECT * WHERE { ( ?z ) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-08.rq0000644000175000017500000000013110362621550022325 00000000000000# Operator, DOT PREFIX : SELECT * { OPTIONAL { :a :b :c } . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-union-01.rq0000644000175000017500000000012210362621550022122 00000000000000PREFIX : SELECT * { { ?s ?p ?o } UNION { ?a ?b ?c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-limit-offset-09.rq0000644000175000017500000000012310362621550023405 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o OFFSET 3 rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-02.rq0000644000175000017500000000010110362621550022071 00000000000000PREFIX : SELECT * WHERE { :x :p :z . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-10.rq0000644000175000017500000000015110362621550022320 00000000000000# Operator, DOT triple PREFIX : SELECT * { OPTIONAL { :a :b :c } . ?x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-forms-01.rq0000644000175000017500000000013010362621550022117 00000000000000PREFIX : SELECT * WHERE { ( [ ?x ?y ] ) :p ( [ ?pa ?b ] 57 ) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-04.rq0000644000175000017500000000015610362621550022105 00000000000000PREFIX : PREFIX a: SELECT * WHERE { : a: :a . : : : . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-11.rq0000644000175000017500000000015210362621550022322 00000000000000# Triple, semi, operator PREFIX : SELECT * { :p :q :r ; OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-06.rq0000644000175000017500000000015110362621550022114 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY DESC(?o+57) :func2(?o) ASC(?s) rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-06.rq0000644000175000017500000000011310362621550021567 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 'x\'' } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-04.rq0000644000175000017500000000006210362621550022061 00000000000000# With trailing dot SELECT * WHERE { ?x ?y ?z . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-04.rq0000644000175000017500000000012010362621550022106 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY DESC(?o) rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-06.rq0000644000175000017500000000005210362621550022102 00000000000000PREFIX : <#> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-07.rq0000644000175000017500000000010710362621550022104 00000000000000BASE PREFIX : <#> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-13.rq0000644000175000017500000000013310362621550021567 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p """Long\"""Literal""" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-01.rq0000644000175000017500000000010410362621550022130 00000000000000PREFIX : SELECT * WHERE { ( ?x ) :p ?z } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-02.rq0000644000175000017500000000011110362621550021561 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 'x' } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-07.rq0000644000175000017500000000011110362621550021566 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 123 } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-03.rq0000644000175000017500000000015310362621550022324 00000000000000# Triple, no DOT, operator PREFIX : SELECT * { :p :q :r OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-02.rq0000644000175000017500000000010310362621550022130 00000000000000PREFIX : SELECT * WHERE { ?x :p ( ?z ) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-08.rq0000644000175000017500000000011410362621550021572 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 123. . } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-06.rq0000644000175000017500000000010210362621550022247 00000000000000PREFIX : SELECT * WHERE { [ :p :q ; ] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-12.rq0000644000175000017500000000016110362621550022323 00000000000000# Triple, semi, DOT, operator PREFIX : SELECT * { :p :q :r ; . OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-04.rq0000644000175000017500000000014710362621550021762 00000000000000PREFIX xsd: SELECT * WHERE { ?s ?p ?o . FILTER xsd:integer(?o) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-10.rq0000644000175000017500000000013710362621550021570 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p '''Long '' """ Literal''' } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-forms-02.rq0000644000175000017500000000007710362621550022132 00000000000000PREFIX : SELECT * WHERE { ( [] [] ) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-05.rq0000644000175000017500000000003310362621550022135 00000000000000SELECT * WHERE { ( ( ) ) } rasqal-0.9.33/tests/sparql/part1/0000755000175000017500000000000012443715252013572 500000000000000rasqal-0.9.33/tests/sparql/part1/Makefile.am0000644000175000017500000000723512302411034015536 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ dawg-data-01.n3 SPARQL_TEST_FILES= \ dawg-query-001.rq dawg-query-002.rq dawg-query-003.rq dawg-query-004.rq SPARQL_TEST_NAMES= \ dawg-opt-query-001 \ dawg-opt-query-002 \ dawg-opt-query-003 \ dawg-opt-query-004 EXPECTED_SPARQL_CORRECT_FAILURES= \ dawg-opt-query-001 \ dawg-opt-query-002 \ dawg-opt-query-003 \ dawg-opt-query-004 SPARQL_RESULT_FILES= \ dawg-result-001.n3 dawg-result-002.n3 dawg-result-003.n3 dawg-result-004.n3 EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/part1/Makefile.in0000644000175000017500000003726412434455633015577 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/part1 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ dawg-data-01.n3 SPARQL_TEST_FILES = \ dawg-query-001.rq dawg-query-002.rq dawg-query-003.rq dawg-query-004.rq SPARQL_TEST_NAMES = \ dawg-opt-query-001 \ dawg-opt-query-002 \ dawg-opt-query-003 \ dawg-opt-query-004 EXPECTED_SPARQL_CORRECT_FAILURES = \ dawg-opt-query-001 \ dawg-opt-query-002 \ dawg-opt-query-003 \ dawg-opt-query-004 SPARQL_RESULT_FILES = \ dawg-result-001.n3 dawg-result-002.n3 dawg-result-003.n3 dawg-result-004.n3 EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/part1/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/part1/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/part1/dawg-data-01.n30000644000175000017500000000126410362621550016021 00000000000000@prefix foaf: . @prefix rdf: . @prefix rdfs: . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox ; foaf:mbox ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox . rasqal-0.9.33/tests/sparql/part1/dawg-query-003.rq0000644000175000017500000000047310362621550016442 00000000000000# Get names and mboxes, each of which may be optional. PREFIX foaf: PREFIX rdf: SELECT ?name ?mbox WHERE { { ?person rdf:type foaf:Person } . OPTIONAL { ?person foaf:name ?name } . OPTIONAL {?person foaf:mbox ?mbox} . } rasqal-0.9.33/tests/sparql/part1/dawg-query-004.rq0000644000175000017500000000022510362621550016436 00000000000000# Get optional get the mbox, of each person PREFIX foaf: SELECT ?name WHERE { OPTIONAL { ?person foaf:name ?name } } rasqal-0.9.33/tests/sparql/part1/manifest.n30000644000175000017500000000304510362621550015557 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Some DAWG test cases" ; mf:entries ([ mf:name "dawg-opt-query-001" ; rdfs:comment "Optional triples: single optional triple case." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "dawg-opt-query-002" ; rdfs:comment "Optional triples: multiple triples in one optional clause. Must find a name for each person known." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "dawg-opt-query-003" ; rdfs:comment "Optional triples: multiple optional clauses." ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "dawg-opt-query-004" ; rdfs:comment "Optional triples: just a single optional clauses." ; mf:action [ qt:query ; qt:data ] ; mf:result ] # End of tests ). rasqal-0.9.33/tests/sparql/part1/dawg-result-002.n30000644000175000017500000000170410362621550016506 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "name2" , "name" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name2" ] ; rs:binding [ rs:value "Bob" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ; rs:binding [ rs:value "Bob" ; rs:variable "name2" ] ] ; rs:solution [ rs:binding [ rs:value "Eve" ; rs:variable "name" ] ] . rasqal-0.9.33/tests/sparql/part1/dawg-result-001.n30000644000175000017500000000241110362621550016501 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "mbox" , "name" ; rs:solution [ rs:binding [ rs:value ; rs:variable "mbox" ] ; rs:binding [ rs:value "Bob" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] ; rs:solution [ rs:binding [ rs:value "Eve" ; rs:variable "name" ] ] . rasqal-0.9.33/tests/sparql/part1/dawg-result-003.n30000644000175000017500000000266010362621550016511 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "mbox" , "name" ; rs:solution [ rs:binding [ rs:value ; rs:variable "mbox" ] ; rs:binding [ rs:value "Bob" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "mbox" ] ] ; rs:solution [ rs:binding [ rs:value "Eve" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/part1/dawg-query-002.rq0000644000175000017500000000040510362621550016434 00000000000000# Get names of people, together with the names of people they know. PREFIX foaf: SELECT ?name ?name2 WHERE { ?person foaf:name ?name . OPTIONAL { ?person foaf:knows ?p2 . ?p2 foaf:name ?name2 . } } rasqal-0.9.33/tests/sparql/part1/dawg-query-001.rq0000644000175000017500000000030210362621550016427 00000000000000# Get name, and optionally the mbox, of each person PREFIX foaf: SELECT ?name ?mbox WHERE { ?person foaf:name ?name . OPTIONAL { ?person foaf:mbox ?mbox} }rasqal-0.9.33/tests/sparql/part1/dawg-result-004.n30000644000175000017500000000136510362621550016513 00000000000000@prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "name" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Eve" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "name" ] ] . rasqal-0.9.33/tests/sparql/SyntaxFull/0000755000175000017500000000000012443715252014654 500000000000000rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-order-01.rq0000644000175000017500000000011210362621550020002 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-03.rq0000644000175000017500000000011610362621550017465 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p "x\"y'z" } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-11.rq0000644000175000017500000000005110362621550017773 00000000000000PREFIX : <> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-basic-03.rq0000644000175000017500000000012110362621550017752 00000000000000# No trailing dot PREFIX : SELECT * WHERE { ?x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-pat-01.rq0000644000175000017500000000005710362621550017463 00000000000000PREFIX : SELECT * { } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-order-05.rq0000644000175000017500000000013310362621550020011 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY DESC(:func(?s, ?o)) rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-basic-02.rq0000644000175000017500000000001410362621550017752 00000000000000SELECT * {} rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-01.rq0000644000175000017500000000011110362621550020212 00000000000000# Operator PREFIX : SELECT * { OPTIONAL { } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-01.rq0000644000175000017500000000007110362621550017774 00000000000000PREFIX : SELECT * { ?x :p ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-08.rq0000644000175000017500000000014210362621550020002 00000000000000BASE PREFIX : <#> PREFIX x.y: SELECT * WHERE { :a.b x.y: : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-limit-offset-07.rq0000644000175000017500000000012210362621550021300 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o LIMIT 5 rasqal-0.9.33/tests/sparql/SyntaxFull/Makefile.am0000644000175000017500000001252612350617062016633 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SyntaxFull SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= empty.nt SPARQL_TEST_FILES_CORE= \ syntax-basic-01.rq syntax-basic-02.rq syntax-basic-03.rq \ syntax-basic-04.rq syntax-basic-05.rq syntax-basic-06.rq \ syntax-bnodes-01.rq syntax-bnodes-02.rq \ syntax-bnodes-05.rq syntax-bnodes-06.rq \ syntax-bnodes-07.rq \ syntax-expr-01.rq syntax-expr-02.rq syntax-expr-03.rq \ syntax-expr-04.rq syntax-expr-05.rq syntax-expr-06.rq \ syntax-forms-01.rq syntax-forms-02.rq \ syntax-limit-offset-07.rq syntax-limit-offset-07.rq \ syntax-limit-offset-09.rq \ syntax-lists-01.rq syntax-lists-02.rq syntax-lists-03.rq \ syntax-lists-04.rq syntax-lists-05.rq \ syntax-lit-01.rq syntax-lit-02.rq syntax-lit-03.rq syntax-lit-04.rq \ syntax-lit-05.rq syntax-lit-06.rq syntax-lit-07.rq syntax-lit-08.rq \ syntax-lit-09.rq syntax-lit-10.rq syntax-lit-11.rq syntax-lit-12.rq \ syntax-lit-13.rq syntax-lit-14.rq \ syntax-order-01.rq syntax-order-02.rq syntax-order-03.rq \ syntax-order-04.rq syntax-order-05.rq syntax-order-06.rq \ syntax-pat-01.rq syntax-pat-02.rq syntax-pat-03.rq syntax-pat-04.rq \ syntax-qname-07.rq syntax-qname-08.rq syntax-qname-09.rq \ syntax-qname-10.rq syntax-qname-11.rq syntax-qname-12.rq \ syntax-qname-13.rq syntax-qname-14.rq \ syntax-struct-01.rq syntax-struct-02.rq \ syntax-struct-03.rq syntax-struct-04.rq syntax-struct-05.rq \ syntax-struct-06.rq syntax-struct-07.rq syntax-struct-08.rq \ syntax-struct-09.rq syntax-struct-10.rq \ syntax-union-01.rq syntax-union-02.rq SPARQL_TEST_FILES=$(SPARQL_TEST_FILES_CORE) \ syntax-keywords-01.rq syntax-keywords-02.rq syntax-keywords-03.rq \ syntax-qname-01.rq syntax-qname-02.rq syntax-qname-03.rq \ syntax-qname-04.rq syntax-qname-05.rq syntax-qname-06.rq \ syntax-struct-11.rq syntax-struct-12.rq SPARQL_TEST_NAMES=$(SPARQL_TEST_FILES_CORE) \ "keyword FILTER as a namespace prefix" \ "keyword FILTER as a local name" \ "keyword UNION as a namespace prefix" EXPECTED_SPARQL_PARSER_FAILURES= EXPECTED_SPARQL_PARSER_FAILURES_COUNT= 0 EXPECTED_SPARQL_CORRECT_FAILURES= \ $(EXPECTED_SPARQL_PARSER_FAILURES) EXPECTED_SPARQL_CORRECT_FAILURES_COUNT = \ $(EXPECTED_SPARQL_PARSER_FAILURES_COUNT) EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ expect="PositiveTest"; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(SPARQL_TEST_NAMES); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/SyntaxFull/Makefile.in0000644000175000017500000004257612434455633016663 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SyntaxFull SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/SyntaxFull DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = empty.nt SPARQL_TEST_FILES_CORE = \ syntax-basic-01.rq syntax-basic-02.rq syntax-basic-03.rq \ syntax-basic-04.rq syntax-basic-05.rq syntax-basic-06.rq \ syntax-bnodes-01.rq syntax-bnodes-02.rq \ syntax-bnodes-05.rq syntax-bnodes-06.rq \ syntax-bnodes-07.rq \ syntax-expr-01.rq syntax-expr-02.rq syntax-expr-03.rq \ syntax-expr-04.rq syntax-expr-05.rq syntax-expr-06.rq \ syntax-forms-01.rq syntax-forms-02.rq \ syntax-limit-offset-07.rq syntax-limit-offset-07.rq \ syntax-limit-offset-09.rq \ syntax-lists-01.rq syntax-lists-02.rq syntax-lists-03.rq \ syntax-lists-04.rq syntax-lists-05.rq \ syntax-lit-01.rq syntax-lit-02.rq syntax-lit-03.rq syntax-lit-04.rq \ syntax-lit-05.rq syntax-lit-06.rq syntax-lit-07.rq syntax-lit-08.rq \ syntax-lit-09.rq syntax-lit-10.rq syntax-lit-11.rq syntax-lit-12.rq \ syntax-lit-13.rq syntax-lit-14.rq \ syntax-order-01.rq syntax-order-02.rq syntax-order-03.rq \ syntax-order-04.rq syntax-order-05.rq syntax-order-06.rq \ syntax-pat-01.rq syntax-pat-02.rq syntax-pat-03.rq syntax-pat-04.rq \ syntax-qname-07.rq syntax-qname-08.rq syntax-qname-09.rq \ syntax-qname-10.rq syntax-qname-11.rq syntax-qname-12.rq \ syntax-qname-13.rq syntax-qname-14.rq \ syntax-struct-01.rq syntax-struct-02.rq \ syntax-struct-03.rq syntax-struct-04.rq syntax-struct-05.rq \ syntax-struct-06.rq syntax-struct-07.rq syntax-struct-08.rq \ syntax-struct-09.rq syntax-struct-10.rq \ syntax-union-01.rq syntax-union-02.rq SPARQL_TEST_FILES = $(SPARQL_TEST_FILES_CORE) \ syntax-keywords-01.rq syntax-keywords-02.rq syntax-keywords-03.rq \ syntax-qname-01.rq syntax-qname-02.rq syntax-qname-03.rq \ syntax-qname-04.rq syntax-qname-05.rq syntax-qname-06.rq \ syntax-struct-11.rq syntax-struct-12.rq SPARQL_TEST_NAMES = $(SPARQL_TEST_FILES_CORE) \ "keyword FILTER as a namespace prefix" \ "keyword FILTER as a local name" \ "keyword UNION as a namespace prefix" EXPECTED_SPARQL_PARSER_FAILURES = EXPECTED_SPARQL_PARSER_FAILURES_COUNT = 0 EXPECTED_SPARQL_CORRECT_FAILURES = \ $(EXPECTED_SPARQL_PARSER_FAILURES) EXPECTED_SPARQL_CORRECT_FAILURES_COUNT = \ $(EXPECTED_SPARQL_PARSER_FAILURES_COUNT) EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_TEST_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/SyntaxFull/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/SyntaxFull/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ expect="PositiveTest"; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(SPARQL_TEST_NAMES); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lists-04.rq0000644000175000017500000000003610362621550020035 00000000000000SELECT * WHERE { ( ( ?z ) ) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-basic-01.rq0000644000175000017500000000002310362621550017751 00000000000000SELECT * WHERE { } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-14.rq0000644000175000017500000000014210362621550017777 00000000000000BASE PREFIX : <#> PREFIX x.y: SELECT * WHERE { :a.b x.y: : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-07.rq0000644000175000017500000000013210362621550020223 00000000000000# Operator, no DOT PREFIX : SELECT * { OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-keywords-03.rq0000644000175000017500000000016510362621550020550 00000000000000# use keyword UNION as a namespace prefix PREFIX UNION: SELECT * WHERE { ?x UNION:foo ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-bnodes-02.rq0000644000175000017500000000007610362621550020153 00000000000000PREFIX : SELECT * WHERE { [] :p :q } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-keywords-01.rq0000644000175000017500000000020410362621550020540 00000000000000# use keyword FILTER as a namespace prefix PREFIX FILTER: SELECT * WHERE { ?x FILTER:foo ?z FILTER (?z) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-expr-05.rq0000644000175000017500000000015110362621550017654 00000000000000PREFIX xsd: SELECT * WHERE { ?s ?p ?o . FILTER (xsd:integer(?o)) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-06.rq0000644000175000017500000000016110362621550020224 00000000000000# Triple, DOT, operator, DOT PREFIX : SELECT * { :p :q :r . OPTIONAL { :a :b :c } . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-pat-04.rq0000644000175000017500000000023710362621550017466 00000000000000# No DOT between non-triples patterns PREFIX : SELECT * { OPTIONAL{:x :y :z} ?a :b :c { :x1 :y1 :z1 } UNION { :x2 :y2 :z2 } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-09.rq0000644000175000017500000000013410362621550017473 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p """Long "" Literal """ } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-04.rq0000644000175000017500000000015210362621550020222 00000000000000# Triple, DOT, operator PREFIX : SELECT * { :p :q :r . OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-13.rq0000644000175000017500000000010710362621550017777 00000000000000BASE PREFIX : <#> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-expr-03.rq0000644000175000017500000000006610362621550017657 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER REGEX(?o, "foo") } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-05.rq0000644000175000017500000000005110362621550017776 00000000000000PREFIX : <> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-12.rq0000644000175000017500000000005210362621550017775 00000000000000PREFIX : <#> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-12.rq0000644000175000017500000000013310362621550017464 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p '''Long''\'Literal''' } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-pat-03.rq0000644000175000017500000000023510362621550017463 00000000000000# No DOT between non-triples patterns PREFIX : SELECT * { ?a :b :c OPTIONAL{:x :y :z} { :x1 :y1 :z1 } UNION { :x2 :y2 :z2 } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-bnodes-01.rq0000644000175000017500000000007610362621550020152 00000000000000PREFIX : SELECT * WHERE { [:p :q ] } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-bnodes-07.rq0000644000175000017500000000014010362621550020150 00000000000000PREFIX : SELECT * WHERE { _:a :p1 :q1 . _:a :p2 :q2 . } rasqal-0.9.33/tests/sparql/SyntaxFull/manifest.ttl0000644000175000017500000005540312350617062017133 00000000000000@prefix rdf: . @prefix rdfs: . @prefix dawgt: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Syntax tests" ; mf:entries ( [ mf:name "syntax-basic-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-basic-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-basic-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-basic-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-basic-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-basic-06.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-bnodes-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-bnodes-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-bnodes-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-bnodes-06.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-bnodes-07.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-expr-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-expr-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-expr-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-expr-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-expr-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-expr-06.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-forms-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-forms-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-limit-offset-07.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-limit-offset-08.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-limit-offset-09.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lists-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lists-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lists-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lists-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lists-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-06.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-07.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-08.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-09.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-10.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-11.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-12.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-13.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-lit-14.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-order-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-order-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-order-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-order-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-order-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-order-06.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-pat-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-pat-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-pat-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-pat-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-07.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-08.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-09.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-10.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-11.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-12.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-13.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-qname-14.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-03.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-04.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-05.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-06.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-07.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-08.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-09.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-struct-10.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-union-01.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "syntax-union-02.rq" ; mf:action [ qt:query ; qt:data ] ; # No result dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "keyword FILTER as a namespace prefix" ; mf:action [ qt:query ; qt:data ] # No result # dawgt:approval dawgt:Approved ] [ mf:name "keyword FILTER as a local name" ; mf:action [ qt:query ; qt:data ] # No result # dawgt:approval dawgt:Approved ] [ mf:name "keyword UNION as a namespace prefix" ; mf:action [ qt:query ; qt:data ] # No result # dawgt:approval dawgt:Approved ] ) . rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-expr-02.rq0000644000175000017500000000005210362621550017651 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER (?o) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-02.rq0000644000175000017500000000012210362621550020215 00000000000000# Operator PREFIX : SELECT * { OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-03.rq0000644000175000017500000000011010362621550017770 00000000000000PREFIX : SELECT * WHERE { :_1 :p.rdf :z.z . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-14.rq0000644000175000017500000000013310362621550017466 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p '''Long\'''Literal''' } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-11.rq0000644000175000017500000000013310362621550017463 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p """Long""\"Literal""" } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-order-03.rq0000644000175000017500000000011710362621550020011 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ASC(?o) rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-basic-05.rq0000644000175000017500000000010710362621550017760 00000000000000# Two triples : no trailing dot SELECT * WHERE { ?x ?y ?z . ?a ?b ?c } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-union-02.rq0000644000175000017500000000014410362621550020025 00000000000000PREFIX : SELECT * { { ?s ?p ?o } UNION { ?a ?b ?c } UNION { ?r ?s ?t } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-basic-06.rq0000644000175000017500000000011310362621550017756 00000000000000# Two triples : with trailing dot SELECT * WHERE { ?x ?y ?z . ?a ?b ?c . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-04.rq0000644000175000017500000000011610362621550017466 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 'x"y\'z' } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-09.rq0000644000175000017500000000014310362621550020227 00000000000000# Operator, triple PREFIX : SELECT * { OPTIONAL { :a :b :c } ?x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-05.rq0000644000175000017500000000011310362621550017464 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p "x\"" } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-expr-06.rq0000644000175000017500000000022010362621550017652 00000000000000PREFIX : PREFIX xsd: SELECT * WHERE { ?s ?p ?o . FILTER (:myFunc(?s,?o)) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-10.rq0000644000175000017500000000015610362621550020000 00000000000000PREFIX : PREFIX a: SELECT * WHERE { : a: :a . : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-bnodes-05.rq0000644000175000017500000000011510362621550020150 00000000000000PREFIX : SELECT * WHERE { [ ?x ?y ] :p [ ?pa ?b ] } rasqal-0.9.33/tests/sparql/SyntaxFull/empty.nt0000644000175000017500000000000010362621550016256 00000000000000rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-order-02.rq0000644000175000017500000000011610362621550020007 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY (?o+5) rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-expr-01.rq0000644000175000017500000000005210362621550017650 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER (?o) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-05.rq0000644000175000017500000000015210362621550020223 00000000000000# Triple, DOT, operator PREFIX : SELECT * { :p :q :r . OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-pat-02.rq0000644000175000017500000000015410362621550017462 00000000000000# No DOT after optional PREFIX : SELECT * { ?a :b :c OPTIONAL{:x :y :z} :x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-01.rq0000644000175000017500000000011110362621550017456 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p "x" } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lists-03.rq0000644000175000017500000000003210362621550020030 00000000000000SELECT * WHERE { ( ?z ) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-08.rq0000644000175000017500000000013110362621550020223 00000000000000# Operator, DOT PREFIX : SELECT * { OPTIONAL { :a :b :c } . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-union-01.rq0000644000175000017500000000012210362621550020020 00000000000000PREFIX : SELECT * { { ?s ?p ?o } UNION { ?a ?b ?c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-limit-offset-09.rq0000644000175000017500000000012310362621550021303 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY ?o OFFSET 3 rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-02.rq0000644000175000017500000000010110362621550017767 00000000000000PREFIX : SELECT * WHERE { :x :p :z . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-10.rq0000644000175000017500000000015110362621550020216 00000000000000# Operator, DOT triple PREFIX : SELECT * { OPTIONAL { :a :b :c } . ?x ?y ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-forms-01.rq0000644000175000017500000000013010362621550020015 00000000000000PREFIX : SELECT * WHERE { ( [ ?x ?y ] ) :p ( [ ?pa ?b ] 57 ) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-04.rq0000644000175000017500000000015610362621550020003 00000000000000PREFIX : PREFIX a: SELECT * WHERE { : a: :a . : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-11.rq0000644000175000017500000000015310362621550020221 00000000000000# Triple, semi, operator PREFIX : SELECT * { :p :q :r ; OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-order-06.rq0000644000175000017500000000015110362621550020012 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY DESC(?o+57) :func2(?o) ASC(?s) rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-06.rq0000644000175000017500000000011310362621550017465 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 'x\'' } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-basic-04.rq0000644000175000017500000000006210362621550017757 00000000000000# With trailing dot SELECT * WHERE { ?x ?y ?z . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-order-04.rq0000644000175000017500000000012010362621550020004 00000000000000PREFIX : SELECT * { ?s ?p ?o } ORDER BY DESC(?o) rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-06.rq0000644000175000017500000000005210362621550020000 00000000000000PREFIX : <#> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-07.rq0000644000175000017500000000010710362621550020002 00000000000000BASE PREFIX : <#> SELECT * WHERE { : : : . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-13.rq0000644000175000017500000000013310362621550017465 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p """Long\"""Literal""" } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lists-01.rq0000644000175000017500000000010410362621550020026 00000000000000PREFIX : SELECT * WHERE { ( ?x ) :p ?z } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-02.rq0000644000175000017500000000011110362621550017457 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 'x' } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-07.rq0000644000175000017500000000011110362621550017464 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 123 } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-03.rq0000644000175000017500000000015310362621550020222 00000000000000# Triple, no DOT, operator PREFIX : SELECT * { :p :q :r OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lists-02.rq0000644000175000017500000000010310362621550020026 00000000000000PREFIX : SELECT * WHERE { ?x :p ( ?z ) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-08.rq0000644000175000017500000000011410362621550017470 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p 123. . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-bnodes-06.rq0000644000175000017500000000010210362621550020145 00000000000000PREFIX : SELECT * WHERE { [ :p :q ; ] } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-keywords-02.rq0000644000175000017500000000016510362621550020547 00000000000000# use keyword FILTER as a local name PREFIX : SELECT * WHERE { ?x :FILTER ?z FILTER (?z) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-struct-12.rq0000644000175000017500000000016210362621550020222 00000000000000# Triple, semi, DOT, operator PREFIX : SELECT * { :p :q :r ; . OPTIONAL { :a :b :c } } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-expr-04.rq0000644000175000017500000000007310362621550017656 00000000000000SELECT * WHERE { ?s ?p ?o . FILTER REGEX(?o, "foo", "i") } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lit-10.rq0000644000175000017500000000013710362621550017466 00000000000000BASE PREFIX : <#> SELECT * WHERE { :x :p '''Long '' """ Literal''' } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-qname-09.rq0000644000175000017500000000011010362621550017776 00000000000000PREFIX : SELECT * WHERE { :_1 :p.rdf :z.z . } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-forms-02.rq0000644000175000017500000000007710362621550020030 00000000000000PREFIX : SELECT * WHERE { ( [] [] ) } rasqal-0.9.33/tests/sparql/SyntaxFull/syntax-lists-05.rq0000644000175000017500000000003310362621550020033 00000000000000SELECT * WHERE { ( ( ) ) } rasqal-0.9.33/tests/sparql/simple/0000755000175000017500000000000012443715252014034 500000000000000rasqal-0.9.33/tests/sparql/simple/Makefile.am0000644000175000017500000000707512302411034016002 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests - simple # # Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data-01.n3 data-02.n3 dawg-data-01.n3 SPARQL_TEST_NAMES= \ dawg-triple-pattern-001 \ dawg-triple-pattern-002 \ dawg-triple-pattern-003 \ dawg-triple-pattern-004 SPARQL_TEST_FILES= \ dawg-tp-01.rq dawg-tp-02.rq dawg-tp-03.rq dawg-tp-04.rq SPARQL_RESULT_FILES= \ result-tp-01.n3 result-tp-02.n3 result-tp-03.n3 result-tp-04.n3 EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/simple/Makefile.in0000644000175000017500000003712612434455633016036 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests - simple # # Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/simple DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data-01.n3 data-02.n3 dawg-data-01.n3 SPARQL_TEST_NAMES = \ dawg-triple-pattern-001 \ dawg-triple-pattern-002 \ dawg-triple-pattern-003 \ dawg-triple-pattern-004 SPARQL_TEST_FILES = \ dawg-tp-01.rq dawg-tp-02.rq dawg-tp-03.rq dawg-tp-04.rq SPARQL_RESULT_FILES = \ result-tp-01.n3 result-tp-02.n3 result-tp-03.n3 result-tp-04.n3 EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/simple/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/simple/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/simple/dawg-tp-04.rq0000644000175000017500000000026710362621550016104 00000000000000PREFIX rdf: PREFIX foaf: SELECT ?name WHERE { ?x rdf:type foaf:Person . ?x foaf:name ?name . } rasqal-0.9.33/tests/sparql/simple/dawg-data-01.n30000644000175000017500000000125510362621550016263 00000000000000@prefix foaf: . @prefix rdf: . @prefix rdfs: . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox ; foaf:mbox ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox . rasqal-0.9.33/tests/sparql/simple/dawg-tp-03.rq0000644000175000017500000000003610362621550016075 00000000000000SELECT * WHERE { ?a ?a ?b . } rasqal-0.9.33/tests/sparql/simple/data-01.n30000644000175000017500000000010010362621550015327 00000000000000@prefix : . :x :p :v1 . :x :p :v2 . rasqal-0.9.33/tests/sparql/simple/result-tp-03.n30000644000175000017500000000103610362621550016370 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "a" , "b" ; rs:solution [ rs:binding [ rs:value ; rs:variable "a" ] ; rs:binding [ rs:value ; rs:variable "b" ] ] . rasqal-0.9.33/tests/sparql/simple/dawg-tp-02.rq0000644000175000017500000000010410362621550016070 00000000000000PREFIX : SELECT * WHERE { ?x :p ?q . } rasqal-0.9.33/tests/sparql/simple/dawg-tp-01.rq0000644000175000017500000000010310362621550016066 00000000000000PREFIX : SELECT * WHERE { :x ?p ?q . } rasqal-0.9.33/tests/sparql/simple/result-tp-04.n30000644000175000017500000000124410362621550016372 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "name" ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ] ; rs:solution [ rs:binding [ rs:value "Eve" ; rs:variable "name" ] ] . rasqal-0.9.33/tests/sparql/simple/manifest.n30000644000175000017500000000400210362621550016013 00000000000000@prefix rdf: . @prefix rdfs: . @prefix dawgt: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Some DAWG test cases" ; mf:entries ( [ mf:name "dawg-triple-pattern-001" ; rdfs:comment "Simple triple match" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "dawg-triple-pattern-002" ; rdfs:comment "Simple triple match" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "dawg-triple-pattern-003" ; rdfs:comment "Simple triple match - repeated variable" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "dawg-triple-pattern-004" ; rdfs:comment "Simple triple match - two triples, common variable" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] # End of tests ). rasqal-0.9.33/tests/sparql/simple/data-02.n30000644000175000017500000000011310362621550015334 00000000000000@prefix : . :y :y :x . :x :y :y . :y :x :y . rasqal-0.9.33/tests/sparql/simple/result-tp-01.n30000644000175000017500000000155210362621550016371 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "p" , "q" ; rs:solution [ rs:binding [ rs:value ; rs:variable "q" ] ; rs:binding [ rs:value ; rs:variable "p" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "q" ] ; rs:binding [ rs:value ; rs:variable "p" ] ] . rasqal-0.9.33/tests/sparql/simple/result-tp-02.n30000644000175000017500000000155210362621550016372 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "q" , "x" ; rs:solution [ rs:binding [ rs:value ; rs:variable "q" ] ; rs:binding [ rs:value ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "q" ] ; rs:binding [ rs:value ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/Expr1/0000755000175000017500000000000012443715252013542 500000000000000rasqal-0.9.33/tests/sparql/Expr1/expr-3-result.ttl0000644000175000017500000000153310362621550016636 00000000000000@prefix dc: . @prefix rs: . @prefix x: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "title" ; rs:resultVariable "price" ; rs:solution [ rs:binding [ rs:value "TITLE 3" ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "TITLE 1" ; rs:variable "title" ] ; rs:binding [ rs:value 10 ; rs:variable "price" ] ] . rasqal-0.9.33/tests/sparql/Expr1/expr-3.rq0000644000175000017500000000040110362621550015132 00000000000000PREFIX dc: PREFIX x: SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price } . FILTER ( ( ! bound(?price) ) || ( ?price < 15 ) ) . } rasqal-0.9.33/tests/sparql/Expr1/Makefile.am0000644000175000017500000000736712302411034015514 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax SPARQL tests # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data-1.ttl SPARQL_TEST_FILES= \ expr-1.rq expr-2.rq expr-3.rq SPARQL_TEST_NAMES= \ "OPTIONAL-FILTER" \ "OPTIONAL - Outer FILTER" \ "OPTIONAL - Outer FILTER with BOUND" EXPECTED_SPARQL_CORRECT= $(SPARQL_TEST_NAMES) EXPECTED_SPARQL_CORRECT_FAILURES= SPARQL_RESULT_FILES= \ expr-1-result.ttl expr-2-result.ttl expr-3-result.ttl EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/Expr1/Makefile.in0000644000175000017500000003741512434455633015545 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax SPARQL tests # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/Expr1 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data-1.ttl SPARQL_TEST_FILES = \ expr-1.rq expr-2.rq expr-3.rq SPARQL_TEST_NAMES = \ "OPTIONAL-FILTER" \ "OPTIONAL - Outer FILTER" \ "OPTIONAL - Outer FILTER with BOUND" EXPECTED_SPARQL_CORRECT = $(SPARQL_TEST_NAMES) EXPECTED_SPARQL_CORRECT_FAILURES = SPARQL_RESULT_FILES = \ expr-1-result.ttl expr-2-result.ttl expr-3-result.ttl EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/Expr1/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/Expr1/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/Expr1/expr-2-result.ttl0000644000175000017500000000124010362621550016630 00000000000000@prefix dc: . @prefix rs: . @prefix x: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "title" ; rs:resultVariable "price" ; rs:solution [ rs:binding [ rs:value "TITLE 1" ; rs:variable "title" ] ; rs:binding [ rs:value 10 ; rs:variable "price" ] ] . rasqal-0.9.33/tests/sparql/Expr1/expr-1.rq0000644000175000017500000000036210362621550015136 00000000000000PREFIX dc: PREFIX x: SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price . FILTER (?price < 15) . } . } rasqal-0.9.33/tests/sparql/Expr1/expr-1-result.ttl0000644000175000017500000000202610362621550016632 00000000000000@prefix dc: . @prefix rs: . @prefix x: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "title" ; rs:resultVariable "price" ; rs:solution [ rs:binding [ rs:value "TITLE 1" ; rs:variable "title" ] ; rs:binding [ rs:value 10 ; rs:variable "price" ] ] ; rs:solution [ rs:binding [ rs:value "TITLE 3" ; rs:variable "title" ] ] ; rs:solution [ rs:binding [ rs:value "TITLE 2" ; rs:variable "title" ] ] . rasqal-0.9.33/tests/sparql/Expr1/manifest.n30000644000175000017500000000171010362621550015524 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Eval tests : nested constraints" ; mf:entries ( [ mf:name "OPTIONAL-FILTER" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "OPTIONAL - Outer FILTER" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "OPTIONAL - Outer FILTER with BOUND" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ). rasqal-0.9.33/tests/sparql/Expr1/data-1.ttl0000644000175000017500000000041010362621550015244 00000000000000@prefix x: . @prefix : . @prefix dc: . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" . rasqal-0.9.33/tests/sparql/Expr1/expr-2.rq0000644000175000017500000000034510362621550015140 00000000000000PREFIX dc: PREFIX x: SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price } . FILTER (?price < 15) . } rasqal-0.9.33/tests/sparql/regex/0000755000175000017500000000000012443715252013655 500000000000000rasqal-0.9.33/tests/sparql/regex/regex-result-001.n30000644000175000017500000000056510362621550016764 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "val" ; rs:solution [ rs:binding [ rs:value "ABCdefGHIjkl" ; rs:variable "val" ] ; ] . rasqal-0.9.33/tests/sparql/regex/Makefile.am0000644000175000017500000000700612302411034015615 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ regex-data-01.n3 SPARQL_TEST_FILES= \ regex-query-001.rq regex-query-002.rq regex-query-003.rq regex-query-004.rq EXPECTED_SPARQL_CORRECT= \ "regex-query-001" \ "regex-query-002" \ "regex-query-003" \ "regex-query-004" SPARQL_RESULT_FILES= \ regex-result-001.n3 \ regex-result-002.n3 \ regex-result-003.n3 \ regex-result-004.n3 EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/regex/Makefile.in0000644000175000017500000003703412434455633015655 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/regex DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ regex-data-01.n3 SPARQL_TEST_FILES = \ regex-query-001.rq regex-query-002.rq regex-query-003.rq regex-query-004.rq EXPECTED_SPARQL_CORRECT = \ "regex-query-001" \ "regex-query-002" \ "regex-query-003" \ "regex-query-004" SPARQL_RESULT_FILES = \ regex-result-001.n3 \ regex-result-002.n3 \ regex-result-003.n3 \ regex-result-004.n3 EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/regex/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/regex/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) \"$$test\" \"\"\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/regex/regex-query-002.rq0000644000175000017500000000026110362621550016707 00000000000000PREFIX ex: PREFIX rdf: SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(?val, "DeFghI", "i") } rasqal-0.9.33/tests/sparql/regex/regex-result-004.n30000644000175000017500000000106210362621550016760 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "val" ; rs:solution [ rs:binding [ rs:value "http://example.com/literal" ; rs:variable "val" ] ; ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "val" ] ; ] . rasqal-0.9.33/tests/sparql/regex/regex-query-004.rq0000644000175000017500000000026710362621550016717 00000000000000PREFIX rdf: PREFIX ex: SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(str(?val), "example\\.com") } rasqal-0.9.33/tests/sparql/regex/regex-result-003.n30000644000175000017500000000060310362621550016757 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "val" ; rs:solution [ rs:binding [ rs:value "http://example.com/literal" ; rs:variable "val" ] ; ] . rasqal-0.9.33/tests/sparql/regex/manifest.n30000644000175000017500000000263010362621550015641 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "SPARQL regex tests" ; mf:entries ( [ mf:name "regex-query-001" ; rdfs:comment "Simple unanchored match test" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "regex-query-002" ; rdfs:comment "Case insensitive unanchored match test" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "regex-query-003" ; rdfs:comment "Use/mention test" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "regex-query-004" ; rdfs:comment "str()+URI test" ; mf:action [ qt:query ; qt:data ] ; mf:result ] # End of tests ). rasqal-0.9.33/tests/sparql/regex/regex-result-002.n30000644000175000017500000000103210362621550016753 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "val" ; rs:solution [ rs:binding [ rs:value "ABCdefGHIjkl" ; rs:variable "val" ] ; ] ; rs:solution [ rs:binding [ rs:value "abcDEFghiJKL" ; rs:variable "val" ] ; ] . rasqal-0.9.33/tests/sparql/regex/regex-query-001.rq0000644000175000017500000000025110362621550016705 00000000000000PREFIX rdf: PREFIX ex: SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(?val, "GHI") } rasqal-0.9.33/tests/sparql/regex/regex-query-003.rq0000644000175000017500000000026410362621550016713 00000000000000PREFIX rdf: PREFIX ex: SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(?val, "example\\.com") } rasqal-0.9.33/tests/sparql/regex/regex-data-01.n30000644000175000017500000000033510362621550016272 00000000000000@prefix rdf: . @prefix ex: . ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789", , "http://example.com/literal" . rasqal-0.9.33/tests/sparql/bound/0000755000175000017500000000000012443715252013652 500000000000000rasqal-0.9.33/tests/sparql/bound/Makefile.am0000644000175000017500000000661312302411034015615 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests - BOUND() # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data.n3 SPARQL_TEST_FILES= \ bound1.rq SPARQL_RESULT_FILES= \ bound1-result.n3 EXPECTED_SPARQL_CORRECT= \ dawg-bound-query-001 EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/bound/Makefile.in0000644000175000017500000003664112434455633015655 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests - BOUND() # # Copyright (C) 2005-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/bound DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data.n3 SPARQL_TEST_FILES = \ bound1.rq SPARQL_RESULT_FILES = \ bound1-result.n3 EXPECTED_SPARQL_CORRECT = \ dawg-bound-query-001 EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/bound/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/bound/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/bound/data.n30000644000175000017500000000013110362621550014733 00000000000000@prefix : . :a1 :b :c1 . :c1 :d :e . :a2 :b :c2 . :c2 :b :f . rasqal-0.9.33/tests/sparql/bound/manifest.n30000644000175000017500000000115710362621550015641 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "DAWG bound test cases" ; mf:entries ([ mf:name "dawg-bound-query-001" ; rdfs:comment "BOUND test case." ; mf:action [ qt:query ; qt:data ] ; mf:result ] # End of tests ). rasqal-0.9.33/tests/sparql/bound/bound1-result.n30000644000175000017500000000154310362621550016536 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "a" , "c" ; rs:solution [ rs:binding [ rs:value ; rs:variable "a" ] ; rs:binding [ rs:value ; rs:variable "c" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "a" ] ; rs:binding [ rs:value ; rs:variable "c" ] ] . rasqal-0.9.33/tests/sparql/bound/bound1.rq0000644000175000017500000000034010362621550015316 00000000000000# Based on # http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0554.html PREFIX : SELECT $a $c WHERE { $a :b $c . OPTIONAL { $c :d $e } . FILTER ( !BOUND($e) ) } rasqal-0.9.33/tests/sparql/examples/0000755000175000017500000000000012443715252014361 500000000000000rasqal-0.9.33/tests/sparql/examples/ex2-1b.rq0000644000175000017500000000017410362621550015640 00000000000000PREFIX dc: SELECT ?title WHERE { dc:title ?title } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.2_0.n30000644000175000017500000000044110362621550016173 00000000000000@prefix foaf: . @prefix dc: . @prefix xs: . _:a foaf:name "Alice". _:b foaf:givenName "Bob" . _:b dc:created "2005-04-04T04:04:04Z"^^xs:dateTime . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.3_0-result.n30000644000175000017500000000110510362621550017506 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "mbox" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/examples/ex2-1d.n30000644000175000017500000000020410362621550015532 00000000000000@prefix dc: . @prefix : . :book1 dc:title "SPARQL Tutorial" . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.6_0.rq0000644000175000017500000000026010362621550016300 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER regex(str(?mbox), "@work.example") } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.8_0.rq0000644000175000017500000000037710362621550016313 00000000000000PREFIX foaf: PREFIX xsd: PREFIX eg: SELECT ?name ?size WHERE { ?x foaf:name ?name ; eg:shoeSize ?size . FILTER ( datatype(?size) = xsd:int ) } rasqal-0.9.33/tests/sparql/examples/ex3.rq0000644000175000017500000000031410362621550015335 00000000000000PREFIX dc: PREFIX ns: SELECT ?title ?price WHERE { ?x ns:price ?price . FILTER ( ?price < 30 ) . ?x dc:title ?title . } rasqal-0.9.33/tests/sparql/examples/ex2-4a.rq0000644000175000017500000000020110362621550015631 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mbox . } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.4_0-result.n30000644000175000017500000000106510362621550017514 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "given", "family" ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "given" ] ; rs:binding [ rs:value "Smith" ; rs:variable "family" ] ] . rasqal-0.9.33/tests/sparql/examples/Makefile.am0000644000175000017500000001217512302411034016324 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal SPARQL tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ ex2-1a.n3 ex2-1d.n3 ex2-1f.n3 ex2-2a.n3 ex2-3a.n3 ex2-4a.n3 ex3.n3 \ ex11.2.3.1_0.n3 ex11.2.3.1_1.n3 ex11.2.3.2_0.n3 ex11.2.3.3_0.n3 \ ex11.2.3.4_0.n3 ex11.2.3.5_0.n3 ex11.2.3.6_0.n3 ex11.2.3.7_0.n3 \ ex11.2.3.8_0.n3 ex11_0.n3 SPARQL_TEST_FILES= \ ex2-1a.rq ex2-1b.rq ex2-1c.rq ex2-1e.rq ex2-2a.rq ex2-3a.rq ex2-4a.rq \ ex3.rq ex11.2.3.1_0.rq ex11.2.3.1_1.rq ex11.2.3.2_0.rq \ ex11.2.3.2_1.rq ex11.2.3.3_0.rq ex11.2.3.4_0.rq ex11.2.3.5_0.rq \ ex11.2.3.6_0.rq ex11.2.3.7_0.rq ex11.2.3.8_0.rq ex11_0.rq ex11_1.rq EXPECTED_SPARQL_CORRECT= \ sparql-query-example-a \ sparql-query-example-b \ sparql-query-example-c \ sparql-query-example-d \ sparql-query-example-e \ sparql-query-example-Testing-Values-0 \ sparql-query-example-Testing-Values-1 \ sparql-query-example-Testing-Values-RDFterm-equal \ sparql-query-example-Testing-Values-RDFterm-equal-2 \ sparql-query-example-Testing-Values-isURI \ sparql-query-example-Testing-Values-isLiteral \ sparql-query-example-Testing-Values-str \ sparql-query-example-Testing-Values-lang \ sparql-query-example-Testing-Values-isBlank \ sparql-query-example-Testing-Values-bound \ sparql-query-example-Testing-Values-bound-2 EXPECTED_SPARQL_CORRECT_FAILURES= SPARQL_RESULT_FILES= \ ex2-1a-result.n3 ex2-2a-result.n3 ex2-3a-result.n3 ex2-4a-result.n3 \ ex3-result.n3 ex11.2.3.1_0-result.n3 ex11.2.3.1_1-result.n3 \ ex11.2.3.2_0-result.n3 ex11.2.3.2_1-result.n3 ex11.2.3.3_0-result.n3 \ ex11.2.3.4_0-result.n3 ex11.2.3.5_0-result.n3 ex11.2.3.6_0-result.n3 \ ex11.2.3.7_0-result.n3 ex11.2.3.8_0-result.n3 ex11_0-result.n3 \ ex11_1-result.n3 EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ expect="NegativeTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/examples/ex2-1a.rq0000644000175000017500000000015410362621550015635 00000000000000SELECT ?title WHERE { ?title } rasqal-0.9.33/tests/sparql/examples/Makefile.in0000644000175000017500000004223412434455633016357 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal SPARQL tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ ex2-1a.n3 ex2-1d.n3 ex2-1f.n3 ex2-2a.n3 ex2-3a.n3 ex2-4a.n3 ex3.n3 \ ex11.2.3.1_0.n3 ex11.2.3.1_1.n3 ex11.2.3.2_0.n3 ex11.2.3.3_0.n3 \ ex11.2.3.4_0.n3 ex11.2.3.5_0.n3 ex11.2.3.6_0.n3 ex11.2.3.7_0.n3 \ ex11.2.3.8_0.n3 ex11_0.n3 SPARQL_TEST_FILES = \ ex2-1a.rq ex2-1b.rq ex2-1c.rq ex2-1e.rq ex2-2a.rq ex2-3a.rq ex2-4a.rq \ ex3.rq ex11.2.3.1_0.rq ex11.2.3.1_1.rq ex11.2.3.2_0.rq \ ex11.2.3.2_1.rq ex11.2.3.3_0.rq ex11.2.3.4_0.rq ex11.2.3.5_0.rq \ ex11.2.3.6_0.rq ex11.2.3.7_0.rq ex11.2.3.8_0.rq ex11_0.rq ex11_1.rq EXPECTED_SPARQL_CORRECT = \ sparql-query-example-a \ sparql-query-example-b \ sparql-query-example-c \ sparql-query-example-d \ sparql-query-example-e \ sparql-query-example-Testing-Values-0 \ sparql-query-example-Testing-Values-1 \ sparql-query-example-Testing-Values-RDFterm-equal \ sparql-query-example-Testing-Values-RDFterm-equal-2 \ sparql-query-example-Testing-Values-isURI \ sparql-query-example-Testing-Values-isLiteral \ sparql-query-example-Testing-Values-str \ sparql-query-example-Testing-Values-lang \ sparql-query-example-Testing-Values-isBlank \ sparql-query-example-Testing-Values-bound \ sparql-query-example-Testing-Values-bound-2 EXPECTED_SPARQL_CORRECT_FAILURES = SPARQL_RESULT_FILES = \ ex2-1a-result.n3 ex2-2a-result.n3 ex2-3a-result.n3 ex2-4a-result.n3 \ ex3-result.n3 ex11.2.3.1_0-result.n3 ex11.2.3.1_1-result.n3 \ ex11.2.3.2_0-result.n3 ex11.2.3.2_1-result.n3 ex11.2.3.3_0-result.n3 \ ex11.2.3.4_0-result.n3 ex11.2.3.5_0-result.n3 ex11.2.3.6_0-result.n3 \ ex11.2.3.7_0-result.n3 ex11.2.3.8_0-result.n3 ex11_0-result.n3 \ ex11_1-result.n3 EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/examples/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ expect="NegativeTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/examples/ex11_0.n30000644000175000017500000000061310362621550015533 00000000000000@prefix a: . @prefix dc: . _:a a:annotates . _:a dc:created "2004-12-31T18:00:00-05:00" . _:b a:annotates . _:b dc:created "2004-12-31T18:01:00-05:00"^^ . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.1_0-result.n30000644000175000017500000000155510362621550017515 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name1", "name2" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name1" ] ; rs:binding [ rs:value "Ms A." ; rs:variable "name2" ] ] ; rs:solution [ rs:binding [ rs:value "Ms A." ; rs:variable "name1" ] ; rs:binding [ rs:value "Alice" ; rs:variable "name2" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.2_1-result.n30000644000175000017500000000065410362621550017516 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ] . rasqal-0.9.33/tests/sparql/examples/ex2-2a.rq0000644000175000017500000000004110362621550015631 00000000000000SELECT * WHERE { ?x ?x ?v } rasqal-0.9.33/tests/sparql/examples/ex11_0-result.n30000644000175000017500000000065210362621550017052 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "annot" ; rs:solution [ rs:binding [ rs:value _:a ; rs:variable "annot" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.5_0.rq0000644000175000017500000000023510362621550016301 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER isLiteral(?mbox) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.7_0.rq0000644000175000017500000000024412251256674016315 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER ( lang(?name) = "es" ) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.1_1-result.n30000644000175000017500000000072710362621550017516 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "annotates" ; rs:solution [ rs:binding [ rs:value ; rs:variable "annotates" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11_1.rq0000644000175000017500000000056110362621550015640 00000000000000PREFIX a: PREFIX dc: PREFIX xsd: SELECT ?annot WHERE { ?annot a:annotates . ?annot dc:created ?date . FILTER ( xsd:dateTime(?date) < xsd:dateTime("2005-01-01T00:00:00Z") ) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.2_0-result.n30000644000175000017500000000067310362621550017516 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "givenName" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ; ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.8_0-result.n30000644000175000017500000000106210362621550017515 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "shoeSize" ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "name" ] ; rs:binding [ rs:value 42 ; rs:variable "shoeSize" ] ] . rasqal-0.9.33/tests/sparql/examples/ex2-4a.n30000644000175000017500000000032410362621550015535 00000000000000@prefix foaf: . _:a foaf:name "Johnny Lee Outlaw" . _:a foaf:mbox . _:b foaf:name "Peter Goodguy" . _:b foaf:mbox . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.1_1.rq0000644000175000017500000000056310362621550016302 00000000000000PREFIX a: PREFIX dc: PREFIX xsd: SELECT ?annotates WHERE { ?annot a:annotates ?annotates . ?annot dc:created ?date . FILTER ( ?date = xsd:dateTime("2004-01-01T00:00:00Z") || ?date = xsd:dateTime("2005-01-01T00:00:00Z") ) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.1_0.rq0000644000175000017500000000040010362621550016267 00000000000000PREFIX foaf: SELECT ?name1 ?name2 WHERE { ?x foaf:name ?name1 ; foaf:mbox ?mbox1 . ?y foaf:name ?name2 ; foaf:mbox ?mbox2 . FILTER ( ?mbox1 = ?mbox2 && ?name1 != ?name2 ) } rasqal-0.9.33/tests/sparql/examples/ex2-1a.n30000644000175000017500000000013410362621550015531 00000000000000 "SPARQL Tutorial" . rasqal-0.9.33/tests/sparql/examples/ex2-3a.rq0000644000175000017500000000021110362621550015631 00000000000000PREFIX foaf: SELECT ?mbox WHERE { ?x foaf:name "Johnny Lee Outlaw" . ?x foaf:mbox ?mbox . } rasqal-0.9.33/tests/sparql/examples/ex11_0.rq0000644000175000017500000000053510362621550015640 00000000000000PREFIX a: PREFIX dc: PREFIX xsd: SELECT ?annot WHERE { ?annot a:annotates . ?annot dc:created ?date . FILTER ( ?date < xsd:dateTime("2005-01-01T00:00:00Z") ) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.3_0.n30000644000175000017500000000051710362621550016200 00000000000000@prefix foaf: . @prefix rdf: . @prefix rdfs: . _:a foaf:name "Alice". _:a foaf:mbox . _:b foaf:name "Bob" . _:b foaf:mbox "bob@work.example" . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.2_1.rq0000644000175000017500000000033310362621550016276 00000000000000PREFIX foaf: PREFIX dc: SELECT ?name WHERE { ?x foaf:name ?name . OPTIONAL { ?x dc:created ?created } . FILTER ( !bound(?created)) } rasqal-0.9.33/tests/sparql/examples/ex2-3a.n30000644000175000017500000000020510362621550015532 00000000000000@prefix foaf: . _:a foaf:name "Johnny Lee Outlaw" . _:a foaf:mbox . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.1_1.n30000644000175000017500000000043110362621550016172 00000000000000@prefix a: . @prefix dc: . _:b a:annotates . _:b dc:created "2004-12-31T19:00:00-05:00"^^ . rasqal-0.9.33/tests/sparql/examples/ex2-3a-result.n30000644000175000017500000000067610362621550017062 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "mbox" ; rs:solution [ rs:binding [ rs:value ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/examples/ex3.n30000644000175000017500000000040310362621550015232 00000000000000@prefix dc: . @prefix : . @prefix ns: . :book1 dc:title "SPARQL Tutorial" . :book1 ns:price 42 . :book2 dc:title "The Semantic Web" . :book2 ns:price 23 . rasqal-0.9.33/tests/sparql/examples/manifest.n30000644000175000017500000001247110362621550016351 00000000000000@prefix rdf: . @prefix rdfs: . @prefix dawgt: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "SPARQL examples from query WD" ; mf:entries ([ mf:name "sparql-query-example-a" ; rdfs:comment "Example from section 2.1" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "sparql-query-example-b" ; rdfs:comment "Example from section 2.3" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "sparql-query-example-c" ; rdfs:comment "Example from section 2.4" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "sparql-query-example-d" ; rdfs:comment "Example from section 2.5" ; mf:action [ qt:query ; qt:data ] ; mf:result ; dawgt:approvedBy ; dawgt:approval dawgt:Approved ] [ mf:name "sparql-query-example-e" ; rdfs:comment "Example from section 3" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-0" ; rdfs:comment "Example from section 11" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-1" ; rdfs:comment "2nd Example from section 11" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-RDFterm-equal" ; rdfs:comment "Example from section 11.2.3.1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-RDFterm-equal-2" ; rdfs:comment "2nd Example from section 11.2.3.1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-bound" ; rdfs:comment "Example from section 11.2.3.2" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-bound-2" ; rdfs:comment "2nd Example from section 11.2.3.2" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-isURI" ; rdfs:comment "Example from section 11.2.3.3" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-isBlank" ; rdfs:comment "Example from section 11.2.3.4" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-isLiteral" ; rdfs:comment "Example from section 11.2.3.5" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-str" ; rdfs:comment "Example from section 11.2.3.6" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "sparql-query-example-Testing-Values-lang" ; rdfs:comment "Example from section 11.2.3.7" ; mf:action [ qt:query ; qt:data ] ; mf:result ] # End of tests ). rasqal-0.9.33/tests/sparql/examples/ex11.2.3.4_0.n30000644000175000017500000000065110362621550016200 00000000000000@prefix a: . @prefix dc: . @prefix foaf: . _:a a:annotates . _:a dc:creator "Alice B. Toeclips" . _:b a:annotates . _:b dc:creator _:c . _:c foaf:given "Bob". _:c foaf:family "Smith". rasqal-0.9.33/tests/sparql/examples/ex3-result.n30000644000175000017500000000111110362621550016543 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "title", "price" ; rs:solution [ rs:binding [ rs:value "The Semantic Web" ; rs:variable "title" ] ; rs:binding [ rs:value 23 ; rs:variable "price" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.5_0-result.n30000644000175000017500000000107210362621550017513 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "mbox" ; rs:solution [ rs:binding [ rs:value "Bob" ; rs:variable "name" ] ; rs:binding [ rs:value "bob@work.example" ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.7_0-result.n30000644000175000017500000000111010362621550017506 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "mbox" ; rs:solution [ rs:binding [ rs:value "Roberto"@ES ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/examples/ex2-2a-result.n30000644000175000017500000000107110362621550017047 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "x", "v" ; rs:solution [ rs:binding [ rs:value rdf:type ; rs:variable "x" ] ; rs:binding [ rs:value rdf:Property ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.3_0.rq0000644000175000017500000000023210362621550016274 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER isUri(?mbox) } rasqal-0.9.33/tests/sparql/examples/ex2-4a-result.n30000644000175000017500000000164010362621550017053 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "mbox" ; rs:solution [ rs:binding [ rs:value "Johnny Lee Outlaw" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] ; rs:solution [ rs:binding [ rs:value "Peter Goodguy" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.6_0-result.n30000644000175000017500000000110510362621550017511 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "name", "mbox" ; rs:solution [ rs:binding [ rs:value "Alice" ; rs:variable "name" ] ; rs:binding [ rs:value ; rs:variable "mbox" ] ] . rasqal-0.9.33/tests/sparql/examples/ex2-1c.rq0000644000175000017500000000021010362621550015630 00000000000000PREFIX dc: PREFIX : SELECT ?title WHERE { :book1 dc:title ?title } rasqal-0.9.33/tests/sparql/examples/ex2-1f.n30000644000175000017500000000031410362621550015536 00000000000000@prefix ns: . @prefix xsd: . @prefix : . :book1 ns:numPages "200"^^xsd:integer . :book2 ns:numPages 100 . rasqal-0.9.33/tests/sparql/examples/ex2-2a.n30000644000175000017500000000014110362621550015530 00000000000000@prefix rdf: . rdf:type rdf:type rdf:Property . rasqal-0.9.33/tests/sparql/examples/ex2-1a-result.n30000644000175000017500000000057210362621550017053 00000000000000@prefix rs: . [] rs:ResultSet ; rs:resultVariable "title" ; rs:solution [ rs:binding [ rs:value "SPARQL Tutorial" ; rs:variable "title" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11_1-result.n30000644000175000017500000000110410362621550017044 00000000000000@prefix rdf: . @prefix rs: . [] rs:ResultSet ; rs:resultVariable "annot" ; rs:solution [ rs:binding [ rs:value _:a ; rs:variable "annot" ] ] ; rs:solution [ rs:binding [ rs:value _:b ; rs:variable "annot" ] ] . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.4_0.rq0000644000175000017500000000060710362621550016303 00000000000000PREFIX a: PREFIX dc: PREFIX foaf: SELECT ?given ?family WHERE { ?annot a:annotates . ?annot dc:creator ?c . OPTIONAL { ?c foaf:given ?given ; foaf:family ?family } . FILTER isBlank(?c) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.8_0.n30000644000175000017500000000046010362621550016202 00000000000000@prefix foaf: . @prefix eg: . @prefix xsd: . _:a foaf:name "alice". _:a eg:shoeSize "9.5"^^xsd:float . _:b foaf:name "bob". _:b eg:shoeSize "42"^^xsd:integer . rasqal-0.9.33/tests/sparql/examples/ex2-1e.rq0000644000175000017500000000023110362621550015635 00000000000000PREFIX dcore: PREFIX xsd: SELECT ?title WHERE { ?book dcore:title ?title } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.6_0.n30000644000175000017500000000043010362621550016175 00000000000000@prefix foaf: . @prefix rdf: . _:a foaf:name "Alice". _:a foaf:mbox . _:b foaf:name "Bob" . _:b foaf:mbox . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.7_0.n30000644000175000017500000000035612251256674016217 00000000000000@prefix foaf: . @prefix rdf: . _:a foaf:name "Robert"@en. _:a foaf:name "Roberto"@es. _:a foaf:mbox . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.2_0.rq0000644000175000017500000000043110362621550016274 00000000000000PREFIX foaf: PREFIX dc: SELECT ?name ?givenName WHERE { { ?x foaf:name ?name } UNION { ?x foaf:givenName ?givenName; dc:created ?created } . FILTER ( bound(?name) || ?created < "2005-01-01T00:00:00Z" ) } rasqal-0.9.33/tests/sparql/examples/ex11.2.3.5_0.n30000644000175000017500000000051710362621550016202 00000000000000@prefix foaf: . @prefix rdf: . @prefix rdfs: . _:a foaf:name "Alice". _:a foaf:mbox . _:b foaf:name "Bob" . _:b foaf:mbox "bob@work.example" . rasqal-0.9.33/tests/sparql/examples/ex11.2.3.1_0.n30000644000175000017500000000053110362621550016172 00000000000000@prefix foaf: . @prefix rdf: . @prefix rdfs: . _:a foaf:name "Alice". _:a foaf:mbox . _:b foaf:name "Ms A.". _:b foaf:mbox . rasqal-0.9.33/tests/sparql/bugs/0000755000175000017500000000000012443715253013504 500000000000000rasqal-0.9.33/tests/sparql/bugs/459.rq0000644000175000017500000000023511621007215014276 00000000000000PREFIX foaf: SELECT ?first ?second WHERE { ?first _:second . _:second foaf:name $second } rasqal-0.9.33/tests/sparql/bugs/352-result.ttl0000644000175000017500000000016012134571646015776 00000000000000_:r1qbnodeid1 "Alice" . _:r2qbnodeid1 "Bob" . rasqal-0.9.33/tests/sparql/bugs/Makefile.am0000644000175000017500000000447612302411034015453 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal bug tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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. # MANIFEST_FILES= \ manifest.ttl BUG_DATA_FILES= \ 352.ttl 353.ttl 354.nt 459.ttl 519.ttl SPARQL_TEST_FILES= \ 352.rq 353.rq 354.rq 459.rq 519.rq SPARQL_TEST_NAMES= \ 352 353 354 459 519 SPARQL_RESULT_FILES= \ 352-result.ttl \ 353-result.ttl \ 354-result.ttl \ 459-result.ttl \ 519-result.ttl EXTRA_DIST= \ $(MANIFEST_FILES) \ $(BUG_DATA_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out RECHO=/bin/echo .PHONY: build-core build-roqet check-lcoal # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) check-local: build-roqet @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-query" get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"Bug Tests via SPARQL\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/bugs/Makefile.in0000644000175000017500000003450312434455633015501 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal bug tests # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/bugs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = /bin/echo RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ MANIFEST_FILES = \ manifest.ttl BUG_DATA_FILES = \ 352.ttl 353.ttl 354.nt 459.ttl 519.ttl SPARQL_TEST_FILES = \ 352.rq 353.rq 354.rq 459.rq 519.rq SPARQL_TEST_NAMES = \ 352 353 354 459 519 SPARQL_RESULT_FILES = \ 352-result.ttl \ 353-result.ttl \ 354-result.ttl \ 459-result.ttl \ 519-result.ttl EXTRA_DIST = \ $(MANIFEST_FILES) \ $(BUG_DATA_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/bugs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/bugs/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet check-lcoal # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) check-local: build-roqet @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-query" get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"Bug Tests via SPARQL\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/bugs/459.ttl0000644000175000017500000000047111621007215014461 00000000000000@prefix foaf: . _:dave a foaf:Person ; foaf:name "Dave" . _:libby a foaf:Person ; foaf:name "Libby" . _:nick a foaf:Person ; foaf:name "Nick" . a foaf:Person ; foaf:knows _:dave, _:libby, _:nick ; foaf:name "Steve" . rasqal-0.9.33/tests/sparql/bugs/354-result.ttl0000644000175000017500000000063111344116062015770 00000000000000@prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value ; rs:variable "x" ] ; ] . rasqal-0.9.33/tests/sparql/bugs/353.rq0000644000175000017500000000030011433034336014265 00000000000000PREFIX foaf: PREFIX site: CONSTRUCT { [] foaf:name ?name } WHERE { [] foaf:name ?name ; site:hits ?hits . } ORDER BY desc(?hits) rasqal-0.9.33/tests/sparql/bugs/352.rq0000644000175000017500000000026311344122204014265 00000000000000PREFIX foaf: PREFIX site: CONSTRUCT { [] foaf:name ?name } WHERE { [] foaf:name ?name ; site:hits ?hits . } LIMIT 2 rasqal-0.9.33/tests/sparql/bugs/519.rq0000644000175000017500000000044412063453206014303 00000000000000PREFIX : SELECT * WHERE { ?a :prop "1"^^ . ?b :prop 2^^ . ?c :prop "3"^^ . ?d :prop 4^^ . } rasqal-0.9.33/tests/sparql/bugs/353.ttl0000644000175000017500000000033611433262216014457 00000000000000@prefix foaf: . @prefix site: . _:a foaf:name "Alice" . _:a site:hits 2349 . _:b foaf:name "Bob" . _:b site:hits 105 . _:c foaf:name "Eve" . _:c site:hits 181 . rasqal-0.9.33/tests/sparql/bugs/353-result.ttl0000644000175000017500000000024712134571646016005 00000000000000_:r1qbnodeid1 "Alice" . _:r2qbnodeid1 "Eve" . _:r3qbnodeid1 "Bob" . rasqal-0.9.33/tests/sparql/bugs/manifest.ttl0000644000175000017500000000277412063453206015764 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Bug test cases" ; mf:entries ( [ mf:name "352" ; rdfs:comment "CONSTRUCT with LIMIT" ; mf:action [ qt:query <352.rq> ; qt:data <352.ttl> ] ; mf:result <352-result.ttl> ] [ mf:name "353" ; rdfs:comment "CONSTRUCT with ORDER BY" ; mf:action [ qt:query <353.rq> ; qt:data <353.ttl> ] ; mf:result <353-result.ttl> ] [ mf:name "354" ; rdfs:comment "Comparing xsd:int to xsd:integer" ; mf:action [ qt:query <354.rq> ; qt:data <354.nt> ] ; mf:result <354-result.ttl> ] [ mf:name "459" ; rdfs:comment "Selecting a binding with the same name as a bnode" ; mf:action [ qt:query <459.rq> ; qt:data <459.ttl> ] ; mf:result <459-result.ttl> ] [ mf:name "519" ; rdfs:comment "Handling integer^^URI data" ; mf:action [ qt:query <519.rq> ; qt:data <519.ttl> ] ; mf:result <519-result.ttl> ] # End of tests ). rasqal-0.9.33/tests/sparql/bugs/352.ttl0000644000175000017500000000033611344122204014447 00000000000000@prefix foaf: . @prefix site: . _:a foaf:name "Alice" . _:a site:hits 2349 . _:b foaf:name "Bob" . _:b site:hits 105 . _:c foaf:name "Eve" . _:c site:hits 181 . rasqal-0.9.33/tests/sparql/bugs/519-result.ttl0000644000175000017500000000211012063453206015770 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "a" ; rs:resultVariable "b" ; rs:resultVariable "c" ; rs:resultVariable "d" ; rs:solution [ rs:binding [ rs:variable "a" ; rs:value ] ; rs:binding [ rs:variable "b" ; rs:value ] ; rs:binding [ rs:variable "c" ; rs:value ] ; rs:binding [ rs:variable "d" ; rs:value ] ] . rasqal-0.9.33/tests/sparql/bugs/519.ttl0000644000175000017500000000042012063453206014456 00000000000000@prefix : . :a :prop "1"^^ . :b :prop "2"^^ . :c :prop "3"^^ . :d :prop "4"^^ . rasqal-0.9.33/tests/sparql/bugs/354.rq0000644000175000017500000000011411344116062014267 00000000000000SELECT ?x WHERE { ?x ?y . FILTER( ?y > 40 ) } rasqal-0.9.33/tests/sparql/bugs/459-result.ttl0000644000175000017500000000245711621007215016003 00000000000000@prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "first", "second" ; rs:solution [ rs:binding [ rs:value ; rs:variable "first" ] ; rs:binding [ rs:value "Dave" ; rs:variable "second" ] ; ] , [ rs:binding [ rs:value ; rs:variable "first" ] ; rs:binding [ rs:value "Libby" ; rs:variable "second" ] ; ] , [ rs:binding [ rs:value ; rs:variable "first" ] ; rs:binding [ rs:value "Nick" ; rs:variable "second" ] ; ] . rasqal-0.9.33/tests/sparql/bugs/354.nt0000644000175000017500000000014311344116062014270 00000000000000 "42"^^ . rasqal-0.9.33/tests/sparql/syntax/0000755000175000017500000000000012443715252014071 500000000000000rasqal-0.9.33/tests/sparql/syntax/ask0.rq0000644000175000017500000000012010362621550015177 00000000000000prefix ex: ask from where { $x ex:bar ex:baz } rasqal-0.9.33/tests/sparql/syntax/namespaces.rq0000644000175000017500000000012010362621550016460 00000000000000# rdf: is not a default namespace in sparql SELECT * WHERE { ?s rdf:type ?o } rasqal-0.9.33/tests/sparql/syntax/Makefile.am0000644000175000017500000001070112302411034016025 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax SPARQL tests # # Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data.n3 order.ttl SPARQL_TEST_FILES= \ describe1.rq groups.rq 0triples.rq \ construct1.rq construct2.rq \ ask0.rq distinct0.rq limit0.rq cast0.rq cast1.rq offset0.rq \ select-dup.rq order-distinct.rq distinct-undef.rq \ blankuri.rq SPARQL_BAD_TEST_FILES= \ nojam.rq namespaces.rq select-no-gp.rq SPARQL_TEST_NAMES= \ sparql-0triples \ order-by-distinct \ distinct-with-undef-var SPARQL_RESULT_FILES= \ result-0triples.n3 result-order-distinct.ttl result-distinct-undef.ttl EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_BAD_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query sparql-bad-parser" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-bad-parser: @tests="$(SPARQL_BAD_TEST_FILES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Bad Query Parsing Fails\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql parse fails $$test"; \ t=`echo $$test`; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/sparql_parser_test $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/syntax/Makefile.in0000644000175000017500000004073212434455633016070 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax SPARQL tests # # Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ # Copyright (C) 2004-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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/syntax DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data.n3 order.ttl SPARQL_TEST_FILES = \ describe1.rq groups.rq 0triples.rq \ construct1.rq construct2.rq \ ask0.rq distinct0.rq limit0.rq cast0.rq cast1.rq offset0.rq \ select-dup.rq order-distinct.rq distinct-undef.rq \ blankuri.rq SPARQL_BAD_TEST_FILES = \ nojam.rq namespaces.rq select-no-gp.rq SPARQL_TEST_NAMES = \ sparql-0triples \ order-by-distinct \ distinct-with-undef-var SPARQL_RESULT_FILES = \ result-0triples.n3 result-order-distinct.ttl result-distinct-undef.ttl EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_BAD_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/syntax/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/syntax/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query sparql-bad-parser" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @tests="$(SPARQL_TEST_FILES)"; \ type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @tests="$(SPARQL_TEST_NAMES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql query $$test"; \ expect="PositiveTest"; \ t=`echo $$test`; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) $$t\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-bad-parser: @tests="$(SPARQL_BAD_TEST_FILES)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Bad Query Parsing Fails\"; mf:entries ("; \ for test in $$tests; do \ comment="sparql parse fails $$test"; \ t=`echo $$test`; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/sparql_parser_test $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/syntax/order.ttl0000644000175000017500000000031610362621550015644 00000000000000@prefix ex: . @prefix rdf: . ex:r1 ex:prop "value 1" . ex:r2 ex:prop "value 3" . ex:r3 ex:prop "value 3" . ex:r4 ex:prop "value 4" . rasqal-0.9.33/tests/sparql/syntax/construct2.rq0000644000175000017500000000065610362621550016465 00000000000000PREFIX ex: CONSTRUCT { _:a ex:pred1 "hello" . _:b "val" . _:c ex:pred3 _:d . ex:thing1 ex:pred4 _:e . ex:pred5 _:f . ex:pred6 . . } FROM WHERE { ?x ?y ?z } rasqal-0.9.33/tests/sparql/syntax/select-no-gp.rq0000644000175000017500000000001111306366745016650 00000000000000select * rasqal-0.9.33/tests/sparql/syntax/result-distinct-undef.ttl0000644000175000017500000000254610362621550020774 00000000000000@prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "foo" ; rs:resultVariable "o" ; rs:resultVariable "p" ; rs:resultVariable "s" ; rs:solution [ rs:binding [ rs:value ; rs:variable "s" ] ; rs:binding [ rs:value ; rs:variable "o" ] ; rs:binding [ rs:value ; rs:variable "p" ] ] ; rs:solution [ rs:binding [ rs:value ; rs:variable "p" ] ; rs:binding [ rs:value "10" ; rs:variable "o" ] ; rs:binding [ rs:value ; rs:variable "s" ] ] . rasqal-0.9.33/tests/sparql/syntax/cast0.rq0000644000175000017500000000021110362621550015354 00000000000000PREFIX ex: SELECT * WHERE { ?x ?y ?y . FILTER ( (?x) || ex:bar(?x) ) } rasqal-0.9.33/tests/sparql/syntax/distinct-undef.rq0000644000175000017500000000006410362621550017270 00000000000000SELECT DISTINCT ?foo ?s ?p ?o WHERE { ?s ?p ?o } rasqal-0.9.33/tests/sparql/syntax/select-dup.rq0000644000175000017500000000013510362621550016414 00000000000000prefix ex: select $a $b $a $b $a $b $c where { $a ex:bar ex:baz . } rasqal-0.9.33/tests/sparql/syntax/data.n30000644000175000017500000000012110362621550015151 00000000000000@prefix ex: . ex:foo ex:bar ex:baz . ex:foo ex:bar "10" . rasqal-0.9.33/tests/sparql/syntax/limit0.rq0000644000175000017500000000013510362621550015545 00000000000000prefix ex: select * from where { $x ex:bar ex:baz } limit 5 rasqal-0.9.33/tests/sparql/syntax/nojam.rq0000644000175000017500000000013610362621550015454 00000000000000prefix foaf: select ?x where (?x foaf:name ?name) AND ? == "foo" rasqal-0.9.33/tests/sparql/syntax/groups.rq0000644000175000017500000000017010362621550015665 00000000000000PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name . { ?x foaf:mbox ?mbox } } rasqal-0.9.33/tests/sparql/syntax/manifest.n30000644000175000017500000000230410362621550016053 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Miscellaneous SPARQL syntax test cases" ; mf:entries ( [ mf:name "sparql-0triples" ; rdfs:comment "Select with 0 triples" ; mf:action [ qt:query <0triples.rq> ; qt:data ] ; mf:result ] [ mf:name "order-by-distinct" ; rdfs:comment "ORDER BY and DISTINCT with different variables" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "distinct-with-undef-var" ; rdfs:comment "SELECT DISTINCT with an undefined variable" ; mf:action [ qt:query ; qt:data ] ; mf:result ] # End of tests ). rasqal-0.9.33/tests/sparql/syntax/describe1.rq0000644000175000017500000000017710362621550016216 00000000000000prefix rdf: describe ?p, where { ?p rdf:value "hello" } rasqal-0.9.33/tests/sparql/syntax/result-0triples.n30000644000175000017500000000032211526037271017325 00000000000000@prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:solution [ ] . rasqal-0.9.33/tests/sparql/syntax/blankuri.rq0000644000175000017500000000030110612545467016163 00000000000000prefix foaf: select ?person from where { <_:foo> a foaf:Person . <_:foo> foaf:name ?person . FILTER (?person != <_foo> && ?person != <:foo> ) } rasqal-0.9.33/tests/sparql/syntax/0triples.rq0000644000175000017500000000002211306366401016104 00000000000000select * where {} rasqal-0.9.33/tests/sparql/syntax/construct1.rq0000644000175000017500000000007110362621550016453 00000000000000CONSTRUCT { ?x ?y ?z } FROM WHERE { ?x ?y ?z } rasqal-0.9.33/tests/sparql/syntax/offset0.rq0000644000175000017500000000005510362621550015716 00000000000000SELECT * WHERE { ?x ?y ?z } LIMIT 5 OFFSET 2 rasqal-0.9.33/tests/sparql/syntax/result-order-distinct.ttl0000644000175000017500000000164710362621550021007 00000000000000@prefix ex: . @prefix rs: . @prefix rdf: . [] rdf:type rs:ResultSet ; rs:resultVariable "value" ; rs:solution [ rs:binding [ rs:value "value 1" ; rs:variable "value" ] ; rs:index 1 ] ; rs:solution [ rs:binding [ rs:value "value 3" ; rs:variable "value" ] ; rs:index 2 ] ; rs:solution [ rs:binding [ rs:value "value 4" ; rs:variable "value" ] ; rs:index 3 ] . rasqal-0.9.33/tests/sparql/syntax/distinct0.rq0000644000175000017500000000013710362621550016252 00000000000000prefix ex: select distinct * from where { $x ex:bar ex:baz } rasqal-0.9.33/tests/sparql/syntax/order-distinct.rq0000644000175000017500000000024610362621550017304 00000000000000PREFIX ex: PREFIX rdf: SELECT DISTINCT ?value WHERE { ?res ex:prop ?value . } ORDER BY ?res rasqal-0.9.33/tests/sparql/syntax/cast1.rq0000644000175000017500000000020110362621550015354 00000000000000PREFIX xsd: SELECT * WHERE { ?x ?y ?val . FILTER ( xsd:integer(?val) = 10 ) } rasqal-0.9.33/tests/sparql/warnings/0000755000175000017500000000000012443715253014374 500000000000000rasqal-0.9.33/tests/sparql/warnings/Makefile.am0000644000175000017500000000435012302411034016332 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal warnings tests # # Copyright (C) 2011, David Beckett http://www.dajobe.org/ # # 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. # SPARQL_MANIFEST_FILES= manifest.ttl SPARQL_MODEL_FILES= \ empty.nt SPARQL_TEST_FILES= \ warning-1.rq warning-2.rq warning-3.rq SPARQL_TEST_NAMES= \ $(SPARQL_TEST_FILES) EXPECTED_SPARQL_WARNINGS= $(SPARQL_TEST_NAMES) SPARQL_RESULT_FILES= EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet check-lcoal # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) check-local: build-roqet @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-query" get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Preparation Warnings\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_WARNINGS); do \ comment="sparql warning $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) -W 100 '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/warnings/Makefile.in0000644000175000017500000003440712434455633016374 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal warnings tests # # Copyright (C) 2011, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/warnings DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.ttl SPARQL_MODEL_FILES = \ empty.nt SPARQL_TEST_FILES = \ warning-1.rq warning-2.rq warning-3.rq SPARQL_TEST_NAMES = \ $(SPARQL_TEST_FILES) EXPECTED_SPARQL_WARNINGS = $(SPARQL_TEST_NAMES) SPARQL_RESULT_FILES = EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/warnings/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/warnings/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet check-lcoal # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) check-local: build-roqet @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-query" get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Preparation Warnings\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_WARNINGS); do \ comment="sparql warning $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) -W 100 '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/warnings/warning-2.rq0000644000175000017500000000011711602004306016445 00000000000000# Binding variable (?b) that is never selected SELECT ?s ?p WHERE { ?s ?p ?b } rasqal-0.9.33/tests/sparql/warnings/warning-1.rq0000644000175000017500000000015511602004306016446 00000000000000# Selecting a variable (?a) that is never bound PREFIX : SELECT ?a WHERE { : : : } rasqal-0.9.33/tests/sparql/warnings/warning-3.rq0000644000175000017500000000014411602004306016446 00000000000000# Selecting the same variable (?c) multiple times in a select SELECT ?c ?c ?p ?o WHERE { ?c ?p ?o } rasqal-0.9.33/tests/sparql/warnings/manifest.ttl0000644000175000017500000000135212414554773016656 00000000000000@prefix : . @prefix rdf: . @prefix rdfs: . @prefix mf: . <> rdf:type mf:Manifest ; rdfs:comment "Syntax tests Syntax SPARQL 1.1" ; mf:entries ( :test_1 :test_2 :test_3 ) . :test_1 rdf:type mf:PositiveSyntaxTest11 ; mf:name "warning-1.rq" ; mf:action ; . :test_2 rdf:type mf:PositiveSyntaxTest11 ; mf:name "warning-2.rq" ; mf:action ; . :test_3 rdf:type mf:PositiveSyntaxTest11 ; mf:name "warning-3.rq" ; mf:action ; . rasqal-0.9.33/tests/sparql/warnings/empty.nt0000644000175000017500000000000011602004306015765 00000000000000rasqal-0.9.33/tests/sparql/ExprEquals/0000755000175000017500000000000012443715252014634 500000000000000rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-5.ttl0000644000175000017500000000074610362621550017366 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xu ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/Makefile.am0000644000175000017500000001050612302411034016573 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # SPARQL_MANIFEST_FILES= manifest.n3 SPARQL_MODEL_FILES= \ data-eq.ttl SPARQL_TEST_FILES= \ query-eq-1.rq query-eq-2.rq query-eq-3.rq query-eq-4.rq query-eq-5.rq \ query-eq2-1.rq query-eq2-2.rq query-eq2-graph-1.rq \ query-eq-graph-1.rq query-eq-graph-2.rq query-eq-graph-3.rq \ query-eq-graph-4.rq query-eq-graph-5.rq EXPECTED_SPARQL_CORRECT= \ "Equality 1-1" \ "Equality 1-2" \ "Equality 1-3" \ "Equality 1-4" \ "Equality 1-5" \ "Equality - 2 var - test equals" \ "Equality 1-3 -- graph" \ "Equality 1-4 -- graph" \ "Equality 1-5 -- graph" EXPECTED_SPARQL_CORRECT_FAILURES= \ "Equality 1-1 -- graph" \ "Equality 1-2 -- graph" \ "Equality - 2 var - test equals -- graph" SPARQL_RESULT_FILES= \ result-eq-1.ttl result-eq-2.ttl result-eq-3.ttl result-eq-4.ttl \ result-eq-5.ttl \ result-eq2-1.ttl result-eq2-2.ttl result-eq2-graph-1.ttl \ result-eq-graph-1.ttl result-eq-graph-2.ttl \ result-eq-graph-3.ttl result-eq-graph-4.ttl \ result-eq-graph-5.ttl EXTRA_DIST= \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES=diff.out roqet.err roqet.out roqet.tmp result.out .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/sparql/ExprEquals/Makefile.in0000644000175000017500000004055312434455633016634 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax SPARQL tests # # Copyright (C) 2005-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/sparql/ExprEquals DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SPARQL_MANIFEST_FILES = manifest.n3 SPARQL_MODEL_FILES = \ data-eq.ttl SPARQL_TEST_FILES = \ query-eq-1.rq query-eq-2.rq query-eq-3.rq query-eq-4.rq query-eq-5.rq \ query-eq2-1.rq query-eq2-2.rq query-eq2-graph-1.rq \ query-eq-graph-1.rq query-eq-graph-2.rq query-eq-graph-3.rq \ query-eq-graph-4.rq query-eq-graph-5.rq EXPECTED_SPARQL_CORRECT = \ "Equality 1-1" \ "Equality 1-2" \ "Equality 1-3" \ "Equality 1-4" \ "Equality 1-5" \ "Equality - 2 var - test equals" \ "Equality 1-3 -- graph" \ "Equality 1-4 -- graph" \ "Equality 1-5 -- graph" EXPECTED_SPARQL_CORRECT_FAILURES = \ "Equality 1-1 -- graph" \ "Equality 1-2 -- graph" \ "Equality - 2 var - test equals -- graph" SPARQL_RESULT_FILES = \ result-eq-1.ttl result-eq-2.ttl result-eq-3.ttl result-eq-4.ttl \ result-eq-5.ttl \ result-eq2-1.ttl result-eq2-2.ttl result-eq2-graph-1.ttl \ result-eq-graph-1.ttl result-eq-graph-2.ttl \ result-eq-graph-3.ttl result-eq-graph-4.ttl \ result-eq-graph-5.ttl EXTRA_DIST = \ $(SPARQL_MANIFEST_FILES) \ $(SPARQL_MODEL_FILES) \ $(SPARQL_TEST_FILES) \ $(SPARQL_RESULT_FILES) CLEANFILES = diff.out roqet.err roqet.out roqet.tmp result.out all: all-am .SUFFIXES: $(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 tests/sparql/ExprEquals/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/sparql/ExprEquals/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: build-core build-roqet build-sparql-test-utils check-local get-testsuites-list get-testsuite-sparql-lexer get-testsuite-sparql-parser # This sequence allows parallel building of build-core and then once # that is built, parallel building of the dependent programs: roqet, # sparql_lexer_test and sparql_parser_test build-core: @(cd $(top_builddir)/src ; $(MAKE)) build-roqet: build-core @(cd $(top_builddir)/utils ; $(MAKE) roqet) build-sparql-test-utils: build-core @(cd $(top_builddir)/src ; $(MAKE) sparql_lexer_test sparql_parser_test) check-local: build-roqet build-sparql-test-utils @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "sparql-lexer sparql-parser sparql-query" get-testsuite-sparql-lexer get-testsuite-sparql-parser: @type=`echo $@ | sed -e 's/^.*sparql-//' -e 's/er$$//'`; \ verb=`echo $$type`ing; \ prog=sparql_`echo $$type`er_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL legal $$verb\"; mf:entries ("; \ for test in $(SPARQL_TEST_FILES); do \ comment="sparql $$type of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-sparql-query: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Query Execution\"; mf:entries ("; \ for test in $(EXPECTED_SPARQL_CORRECT); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ for test in $(EXPECTED_SPARQL_CORRECT_FAILURES); do \ comment="sparql query $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(PERL) $(srcdir)/../check-sparql -s $(srcdir) '$$test'\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/sparql/ExprEquals/query-eq2-1.rq0000644000175000017500000000027010362621550017102 00000000000000PREFIX xsd: PREFIX : SELECT ?v1 ?v2 WHERE { ?x1 :p ?v1 . ?x2 :p ?v2 . FILTER ( ?v1 = ?v2 ) . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq2-2.rq0000644000175000017500000000027110362621550017104 00000000000000PREFIX xsd: PREFIX : SELECT ?v1 ?v2 WHERE { ?x1 :p ?v1 . ?x2 :p ?v2 . FILTER ( ?v1 != ?v2 ) . } rasqal-0.9.33/tests/sparql/ExprEquals/result-eq2-graph-1.ttl0000644000175000017500000002574010362621550020544 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x2" ; rs:resultVariable "v" ; rs:resultVariable "x1" ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x2" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd1 ; rs:variable "x1" ] ] ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x2" ] ; rs:binding [ rs:value 01 ; rs:variable "v" ] ; rs:binding [ rs:value :xi3 ; rs:variable "x1" ] ] ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x2" ] ; rs:binding [ rs:value :xi1 ; rs:variable "x1" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd3 ; rs:variable "x1" ] ; rs:binding [ rs:value :xd3 ; rs:variable "x2" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x2" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ; rs:binding [ rs:value :xi1 ; rs:variable "x1" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x2" ] ; rs:binding [ rs:value :xi2 ; rs:variable "x1" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xp2 ; rs:variable "x2" ] ; rs:binding [ rs:value :xp2 ; rs:variable "x1" ] ; rs:binding [ rs:value "1" ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd3 ; rs:variable "x1" ] ; rs:binding [ rs:value :xd1 ; rs:variable "x2" ] ] ; rs:solution [ rs:binding [ rs:value :xu ; rs:variable "x2" ] ; rs:binding [ rs:value :z ; rs:variable "v" ] ; rs:binding [ rs:value :xu ; rs:variable "x1" ] ] ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x1" ] ; rs:binding [ rs:value :xi2 ; rs:variable "x2" ] ; rs:binding [ rs:value 01 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xi2 ; rs:variable "x2" ] ; rs:binding [ rs:value :xi2 ; rs:variable "x1" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x2" ] ; rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd2 ; rs:variable "x1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd2 ; rs:variable "x1" ] ; rs:binding [ rs:value :xd1 ; rs:variable "x2" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x2" ] ; rs:binding [ rs:value :xi3 ; rs:variable "x1" ] ; rs:binding [ rs:value 01 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xt1 ; rs:variable "x2" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v" ] ; rs:binding [ rs:value :xt1 ; rs:variable "x1" ] ] ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x2" ] ; rs:binding [ rs:value :xi2 ; rs:variable "x1" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xd3 ; rs:variable "x1" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd2 ; rs:variable "x2" ] ] ; rs:solution [ rs:binding [ rs:value :xd1 ; rs:variable "x1" ] ; rs:binding [ rs:value :xd3 ; rs:variable "x2" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xd1 ; rs:variable "x1" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd1 ; rs:variable "x2" ] ] ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x1" ] ; rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v" ] ; rs:binding [ rs:value :xd3 ; rs:variable "x2" ] ] ; rs:solution [ rs:binding [ rs:value :xp1 ; rs:variable "x2" ] ; rs:binding [ rs:value :xp1 ; rs:variable "x1" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x1" ] ; rs:binding [ rs:value :xi2 ; rs:variable "x2" ] ; rs:binding [ rs:value 1 ; rs:variable "v" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq2-2.ttl0000644000175000017500000001020610362621550017435 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "v1" ; rs:resultVariable "v2" ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v1" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v2" ] ; rs:binding [ rs:value :z ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "zzz" ; rs:variable "v1" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v1" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "zzz" ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v1" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v1" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v1" ] ; rs:binding [ rs:value :z ; rs:variable "v2" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-graph-4.ttl0000644000175000017500000000075010362621550020457 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xp1 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-graph-5.ttl0000644000175000017500000000074710362621550020466 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xu ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-graph-3.ttl0000644000175000017500000000075010362621550020456 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xp2 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-2.ttl0000644000175000017500000000254110362621550017356 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xd1 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi2 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd3 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-1.ttl0000644000175000017500000000254110362621550017355 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd3 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi2 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd1 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-1.rq0000644000175000017500000000023310362621550017017 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = 1 ) . } rasqal-0.9.33/tests/sparql/ExprEquals/data-eq.ttl0000644000175000017500000000071510362621550016613 00000000000000@prefix : . @prefix xsd: . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p "1.0e0"^^xsd:double . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . ## :xdec1 :p "1.0"^^xsd:decimal . ## :xdec2 :p "1"^^xsd:decimal . ## :xdec3 :p "01"^^xsd:decimal . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a . rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-graph-4.rq0000644000175000017500000000020310362621550020116 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p "zzz" . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-graph-3.rq0000644000175000017500000000023510362621550020122 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = "1" ) . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq2-graph-1.rq0000644000175000017500000000023410362621550020201 00000000000000PREFIX xsd: PREFIX : SELECT ?x1 ?x2 ?v WHERE { ?x1 :p ?v . ?x2 :p ?v . } rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-graph-1.ttl0000644000175000017500000000151210362621550020451 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xi3 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi2 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xi1 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/manifest.n30000644000175000017500000000643110362621550016623 00000000000000@prefix rdf: . @prefix rdfs: . @prefix mf: . @prefix qt: . <> rdf:type mf:Manifest ; rdfs:comment "Some SPARQL test cases - equality of values" ; mf:entries ( [ mf:name "Equality 1-1" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-2" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-3" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-4" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-5" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality - 2 var - test equals" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ## [ mf:name "Equality - 2 var - test not equals " ; ## mf:action ## [ qt:query ; ## qt:data ] ; ## mf:result ## ] # Graph versions of the equality tests [ mf:name "Equality 1-1 -- graph" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-2 -- graph" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-3 -- graph" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-4 -- graph" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality 1-5 -- graph" ; mf:action [ qt:query ; qt:data ] ; mf:result ] [ mf:name "Equality - 2 var - test equals -- graph" ; mf:action [ qt:query ; qt:data ] ; mf:result ] ## Can't write != in a graph match. ## [ mf:name "Equality - 2 var - test not equals -- graph" ; ## mf:action ## [ qt:query ; ## qt:data ] ; ## mf:result ## ] ). rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-3.rq0000644000175000017500000000023510362621550017023 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = "1" ) . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-graph-1.rq0000644000175000017500000000020010362621550020110 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p 1 . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-graph-2.rq0000644000175000017500000000020310362621550020114 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p 1.0e0 . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-4.rq0000644000175000017500000000023710362621550017026 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = "zzz" ) . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-2.rq0000644000175000017500000000024010362621550017016 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = 1.0e0 ) . } rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-3.ttl0000644000175000017500000000074710362621550017365 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xp2 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-graph-5.rq0000644000175000017500000000023510362621550020124 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = :z ) . } rasqal-0.9.33/tests/sparql/ExprEquals/query-eq-5.rq0000644000175000017500000000023510362621550017025 00000000000000PREFIX xsd: PREFIX : SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = :z ) . } rasqal-0.9.33/tests/sparql/ExprEquals/result-eq2-1.ttl0000644000175000017500000003341410362621550017442 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "v2" ; rs:resultVariable "v1" ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v2" ] ; rs:binding [ rs:value 1 ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz"^^:myType ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v2" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "zzz" ; rs:variable "v2" ] ; rs:binding [ rs:value "zzz" ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v2" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v2" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v2" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v2" ] ; rs:binding [ rs:value 01 ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value 01 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 01 ; rs:variable "v1" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 01 ; rs:variable "v1" ] ; rs:binding [ rs:value 01 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 01 ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 01 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 01 ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v2" ] ; rs:binding [ rs:value 1 ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value 01 ; rs:variable "v2" ] ; rs:binding [ rs:value 1 ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1" ; rs:variable "v2" ] ; rs:binding [ rs:value "1" ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 01 ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 01 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v2" ] ; rs:binding [ rs:value 1 ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v2" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value "1.0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value :z ; rs:variable "v2" ] ; rs:binding [ rs:value :z ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value "1.0e0"^^xsd:double ; rs:variable "v1" ] ; rs:binding [ rs:value 01 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v2" ] ; rs:binding [ rs:value 1 ; rs:variable "v1" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value 1 ; rs:variable "v2" ] ] ; rs:solution [ rs:binding [ rs:value 1 ; rs:variable "v1" ] ; rs:binding [ rs:value "1"^^xsd:double ; rs:variable "v2" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-graph-2.ttl0000644000175000017500000000151210362621550020452 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xd2 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd1 ; rs:variable "x" ] ] ; rs:solution [ rs:binding [ rs:value :xd3 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/sparql/ExprEquals/result-eq-4.ttl0000644000175000017500000000074710362621550017366 00000000000000@prefix xsd: . @prefix rs: . @prefix rdf: . @prefix : . [] rdf:type rs:ResultSet ; rs:resultVariable "x" ; rs:solution [ rs:binding [ rs:value :xp1 ; rs:variable "x" ] ] . rasqal-0.9.33/tests/improve0000755000175000017500000003563212311460057012573 00000000000000#!/usr/bin/perl -w # # improve - Run Rasqal test suites # # USAGE: improve [options] [DIRECTORY [TESTSUITE]] # # Copyright (C) 2009, David Beckett http://www.dajobe.org/ # # 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: # GNU 'make' in the PATH (or where envariable MAKE is) # use strict; use File::Basename; use Getopt::Long; use Pod::Usage; use Cwd qw(abs_path getcwd); sub get_utils_dir() { my $dir = getcwd; while($dir ne '' && ! -d "$dir/utils") { $dir =~ s{/[^/]+$}{}; } if($dir eq '') { die "$0: Could not find 'utils' dir in parent directories\n"; } $dir . "/utils"; } our $UTILS_DIR = get_utils_dir(); our $TO_NTRIPLES = $ENV{TO_NTRIPLES} || $UTILS_DIR. '/to-ntriples'; our $MAKE=$ENV{MAKE} || 'make'; our $INDENT=' '; our $mf='http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#'; our $rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'; our $rdfs='http://www.w3.org/2000/01/rdf-schema#'; our $t='http://ns.librdf.org/2009/test-manifest#'; our $linewrap=78; our $banner_width=$linewrap-10; our $program=basename $0; our $debug=0; our(@counters)=qw( passed failed skipped xfailed uxpassed ); sub get_testsuites($) { my $dir=shift; my $cmd="cd $dir && $MAKE >/dev/null 2>&1"; print STDERR "$program: Running $cmd\n" if $debug > 1; system $cmd; $cmd="cd $dir && $MAKE get-testsuites-list 2>/dev/null | grep -v 'ing directory' | tail -1"; print STDERR "$program: Running $cmd\n" if $debug > 1; my $raw=`$cmd`; return split(/\s+/,$raw); } sub decode_literal ($) { my $lit=shift; $lit =~ s/^\"(.*)\"$/$1/; $lit =~ s/\\"/"/g; return $lit; } sub read_plan($$) { my($testsuite, $plan_file)=@_; my $dir = $testsuite->{dir}; my(%triples); my $manifest_node; my $entries_node; my $to_ntriples_error='to_ntriples.err'; my $cmd="$TO_NTRIPLES $plan_file 2> $to_ntriples_error"; print STDERR "$program: Running pipe from $cmd\n" if $debug > 1; open(MF, "$cmd |") or die "Cannot open pipe from '$cmd' - $!\n"; while() { chomp; s/\s+\.$//; my($s,$p,$o)=split(/ /,$_,3); die "no p in '$_'\n" unless defined $p; die "no o in '$_'\n" unless defined $o; push(@{$triples{$s}->{$p}}, $o); $manifest_node=$s if $p eq "<${rdf}type>" && $o eq "<${mf}Manifest>"; $entries_node=$o if $p eq "<${mf}entries>"; } close(MF); if(!-z $to_ntriples_error) { my $status = {status => 'fail', details => `cat $to_ntriples_error` }; unlink $to_ntriples_error; return $status; } unlink $to_ntriples_error; warn "Manifest node is '$manifest_node'\n" if $debug > 1; if($manifest_node) { my $desc=$triples{$manifest_node}->{"<${rdfs}comment>"}->[0]; if($desc) { $testsuite->{desc}=decode_literal($desc); } my $path=$triples{$manifest_node}->{"<${t}path>"}->[0]; if($path) { $testsuite->{path}=decode_literal($path); } } warn "Entries node is '$entries_node'\n" if $debug > 1; my $list_node=$entries_node; my(@tests); while($list_node) { warn "List node is '$list_node'\n" if $debug > 2; my $entry_node=$triples{$list_node}->{"<${rdf}first>"}->[0]; warn "Entry node is '$entry_node'\n" if $debug > 2; my $name=$triples{$entry_node}->{"<${mf}name>"}->[0] | ''; $name = decode_literal($name); warn "Entry name=$name\n" if $debug > 1; my $comment=$triples{$entry_node}->{"<${rdfs}comment>"}->[0] || ''; $comment = decode_literal($comment); warn "Entry comment=$comment\n" if $debug > 1; my $action=$triples{$entry_node}->{"<${mf}action>"}->[0] || ''; $action = decode_literal($action); warn "Entry action $action\n" if $debug > 1; my $entry_type=$triples{$entry_node}->{"<${rdf}type>"}->[0] || ''; warn "Entry type is ".($entry_type ? $entry_type : "NONE")."\n" if $debug > 1; my $expect='pass'; my $execute=1; $expect='fail' if $entry_type eq "<${t}NegativeTest>" || $entry_type eq "<${t}XFailTest>"; my $test_uri=$entry_node; $test_uri =~ s/^<(.+)>$/$1/; warn "Test uri $test_uri\n" if $debug > 1; push(@tests, {name => $name, comment => $comment, dir => $dir, expect => $expect, test_uri => $test_uri, action => $action } ); next_list_node: $list_node=$triples{$list_node}->{"<${rdf}rest>"}->[0]; last if $list_node eq "<${rdf}nil>"; } $testsuite->{tests}=\@tests; return {status => 'pass', details => ''}; } sub run_test($$) { my($testsuite,$test)=@_; my $name=$test->{name}; my $action=$test->{action}; $test->{status}= 'fail'; $test->{detail}= ''; $test->{log}= ''; my $path=$testsuite->{path} ? "PATH=$testsuite->{path} " : ""; print STDERR "$program: Running test $name: $path$action\n" if $debug > 1; my $sname=$name; $sname =~ s/\W/-/g; my $log="$sname.log"; system "$action > '$log' 2>&1"; my $rc=$?; my $status='fail'; if($rc == -1) { # exec() failed $test->{detail}="failed to execute $action: $!"; $status='fail'; } elsif($rc & 127) { # exec()ed but died on a signal my($signal,$coredump_p); ($signal,$coredump_p)=(($rc & 127), ($rc & 128)); $test->{detail}=sprintf("$path$action died with signal $signal, %s coredump". $coredump_p ? 'with' : 'without'); open(LOG, '<', $log); $test->{log}=join('', ); close(LOG); $status='fail'; if($signal == 2) { # SIGINT $testsuite->{abort}=1; } } elsif($rc) { # exec()ed and exited with non-0 $rc >>= 8; $test->{detail}="$path$action exited with code $rc"; if(open(LOG, '<', $log)) { $test->{log}=join('', ); close(LOG); } else { $test->{log}=''; } $status='fail'; } else { # exec()ed and exit 0 $status='pass'; } unlink $log; if($test->{expect} eq 'fail') { if($status eq 'fail') { $status='xfail' ; $test->{detail}="Test failed as expected" } else { $status='uxpass'; $test->{detail}="Test passed but expected to fail" } } $test->{status}=$status; return $status; } sub prepare_testsuite($) { my($testsuite)=@_; my $dir = $testsuite->{dir}; my $name = $testsuite->{name}; my $plan_file=$name."-plan.ttl"; $testsuite->{plan}=$plan_file; unlink $plan_file; if(!-r $plan_file) { system("$MAKE >/dev/null 2>&1"); my $cmd="$MAKE get-testsuite-$name 2>/dev/null | grep -v 'ing directory' | sed -n -e '/\@prefix/,\$p' > $plan_file"; print STDERR "$program: Running $cmd\n" if $debug > 1; system $cmd; my $rc=$?; return { status => 'fail', details => "Running '$cmd' failed with status $rc" } if $rc; } return { status => 'fail', details => "No testsuite plan file $plan_file could be created in $dir" } unless -r $plan_file && !-z $plan_file; my $result=read_plan($testsuite, $plan_file); if($testsuite->{path}) { $ENV{PATH}=$testsuite->{path}; } return $result; } sub run_testsuite($$$) { my($testsuite, $indent, $verbose)=@_; my $dir = $testsuite->{dir}; my $name = $testsuite->{name}; my(@tests)=@{$testsuite->{tests}}; my $desc=$testsuite->{desc} || $name; print $indent."Running testsuite $name: $desc\n"; my $ntests=scalar @tests; my(@passed); my(@failed); my(@xfailed); # Expected failure my(@skipped); my(@uxpassed); # Unexpected pass my $expected_failures_count = 0; print $indent unless $verbose; my $result=0; my $column=length($indent); for my $test (@tests) { $test->{testsuite}=$name; if($testsuite->{dryrun}) { $test->{status} = 'skip'; $test->{detail} = ''; } else { run_test($testsuite,$test); } $expected_failures_count++ if $test->{expect} eq 'fail'; my $rc=$test->{status}; if($rc eq 'fail') { print "F" unless $verbose; push(@failed, $test); } elsif($rc eq 'xfail') { print "*" unless $verbose; push(@xfailed, $test); } elsif($rc eq 'uxpass') { print "!" unless $verbose; push(@uxpassed, $test); } elsif($rc eq 'skip') { print "-" unless $verbose; push(@skipped, $test); } else { print "." unless $verbose; push(@passed, $test); } $column++; if(!$verbose && $column > $linewrap) { print "\n$indent"; $column=$indent; } if($verbose) { my $rcv = $rc; $rcv = uc $rc if $rc ne 'pass'; my $i = $indent . $INDENT; printf "${i}$test->{name}: $rcv%s\n", (length($test->{detail}) ? " - ".$test->{detail} : ''); if($verbose > 1) { if($rc eq 'fail' && $test->{log}) { my(@lines)=split(/\n/, $test->{log}); print $i." ".join("\n${i} ", @lines)."\n"; } } } if($testsuite->{abort}) { print "aborted"; last; } } print "\n" unless $verbose; my $plan_file= $testsuite->{plan}; unlink $plan_file; my $status = ((scalar(@xfailed) == $expected_failures_count) && !@failed) ? 'pass' : 'fail'; return { passed => \@passed, failed => \@failed, xfailed => \@xfailed, skipped => \@skipped, uxpassed => \@uxpassed, status => $status }; } sub format_testsuite_result($$$;$) { my($fh,$result,$indent,$verbose)=@_; $verbose ||= 0; if(ref($result->{failed})) { my(@failed)=@{$result->{failed}}; if(@failed) { print $fh $indent."Failed tests:\n"; for my $ftest (@failed) { my $i=$indent.$INDENT; print $i . "=" x $banner_width . "\n" if $verbose; printf $i . "$ftest->{name}%s\n", ($verbose ? " in suite $ftest->{testsuite} in $ftest->{dir}" : ""); print $i . $ftest->{detail} . "\n" if $verbose && $ftest->{detail}; if($ftest->{log} && $verbose) { my $i2=$i.$INDENT; my(@lines)=split(/\n/, $ftest->{log}); @lines = splice(@lines, -15) if scalar(@lines) > 15; print $i2.join("\n${i2}", "...", @lines)."\n"; } print $i . "=" x $banner_width . "\n" if $verbose; } } } if(ref($result->{uxpassed})) { my(@uxpassed)=@{$result->{uxpassed}}; print $fh $indent."Unexpected passed tests:\n" . $indent . $INDENT . join("\n".$indent.$INDENT, map { $_->{name}. ($debug ? " (".$_->{test_uri}.")" : "") } @uxpassed) . "\n" if @uxpassed; } print $fh $indent; for my $counter (@counters) { my $count=0; if(defined($result->{$counter}) && ref($result->{$counter})) { $count = scalar(@{$result->{$counter}}); } print $fh ucfirst($counter).": ".$count." "; } print $fh "\n"; } sub run_testsuites_in_dir($$$$$) { my($dir,$ts,$indent,$verbose,$dryrun)=@_; my(@testsuites)=@{$ts}; chdir($dir) or die "$program: Directory $dir not found\n"; my(@known_testsuites)=get_testsuites('.'); if(!@known_testsuites) { warn "$program: Could not find any testsuites in $dir\n"; return { status => 'fail', details => 'No testsuites found'}; } my(%is_known_testsuite)=map { $_ => 1} @known_testsuites; if(!@testsuites) { @testsuites = @known_testsuites; } else { my(@t)=grep($is_known_testsuite{$_}, @testsuites); if(!@t) { return { status => 'skip', details => 'No known testsuites given in: @testsuites'}; } @testsuites=@t; } print "$indent$program: Running testsuites @testsuites in $dir\n"; $indent.=$INDENT; my $total_result = { }; my $total_status='pass'; for my $testsuite_name (@testsuites) { my $testsuite = {dir => $dir, name => $testsuite_name }; my $result = prepare_testsuite($testsuite); if($result->{status} eq 'fail') { my $details=$result->{details}; print "$indent$program: Suite $testsuite->{name} failed preparation - $details\n"; $total_status='fail'; next; } $result=run_testsuite($testsuite, $indent, $verbose); format_testsuite_result(*STDOUT, $result, $indent.$INDENT, $verbose); for my $counter (@counters) { push(@{$total_result->{$counter}}, @{$result->{$counter}}); } $total_status='fail' if $result->{status} eq 'fail'; print "\n" if @testsuites > 1; } $total_result->{status} = $total_status; printf $indent."Testsuites summary%s:\n", ($verbose ? " for dir $dir" : ''); format_testsuite_result(*STDOUT, $total_result, $indent.$INDENT, $verbose); printf $indent."Result status: $total_status\n" if $verbose; return $total_result; } ###################################################################### $debug=1 if defined $ENV{'RASQAL_DEBUG'}; my $dryrun=0; my $usage=0; my $verbose=0; my $recursive=0; # Argument handling GetOptions( 'debug|d+' => \$debug, # incremental 'dryrun|n' => \$dryrun, 'recursive|r' => \$recursive, 'verbose|v+' => \$verbose, # incremental 'help|h|?' => \$usage ) || pod2usage(2); pod2usage(-verbose => 2) if $usage; pod2usage("$program: Too many arguments.\n") if (@ARGV > 2); my($dir,@testsuites)=@ARGV; $dir ||= '.'; $verbose++ if $debug; $dir = abs_path($dir); my(@dirs); if($recursive) { my $cmd="find . -type d -print | grep -v \.svn"; warn "$program: Recursive scan for testsuites\n" if $verbose; open(PIPE, "$cmd|") or die "$program: Cannot open pipe from '$cmd' - $!\n"; while() { chomp; my $dir=abs_path($_); my(@testsuites)=get_testsuites($dir); if(@testsuites) { warn " $_: @testsuites\n" if $verbose; push(@dirs, $dir) } } close(PIPE); } else { push(@dirs, abs_path($dir)); } warn "$program: Running testsuites in dirs: @dirs\n" if $debug; my $total_result = { }; my $rc = 0; for my $dir (@dirs) { my $result = run_testsuites_in_dir($dir, \@testsuites, '', $verbose, $dryrun); for my $counter (@counters) { my $r = $result->{$counter}; push(@{$total_result->{$counter}}, @$r) if $r; } $rc=1 if $result->{status} eq 'fail'; } if($recursive) { print "\nTotal of all Testsuites\n"; format_testsuite_result(*STDOUT, $total_result, $INDENT, 1); } exit $rc; __END__ =head1 NAME improve - run Rasqal testsuites =head1 SYNOPSIS improve [options] [DIR [TESTSUITES]] =head1 OPTIONS =over 8 =item B<-d>, B<--debug> Enable extra debugging output. =item B<-n>, B<--dryrun> Do not run tests. =item B<-r>, B<--recursive> Run all testsuites below the given I

=item B<-h>, B<--help> Give help summary. =item B<-v>, B<--verbose> Enable extra verbosity when running tests. =back =head1 DESCRIPTION Run Rasqal testsuites from a Turtle manifest in the I. If I are not given, provides a list of known testsuites in I. I defaults to '.' if not given. =cut rasqal-0.9.33/tests/laqrs/0000755000175000017500000000000012443715253012364 500000000000000rasqal-0.9.33/tests/laqrs/Makefile.am0000644000175000017500000000145511031047556014341 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal LAQRS tests # # Copyright (C) 2007-2008, David Beckett http://www.dajobe.org/ # # 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. # SUBDIRS=syntax rasqal-0.9.33/tests/laqrs/Makefile.in0000644000175000017500000004727612434455633014374 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal LAQRS tests # # Copyright (C) 2007-2008, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/laqrs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ SUBDIRS = syntax all: all-recursive .SUFFIXES: $(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 tests/laqrs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/laqrs/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: 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-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: rasqal-0.9.33/tests/laqrs/syntax/0000755000175000017500000000000012443715253013712 500000000000000rasqal-0.9.33/tests/laqrs/syntax/count2.rq0000644000175000017500000000005511354707245015412 00000000000000SELECT ( COUNT(?c) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/count1.rq0000644000175000017500000000005511354673420015406 00000000000000SELECT ( COUNT(?c) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/Makefile.am0000644000175000017500000000555311476100736015675 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal syntax LAQRS tests # # Copyright (C) 2007-2010, David Beckett http://www.dajobe.org/ # # 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. # LAQRS_MODEL_FILES= \ data.n3 LAQRS_TEST_FILES= \ agg-function1.rq \ coalesce1.rq \ count1.rq \ count2.rq \ count3.rq \ count4.rq \ coverage.rq \ explain.rq \ function-distinct1.rq \ delete.rq \ in1.rq \ in2.rq \ insert.rq \ avg1.rq \ max1.rq \ min1.rq \ sum1.rq \ let1.rq \ let2.rq \ let3.rq \ let4.rq \ strdt1.rq \ strdt2.rq \ strlang1.rq \ bnode1.rq \ bnode2.rq \ uri1.rq \ iri1.rq \ if1.rq LAQRS_BAD_TEST_FILES= \ bad-select-expr.rq EXPECTED_LAQRS_CORRECT_FAILURES= EXTRA_DIST= \ $(LAQRS_MODEL_FILES) \ $(LAQRS_TEST_FILES) \ $(LAQRS_BAD_TEST_FILES) build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "laqrs-parse-good laqrs-parse-bad" get-testsuite-laqrs-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"LAQRS legal parsing\"; mf:entries ("; \ for test in $(LAQRS_TEST_FILES); do \ comment="laqrs parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i laqrs $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-laqrs-parse-bad: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"LAQRS illegal parsing\"; mf:entries ("; \ for test in $(LAQRS_BAD_TEST_FILES); do \ comment="laqrs failing to parse of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i laqrs $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/laqrs/syntax/Makefile.in0000644000175000017500000003551512434455633015713 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal syntax LAQRS tests # # Copyright (C) 2007-2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/laqrs/syntax DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ LAQRS_MODEL_FILES = \ data.n3 LAQRS_TEST_FILES = \ agg-function1.rq \ coalesce1.rq \ count1.rq \ count2.rq \ count3.rq \ count4.rq \ coverage.rq \ explain.rq \ function-distinct1.rq \ delete.rq \ in1.rq \ in2.rq \ insert.rq \ avg1.rq \ max1.rq \ min1.rq \ sum1.rq \ let1.rq \ let2.rq \ let3.rq \ let4.rq \ strdt1.rq \ strdt2.rq \ strlang1.rq \ bnode1.rq \ bnode2.rq \ uri1.rq \ iri1.rq \ if1.rq LAQRS_BAD_TEST_FILES = \ bad-select-expr.rq EXPECTED_LAQRS_CORRECT_FAILURES = EXTRA_DIST = \ $(LAQRS_MODEL_FILES) \ $(LAQRS_TEST_FILES) \ $(LAQRS_BAD_TEST_FILES) all: all-am .SUFFIXES: $(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 tests/laqrs/syntax/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/laqrs/syntax/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ clean-libtool distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am build-sparql-parser-test: @(cd $(top_builddir)/src ; $(MAKE) sparql_parser_test) check-local: build-sparql-parser-test @$(PERL) $(srcdir)/../../improve . get-testsuites-list: @echo "laqrs-parse-good laqrs-parse-bad" get-testsuite-laqrs-parse-good: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"LAQRS legal parsing\"; mf:entries ("; \ for test in $(LAQRS_TEST_FILES); do \ comment="laqrs parsing of $$test"; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i laqrs $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." get-testsuite-laqrs-parse-bad: @prog=sparql_parser_test; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"LAQRS illegal parsing\"; mf:entries ("; \ for test in $(LAQRS_BAD_TEST_FILES); do \ comment="laqrs failing to parse of $$test"; \ $(RECHO) " [ a t:NegativeTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"$(top_builddir)/src/$$prog -i laqrs $(srcdir)/$$test\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/laqrs/syntax/min1.rq0000644000175000017500000000005311354673420015037 00000000000000SELECT ( MIN(?c) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/strdt1.rq0000644000175000017500000000024711352051521015407 00000000000000# STRDT(str, datatype URI) makes a datatyped literal PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( STRDT(?c, ex:DT) = "val"^^ex:DT ) } rasqal-0.9.33/tests/laqrs/syntax/avg1.rq0000644000175000017500000000005311354673420015031 00000000000000SELECT ( AVG(?c) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/function-distinct1.rq0000644000175000017500000000033611354673420017724 00000000000000# Test aggregate function call with DISTINCT. This isn't actually # legal / useful but tests the expression grammar. PREFIX ex: SELECT * WHERE { ?s ?p ?o . FILTER( ex:foo ( DISTINCT ) ) } rasqal-0.9.33/tests/laqrs/syntax/if1.rq0000644000175000017500000000046111353750371014655 00000000000000# IF(expr_cond, expr_true, expr_false) evaluates expr_cond and if # true returns expr1, otherwise expr2. # AKA C ternary operation # result = expr_cond ? expr_true : expr_false PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( IF("10" = "10", ex:true, ex:false) = ex:true) } rasqal-0.9.33/tests/laqrs/syntax/bnode1.rq0000644000175000017500000000023511352051521015333 00000000000000# BNODE(string) => make a blank node with given name PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( BNODE("foo") = _:foo ) } rasqal-0.9.33/tests/laqrs/syntax/coalesce1.rq0000644000175000017500000000015711354673420016037 00000000000000PREFIX : SELECT ( COALESCE(?o + 1 - 1, "not numeric") AS val ) WHERE { ?s ?p ?o . } rasqal-0.9.33/tests/laqrs/syntax/count4.rq0000644000175000017500000000005411354707245015413 00000000000000SELECT ( COUNT(*) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/strlang1.rq0000644000175000017500000000025611352051521015721 00000000000000# STRLANG(str, language) makes a plain literal with language PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( STRLANG(?c, "foo") = "val"@foo ) } rasqal-0.9.33/tests/laqrs/syntax/count3.rq0000644000175000017500000000005411354673420015407 00000000000000SELECT ( COUNT(*) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/data.n30000644000175000017500000000012110612545466015002 00000000000000@prefix ex: . ex:foo ex:bar ex:baz . ex:foo ex:bar "10" . rasqal-0.9.33/tests/laqrs/syntax/strdt2.rq0000644000175000017500000000027411352051521015410 00000000000000# STRDT(str, "uri string") makes a datatyped literal PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( STRDT(?c, "http://example.org/dt#DT") = "val"^^ex:DT ) } rasqal-0.9.33/tests/laqrs/syntax/iri1.rq0000644000175000017500000000027611352051521015034 00000000000000# IRI(str) makes an RDF URI Reference (aka IRI) PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( IRI("http://www.example.org/") = ) } rasqal-0.9.33/tests/laqrs/syntax/delete.rq0000644000175000017500000000021110612545466015435 00000000000000PREFIX ex: DELETE FROM WHERE { $r a ex:Class ; ex:numPred $number ; ex:stringPred $name . } rasqal-0.9.33/tests/laqrs/syntax/explain.rq0000644000175000017500000000043011354673420015632 00000000000000PREFIX ex: EXPLAIN SELECT $number $name ( (3 + $number) AS foo ) ( COUNT(*) AS bar ) FROM WHERE { $r a ex:Class ; ex:numPred $number ; ex:stringPred $name . FILTER ($number < 10 && $name != "foo") } GROUP BY $name ORDER BY $number rasqal-0.9.33/tests/laqrs/syntax/in1.rq0000644000175000017500000000007011355026017014654 00000000000000SELECT * WHERE { ?s ?p ?o FILTER (?o IN (1, 2, 3) ) } rasqal-0.9.33/tests/laqrs/syntax/max1.rq0000644000175000017500000000005311354673420015041 00000000000000SELECT ( MAX(?c) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/in2.rq0000644000175000017500000000007411355026017014661 00000000000000SELECT * WHERE { ?s ?p ?o FILTER (?o NOT IN (1, 2, 3) ) } rasqal-0.9.33/tests/laqrs/syntax/bnode2.rq0000644000175000017500000000034511352051521015336 00000000000000# BNODE() => make a blank node # # This example is contrived; it probably needs a constructor # and/or sub-SELECTs to make sense PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( ISBLANK(BNODE()) ) } rasqal-0.9.33/tests/laqrs/syntax/coverage.rq0000644000175000017500000000035411354673420015772 00000000000000PREFIX ex: EXPLAIN SELECT $number $name ( (3 + $number) AS foo ) ( COUNT(*) AS bar ) FROM WHERE { $r a ex:Class ; ex:numPred $number ; ex:stringPred $name . } GROUP BY $name ORDER BY $number rasqal-0.9.33/tests/laqrs/syntax/sum1.rq0000644000175000017500000000005311354673420015060 00000000000000SELECT ( SUM(?c) AS x ) WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/let3.rq0000644000175000017500000000030411271475511015040 00000000000000PREFIX foaf: PREFIX : SELECT ?name ?inch { ?x foaf:name ?name . ?x :height ?cm . LET ( ?inch := ?cm/2.54 ) FILTER (?inch > 68) } rasqal-0.9.33/tests/laqrs/syntax/uri1.rq0000644000175000017500000000027611352051521015050 00000000000000# IRI(str) makes an RDF URI Reference (aka IRI) PREFIX ex: SELECT ?c WHERE { ?a ?b ?c FILTER ( IRI("http://www.example.org/") = ) } rasqal-0.9.33/tests/laqrs/syntax/let1.rq0000644000175000017500000000026511271475511015044 00000000000000PREFIX : CONSTRUCT { ?this :area ?area . } WHERE { ?this :width ?width . ?this :height ?height . LET (?area := (?width * ?height)) . } rasqal-0.9.33/tests/laqrs/syntax/insert.rq0000644000175000017500000000021110613153312015461 00000000000000PREFIX ex: INSERT FROM WHERE { $r a ex:Class ; ex:numPred $number ; ex:stringPred $name . } rasqal-0.9.33/tests/laqrs/syntax/bad-select-expr.rq0000644000175000017500000000015110612545466017155 00000000000000# Cannot have a select expression mentioning the AS variable SELECT ?a COUNT(?c) AS c WHERE { ?a ?b ?c } rasqal-0.9.33/tests/laqrs/syntax/let2.rq0000644000175000017500000000031511271475511015041 00000000000000PREFIX ex: SELECT ?x ?r WHERE { ?x ex:property ?y . LET (?helper1 := ex:function1(?y)) . LET (?helper2 := ex:function2(?helper1)) . LET (?r := ex:function3(?helper2)) . } rasqal-0.9.33/tests/laqrs/syntax/agg-function1.rq0000644000175000017500000000035711354673420016644 00000000000000# Test aggregate function call with a ';' introducting zero parameters # This isn't actually legal / useful but tests the expression grammar. PREFIX ex: SELECT * WHERE { ?s ?p ?o . FILTER( ex:foo ( ; ) ) } rasqal-0.9.33/tests/laqrs/syntax/let4.rq0000644000175000017500000000006011453251120015026 00000000000000SELECT * WHERE { ?x ?y ?z LET(?a := ?z*2) } rasqal-0.9.33/tests/engine/0000755000175000017500000000000012443715251012505 500000000000000rasqal-0.9.33/tests/engine/rasqal_order_test.c0000644000175000017500000001235212434455625016317 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_order_test.c - Rasqal RDF Query Order Tests * * Copyright (C) 2006, David Beckett http://purl.org/net/dajobe/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef RASQAL_QUERY_SPARQL #define QUERY_LANGUAGE "sparql" static const char* animalsList[27]={ "aardvark", "badger", "cow", "dog", "elephant", "fox", "goat", "horse", "iguana", "jackal", "koala", "lemur", "mouse", "newt", "owl", "penguin", "quail", "rat", "snake", "tiger", "uakari", "vole", "whale", "xantus", "yak", "zebra", NULL }; #define QUERY_FORMAT "\ PREFIX ex: \n\ SELECT $animal \n\ FROM <%s/%s> \n\ WHERE { \n\ $zoo ex:hasAnimal $animal \n\ } ORDER BY $animal LIMIT %d OFFSET %d" #else #define NO_QUERY_LANGUAGE #endif #ifdef NO_QUERY_LANGUAGE int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); fprintf(stderr, "%s: No supported query language available, skipping test\n", program); return(0); } #else int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); raptor_uri *base_uri; unsigned char *uri_string; const char *query_language_name=QUERY_LANGUAGE; const char *query_format=QUERY_FORMAT; static const char* animals="animals.nt"; int failures=0; int i; rasqal_world *world; if(argc != 2) { fprintf(stderr, "USAGE: %s \n", program); return(1); } world=rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } uri_string=raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); for(i=0; i<6; i++) { rasqal_query *query = NULL; rasqal_query_results *results = NULL; unsigned char *data_dir_string; unsigned char *query_string; int count; int limit=9-3*i; int offset=0+3*i; if(i==4) { limit=8; offset=1; } else if (i==5) { limit=1; offset=8; } data_dir_string=raptor_uri_filename_to_uri_string(argv[1]); query_string = RASQAL_MALLOC(unsigned char*, strlen((const char*)data_dir_string) + strlen(animals) + strlen(query_format) + 1); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf((char*)query_string, query_format, data_dir_string, animals, limit, offset); #pragma GCC diagnostic pop raptor_free_memory(data_dir_string); query=rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query %d in language %s FAILED\n", program, i, query_language_name); return(1); } printf("%s: preparing %s query %d\n", program, query_language_name, i); if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: %s query prepare %d '%s' FAILED\n", program, query_language_name, i, query_string); return(1); } RASQAL_FREE(char*, query_string); printf("%s: executing query %d limit %d offset %d\n", program, i, limit, offset); results=rasqal_query_execute(query); if(!results) { fprintf(stderr, "%s: query execution %d FAILED\n", program, i); return(1); } printf("%s: checking query %d results\n", program, i); count=0; while(results && !rasqal_query_results_finished(results)) { const unsigned char *name=(const unsigned char *)"animal"; rasqal_literal *value=rasqal_query_results_get_binding_value_by_name(results, name); const char *answer=animalsList[count+offset]; if(strcmp((const char*)rasqal_literal_as_string(value), answer)) { printf("result %d FAILED: %s=", count, (char*)name); rasqal_literal_print(value, stdout); printf(" expected value '%s'\n", answer); failures++; } rasqal_query_results_next(results); count++; } if(results) rasqal_free_query_results(results); printf("%s: checking query %d results count\n", program, i); if(count != limit) { printf("%s: query execution %d FAILED returning %d results, expected %d\n", program, i, count, limit); return(1); } rasqal_free_query(query); printf("%s: query %d OK\n", program, i); } raptor_free_uri(base_uri); rasqal_free_world(world); return failures; } #endif rasqal-0.9.33/tests/engine/Makefile.am0000644000175000017500000000554711476100736014475 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal query engine tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # # 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. # local_tests=rasqal_order_test$(EXEEXT) rasqal_graph_test$(EXEEXT) \ rasqal_construct_test$(EXEEXT) rasqal_limit_test$(EXEEXT) \ rasqal_triples_test$(EXEEXT) EXTRA_PROGRAMS=$(local_tests) AM_CPPFLAGS=@RASQAL_INTERNAL_CPPFLAGS@ -I$(top_srcdir)/src AM_CFLAGS=@RASQAL_INTERNAL_CPPFLAGS@ $(MEM) AM_LDFLAGS=@RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) CLEANFILES=$(local_tests) rasqal_order_test_SOURCES = rasqal_order_test.c rasqal_order_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_graph_test_SOURCES = rasqal_graph_test.c rasqal_graph_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_construct_test_SOURCES = rasqal_construct_test.c rasqal_construct_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_limit_test_SOURCES = rasqal_limit_test.c rasqal_limit_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_triples_test_SOURCES = rasqal_triples_test.c rasqal_triples_test_LDADD = $(top_builddir)/src/librasqal.la # These are compiled here and used elsewhere for running tests check-local: $(local_tests) run-rasqal-tests run-rasqal-tests: $(local_tests) @$(PERL) $(srcdir)/../improve . $(top_builddir)/src/librasqal.la: cd $(top_builddir)/src && $(MAKE) librasqal.la $(top_builddir)/../raptor/src/libraptor.la: cd $(top_builddir)/../raptor/src && $(MAKE) $(AM_MAKEFLAGS) libraptor.la get-testsuites-list: @echo "engine" get-testsuite-engine: @tests="$(local_tests)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"Query Engine Tests\"; mf:entries ("; \ for test in $$tests; do \ comment="rdql query $$test"; \ expect="PositiveTest"; \ arg="$(top_srcdir)/data/"; \ if [ $$test = rasqal_limit_test$(EXEEXT) ]; then \ arg="$$arg/letters.nt"; \ fi; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"./$$test $$arg\" ]"; \ done; \ $(RECHO) ")." rasqal-0.9.33/tests/engine/Makefile.in0000644000175000017500000005364112434455633014510 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal query engine tests # # Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/engine DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_rasqal_construct_test_OBJECTS = rasqal_construct_test.$(OBJEXT) rasqal_construct_test_OBJECTS = $(am_rasqal_construct_test_OBJECTS) rasqal_construct_test_DEPENDENCIES = $(top_builddir)/src/librasqal.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_rasqal_graph_test_OBJECTS = rasqal_graph_test.$(OBJEXT) rasqal_graph_test_OBJECTS = $(am_rasqal_graph_test_OBJECTS) rasqal_graph_test_DEPENDENCIES = $(top_builddir)/src/librasqal.la am_rasqal_limit_test_OBJECTS = rasqal_limit_test.$(OBJEXT) rasqal_limit_test_OBJECTS = $(am_rasqal_limit_test_OBJECTS) rasqal_limit_test_DEPENDENCIES = $(top_builddir)/src/librasqal.la am_rasqal_order_test_OBJECTS = rasqal_order_test.$(OBJEXT) rasqal_order_test_OBJECTS = $(am_rasqal_order_test_OBJECTS) rasqal_order_test_DEPENDENCIES = $(top_builddir)/src/librasqal.la am_rasqal_triples_test_OBJECTS = rasqal_triples_test.$(OBJEXT) rasqal_triples_test_OBJECTS = $(am_rasqal_triples_test_OBJECTS) rasqal_triples_test_DEPENDENCIES = $(top_builddir)/src/librasqal.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(rasqal_construct_test_SOURCES) \ $(rasqal_graph_test_SOURCES) $(rasqal_limit_test_SOURCES) \ $(rasqal_order_test_SOURCES) $(rasqal_triples_test_SOURCES) DIST_SOURCES = $(rasqal_construct_test_SOURCES) \ $(rasqal_graph_test_SOURCES) $(rasqal_limit_test_SOURCES) \ $(rasqal_order_test_SOURCES) $(rasqal_triples_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ local_tests = rasqal_order_test$(EXEEXT) rasqal_graph_test$(EXEEXT) \ rasqal_construct_test$(EXEEXT) rasqal_limit_test$(EXEEXT) \ rasqal_triples_test$(EXEEXT) EXTRA_PROGRAMS = $(local_tests) AM_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ -I$(top_srcdir)/src AM_CFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ $(MEM) AM_LDFLAGS = @RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) CLEANFILES = $(local_tests) rasqal_order_test_SOURCES = rasqal_order_test.c rasqal_order_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_graph_test_SOURCES = rasqal_graph_test.c rasqal_graph_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_construct_test_SOURCES = rasqal_construct_test.c rasqal_construct_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_limit_test_SOURCES = rasqal_limit_test.c rasqal_limit_test_LDADD = $(top_builddir)/src/librasqal.la rasqal_triples_test_SOURCES = rasqal_triples_test.c rasqal_triples_test_LDADD = $(top_builddir)/src/librasqal.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 tests/engine/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/engine/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): rasqal_construct_test$(EXEEXT): $(rasqal_construct_test_OBJECTS) $(rasqal_construct_test_DEPENDENCIES) $(EXTRA_rasqal_construct_test_DEPENDENCIES) @rm -f rasqal_construct_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_construct_test_OBJECTS) $(rasqal_construct_test_LDADD) $(LIBS) rasqal_graph_test$(EXEEXT): $(rasqal_graph_test_OBJECTS) $(rasqal_graph_test_DEPENDENCIES) $(EXTRA_rasqal_graph_test_DEPENDENCIES) @rm -f rasqal_graph_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_graph_test_OBJECTS) $(rasqal_graph_test_LDADD) $(LIBS) rasqal_limit_test$(EXEEXT): $(rasqal_limit_test_OBJECTS) $(rasqal_limit_test_DEPENDENCIES) $(EXTRA_rasqal_limit_test_DEPENDENCIES) @rm -f rasqal_limit_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_limit_test_OBJECTS) $(rasqal_limit_test_LDADD) $(LIBS) rasqal_order_test$(EXEEXT): $(rasqal_order_test_OBJECTS) $(rasqal_order_test_DEPENDENCIES) $(EXTRA_rasqal_order_test_DEPENDENCIES) @rm -f rasqal_order_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_order_test_OBJECTS) $(rasqal_order_test_LDADD) $(LIBS) rasqal_triples_test$(EXEEXT): $(rasqal_triples_test_OBJECTS) $(rasqal_triples_test_DEPENDENCIES) $(EXTRA_rasqal_triples_test_DEPENDENCIES) @rm -f rasqal_triples_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_triples_test_OBJECTS) $(rasqal_triples_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_construct_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_graph_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_limit_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_order_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_triples_test.Po@am__quote@ .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 $< .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 `$(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 $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 -rf ./$(DEPDIR) -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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ clean-generic clean-libtool ctags 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 uninstall uninstall-am # These are compiled here and used elsewhere for running tests check-local: $(local_tests) run-rasqal-tests run-rasqal-tests: $(local_tests) @$(PERL) $(srcdir)/../improve . $(top_builddir)/src/librasqal.la: cd $(top_builddir)/src && $(MAKE) librasqal.la $(top_builddir)/../raptor/src/libraptor.la: cd $(top_builddir)/../raptor/src && $(MAKE) $(AM_MAKEFLAGS) libraptor.la get-testsuites-list: @echo "engine" get-testsuite-engine: @tests="$(local_tests)"; \ $(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"Query Engine Tests\"; mf:entries ("; \ for test in $$tests; do \ comment="rdql query $$test"; \ expect="PositiveTest"; \ arg="$(top_srcdir)/data/"; \ if [ $$test = rasqal_limit_test$(EXEEXT) ]; then \ arg="$$arg/letters.nt"; \ fi; \ $(RECHO) " [ a t:$$expect; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"./$$test $$arg\" ]"; \ done; \ $(RECHO) ")." # 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: rasqal-0.9.33/tests/engine/rasqal_limit_test.c0000644000175000017500000002060212434455625016317 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_limit_test.c - Rasqal RDF Query LIMIT Tests * * Copyright (C) 2007-2008, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef RASQAL_QUERY_SPARQL #define QUERY_LANGUAGE "sparql" #define QUERY_UNSORTED "\ SELECT $letter \ FROM <%s> \ WHERE { $letter } \ " #define QUERY_SORTED QUERY_UNSORTED " ORDER BY $letter \ " #define QUERY_SUBSELECT "\ SELECT $letter \ FROM <%s> \ WHERE { \ SELECT $letter \ WHERE { $letter } \ ORDER BY $letter \ %s %s \ } \ " #else #define NO_QUERY_LANGUAGE #endif #ifdef NO_QUERY_LANGUAGE int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); fprintf(stderr, "%s: SPARQL query language not available, skipping test\n", program); return(0); } #else #define NQUERIES 3 static const char* limit_queries[NQUERIES]= { QUERY_UNSORTED, QUERY_SORTED, QUERY_SUBSELECT }; typedef struct { int limit; int offset; int expected_count; const char *expected_results[NQUERIES]; } limit_test; #define NONE (-1) static limit_test limit_offset_tests[]={ /* limit offset count results */ { NONE, NONE, 26, { "jcthzguxwpnefbioqadmrvykls", "abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz" } }, { 0, NONE, 0, { "", "", "" } }, { NONE, 0, 26, { "jcthzguxwpnefbioqadmrvykls", "abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz" } }, { 10, NONE, 10, { "jcthzguxwp", "abcdefghij", "abcdefghij" } }, { NONE, 5, 21, { "guxwpnefbioqadmrvykls", "fghijklmnopqrstuvwxyz", "fghijklmnopqrstuvwxyz" } }, { 10, 5, 10, { "guxwpnefbi", "fghijklmno", "fghijklmno" } }, { 5, 10, 5, { "nefbi", "klmno", "klmno" } }, { NONE, NONE, NONE, { NULL, NULL, NULL } } }; int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); const char *query_language_name=QUERY_LANGUAGE; raptor_uri *base_uri; unsigned char *uri_string; int test_i; limit_test* test; int tests_failed_count=0; int single_shot= -1; int query_i; rasqal_world *world; world=rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } if(argc < 2 || argc > 3) { fprintf(stderr, "USAGE: %s data-filename [test number]\n", program); return(1); } if(argv[2]) single_shot=atoi(argv[2]); uri_string=raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); for(query_i=0; query_i < NQUERIES; query_i++) { const char *query_format = limit_queries[query_i]; int dynamic_limits = (strstr(query_format, "%s %s") != NULL); for(test_i=(single_shot >=0 ? single_shot : 0); (test=&limit_offset_tests[test_i]) && (test->expected_count >=0); test_i++) { int result_i; rasqal_query *query = NULL; rasqal_query_results *results = NULL; const char* expected_results; int test_ok=1; unsigned char *data_string; unsigned char *query_string; #define LIM_OFF_BUF_SIZE 20 data_string=raptor_uri_filename_to_uri_string(argv[1]); query_string = RASQAL_MALLOC(unsigned char*, strlen((const char*)data_string) + strlen(query_format) + (2 * LIM_OFF_BUF_SIZE) + 1); if(dynamic_limits) { char lim[LIM_OFF_BUF_SIZE]; char off[LIM_OFF_BUF_SIZE]; if(test->limit >= 0) sprintf(lim, "LIMIT %d", test->limit); else *lim = '\0'; if(test->offset >= 0) sprintf(off, "OFFSET %d", test->offset); else *off = '\0'; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf((char*)query_string, query_format, data_string, lim, off); #pragma GCC diagnostic pop } else { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf((char*)query_string, query_format, data_string); #pragma GCC diagnostic pop } raptor_free_memory(data_string); query = rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); return(1); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "%s: preparing query %d test %d - %s\n", program, query_i, test_i, query_string); #endif if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: query %d test %d prepare '%s' FAILED\n", program, query_i, test_i, query_string); return(1); } if(!dynamic_limits) { rasqal_query_set_limit(query, test->limit); rasqal_query_set_offset(query, test->offset); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "%s: executing query %d test %d\n", program, query_i, test_i); #endif results=rasqal_query_execute(query); if(!results) { fprintf(stderr, "%s: query %d test %d FAILED\n", program, query_i, test_i); return(1); } /* check results */ expected_results=test->expected_results[query_i]; result_i=0; tests_failed_count=0; while(results && !rasqal_query_results_finished(results)) { rasqal_literal *value; const char* str; char expected_str[2]={0,0}; int failed=1; if(result_i < test->expected_count) expected_str[0]=expected_results[result_i]; value=rasqal_query_results_get_binding_value(results, 0); if(value) { int error=0; str=(const char*)rasqal_literal_as_string_flags(value, 0, &error); if(!error && str) { size_t len=strlen(str); if(len == 1 && str[0] == expected_str[0]) failed=0; } } if(failed) { fprintf(stderr, "%s: query %d test %d result %d FAILED returning value '%s' expected value '%s'\n", program, query_i, test_i, result_i, (str ? str: "NULL"), expected_str); test_ok=0; } rasqal_query_results_next(results); result_i++; } if(results) rasqal_free_query_results(results); if(!test_ok) { fprintf(stderr, "%s: query %d test %d limit %d offset %d FAILED\n", program, query_i, test_i, test->limit, test->offset); } else { if(result_i != test->expected_count) { fprintf(stderr, "%s: query %d test %d limit %d offset %d FAILED returned %d results, expected %d\n", program, query_i, test_i, test->limit, test->offset, result_i, test->expected_count); test_ok=0; } } if(!test_ok) { tests_failed_count++; } else { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "%s: query %d test %d OK\n", program, query_i, test_i); #endif } rasqal_free_query(query); RASQAL_FREE(char*, query_string); if(single_shot >=0) break; } /* end test loop */ } /* end query loop */ raptor_free_uri(base_uri); rasqal_free_world(world); return tests_failed_count; } #endif rasqal-0.9.33/tests/engine/rasqal_construct_test.c0000644000175000017500000001200412434455625017222 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_construct_test.c - Rasqal RDF Query CONSTRUCT Tests * * Copyright (C) 2006, David Beckett http://purl.org/net/dajobe/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef RASQAL_QUERY_SPARQL #define QUERY_LANGUAGE "sparql" #define QUERY_FORMAT "\ CONSTRUCT {\ ?s ?p ?o . \ ?o ?p ?s \ }\n\ FROM <%s/%s>\n \ WHERE { \ ?s ?p ?o \ FILTER(!isLiteral(?o)) \ } \n\ " #else #define NO_QUERY_LANGUAGE #endif #define QUERY_DATA "dc.rdf" #define QUERY_EXPECTED_COUNT 4 #ifdef NO_QUERY_LANGUAGE int main(int argc, char **argv) { const char *program = rasqal_basename(argv[0]); fprintf(stderr, "%s: No supported query language available, skipping test\n", program); return(0); } #else int main(int argc, char **argv) { const char *program = rasqal_basename(argv[0]); raptor_uri *base_uri = NULL; unsigned char *uri_string; const char *query_language_name = QUERY_LANGUAGE; const char *query_format = QUERY_FORMAT; const char *data_file = QUERY_DATA; const int expected_count = QUERY_EXPECTED_COUNT; int failures = 0; rasqal_world *world = NULL; rasqal_query *query = NULL; rasqal_query_results *results = NULL; unsigned char *data_dir_string; unsigned char *query_string; int count = 0; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 raptor_serializer* serializer=NULL; #endif world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); failures++; goto done; } if(argc != 2) { fprintf(stderr, "USAGE: %s \n", program); failures++; goto done; } uri_string = raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); data_dir_string = raptor_uri_filename_to_uri_string(argv[1]); query_string = RASQAL_MALLOC(unsigned char*, strlen((const char*)data_dir_string) + strlen(data_file) + strlen(query_format) + 1); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf((char*)query_string, query_format, data_dir_string, data_file); #pragma GCC diagnostic pop raptor_free_memory(data_dir_string); query = rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); failures++; goto done; } printf("%s: preparing %s query\n", program, query_language_name); if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: %s query prepare '%s' FAILED\n", program, query_language_name, query_string); failures++; goto done; } RASQAL_FREE(char*, query_string); printf("%s: executing query\n", program); results = rasqal_query_execute(query); if(!results) { fprintf(stderr, "%s: query execution FAILED\n", program); failures++; goto done; } printf("%s: checking query results\n", program); if(!rasqal_query_results_is_graph(results)) { fprintf(stderr, "%s: query results is not a graph\n", program); failures++; goto done; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 serializer = raptor_new_serializer("ntriples"); raptor_serialize_start_to_file_handle(serializer, base_uri, stdout); #endif count = 0; while(results) { raptor_statement* triple = rasqal_query_results_get_triple(results); if(!triple) break; count++; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 raptor_serialize_statement(serializer, triple); #endif if(rasqal_query_results_next_triple(results)) break; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 raptor_serialize_end(serializer); raptor_free_serializer(serializer); #endif if(count != expected_count) { printf("%s: query execution FAILED returning %d triples, expected %d\n", program, count, expected_count); failures++; goto done; } done: if(results) rasqal_free_query_results(results); if(query) rasqal_free_query(query); if(base_uri) raptor_free_uri(base_uri); rasqal_free_world(world); return failures; } #endif rasqal-0.9.33/tests/engine/rasqal_triples_test.c0000644000175000017500000001310611513006053016644 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_triples_test.c - Rasqal RDF Query Triple Patterns Tests * * Copyright (C) 2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DATA_FILE_NAME (const unsigned char*)"triples.ttl" #ifdef RASQAL_QUERY_SPARQL /* DAWG basic/list-4.rql test flattened to show triple patterns not just collections but triples, bnode renamed to be more readable. The triple patterns are not reordered so execution should be identical. Expected answer is 1 row: { p = v = "11"^^ w = "22"^^ } Original query: SELECT ?p ?v ?w { :x ?p (?v ?w) . } */ #define QUERY_LANGUAGE "sparql" #define QUERY_FORMAT " \ PREFIX : \ PREFIX rdf: \ SELECT ?p ?v ?w \ { \ :x ?p _:node1 . \ _:node2 rdf:first ?w . \ _:node2 rdf:rest rdf:nil . \ _:node1 rdf:first ?v . \ _:node1 rdf:rest _:node2 \ } \ " #else #ifdef RASQAL_QUERY_RDQL #define QUERY_LANGUAGE "rdql" #define QUERY_FORMAT "SELECT ?p, ?v, ?w \ WHERE \ (?p, ?v, ?w) USING \ rdf FOR , \ ex FOR " #else #define NO_QUERY_LANGUAGE #endif #endif #define EXPECTED_RESULTS_COUNT 1 #ifdef NO_QUERY_LANGUAGE int main(int argc, char **argv) { const char *program = rasqal_basename(argv[0]); fprintf(stderr, "%s: No supported query language available, skipping test\n", program); return(0); } #else int main(int argc, char **argv) { const char *program = rasqal_basename(argv[0]); rasqal_query *query = NULL; rasqal_query_results *results = NULL; raptor_uri *base_uri; unsigned char *data_dir_string; raptor_uri* data_dir_uri; unsigned char *uri_string; const char *query_language_name = QUERY_LANGUAGE; const unsigned char *query_string = (const unsigned char*)QUERY_FORMAT; int count; rasqal_world *world; raptor_uri *data_file_uri; rasqal_data_graph* dg; world=rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } uri_string = raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); data_dir_string =raptor_uri_filename_to_uri_string(argv[1]); data_dir_uri = raptor_new_uri(world->raptor_world_ptr, data_dir_string); query = rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); return(1); } printf("%s: preparing %s query\n", program, query_language_name); if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: %s query prepare FAILED\n", program, query_language_name); return(1); } #ifdef RAPTOR_V2_AVAILABLE data_file_uri = raptor_new_uri_relative_to_base(world->raptor_world_ptr, data_dir_uri, DATA_FILE_NAME); #else data_file_uri = raptor_new_uri_relative_to_base(data_dir_uri, DATA_FILE_NAME); #endif dg = rasqal_new_data_graph_from_uri(world, /* source URI */ data_file_uri, /* name URI */ NULL, RASQAL_DATA_GRAPH_BACKGROUND, NULL, NULL, NULL); rasqal_query_add_data_graph(query, dg); raptor_free_uri(data_file_uri); data_file_uri = NULL; printf("%s: executing query\n", program); results = rasqal_query_execute(query); if(!results) { fprintf(stderr, "%s: query execution FAILED\n", program); return(1); } count = 0; while(results && !rasqal_query_results_finished(results)) { int i; for(i = 0; i < rasqal_query_results_get_bindings_count(results); i++) { const unsigned char *name = rasqal_query_results_get_binding_name(results, i); rasqal_literal *value = rasqal_query_results_get_binding_value(results, i); printf("result %d: variable %s=", count+1, (char*)name); rasqal_literal_print(value, stdout); putchar('\n'); } rasqal_query_results_next(results); count++; } if(results) rasqal_free_query_results(results); if(count != EXPECTED_RESULTS_COUNT) { fprintf(stderr, "%s: query execution returned %d results, expected %d\n", program, count, EXPECTED_RESULTS_COUNT); return(1); } rasqal_free_query(query); raptor_free_uri(base_uri); rasqal_free_world(world); return 0; } #endif rasqal-0.9.33/tests/engine/rasqal_graph_test.c0000644000175000017500000002056611513006053016273 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_graph_test.c - Rasqal RDF Query GRAPH Tests * * Copyright (C) 2006, David Beckett http://purl.org/net/dajobe/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef RASQAL_QUERY_SPARQL #define DATA_GRAPH_COUNT 3 static const char* graph_files[DATA_GRAPH_COUNT] = { "graph-a.ttl", "graph-b.ttl", "graph-c.ttl" }; #define QUERY_VARIABLES_MAX_COUNT 3 struct test { const char *query_language; const char *query_string; /* expected result count */ int expected_count; /* data graph offsets (<0 for not used) */ int data_graphs[DATA_GRAPH_COUNT]; /* expected value answers */ const char* value_answers[QUERY_VARIABLES_MAX_COUNT]; /* expected graph answers */ int graph_answers[QUERY_VARIABLES_MAX_COUNT]; const char* value_var; const char* graph_var; }; #define QUERY_COUNT 2 static const struct test tests[QUERY_COUNT] = { { /* query_language */ "sparql", /* query_string */ "\ PREFIX : \ SELECT ?graph ?value \ WHERE\ {\ GRAPH ?graph { :x :b ?value } \ }\ ", /* expected_count */ 2, /* data_graphs */ { 0, 1, -1 }, /* value_answers */ { "mercury", "orange" }, /* graph_answers */ { 0, 1 }, /* value_var */ "value", /* graph_var */ "graph", }, { /* query_language */ "sparql", /* query_string */ "\ PREFIX : \ SELECT ?graph ?value \ WHERE\ {\ GRAPH ?graph { ?var :a ?value } \ }\ ", /* expected_count */ 3, /* data_graphs */ { 0, 1, 2 }, /* value_answers */ { "venus", "apple", "red" }, /* graph_answers */ { 0, 1, 2 }, /* value_var */ "value", /* graph_var */ "graph", } }; #else #define NO_QUERY_LANGUAGE #endif #ifdef NO_QUERY_LANGUAGE int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); fprintf(stderr, "%s: No supported query language available, skipping test\n", program); return(0); } #else int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); int failures=0; raptor_uri *base_uri; unsigned char *data_dir_string; raptor_uri* data_dir_uri; unsigned char *uri_string; int i; raptor_uri* graph_uris[DATA_GRAPH_COUNT]; rasqal_world *world; if(argc != 2) { fprintf(stderr, "USAGE: %s \n", program); return(1); } world=rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } uri_string=raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); data_dir_string=raptor_uri_filename_to_uri_string(argv[1]); data_dir_uri = raptor_new_uri(world->raptor_world_ptr, data_dir_string); for(i=0; i < DATA_GRAPH_COUNT; i++) #ifdef RAPTOR_V2_AVAILABLE graph_uris[i] = raptor_new_uri_relative_to_base(world->raptor_world_ptr, data_dir_uri, (const unsigned char*)graph_files[i]); #else graph_uris[i] = raptor_new_uri_relative_to_base(data_dir_uri, (const unsigned char*)graph_files[i]); #endif for(i=0; i < QUERY_COUNT; i++) { rasqal_query *query = NULL; rasqal_query_results *results = NULL; const char *query_language_name=tests[i].query_language; const unsigned char *query_string=(const unsigned char *)tests[i].query_string; int count; int query_failed=0; int j; query=rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query %d in language %s FAILED\n", program, i, query_language_name); query_failed=1; goto tidy_query; } printf("%s: preparing %s query %d\n", program, query_language_name, i); if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: %s query prepare %d FAILED\n", program, query_language_name, i); query_failed=1; goto tidy_query; } for(j=0; j < DATA_GRAPH_COUNT; j++) { int offset=tests[i].data_graphs[j]; if(offset >= 0) { rasqal_data_graph* dg; dg = rasqal_new_data_graph_from_uri(world, /* source URI */ graph_uris[offset], /* name URI */ graph_uris[offset], RASQAL_DATA_GRAPH_NAMED, NULL, NULL, NULL); rasqal_query_add_data_graph(query, dg); } } printf("%s: executing query %d\n", program, i); results=rasqal_query_execute(query); if(!results) { fprintf(stderr, "%s: query execution %d FAILED\n", program, i); query_failed=1; goto tidy_query; } printf("%s: checking query %d results\n", program, i); count=0; query_failed=0; while(results && !rasqal_query_results_finished(results)) { rasqal_literal *value; rasqal_literal *graph_value; raptor_uri* graph_uri; const char *value_answer=tests[i].value_answers[count]; raptor_uri* graph_answer=graph_uris[tests[i].graph_answers[count]]; const unsigned char* graph_var=(const unsigned char*)tests[i].graph_var; const unsigned char* value_var=(const unsigned char*)tests[i].value_var; value=rasqal_query_results_get_binding_value_by_name(results, value_var); if(strcmp((const char*)rasqal_literal_as_string(value), value_answer)) { printf("result %d FAILED: %s=", count, (char*)value_var); rasqal_literal_print(value, stdout); printf(" expected value '%s'\n", value_answer); query_failed=1; break; } graph_value=rasqal_query_results_get_binding_value_by_name(results, graph_var); if(!graph_value) { printf("variable '%s' is not in the result\n", graph_var); query_failed=1; break; } if(graph_value->type != RASQAL_LITERAL_URI) { printf("variable '%s' is type %d expected %d\n", graph_var, graph_value->type, RASQAL_LITERAL_URI); query_failed=1; break; } graph_uri=graph_value->value.uri; if(!raptor_uri_equals(graph_uri, graph_answer)) { printf("result %d FAILED: %s=", count, (char*)graph_var); rasqal_literal_print(graph_value, stdout); printf(" expected URI value <%s>\n", raptor_uri_as_string(graph_answer)); query_failed=1; break; } rasqal_query_results_next(results); count++; } if(results) rasqal_free_query_results(results); printf("%s: query %d results count returned %d results\n", program, i, count); if(count != tests[i].expected_count) { printf("%s: query execution %d FAILED returning %d results, expected %d\n", program, i, count, tests[i].expected_count); query_failed=1; } tidy_query: rasqal_free_query(query); if(!query_failed) printf("%s: query %d OK\n", program, i); else { printf("%s: query %d FAILED\n", program, i); failures++; } } for(i=0; i < DATA_GRAPH_COUNT; i++) { if(graph_uris[i]) raptor_free_uri(graph_uris[i]); } raptor_free_uri(data_dir_uri); raptor_free_memory(data_dir_string); raptor_free_uri(base_uri); rasqal_free_world(world); return failures; } #endif rasqal-0.9.33/tests/algebra/0000755000175000017500000000000012443715251012635 500000000000000rasqal-0.9.33/tests/algebra/test-03.out0000644000175000017500000000051511103430321014466 00000000000000Project( Union( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) ) , Variables([ variable(s), variable(v1), variable(v2) ]) ) rasqal-0.9.33/tests/algebra/test-02.out0000644000175000017500000000037111103430260014467 00000000000000Project( BGP( triple(variable(s), uri, variable(v1)) , triple(variable(s), uri, variable(v2)) ) , Variables([ variable(s), variable(v1), variable(v2) ]) ) rasqal-0.9.33/tests/algebra/test-04.rq0000644000175000017500000000040611035052037014311 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting a union of a union and a basic graph pattern: # PREFIX : SELECT * WHERE { { ?s :p1 ?v1 } UNION {?s :p2 ?v2 } UNION {?s :p3 ?v3 } } rasqal-0.9.33/tests/algebra/Makefile.am0000644000175000017500000000477312302411034014606 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal algebra tests # # Copyright (C) 2008, David Beckett http://www.dajobe.org/ # # 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. # local_tests=convert_graph_pattern$(EXEEXT) ALGEBRA_TEST_FILES=test-01.rq test-02.rq test-03.rq test-04.rq test-05.rq \ test-06.rq test-07.rq test-08.rq test-09.rq ALGEBRA_RESULT_FILES=$(ALGEBRA_TEST_FILES:.rq=.out) EXTRA_DIST= $(ALGEBRA_TEST_FILES) $(ALGEBRA_RESULT_FILES) \ check-algebra EXTRA_PROGRAMS=$(local_tests) AM_CPPFLAGS=@RASQAL_INTERNAL_CPPFLAGS@ -I$(top_srcdir)/src AM_CFLAGS=@RASQAL_INTERNAL_CPPFLAGS@ $(MEM) AM_LDFLAGS=@RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) CLEANFILES=$(local_tests) \ convert.out convert.err diff.out convert_graph_pattern_SOURCES = convert_graph_pattern.c convert_graph_pattern_LDADD = $(top_builddir)/src/librasqal.la BASE_URI=http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/# # These are compiled here and used elsewhere for running tests check-local: convert_graph_pattern$(EXEEXT) $(ALGEBRA_TEST_FILES) @$(PERL) $(srcdir)/../improve . get-testsuites-list: @echo "sparql-algebra" get-testsuite-sparql-algebra: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Algebra Conversions\"; t:path \"$(abs_builddir):$$PATH\"; mf:entries ("; \ for test in $(ALGEBRA_TEST_FILES); do \ comment="SPARQL algebra $$test"; \ base=$(BASE_URI)$$test; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/check-algebra \"$(srcdir)/$$test\" \"$$base\" \"\"\" ]"; \ done; \ $(RECHO) ")." $(top_builddir)/src/librasqal.la: cd $(top_builddir)/src && $(MAKE) librasqal.la rasqal-0.9.33/tests/algebra/test-07.out0000644000175000017500000000064711103430402014500 00000000000000Project( LeftJoin( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) , expr(op lt(expr(variable(v1)), expr(integer(3)))) ) , Variables([ variable(s), variable(v1), variable(v2) ]) ) rasqal-0.9.33/tests/algebra/Makefile.in0000644000175000017500000004643112434455632014636 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal algebra tests # # Copyright (C) 2008, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = tests/algebra DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_convert_graph_pattern_OBJECTS = convert_graph_pattern.$(OBJEXT) convert_graph_pattern_OBJECTS = $(am_convert_graph_pattern_OBJECTS) convert_graph_pattern_DEPENDENCIES = $(top_builddir)/src/librasqal.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(convert_graph_pattern_SOURCES) DIST_SOURCES = $(convert_graph_pattern_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ local_tests = convert_graph_pattern$(EXEEXT) ALGEBRA_TEST_FILES = test-01.rq test-02.rq test-03.rq test-04.rq test-05.rq \ test-06.rq test-07.rq test-08.rq test-09.rq ALGEBRA_RESULT_FILES = $(ALGEBRA_TEST_FILES:.rq=.out) EXTRA_DIST = $(ALGEBRA_TEST_FILES) $(ALGEBRA_RESULT_FILES) \ check-algebra EXTRA_PROGRAMS = $(local_tests) AM_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ -I$(top_srcdir)/src AM_CFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ $(MEM) AM_LDFLAGS = @RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) CLEANFILES = $(local_tests) \ convert.out convert.err diff.out convert_graph_pattern_SOURCES = convert_graph_pattern.c convert_graph_pattern_LDADD = $(top_builddir)/src/librasqal.la BASE_URI = http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/# 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 tests/algebra/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/algebra/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): convert_graph_pattern$(EXEEXT): $(convert_graph_pattern_OBJECTS) $(convert_graph_pattern_DEPENDENCIES) $(EXTRA_convert_graph_pattern_DEPENDENCIES) @rm -f convert_graph_pattern$(EXEEXT) $(AM_V_CCLD)$(LINK) $(convert_graph_pattern_OBJECTS) $(convert_graph_pattern_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert_graph_pattern.Po@am__quote@ .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 $< .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 `$(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 $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-local 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 -rf ./$(DEPDIR) -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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ clean-generic clean-libtool ctags 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 uninstall uninstall-am # These are compiled here and used elsewhere for running tests check-local: convert_graph_pattern$(EXEEXT) $(ALGEBRA_TEST_FILES) @$(PERL) $(srcdir)/../improve . get-testsuites-list: @echo "sparql-algebra" get-testsuite-sparql-algebra: @$(RECHO) '@prefix rdfs: .'; \ $(RECHO) '@prefix mf: .'; \ $(RECHO) '@prefix t: .'; \ $(RECHO) ' '; \ $(RECHO) "<> a mf:Manifest; rdfs:comment \"SPARQL Algebra Conversions\"; t:path \"$(abs_builddir):$$PATH\"; mf:entries ("; \ for test in $(ALGEBRA_TEST_FILES); do \ comment="SPARQL algebra $$test"; \ base=$(BASE_URI)$$test; \ $(RECHO) " [ a t:PositiveTest; mf:name \"$$test\"; rdfs:comment \"$$comment\"; mf:action \"\"\"$(PERL) $(srcdir)/check-algebra \"$(srcdir)/$$test\" \"$$base\" \"\"\" ]"; \ done; \ $(RECHO) ")." $(top_builddir)/src/librasqal.la: cd $(top_builddir)/src && $(MAKE) librasqal.la # 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: rasqal-0.9.33/tests/algebra/check-algebra0000755000175000017500000000523411625633123015155 00000000000000#!/usr/bin/perl -w # # check-algebra - Run Rasqal against W3C DAWG SPARQL testsuite # # USAGE: check-algebra [options] [TEST] # # Copyright (C) 2009, David Beckett http://www.dajobe.org/ # # 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: # convert_graph_pattern utility in the PATH # use strict; use File::Basename; use Getopt::Long; use Pod::Usage; my $diff_cmd = $ENV{DIFF} || "diff"; my $convert_graph_pattern="convert_graph_pattern"; my $out="convert.out"; my $err="convert.err"; my $diff="diff.out"; my $program=basename $0; my $debug=0; $debug=1 if defined $ENV{'RASQAL_DEBUG'}; # Argument handling my $usage=0; GetOptions( 'debug|d+' => \$debug, # incremental 'help|h|?' => \$usage ) || pod2usage(2); pod2usage(-verbose => 2) if $usage; pod2usage(2) if @ARGV != 2; my($tst,$baseuri)=@ARGV; my $base=basename($tst, ".rq"); my $srcdir=dirname($tst); my $expected="$srcdir/$base.out"; warn "$program: Running test $tst with base URI $baseuri\n" if $debug; my $cmd="convert_graph_pattern $tst $baseuri > $out 2> $err"; warn "$program: Running '$cmd'\n" if $debug; system $cmd; my $rc=$?; warn "$program: Result was $rc\n" if $debug; if($rc) { warn "$program: Graph pattern conversion '$tst' FAILED to execute\n"; warn "Failing program was:\n"; warn " $cmd\n"; system("cat $err"); exit 1; } my $cmp_cmd="$diff_cmd -u $expected $out > $diff 2>&1"; warn "$program: Running '$cmp_cmd'\n" if $debug; system $cmp_cmd; $rc=$?; warn "$program: Result was $rc\n" if $debug; if($rc) { warn "$program: Graph pattern conversion '$tst' FAILED to give correct answer\n"; warn "Failing program was:\n"; warn " $cmd\n"; system("cat $err"); warn "Difference is:\n"; system("cat $diff"); exit 1; } unlink $out, $err, $diff; exit 0; __END__ =head1 NAME check-algebra - run SPARQL algebra graph pattern test =head1 SYNOPSIS check-algebra [options] TEST BASE-URI =head1 OPTIONS =over 8 =item B<--debug> Enable extra debugging output. =item B<--help> Give command help summary. =back =head1 DESCRIPTION Run SPARQL algebra conversion test =cut rasqal-0.9.33/tests/algebra/test-03.rq0000644000175000017500000000035411035052037014312 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a union of two basic graph patterns: # PREFIX : SELECT * WHERE { { ?s :p1 ?v1 } UNION {?s :p2 ?v2 } } rasqal-0.9.33/tests/algebra/convert_graph_pattern.c0000644000175000017500000001276111644472672017337 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * convert_graph_pattern.c - Rasqal test program to turn a GP into algebra tree * * Copyright (C) 2008, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "rasqal.h" #include "rasqal_internal.h" #define QUERY_LANGUAGE "sparql" #ifdef BUFSIZ #define FILE_READ_BUF_SIZE BUFSIZ #else #define FILE_READ_BUF_SIZE 1024 #endif int main(int argc, char *argv[]); static unsigned char buffer[FILE_READ_BUF_SIZE]; static unsigned char* file_read_string(const char* program, const char* filename, const char* label) { raptor_stringbuffer *sb=raptor_new_stringbuffer(); unsigned char* string=NULL; size_t len=0; FILE *fh; int rc=0; fh=fopen(filename, "r"); if(!fh) { fprintf(stderr, "%s: Failed to read %s file '%s' open failed - %s", program, label, filename, strerror(errno)); rc=1; goto tidy; } while(!feof(fh)) { size_t read_len; read_len=fread((char*)buffer, 1, FILE_READ_BUF_SIZE, fh); if(read_len > 0) raptor_stringbuffer_append_counted_string(sb, buffer, read_len, 1); if(read_len < FILE_READ_BUF_SIZE) { if(ferror(fh)) { fprintf(stderr, "%s: file '%s' read failed - %s\n", program, filename, strerror(errno)); rc=1; goto tidy; } break; } } fclose(fh); fh=NULL; len=raptor_stringbuffer_length(sb); string=(unsigned char*)malloc(len+1); raptor_stringbuffer_copy_to_string(sb, (unsigned char*)string, len); tidy: if(sb) raptor_free_stringbuffer(sb); if(fh) fclose(fh); return rc ? NULL : string; } int main(int argc, char *argv[]) { char const *program=rasqal_basename(*argv); const char *query_language_name=QUERY_LANGUAGE; int failures = 0; #define FAIL do { failures++; goto tidy; } while(0) rasqal_world *world; rasqal_query* query = NULL; raptor_uri *base_uri = NULL; char *query_file; unsigned char *query_string = NULL; raptor_iostream* iostr = NULL; rasqal_algebra_node* node = NULL; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } if(argc != 3) { fprintf(stderr, "%s: USAGE SPARQL-FILE BASE-URI\n", program); return(1); } query_file = argv[1]; base_uri = raptor_new_uri(world->raptor_world_ptr, (const unsigned char*)argv[2]); query = rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); FAIL; } query_string = file_read_string(program, query_file, "query"); if(!query_string) { FAIL; } if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: %s query prepare FAILED\n", program, query_language_name); FAIL; } node = rasqal_algebra_query_to_algebra(query); if(!node) { fprintf(stderr, "%s: Failed to make algebra node\n", program); FAIL; } node = rasqal_algebra_query_add_orderby(query, node, query->projection, query->modifier); if(!node) { fprintf(stderr, "%s: Failed to add algebra modifiers\n", program); FAIL; } if(query->verb == RASQAL_QUERY_VERB_SELECT) { node = rasqal_algebra_query_add_projection(query, node, query->projection); if(!node) { fprintf(stderr, "%s: Failed to add algebra projection\n", program); FAIL; } } else if (query->verb == RASQAL_QUERY_VERB_CONSTRUCT) { node = rasqal_algebra_query_add_construct_projection(query, node); if(!node) { fprintf(stderr, "%s: Failed to add algebra construct projection\n", program); FAIL; } } node = rasqal_algebra_query_add_distinct(query, node, query->projection); if(!node) { fprintf(stderr, "%s: Failed to add algebra distinct\n", program); FAIL; } iostr = raptor_new_iostream_to_file_handle(world->raptor_world_ptr, stdout); if(!iostr) { fprintf(stderr, "%s: Failed to make iostream\n", program); FAIL; } rasqal_algebra_algebra_node_write(node, iostr); raptor_iostream_write_byte('\n', iostr); raptor_free_iostream(iostr); iostr = NULL; rasqal_free_algebra_node(node); node = NULL; rasqal_free_memory(query_string); query_string = NULL; tidy: if(node) rasqal_free_algebra_node(node); if(iostr) raptor_free_iostream(iostr); if(query) rasqal_free_query(query); if(base_uri) raptor_free_uri(base_uri); if(world) rasqal_free_world(world); return failures; } rasqal-0.9.33/tests/algebra/test-01.rq0000644000175000017500000000034111034525047014311 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group with a basic graph pattern consisting of a single triple pattern: # PREFIX : SELECT * WHERE { ?s ?p ?o } rasqal-0.9.33/tests/algebra/test-01.out0000644000175000017500000000023311103430245014466 00000000000000Project( BGP( triple(variable(s), variable(p), variable(o)) ) , Variables([ variable(s), variable(p), variable(o) ]) ) rasqal-0.9.33/tests/algebra/test-05.rq0000644000175000017500000000037311035052037014315 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a basic graph pattern and an optional graph pattern: # PREFIX : SELECT * WHERE { ?s :p1 ?v1 OPTIONAL {?s :p2 ?v2 } } rasqal-0.9.33/tests/algebra/test-07.rq0000644000175000017500000000042711035742156014327 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a basic graph pattern and an optional graph pattern with a filter: # PREFIX : SELECT * WHERE { ?s :p1 ?v1 OPTIONAL {?s :p2 ?v2 FILTER(?v1<3) } } rasqal-0.9.33/tests/algebra/test-08.rq0000644000175000017500000000041711040543724014323 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a union graph pattern and an optional graph pattern: # PREFIX : SELECT * WHERE { {?s :p1 ?v1} UNION {?s :p2 ?v2} OPTIONAL {?s :p3 ?v3} } rasqal-0.9.33/tests/algebra/test-05.out0000644000175000017500000000054211310264415014501 00000000000000Project( LeftJoin( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) ) , Variables([ variable(s), variable(v1), variable(v2) ]) ) rasqal-0.9.33/tests/algebra/test-04.out0000644000175000017500000000103111103430343014465 00000000000000Project( Union( Union( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) ) , BGP( triple(variable(s), uri, variable(v3)) ) ) , Variables([ variable(s), variable(v1), variable(v2), variable(v3) ]) ) rasqal-0.9.33/tests/algebra/test-06.rq0000644000175000017500000000042311035742156014322 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a basic graph pattern and an optional graph pattern: # PREFIX : SELECT * WHERE { ?s :p1 ?v1 OPTIONAL {?s :p2 ?v2 } OPTIONAL { ?s :p3 ?v3 } } rasqal-0.9.33/tests/algebra/test-09.rq0000644000175000017500000000042611040543724014324 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a basic graph pattern, a filter and an optional graph pattern: # PREFIX : SELECT * WHERE { ?s :p1 ?v1 FILTER (?v1 < 3 ) OPTIONAL {?s :p2 ?v2} } rasqal-0.9.33/tests/algebra/test-08.out0000644000175000017500000000107511310264354014510 00000000000000Project( LeftJoin( Union( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) ) , BGP( triple(variable(s), uri, variable(v3)) ) ) , Variables([ variable(s), variable(v1), variable(v2), variable(v3) ]) ) rasqal-0.9.33/tests/algebra/test-02.rq0000644000175000017500000000033611034525047014316 00000000000000# http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern # # Example: group consisting of a union of two basic graph patterns: # PREFIX : SELECT * WHERE { ?s :p1 ?v1 ; :p2 ?v2 } rasqal-0.9.33/tests/algebra/test-06.out0000644000175000017500000000112211310264401014470 00000000000000Project( LeftJoin( LeftJoin( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) ) , BGP( triple(variable(s), uri, variable(v3)) ) ) , Variables([ variable(s), variable(v1), variable(v2), variable(v3) ]) ) rasqal-0.9.33/tests/algebra/test-09.out0000644000175000017500000000076711310264307014516 00000000000000Project( Filter( LeftJoin( BGP( triple(variable(s), uri, variable(v1)) ) , BGP( triple(variable(s), uri, variable(v2)) ) ) , expr(op lt(expr(variable(v1)), expr(integer(3)))) ) , Variables([ variable(s), variable(v1), variable(v2) ]) ) rasqal-0.9.33/ChangeLog.70000644000175000017500000040307311335401176011741 000000000000002009-12-16 Dave Beckett * Snapshotted rasqal_0_9_17 for 0.9.17 release (SVN 15914) * src/rasqal_literal.c: (rasqal_literal_compare): When comparing URIs and get error, pass through cleanup to deallocate promoted literals. * src/rasqal_algebra.c: (rasqal_free_algebra_node): Free graph and var fields. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): During join, do not lose track of right_row rows that are discarded. * src/rasqal_rowsource_graph.c: (rasqal_graph_next_dg): Do not keep extra reference to o; pass it to con->var * src/rasqal_query_write.c: (rasqal_query_write_sparql_literal): Handle printing out UDT URIs correctly. * src/rasqal_query_write.c: (rasqal_query_write_sparql_graph_pattern): Do not add {}s around FILTER; it never appears on it's own. 2009-12-15 Dave Beckett * utils/roqet.1: spellings * utils/roqet.1: Add longer examples section 2009-12-14 Dave Beckett * src/rasqal_engine.c: (rasqal_query_engine_1_set_origin_triples): Re-initialise column for origin to first triple seen - for QE1. * docs/tmpl/section-graph_pattern.sgml: Update tmpl for rasqal_graph_pattern_get_origin * src/rasqal_query_transform.c: (rasqal_query_triples_build_bound_in): Initialise bound_in array to BOUND_IN_UNBOUND. (rasqal_query_graph_pattern_build_bound_in): If a GRAPH is seen, set any variable seen to BOUND_ELSEWHERE. (rasqal_query_build_bound_in): Initialise bound_in array to BOUND_IN_UNBOUND. Set any select expression variables to BOUND_IN_ELSEWHERE. (rasqal_query_check_unused_variables): Update FIXME comment - does not handle LET. Only warn for variables BOUND_IN_UNBOUND. * src/rasqal_query.c: (rasqal_query_variable_bound_in_triple): Return not bound for non-column values. * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_variable_bound_in): Return not bound for non-column values. * src/rasqal_engine.c: (rasqal_query_engine_1_set_origin_triples): Use column is BOUND_IN_UNBOUND for variable unbound check. * src/rasqal_internal.h: Define magic (non-column number ) values for query->variables_bound_in BOUND_IN_UNBOUND and BOUND_IN_ELSEWHERE * src/rasqal_graph_pattern.c: autodocs * docs/rasqal-sections.txt, src/rasqal.h, src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_origin): Added to public api for GRAPH graph pattern * src/rasqal_query_write.c: (rasqal_query_write_sparql_graph_pattern): Write GRAPH pattern literal from gp->origin field. * src/sparql_parser.y: err typo * docs/tmpl/section-general.sgml: Update generated tmpls for new version macros * configure.ac, docs/rasqal-sections.txt, src/rasqal.h, src/rasqal_general.c, src/win32_rasqal_config.h: Add version defines to rasqal.h Hard-code RASQAL_VERSION, RASQAL_VERSION_STRING, RASQAL_VERSION_MAJOR, RASQAL_VERSION_MINOR and RASQAL_VERSION_RELEASE into rasqal.h to make it easier for clients. Remove version_decimal computation and substution fron configure.in Remove version defines from win32_rasqal_config.h. Add defines to docs. rasqal_version_decimal now uses RASQAL_VERSION. rasqal_version_string now uses the RASQAL_VERSION_STRING (not VERSION) 2009-12-13 Dave Beckett * src/rasqal_general.c, src/rasqal_engine.c, src/rasqal_format_table.c, src/rasqal_literal.c: Casts for C++ * src/rasqal_rowsource_join.c: rasqal_join_rowsource_context struct gains right_rows_joined_count field to count number of right rows generated per left row. (rasqal_join_rowsource_read_row): Use above to generate a new left row - for left join - once only when entire right rowsource generated no results. This should fix the semantics of left outer join. 2009-12-12 Dave Beckett * src/rasqal-config.in: remove warning * src/rasqal_engine.c: Update comment in rasqal_engine_gp_data referring to old flags. * src/rasqal.h: Removed rasqal_triple_flags enum with unused flags: RASQAL_TRIPLE_FLAGS_EXACT, RASQAL_TRIPLE_FLAGS_OPTIONAL and RASQAL_TRIPLE_FLAGS_LAST * src/rasqal.h: rasqal_compare_flags autodocs * src/rasqal-config.in: Add warning * src/rasqal-config.in: Try computing the decimal version another way * docs/rasqal-sections.txt, docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-triples_source.sgml, docs/tmpl/section-variable.sgml, docs/tmpl/section-xsd.sgml: Update gtk-doc templates * src/rasqal.h: autodocs * src/rasqal.h: rasqal_graph_pattern_variable_bound_in is RASQAL_API * src/rasqal_graph.c: autodocs however this is unused/uncompiled code at this point * docs/Makefile.am: Ignore rasqal_graph.c * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_variable_bound_in): autodocs * src/rasqal_algebra.c: (rasqal_algebra_query_to_algebra): For construct, walk selects to make projection. The query->constructs is an array of triples, not variables. * tests/engine/rasqal_construct_test.c: (main): removed unused var i * src/rasqal_variable.c: (rasqal_new_variable_from_variable): Copy vars_table * src/rasqal_variable.c: (rasqal_variables_table_add): Assign vars_table to owning object. * src/rasqal_internal.h: Move typedef rasqal_variables_table to rasqal.h * src/rasqal.h: Give all public structures a pointer to their owner object - usually rasqal_world as the first element in structure; since we're breaking the ABI. rasqal_prefix, rasqal_data_graph, rasqal_literal, rasqal_expression, rasqal_triples_match, rasqal_triples_match_s: moved rasqal_world* to start. rasqal_expression: added autodocs rasqal_variable: add pointer to variables table. * tests/engine/rasqal_construct_test.c: (main): Fix error printf using uninitialized var * src/rasqal_redland.c: (rasqal_redland_finish): handle early finish before init is done. * src/rasqal_redland.c: fixes * src/rasqal-config.in: Update to latest common code. * src/rasqal.h, src/rasqal_raptor.c, src/rasqal_redland.c, src/rasqal_triples_source.c: Add versioning to the structures registered by user API. rasqal_triples_source gains API version field. Current API is V1. rasqal_triples_source_factory gains API version field. Current API is V1. Added typedef rasqal_triples_source_factory_register_fn which registers a triples source factory and returns an error status. (rasqal_set_triples_source_factory): Check error return from TSF registration function. Checks API version of passed in factory is in supported range or log failure. Returns errors. (rasqal_new_triples_source): Check API version of constructed triple source is in supported range or log failure. (rasqal_raptor_new_triples_source): Return API V1. (rasqal_raptor_register_triples_source_factory): Return factory API v1 qnd return code. (rasqal_redland_new_triples_source): Return API V1 (rasqal_redland_register_triples_source_factory): Return factory API v1 qnd return code. Code style and tidying in above modules. * src/rasqal.h, src/rasqal_decimal.c, src/rasqal_literal.c: (rasqal_new_xsd_decimal): Add rasqal_world arg to constructor to match all other classes. * src/rasqal.h, src/rasqal_algebra.c, src/rasqal_graph_pattern.c: Remove deprecated rasqal_graph_pattern_get_constraint * src/rasqal_graph_pattern.c, src/rasqal_internal.h: struct rasqal_graph_pattern_s loses constraints field used to support deprecate functions * src/rasqal.h, src/rasqal_graph_pattern.c: Removed deprecated rasqal_graph_pattern_get_constraint_sequence * src/rasqal.h, src/rasqal_graph_pattern.c: Removed deprecated rasqal_graph_pattern_add_constraint * src/rasqal.h, src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_query_transform.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c: Removed deprecated rasqal_expression_evaluate Replaced rasqal_expression_evaluate with formerly named rasqal_expression_evaluate2 with an extra rasqal_world arg. * configure.ac: RASQAL_LIBTOOL_VERSION 2:0:0 * Breaking ABI/API and bumping library soname after this commit. Removing deprecated functions, methods. 2009-12-10 Dave Beckett * tests/algebra/test-05.out, tests/algebra/test-06.out, tests/algebra/test-08.out, tests/algebra/test-09.out: Update expected results to remove optimized-out expr(boolean(true)) * src/rasqal_algebra.c: (rasqal_algebra_remove_znodes): Only merge join nodes with two nodes, one of which is an empty graph pattern. If there is a join condition, it must be constant TRUE. This optimization of constant join conditions - TRUE/FALSE should be a separate previous path and replace join with always FALSE conditions with an empty node. * src/sparql_parser.y: (Collection): Free sequence of formulas after processing the triples. (GraphNodeListNotEmpty): Join node to sequence and initialise if NULL, handle errors and cleanup. * src/sparql_lexer.l: (sparql_token_free): Free more literal types when debugging lexing. * src/rasqal_rowsource_triples.c: (rasqal_new_triples_rowsource): If this is an empty triple pattern, free owned bound_in before calling return rasqal_new_empty_rowsource constructor. * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Allow check-rdql and check-sparql to override roqet and rapper using envariables ROQET and RAPPER * src/rasqal_literal.c: (rasqal_literal_string_equals): Only free dt1 and dt2 if allocated here. 2009-12-10 Lauri Aalto * src/sparql_parser.y: (ConstructTriplesOpt): Initialize empty query->constructs sequence. Fixes sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct05.rq test. 2009-12-10 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_string_equals): Free dt1 and dt2 on success and error. * src/rasqal_literal.c: (rasqal_new_integer_literal): Assign static string for RASQAL_LITERAL_BOOLEAN to avoid memory leak on string later. * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): Free name_uri when copied here. 2009-12-08 Dave Beckett * docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-unused.sgml: update derived docs 2009-12-07 Dave Beckett * src/rasqal_format_table.c: Remove several #if 1 blocks for writing padded strings * src/rasqal.h, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_query_transform.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c: (rasqal_expression_evaluate2): Renamed from rasqal_expression_evaluate_v2 * src/rasqal_query.c: (rasqal_query_get_engine_by_name): Set default query engine based on RASQAL_QUERY_ENGINE_VERSION define. This function is currently only ever called in the library with NULL as a value, so users cannot switch query engine after configure. * configure.ac: Added --with-query-engine-version arg with values 1 or 2 Defines RASQAL_QUERY_ENGINE_VERSION with value. Just adding this to allow people to switch to old engine when building, if necessary. Default query engine is now V2. 2009-12-04 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_graph_pattern_init): use rasqal_query_variable_bound_in_triple not rasqal_graph_pattern_variable_bound_in to check when found the triple to bind in. Former returns true for every variable in a triple loop so caused mis-binding. * src/rasqal_query_transform.c: (rasqal_query_triples_build_bound_in_internal): Add debug messages when a variable binding triple is found. * src/rasqal_internal.h, src/rasqal_query.c: (rasqal_query_variable_bound_in_triple): Added to check if a variable is bound in a triple/column. * src/sparql_parser.y: (WhereClause): Added (WhereClauseOpt): Use above or empty. (SelectQuery, ConstructQuery, AskQuery): Use required WhereClause for SELECT, CONSTRUCT and ASK queries (DescribeQuery): Use optional WhereClauseOpt for DESCRIBE queries. * src/sparql_parser.y: (WhereClauseOpt): WHERE is optional but the graph pattern is not. * tests/sparql/syntax/0triples.rq: Add where {} with empty graph pattern to 0triples.rq * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/select-no-gp.rq: Add select * as bad query in new query select-no-gp.rq 2009-11-30 Dave Beckett * src/rasqal_format_sparql_xml.c: (rasqal_query_results_write_sparql_xml): Remove unused code that attempted to write W3C XML Schemas XSD header. Out of date and not needed. * src/rasqal_engine.c: (rasqal_engine_graph_pattern_order): Removed - dead code. 2009-11-29 Dave Beckett * src/rasqal_query_transform.c: Rename functions and args/variables for terminology: use_map for a 2D array, use_map row for a 1D row in use-map * src/rasqal_query_transform.c: (rasqal_query_build_variables_sequence_use_map, rasqal_query_build_literals_sequence_use_map): Remove unused query arg. * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map, rasqal_query_build_variables_sequence_use_map, rasqal_query_build_literals_sequence_use_map): Return status code (rasqal_query_build_variables_use_map): Check return code of above for failures. * src/rasqal_query_transform.c: (rasqal_query_build_expressions_sequence_use_map): Added. (rasqal_query_build_variables_use_map): Use above to mark use of variables in query order_conditions_sequence (ORDER BY) sequence of rasqal_expression * src/rasqal_query_transform.c: Restore indenting messed up in SVN r15741 * src/rasqal_query_transform.c: indenting * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map): Renamed from rasqal_query_triples_build_variables_use_map_internal but now only used in this file. * src/rasqal_internal.h: Remove rasqal_query_triples_build_variables_use_map prototype - never called outside module. * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map): Removed, never called. * src/rasqal_query_transform.c: (rasqal_query_triples_build_variables_use_map_internal): Take a triples sequence arg so can be used for construct. (rasqal_query_triples_build_variables_use_map): Pass in triples seq. (rasqal_query_graph_pattern_build_variables_use_map): Pass in triples seq. (rasqal_query_build_variables_use_map): Use rasqal_query_triples_build_variables_use_map_internal for construct triples, putting them in the RASQAL_VAR_USE_MAP_OFFSET_VERBS row. * src/rasqal_query_transform.c: (rasqal_query_build_literals_sequence_use_map): Added. (rasqal_query_build_variables_use_map): Use above for DESCRIBE args which are a sequence of literals. * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): Move code comments into internal docucomment. * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): Expand comments and fixmes * configure.ac: Warn if pkg-config is not found - will be a fatal error when raptor2 is required. Prefer pkg-config raptor to raptor-config but accept both for now. pkg-config will not allow compiling against raptor in source tree. * ChangeLog, ChangeLog.6, Makefile.am: Add ChangeLog.6 for 2008. 2009-11-29 Lauri Aalto * autogen.sh: Reduce autogen noise on systems where uname is not in /usr/bin 2009-11-17 Lauri Aalto * src/rasqal.h: Define RASQAL_LITERAL_UDT_DEFINED for rdf_query_rasqal.c * src/rasqal_rowsource_distinct.c: (rasqal_new_distinct_rowsource): Free passed in rowsource on failure. * src/rasqal_rowsource.c: (rasqal_rowsource_read_all_rows): Check for rasqal_rowsource_ensure_variables() failure. * src/rasqal_rowsource_sort.c: (rasqal_sort_rowsource_ensure_variables): Check return value from inner rasqal_rowsource_ensure_variables() call. * src/rasqal_literal.c: (rasqal_literal_get_rdf_term_type): Always return proper enum value instead of int. Fixed typo in docs. * src/rasqal_query_results.c: (rasqal_query_results_execute_with_engine): Also check return value from execute_init() for errors. * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_sort.c: (rasqal_new_sort_rowsource): Do not take in a triples sequence as one is allocated internally, messing up ownership. Free passed in rowsource on failure. 2009-11-16 Dave Beckett * src/rasqal_redland.c: (rasqal_literal_to_redland_node): Use rasqal_literal_get_rdf_term_type to check RDF terminess to get away from ever-expanding if conditions. * src/rasqal.h, src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_get_rdf_term_type): Added to public API to return the RDF term type of a literal. (rasqal_literal_is_rdf_literal): Added calling above to return if a term is an RDF literal. 2009-11-16 Lauri Aalto * src/rasqal_rowsource_sort.c: (rasqal_sort_rowsource_process): Check rasqal_row_set_order_size() return value and clean up on failure. * src/rasqal_query_transform.c: (rasqal_graph_patterns_join): Check and return errors from raptor_sequence_join() * src/rasqal_algebra.c: (rasqal_algebra_group_graph_pattern_to_algebra): Always free anode, prevent double deletes. * src/rasqal_algebra.c: (rasqal_algebra_group_graph_pattern_to_algebra): Free anode on failure. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): Discard unused right_row. 2009-11-13 Dave Beckett * src/rasqal_query_transform.c: (rasqal_expression_expr_build_variables_use_map): Move earlier and take a use_map row. (rasqal_query_build_variables_sequence_use_map): Added to mark variables bound and used in a sequence of vars with optional project expressions. (rasqal_query_build_variables_use_map): Use rasqal_query_build_variables_sequence_use_map for SELECT and DESCRIBE to mark variables. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_build_merged_row): Set row offset from current rowsource context offset. 2009-11-13 Lauri Aalto * src/rasqal_algebra.c: (rasqal_algebra_basic_graph_pattern_to_algebra, rasqal_algebra_group_graph_pattern_to_algebra): Prevent double free of filter set. * src/rasqal_rowsource_union.c: (rasqal_union_rowsource_read_row): Don't leak rows on failure. * src/rasqal_rowsource_union.c: (rasqal_union_rowsource_ensure_variables): Check error code from rasqal_rowsource_copy_variables(). * src/rasqal_rowsource_union.c: (rasqal_new_union_rowsource): Free owned rowsources on failure. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_build_merged_row): Free passed in right_row on failure. Added FIXME note to a no-op assignment. * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c: (rasqal_rowsource_copy_variables): Changed internal function prototype to return int error code e.g. in case rasqal_rowsource_add_variable() fails. (rasqal_filter_rowsource_ensure_variables, rasqal_join_rowsource_ensure_variables): Check for rasqal_rowsource_copy_variables() failures. * src/rasqal_rowsource.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_project.c: (rasqal_filter_rowsource_ensure_variables, rasqal_project_rowsource_ensure_variables): rasqal_rowsource_ensure_variables() success and return error on failure. (rasqal_rowsource_read_row): Check rasqal_rowsource_ensure_variables() success and return NULL on failure. * src/rasqal_rowsource_join.c: (rasqal_new_join_rowsource): Free passed in rowsource params on failure. * src/rasqal_rowsource_filter.c: (rasqal_new_filter_rowsource): Free passed in rowsource, expr on failure. * src/rasqal_row_compatible.c, src/rasqal_rowsource_join.c: (rasqal_new_row_compatible): Check for alloc failures. (rasqal_join_rowsource_init): Check for rasqal_new_row_compatible() failure. * src/rasqal_algebra.c: (rasqal_algebra_group_graph_pattern_to_algebra): Free A node on failure. Prevent double delete of true_expr - rasqal_new_leftjoin_algebra_node() takes ownership of passed in expr. * src/rasqal_rowsource_project.c: (rasqal_new_project_rowsource): Free rowsource param on error. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_init): Return error if vars sequence push fails. 2009-11-11 Lauri Aalto * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_finish): Only free the triple meta if the meta array was allocated. * src/rasqal_engine_algebra.c: (rasqal_query_engine_algebra_execute_finish): Do not assume execution_data allocation succeeded. Cannot check this in caller since it is valid for a query engine to have ex_size 0 and thus no execution_data allocated but still require a call to execute_finish. * src/rasqal_query_transform.c: (rasqal_query_prepare_common): Return failure if a called function fails. * src/rasqal_algebra.c: (rasqal_algebra_query_to_algebra): Code style: return NULL explicitly. * src/rasqal_algebra.c: (rasqal_algebra_remove_znodes): Free the struct memory of nodes merged to other nodes. 2009-11-10 Lauri Aalto * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_finish, rasqal_join_rowsource_read_row): Do not leak left_rows * src/rasqal_algebra.c: (rasqal_new_filter_algebra_node): Made param ownership consistent with other algebra_node types. (rasqal_new_2op_algebra_node, rasqal_new_leftjoin_algebra_node): Ownership documentation fixes. * src/rasqal_algebra.c: (rasqal_algebra_query_to_algebra): Support CONSTRUCT query form on QE2. 2009-11-08 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_graph_pattern_build_variables_use_map): adjust output offset to skip the non-GP rows. use_map_offset_labels: added use_map_flags_labels: renamed from use_map_str and made static const. (rasqal_query_print_variables_use_map): Adjust to handle non-GP rows as well as GP rows. * src/rasqal_internal.h: rasqal_var_use_map_offset: added to reserve use_map rows for marking variable uses outside of graph patterns. * src/rasqal_query_transform.c: (rasqal_query_print_variables_use_map): off by 1 in unknown flag check * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): Document note of missing query parts that may need variable use map scans. 2009-11-06 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_prepare_common): Move rasqal_query_build_bound_in and rasqal_query_check_unused_variables to later so that rasqal_query_build_variables_use_map happens before rasqal_query_build_bound_in. * src/rasqal_engine.c: (rasqal_engine_get_next_result): Remove FIXMEs that are real errors - no graph patterns in query, already reported as such and not fixable. * src/rasqal_engine.c: (rasqal_engine_group_graph_pattern_get_next_match): Engine V1 is never going to implement group graph pattern - remove fixme. 2009-11-03 Dave Beckett * src/rasqal.h, src/rasqal_expr.c, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y, tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/coalesce1.rq: Implement LAQRS (possible SPARQL 1.1) COALESCE rasqal_op gains RASQAL_EXPR_COALESCE (COALESCE): Keyword added to laqrs lexer (CoalesceExpression): Added to laqrs grammar. (BuiltInCall): Add CoalesceExpression to option. (rasqal_new_coalesce_expression): Added. (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_evaluate_v2, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant): Implement coalesce * src/rasqal_query_results.c: (rasqal_query_results_get_binding_name): Get variables by select order not variable table order so that project expressions work - from SPARQL1.1 / LAQRS. * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_read_row): Calculate project expressions. 2009-10-26 Dave Beckett * src/sparql_parser.y: (LetGraphPattern): Free expression on error path * src/sparql_parser.y: (LetGraphPattern): Set $$ on error path * src/Makefile.am, src/rasqal.h, src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_rowsource_assignment.c, src/sparql_lexer.l, src/sparql_parser.y, tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/let1.rq, tests/laqrs/syntax/let1.ttl, tests/laqrs/syntax/let2.rq, tests/laqrs/syntax/let3.rq, tests/laqrs/syntax/let3.ttl: Added LAQRS sparql extension LET ?var := expression evaluated in-order inside a graph pattern rasqal_graph_pattern_operator gains RASQAL_GRAPH_PATTERN_OPERATOR_LET rasqal_algebra_node_operator gains RASQAL_ALGEBRA_OPERATOR_ASSIGN struct rasqal_graph_pattern_s shares filter_expression and gains variable field 'var' for GP LET. rasqal_algebra_node gains variable field 'var' for GP LET. (rasqal_new_assignment_algebra_node): Added. rasqal_algebra_node_operator_labels gains "Assignment" (rasqal_algebra_algebra_node_write_internal): Print variable name for assignment (rasqal_algebra_group_graph_pattern_to_algebra): Only AND filter graph patterns, not everything witha filter_expression. (rasqal_algebra_let_graph_pattern_to_algebra): Added. (rasqal_algebra_graph_pattern_to_algebra): Handle new RASQAL_GRAPH_PATTERN_OPERATOR_LET (rasqal_new_let_graph_pattern): Added. rasqal_graph_pattern_operator_labels gains "Let" (rasqal_graph_pattern_write_internal): Write Let GP for RASQAL_GRAPH_PATTERN_OPERATOR_LET (rasqal_query_let_build_variables_use_map_in_internal): Added (rasqal_query_graph_pattern_build_variables_use_map): Handle RASQAL_GRAPH_PATTERN_OPERATOR_LET using rasqal_query_let_build_variables_use_map_in_internal. (rasqal_query_print_variables_use_map): Tidy code and ignore unknown flags. SPARQL lexer and parser gain LET (LET) and ':' (ASSIGN) keywords. (GraphPatternNotTriples): Add option for LetGraphPattern (LetGraphPattern): Added to construct a RASQAL_GRAPH_PATTERN_OPERATOR_LET for LAQRS. (rasqal_query_write_sparql_graph_pattern): Print the GP out with LET ?var := ?expr. (rasqal_new_assignment_rowsource): Added assignment rowsource with this constructor. (rasqal_algebra_assignment_algebra_node_to_rowsource): Added. (rasqal_algebra_node_to_rowsource): Call above for RASQAL_ALGEBRA_OPERATOR_ASSIGN. 2009-10-22 Dave Beckett * src/rasqal_format_json.c: (rasqal_init_result_format_json): Restored old URIs 2009-10-21 Dave Beckett * src/rasqal_format_sv.c: Sep is a single char Write empty values as empty field ie foo,,bar or foo\t\tbar Write integer, float, double and decimal XSD types without quotes. 2009-10-21 Lauri Aalto * src/rasqal_literal.c: (rasqal_literal_string_equals): Fixed compilation with RAPTOR_V2_AVAILABLE 2009-10-20 Dave Beckett * src/rasqal.h, src/rasqal_engine.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c: Replace mentioned_in with a variables use map concept that has several flags per variable/gp combination. Set the mentioned flag for now - RASQAL_VAR_USE_MENTIONED_HERE Added num rasqal_var_use_map_flags with the flags. Renamed functions/fields with *_mentioned_in to be *_use_map (rasqal_query_print_variables_use_map): Added debug function to print use map and flags better. (rasqal_expression_expr_build_variables_use_map, rasqal_query_filter_build_variables_use_map_in_internal): Added to find variables mentioned in a filter expression. (rasqal_graph_pattern_variable_bound_in): Added to wrap bound_in that will be moving to query->use_map. * src/rasqal_internal.h: update comments for format file renamings * src/Makefile.am, src/rasqal_format_sparql_xml.c: Rename rasqal_sparql_xml.c to rasqal_format_sparql_xml.c * src/rasqal_sparql_xml.c: update label and url for this format * src/rasqal_format_json.c: update label and url for this format * src/rasqal_format_sv.c: Add labels for messages * src/Makefile.am, src/rasqal_format_csv.c, src/rasqal_format_sv.c Rename rasqal_format_csv.c to rasqal_format_sv.c * src/rasqal_format_csv.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Lets go crazy and add TSV too * src/rasqal_format_csv.c: tidy code * src/Makefile.am, src/rasqal_format_csv.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Added CSV output for query results - why not? * src/rasqal.h, src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_literal.c, tests/sparql/check-sparql: rasqal_literal gains a valid flag to indicate when an XSD type is known and has a valid literal form. Otherwise on construction, it gets turned into a RASQAL_LITERAL_UDT aka invalid/unknown type. (rasqal_new_*_literal): Set valid flag explicitly when known good. (rasqal_literal_set_typed_value): Turn invalid known types into RASQAL_LITERAL_UDT. (rasqal_literal_not_equals_flags): Added internal function to parallel rasqal_literal_equals_flags. The logic may be different soon. (rasqal_literal_write, rasqal_literal_print): Emit INV: before invalid literals for debugging. (rasqal_expr_evaluate_v2): Use rasqal_literal_not_equals_flags() for RASQAL_EXPR_NEQ. 2009-10-18 Dave Beckett * src/rasqal_expr.c: (rasqal_expression_evaluate_v2): Disallow comparing invalid literals Adjust datatype of plain literal to new xsd:string form. * src/rasqal_literal.c: (rasqal_new_numeric_literal, rasqal_literal_set_typed_value, rasqal_free_literal, rasqal_literal_cast): Handle RASQAL_LITERAL_XSD_STRING and RASQAL_LITERAL_XSD_UDT. (rasqal_literal_string_interpreted_as_boolean): Added, pulled out of rasqal_literal_set_typed_value. (rasqal_literal_set_typed_value): Use rasqal_literal_string_interpreted_as_boolean for decoding RASQAL_LITERAL_BOOLEAN string. (rasqal_literal_string_to_native): do nothing for RASQAL_LITERAL_STRING; set RASQAL_LITERAL_XSD_STRING and otherwise set unknown types to RASQAL_LITERAL_UDT Ensure the l->type is set via rasqal_literal_set_typed_value even if the function will fail due to a type error when rasqal_xsd_datatype_check is called. Update rasqal_literal_type_labels to add xsdstring and udt. (rasqal_literal_write, rasqal_literal_print): write/print xsd strings and UDT (rasqal_literal_as_boolean): Interpret RASQAL_LITERAL_XSD_STRING as booleans. RASQAL_LITERAL_UDT as error. (rasqal_literal_as_integer, rasqal_literal_as_floating, rasqal_literal_as_string_flags): Interpret RASQAL_LITERAL_XSD_STRING same as RASQAL_LITERAL_STRING. RASQAL_LITERAL_UDT as error. (rasqal_literal_get_rdf_term_type): Turn UDT into a RASQAL_LITERAL_STRING when flattening to an RDF term. (rasqal_new_literal_from_promotion): autodocs and add flags argument to allow promotion of strings to boolean (for RDQL) when RASQAL_COMPARE_URI is given. Interpret RASQAL_LITERAL_UDT as plain literal RASQAL_LITERAL_STRING but ensure the datatype is coopied. case RASQAL_LITERAL_BOOLEAN: Separated from RASQAL_LITERAL_INTEGER and use rasqal_literal_string_interpreted_as_boolean to handle promotion of strings to boolean. case RASQAL_LITERAL_XSD_STRING: Added, copying the string and type. case RASQAL_LITERAL_UDT: Added, causing error. (rasqal_literal_string_compare): Return an error if types are neigther plain literal or user defined datatyped literals (rasqal_literal_rdql_promote_calculate): Handle and ignore XSD_STRING and UDT for rdql promotions. If seen boolean and string, aim for destination type boolean. (rasqal_literal_compare): Return failure with UDT - cannot compare them. Handle UDT<>UDT compare same as STRING and XSD_STRING<>XSD_STRING as simple literal compare. (rasqal_literal_string_equals): Use XSD_STRING to get xsd_string_uri. Promote plain literals to xsd:string-typed for purpose of equality checking. Equality checking on user defined types fails with a type error. (rasqal_literal_equals_flags): Handle RASQAL_LITERAL_XSD_STRING and RASQAL_LITERAL_UDT as plain literal string. (rasqal_literal_as_node): Handle RASQAL_LITERAL_XSD_STRING and RASQAL_LITERAL_UDT as other XSD types. (rasqal_literal_add, rasqal_literal_subtract, rasqal_literal_multiply, rasqal_literal_divide, rasqal_literal_negate): Handle RASQAL_LITERAL_XSD_STRING and RASQAL_LITERAL_UDT as other XSD types. Update check so URI can be cast to xsd:string and no other type. RASQAL_LITERAL_XSD_STRING and RASQAL_LITERAL_XSD_UDT are errors. * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Adjust roqet output to hide udt(); replace with string() for comparison purposes. * src/rasqal_format_json.c, src/rasqal_query_results.c, src/rasqal_query_write.c, src/rasqal_sparql_xml.c: Add cases RASQAL_LITERAL_XSD_STRING and RASQAL_LITERAL_UDT to various switches usually near RASQAL_LITERAL_STRING. * src/rasqal_xsd_datatypes.c: sparql_xsd_names: insert entry for RASQAL_LITERAL_STRING parent_xsd_type: adjust parents for separation of plain literal (RASQAL_LITERAL_STRING), xsd:string (RASQAL_LITERAL_XSD) and user/unknown datatype (RASQAL_LITERAL_UDT) * src/rasqal.h: rasqal_literal_type gains 1) RASQAL_LITERAL_XSD_STRING - for xsd:string typed literals 2) RASQAL_LITERAL_UDT - for unknown data typed literals separated out of RASQAL_LITERAL_STRING which is for RDF plain literals and plain/typed turned into RDF terms only rasqal_compare_flags gains RASQAL_COMPARE_URI - now also provides RDQL string to bool comparison 2009-10-13 Dave Beckett * src/rasqal_rowsource_graph.c: (rasqal_graph_next_dg): Walk through all the named graphs and set the origin; do not end if default graph is seen. Improve error recovery. * src/rasqal_rowsource.c: (rasqal_rowsource_ensure_variables): Print rowsource variables after ensure_variables is called when debugging. (rasqal_rowsource_read_row): Print rowsource ptr when debugging. * src/rasqal_rowsource_join.c: Add rowsource ptr to debug messages. * src/rasqal_row_compatible.c: (rasqal_print_row_compatible): Tidy output ot remove all the "-1"s * src/rasqal_rowsource_union.c: (rasqal_union_rowsource_get_inner_rowsource): Return inner rowsources correctly. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_get_inner_rowsource): Return inner rowsources correctly. * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_init): Use rasqal_graph_rowsource_reset to set up initial graph state. (rasqal_graph_rowsource_reset): Call rasqal_graph_next_dg to set graph variable and start state. * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_read_row): Set new row to size of new rowsource. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): For natural join, return only compatible rows - both present - and with filter true. 2009-10-12 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_set_typed_value): The combination of error_handler/error_data and flags meant the error was never called so remove those args. (rasqal_new_typed_literal, rasqal_new_decimal_literal_from_decimal, rasqal_literal_string_to_native): Adjust calls to rasqal_literal_set_typed_value. * src/rasqal_engine_algebra.c: (rasqal_algebra_node_to_rowsource): Fail with NULL not abort() on getting back now rowsource. (rasqal_query_engine_algebra_execute_init): Handle NULL rowsource in debug printing. * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_read_row): Copy correct #values from old row. * docs/tmpl/section-expression.sgml, docs/tmpl/section-literal.sgml: docs * src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_xsd_datatypes.c: (rasqal_xsd_datatype_uri_parent_type): Deleted - only used once. (rasqal_new_string_literal_common): Remove call to above and replace with simpler inline equivalent. * src/rasqal_literal.c: (rasqal_new_integer_literal): Use rasqal_xsd_format_integer (rasqal_new_float_literal): Use rasqal_xsd_format_double * src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_integer, rasqal_xsd_format_float): Added to put formatting in one clear place. 2009-10-12 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate_v2): Use #if not #ifdef with preprocessor expressions. * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): Plain ascii comments * src/rasqal_format_table.c: (rasqal_query_results_write_table): Compilation fix: Pass NULL context to raptor_new_sequence_v2(). 2009-10-11 Dave Beckett * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): Update left join rules with docs from algebra; update condition for left join to match rules. * tests/sparql/check-sparql: warn when SPARQL JSON results format is seen * src/rasqal_decimal.c: (rasqal_xsd_decimal_compare): Fix decimal comparison case when using doubles to implement it. comparison check was backwards and imprecise. 2009-10-10 Dave Beckett * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): Correct misleading debug message. * src/rasqal.h, src/rasqal_literal.c, src/rasqal_xsd_datatypes.c: ABI change: Reorder rasqal_literal_type enumeration to match numeric type promotion order: float is now between integer and double. * src/rasqal.h, src/rasqal_expr.c, src/rasqal_literal.c: (rasqal_literal_string_equals, rasqal_literal_uri_equals, rasqal_literal_blank_equals): Lose error arg, these never returns a type error. (rasqal_literal_equals_flags): Rename error arg to error_p since it's a pointer/out arg. (rasqal_literal_same_term): Lose error arg and do not pass on any type error from literal comparison; it's a difference not an error. (rasqal_expression_evaluate_v2): same_term returns no error, tidy debug messages. * src/rasqal_xsd_datatypes.c: parent_xsd_type - promote integer to float * src/rasqal_xsd_datatypes.c: parent_xsd_type - promote float to double * src/rasqal_literal.c: (rasqal_new_integer_literal, rasqal_literal_set_typed_value): Set parent_type using rasqal_xsd_datatype_parent_type. (rasqal_literal_promote_numerics): Make numeric type promotion recursive and use rasqal_xsd_datatype_parent_type() for each step. * src/rasqal_expr.c: Extra debug messags for equals_flags/sameterm when RASQAL_DEBUG > 1 * src/rasqal_xsd_datatypes.c: parent_xsd_type - set pattern, qname and variable to no xsd parent type * src/rasqal_xsd_datatypes.c: notes near parent_xsd_type * src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: (rasqal_xsd_datatype_parent_type): Added * src/rasqal_expr.c: (rasqal_expression_evaluate_v2): Use rasqal_literal_same_term for evaluating sameTerm. * src/rasqal.h, src/rasqal_literal.c: (rasqal_literal_same_term): Added * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): snprintf buffer was too small and lost the last digit of the exponent. * src/rasqal_engine.c: remove debug NL * src/rasqal_query_transform.c: (rasqal_graph_pattern_move_constraints): When moving constraints, AND them with any existing constraints. * src/rasqal_rowsource_filter.c: remove debug NL that annoyed me again * src/rasqal_engine.c: remove debug NL that annoyed me * src/rasqal_general.c: (rasqal_uri_init): Tidy OOM during static library init * src/rasqal_query_transform.c: (rasqal_query_prepare_count_graph_patterns): No need for noisy OOM message. 2009-10-09 Dave Beckett * src/rasqal_result_formats.c: autodocs * src/Makefile.am, src/rasqal_format_json.c (copied from /rasqal/trunk/src/rasqal_result_formats.c:15558), src/rasqal_internal.h, src/rasqal_result_formats.c: Move query result format JSON to new file rasqal_format_json.c * src/Makefile.am, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_write.c: Moved query serialization to SPARQL into new rasqal_query_write.c file. * src/rasqal_format_table.c: (rasqal_query_results_write_table): Use rasqal_literal_write and iostream to write formatted literal with type, datatype/lang etc. * tests/sparql/check-sparql: diff -u: it's my favourite diff option 2009-10-08 Dave Beckett * utils/srxread.c: Code style. Add optional read and write result format args. * src/Makefile.am, src/rasqal_format_table.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Added query result format 'table' * src/rasqal_internal.h: Make rasqal_query_results_get_current_row internal * src/rasqal_query_results.c: (rasqal_query_results_get_current_row): Make available to other modules, not public yet. (rasqal_query_results_get_bindings_count): Check for at least one row so that this works at start of results. 2009-10-01 Dave Beckett * tests/sparql/test-suite-archive/data-r2/slice: Remove empty dir slice * tests/sparql/test-suite-archive/data-r2/syntax: Remove empty dir * tests/sparql/test-suite-archive/data-r2/*.*.bak:: Remove .bak files * tests/sparql/test-suite-archive/data-r2/foo, tests/sparql/test-suite-archive/data-r2/x: Remove junk files * tests/sparql/test-suite-archive/*: Remove svn:executable from data files * tests/sparql/test-suite-archive, tests/sparql/test-suite-archive/README.html, tests/sparql/test-suite-archive/data-r2, tests/sparql/test-suite-archive/data-r2/LICENSE, tests/sparql/test-suite-archive/data-r2/README, tests/sparql/test-suite-archive/data-r2/algebra, tests/sparql/test-suite-archive/data-r2/algebra/data-1.ttl, tests/sparql/test-suite-archive/data-r2/algebra/data-2.ttl, tests/sparql/test-suite-archive/data-r2/algebra/filter-nested-1.rq, tests/sparql/test-suite-archive/data-r2/algebra/filter-nested-1.srx, tests/sparql/test-suite-archive/data-r2/algebra/filter-nested-2.rq, tests/sparql/test-suite-archive/data-r2/algebra/filter-nested-2.srx, tests/sparql/test-suite-archive/data-r2/algebra/filter-placement-1.rq, tests/sparql/test-suite-archive/data-r2/algebra/filter-placement-1.srx, tests/sparql/test-suite-archive/data-r2/algebra/filter-placement-2.rq, tests/sparql/test-suite-archive/data-r2/algebra/filter-placement-2.srx, tests/sparql/test-suite-archive/data-r2/algebra/filter-placement-3.rq, tests/sparql/test-suite-archive/data-r2/algebra/filter-placement-3.srx, tests/sparql/test-suite-archive/data-r2/algebra/filter-scope-1.rq, tests/sparql/test-suite-archive/data-r2/algebra/filter-scope-1.srx, tests/sparql/test-suite-archive/data-r2/algebra/join-combo-1.rq, tests/sparql/test-suite-archive/data-r2/algebra/join-combo-1.srx, tests/sparql/test-suite-archive/data-r2/algebra/join-combo-2.rq, tests/sparql/test-suite-archive/data-r2/algebra/join-combo-2.srx, tests/sparql/test-suite-archive/data-r2/algebra/join-combo-graph-1.ttl, tests/sparql/test-suite-archive/data-r2/algebra/join-combo-graph-2.ttl, tests/sparql/test-suite-archive/data-r2/algebra/manifest.ttl, tests/sparql/test-suite-archive/data-r2/algebra/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-1.rq, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-1.srx, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-1.ttl, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-2.rq, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-2.srx, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-2.ttl, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-3.rq, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-3.srx, tests/sparql/test-suite-archive/data-r2/algebra/opt-filter-3.ttl, tests/sparql/test-suite-archive/data-r2/algebra/two-nested-opt-alt.rq, tests/sparql/test-suite-archive/data-r2/algebra/two-nested-opt-alt.srx, tests/sparql/test-suite-archive/data-r2/algebra/two-nested-opt.rq, tests/sparql/test-suite-archive/data-r2/algebra/two-nested-opt.srx, tests/sparql/test-suite-archive/data-r2/algebra/two-nested-opt.ttl, tests/sparql/test-suite-archive/data-r2/algebra/var-scope-join-1.rq, tests/sparql/test-suite-archive/data-r2/algebra/var-scope-join-1.srx, tests/sparql/test-suite-archive/data-r2/algebra/var-scope-join-1.ttl, tests/sparql/test-suite-archive/data-r2/algebra-expressions.txt, tests/sparql/test-suite-archive/data-r2/ask, tests/sparql/test-suite-archive/data-r2/ask/ask-1.rq, tests/sparql/test-suite-archive/data-r2/ask/ask-1.srx, tests/sparql/test-suite-archive/data-r2/ask/ask-4.rq, tests/sparql/test-suite-archive/data-r2/ask/ask-4.srx, tests/sparql/test-suite-archive/data-r2/ask/ask-7.rq, tests/sparql/test-suite-archive/data-r2/ask/ask-7.srx, tests/sparql/test-suite-archive/data-r2/ask/ask-8.rq, tests/sparql/test-suite-archive/data-r2/ask/ask-8.srx, tests/sparql/test-suite-archive/data-r2/ask/data.ttl, tests/sparql/test-suite-archive/data-r2/ask/manifest.ttl, tests/sparql/test-suite-archive/data-r2/ask/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/basic, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-1.rq, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-1.srx, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-2.rq, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-2.srx, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-3.rq, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-3.srx, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-4.rq, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-4.srx, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-5.rq, tests/sparql/test-suite-archive/data-r2/basic/base-prefix-5.srx, tests/sparql/test-suite-archive/data-r2/basic/bgp-no-match.rq, tests/sparql/test-suite-archive/data-r2/basic/bgp-no-match.srx, tests/sparql/test-suite-archive/data-r2/basic/data-1.ttl, tests/sparql/test-suite-archive/data-r2/basic/data-2.ttl, tests/sparql/test-suite-archive/data-r2/basic/data-3.ttl, tests/sparql/test-suite-archive/data-r2/basic/data-4.ttl, tests/sparql/test-suite-archive/data-r2/basic/data-5.ttl, tests/sparql/test-suite-archive/data-r2/basic/data-6.ttl, tests/sparql/test-suite-archive/data-r2/basic/data-7.ttl, tests/sparql/test-suite-archive/data-r2/basic/list-1.rq, tests/sparql/test-suite-archive/data-r2/basic/list-1.srx, tests/sparql/test-suite-archive/data-r2/basic/list-2.rq, tests/sparql/test-suite-archive/data-r2/basic/list-2.srx, tests/sparql/test-suite-archive/data-r2/basic/list-3.rq, tests/sparql/test-suite-archive/data-r2/basic/list-3.srx, tests/sparql/test-suite-archive/data-r2/basic/list-4.rq, tests/sparql/test-suite-archive/data-r2/basic/list-4.srx, tests/sparql/test-suite-archive/data-r2/basic/manifest.ttl, tests/sparql/test-suite-archive/data-r2/basic/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/basic/prefix-name-1.rq, tests/sparql/test-suite-archive/data-r2/basic/prefix-name-1.srx, tests/sparql/test-suite-archive/data-r2/basic/quotes-1.rq, tests/sparql/test-suite-archive/data-r2/basic/quotes-1.srx, tests/sparql/test-suite-archive/data-r2/basic/quotes-2.rq, tests/sparql/test-suite-archive/data-r2/basic/quotes-2.srx, tests/sparql/test-suite-archive/data-r2/basic/quotes-3.rq, tests/sparql/test-suite-archive/data-r2/basic/quotes-3.srx, tests/sparql/test-suite-archive/data-r2/basic/quotes-4.rq, tests/sparql/test-suite-archive/data-r2/basic/quotes-4.srx, tests/sparql/test-suite-archive/data-r2/basic/spoo-1.rq, tests/sparql/test-suite-archive/data-r2/basic/spoo-1.srx, tests/sparql/test-suite-archive/data-r2/basic/term-1.rq, tests/sparql/test-suite-archive/data-r2/basic/term-1.srx, tests/sparql/test-suite-archive/data-r2/basic/term-2.rq, tests/sparql/test-suite-archive/data-r2/basic/term-2.srx, tests/sparql/test-suite-archive/data-r2/basic/term-3.rq, tests/sparql/test-suite-archive/data-r2/basic/term-3.srx, tests/sparql/test-suite-archive/data-r2/basic/term-4.rq, tests/sparql/test-suite-archive/data-r2/basic/term-4.srx, tests/sparql/test-suite-archive/data-r2/basic/term-5.rq, tests/sparql/test-suite-archive/data-r2/basic/term-5.srx, tests/sparql/test-suite-archive/data-r2/basic/term-6.rq, tests/sparql/test-suite-archive/data-r2/basic/term-6.srx, tests/sparql/test-suite-archive/data-r2/basic/term-7.rq, tests/sparql/test-suite-archive/data-r2/basic/term-7.srx, tests/sparql/test-suite-archive/data-r2/basic/term-8.rq, tests/sparql/test-suite-archive/data-r2/basic/term-8.srx, tests/sparql/test-suite-archive/data-r2/basic/term-9.rq, tests/sparql/test-suite-archive/data-r2/basic/term-9.srx, tests/sparql/test-suite-archive/data-r2/basic/var-1.rq, tests/sparql/test-suite-archive/data-r2/basic/var-1.srx, tests/sparql/test-suite-archive/data-r2/basic/var-2.rq, tests/sparql/test-suite-archive/data-r2/basic/var-2.srx, tests/sparql/test-suite-archive/data-r2/bnode-coreference, tests/sparql/test-suite-archive/data-r2/bnode-coreference/data.ttl, tests/sparql/test-suite-archive/data-r2/bnode-coreference/manifest.ttl, tests/sparql/test-suite-archive/data-r2/bnode-coreference/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/bnode-coreference/query.rq, tests/sparql/test-suite-archive/data-r2/bnode-coreference/result.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/data-1.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/data-2.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/manifest.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-bev-1.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-bev-2.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-bev-3.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-bev-4.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-bev-5.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-bev-6.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/query-boolean-literal.rq, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-bev-1.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-bev-2.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-bev-3.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-bev-4.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-bev-5.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-bev-6.ttl, tests/sparql/test-suite-archive/data-r2/boolean-effective-value/result-boolean-literal.ttl, tests/sparql/test-suite-archive/data-r2/bound, tests/sparql/test-suite-archive/data-r2/bound/bound1-result.ttl, tests/sparql/test-suite-archive/data-r2/bound/bound1.rq, tests/sparql/test-suite-archive/data-r2/bound/data.ttl, tests/sparql/test-suite-archive/data-r2/bound/manifest.ttl, tests/sparql/test-suite-archive/data-r2/bound/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/cast, tests/sparql/test-suite-archive/data-r2/cast/cast-bool.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-bool.srx, tests/sparql/test-suite-archive/data-r2/cast/cast-dT.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-dT.srx, tests/sparql/test-suite-archive/data-r2/cast/cast-dbl.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-dbl.srx, tests/sparql/test-suite-archive/data-r2/cast/cast-dec.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-dec.srx, tests/sparql/test-suite-archive/data-r2/cast/cast-flt.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-flt.srx, tests/sparql/test-suite-archive/data-r2/cast/cast-int.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-int.srx, tests/sparql/test-suite-archive/data-r2/cast/cast-str.rq, tests/sparql/test-suite-archive/data-r2/cast/cast-str.srx, tests/sparql/test-suite-archive/data-r2/cast/data.ttl, tests/sparql/test-suite-archive/data-r2/cast/manifest.ttl, tests/sparql/test-suite-archive/data-r2/construct, tests/sparql/test-suite-archive/data-r2/construct/data-ident.ttl, tests/sparql/test-suite-archive/data-r2/construct/data-opt.ttl, tests/sparql/test-suite-archive/data-r2/construct/data-reif.ttl, tests/sparql/test-suite-archive/data-r2/construct/manifest.ttl, tests/sparql/test-suite-archive/data-r2/construct/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/construct/query-construct-optional.rq, tests/sparql/test-suite-archive/data-r2/construct/query-ident.rq, tests/sparql/test-suite-archive/data-r2/construct/query-reif-1.rq, tests/sparql/test-suite-archive/data-r2/construct/query-reif-2.rq, tests/sparql/test-suite-archive/data-r2/construct/query-subgraph.rq, tests/sparql/test-suite-archive/data-r2/construct/result-construct-optional.ttl, tests/sparql/test-suite-archive/data-r2/construct/result-ident.ttl, tests/sparql/test-suite-archive/data-r2/construct/result-reif.ttl, tests/sparql/test-suite-archive/data-r2/construct/result-subgraph.ttl, tests/sparql/test-suite-archive/data-r2/dataset, tests/sparql/test-suite-archive/data-r2/dataset/data-g1-dup.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g1.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g2-dup.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g2.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g3-dup.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g3.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g4-dup.ttl, tests/sparql/test-suite-archive/data-r2/dataset/data-g4.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-01.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-01.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-02.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-02.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-03.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-03.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-04.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-04.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-05.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-05.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-06.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-06.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-07.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-07.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-08.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-08.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-09.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-09.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-09b.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-10.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-10.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-10b.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-11.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-11.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-12.rq, tests/sparql/test-suite-archive/data-r2/dataset/dataset-12.ttl, tests/sparql/test-suite-archive/data-r2/dataset/dataset-12b.rq, tests/sparql/test-suite-archive/data-r2/dataset/manifest.ttl, tests/sparql/test-suite-archive/data-r2/dataset/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/distinct, tests/sparql/test-suite-archive/data-r2/distinct/data-all.ttl, tests/sparql/test-suite-archive/data-r2/distinct/data-node.ttl, tests/sparql/test-suite-archive/data-r2/distinct/data-num.ttl, tests/sparql/test-suite-archive/data-r2/distinct/data-opt.ttl, tests/sparql/test-suite-archive/data-r2/distinct/data-star.ttl, tests/sparql/test-suite-archive/data-r2/distinct/data-str.ttl, tests/sparql/test-suite-archive/data-r2/distinct/distinct-1-results.srx, tests/sparql/test-suite-archive/data-r2/distinct/distinct-1.rq, tests/sparql/test-suite-archive/data-r2/distinct/distinct-2.rq, tests/sparql/test-suite-archive/data-r2/distinct/distinct-all.srx, tests/sparql/test-suite-archive/data-r2/distinct/distinct-node.srx, tests/sparql/test-suite-archive/data-r2/distinct/distinct-num.srx, tests/sparql/test-suite-archive/data-r2/distinct/distinct-opt.srx, tests/sparql/test-suite-archive/data-r2/distinct/distinct-star-1.rq, tests/sparql/test-suite-archive/data-r2/distinct/distinct-star-1.srx, tests/sparql/test-suite-archive/data-r2/distinct/distinct-str.srx, tests/sparql/test-suite-archive/data-r2/distinct/manifest.ttl, tests/sparql/test-suite-archive/data-r2/distinct/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-1.rq, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-2.rq, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-all.srx, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-node.srx, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-num.srx, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-opt.srx, tests/sparql/test-suite-archive/data-r2/distinct/no-distinct-str.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin, tests/sparql/test-suite-archive/data-r2/expr-builtin/data-builtin-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/data-builtin-2.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/data-langMatches-de.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/data-langMatches.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/lang-case-insensitive-eq.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/lang-case-insensitive-ne.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/lang-case-sensitivity-eq.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/lang-case-sensitivity-ne.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/lang-case-sensitivity.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/manifest.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-blank-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-datatype-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-datatype-2.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-datatype-3.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-iri-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-isliteral-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-lang-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-lang-2.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-lang-3.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-langMatches-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-langMatches-2.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-langMatches-3.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-langMatches-4.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-langMatches-de-de.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-str-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-str-2.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-str-3.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-str-4.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/q-uri-1.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-blank-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-datatype-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-datatype-2.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-datatype-3.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-iri-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-isliteral-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-lang-1.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-lang-2.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-lang-3.srx, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-langMatches-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-langMatches-2.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-langMatches-3.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-langMatches-4.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-langMatches-de.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-sameTerm-eq.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-sameTerm-not-eq.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-sameTerm.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-str-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-str-2.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-str-3.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-str-4.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/result-uri-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-builtin/sameTerm-eq.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/sameTerm-not-eq.rq, tests/sparql/test-suite-archive/data-r2/expr-builtin/sameTerm.rq, tests/sparql/test-suite-archive/data-r2/expr-equals, tests/sparql/test-suite-archive/data-r2/expr-equals/data-eq.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/manifest.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-1.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-2.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-3.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-4.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-5.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-graph-1.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-graph-2.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-graph-3.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-graph-4.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq-graph-5.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq2-1.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq2-2.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/query-eq2-graph-1.rq, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-2.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-3.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-4.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-5.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-graph-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-graph-2.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-graph-3.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-graph-4.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq-graph-5.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq2-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq2-2.ttl, tests/sparql/test-suite-archive/data-r2/expr-equals/result-eq2-graph-1.ttl, tests/sparql/test-suite-archive/data-r2/expr-ops, tests/sparql/test-suite-archive/data-r2/expr-ops/data.ttl, tests/sparql/test-suite-archive/data-r2/expr-ops/manifest.ttl, tests/sparql/test-suite-archive/data-r2/expr-ops/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/expr-ops/query-ge-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/query-le-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/query-minus-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/query-mul-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/query-plus-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/query-unminus-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/query-unplus-1.rq, tests/sparql/test-suite-archive/data-r2/expr-ops/result-ge-1.srx, tests/sparql/test-suite-archive/data-r2/expr-ops/result-le-1.srx, tests/sparql/test-suite-archive/data-r2/expr-ops/result-minus-1.srx, tests/sparql/test-suite-archive/data-r2/expr-ops/result-mul-1.srx, tests/sparql/test-suite-archive/data-r2/expr-ops/result-plus-1.srx, tests/sparql/test-suite-archive/data-r2/expr-ops/result-unminus-1.srx, tests/sparql/test-suite-archive/data-r2/expr-ops/result-unplus-1.srx, tests/sparql/test-suite-archive/data-r2/extended-manifest-evaluation.ttl, tests/sparql/test-suite-archive/data-r2/files-to-fix, tests/sparql/test-suite-archive/data-r2/foo, tests/sparql/test-suite-archive/data-r2/graph, tests/sparql/test-suite-archive/data-r2/graph/data-g1.ttl, tests/sparql/test-suite-archive/data-r2/graph/data-g2.ttl, tests/sparql/test-suite-archive/data-r2/graph/data-g3-dup.ttl, tests/sparql/test-suite-archive/data-r2/graph/data-g3.ttl, tests/sparql/test-suite-archive/data-r2/graph/data-g4.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-01.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-01.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-02.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-02.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-03.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-03.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-04.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-04.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-05.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-05.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-06.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-06.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-07.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-07.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-08.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-08.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-09.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-09.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-10.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-10.ttl, tests/sparql/test-suite-archive/data-r2/graph/graph-11.rq, tests/sparql/test-suite-archive/data-r2/graph/graph-11.ttl, tests/sparql/test-suite-archive/data-r2/graph/manifest.ttl, tests/sparql/test-suite-archive/data-r2/graph/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/i18n, tests/sparql/test-suite-archive/data-r2/i18n/.htaccess, tests/sparql/test-suite-archive/data-r2/i18n/kanji-01-results.ttl, tests/sparql/test-suite-archive/data-r2/i18n/kanji-01.rq, tests/sparql/test-suite-archive/data-r2/i18n/kanji-02-results.ttl, tests/sparql/test-suite-archive/data-r2/i18n/kanji-02.rq, tests/sparql/test-suite-archive/data-r2/i18n/kanji.ttl, tests/sparql/test-suite-archive/data-r2/i18n/manifest.ttl, tests/sparql/test-suite-archive/data-r2/i18n/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/i18n/normalization-01-results.ttl, tests/sparql/test-suite-archive/data-r2/i18n/normalization-01.rq, tests/sparql/test-suite-archive/data-r2/i18n/normalization-01.ttl, tests/sparql/test-suite-archive/data-r2/i18n/normalization-02-results.ttl, tests/sparql/test-suite-archive/data-r2/i18n/normalization-02.rq, tests/sparql/test-suite-archive/data-r2/i18n/normalization-02.ttl, tests/sparql/test-suite-archive/data-r2/i18n/normalization-03-results.ttl, tests/sparql/test-suite-archive/data-r2/i18n/normalization-03.rq, tests/sparql/test-suite-archive/data-r2/i18n/normalization-03.ttl, tests/sparql/test-suite-archive/data-r2/manifest-evaluation.ttl, tests/sparql/test-suite-archive/data-r2/manifest-syntax.ttl, tests/sparql/test-suite-archive/data-r2/open-world, tests/sparql/test-suite-archive/data-r2/open-world/data-1.ttl, tests/sparql/test-suite-archive/data-r2/open-world/data-2.ttl, tests/sparql/test-suite-archive/data-r2/open-world/data-3.ttl, tests/sparql/test-suite-archive/data-r2/open-world/data-4.ttl, tests/sparql/test-suite-archive/data-r2/open-world/date-1-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/date-1.rq, tests/sparql/test-suite-archive/data-r2/open-world/date-2-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/date-2.rq, tests/sparql/test-suite-archive/data-r2/open-world/date-3-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/date-3.rq, tests/sparql/test-suite-archive/data-r2/open-world/date-4-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/date-4.rq, tests/sparql/test-suite-archive/data-r2/open-world/manifest.ttl, tests/sparql/test-suite-archive/data-r2/open-world/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/open-world/open-cmp-01-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-cmp-01.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-cmp-02-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-cmp-02.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-01-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-01.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-02-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-02.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-03-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-03.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-04-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-04.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-05-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-05.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-06-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-06.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-07-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-07.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-08-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-08.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-09-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-09.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-10-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-10.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-11-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-11.rq, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-12-result.srx, tests/sparql/test-suite-archive/data-r2/open-world/open-eq-12.rq, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm-StringSimpleLiteralCmp.srx, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm-eq-StringSimpleLiteralCmp.srx, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm-eq.srx, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm-manifest.ttl, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm-not-eq-StringSimpleLiteralCmp.srx, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm-not-eq.srx, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm.srx, tests/sparql/test-suite-archive/data-r2/open-world/sameTerm.ttl, tests/sparql/test-suite-archive/data-r2/optional, tests/sparql/test-suite-archive/data-r2/optional/complex-data-1.ttl, tests/sparql/test-suite-archive/data-r2/optional/complex-data-2.ttl, tests/sparql/test-suite-archive/data-r2/optional/data.ttl, tests/sparql/test-suite-archive/data-r2/optional/manifest.ttl, tests/sparql/test-suite-archive/data-r2/optional/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/optional/q-opt-1.rq, tests/sparql/test-suite-archive/data-r2/optional/q-opt-2.rq, tests/sparql/test-suite-archive/data-r2/optional/q-opt-3.rq, tests/sparql/test-suite-archive/data-r2/optional/q-opt-complex-1.rq, tests/sparql/test-suite-archive/data-r2/optional/q-opt-complex-2.rq, tests/sparql/test-suite-archive/data-r2/optional/q-opt-complex-3.rq, tests/sparql/test-suite-archive/data-r2/optional/q-opt-complex-4.rq, tests/sparql/test-suite-archive/data-r2/optional/result-opt-1.ttl, tests/sparql/test-suite-archive/data-r2/optional/result-opt-2.ttl, tests/sparql/test-suite-archive/data-r2/optional/result-opt-3.ttl, tests/sparql/test-suite-archive/data-r2/optional/result-opt-complex-1.ttl, tests/sparql/test-suite-archive/data-r2/optional/result-opt-complex-2.ttl, tests/sparql/test-suite-archive/data-r2/optional/result-opt-complex-3.ttl, tests/sparql/test-suite-archive/data-r2/optional/result-opt-complex-4.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter, tests/sparql/test-suite-archive/data-r2/optional-filter/data-1.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-1-result.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-1.rq, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-2-result.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-2.rq, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-3-result.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-3.rq, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-4-result.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-4.rq, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-5-result-not-simplified.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-5-result-simplified.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/expr-5.rq, tests/sparql/test-suite-archive/data-r2/optional-filter/manifest.ttl, tests/sparql/test-suite-archive/data-r2/optional-filter/manifest.ttl.bak, tests/sparql/test-suite-archive/data-r2/reduced, tests/sparql/test-suite-archive/data-r2/reduced/manifest.ttl, tests/sparql/test-suite-archive/data-r2/reduced/reduced-1.rq, tests/sparql/test-suite-archive/data-r2/reduced/reduced-1.srx, tests/sparql/test-suite-archive/data-r2/reduced/reduced-2.rq, tests/sparql/test-suite-archive/data-r2/reduced/reduced-2.srx, tests/sparql/test-suite-archive/data-r2/reduced/reduced-star.ttl, tests/sparql/test-suite-archive/data-r2/reduced/reduced-str.ttl, tests/sparql/test-suite-archive/data-r2/regex/manifest.ttl, tests/sparql/test-suite-archive/data-r2/regex/regex-data-01.ttl, tests/sparql/test-suite-archive/data-r2/regex/regex-query-001.rq, tests/sparql/test-suite-archive/data-r2/regex/regex-query-002.rq, tests/sparql/test-suite-archive/data-r2/regex/regex-query-003.rq, tests/sparql/test-suite-archive/data-r2/regex/regex-query-004.rq, tests/sparql/test-suite-archive/data-r2/regex/regex-result-001.ttl, tests/sparql/test-suite-archive/data-r2/regex/regex-result-002.ttl, tests/sparql/test-suite-archive/data-r2/regex/regex-result-003.ttl, tests/sparql/test-suite-archive/data-r2/regex/regex-result-004.ttl, tests/sparql/test-suite-archive/data-r2/run-tests, tests/sparql/test-suite-archive/data-r2/solution-seq/data.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/manifest.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-01.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-02.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-03.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-04.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-10.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-11.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-12.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-13.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-20.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-21.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-22.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-23.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-24.rq, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-01.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-02.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-03.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-04.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-10.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-11.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-12.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-13.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-20.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-21.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-22.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-23.ttl, tests/sparql/test-suite-archive/data-r2/solution-seq/slice-results-24.ttl, tests/sparql/test-suite-archive/data-r2/sort/.manifest.ttl.swp, tests/sparql/test-suite-archive/data-r2/sort/data-sort-1.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-11.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-3.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-4.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-6.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-7.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-8.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-9.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-builtin.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-function.ttl, tests/sparql/test-suite-archive/data-r2/sort/data-sort-numbers.ttl, tests/sparql/test-suite-archive/data-r2/sort/extended-manifest.ttl, tests/sparql/test-suite-archive/data-r2/sort/manifest.ttl, tests/sparql/test-suite-archive/data-r2/sort/query-sort-1.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-10.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-2.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-3.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-4.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-5.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-6.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-9.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-builtin.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-function.rq, tests/sparql/test-suite-archive/data-r2/sort/query-sort-numbers.rq, tests/sparql/test-suite-archive/data-r2/sort/result-sort-1.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-10.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-11.ttl, tests/sparql/test-suite-archive/data-r2/sort/result-sort-2.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-3.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-4.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-5.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-6.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-7.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-8.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-9.rdf, tests/sparql/test-suite-archive/data-r2/sort/result-sort-builtin.ttl, tests/sparql/test-suite-archive/data-r2/sort/result-sort-function.ttl, tests/sparql/test-suite-archive/data-r2/sort/result-sort-numbers.ttl, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/manifest.ttl, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-basic-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-basic-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-basic-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-basic-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-basic-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-basic-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-bnodes-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-bnodes-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-bnodes-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-bnodes-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-bnodes-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-expr-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-expr-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-expr-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-expr-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-expr-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-forms-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-forms-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-limit-offset-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-limit-offset-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-limit-offset-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-limit-offset-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lists-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lists-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lists-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lists-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lists-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-08.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-09.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-10.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-11.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-12.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-13.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-14.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-15.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-16.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-17.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-18.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-19.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-lit-20.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-order-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-pat-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-pat-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-pat-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-pat-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-qname-08.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-08.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-09.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-10.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-11.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-12.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-13.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-struct-14.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-union-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql1/syntax-union-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/manifest.ttl, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-bnode-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-bnode-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-bnode-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-dataset-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-dataset-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-dataset-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-dataset-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-esc-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-esc-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-esc-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-esc-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-esc-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-ask-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-construct01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-construct02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-construct03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-construct04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-construct06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-describe01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-describe02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-select-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-form-select-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-function-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-function-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-function-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-function-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-08.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-09.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-10.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-11.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-12.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-13.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-general-14.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-graph-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-graph-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-graph-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-graph-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-graph-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-keywords-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-keywords-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-keywords-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-lists-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-lists-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-lists-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-lists-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql2/syntax-lists-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/manifest.ttl, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-08.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-03.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-04.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-05.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-06.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-07.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-08.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-09.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-10.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-11.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-12.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-13.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-14.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-15.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-16.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-17.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-18.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-19.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-20.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-21.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-22.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-23.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-24.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-25.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-26.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-27.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-28.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-29.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-30.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-31.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-bnode-dot.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-bnodes-missing-pvalues-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-bnodes-missing-pvalues-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-empty-optional-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-empty-optional-02.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-filter-missing-parens.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-lone-list.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-bad-lone-node.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-blabel-cross-filter.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-blabel-cross-graph-bad.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-blabel-cross-optional-bad.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql3/syn-blabel-cross-union-bad.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/manifest.ttl, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-09.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-10.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-11.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-34.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-35.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-36.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-37.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-38.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-GRAPH-breaks-BGP.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-OPT-breaks-BGP.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-bad-UNION-breaks-BGP.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql4/syn-leading-digits-in-prefixed-names.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql5/manifest.ttl, tests/sparql/test-suite-archive/data-r2/syntax-sparql5/syntax-reduced-01.rq, tests/sparql/test-suite-archive/data-r2/syntax-sparql5/syntax-reduced-02.rq, tests/sparql/test-suite-archive/data-r2/triple-match/data-01.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/data-02.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/data-03.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/dawg-data-01.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/dawg-tp-01.rq, tests/sparql/test-suite-archive/data-r2/triple-match/dawg-tp-02.rq, tests/sparql/test-suite-archive/data-r2/triple-match/dawg-tp-03.rq, tests/sparql/test-suite-archive/data-r2/triple-match/dawg-tp-04.rq, tests/sparql/test-suite-archive/data-r2/triple-match/dawg-tp-05.rq, tests/sparql/test-suite-archive/data-r2/triple-match/manifest.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/result-tp-01.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/result-tp-02.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/result-tp-03.ttl, tests/sparql/test-suite-archive/data-r2/triple-match/result-tp-04.ttl, tests/sparql/test-suite-archive/data-r2/type-promotion/false.ttl, tests/sparql/test-suite-archive/data-r2/type-promotion/manifest.ttl, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-byte-short-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-byte-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-decimal-decimal.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-double-decimal-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-double-decimal.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-double-double.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-double-float-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-double-float.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-float-decimal-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-float-decimal.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-float-float.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-int-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-integer-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-long-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-negativeInteger-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-nonNegativeInteger-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-nonPositiveInteger-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-positiveInteger-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-byte-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-decimal.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-double.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-float.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-int-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-long-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-short-fail.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-short-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-unsignedByte-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-unsignedInt-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-unsignedLong-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP-unsignedShort-short.rq, tests/sparql/test-suite-archive/data-r2/type-promotion/tP.ttl, tests/sparql/test-suite-archive/data-r2/type-promotion/true.ttl Add DAWG approved testsuites from http://www.w3.org/2001/sw/DataAccess/tests/r2 Revision 1.6 1008 contained in URL: http://www.w3.org/2001/sw/DataAccess/tests/data-r2.tar.gz Content-Length: 120802 Last-Modified: Wed, 09 Jan 2008 21:25:02 GMT MD5 c5be294e5a1b6d4448a79b3187fbf0c1 SHA1 b6120fe932a15e97b146d5c5c2bc411418311a04 * tests/sparql/dawg: remove unapproved DAWG testcases 2009-09-29 Dave Beckett * src/rasqal_rowsource_distinct.c: (rasqal_distinct_rowsource_read_row): Do not rasqal_free_row - rasqal_engine_rowsort_map_add_row will do that. * src/rasqal_rowsource_distinct.c: (rasqal_distinct_rowsource_read_row): add ref to row which is shared with distinct rowsort_map. * src/rasqal_rowsource_distinct.c: remove unused var query * src/rasqal_triples_source.c: (rasqal_triples_match_bind_match): return RASQAL_TRIPLE_SPO for exact. * src/rasqal_rowsource_distinct.c: (rasqal_distinct_rowsource_read_row): Do not need to copy values with distinct row, just mark as made here, fix offset and end * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_get_next_row): Continue searching if bind match returns no parts - like QE1 * src/rasqal_algebra.c: (rasqal_algebra_query_to_algebra): Set up variables sequence to free variables copied over. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_get_next_row): Comment out checking all triple patterns finished code triggered by the set_preserve flag. This makes 2 more tests pass: survey/survey-2 examples/sparql-query-example-Testing-Values-isBlank * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_init): allow joining an empty left row to not be failure - it's a finished rowsource. * src/rasqal_rowsource_triples.c: (rasqal_new_triples_rowsource): Handle NULL triples to return an empty rowsource. This is SPARQL {}. * docs/rasqal-docs.xml, docs/rasqal-sections.txt: Remove algebra section and rasqal_algebra_node def * src/rasqal.h, src/rasqal_internal.h: Move rasqal_algebra_node from public API - just typedef. * docs/Makefile.am: Add rasqal_internal.h to IGNORE_CFILES to stop gtkdoc-mkdb referencing it even though it is already in IGNORE_HFILES too. * src/rasqal_internal.h: rasqal_engine_error autodocs * docs/rasqal-docs.xml, docs/rasqal-sections.txt, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-triple.sgml, docs/tmpl/section-unused.sgml: sgml templates and docbook xml fixes * docs/rasqal-docs.xml: update docbook xml * src/rasqal_expr.c: (rasqal_expression_evaluate_v2): autodocs - no query param * src/rasqal_general.c: (rasqal_world_open): autodocs * src/rasqal_expr.c: (rasqal_expression_evaluate, rasqal_expression_evaluate_v2): autodocs * src/rasqal.h: rasqal_triple_parts: Added RASQAL_TRIPLE_NONE to autodocs 2009-09-29 Lauri Aalto * src/rasqal.h, src/rasqal_internal.h, src/rasqal_triples_source.c: Fixed int-enum conflict warning. (rasqal_triple_parts): Added RASQAL_TRIPLE_NONE to enum. (rasqal_triples_match_bind_match): Changed prototype to return rasqal_triple_parts enum instead of int. 2009-09-28 Dave Beckett * tests/improve: more tweaks * tests/improve: nl * tests/improve: Print error log summaries of failed tests when verbose or recursive. Tweak other messages/indenting. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_get_next_row): More logic tidying. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_get_next_row): Tidy code - remove goto and make control flow clearer. 2009-09-27 Dave Beckett * src/rasqal_rowsource_triples.c: whitespace indenting Remove unused var m->executed * src/rasqal_engine.c: whitespace indenting Remove unused var m->executed * src/rasqal.h, src/rasqal_engine.c, src/rasqal_rowsource_triples.c: rasqal_triple_meta is_exact and executed fields are now unused. (rasqal_triples_rowsource_init): Remove init of unused m->is_exact. (rasqal_triples_rowsource_get_next_row): Remove use of rasqal_triples_source_triple_present and m->is_exact. (rasqal_engine_graph_pattern_init): Remove init of m->is_exact. * src/rasqal.h, src/rasqal_engine.c, src/rasqal_triples_source.c: Move extra triples matching into the rasqal_triples_source module and out of the query engines. Code style cleanup. rasqal_triples_match gains is_exact and finished fields. (rasqal_free_triples_match, rasqal_new_triples_match, rasqal_triples_match_bind_match, rasqal_triples_match_next_match, rasqal_triples_match_is_end): set and use is_exact field. * src/rasqal_engine.c, src/rasqal_rowsource_triples.c: Demote failure of triple pattern match to init to an internal error but still fail execution on both query engines: (rasqal_engine_triple_graph_pattern_get_next_match): QE1 (rasqal_triples_rowsource_get_next_row): QE2 * src/rasqal.h: rasqal_triple_meta autodocs * src/rasqal_engine.c: Removed a couple of check for m == NULL that will never happen. * tests/improve: Provide total test summary when running recursive * src/rasqal_rowsource_triples.c: cosmetic code * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_get_next_row): Removed check for m == NULL that will never happen. * src/rasqal_engine.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_rowsource_triples.c: Terminology change: variables declared in (...declared_in in fields and functions) becomes bound in (...bound_in) to more clearly reflect that this is where a variable is set to a value. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_init): Removed check for m == NULL that will never happen. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_rowsource_triples.c: (rasqal_engine_error_as_string): Added to print out engine errors as label not int * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_get_next_row): when checking for end of triples, use <= not < * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_read_row): Let left join work when right row ends early. * src/rasqal_rowsource_graph.c: graph variable is not optional to this rowsource - remove if() conditions. * src/rasqal_rowsource_graph.c: Fix projection of variables - adding graph variable value to output row. (rasqal_graph_rowsource_read_row): Make a new row with graph variable literal value at position #0 * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_ensure_variables): Add graph variable to rowsource earlier. * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_init, rasqal_graph_rowsource_reset): set dg_offset to -1 to start/reset. * src/rasqal_query_transform.c: (rasqal_query_graph_build_mentioned_in_internal): Add switch for other GP types and call new function below for GRAPH graph patterns. (rasqal_query_graph_build_mentioned_in_internal): Added * src/rasqal_rowsource_triples.c: (main): Update call to rasqal_new_triples_rowsource to pass size. 2009-09-26 Dave Beckett * src/rasqal_rowsource_graph.c: (rasqal_graph_rowsource_read_row): Return result rows * src/rasqal_rowsource_triples.c: rasqal_triples_rowsource_context gains origin field to store current GRAPH origin that is pushed down to all inner triple patterns. (rasqal_triples_rowsource_init): Ignore parts ORIGIN since binding that variable is done outside this rowsource. (rasqal_triples_rowsource_finish): Free origin if set. (rasqal_triples_rowsource_set_origin): Added to iterate over triple patterns and set the origin field directly. * src/rasqal_rowsource_graph.c: (rasqal_graph_next_dg): If a variable was given (i.e. GRAPH ?var), set it's value as the datagraph URI. (rasqal_graph_rowsource_init): Add the graph var to the rowsource's variable table. (rasqal_graph_rowsource_finish): Free any variable value on finish. * src/rasqal_rowsource_graph.c: (rasqal_graph_next_dg): Always increment offset to advance through data graph list rather than spin. (rasqal_graph_rowsource_init): Init offset to -1 so above function will set it to offset 0 for first graph. * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_triples.c: rasqal_triples_rowsource_context gains field to store declared_in size (rasqal_new_triples_rowsource): Add size of declared_in array rather than recalculate it again later, possibly wrongly. store it in new field. (rasqal_triples_rowsource_init): Use above to check the right number of variables for declared_in-ness. (rasqal_algebra_basic_algebra_node_to_rowsource): Calculate declared_in for all variables, not just named ones. 2009-09-25 Dave Beckett * src/rasqal_query_transform.c: autodocs 2009-09-25 Lauri Aalto * src/rasqal_rowsource_triples.c: (main): Fixed double free of declared_in 2009-09-24 Dave Beckett * src/rasqal_rowsource_triples.c: (rasqal_new_triples_rowsource): Free passed in declared_in on failure, not con->declared_in which isn't initialised yet. 2009-09-23 Dave Beckett * tests/engine/rasqal_triples_test.c: note where example came from. * src/rasqal_raptor.c: remove noisy debug message * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_rowsource_triples.c: (rasqal_engine_get_parts_string): Added. Turns parts into a debug string. Use in rowsource triples and original engine * data/Makefile.am, data/triples.ttl, tests/engine/Makefile.am, tests/engine/rasqal_triples_test.c: Add triple patterns matching test * src/rasqal_engine_algebra.c: (rasqal_algebra_basic_algebra_node_to_rowsource): Note declared_in becomes owned by rowsource. * src/rasqal_rowsource_triples.c: (rasqal_new_triples_rowsource): Note declared_in becomes owned in internal docs. (rasqal_triples_rowsource_finish): Free declared_in. * src/rasqal_rowsource_join.c: (rasqal_new_join_rowsource): Make a reference to (copy) the passed-in expression. * src/rasqal_rowsource_filter.c: (rasqal_new_filter_rowsource, rasqal_filter_rowsource_finish): Make a reference to (copY) and free the passed-in expression. * docs/tmpl/section-expression.sgml: Update docs 2009-09-02 Dave Beckett * tests/laqrs/syntax/Makefile.am: Convert tests to use improve * src/rasqal_expr.c: rasqal_op_labels: add new labels for sum, avg, min and max. * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/avg1.rq, tests/laqrs/syntax/max1.rq, tests/laqrs/syntax/min1.rq, tests/laqrs/syntax/sum1.rq: Add basic syntax tests for AVG, MAX, MIN and SUM for LAQRS * src/rasqal.h, src/rasqal_expr.c, src/rasqal_query.c, src/sparql_lexer.l, src/sparql_parser.y: Add SUM, AVG, MIN and MAX aggregate expressions to LAQRS. (SumAggregateExpression, AvgAggregateExpression, MinAggregateExpression, MaxAggregateExpression): Added new tokens. (AggregateExpression): Updated to use above. rasqal_op gains RASQAL_EXPR_SUM, RASQAL_EXPR_AVG, RASQAL_EXPR_MIN and RASQAL_EXPR_MAX. rasqal_sparql_op_labels gains labels for the new expressions. (rasqal_query_write_sparql_expression): Write new expressions. * src/sparql_lexer.l: (sparql_copy_string_token): Allow \' and \" in all string literals, whatever the delimeter. * src/sparql_lexer.l: (sparql_copy_string_token): Support \b and \f escapes - which were always in SPARQL * src/rasqal_query.c: (rasqal_query_add_prefix): Handle adding/updating with the default namespace - NULL prefix string * src/rasqal_query.c: (rasqal_query_get_variable): Fix count check 2009-08-30 Dave Beckett * src/rasqal_triples_source.c: (rasqal_set_triples_source_factory): Call rasqal_world_open to ensure default world setup is done. Add comment to note this is for helping the older V1 ABI calls to work. * src/rasqal_general.c: (rasqal_world_open): Test and set opened flag to prevent recursive calls to this function. It now acts as an 'attempt open' flag, and tries init once only max. Adjust comments to later calls to rasqal_world_open to reflect that they are for helping the older V1 ABI calls to work. 2009-08-25 Dave Beckett * autogen.sh: Update common autogen.sh * configure.ac: Add -W to CPPFLAGS not CFLAGS, so they are not used in link lines 2009-08-21 Lauri Aalto * src/rasqal_query_transform.c: (rasqal_query_build_mentioned_in): Removed compiler warning when RASQAL_DEBUG is not defined 2009-08-20 Dave Beckett * tests/improve: Add recursive option -r/--recursive and summary for all testsuites in one dir. 2009-08-18 Dave Beckett * src/rasqal_internal.h: autodocs * tests/improve: Show unexpected passes in output as warnings, not failure * src/rasqal_internal.h, src/rasqal_query_transform.c: (rasqal_query_triples_build_mentioned_in): Added width param to parallel rasqal_query_triples_build_declared_in call. * src/rasqal_internal.h, src/rasqal_query_transform.c: (rasqal_query_triples_build_mentioned_in_internal): Added with main building work. (rasqal_query_triples_build_mentioned_in): Returns a new 1D array using above. * src/rasqal_query_transform.c: * * src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c: Construct a 2D array to mark variables mentioned in GP (rasqal_query_triples_build_mentioned_in, rasqal_query_graph_pattern_build_mentioned_in, rasqal_query_triples_build_mentioned_in): Added. (rasqal_free_query): Free any table. (rasqal_query_prepare_common): Call rasqal_query_triples_build_mentioned_in when GP transformations are done. * src/rasqal_internal.h, src/rasqal_row_compatible.c: (rasqal_print_row_compatible): Make internal not static * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_init): Dump rc map when debugging. 2009-08-17 Dave Beckett * src/rasqal_rowsource_join.c: Use rasqal_row_compatible to compute row compatibility. (rasqal_join_rowsource_init, rasqal_join_rowsource_finish): Init/free the compatible row map. (rasqal_join_rowsource_read_row): Simplify control flow in getting rows. Check row compatibility always for all joins. For left joins, allow rows from left if condition or compatibility fails. (main): Alter test data so rows can be joined (!) and add left join and natural join tests. * src/rasqal_feature.c, src/rasqal_general.c, src/rasqal_query.c: (rasqal_get_query_language_factory, rasqal_features_enumerate_common, rasqal_feature_from_uri, rasqal_languages_enumerate, rasqal_new_query): Call rasqal_world_open to ensure world is opened and items registered, to help older code that may not yet call this function. * tests/sparql/check-sparql: Call roqet -v which works if getopt long is not available. * tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am: preconditon to precondition * tests/rdql/testsuite/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am: Add roqet.tmp to CLEANFILES * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_join.c: Rename RASQAL_JOIN_TYPE_CROSS to RASQAL_JOIN_TYPE_NATURAL. Again. Add description of join types * src/rasqal_rowsource_join.c: (rasqal_new_join_rowsource): Allow RASQAL_JOIN_TYPE_CROSS * src/rasqal_engine_algebra.c, src/rasqal_internal.h: Added RASQAL_JOIN_TYPE_CROSS for sparql algebra Join() (rasqal_algebra_join_algebra_node_to_rowsource): Added to use RASQAL_JOIN_TYPE_CROSS with rasqal_new_join_rowsource. (rasqal_algebra_node_to_rowsource): Call rasqal_algebra_join_algebra_node_to_rowsource for Join(). * src/rasqal_row_compatible.c: (main): Free row compatible map * src/rasqal_row_compatible.c: (main): test cases work * src/rasqal_row.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_union.c: (rasqal_new_row_sequence): Make it terminate on an entire row of NULLs. Update all test data to this format. * src/rasqal_row.c: (rasqal_new_row_sequence): Allow declaring variables with no value, except as first on a row. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_row_compatible.c: Added rasqal_row_compatible object for checking if two query result rows from two rowsources are compatible. The object does the preparation work so that the individual row checks are quicker. (rasqal_new_row_compatible, rasqal_free_row_compatible): Added constructor and destructor. (rasqal_row_compatible_check): Run compatibility check on two rows from the given rowsources. (main): start of test 2009-08-13 Lauri Aalto * src/rasqal_engine_algebra.c: (rasqal_algebra_leftjoin_algebra_node_to_rowsource): Use enum value RASQAL_JOIN_TYPE_LEFT instead of int constant 0 (which maps to RASQAL_JOIN_TYPE_UNKNOWN). * src/rasqal_engine.c, src/rasqal_rowsource_distinct.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_sparql_xml.c: Fixed compiler warnings about implicitly initialized rasqal_rowsource_handler members. Fixed compiler warnings about empty if blocks when RASQAL_DEBUG is not defined. 2009-08-12 Dave Beckett * src/rasqal_rowsource_join.c: Natural to left join * src/rasqal_internal.h, src/rasqal_rowsource_join.c: Remove NATURAL join again - it's not correctly name, doesn't work and isn't needed yet. * src/rasqal_internal.h, src/rasqal_rowsource_join.c: Add RASQAL_JOIN_TYPE_NATURAL - the current implementation. (rasqal_new_join_rowsource): Accept both. * src/rasqal_internal.h, src/rasqal_rowsource_join.c: Add enum rasqal_join_type and use it instead of magic ints. (rasqal_new_join_rowsource): Update to use rasqal_join_type. 2009-08-11 Dave Beckett * src/rasqal_rowsource_filter.c: (rasqal_filter_rowsource_read_row): Construct result variables in correct order according to row variables order not variables table order. * src/rasqal_rowsource.c: debug messages * tests/algebra/check-algebra: use srcdir for getting expected path * tests/algebra/Makefile.am: use srcdir for test * tests/algebra/Makefile.am, tests/algebra/check-algebra: Convert to improve format and use new perl test runner check-algebra to do the checking 2009-08-10 Dave Beckett * tests/sparql/Expr2/Makefile.am: Remove duplicate tests in pass & xfail lists * tests/sparql/regex/Makefile.am: run all tests via improve 2009-08-05 Dave Beckett * tests/sparql/sort/Makefile.am: sort-3 passes - now all sort tests pass * tests/sparql/SyntaxFull/Makefile.am: negative tests do not apply to lexer * tests/sparql/bound/Makefile.am: dawg-bound-query-001 passes * tests/sparql/examples/Makefile.am: These tests now pass in QE1: sparql-query-example-Testing-Values-bound (ex11.2.3.2_0.rq) sparql-query-example-Testing-Values-bound-2 (ex11.2.3.2_1.rq) * tests/improve: annotate xfail * tests/sparql/ValueTesting/Makefile.am: Move all tests to improve testsuites * tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am: Move all tests to improve testsuites * tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am: Move all tests to improve testsuites * tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am: Move all tests to improve testsuites * tests/sparql/ExprEquals/Makefile.am: Move all tests to improve testsuites * tests/sparql/ExprBuiltins/Makefile.am: Move all tests to improve testsuites * tests/improve: Use a log file name that has no non-word chars * tests/sparql/Expr2/Makefile.am: Switch to improve for testsuite. All check-sparql testsuite tests are failing for some reason in how check-sparql is invoked that I can't quite figure out why at present. 2009-08-05 Lauri Aalto * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): Fixed raptor v2 experimental support. Conditional reformatting. 2009-08-04 Dave Beckett * tests/improve: (decode_literal): Added to handle test names with "s in them * tests/sparql/Expr1/Makefile.am: Switch to improve for testsuite * tests/rdql/testsuite/Makefile.am: Add CLEANFILES for check-rdql outputs * tests/sparql/SyntaxFull/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am: Add CLEANFILES for check-sparql outputs * tests/sparql/Expr1/Makefile.am: "OPTIONAL - Outer FILTER with BOUND" now passes with QE1 * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): Make parser base URI (name_uri) a copy of source uri if name_uri is NULL. * tests/sparql/SyntaxFull/Makefile.am: improve tests working * tests/sparql/SyntaxFull/Makefile.am: test with improve * tests/improve: error reports from preparing and get_plan Add debugging for all run of system $cmd * tests/sparql/syntax/Makefile.am: Use improve to run all testsuites * tests/sparql/survey/Makefile.am: Use improve to run all testsuites - with 1 test expected to fail on QE1. * tests/sparql/survey/Makefile.am: survey-2 now works with QE1 * src/rasqal_engine.c: (rasqal_engine_remove_optional_bgp_graph_patterns): Added to replace OPTIONAL { BGP { triples } } with OPTIONAL { triples } (rasqal_query_engine_1_execute_transform_hack): Add a do-while loop that keeps going until no more modifications happen. Invoke rasqal_engine_remove_optional_bgp_graph_patterns. 2009-08-03 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_get_next_result): Reword confusing query ending message. * tests/sparql/bound/Makefile.am: Use improve to run all testsuites - with 1 test, expected to fail on QE1/QE2 * tests/sparql/examples/Makefile.am: Use improve to run all testsuites - with 3 expected failures on QE1 (and a different set of 3 on QE2 at present) * tests/improve: more indenting * tests/improve: print testsuite name in output * tests/sparql/simple/Makefile.am: (get-testsuite-sparql-query): Use test names - tests pass again. * tests/sparql/part1/Makefile.am: Use improve to run all testsuites * tests/sparql/simple/Makefile.am: Use improve to run all testsuites * tests/improve: try to reduce make output crap * tests/sparql/part1/Makefile.am: Use test names not file names for dawg-style tests. * tests/improve: indenting * tests/sparql/check-sparql: Fail if test given does not exist. * tests/sparql/check-sparql: 2009 * tests/sparql/part1/Makefile.am: Add improve testsuites * tests/improve: default DIR to . * src/rasqal_query_results.c: (rasqal_query_results_execute_with_engine): After execute init, debug dump query * tests/sparql/simple/Makefile.am: set t:precondition for check-sparql * tests/sparql/simple/Makefile.am: Add improve testsuites * tests/rdql/testsuite/Makefile.am: invoke check-rdql via $(PERL) * tests/rdql/testsuite/Makefile.am: run all improve testsuites * tests/rdql/Makefile.am: run all improve testsuites * tests/engine/Makefile.am: run all improve testsuites * tests/engine/Makefile.am: run improve in . * tests/engine/Makefile.am: Use improve to run tests. * tests/Makefile.am: Add improve to dist * src/rasqal_engine.c: (rasqal_query_engine_1_set_origin_triples): Free original origin from GP. (rasqal_engine_remove_graph_bgp_graph_patterns): Ignore GPs with no origin. * src/rasqal_engine.c: (rasqal_query_engine_1_set_origin_triples): Handle setting NULL origin. * src/rasqal_engine.c: (rasqal_query_engine_1_set_origin_triples): Ensure that if a variable is moved to the origin, it is 'declared in' that triple so it gets correctly bound in execution. (rasqal_engine_remove_graph_bgp_graph_patterns): Remove top level query transform ban. Wrong. (rasqal_engine_remove_graph_bgp_graph_patterns): Make the GP type into BGP, call rasqal_query_engine_1_set_origin_triples with query and free/remove original GP origin now that the type is BGP. * tests/improve: indenting * tests/engine/Makefile.am: add testsuite 'engine' * tests/improve: fix xfail * tests/improve: indenting wrapping * src/rasqal_engine.c: (rasqal_engine_remove_graph_bgp_graph_patterns): Do no transform this at root of query GP tree, to keep QE1 happy * tests/improve: Add support for t:path for setting PATH for tests (run_test): Take testsuite arg. Notice SIGINT and abort testsuite if it happens. Adjust messages so PATH is included with cmd. Abort when no testsuites found * tests/rdql/testsuite/Makefile.am: add improve testsuite-generation rules * tests/rdql/Makefile.am: (check-rdql-lexer, check-rdql-parser): Use improve to run testsuites. * tests/improve: fix exit code * tests/improve: (run_testsuite): When superverbose, show fail log * tests/improve: (run_testsuite): Remove preparation code * tests/improve: (prepare_testsuite): Added so failure here can be passed on before running suite. (format_testsuite_result): Pass in output FH * tests/improve: (run_test): self is $test * tests/improve: (read_plan): Does not need dir param. * tests/improve: (format_testsuite_result): Added. * tests/rdql/Makefile.am: verb * tests/improve: Tidy. More OO-like Add -n/--dryrun Add skipped tests Added -v verbose Make plan file if not already there Add xfailed - expected failures - to summary (run_testsuite): Added 2009-08-02 Dave Beckett * tests/improve: improve - Run Rasqal test suites * tests/rdql/Makefile.am: Added get-testsuites-list rule and get-testsuite-rdql-lexer get-testsuite-rdql-parser rules to generate a Turtle/RDF description of the tests. * src/Makefile.am: comments on rdql/sparql_lexer/parser_test * configure.ac: Add AC_SUBST(ECHO) since it seems not to be happening by default. 2009-07-29 Dave Beckett * src/rasqal_skiplist.c: Remove obsolete skiplist code - never used. * src/Makefile.am, src/rasqal_query_test.c, src/rasqal_rowsource_triples.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Alter rdql/sparql lexer/parser tests to automatically run a test query from a file using envariables. Alter TEST_ENVIRONMENT to set those to run tests. Add the 4 tests to TESTS and remove the special case invoking * src/rdql_parser.y: (URI_LITERAL): Use raptor_uri_print instead of deprecated raptor_sequence_print_uri. * Remove ignores for files moved to build/ * Makefile.am, autogen.sh, build, build/shave-libtool.in, build/shave.in, build/shave.m4, configure.ac: Add SHAVE support for compiling and enable it for maintainer 2009-07-28 Dave Beckett * configure.ac, fix-groff-xhtml, rasqal-src-config.in, rasqal.rdf.in: 2009 and url fix 2009-07-24 Dave Beckett * src/rasqal_query.c: (rasqal_query_write_sparql_20060406): Ouput DESCRIBE does not need to write commas * src/rasqal_query.c: (rasqal_query_write_sparql_20060406): Make DESCRIBE write comma-separated list of rasqal_literal, not space-separated list of variables. * src/rasqal.h, src/rasqal_query.c: (rasqal_query_get_describe_sequence): Added 2009-07-19 Dave Beckett * src/Makefile.am, src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_distinct.c: Implement RASQAL_ALGEBRA_OPERATOR_DISTINCT (rasqal_new_distinct_algebra_node): Added to make a distinct algebra node. (rasqal_new_distinct_rowsource): Added to implement distinct rowsource - in new file rasqal_rowsource_distinct.c (rasqal_algebra_node_to_rowsource): Call above function when RASQAL_ALGEBRA_OPERATOR_DISTINCT is given to make a distinct rowsource from the algebra node. * src/rasqal_engine_sort.c: (rasqal_engine_rowsort_row_compare): Only do the row-literals compare if there is an order_conditions_sequence. * src/Makefile.am, src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_distinct.c: Implement RASQAL_ALGEBRA_OPERATOR_DISTINCT (rasqal_new_distinct_algebra_node): Added to make a distinct algebra node. (rasqal_new_distinct_rowsource): Added to implement distinct rowsource - in new file rasqal_rowsource_distinct.c (rasqal_algebra_node_to_rowsource): Call above function when RASQAL_ALGEBRA_OPERATOR_DISTINCT is given to make a distinct rowsource from the algebra node. * src/rasqal_engine_sort.c: (rasqal_engine_rowsort_row_compare): Only do the row-literals compare if there is an order_conditions_sequence. 2009-07-17 Dave Beckett * src/rdql_parser.y, utils/roqet.c: Updates to use raptor_new_sequence_v2 not raptor_new_sequence_with_handler_context from 1.4.19 * COPYING, COPYING.LIB: Add specific versions of GPL (2) and LGPL (2.1) to source control 2009-07-15 Dave Beckett * configure.ac: Enable LAQRS in default build 2009-01-19 Lauri Aalto * src/rasqal_rowsource_graph.c: (rasqal_graph_next_dg): Fixed for raptor v2 * src/rasqal_engine_algebra.c: Replaced utf-8 in comment with ascii 2009-01-17 Dave Beckett * src/Makefile.am, src/rasqal_engine.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_graph.c: Added graph rowsource. (rasqal_new_graph_rowsource): Added. rasqal_rowsource_handler gains set_origin handler of type rasqal_rowsource_set_origin_func (rasqal_algebra_visitor_set_origin): Added. (rasqal_algebra_graph_algebra_node_to_rowsource): Added using rasqal_new_graph_rowsource. (rasqal_algebra_node_to_rowsource): Call rasqal_algebra_graph_algebra_node_to_rowsource for graph operator. (rasqal_query_engine_1_set_origin_triples): Added. (rasqal_engine_remove_graph_bgp_graph_patterns): Added. (rasqal_query_engine_1_execute_transform_hack): Call rasqal_engine_remove_graph_bgp_graph_patterns to remove graph operators for query engine #1. (rasqal_rowsource_visitor_set_origin): Added. (rasqal_rowsource_set_origin): Added using rasqal_rowsource_visitor_set_origin. rasqal-0.9.33/ChangeLog.50000644000175000017500000036745511040535054011750 000000000000002007-12-28 Dave Beckett * utils/srxread.c: init fh * utils/srxread.c: init before arg check * utils/srxread.c: Pass variable_names ownership * utils/srxread.c: use memset properly * src/rasqal_query.c: (rasqal_query_execute): Initialise variable_names using rasqal_query_results_set_variables. * src/rasqal_engine.c: (rasqal_engine_query_result_row_print): Renamed to public rasqal_query_result_row_print. * src/rasqal_query_results.c: (rasqal_free_query_results): Free variable_names (rasqal_query_results_set_variables): set variable_names. (rasqal_query_result_row_print): Added - renamed from rasqal_engine_query_result_row_print. * src/rasqal_internal.h: struct rasqal_query_results_s gains field variable_names. Added rasqal_query_result_row_print prototype * utils/Makefile.am: Remove srxread_CPPFLAGS * utils/srxread.c: Use 1.4.17 raptor API * configure.ac: Require raptor 1.4.17 for SAX2 API * configure.ac, RELEASE.html, NEWS.html, src/win32_rasqal_config.h: Bump version to 0.9.16 Update libtool version to 1:0:0 2007-12-09 Dave Beckett * utils/Makefile.am, utils/srxread.c: Added test SPARQL XML results reader. Incomplete * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c, utils/Makefile.am: (rasqal_new_query_result_row, rasqal_new_query_result_row_from_query_result_row, rasqal_free_query_result_row): Added based on previously engine-specific rasqal_engine_new_query_result_row, rasqal_engine_new_query_result_row_from_query_result_row and rasqal_engine_free_query_result_row. (rasqal_new_query_result_row): No longer does the rasqal_engine_query_result_row_update work, so that has to be called externally. (rasqal_engine_excute_next_lazy): Call rasqal_engine_query_result_row_update after rasqal_new_query_result_row. (rasqal_query_results_set_variables, (rasqal_query_results_set_order_conditions): Added. (rasqal_query_execute): Call rasqal_query_results_set_variables and rasqal_query_results_set_order_conditions. * src/rasqal_engine.c: Switch to non-lazy execution * src/rasqal_engine.c: Add RASQAL_ENGINE_EVAL_LAZY macro to enable/disable lazy evaluation. Existing code and default is enabled. (rasqal_engine_check_limit_offset): Limit to 1 result when query is an ASK. (rasqal_engine_new_query_result_row): Allow non-bindings, non-graph queries to enter here, when doing ASK for example. (rasqal_engine_execute_and_save): Allow map to be optional if need_map is not true. (rasqal_engine_execute_run): Use RASQAL_ENGINE_EVAL_LAZY to call lazy or save version of execution. 2007-11-29 Lauri Aalto * src/rasqal.h: Guard against double declaration of rasqal_query_results_formatter. 2007-11-26 Dave Beckett * autogen.sh: Update to handle OSX glibtoolize and optional ltdl 2007-11-19 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate) Fix memory leak in RASQAL_EXPR_LANG. * tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am: Revert r13225 - make check to pass with svn HEAD raptor * src/rasqal_query.c, src/rasqal_result_formats.c: Reapply r13173 reverted in r13199 - compile cleanly against svn HEAD raptor. 2007-11-17 Dave Beckett * Snapshotted rasqal_0_9_15 for 0.9.15 release (SVN 13232) * tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am: Revert test results to match builing with raptor 1.4.16 * src/rasqal_literal.c: (rasqal_new_decimal_literal): Fix after doc change * docs/rasqal-sections.txt, docs/tmpl/section-unused.sgml: docs * docs/tmpl/section-literal.sgml, docs/tmpl/section-unused.sgml, docs/tmpl/section-xsd.sgml: docs * src/rasqal_datetime.c: docs * src/rasqal_literal.c: docs * docs/rasqal-sections.txt: update new functions 2007-11-15 Dave Beckett * src/rasqal.h, src/rasqal_literal.c, src/sparql_lexer.l: Restore rasqal_new_decimal_literal back to APi signature from 0.9.14. Add rasqal_new_decimal_literal_from_decimal to build from a rasqal_xsd_decimal 2007-11-15 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_as_boolean, rasqal_expression_as_integer, rasqal_expression_compare) Removed unused functions - eliminates compiler warnings. 2007-11-14 Dave Beckett * src/rasqal_query.c, src/rasqal_result_formats.c: Revert r13173 for compiling against raptor 1.4.16 (or earlier) raptor_uri_handler 2007-11-14 Lauri Aalto * src/rasqal_datetime.c: Fix copyright notice - it's all this year. Add contributions notice. Move tests to main(). 2007-11-13 Lauri Aalto * src/rasqal_raptor.c: indent tabs -> spaces 2007-11-13 Dave Beckett * configure.ac: Require raptor 1.4.16 for uri compare factory method * src/rasqal_literal.c: (rasqal_literal_ebv): Handle decimal zero * src/rasqal.h: Added rasqal_xsd_decimal_is_zero prototype * src/rasqal_decimal.c: (rasqal_xsd_decimal_is_zero): Added. (rasqal_xsd_decimal_divide): Use rasqal_xsd_decimal_is_zero. * src/Makefile.am, src/rasqal_datetime.c (from /rasqal/trunk/src/rasqal_xsd_datatypes.c:13190), src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: Added rasqal_datetime.c for XSD dateTime code. Added rasqal_xsd_datetime_check() internal function for checking * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/insert.rq: Added insert.rq * docs/tmpl/section-expression.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-unused.sgml: docs updates * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-0 now passes * src/rasqal_raptor.c: (rasqal_raptor_bind_match): Use rasqal_literal_equals_flags with RASQAL_COMPARE_RDF to compare for equality. Also, this may be cheaper than using rsaqal_literal_compare. * src/rdql_parser.y: Set RDQL default compare_flags to RASQAL_COMPARE_URI * src/sparql_parser.y: add missing ; 2007-11-12 Dave Beckett * src/rasqal_engine.c: (rasqal_query_result_literal_sequence_compare): Call rasqal_literal_compare with RASQAL_COMPARE_URI * src/rasqal_literal.c: (rasqal_literal_compare): Use RASQAL_COMPARE_URI to allow comparison of URIs. It's not allowed via the < operator but is ok when using literal with SPARQL ORDER BY * src/rasqal.h: rasqal_compare_flags add RASQAL_COMPARE_URI * tests/sparql/check-sparql: Invoke roqet correctly with named graphs * Last known good revision 13179: 'make check' succeeds. * src/rasqal_literal.c: (rasqal_literal_equals_flags): For XQUERY style, try RDF term equality if numeric promotion fails. Add debug messages 2007-11-12 Lauri Aalto * src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: Pulled rasqal_xsd_datatype_info from rasqal_xsd_datatypes.c to rasqal_internal.h * src/rasqal_query.c, src/rasqal_result_formats.c: Make raptor_uri_handlers const. 2007-11-11 Dave Beckett * src/rasqal_expr.c: (rasqal_expression_evaluate): Revert: RASQAL_EXPR_NEQ return type errors again. * src/rasqal_internal.h: Update rasqal_literal_string_to_native prototype * src/rasqal_literal.c: (rasqal_literal_string_to_native): Add flags arg to use to pass on to rasqal_xsd_datatype_check. (rasqal_new_string_literal): Call rasqal_literal_string_to_native with flags=1 so that a literal with a bad lexical form is kept but never converted to native type. (rasqal_literal_expand_qname): Call rasqal_literal_string_to_native with flags=0 for original check. * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_NEQ type errors are not equal. 2007-11-07 Lauri Aalto * src/rasqal_general.c: (rasqal_uri_init) Check for oom. (rasqal_uri_finish) Do not leave dangling pointers. 2007-11-06 Lauri Aalto * src/rasqal_feature.c: fix eol style * src/rasqal.h: Allow RASQAL_API to be externally defined e.g. in a static config.h. Remove __SYMBIAN32__ case. * src/rasqal_internal.h: Allow flagging out writable static data in RASQAL_DEPRECATED macros with NO_STATIC_DATA. * src/rasqal_expr.c, src/rasqal_feature.c, src/rasqal_graph_pattern.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_xsd_datatypes.c: Remove writable static data. Make const arrays const. 2007-10-31 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate) Avoid division-by-zero exceptions in RASQAL_EXPR_REM. * src/rasqal_expr.c: (rasqal_expression_evaluate) Ensure NULL result and no leaks on error. * src/rasqal_expr.c: (rasqal_expression_evaluate) Do not leak literal args in DATATYPE expressions. 2007-10-30 Lauri Aalto * src/rasqal_graph_pattern.c, src/rasqal_query.c: Move rasqal_graph_pattern_* functions from rasqal_query.c to rasqal_graph_pattern.c * src/rdql_lexer.l: Lowmem leak fixes. Merged experimental lexer leak prevention code from sparql_lexer r12922. Flagged with LEXER_ALLOC_TRACKING, disabled by default. 2007-10-29 Dave Beckett * tests/sparql/ExprEquals/Makefile.am: "Equality - 2 var - test equals" now passes * tests/sparql/ExprBuiltins/Makefile.am: str-2 now passes * src/rasqal_literal.c: (rasqal_literal_get_rdf_term_type): Not static and use parent type to handle XSD numeric sub-types. * src/rasqal_internal.h: Add rasqal_literal_get_rdf_term_type * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_LANG and RASQAL_EXPR_DATATYPE: Handle only for RDF Term literals including INTEGER etc using rasqal_literal_get_rdf_term_type() RASQAL_EXPR_ISLITERAL: Use rasqal_literal_get_rdf_term_type() to check for literal type. 2007-10-29 Lauri Aalto * src/rasqal_literal.c: (rasqal_literal_set_typed_value) Don't need to copy literal string if no new string passed in. * src/rasqal_literal.c: (rasqal_new_typed_literal) Ensure type is set before calling rasqal_free_literal(). (rasqal_literal_set_typed_value) Do not free strings that are not owned. * src/rasqal_literal.c: (rasqal_literal_set_typed_value) Do not leak string * src/rasqal_literal.c: (rasqal_new_decimal_literal) Return NULL if rasqal_xsd_datatype_type_to_uri() fails. * src/rasqal_literal.c: (rasqal_literal_set_typed_value) Fix leaking datatype uris * src/rasqal_literal.c: (rasqal_new_decimal_literal) Make a copy of datatype uri. * src/rasqal_literal.c: (rasqal_new_typed_literal) Do not return stale pointers. 2007-10-28 Dave Beckett * tests/rdql/testsuite/check-rdql: Remove xsd:string mutation * src/rasqal_literal.c: (rasqal_literal_string_to_native): Remove removal of xsd:string datatype. (rasqal_literal_string_equals): Make "xx" and "xx"^^xsd:string compare equal here. * tests/sparql/ExprEquals/Makefile.am: "Equality 1-1 -- graph" and "Equality 1-2 -- graph" now fail * tests/sparql/ValueTesting/Makefile.am: extendedType-ne-fail extendedType-literal-ne now pass * src/rasqal_literal.c: (rasqal_literal_string_to_native): Turn "xx"^^xsd:string into "xx" (rasqal_literal_string_equals): Added, pulled out of rasqal_literal_equals_flags. (rasqal_literal_equals_flags): Update SPARQL checks - do promotions only for sparql. Give type error if have incompatible types. Mov RASQAL_LITERAL_PATTERN and RASQAL_LITERAL_QNAME into error case; these should never be compared. * src/rasqal_expr.c: (rasqal_expression_evaluate): Use rasqal_literal_equals_flags for RASQAL_EXPR_EQ and RASQAL_EXPR_NEQ. Implement RASQAL_EXPR_SAMETERM with rasqal_literal_equals_flags too. * src/rdql_lexer.l: Double constant preserves the string using rasqal_new_typed_literal * tests/rdql/testsuite/check-rdql: (toDebug): Turn "xx"^^xsd:string into "xx" Unidiffs * tests/rdql/testsuite/Makefile.am: Failing tests now 1-09 B-17 * src/rasqal_raptor.c: (rasqal_raptor_triple_match): Match RDF terms with rasqal_literal_equals_flags and RASQAL_COMPARE_RDF. 2007-10-28 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate) double var no longer needed after unary minus changes in r13091 2007-10-28 Dave Beckett * src/rasqal_engine.c: (rasqal_query_result_literal_sequence_compare): Revert: use query compare flags since that is based on the 'A < B' operator which is value comparison. * src/rasqal_engine.c: (rasqal_query_result_literal_sequence_compare): Compare as RDF Terms always. (rasqal_query_result_literal_sequence_equals): Equality as RDF Terms always. * src/rasqal_literal.c: (rasqal_literal_get_rdf_term_type): Added. (rasqal_literal_compare): Do not always promote - saves copying objects. Add RASQAL_COMPARE_RDF to compare as RDF terms. (rasqal_literal_equals_flags): Add RASQAL_COMPARE_RDF to check for equality as RDF terms. Uses rasqal_literal_get_rdf_term_type() Add a quick check for string compares - not equal if lengths are different. * src/rasqal.h: Added rasqal_compare_flags enum RASQAL_COMPARE_RDF for comparing as RDF terms. 2007-10-28 Lauri Aalto * tests/rdql/testsuite/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am: RDQL B-07 B-20 tests now pass. SPARQL str-1 test now passes. * src/rasqal_decimal.c: (rasqal_xsd_decimal_negate) Fix RASQAL_DECIMAL_GMP negation. 2007-10-27 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_as_node): Copy NUL when stringifying. * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Correct len * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Do not try to canonicalize DOUBLE values. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Set string len for dateTime (rasqal_literal_as_node): strncpy * src/sparql_lexer.l: Use rasqal_xsd_datatype_check to check for decimal and double syntax rather than scanf. * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): less debug output * Last known good revision 13092: 'make check' succeeds. * src/rasqal_literal.c: (rasqal_literal_negate): Init type * src/rasqal_expr.c: (rasqal_expression_evaluate): For RASQAL_EXPR_UMINUS use rasqal_literal_negate * src/rasqal_internal.h: Added rasqal_literal_negate prototype * src/rasqal_literal.c: (rasqal_literal_add, rasqal_literal_subtract, rasqal_literal_multiply, rasqal_literal_divide): Promote to get to decimals for evaluation. (rasqal_literal_negate): Added. * src/rasqal.h: Added rasqal_xsd_decimal_negate * src/rasqal_decimal.c: (rasqal_xsd_decimal_negate): Added * src/rasqal_literal.c: (rasqal_new_decimal_literal): Set literal type * src/rasqal_literal.c: (rasqal_literal_string_to_native): Do not call rasqal_free_literal here. * src/rasqal_literal.c: (rasqal_literal_add, rasqal_literal_subtract, rasqal_literal_multiply, rasqal_literal_divide): Do calculations as integer, double or decimal. * src/rasqal_literal.c: (rasqal_new_decimal_literal): Add decimal arg to construct a new decimal literal based on a string or XSD Decimal. * src/sparql_lexer.l: Update rasqal_new_decimal_literal call * src/rasqal.h: rasqal_new_decimal_literal takes string / decimal. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Allow string to be NULL to use existing literal string. (rasqal_literal_string_to_native): Use NULL above * src/rasqal_literal.c: Everwhere: only write to *error if error is not NULL. (rasqal_literal_set_typed_value): Free any existing string before overwriting. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Copy NULL * src/rasqal_literal.c: Fix casts * src/sparql_lexer.l: Use rasqal_new_typed_literal for integer. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Added, pulled out of rasqal_literal_string_to_native. (rasqal_new_typed_literal, rasqal_new_decimal_literal, rasqal_literal_string_to_native): Altered to use rasqal_literal_set_typed_value removing duplicate code for setting decimals. * src/rasqal.h: rasqal_new_typed_literal renamed from rasqal_new_integer_literal_from_string * src/rasqal_engine.c: (rasqal_query_result_literal_sequence_equals): Pass on any type errors as not equal. * src/rasqal_internal.h: rasqal_literal_equals_flags add error pointer arg. * src/rasqal_literal.c: (rasqal_literal_equals_flags): Add an error pointer arg. * docs/tmpl/section-xsd.sgml: XSD Decimals templaet * src/rasqal_decimal.c: Autodocs * docs/rasqal-sections.txt: Add new functions * docs/rasqal-docs.xml: Added section-xsd 2007-10-27 Lauri Aalto * src/rasqal_literal.c: (rasqal_new_integer_literal_from_string) Need to have literal usage and type set before calling rasqal_free_literal() on failure. 2007-10-27 Dave Beckett * src/sparql_lexer.l: Use rasqal_new_integer_literal_from_string for integer literal. Remove hex literals - they are not allowed in SPARQL. * src/rasqal.h, src/rasqal_literal.c: (rasqal_new_integer_literal_from_string): Added to preserve integer literal original lexical form. * src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_promote_numerics): Renamed from rasqal_literal_promote_calculate 2007-10-25 Lauri Aalto * src/rasqal_query.c: (rasqal_query_prepare_count_graph_patterns) Prevent a later lowmem crash caused by graph pattern count and graph pattern sequence getting out of sync. * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string) Better formatting with RASQAL_DECIMAL_NONE (main) Ignore rasqal_decimal_test failures with RASQAL_DECIMAL_NONE - insufficient precision with doubles. Test for <0, ==0 or >0 when testing rasqal_xsd_decimal_compare(), not exact value like -1. * src/rasqal_map.c: (rasqal_map_node_add_kv) Return error if rasqal_new_map_node() failed * src/rasqal_map.c: (rasqal_map_add_kv) Return error if rasqal_new_map_node() failed * src/rasqal_expr.c: (rasqal_expression_evaluate) Remove memset() overhead - init vars when actually needed. 2007-10-24 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evalate) Fix bug in RASQAL_EXPR_OR and refactor RASQAL_EXPR_{AND,OR}. * src/rasqal_expr.c: (rasqal_expression_evaluate_strmatch, rasqal_expression_evaluate) Init error vars to zero * src/rasqal_expr.c: (rasqal_expression_evaluate_strmatch) Pulled function from rasqal_expression_evaluate(). (rasqal_expression_evaluate) Reduce stack consumption of a recursive function by about 90% (depending on compiler and architecture) - do not allocate separate variables for each switch case and pack in unions variables that are not needed simultaneously. * src/rasqal_literal.c: (rasqal_literal_string_to_native) Lowmem leak fix: make sure decimal literal string is not leaked. * src/rasqal_literal.c: (rasqal_free_literal) Do not leak decimal literal datatype uris. 2007-10-23 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_print): Write URIs out properly escaped Unicode. 2007-10-23 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate) Check for alloc failures 2007-10-22 Lauri Aalto * src/rasqal_literal.c: (rasqal_new_literal_from_promotion) Fix rasqal_new_integer_literal() params. (rasqal_literal_rdql_promote_calculate) Fix lits array init. 2007-10-22 Dave Beckett * tests/sparql/check-sparql: fix curdir * tests/sparql/check-sparql: Remove curdir from debug outputs * docs/tmpl/section-triple.sgml: Added RASQAL_TRIPLE_GRAPH, RASQAL_TRIPLE_SPO and RASQAL_TRIPLE_SPOG * docs/tmpl/section-expression.sgml: Added RASQAL_EXPR_SAMETERM * src/rasqal_literal.c: (rasqal_literal_compare): Restore d assignment * src/rasqal_literal.c: Remove unused double_to_int * src/rasqal_literal.c: (rasqal_literal_rdql_promote_calculate): Pull out of rasqal_literal_compare (rasqal_literal_compare): Use above. * Last known good revision 13011: 'make check' succeeds. * src/rasqal_literal.c: (rasqal_literal_compare): Fix xquery compare ordering when types are different and cannot promote. * src/rasqal_literal.c: (rasqal_literal_compare): Fix float/double compare. * src/rasqal_literal.c: (rasqal_literal_compare): Fix float/double compare with fabs * src/rasqal_literal.c: (rasqal_literal_compare): Return type error if rasqal_new_literal_from_promotion fails * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): Handle rasqal_new_literal_from_promotion failing. * src/rasqal_literal.c: death in debug message * src/rasqal_literal.c: casts for warnings * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): Do not assume l->string is set. * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): Allow nop promotion * src/rasqal_literal.c: (rasqal_literal_compare): Fix error from string compare. * src/rasqal_literal.c: docs (rasqal_literal_compare): Fix uri compare. * src/rasqal_literal.c: (rasqal_literal_string_compare): Added, pulled out of rasqal_literal_compare. (rasqal_literal_compare): Call above. * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): Call rasqal_new_string_literal with copy of string which is an input parameter. * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): Added, pulled out of rasqal_literal_compare. (rasqal_literal_compare): Use above. * src/rasqal_literal.c: (rasqal_literal_equals_flags): Start to add XQuery/SPARQL promotions. * src/rasqal_literal.c: (rasqal_literal_equals_flags): Added * src/rasqal_engine.c: (rasqal_query_result_literal_sequence_equals): Added to compare two arrays of literal for equality (rasqal_engine_query_result_row_compare): Use rasqal_query_result_literal_sequence_equals when just doing distinct, no sorting. * src/rasqal_internal.h: Added rasqal_literal_equals_flags prototype 2007-10-21 Lauri Aalto * src/rasqal_decimal.c: Make rasqal_decimal.c compile with RASQAL_DECIMAL_NONE * src/rasqal_decimal.c: (rasqal_xsd_decimal_equals) Catch flagging error and prevent warning about uninitialized rc variable. 2007-10-21 Dave Beckett * src/rasqal_literal.c: Switch rasqal_literal with type RASQAL_LITERAL_DECIMAL from stored as a double stored as an rasqal_xsd_decimal. (rasqal_new_decimal_literal, rasqal_literal_string_to_native, rasqal_free_literal, rasqal_literal_as_integer, rasqal_literal_as_floating, rasqal_literal_equals): Use new fields for decimal. * src/rasqal_decimal.c: (rasqal_xsd_decimal_equals): Renamed from rasqal_xsd_decimal_equal * src/rasqal.h: rasqal_literal now stores decimals as rasqal_xsd_decimal. rasqal_xsd_decimal_equals renamed from rasqal_xsd_decimal_equal * Last known good revision 12976: 'make check' succeeds. * src/rasqal.h, src/rasqal_decimal.c, src/rasqal_internal.h: Move rasqal_xsd_decimal prototypes to rasqal.h and rename constructor/destructor to match convention * src/rasqal_decimal.c, src/rasqal_internal.h: Move rasqal_xsd_decimal prototypes to rasqal_internal.h * src/rasqal_decimal.c: (main): Tests are silent on success * src/rasqal_decimal.c: (rasqal_xsd_decimal_init): Set to 32 digits precision * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string): less strlen * src/rasqal_decimal.c: ; * src/rasqal_decimal.c: (rasqal_xsd_decimal_clear_string): All strings are rasqal alloced. (rasqal_xsd_decimal_as_string): Handle zero better. * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string): No longer format as ints, always generate -?X.YeZ * src/rasqal_decimal.c: Prevent 0.0e-1, make it 0.0e0 * src/rasqal_decimal.c: Ensure trailing zeroes are not all removed in MPFR cleanup. Clear result strings when computing. * src/rasqal_decimal.c: Catch malloc failures * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string): Adjust MPFR output to remove leading 0s and have 1 leading digit. Adjust GMP output to have 1 leading digit. (rasqal_xsd_decimal_print): Use string from rasqal_xsd_decimal_as_string. * src/rasqal_decimal.c: Flags made explicit. Annotate free() * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_counted_string): Added. * src/rasqal_decimal.c: Preserve original string as str. Fix output formatting better for GMP * src/rasqal_decimal.c: Added GMP * configure.ac: Added --with-decimal to choose mpfr, gmp, none Added --with-mpfr=DIR to set prefix for mpfr install. Added MPFR and GMP presence tests. Added decimal choice to summary * src/Makefile.am: Added rasqal_decimal.c to library * configure.ac: AC_MSG_RESULT * src/Makefile.am: Added rasqal_decimal_test * src/rasqal_decimal.c: Moved macros to ../configure.ac * configure.ac: Add checks and defines for MPFR and decimal * src/rasqal_decimal.c: XSD decimal via some external library 2007-10-18 Lauri Aalto * src/rasqal_engine.c: (rasqal_engine_query_result_row_update) Fix SPARQL sort-3 segfault: Evaluating order condition expression may return NULL. * src/rasqal_engine.c: (rasqal_engine_query_result_row_to_nodes, rasqal_engine_execute_run) Allow empty result sets - not an error. * src/rasqal_literal.c: (rasqal_literal_cast) Check for new_string alloc failure * src/rasqal_result_formats.c: (rasqal_query_results_write_xml_result4) Fix segfault when binding value literal is not a node type. * src/rasqal_engine.c: (rasqal_engine_query_result_row_to_nodes) Return an error if cannot convert a literal to node. Do not just leave a non-node literal row values. (rasqal_engine_execute_run) Check rasqal_engine_query_result_row_to_nodes() return value. * src/rasqal_engine.c: (rasqal_engine_query_result_row_update) Free literal returned by evaluation of order condition expressions. 2007-10-17 Lauri Aalto * src/rasqal_engine.c: (rasqal_free_gp_data) Remove unnecessary start_column check - the root cause for start_column<0 was fixed in r12884. * tests/sparql/ExprBuiltins/Makefile.am: Expect SPARQL ExprBuiltins str-1 to fail. * src/fix-flex: (fix-flex) Also remove generated yy_fatal_error() declaration to avoid warning about declared but non-defined static function. Fix line offset off-by-one by not including $ in printed match when patching lex_destroy(). Fix .h #line directives as well. * src/fix-flex: (fix-flex) Remove generated yy_fatal_error() definition to avoid warnings about unused function. * src/rdql_lexer.l, src/sparql_lexer.l: (sparql_lexer_fatal_error, rdql_lexer_fatal_error) Portability: avoid depending on varargs implementation internals. * src/sparql_lexer.l: (sparql_lexer) Replace out-of-memory yyterminate() calls with more informative SPARQL_LEXER_OOM macros. * src/rdql_lexer.l, src/sparql_lexer.l: (sparql_lexer_cleanup,rdql_lexer_cleanup) Does not have to be non-static. * src/fix-flex, src/rasqal_internal.h, src/rdql_lexer.l, src/sparql_lexer.l: (rasqal_query_s) Added lexer_user_data for storing re-entrant lexer internal data. (fix-flex) Replace calls to yy_fatal_error() with YY_FATAL_ERROR macro. Add alloc failure checks to generated ensure_stack(). Call custom cleanup() function in lex_destroy(). Removed prefixing free(ptr) with NULL guard - rasqal lexers now have yyfree replacements that check for NULL. Fix .c #line numbers. (sparql_lexer) Specify noyyalloc, noyyrealloc, noyyfree options to prevent flex from generating alloc/realloc/free functions. Define YY_FATAL_ERROR macro to sparql_lexer_fatal_error(). Added experimental low-memory memory leak prevention code under LEXER_ALLOC_TRACKING flag (disabled by default) - easier and probably more failsafe than patching large amounts of generated C in fix-flex. The leak itself is YY_BUFFER_STATE struct that is not freed when ensure_stack() encounters an OOM fatal error - previously ensure_stack() segfaulted but now fix-flex patches it to just leak memory. (sparql_lexer_fatal_error) Added replacement for default error handler. Uses rasqal query fatal error reporting mechanisms if possible. abort()s and does not exit() like the generated error handler would do. (sparql_lexer_cleanup) Added function that gets called by sparql_lexer_lexer_destroy() patched by fix-flex. Cleans up memory leaks (if any) when LEXER_ALLOC_TRACKING flag is enabled, otherwise a no-op. (sparql_lexer_alloc) Added allocator function as needed after the noyyalloc option. If LEXER_ALLOC_TRACKING flag is disabled, it's just the plain malloc(). Otherwise stores allocated pointer to an alloc tracker stored in lexer_user_data in rasqal_query_s to allow cleanup by sparql_lexer_cleanup(). (sparql_lexer_realloc) Added realloc function as needed after the noyyrealloc option. If LEXER_ALLOC_TRACKING flag is disabled, it's just the plain realloc(). Otherwise it uses the alloc tracker in lexer_user_data. (sparql_lexer_free) Added free function as needed after the noyyfree option. If LEXER_ALLOC_TRACKING flag is disabled, it's just the plain free() with NULL check. Otherwise it uses the alloc tracker in lexer_user_data. (rdql_lexer) Specify noyyalloc, noyyrealloc, noyyfree options to prevent flex from generating alloc/realloc/free functions. Define YY_FATAL_ERROR macro to rdql_lexer_fatal_error(). (rdql_lexer_fatal_error) Added replacement for default error handler. Uses rasqal query fatal error reporting mechanisms if possible. abort()s and does not exit() like the generated error handler would do. (rdql_lexer_cleanup) Added empty function that gets called by rdql_lexer_lex_destroy() patched by fix-flex. (rdql_lexer_alloc,rdql_lexer_realloc) Added functions as needed after noyyalloc and noyyrealloc options. (rdql_lexer_free) Added function as needed after noyyfree option. Checks for NULL ptr unlike the generated yyfree(). 2007-10-16 Lauri Aalto * src/fix-bison: (fix-bison) Fix .c #line references - was still off by one. * src/fix-bison: (fix-bison) Fix .c #line references. Fix script indent. * src/sparql_parser.y: (sparql_parse) Check lexer init return code. 2007-10-15 Dave Beckett * tests/rdql/testsuite/Makefile.am: Document B-07 B-20 as failing since core changes to normalize xsd:double format for SPARQL cause these to fail now 2007-10-15 Lauri Aalto * src/rasqal_literal.c: (rasqal_new_string_literal) Free datatype as uri and not as cstring on error. * src/rasqal_xsd_datatypes.c: (rasqal_xsd_datatype_uri_parent_type) fix comments * src/sparql_parser.y: Memory leak fix: add %destructor for Object * src/rasqal_engine.c: (rasqal_engine_convert_blank_node_to_anonymous_variable) Fix low memory crashes due to variable literals with NULL value. Changed function to return an int error code. (rasqal_engine_build_anonymous_variables) Bubble up errors from rasqal_engine_convert_blank_node_to_anonymous_variable(). (rasqal_engine_prepare) Bubble up errors from rasqal_engine_build_anonymous_variables(). * src/rasqal_xsd_datatypes.c: (rasqal_xsd_datetime_normalize) Fix bugs in day normalization: uninitialized var t in y2 expression; add the correct number of days when going down a month boundary (and not the number of days next month). (test_datetimes) Add tests to catch the bug. Was not caught before because January and December both have 31 days. (test_datetime_parser_tostring) Print relevant information to stderr on test failure. * src/rasqal_literal.c: (rasqal_literal_string_to_native) Remove unnecessary if 2007-10-15 Dave Beckett * src/rasqal_literal.c: docs 2007-10-14 Dave Beckett * src/rasqal_literal.c: (rasqal_new_double_literal): Use rasqal_xsd_format_double to format a double. (rasqal_literal_string_to_native): Use rasqal_xsd_format_double to format a new double. * src/rasqal_internal.h: Added rasqal_xsd_format_double prototype * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Added to properly format an xsd:double * src/sparql_lexer.l: Added SPARQL_NAME_CHECK_ALLOW_09_FIRST NCNAME2: Added allowing 0-9 (QNAME,BNAME,BNAME2): Use NCNAME2 instead of NCNAME to allow 0-9 first. (rasqal_sparql_name_check): Use SPARQL_NAME_CHECK_ALLOW_09_FIRST to allow 0-9 as the first character. * tests/sparql/ValueTesting/Makefile.am: typePromotion-decimal-decimal-fail passes again * src/rasqal_literal.c: (rasqal_literal_cast): Use rasqal_xsd_datatype_check() to check if a cast from string is allowed. * src/rasqal_xsd_datatypes.c: (rasqal_xsd_init, rasqal_xsd_finish): Do not try to init, free NULL names. * src/rasqal_expr.c: (rasqal_expression_evaluate): Moved RASQAL_EXPR_PLUS, RASQAL_EXPR_MINUS, RASQAL_EXPR_STAR and RASQAL_EXPR_SLASH evaluation to rasqal_literal_add, rasqal_literal_subtract, rasqal_literal_multiply, rasqal_literal_divide respectively. * src/rasqal_xsd_datatypes.c: table sparql_xsd_names now includes the types that promote to xsd:integer (rasqal_xsd_init): Init the URIs of the types above. (rasqal_xsd_datatype_uri_parent_type): Added to get the parent type of a datatype URI. (rasqal_xsd_datatype_is_numeric): Added to check if an XSD type is numeric. * src/rasqal_literal.c: (rasqal_new_integer_literal): Initialise parent_type to decimal. (rasqal_literal_string_to_native): Native integers have a decimal parent. (rasqal_new_string_literal): Initialise parent type. (rasqal_literal_promote_calculate): Added to calculate XSD type promotions. (rasqal_literal_is_numeric): Added to determine a numeric literal. (rasqal_literal_add, rasqal_literal_subtract, rasqal_literal_multiply, rasqal_literal_divide): Added based on the expression code for literals. * src/rasqal_internal.h: Added prototypes for rasqal_literal_is_numeric, rasqal_literal_promote_calculate, rasqal_literal_add, rasqal_literal_subtract, rasqal_literal_multiply, rasqal_literal_divide, rasqal_xsd_datatype_uri_parent_type and rasqal_xsd_datatype_is_numeric * src/rasqal.h: rasqal_literal_s gains field parent_type for XSD type hierarchy. * Last known good revision 12894: 'make check' succeeds. * tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/manifest.ttl, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-06.rq: Removed tests syntax-graph-02.rq syntax-graph-06.rq with GRAPH blank nodes which are no longer legal SPARQL * tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/manifest.ttl, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-04.rq: Removed tests syntax-bnodes-03.rq syntax-bnodes-04.rq with blank nodes in predicate which are no longer legal SPARQL * tests/sparql/ValueTesting/Makefile.am: Add typePromotion-decimal-decimal-fail to failures until type promotions are fixed. * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/construct0.rq: Removed construct0.rq test since CONSTRUCT * is no longer legal sparql * src/rasqal_literal.c: (rasqal_literal_compare): Use raptor_uri_compare from raptor 1.4.16 instead of strcmp. Protect checking rdf literal language and datatypes in a comparison to only happen when both literals were originally strings. * src/rasqal_raptor.c: (rasqal_raptor_triple_match): Debug messages (rasqal_raptor_triple_present): Set the match parts dependent of whether the triple has an origin. * src/rasqal_xsd_datatypes.c: (rasqal_xsd_datetime_to_string): Does not return a string that is required to be const. 2007-10-13 Dave Beckett * src/rasqal_xsd_datatypes.c: Code style - comments, whitespace, indenting. (rasqal_xsd_datetime_normalize): Added, pulled out of rasqal_xsd_datetime_parse_and_normalize 2007-10-12 Lauri Aalto * src/sparql_parser.y: (OrderConditionList) Fix memory leak when sequence creation fails. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c: Fix error where a sequence alloc error in rasqal_engine_join_graph_patterns() leaves gp in stale state. (rasqal_engine_move_constraints, rasqal_engine_join_graph_patterns) Changed to return an int error code. (rasqal_engine_merge_graph_patterns, rasqal_engine_merge_triples, rasqal_engine_remove_empty_group_graph_patterns) Set modified flag to negative to signal error codes. (rasqal_query_prepare) Do gp merge only if factory->prepare() succeeded. Use negative values of the modified flag to signal errors from gp visitors. * src/rasqal_engine.c: (rasqal_engine_graph_pattern_init) Bubble up errors from subgp init. * src/sparql_parser.y: Memory leak fixes: Add Filter %destructor. (AdditiveExpression) Free MultiplicativeExpression when rasqal_new_literal_expression() for a numeric literal fails. * src/rasqal_literal.c: (rasqal_new_integer_literal, rasqal_new_double_literal, rasqal_new_float_literal, rasqal_new_decimal_literal, rasqal_new_boolean_literal, rasqal_literal_as_node) Check rasqal_xsd_datatype_type_to_uri() return value. * src/rasqal_xsd_datatypes.c: (sparql_xsd_datatypes_table) Init static variable to NULL. (rasqal_xsd_init) Check for rasqal_xsd_namespace_uri alloc failure. (rasqal_xsd_finish) Set static pointers to NULL to prevent dangling pointers. (rasqal_xsd_datatype_uri_to_type, rasqal_xsd_datatype_type_to_uri, rasqal_xsd_datatype_check, rasqal_xsd_datatype_label) Check that sparql_xsd_datatypes_table is allocated. * src/rasqal_engine.c: (rasqal_new_engine_execution_data) Check raptor_sequence_set_at() return value. Fixes memory leak when setting (n+1)th item and setting nth item had failed. 2007-10-11 Lauri Aalto * src/rasqal_xsd_datatypes.c: Fix compiler warning * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-0 (ex11_0) was broken by recent changes in literal handling. * tests/sparql/examples/Makefile.am: makefile comments * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-RDFterm-equal-2 (ex11.2.3.1_1) now passes * src/rasqal_literal.c: (rasqal_literal_string_to_native) Promote xsd:dateTime literals to canonical literal form - strcmp() now works better when comparing datetime literals. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: (rasqal_xsd_datetime_string_to_canonical) Added library internal function for upgrading xsd:dateTime strings to canonical form. (rasqal_xsd_datetime_parse_and_normalize, rasqal_xsd_datetime_to_string) Added module internal functions for dealing with xsd:dateTime strings. (rasqal_xsd_check_dateTime_format) Use rasqal_xsd_datetime_parse_and_normalize() for format checking. (days_per_month) Added helper function for rasqal_xsd_datetime_parse_and_normalize(). (rasqal_xsd_datetime) Replaced struct with a version that can be used for normalization and does not use bitfields. Second fractions stored as string, not as double. (test_datetime_parser_tostring, test_datetimes, main) Added test code for xsd:dateTime handling. (Makefile.am): Moved rasqal_xsd_datatypes_test from local_tests to TESTS. 2007-10-10 Lauri Aalto * src/rasqal_raptor.c: (rasqal_raptor_triple_present, rasqal_raptor_triples_match_context) Fix compiler warnings about enum-int mismatches. 2007-10-09 Dave Beckett * tests/sparql/check-sparql: Invoke roqet with -D for data graphs (not named) * utils/roqet.c: Added -D/--data for data graphs and -G/--named for named graphs (-s is a synonym for this) * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): Use the named graph URI for the source literal to distinguish default and named graphs. (rasqal_raptor_triple_match): Add a parts field for the fields of the triple to match to distinguish a graph query with no binding from a non-graph query. Add checks for graph/non-graph query when finding an origin in a triple so that they match. (rasqal_raptor_init_triples_match): Init the parts being looked for depending on whether t->origin is present. * src/rasqal_engine.c: (rasqal_engine_execute_run): Allow rasqal_engine_excute_next_lazy to return finished on first execution, for an empty result set. * src/rasqal_query.c: (rasqal_query_execute): It is not a failure for rasqal_engine_execute_run to be immediately finished, it is just an empty results set. * src/rasqal.h: (enum rasqal_triple_parts): Added RASQAL_TRIPLE_GRAPH as alias for RASQAL_TRIPLE_ORIGIN, RASQAL_TRIPLE_SPO for triple parts and RASQAL_TRIPLE_SPOG for all parts including graph. * src/sparql_parser.y: (DefaultGraphClause): Set graph name to NULL for default graph. * src/rasqal_raptor.c: (rasqal_raptor_triple_match): If a named graph triple is present, do not match a triple pattern with nothing in the 'origin'. * tests/sparql/check-sparql: handle dt:graphData * tests/sparql/dawg/graph/data-g3-dup.ttl, tests/sparql/dawg/graph/manifest.ttl: Update to DAWG test suite graph dir 2007-10-09 * tests/sparql/dawg/dataset/data-g1-dup.ttl, tests/sparql/dawg/dataset/data-g2-dup.ttl, tests/sparql/dawg/dataset/data-g3-dup.ttl, tests/sparql/dawg/dataset/data-g4-dup.ttl, tests/sparql/dawg/dataset/dataset-09b.rq, tests/sparql/dawg/dataset/dataset-10b.rq, tests/sparql/dawg/dataset/dataset-12b.rq, tests/sparql/dawg/dataset/manifest.ttl: Update to DAWG test suite dataset dir 2007-10-09 * tests/sparql/check-sparql: Handle DAWG dawgt:approval dawgt:Withdrawn tests * src/rasqal_expr.c: (rasqal_expression_evaluate): Make RASQAL_EXPR_BOUND work again. 2007-10-08 Dave Beckett * src/sparql_parser.y: Added SAMETERM token for SPARQL keyword sameTerm() Added lexer tokens DOUBLE_POSITIVE_LITERAL, DOUBLE_NEGATIVE_LITERAL, INTEGER_POSITIVE_LITERAL, INTEGER_NEGATIVE_LITERAL, DECIMAL_POSITIVE_LITERAL, DECIMAL_NEGATIVE_LITERAL. Some token re-orderings and renumberings. (Query): Move dataset, wher, group, order and limit to elsewhere like sparql grammar. (Prolog, PRefixDeclOpt): Rename to PrefixDeclListOpt (SelectQuery, DescribeQuery, ConstructQuery, AskQuery): Add appropriate datasets, where, and solution modifier if allowed. (ConstructQuery): Remove CONSTRUCT * - no longer in the grammar. (DefaultGraphClause, NamedGraphClause): Use SourceSelector (SourceSelector, SolutionModifier): Added like SPARQL grammar. (LimitOffsetClausesOpt): Renamed from LimitOffsetOpt, like SPARQL grammar. (Filter): Added, like SPARQL grammar. (ObjectList): Uses a list of Object like SPARQL grammar (Object): Added, like SPARQL grammar. (Verb): Changed to be VarOrIRIref not VarOrBlankNodeOrIRIref like SPARQL grammar (VarOrBlankNodeOrIRIref): Removed, no longer used. (GraphTerm): Use NumericLiteral like SPARQL grammar. (AdditiveExpression): Use NumericLiteralPositive and NumericLiteralNegative to allow unary minus/plus to work. like SPARQL grammar. (BuiltInCall): Add SAMETERM. (NumericLiteral, NumericLiteralUnsigned, NumericLiteralPositive, NumericLiteralNegative): Added like SPARQL grammar * src/sparql_lexer.l: Added INTEGER macro Added SAMETERM SPARQL keyword Made INTEGER, DECIMAL and DOUBLE return either UNSIGNED_, POSITIVE_ or NEGATIVE_ tokens to help out the parser. * src/rasqal_query.c: (rasqal_query_write_sparql_expression_op): Added new RASQAL_EXPR_SAMETERM for SPARQL keyword sameTerm. * src/rasqal_expr.c: (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_evaluate, rasqal_expression_print, rasqal_expression_is_constant): Added new RASQAL_EXPR_SAMETERM for SPARQL keyword sameTerm(). Evaluation not implemented yet. * src/rasqal.h: Added new rasqal_op expression RASQAL_EXPR_SAMETERM for SPARQL keyword sameTerm() 2007-10-07 Dave Beckett * src/rasqal_xsd_datatypes.c: (main) Comment out all of old test code that's not used or usable. * configure.ac: Remove --enable-datatypes * src/rasqal_expr.c: (main): Needs more init for xsd module. * src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: Remove last uses of static rasqal_xsd_TYPE_uri uris * src/sparql_lexer.l: altered cast for change to rasqal_new_decimal_literal. * tests/sparql/check-sparql: Use config->{execute} and set to false for syntax test types * tests/sparql/check-sparql: revert: Debugging run_test for $debug>0 * tests/sparql/check-sparql: Debugging run_test for $debug>1 * tests/sparql/check-sparql: Debugging manifest for $debug>1 * src/rasqal.h: typedef rasqal_literal: note decimal inits value.floating * src/rasqal_literal.c: (rasqal_new_decimal_literal): Initialise the floating field. * src/rasqal.h: Move the FIRST XSD to include RASQAL_LITERAL_STRING aka xsd:string * src/rasqal_query.c: (rasqal_query_write_sparql_literal): Use rasqal_xsd_datatype_type_to_uri to get xsd:dateTime URI. * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_DATATYPE - ensure a plain literal with no datatype returns datatype xsd:string. * src/sparql_parser.y: (sparql_is_builtin_xsd_datatype): Removed. Use rasqal_xsd_is_datatype_uri instead * src/rasqal_literal.c, src/rasqal_xsd_datatypes.c: Move XSD functions to rasqal_xsd_datatypes.c * src/rasqal_internal.h: Added prototypes for rasqal_xsd_datatype_uri_to_type, rasqal_xsd_datatype_type_to_uri, rasqal_xsd_datatype_check, rasqal_xsd_datatype_label and rasqal_xsd_is_datatype_uri * src/rasqal_general.c: Move XSD uris init/free to rasqal_xsd_datatypes.c * src/Makefile.am: Add rasqal_xsd_datatypes.c to compilation * src/rasqal_internal.h: Added rasqal_new_numeric_literal * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_UMINUS, RASQAL_EXPR_PLUS, RASQAL_EXPR_MINUS, RASQAL_EXPR_STAR and RASQAL_EXPR_SLASH now use rasqal_new_numeric_literal. RASQAL_EXPR_LITERAL: Turn a literal into a literal value here, removing mention of variables. * src/rasqal_literal.c: (rasqal_new_float_literal): Added. (rasqal_new_decimal_literal) Now takes a const char* arg. (rasqal_new_numeric_literal): Added * src/rasqal.h: Added rasqal_new_float_literal rasqal_new_decimal_literal now takes a const char* * tests/sparql/check-sparql: debug query type * src/rasqal_expr.c: (rasqal_expression_evaluate): Print expression again when printing result. * src/rasqal_literal.c: (rasqal_literal_as_integer, rasqal_literal_as_floating): Convert decimal to integer, floating too. (rasqal_literal_compare): Decimal can be used as a double. (rasqal_literal_as_integer): Decimal can be turned into an an integer. (rasqal_literal_equals): Compare decimal as doubles. * src/rasqal_literal.c: (rasqal_literal_print): Debug message tweak * src/rasqal_engine.c: docs * src/rasqal_engine.c: (rasqal_engine_query_result_row_to_nodes): Added to turn internal literal types into just URI/blank/string literal RDF nodes. (rasqal_engine_execute_run): Call rasqal_engine_query_result_row_to_nodes for first result row. (rasqal_engine_execute_next): Call rasqal_engine_query_result_row_to_nodes for all new rows. * src/rasqal_engine.c: prototype * src/rasqal_engine.c: Moved rasqal_engine_excute_next_lazy * src/rasqal_engine.c: (rasqal_engine_get_result_row): Added (rasqal_engine_get_result_values): Uses rasqal_engine_get_result_row. (rasqal_engine_execute_next_from_saved): Added (rasqal_engine_execute_next): Use rasqal_engine_execute_next_from_saved. 2007-10-06 Dave Beckett * src/rasqal_engine.c: Code style * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c: Remove rasqal_query field binding_values as it is not needed * src/rasqal_engine.c: Docs (rasqal_engine_get_result_values): Renamed from rasqal_engine_get_results_values * src/rasqal_query_results.c: Renamed rasqal_engine_get_results_values to rasqal_engine_get_result_values * src/rasqal_internal.h: Renamed rasqal_engine_get_results_values to rasqal_engine_get_result_values * src/rasqal_engine.c: docs * src/rasqal_engine.c: Add a bunch of internal docs. (rasqal_engine_query_result_row_update): Do not throw away datatype information early. Do not throw it away for ordering. (rasqal_engine_excute_next_lazy): Renamed from rasqal_engine_query_results_update since it is only used in lazy evaluation. (rasqal_engine_execute_and_save): Added to pull out the code from rasqal_engine_execute_run that is run when results are wanted to be saved. (rasqal_engine_execute_run): Documentation of execution operation and change to use rasqal_engine_execute_and_save (rasqal_engine_execute_next): Docs and change to use rasqal_engine_excute_next_lazy. * src/rasqal.h: Added rasqal_literal_value. * src/rasqal_literal.c: (rasqal_new_literal_from_literal): Return NULL if NULL was given. (rasqal_literal_value): Added, to return a value and looking up variable literals. * tests/sparql/check-sparql: Order expected results using rs:index predicate if it's present. 2007-10-05 Lauri Aalto * src/sparql_parser.y: (PropertyListNotEmpty) Refactored to not use raptor_sequence_disown_at() * src/rasqal_literal.c: (sparql_xsd_datatypes_table) Fix compiler warning: cast int to enum. (rasqal_literal_cast) Return a copy of the literal when casting to same type. 2007-10-05 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_check_boolean_format): Note not strictly conforming. (rasqal_literal_check_dateTime_format): Add even more caveats. (rasqal_literal_check_decimal_format): Update to be conformant. (rasqal_literal_check_double_format): Note not strictly confirming. (rasqal_literal_check_float_format): Note not strictly confirming. (rasqal_literal_check_integer_format): Note is conformant. * src/rasqal_literal.c: Added start of format checking for XSD literal strings. This code should probably be moved into a separate module and connected to the other skeletal datatype code. (rasqal_literal_check_boolean_format, rasqal_literal_check_dateTime_format, rasqal_literal_check_decimal_format, rasqal_literal_check_double_format, rasqal_literal_check_float_format, rasqal_literal_check_integer_format): Added of which only boolean and integer are fully correct. (struct sparql_xsd_datatypes_table): Table added. (rasqal_xsd_init, rasqal_xsd_finish): Added to initialise table. (rasqal_literal_string_to_native): Use sparql_xsd_datatypes_table table to drive validation and to avoid URI comparisons. (rasqal_literal_cast): Do allowed type conversion checks and then pass on to rasqal_new_string_literal to test the allowed syntax. * src/rasqal_internal.h: Added rasqal_xsd_init and rasqal_xsd_finish. * src/rasqal_general.c: (rasqal_init, rasqal_finish): Init/free the XSD code with rasqal_xsd_init() and rasqal_xsd_finish(). 2007-10-04 Dave Beckett * src/rasqal_expr.c: unused var * src/rasqal_expr.c: (rasqal_expression_evaluate): Use rasqal_literal_cast for RASQAL_EXPR_CAST evaluation. * src/rasqal_internal.h: Added rasqal_literal_cast * src/rasqal_literal.c: (rasqal_literal_cast): Added for casting between literal types * src/rasqal.h: Added rasqal_literal_datatype * src/rasqal_literal.c: (rasqal_new_boolean_literal): Set boolean datatype. (rasqal_literal_datatype): Added to get a literal datatype URI if it has one. * tests/sparql/check-sparql: Allow choosing unique test by regex on the test URI since sometimes the name is not unique. * tests/sparql/check-sparql: Replace so-called XML::Simple with XML::DOM which is actually simpler, and even as a bonus, works. 2007-10-04 Lauri Aalto * src/sparql_parser.y: Check for alloc failures. Free allocated resources and YYERROR on failure. Added YYERROR_MSG macro to help with debugging. * src/sparql_lexer.l: lexer: yyterminate() on alloc failures. (sparql_copy_string_token) Check for alloc failures. * src/rasqal_expr.c: (rasqal_new_3op_expression) Do not free null arg3 on alloc error. 2007-10-03 Dave Beckett * tests/sparql/check-sparql: tweak output * tests/sparql/dawg/optional-filter/expr-4-result.ttl, tests/sparql/dawg/optional-filter/expr-4.rq, tests/sparql/dawg/optional-filter/expr-5-result-not-simplified.ttl, tests/sparql/dawg/optional-filter/expr-5-result-simplified.ttl, tests/sparql/dawg/optional-filter/expr-5.rq: new DAWG tests * tests/sparql/dawg/optional-filter/data-1.ttl, tests/sparql/dawg/optional-filter/expr-1-result.ttl, tests/sparql/dawg/optional-filter/expr-2-result.ttl, tests/sparql/dawg/optional-filter/expr-3-result.ttl, tests/sparql/dawg/optional-filter/manifest.ttl: updated DAWG tests * src/rasqal_raptor.c: (rasqal_raptor_triple_match): debug printf * src/rasqal_literal.c: (rasqal_literal_string_to_native): Promote xsd:decimal to RASQAL_LITERAL_DECIMAL * src/sparql_lexer.l: Add support for @lang and ^^datatype after triple quoted literals. (sparql_copy_string_token): Skip repeated terminating delimiters. 2007-10-03 Lauri Aalto * src/rasqal_literal.c: (rasqal_literal_as_node) Return NULL if new literal string allocation fails. No need to handle boolean datatypes as a special case. * src/rasqal_literal.c: indent, style * src/rasqal_literal.c: (rasqal_new_integer_literal, rasqal_new_double_literal, rasqal_new_decimal_literal, rasqal_new_string_literal) Set usage flag early to enable cleanup with rasqal_free_literal(). * src/rasqal_literal.c: (rasqal_formula_join) Free second formula even if neither formula has triples. 2007-10-02 Dave Beckett * tests/sparql/check-sparql: try to fix the pain of using XML::Simple * tests/sparql/check-sparql: Save rasqal_date in output EARL 2007-10-02 Lauri Aalto * src/rasqal_literal.c, tests/sparql/examples/Makefile.am: (rasqal_literal_compare) Return type error when comparing plain and typed literals. Fixes tests/sparql/examples/ex11_0 (sparql-query-example-Testing-Values-0). * src/sparql_parser.y, tests/sparql/examples/Makefile.am: (FilteredBasicGraphPattern) Push BlockOfTriplesOpt instead of shifting. Fixes Issue#000200 http://bugs.librdf.org/mantis/view.php?id=200 Fixes tests/sparql/examples/ex3 (sparql-query-example-e). 2007-10-01 Lauri Aalto * src/rasqal_engine.c: (rasqal_free_gp_data) Free triple_meta even if gp is NULL. (rasqal_engine_graph_pattern_init(rasqal_query_results) Check for triple_meta alloc failure. 2007-09-30 Dave Beckett * tests/sparql/check-sparql: Add SVN info to version for EARL output * tests/sparql/dawg, tests/sparql/dawg/LICENSE, tests/sparql/dawg/README, tests/sparql/dawg/algebra, tests/sparql/dawg/algebra/data-1.ttl, tests/sparql/dawg/algebra/data-2.ttl, tests/sparql/dawg/algebra/filter-nested-1.rq, tests/sparql/dawg/algebra/filter-nested-1.srx, tests/sparql/dawg/algebra/filter-nested-2.rq, tests/sparql/dawg/algebra/filter-nested-2.srx, tests/sparql/dawg/algebra/filter-placement-1.rq, tests/sparql/dawg/algebra/filter-placement-1.srx, tests/sparql/dawg/algebra/filter-placement-2.rq, tests/sparql/dawg/algebra/filter-placement-2.srx, tests/sparql/dawg/algebra/filter-placement-3.rq, tests/sparql/dawg/algebra/filter-placement-3.srx, tests/sparql/dawg/algebra/filter-scope-1.rq, tests/sparql/dawg/algebra/filter-scope-1.srx, tests/sparql/dawg/algebra/join-combo-1.rq, tests/sparql/dawg/algebra/join-combo-1.srx, tests/sparql/dawg/algebra/join-combo-2.rq, tests/sparql/dawg/algebra/join-combo-2.srx, tests/sparql/dawg/algebra/join-combo-graph-1.ttl, tests/sparql/dawg/algebra/join-combo-graph-2.ttl, tests/sparql/dawg/algebra/manifest.ttl, tests/sparql/dawg/algebra/opt-filter-1.rq, tests/sparql/dawg/algebra/opt-filter-1.srx, tests/sparql/dawg/algebra/opt-filter-1.ttl, tests/sparql/dawg/algebra/opt-filter-2.rq, tests/sparql/dawg/algebra/opt-filter-2.srx, tests/sparql/dawg/algebra/opt-filter-2.ttl, tests/sparql/dawg/algebra/opt-filter-3.rq, tests/sparql/dawg/algebra/opt-filter-3.srx, tests/sparql/dawg/algebra/opt-filter-3.ttl, tests/sparql/dawg/algebra/two-nested-opt-alt.rq, tests/sparql/dawg/algebra/two-nested-opt-alt.srx, tests/sparql/dawg/algebra/two-nested-opt.rq, tests/sparql/dawg/algebra/two-nested-opt.srx, tests/sparql/dawg/algebra/two-nested-opt.ttl, tests/sparql/dawg/algebra/var-scope-join-1.rq, tests/sparql/dawg/algebra/var-scope-join-1.srx, tests/sparql/dawg/algebra/var-scope-join-1.ttl, tests/sparql/dawg/algebra-expressions.txt, tests/sparql/dawg/ask, tests/sparql/dawg/ask/ask-1.rq, tests/sparql/dawg/ask/ask-1.srx, tests/sparql/dawg/ask/ask-4.rq, tests/sparql/dawg/ask/ask-4.srx, tests/sparql/dawg/ask/ask-7.rq, tests/sparql/dawg/ask/ask-7.srx, tests/sparql/dawg/ask/ask-8.rq, tests/sparql/dawg/ask/ask-8.srx, tests/sparql/dawg/ask/data.ttl, tests/sparql/dawg/ask/manifest.ttl, tests/sparql/dawg/basic, tests/sparql/dawg/basic/base-prefix-1.rq, tests/sparql/dawg/basic/base-prefix-1.srx, tests/sparql/dawg/basic/base-prefix-2.rq, tests/sparql/dawg/basic/base-prefix-2.srx, tests/sparql/dawg/basic/base-prefix-3.rq, tests/sparql/dawg/basic/base-prefix-3.srx, tests/sparql/dawg/basic/base-prefix-4.rq, tests/sparql/dawg/basic/base-prefix-4.srx, tests/sparql/dawg/basic/base-prefix-5.rq, tests/sparql/dawg/basic/base-prefix-5.srx, tests/sparql/dawg/basic/bgp-no-match.rq, tests/sparql/dawg/basic/bgp-no-match.srx, tests/sparql/dawg/basic/data-1.ttl, tests/sparql/dawg/basic/data-2.ttl, tests/sparql/dawg/basic/data-3.ttl, tests/sparql/dawg/basic/data-4.ttl, tests/sparql/dawg/basic/data-5.ttl, tests/sparql/dawg/basic/data-6.ttl, tests/sparql/dawg/basic/data-7.ttl, tests/sparql/dawg/basic/list-1.rq, tests/sparql/dawg/basic/list-1.srx, tests/sparql/dawg/basic/list-2.rq, tests/sparql/dawg/basic/list-2.srx, tests/sparql/dawg/basic/list-3.rq, tests/sparql/dawg/basic/list-3.srx, tests/sparql/dawg/basic/list-4.rq, tests/sparql/dawg/basic/list-4.srx, tests/sparql/dawg/basic/manifest.ttl, tests/sparql/dawg/basic/prefix-name-1.rq, tests/sparql/dawg/basic/prefix-name-1.srx, tests/sparql/dawg/basic/quotes-1.rq, tests/sparql/dawg/basic/quotes-1.srx, tests/sparql/dawg/basic/quotes-2.rq, tests/sparql/dawg/basic/quotes-2.srx, tests/sparql/dawg/basic/quotes-3.rq, tests/sparql/dawg/basic/quotes-3.srx, tests/sparql/dawg/basic/quotes-4.rq, tests/sparql/dawg/basic/quotes-4.srx, tests/sparql/dawg/basic/spoo-1.rq, tests/sparql/dawg/basic/spoo-1.srx, tests/sparql/dawg/basic/term-1.rq, tests/sparql/dawg/basic/term-1.srx, tests/sparql/dawg/basic/term-2.rq, tests/sparql/dawg/basic/term-2.srx, tests/sparql/dawg/basic/term-3.rq, tests/sparql/dawg/basic/term-3.srx, tests/sparql/dawg/basic/term-4.rq, tests/sparql/dawg/basic/term-4.srx, tests/sparql/dawg/basic/term-5.rq, tests/sparql/dawg/basic/term-5.srx, tests/sparql/dawg/basic/term-6.rq, tests/sparql/dawg/basic/term-6.srx, tests/sparql/dawg/basic/term-7.rq, tests/sparql/dawg/basic/term-7.srx, tests/sparql/dawg/basic/term-8.rq, tests/sparql/dawg/basic/term-8.srx, tests/sparql/dawg/basic/term-9.rq, tests/sparql/dawg/basic/term-9.srx, tests/sparql/dawg/basic/var-1.rq, tests/sparql/dawg/basic/var-1.srx, tests/sparql/dawg/basic/var-2.rq, tests/sparql/dawg/basic/var-2.srx, tests/sparql/dawg/bnode-coreference, tests/sparql/dawg/bnode-coreference/data.ttl, tests/sparql/dawg/bnode-coreference/manifest.ttl, tests/sparql/dawg/bnode-coreference/query.rq, tests/sparql/dawg/bnode-coreference/result.ttl, tests/sparql/dawg/boolean-effective-value, tests/sparql/dawg/boolean-effective-value/data-1.ttl, tests/sparql/dawg/boolean-effective-value/data-2.ttl, tests/sparql/dawg/boolean-effective-value/manifest.ttl, tests/sparql/dawg/boolean-effective-value/query-bev-1.rq, tests/sparql/dawg/boolean-effective-value/query-bev-2.rq, tests/sparql/dawg/boolean-effective-value/query-bev-3.rq, tests/sparql/dawg/boolean-effective-value/query-bev-4.rq, tests/sparql/dawg/boolean-effective-value/query-bev-5.rq, tests/sparql/dawg/boolean-effective-value/query-bev-6.rq, tests/sparql/dawg/boolean-effective-value/query-boolean-literal.rq, tests/sparql/dawg/boolean-effective-value/result-bev-1.ttl, tests/sparql/dawg/boolean-effective-value/result-bev-2.ttl, tests/sparql/dawg/boolean-effective-value/result-bev-3.ttl, tests/sparql/dawg/boolean-effective-value/result-bev-4.ttl, tests/sparql/dawg/boolean-effective-value/result-bev-5.ttl, tests/sparql/dawg/boolean-effective-value/result-bev-6.ttl, tests/sparql/dawg/boolean-effective-value/result-boolean-literal.ttl, tests/sparql/dawg/bound, tests/sparql/dawg/bound/bound1-result.ttl, tests/sparql/dawg/bound/bound1.rq, tests/sparql/dawg/bound/data.ttl, tests/sparql/dawg/bound/manifest.ttl, tests/sparql/dawg/cast, tests/sparql/dawg/cast/cast-bool.rq, tests/sparql/dawg/cast/cast-bool.srx, tests/sparql/dawg/cast/cast-dT.rq, tests/sparql/dawg/cast/cast-dT.srx, tests/sparql/dawg/cast/cast-dbl.rq, tests/sparql/dawg/cast/cast-dbl.srx, tests/sparql/dawg/cast/cast-dec.rq, tests/sparql/dawg/cast/cast-dec.srx, tests/sparql/dawg/cast/cast-flt.rq, tests/sparql/dawg/cast/cast-flt.srx, tests/sparql/dawg/cast/cast-int.rq, tests/sparql/dawg/cast/cast-int.srx, tests/sparql/dawg/cast/cast-str.rq, tests/sparql/dawg/cast/cast-str.srx, tests/sparql/dawg/cast/data.ttl, tests/sparql/dawg/cast/manifest.ttl, tests/sparql/dawg/construct, tests/sparql/dawg/construct/data-ident.ttl, tests/sparql/dawg/construct/data-opt.ttl, tests/sparql/dawg/construct/data-reif.ttl, tests/sparql/dawg/construct/manifest.ttl, tests/sparql/dawg/construct/query-construct-optional.rq, tests/sparql/dawg/construct/query-ident.rq, tests/sparql/dawg/construct/query-reif-1.rq, tests/sparql/dawg/construct/query-reif-2.rq, tests/sparql/dawg/construct/query-subgraph.rq, tests/sparql/dawg/construct/result-construct-optional.ttl, tests/sparql/dawg/construct/result-ident.ttl, tests/sparql/dawg/construct/result-reif.ttl, tests/sparql/dawg/construct/result-subgraph.ttl, tests/sparql/dawg/dataset, tests/sparql/dawg/dataset/data-g1.ttl, tests/sparql/dawg/dataset/data-g2.ttl, tests/sparql/dawg/dataset/data-g3.ttl, tests/sparql/dawg/dataset/data-g4.ttl, tests/sparql/dawg/dataset/dataset-01.rq, tests/sparql/dawg/dataset/dataset-01.ttl, tests/sparql/dawg/dataset/dataset-02.rq, tests/sparql/dawg/dataset/dataset-02.ttl, tests/sparql/dawg/dataset/dataset-03.rq, tests/sparql/dawg/dataset/dataset-03.ttl, tests/sparql/dawg/dataset/dataset-04.rq, tests/sparql/dawg/dataset/dataset-04.ttl, tests/sparql/dawg/dataset/dataset-05.rq, tests/sparql/dawg/dataset/dataset-05.ttl, tests/sparql/dawg/dataset/dataset-06.rq, tests/sparql/dawg/dataset/dataset-06.ttl, tests/sparql/dawg/dataset/dataset-07.rq, tests/sparql/dawg/dataset/dataset-07.ttl, tests/sparql/dawg/dataset/dataset-08.rq, tests/sparql/dawg/dataset/dataset-08.ttl, tests/sparql/dawg/dataset/dataset-09.rq, tests/sparql/dawg/dataset/dataset-09.ttl, tests/sparql/dawg/dataset/dataset-10.rq, tests/sparql/dawg/dataset/dataset-10.ttl, tests/sparql/dawg/dataset/dataset-11.rq, tests/sparql/dawg/dataset/dataset-11.ttl, tests/sparql/dawg/dataset/dataset-12.rq, tests/sparql/dawg/dataset/dataset-12.ttl, tests/sparql/dawg/dataset/manifest.ttl, tests/sparql/dawg/distinct, tests/sparql/dawg/distinct/data-all.ttl, tests/sparql/dawg/distinct/data-node.ttl, tests/sparql/dawg/distinct/data-num.ttl, tests/sparql/dawg/distinct/data-opt.ttl, tests/sparql/dawg/distinct/data-star.ttl, tests/sparql/dawg/distinct/data-str.ttl, tests/sparql/dawg/distinct/distinct-1-results.srx, tests/sparql/dawg/distinct/distinct-1.rq, tests/sparql/dawg/distinct/distinct-2.rq, tests/sparql/dawg/distinct/distinct-all.srx, tests/sparql/dawg/distinct/distinct-node.srx, tests/sparql/dawg/distinct/distinct-num.srx, tests/sparql/dawg/distinct/distinct-opt.srx, tests/sparql/dawg/distinct/distinct-star-1.rq, tests/sparql/dawg/distinct/distinct-star-1.srx, tests/sparql/dawg/distinct/distinct-str.srx, tests/sparql/dawg/distinct/manifest.ttl, tests/sparql/dawg/distinct/no-distinct-1.rq, tests/sparql/dawg/distinct/no-distinct-2.rq, tests/sparql/dawg/distinct/no-distinct-all.srx, tests/sparql/dawg/distinct/no-distinct-node.srx, tests/sparql/dawg/distinct/no-distinct-num.srx, tests/sparql/dawg/distinct/no-distinct-opt.srx, tests/sparql/dawg/distinct/no-distinct-str.srx, tests/sparql/dawg/expr-builtin, tests/sparql/dawg/expr-builtin/data-builtin-1.ttl, tests/sparql/dawg/expr-builtin/data-builtin-2.ttl, tests/sparql/dawg/expr-builtin/data-langMatches-de.ttl, tests/sparql/dawg/expr-builtin/data-langMatches.ttl, tests/sparql/dawg/expr-builtin/lang-case-insensitive-eq.srx, tests/sparql/dawg/expr-builtin/lang-case-insensitive-ne.srx, tests/sparql/dawg/expr-builtin/lang-case-sensitivity-eq.rq, tests/sparql/dawg/expr-builtin/lang-case-sensitivity-ne.rq, tests/sparql/dawg/expr-builtin/lang-case-sensitivity.ttl, tests/sparql/dawg/expr-builtin/manifest.ttl, tests/sparql/dawg/expr-builtin/q-blank-1.rq, tests/sparql/dawg/expr-builtin/q-datatype-1.rq, tests/sparql/dawg/expr-builtin/q-datatype-2.rq, tests/sparql/dawg/expr-builtin/q-datatype-3.rq, tests/sparql/dawg/expr-builtin/q-iri-1.rq, tests/sparql/dawg/expr-builtin/q-isliteral-1.rq, tests/sparql/dawg/expr-builtin/q-lang-1.rq, tests/sparql/dawg/expr-builtin/q-lang-2.rq, tests/sparql/dawg/expr-builtin/q-lang-3.rq, tests/sparql/dawg/expr-builtin/q-langMatches-1.rq, tests/sparql/dawg/expr-builtin/q-langMatches-2.rq, tests/sparql/dawg/expr-builtin/q-langMatches-3.rq, tests/sparql/dawg/expr-builtin/q-langMatches-4.rq, tests/sparql/dawg/expr-builtin/q-langMatches-de-de.rq, tests/sparql/dawg/expr-builtin/q-str-1.rq, tests/sparql/dawg/expr-builtin/q-str-2.rq, tests/sparql/dawg/expr-builtin/q-str-3.rq, tests/sparql/dawg/expr-builtin/q-str-4.rq, tests/sparql/dawg/expr-builtin/q-uri-1.rq, tests/sparql/dawg/expr-builtin/result-blank-1.ttl, tests/sparql/dawg/expr-builtin/result-datatype-1.ttl, tests/sparql/dawg/expr-builtin/result-datatype-2.srx, tests/sparql/dawg/expr-builtin/result-datatype-3.srx, tests/sparql/dawg/expr-builtin/result-iri-1.ttl, tests/sparql/dawg/expr-builtin/result-isliteral-1.ttl, tests/sparql/dawg/expr-builtin/result-lang-1.srx, tests/sparql/dawg/expr-builtin/result-lang-2.srx, tests/sparql/dawg/expr-builtin/result-lang-3.srx, tests/sparql/dawg/expr-builtin/result-langMatches-1.ttl, tests/sparql/dawg/expr-builtin/result-langMatches-2.ttl, tests/sparql/dawg/expr-builtin/result-langMatches-3.ttl, tests/sparql/dawg/expr-builtin/result-langMatches-4.ttl, tests/sparql/dawg/expr-builtin/result-langMatches-de.ttl, tests/sparql/dawg/expr-builtin/result-str-1.ttl, tests/sparql/dawg/expr-builtin/result-str-2.ttl, tests/sparql/dawg/expr-builtin/result-str-3.ttl, tests/sparql/dawg/expr-builtin/result-str-4.ttl, tests/sparql/dawg/expr-builtin/result-uri-1.ttl, tests/sparql/dawg/expr-equals, tests/sparql/dawg/expr-equals/data-eq.ttl, tests/sparql/dawg/expr-equals/manifest.ttl, tests/sparql/dawg/expr-equals/query-eq-1.rq, tests/sparql/dawg/expr-equals/query-eq-2.rq, tests/sparql/dawg/expr-equals/query-eq-3.rq, tests/sparql/dawg/expr-equals/query-eq-4.rq, tests/sparql/dawg/expr-equals/query-eq-5.rq, tests/sparql/dawg/expr-equals/query-eq-graph-1.rq, tests/sparql/dawg/expr-equals/query-eq-graph-2.rq, tests/sparql/dawg/expr-equals/query-eq-graph-3.rq, tests/sparql/dawg/expr-equals/query-eq-graph-4.rq, tests/sparql/dawg/expr-equals/query-eq-graph-5.rq, tests/sparql/dawg/expr-equals/query-eq2-1.rq, tests/sparql/dawg/expr-equals/query-eq2-2.rq, tests/sparql/dawg/expr-equals/query-eq2-graph-1.rq, tests/sparql/dawg/expr-equals/result-eq-1.ttl, tests/sparql/dawg/expr-equals/result-eq-2.ttl, tests/sparql/dawg/expr-equals/result-eq-3.ttl, tests/sparql/dawg/expr-equals/result-eq-4.ttl, tests/sparql/dawg/expr-equals/result-eq-5.ttl, tests/sparql/dawg/expr-equals/result-eq-graph-1.ttl, tests/sparql/dawg/expr-equals/result-eq-graph-2.ttl, tests/sparql/dawg/expr-equals/result-eq-graph-3.ttl, tests/sparql/dawg/expr-equals/result-eq-graph-4.ttl, tests/sparql/dawg/expr-equals/result-eq-graph-5.ttl, tests/sparql/dawg/expr-equals/result-eq2-1.ttl, tests/sparql/dawg/expr-equals/result-eq2-2.ttl, tests/sparql/dawg/expr-equals/result-eq2-graph-1.ttl, tests/sparql/dawg/expr-ops, tests/sparql/dawg/expr-ops/data.ttl, tests/sparql/dawg/expr-ops/manifest.ttl, tests/sparql/dawg/expr-ops/query-ge-1.rq, tests/sparql/dawg/expr-ops/query-le-1.rq, tests/sparql/dawg/expr-ops/query-minus-1.rq, tests/sparql/dawg/expr-ops/query-mul-1.rq, tests/sparql/dawg/expr-ops/query-plus-1.rq, tests/sparql/dawg/expr-ops/query-unminus-1.rq, tests/sparql/dawg/expr-ops/query-unplus-1.rq, tests/sparql/dawg/expr-ops/result-ge-1.srx, tests/sparql/dawg/expr-ops/result-le-1.srx, tests/sparql/dawg/expr-ops/result-minus-1.srx, tests/sparql/dawg/expr-ops/result-mul-1.srx, tests/sparql/dawg/expr-ops/result-plus-1.srx, tests/sparql/dawg/expr-ops/result-unminus-1.srx, tests/sparql/dawg/expr-ops/result-unplus-1.srx, tests/sparql/dawg/extended-manifest-evaluation.ttl, tests/sparql/dawg/graph, tests/sparql/dawg/graph/data-g1.ttl, tests/sparql/dawg/graph/data-g2.ttl, tests/sparql/dawg/graph/data-g3.ttl, tests/sparql/dawg/graph/data-g4.ttl, tests/sparql/dawg/graph/graph-01.rq, tests/sparql/dawg/graph/graph-01.ttl, tests/sparql/dawg/graph/graph-02.rq, tests/sparql/dawg/graph/graph-02.ttl, tests/sparql/dawg/graph/graph-03.rq, tests/sparql/dawg/graph/graph-03.ttl, tests/sparql/dawg/graph/graph-04.rq, tests/sparql/dawg/graph/graph-04.ttl, tests/sparql/dawg/graph/graph-05.rq, tests/sparql/dawg/graph/graph-05.ttl, tests/sparql/dawg/graph/graph-06.rq, tests/sparql/dawg/graph/graph-06.ttl, tests/sparql/dawg/graph/graph-07.rq, tests/sparql/dawg/graph/graph-07.ttl, tests/sparql/dawg/graph/graph-08.rq, tests/sparql/dawg/graph/graph-08.ttl, tests/sparql/dawg/graph/graph-09.rq, tests/sparql/dawg/graph/graph-09.ttl, tests/sparql/dawg/graph/graph-10.rq, tests/sparql/dawg/graph/graph-10.ttl, tests/sparql/dawg/graph/graph-11.rq, tests/sparql/dawg/graph/graph-11.ttl, tests/sparql/dawg/graph/manifest.ttl, tests/sparql/dawg/i18n, tests/sparql/dawg/i18n/.htaccess, tests/sparql/dawg/i18n/kanji-01-results.ttl, tests/sparql/dawg/i18n/kanji-01.rq, tests/sparql/dawg/i18n/kanji-02-results.ttl, tests/sparql/dawg/i18n/kanji-02.rq, tests/sparql/dawg/i18n/kanji.ttl, tests/sparql/dawg/i18n/manifest.ttl, tests/sparql/dawg/i18n/normalization-01-results.ttl, tests/sparql/dawg/i18n/normalization-01.rq, tests/sparql/dawg/i18n/normalization-01.ttl, tests/sparql/dawg/i18n/normalization-02-results.ttl, tests/sparql/dawg/i18n/normalization-02.rq, tests/sparql/dawg/i18n/normalization-02.ttl, tests/sparql/dawg/i18n/normalization-03-results.ttl, tests/sparql/dawg/i18n/normalization-03.rq, tests/sparql/dawg/i18n/normalization-03.ttl, tests/sparql/dawg/manifest-evaluation.ttl, tests/sparql/dawg/manifest-syntax.ttl, tests/sparql/dawg/open-world, tests/sparql/dawg/open-world/data-1.ttl, tests/sparql/dawg/open-world/data-2.ttl, tests/sparql/dawg/open-world/data-3.ttl, tests/sparql/dawg/open-world/data-4.ttl, tests/sparql/dawg/open-world/date-1-result.srx, tests/sparql/dawg/open-world/date-1.rq, tests/sparql/dawg/open-world/date-2-result.srx, tests/sparql/dawg/open-world/date-2.rq, tests/sparql/dawg/open-world/date-3-result.srx, tests/sparql/dawg/open-world/date-3.rq, tests/sparql/dawg/open-world/date-4-result.srx, tests/sparql/dawg/open-world/date-4.rq, tests/sparql/dawg/open-world/manifest.ttl, tests/sparql/dawg/open-world/open-cmp-01-result.srx, tests/sparql/dawg/open-world/open-cmp-01.rq, tests/sparql/dawg/open-world/open-cmp-02-result.srx, tests/sparql/dawg/open-world/open-cmp-02.rq, tests/sparql/dawg/open-world/open-eq-01-result.srx, tests/sparql/dawg/open-world/open-eq-01.rq, tests/sparql/dawg/open-world/open-eq-02-result.srx, tests/sparql/dawg/open-world/open-eq-02.rq, tests/sparql/dawg/open-world/open-eq-03-result.srx, tests/sparql/dawg/open-world/open-eq-03.rq, tests/sparql/dawg/open-world/open-eq-04-result.srx, tests/sparql/dawg/open-world/open-eq-04.rq, tests/sparql/dawg/open-world/open-eq-05-result.srx, tests/sparql/dawg/open-world/open-eq-05.rq, tests/sparql/dawg/open-world/open-eq-06-result.srx, tests/sparql/dawg/open-world/open-eq-06.rq, tests/sparql/dawg/open-world/open-eq-07-result.srx, tests/sparql/dawg/open-world/open-eq-07.rq, tests/sparql/dawg/open-world/open-eq-08-result.srx, tests/sparql/dawg/open-world/open-eq-08.rq, tests/sparql/dawg/open-world/open-eq-09-result.srx, tests/sparql/dawg/open-world/open-eq-09.rq, tests/sparql/dawg/open-world/open-eq-10-result.srx, tests/sparql/dawg/open-world/open-eq-10.rq, tests/sparql/dawg/open-world/open-eq-11-result.srx, tests/sparql/dawg/open-world/open-eq-11.rq, tests/sparql/dawg/open-world/open-eq-12-result.srx, tests/sparql/dawg/open-world/open-eq-12.rq, tests/sparql/dawg/open-world/sameTerm-StringSimpleLiteralCmp.srx, tests/sparql/dawg/open-world/sameTerm-eq-StringSimpleLiteralCmp.srx, tests/sparql/dawg/open-world/sameTerm-eq.rq, tests/sparql/dawg/open-world/sameTerm-eq.srx, tests/sparql/dawg/open-world/sameTerm-manifest.ttl, tests/sparql/dawg/open-world/sameTerm-not-eq-StringSimpleLiteralCmp.srx, tests/sparql/dawg/open-world/sameTerm-not-eq.rq, tests/sparql/dawg/open-world/sameTerm-not-eq.srx, tests/sparql/dawg/open-world/sameTerm.rq, tests/sparql/dawg/open-world/sameTerm.srx, tests/sparql/dawg/open-world/sameTerm.ttl, tests/sparql/dawg/optional, tests/sparql/dawg/optional/complex-data-1.ttl, tests/sparql/dawg/optional/complex-data-2.ttl, tests/sparql/dawg/optional/data.ttl, tests/sparql/dawg/optional/manifest.ttl, tests/sparql/dawg/optional/q-opt-1.rq, tests/sparql/dawg/optional/q-opt-2.rq, tests/sparql/dawg/optional/q-opt-3.rq, tests/sparql/dawg/optional/q-opt-complex-1.rq, tests/sparql/dawg/optional/q-opt-complex-2.rq, tests/sparql/dawg/optional/q-opt-complex-3.rq, tests/sparql/dawg/optional/q-opt-complex-4.rq, tests/sparql/dawg/optional/result-opt-1.ttl, tests/sparql/dawg/optional/result-opt-2.ttl, tests/sparql/dawg/optional/result-opt-3.ttl, tests/sparql/dawg/optional/result-opt-complex-1.ttl, tests/sparql/dawg/optional/result-opt-complex-2.ttl, tests/sparql/dawg/optional/result-opt-complex-3.ttl, tests/sparql/dawg/optional/result-opt-complex-4.ttl, tests/sparql/dawg/optional-filter, tests/sparql/dawg/optional-filter/data-1.ttl, tests/sparql/dawg/optional-filter/expr-1-result.ttl, tests/sparql/dawg/optional-filter/expr-1.rq, tests/sparql/dawg/optional-filter/expr-2-result.ttl, tests/sparql/dawg/optional-filter/expr-2.rq, tests/sparql/dawg/optional-filter/expr-3-result.ttl, tests/sparql/dawg/optional-filter/expr-3.rq, tests/sparql/dawg/optional-filter/manifest.ttl, tests/sparql/dawg/regex, tests/sparql/dawg/regex/manifest.ttl, tests/sparql/dawg/regex/regex-data-01.ttl, tests/sparql/dawg/regex/regex-query-001.rq, tests/sparql/dawg/regex/regex-query-002.rq, tests/sparql/dawg/regex/regex-query-003.rq, tests/sparql/dawg/regex/regex-query-004.rq, tests/sparql/dawg/regex/regex-result-001.ttl, tests/sparql/dawg/regex/regex-result-002.ttl, tests/sparql/dawg/regex/regex-result-003.ttl, tests/sparql/dawg/regex/regex-result-004.ttl, tests/sparql/dawg/slice, tests/sparql/dawg/solution-seq, tests/sparql/dawg/solution-seq/data.ttl, tests/sparql/dawg/solution-seq/manifest.ttl, tests/sparql/dawg/solution-seq/slice-01.rq, tests/sparql/dawg/solution-seq/slice-02.rq, tests/sparql/dawg/solution-seq/slice-03.rq, tests/sparql/dawg/solution-seq/slice-04.rq, tests/sparql/dawg/solution-seq/slice-10.rq, tests/sparql/dawg/solution-seq/slice-11.rq, tests/sparql/dawg/solution-seq/slice-12.rq, tests/sparql/dawg/solution-seq/slice-13.rq, tests/sparql/dawg/solution-seq/slice-20.rq, tests/sparql/dawg/solution-seq/slice-21.rq, tests/sparql/dawg/solution-seq/slice-22.rq, tests/sparql/dawg/solution-seq/slice-23.rq, tests/sparql/dawg/solution-seq/slice-24.rq, tests/sparql/dawg/solution-seq/slice-results-01.ttl, tests/sparql/dawg/solution-seq/slice-results-02.ttl, tests/sparql/dawg/solution-seq/slice-results-03.ttl, tests/sparql/dawg/solution-seq/slice-results-04.ttl, tests/sparql/dawg/solution-seq/slice-results-10.ttl, tests/sparql/dawg/solution-seq/slice-results-11.ttl, tests/sparql/dawg/solution-seq/slice-results-12.ttl, tests/sparql/dawg/solution-seq/slice-results-13.ttl, tests/sparql/dawg/solution-seq/slice-results-20.ttl, tests/sparql/dawg/solution-seq/slice-results-21.ttl, tests/sparql/dawg/solution-seq/slice-results-22.ttl, tests/sparql/dawg/solution-seq/slice-results-23.ttl, tests/sparql/dawg/solution-seq/slice-results-24.ttl, tests/sparql/dawg/sort, tests/sparql/dawg/sort/.manifest.ttl.swp, tests/sparql/dawg/sort/data-sort-1.ttl, tests/sparql/dawg/sort/data-sort-11.ttl, tests/sparql/dawg/sort/data-sort-3.ttl, tests/sparql/dawg/sort/data-sort-4.ttl, tests/sparql/dawg/sort/data-sort-6.ttl, tests/sparql/dawg/sort/data-sort-7.ttl, tests/sparql/dawg/sort/data-sort-8.ttl, tests/sparql/dawg/sort/data-sort-9.ttl, tests/sparql/dawg/sort/data-sort-builtin.ttl, tests/sparql/dawg/sort/data-sort-function.ttl, tests/sparql/dawg/sort/data-sort-numbers.ttl, tests/sparql/dawg/sort/extended-manifest.ttl, tests/sparql/dawg/sort/manifest.ttl, tests/sparql/dawg/sort/query-sort-1.rq, tests/sparql/dawg/sort/query-sort-10.rq, tests/sparql/dawg/sort/query-sort-2.rq, tests/sparql/dawg/sort/query-sort-3.rq, tests/sparql/dawg/sort/query-sort-4.rq, tests/sparql/dawg/sort/query-sort-5.rq, tests/sparql/dawg/sort/query-sort-6.rq, tests/sparql/dawg/sort/query-sort-9.rq, tests/sparql/dawg/sort/query-sort-builtin.rq, tests/sparql/dawg/sort/query-sort-function.rq, tests/sparql/dawg/sort/query-sort-numbers.rq, tests/sparql/dawg/sort/result-sort-1.rdf, tests/sparql/dawg/sort/result-sort-10.rdf, tests/sparql/dawg/sort/result-sort-11.ttl, tests/sparql/dawg/sort/result-sort-2.rdf, tests/sparql/dawg/sort/result-sort-3.rdf, tests/sparql/dawg/sort/result-sort-4.rdf, tests/sparql/dawg/sort/result-sort-5.rdf, tests/sparql/dawg/sort/result-sort-6.rdf, tests/sparql/dawg/sort/result-sort-7.rdf, tests/sparql/dawg/sort/result-sort-8.rdf, tests/sparql/dawg/sort/result-sort-9.rdf, tests/sparql/dawg/sort/result-sort-builtin.ttl, tests/sparql/dawg/sort/result-sort-function.ttl, tests/sparql/dawg/sort/result-sort-numbers.ttl, tests/sparql/dawg/syntax, tests/sparql/dawg/syntax-sparql1, tests/sparql/dawg/syntax-sparql1/manifest.ttl, tests/sparql/dawg/syntax-sparql1/syntax-basic-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-basic-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-basic-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-basic-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-basic-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-basic-06.rq, tests/sparql/dawg/syntax-sparql1/syntax-bnodes-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-bnodes-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-bnodes-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-bnodes-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-bnodes-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-expr-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-expr-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-expr-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-expr-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-expr-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-forms-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-forms-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-limit-offset-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-limit-offset-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-limit-offset-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-limit-offset-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-lists-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-lists-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-lists-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-lists-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-lists-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-06.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-07.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-08.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-09.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-10.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-11.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-12.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-13.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-14.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-15.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-16.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-17.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-18.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-19.rq, tests/sparql/dawg/syntax-sparql1/syntax-lit-20.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-06.rq, tests/sparql/dawg/syntax-sparql1/syntax-order-07.rq, tests/sparql/dawg/syntax-sparql1/syntax-pat-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-pat-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-pat-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-pat-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-04.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-06.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-07.rq, tests/sparql/dawg/syntax-sparql1/syntax-qname-08.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-02.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-03.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-05.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-06.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-07.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-08.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-09.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-10.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-11.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-12.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-13.rq, tests/sparql/dawg/syntax-sparql1/syntax-struct-14.rq, tests/sparql/dawg/syntax-sparql1/syntax-union-01.rq, tests/sparql/dawg/syntax-sparql1/syntax-union-02.rq, tests/sparql/dawg/syntax-sparql2, tests/sparql/dawg/syntax-sparql2/manifest.ttl, tests/sparql/dawg/syntax-sparql2/syntax-bnode-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-bnode-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-bnode-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-dataset-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-dataset-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-dataset-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-dataset-04.rq, tests/sparql/dawg/syntax-sparql2/syntax-esc-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-esc-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-esc-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-esc-04.rq, tests/sparql/dawg/syntax-sparql2/syntax-esc-05.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-ask-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-construct01.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-construct02.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-construct03.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-construct04.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-construct06.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-describe01.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-describe02.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-select-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-form-select-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-function-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-function-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-function-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-function-04.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-04.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-05.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-06.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-07.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-08.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-09.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-10.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-11.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-12.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-13.rq, tests/sparql/dawg/syntax-sparql2/syntax-general-14.rq, tests/sparql/dawg/syntax-sparql2/syntax-graph-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-graph-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-graph-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-graph-04.rq, tests/sparql/dawg/syntax-sparql2/syntax-graph-05.rq, tests/sparql/dawg/syntax-sparql2/syntax-keywords-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-keywords-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-keywords-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-lists-01.rq, tests/sparql/dawg/syntax-sparql2/syntax-lists-02.rq, tests/sparql/dawg/syntax-sparql2/syntax-lists-03.rq, tests/sparql/dawg/syntax-sparql2/syntax-lists-04.rq, tests/sparql/dawg/syntax-sparql2/syntax-lists-05.rq, tests/sparql/dawg/syntax-sparql3, tests/sparql/dawg/syntax-sparql3/manifest.ttl, tests/sparql/dawg/syntax-sparql3/syn-01.rq, tests/sparql/dawg/syntax-sparql3/syn-02.rq, tests/sparql/dawg/syntax-sparql3/syn-03.rq, tests/sparql/dawg/syntax-sparql3/syn-04.rq, tests/sparql/dawg/syntax-sparql3/syn-05.rq, tests/sparql/dawg/syntax-sparql3/syn-06.rq, tests/sparql/dawg/syntax-sparql3/syn-07.rq, tests/sparql/dawg/syntax-sparql3/syn-08.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-01.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-02.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-03.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-04.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-05.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-06.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-07.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-08.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-09.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-10.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-11.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-12.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-13.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-14.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-15.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-16.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-17.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-18.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-19.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-20.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-21.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-22.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-23.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-24.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-25.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-26.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-27.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-28.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-29.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-30.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-31.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-bnode-dot.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-bnodes-missing-pvalues-01.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-bnodes-missing-pvalues-02.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-empty-optional-01.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-empty-optional-02.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-filter-missing-parens.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-lone-list.rq, tests/sparql/dawg/syntax-sparql3/syn-bad-lone-node.rq, tests/sparql/dawg/syntax-sparql3/syn-blabel-cross-filter.rq, tests/sparql/dawg/syntax-sparql3/syn-blabel-cross-graph-bad.rq, tests/sparql/dawg/syntax-sparql3/syn-blabel-cross-optional-bad.rq, tests/sparql/dawg/syntax-sparql3/syn-blabel-cross-union-bad.rq, tests/sparql/dawg/syntax-sparql4, tests/sparql/dawg/syntax-sparql4/manifest.ttl, tests/sparql/dawg/syntax-sparql4/syn-09.rq, tests/sparql/dawg/syntax-sparql4/syn-10.rq, tests/sparql/dawg/syntax-sparql4/syn-11.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-34.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-35.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-36.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-37.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-38.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-GRAPH-breaks-BGP.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-OPT-breaks-BGP.rq, tests/sparql/dawg/syntax-sparql4/syn-bad-UNION-breaks-BGP.rq, tests/sparql/dawg/syntax-sparql4/syn-leading-digits-in-prefixed-names.rq, tests/sparql/dawg/triple-match, tests/sparql/dawg/triple-match/data-01.ttl, tests/sparql/dawg/triple-match/data-02.ttl, tests/sparql/dawg/triple-match/data-03.ttl, tests/sparql/dawg/triple-match/dawg-data-01.ttl, tests/sparql/dawg/triple-match/dawg-tp-01.rq, tests/sparql/dawg/triple-match/dawg-tp-02.rq, tests/sparql/dawg/triple-match/dawg-tp-03.rq, tests/sparql/dawg/triple-match/dawg-tp-04.rq, tests/sparql/dawg/triple-match/dawg-tp-05.rq, tests/sparql/dawg/triple-match/manifest.ttl, tests/sparql/dawg/triple-match/result-tp-01.ttl, tests/sparql/dawg/triple-match/result-tp-02.ttl, tests/sparql/dawg/triple-match/result-tp-03.ttl, tests/sparql/dawg/triple-match/result-tp-04.ttl, tests/sparql/dawg/type-promotion, tests/sparql/dawg/type-promotion/false.ttl, tests/sparql/dawg/type-promotion/manifest.ttl, tests/sparql/dawg/type-promotion/tP-byte-short-fail.rq, tests/sparql/dawg/type-promotion/tP-byte-short.rq, tests/sparql/dawg/type-promotion/tP-decimal-decimal.rq, tests/sparql/dawg/type-promotion/tP-double-decimal-fail.rq, tests/sparql/dawg/type-promotion/tP-double-decimal.rq, tests/sparql/dawg/type-promotion/tP-double-double.rq, tests/sparql/dawg/type-promotion/tP-double-float-fail.rq, tests/sparql/dawg/type-promotion/tP-double-float.rq, tests/sparql/dawg/type-promotion/tP-float-decimal-fail.rq, tests/sparql/dawg/type-promotion/tP-float-decimal.rq, tests/sparql/dawg/type-promotion/tP-float-float.rq, tests/sparql/dawg/type-promotion/tP-int-short.rq, tests/sparql/dawg/type-promotion/tP-integer-short.rq, tests/sparql/dawg/type-promotion/tP-long-short.rq, tests/sparql/dawg/type-promotion/tP-negativeInteger-short.rq, tests/sparql/dawg/type-promotion/tP-nonNegativeInteger-short.rq, tests/sparql/dawg/type-promotion/tP-nonPositiveInteger-short.rq, tests/sparql/dawg/type-promotion/tP-positiveInteger-short.rq, tests/sparql/dawg/type-promotion/tP-short-byte-fail.rq, tests/sparql/dawg/type-promotion/tP-short-decimal.rq, tests/sparql/dawg/type-promotion/tP-short-double.rq, tests/sparql/dawg/type-promotion/tP-short-float.rq, tests/sparql/dawg/type-promotion/tP-short-int-fail.rq, tests/sparql/dawg/type-promotion/tP-short-long-fail.rq, tests/sparql/dawg/type-promotion/tP-short-short-fail.rq, tests/sparql/dawg/type-promotion/tP-short-short.rq, tests/sparql/dawg/type-promotion/tP-unsignedByte-short.rq, tests/sparql/dawg/type-promotion/tP-unsignedInt-short.rq, tests/sparql/dawg/type-promotion/tP-unsignedLong-short.rq, tests/sparql/dawg/type-promotion/tP-unsignedShort-short.rq, tests/sparql/dawg/type-promotion/tP.ttl, tests/sparql/dawg/type-promotion/true.ttl: Import DAWG latest SPARQL tests 2007-09-30 Lauri Aalto * tests/sparql/check-sparql: Recognize http://jena.hpl.hp.com/2005/05/test-manifest-extra#TestSyntax and #TestBadSyntax as syntax tests. * tests/sparql/check-sparql: Use stderr consistently for debug messages. 2007-09-29 Dave Beckett * src/rasqal_result_formats.c: Adjust for raptor_new_xml_element_from_namespace_local_name signature change 2007-09-28 Lauri Aalto * src/rasqal_expr.c: (rasqal_new_data_graph) Does not take ownership or uri & name_uri but copies them. 2007-09-27 Lauri Aalto * src/rasqal_engine.c: (rasqal_free_gp_data) Do not assume graph pattern is non-NULL. 2007-09-26 Dave Beckett * autogen.sh: autogen.sh with perl version grep script 2007-09-26 Lauri Aalto * src, tests/engine, tests/laqrs, tests/laqrs/syntax, utils: Props: ignore .exes, Makefile, Makefile.in 2007-09-25 Lauri Aalto * src/rasqal_result_formats.c: (rasqal_query_results_write_xml_result4) Refactoring: Replaced rasqal_query_results_new_xml_element() with raptor_new_xml_element_from_namespace_local_name(). 2007-09-24 Lauri Aalto * autogen.sh: Do not compare versions as decimal, e.g. automake 1.10 should be treated newer than 1.7. (update_prog_version) Convert [z.]x.y version strings to 100x+y. 2007-09-21 Lauri Aalto * src/sparql_parser.y: (rasqal_sparql_query_engine_terminate) Clean up nicely even if could not init query engine. * src/rasqal_internal.h, src/rasqal_query.c, src/rdql_parser.y, src/sparql_parser.y: (rasqal queries) Added query string length field to rasqal_query_s. Moved padding query strings with two YY_END_OF_BUFFER_CHARs (NULs) from bison parsers to rasqal_query_prepare() - prevents a memory leak if there's an error parsing the string. Removed query_string from *_parse() prototypes as the query string is already available in the query structure passed in. * src/rasqal_result_formats.c: (rasqal_query_results_write_xml_result4) Check for alloc failures and clean up on error. * src/rasqal_query_results.c: (rasqal_query_results_reset) Do not clear executed flag to allow cleanup on partially initialized results. * src/rasqal_general.c: rasqal_general: Check for alloc failures and clean up on error. * src/rasqal_general.c: (rasqal_finish) Allow cleanup even if init was incomplete * src/rasqal_engine.c: (rasqal_engine_merge_graph_patterns) Fix constant 1 > 1 check for the number of triples. * src/rasqal_engine.c: (rasqal_engine_graph_pattern_init) Robustness fixes * src/rasqal_engine.c: (rasqal_free_gp_data) Check against negative start_column * src/rasqal_engine.c: (rasqal_engine_graph_pattern_init) Check for alloc failure * src/rasqal_engine.c: (rasqal_engine_merge_triples) Fix compiler warning about uninitialized variables. * src/rasqal_engine.c: (rasqal_engine_prepare) Check rasqal_engine_assign_variables() return value. * src/rasqal_engine.c: rasqal_engine: Check for alloc failures and clean up on errors. * src/rasqal_expr.c: rasqal_expr: Fix compiler warnings about not returning a value from a non-void function (for compilers that do not recognize abort() as non-returning function). * src/rasqal_expr.c: rasqal_expr: Check for alloc failures and clean up on errors. * src/rasqal_graph_pattern.c: rasqal_graph_pattern: Check for alloc failures and clean up on errors. * src/rasqal_literal.c: (rasqal_formula_join) Free formulas and return NULL on error. * src/rasqal_literal.c: rasqal_literal: Fix compiler warnings about uninitialized variables. Fix compiler warnings about not returning a value from a non-void function (for compilers that do not recognize abort() as non-returning function). * src/rasqal_literal.c: rasqal_literal: Check for alloc failures. Clean up on failure. * src/rasqal_query.c: rasqal_query: Check for alloc failures. Clean up on failure. * src/rasqal_query.c: (rasqal_new_query) Check for alloc failures. Clean up on failure. * src/rasqal_query.c: (rasqal_query_escape_counted_string) Fix compiler warning about type punning. * src/rasqal_query_results.c: (rasqal_free_query_results) Do not indirect query_results before making sure it is not NULL. * src/rasqal_query_results.c: (rasqal_new_query_results) Check for alloc failure * src/rasqal_result_formats.c: rasqal_result_formats: Check for alloc failures. Clean up on failure. * src/fix-bison: bison parsers / fix-bison: Fix compiler warning about empty declarations (remove semicolon). * src/rasqal_feature.c: Fix typos in comments * Makefile.am, autogen.sh, configure.ac, data/Makefile.am, docs/Makefile.am, src/Makefile.am, tests/Makefile.am, tests/engine/Makefile.am, tests/laqrs/Makefile.am, tests/laqrs/syntax/Makefile.am, tests/rdql/Makefile.am, tests/rdql/testsuite/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/Makefile.am, tests/sparql/SyntaxDev/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, utils/Makefile.am, win32/Makefile.am: Fix EOL issues when building svn version on cygwin. Partial fix to http://bugs.librdf.org/mantis/view.php?id=236 * src/Makefile.am, tests/engine/Makefile.am: Added $(EXEEXT)s to Makefiles to fix "make clean" on cygwin. Partial fix to http://bugs.librdf.org/mantis/view.php?id=235 * autogen.sh: rasqal autogen.sh $dir quoting. Partial fix to http://bugs.librdf.org/mantis/view.php?id=234 2007-09-20 Dave Beckett * tests/sparql/SyntaxFull/Makefile.am: Expect 2 more failures :( * tests/engine/rasqal_order_test.c: Formatting 2007-09-19 Dave Beckett * tests/sparql/check-sparql: Fix exit * src/sparql_parser.y: Protect destructors from calling on NULL object - such as in an error case. * src/sparql_lexer.l: Move bare +, - alone to after recognising all other numerics. * src/sparql_lexer.l: Allow unary +/- before an integer. * src/sparql_parser.y: (OrderCondition): Allow a built-in call at the top level * src/sparql_parser.y: (LimitOffsetOpt): Added to allow LIMIT and OFFSET in any order or absent. (LimitClause): Renamed from LimitClauseOpt (OffsetClause): Renamed from OffsetClauseOpt * tests/sparql/check-sparql: Output EARL. Handle syntax only tests 2007-09-18 Dave Beckett * tests/sparql/check-sparql: help * tests/sparql/check-sparql: use perl Getopt::Long and Pod::Usage 2007-08-25 Dave Beckett * src/rasqal_limit_test.c: Tidy messages * src/Makefile.am, src/rasqal_engine.c, src/rasqal_limit_test.c: Added rasqal_iimit_test.c 2007-08-24 Dave Beckett * data/Makefile.am, data/letters.nt: Added letters.nt * src/rasqal_literal.c: (rasqal_literal_as_integer): Return integer values correctly. How did this ever work? Fixes Issue#0000221 http://bugs.librdf.org/mantis/view.php?id=221 * src/sparql_parser.y: Destruct all tokens so memory does not leak on error. Fixes Issue#0000225 http://bugs.librdf.org/mantis/view.php?id=225 * tests/sparql/check-sparql: guess for xml:lang * tests/sparql/check-sparql: tidy * tests/sparql/check-sparql: Crude srx reading * tests/sparql/Makefile.am: Removed BNodes dir * tests/sparql/Makefile.am: Added BNodes * tests/sparql/check-sparql: Add error messages when rapper fails - and abort test. Fix more assumptions when no result is expected. 2007-08-23 Dave Beckett * tests/sparql/check-sparql: (read_rdf_results_file): Renamed from read_turtle_results_file and guesses result rdf format - turtle/n3 or rdf seem to be the choiecs. * tests/sparql/check-sparql: Refactored to pull out read_turtle_results_file * tests/sparql/check-sparql: pull apart results creation from writing result.out * src/rasqal_result_formats.c: Delete old SPARQL XML Result formats to leave just the latest draft and JSON. * src/Makefile.am, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_result_formats.c (from /rasqal/trunk/src/rasqal_query_results.c:12462): Moved query result formatter code into new rasqal_result_formats.c from rasqal_query_results.c 2007-08-22 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_get_boolean): Do not return error on finished. Finished has no meaning for boolean result. * src/rasqal_query_results.c: (rasqal_query_results_get_boolean): Simplify since now rasqal_engine_query_results_update does all the work. Just count the results returned so far which will be at least 1 if there are any results. * src/rasqal_engine.c: (rasqal_engine_query_results_update): Let this be called for a boolean result, to get the first one. 2007-08-19 Dave Beckett * src/sparql_parser.y: (BasedeclOpt): Use rasqal_query_set_base_uri to ensure the URI fields are updated correctly. Fixes Issue#0000219 http://bugs.librdf.org/mantis/view.php?id=219 * src/rasqal_internal.h: Added rasqal_query_set_base_uri prototype * src/rasqal_query.c: (rasqal_query_prepare): Use rasqal_query_set_base_uri. (rasqal_query_set_base_uri): Added * src/rasqal_query_results.c: (rasqal_query_results_get_boolean): Get the first result row from a query in order to answer ASK. Fixes Issue#0000193 http://bugs.librdf.org/mantis/view.php?id=193 * src/sparql_lexer.l: (rasqal_sparql_name_check): debug cast * src/sparql_parser.y: (WhereClauseOpt): Remove warning about optional SPARQL WHERE although it is still a dumb idea to have useless keywords. Fixes Issue#0000204 http://bugs.librdf.org/mantis/view.php?id=204 * src/rasqal_expr.c: (rasqal_language_matches): * does not match a langString with no language. Fixes Issue#0000201 http://bugs.librdf.org/mantis/view.php?id=201 * tests/sparql/ExprBuiltins/result-langMatches-3.ttl, tests/sparql/ExprBuiltins/result-langMatches-4.ttl: Fix expected result fixes for langMatches-[34] http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2006Jun/0050.html 2007-08-17 Dave Beckett * src/rasqal.h: Applied rasqal part of symbian portability fix for Issue#0000203 http://bugs.librdf.org/mantis/view.php?id=203 2007-07-06 Dave Beckett * src/rasqal_query_results.c: Add 4th version of SPARQL XML Results format. (rasqal_init_query_results): Use rasqal_query_results_write_xml_result4 for latest version 2007-06-14 named "xml" and demote previous one 2006-01-25 to name "xml-v3" (rasqal_query_results_write_xml_result4): Added to implement version 2007-06-14 with removal of attributes 'ordered' and 'distinct'. 2007-06-13 Dave Beckett * tests/sparql/ExprBuiltins/Makefile.am: LangMatches-2 LangMatches-3 LangMatches-4 all pass leaving 2 failures * src/rasqal_expr.c: (rasqal_language_matches): Added to do proper language tag/range matching. (rasqal_expression_evaluate): RASQAL_EXPR_LANG: Return an empty string for no language and NULL (error) for not a literal. RASQAL_EXPR_LANGMATCHES: Use rasqal_language_matches() above. Fixes Issue#0000201 http://bugs.librdf.org/mantis/view.php?id=201 and makes tests sparql/ExprBuiltins/LangMatches-[234] pass. 2007-06-12 Dave Beckett * tests/sparql/Expr2/Makefile.am: Fix for issue #0000199 makes query-bev-[1-4].rq pass * src/rasqal_literal.c: (rasqal_literal_as_boolean): Implement SPARQL EBV rules here. Fixes Issue#0000199 http://bugs.librdf.org/mantis/view.php?id=199 and makes tests sparql/Expr2/query-bev-[1-4].rq pass * src/rasqal_redland.c: (redland_node_to_rasqal_literal): Casts for picky compiler. Fixes Issue#0000198 http://bugs.librdf.org/mantis/view.php?id=198 * src/rasqal_expr.c: (rasqal_expression_evaluate): case RASQAL_EXPR_STR_MATCH, RASQAL_EXPR_STR_NMATCH and RASQAL_EXPR_REGEX. Use pcre_free(re) to free PCRE object Fixes Issue#0000196 http://bugs.librdf.org/mantis/view.php?id=196 2007-06-02 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_as_floating): It is possible to promote a decimal to a float. Fixes Issue#0000197 http://bugs.librdf.org/mantis/view.php?id=197 2007-05-26 Dave Beckett * src/rasqal.h: Use RASQAL_API not RAPTOR_API here Fixes Issue#0000191 http://bugs.librdf.org/mantis/view.php?id=191 * src/rasqal_literal.c: (rasqal_literal_string_to_native): Free original string for boolean, replacing with static. (rasqal_free_literal): Free boolean literal's datatype URI. Fixes Issue#0000190 http://bugs.librdf.org/mantis/view.php?id=190 * src/rasqal.h: Allow _declspec and __declspec Fixes Issue#0000188 http://bugs.librdf.org/mantis/view.php?id=188 2007-05-21 Dave Beckett * configure.ac: Add -Wformat-security 2007-04-23 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_compare): Declare rasqal_literal_type type and add rest of cases to switches. * NEWS.html, configure.ac, src/win32_rasqal_config.h: Bump version to 0.9.15 2007-04-22 Dave Beckett * Snapshotted rasqal_0_9_14 for 0.9.14 release (SVN 12127) * docs/librasqal.3: rasqal_query_get_explain * docs/librasqal.3: 0.9.14 from 6 months ago * autogen.sh: Update autogen.sh * rasqal.pc.in: Add Libs.private * src/rasqal-config.in, src/rasqal_engine.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_raptor.c, utils/roqet.c: casts for C++ * docs/tmpl/section-expression.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-query_results_formatter.sgml: docs 2007-04-21 Dave Beckett * src/rasqal.h: variable has @expression field. * src/rasqal_engine.c, src/rasqal_internal.h: Revert query engine back to 'working' optionals. At least working as well as they did in the last release * src/rasqal.h: rasqal_expression has no variable * docs/tmpl/section-unused.sgml: expression no variable * docs/tmpl/section-query.sgml: rasqal_query_set_distinct * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Make static, only used here. * src/sparql_parser.y: (SelectTerm): Renamed from SelectExpressionTerm (SelectExpression): Uses AggregateExpression or Expression. (AggregateExpression): Added, just using CountAggregateExpression. (CountAggregateExpression): Added for COUNT(expr) and COUNT(*) * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/count1.rq, tests/laqrs/syntax/count2.rq, tests/laqrs/syntax/count3.rq, tests/laqrs/syntax/count4.rq: more COUNT tests * utils/roqet.c: Declare any query namespaces in the output serializer * utils/roqet.c: Allow -r to take a serializer argument. Check it with raptor_serializer_syntax_name_check * tests/Makefile.am: No local_tests here for 6 months * tests/laqrs/Makefile.am, tests/laqrs/check-laqrs: remove check-laqrs * tests/laqrs/syntax/Makefile.am: renames * tests/laqrs/syntax/bad-select-expr.rq: comment * src/sparql_parser.y: (SelectExpressionTerm): Do not allow a select expression to contain the variable name it is named for. (SelectExpression): Tidy error returns. * src/rasqal_internal.h: Added rasqal_expression_mentions_variable prototype * src/rasqal_expr.c: (rasqal_expression_has_variable): Added. (rasqal_expression_mentions_variable): Added to check if an expression mentions a rasqal_variable. * src/rasqal.h: rasqal_expression does not need a rasqal_variable field. * tests/laqrs, tests/laqrs/Makefile.am, tests/laqrs/check-laqrs, tests/laqrs/syntax, tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/bad-select-expr.rq, tests/laqrs/syntax/bug156.rq, tests/laqrs/syntax/coverage.rq, tests/laqrs/syntax/data.n3, tests/laqrs/syntax/delete.rq, tests/laqrs/syntax/explain.rq: laqrs * src/sparql_parser.y: (SelectExpressionListTail): A list or a wildcard. (SelectExpressionListTail): Added to ensure select expression list is always 1 or more item. (SelectExpressionTerm): A variable ?var or a select expression assigned to a name (SelectExpression): Docs and forbid COUNT in sparql. * src/sparql_parser.y: Move '*' to SelectExpressionList from SelectQuery * src/sparql_parser.y: Add getopt() simple handling for -d and -i LANGUAGE for sparql and laqrs. * configure.ac: Added tests/laqrs/syntax/Makefile * configure.ac: add tests/laqrs/Makefile * tests/Makefile.am: Add laqrs sub dir * src/rdql_lexer.l: Allow '-' in language tags * src/sparql_lexer.l: Allow '-' in language tags Fixes Issue#0000182 http://bugs.librdf.org/mantis/view.php?id=182 * src/sparql_lexer.l: Make <_:NAME> (an illegal URI) act like _:NAME. Fixes Issue#0000152 http://bugs.librdf.org/mantis/view.php?id=152 * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/blankuri.rq: added blankuri.rq 2007-04-15 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_query_result_row_compare): Only do distinct=1 DISTINCT, no code for REDUCE yet. * src/rasqal_query_results.c: (rasqal_query_results_write_xml_result3): Allow for a potential new output argument reduced=true/false. Not yet enabled. * src/rasqal_query.c: (rasqal_query_get_distinct): Rename arg to distinct_mode. (rasqal_query_set_distinct): Rename arg to distinct_mode and accept values 0, 1 and 2. (rasqal_query_print, rasqal_query_write_sparql_20060406): Print distinct or reduced. 2007-04-14 Dave Beckett * src/rasqal.h: Alter rasqal_query_set_distinct arg to be named distinct_mode (no API change) * src/rasqal_internal.h: (struct rasqal_query_s): distinct now takes 0, 1 or 2 to allow for REDUCED. * src/sparql_parser.y: Add REDUCED token (SelectQuery): Add REDUCED wherever DISTINCT can go * src/sparql_lexer.l: Add REDUCED keyword * tests/rdql/testsuite/check-rdql: add debug if RASQAL_DEBUG set * tests/sparql/check-sparql: hardcode turtle as input type add debug if RASQAL_DEBUG set * tests/rdql/testsuite/check-rdql: hardcode turtle as input type 2007-04-08 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_triple_graph_pattern_get_next_match): Fix revision with an exact match in a 1 TP query. 2007-03-25 Dave Beckett * utils/roqet.c: Print all informational and help messages to stderr. Only results of querying and the help (-h/--help) message goes to stdout now. 2007-03-07 Dave Beckett * src/rasqal_engine.c: (rasqal_optional_graph_pattern_execute_init, rasqal_optional_graph_pattern_execute_bind): Restored. 2007-03-06 Dave Beckett * src/rasqal_engine.c: Removed rasqal_engine_gp_data unused fields optional_graph_pattern, optional_graph_pattern_matches_count, matches_returned Added rasqal_engine_gp_data field matches (rasqal_engine_triple_graph_pattern_get_next_match): Side effect return matches count. (rasqal_basic_graph_pattern_execute_bind): Count matches. (rasqal_group_graph_pattern_execute_init): Init start and current graph patterns. (rasqal_group_graph_pattern_execute_bind): Count matches, use start_graph_pattern for backtracing. (asqal_engine_graph_pattern_init): Merged rasqal_engine_graph_pattern_reset and rasqal_engine_graph_pattern_init (rasqal_engine_move_to_graph_pattern): Deleted. (rasqal_engine_execute_run_graph_pattern): Return step (rasqal_engine_execute_run): Use step and pass on counts. * src/rasqal_internal.h: removed new_bindings_count 2007-03-04 Dave Beckett * src/rasqal_engine.c: Add STEP_IGNORE to handle things such as empty group graph patterns that neither bind nor otherwise affect the results. Restore rasqal_engine_step_names table. rasqal_engine_execute_gp_handler method execute_bind returns a rasqal_engine_step (rasqal_basic_graph_pattern_execute_bind): Return step. Still works. (rasqal_optional_graph_pattern_execute_bind): Return steps. Still untested. (rasqal_group_graph_pattern_execute_init): Added. Works. (rasqal_group_graph_pattern_execute_bind): Added. Works. (rasqal_engine_execute_run_graph_pattern): Convert from step to rc. Testing state: src/ tests/rdql tests all work. * src/rasqal_query.c: Define RASQAL_NO_GP_MERGE to enable/disable empty graph merging * src/rasqal_engine.c: Remove rasqal_engine_group_graph_pattern_get_next_match * src/rasqal_engine.c: docs * src/rasqal_engine.c: Here we go. Throughout replace "graph pattern POINTER" with "graph pattern INDEX" (rasqal_basic_graph_pattern_execute_init): Added, with code from rasqal_engine_graph_pattern_reset for triples. (rasqal_basic_graph_pattern_execute_bind): Added, with code from rasqal_engine_do_step for triples and calling rasqal_engine_triple_graph_pattern_get_next_match to do the triple pattern matching. WORKS on a trivial example. (rasqal_optional_graph_pattern_execute_bind): Added, with code from rasqal_engine_do_optional_step. UNTESTED. rasqal_engine_execute_gp_handlers table does basic init/bind, optional bind. (rasqal_engine_graph_pattern_order): Removed. (rasqal_engine_graph_pattern_reset): Do less, moved into gp-specific init. (rasqal_engine_graph_pattern_init): Can return failure. (rasqal_engine_do_step, rasqal_engine_do_optional_step): Merged above. (rasqal_engine_store_query_results): Debug messages here. (rasqal_engine_execute_run_graph_pattern): Added to call the execute_bind handler method. (rasqal_engine_execute_run): Remove outer_gp and old code, use rasqal_engine_execute_run_graph_pattern to do the work. * src/rasqal_engine.c: struct rasqal_engine_gp_data gains matched, finished fields (rasqal_engine_graph_pattern_reset): Init matched, finished fields (rasqal_engine_graph_pattern_init): Remove sort. (rasqal_engine_do_step, rasqal_engine_do_optional_step, rasqal_engine_execute_run): use gp_data->matched, finished * src/rasqal_internal.h: struct rasqal_graph_pattern loses matched, finished fields * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Lose finished field. * src/rasqal_engine.c: (rasqal_engine_execute_init): Remove hack to restructure top-level GP * src/rasqal_engine.c: typedef rasqal_engine_execute_gp_handler Added handler field to rasqal_engine_gp_data (rasqal_new_engine_gp_data): Error checking Added NULL rasqal_engine_execute_gp_handlers array. (rasqal_new_engine_execution_data): Init handler field. * src/rasqal_engine.c: Rename rasqal_new_engine_gp_data from rasqal_new_gp_data * src/rasqal_engine.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query.c: Docucomments. (rasqal_new_graph_pattern): Add op arg and use it. * src/rasqal_engine.c: Docs. Use rasqal_query_results_reset call replacing rasqal_query_results_init * src/rasqal_query_results.c: (rasqal_query_results_reset) Renamed from rasqal_query_results_init * src/rasqal_internal.h: rasqal_query_results_reset renamed from rasqal_query_results_init * src/rasqal_query.c: (rasqal_query_execute): Handle failing to make query results object. * src/sparql_parser.y: Use rasqal_engine_new_basic_graph_pattern_from_formula. * src/rdql_parser.y: Use rasqal_new_basic_graph_pattern. * src/rasqal_engine.c: (rasqal_engine_new_basic_graph_pattern_from_formula): renamed from rasqal_engine_new_graph_pattern_from_formula Use rasqal_new_basic_graph_pattern. * src/rasqal_internal.h: Added rasqal_new_basic_graph_pattern renamed from rasqal_new_graph_pattern_from_triples. Removed rasqal_graph_pattern_add_triples Added rasqal_engine_new_basic_graph_pattern_from_formula renamed from rasqal_engine_new_graph_pattern_from_formula * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Warning this is mostly internal and does not init all fields. (rasqal_new_basic_graph_pattern): Renamed from rasqal_new_graph_pattern_from_triples - API change. (rasqal_new_graph_pattern_from_sequence): Tidied. (rasqal_graph_pattern_add_triples): Removed - API change. 2007-02-27 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_execute_run): Pull out invariants to top. * src/rasqal_engine.c: (rasqal_engine_execute_run): Tidy inlining more * src/rasqal_engine.c: (rasqal_engine_execute_run): Tidy inlining 2007-02-26 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_execute_run): Inline rasqal_engine_get_next_result into here. * src/rasqal_query_results.c: (rasqal_query_results_get_boolean): Remove rasqal_engine_get_next_result and use rasqal_engine_execute_run then look for sequence size. * src/rasqal_query.c: (rasqal_query_get_genid): one more byte * src/rasqal_engine.c, src/rasqal_internal.h: (rasqal_engine_run): Removed, never called * src/rasqal_engine.c: removed rasqal_engine_query_results_update * src/rasqal_engine.c: tidy * src/rasqal_engine.c, src/rasqal_internal.h: (rasqal_engine_store_query_results): Added. Store offset in rasqal_engine_execution_data * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c: Move rasqal_map inside rasqal_engine_execute_data * src/rasqal_engine.c: (rasqal_engine_execute_order): Do less work when not ordering or distinct, just store results in seq. * src/rasqal_engine.c: (rasqal_engine_execute_next): LAZY removal: Always use results in order_conditions_sequence. * src/rasqal_engine.c: (order_conditions_sequence): LAZY removal: Always store results in order_conditions_sequence. * docs/tmpl/section-query.sgml: new docs 2007-02-21 Dave Beckett * src/sparql_lexer.l: Added LAQRS DELETE and INSERT * src/sparql_parser.y: (DeleteQuery, InsertQuery): Added. * src/rasqal_query.c: Add rasqal_query_verb_labels labels for DELETE and INSERT. * src/rasqal_engine.c: (rasqal_engine_expand_wildcards): Handle switch RASQAL_QUERY_VERB_DELETE and RASQAL_QUERY_VERB_INSERT (rasqal_engine_assign_variables): Init size to 0 * src/rasqal.h: Added LAQRS RASQAL_QUERY_VERB_DELETE and RASQAL_QUERY_VERB_INSERT 2007-02-17 Dave Beckett * utils/roqet.1: -r words 2007-02-09 Dave Beckett * src/rasqal_raptor.c: rasqal_raptor_triples_source_user_data gains query field, source_uri field replacing list of URIs and mapped_id_base, mapped_id_base_len. (rasqal_raptor_generate_id_handler): Added, to either add the user_bnodeid to a graph-specific base, or to generate an ID otherwise. (rasqal_raptor_new_triples_source): Init uris each time, keep literals around till destruction. Set the generated ID handler for raptor to rasqal_raptor_generate_id_handler. (rasqal_raptor_free_triples_source): Do not free URIs in list, or uris array. * src/rasqal_query.c: (rasqal_query_get_genid): Added simple genid generation from a single counter held in the query plus a given base. * src/rasqal_internal.h: Remove genid_bsae again * src/rasqal_internal.h: Added rasqal_query_get_genid 2007-02-08 Dave Beckett * src/rasqal_query.c: (rasqal_query_write_sparql_graph_pattern): Write GRAPH parameter correctly in output. 2007-02-07 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Simplify and use rasqal_engine_execute_next to handle limit and offset. This patch with the previous commits Fixes Issue#0000167 http://bugs.librdf.org/mantis/view.php?id=167 * src/rasqal_engine.c: (rasqal_engine_assign_variables): Abstract from assigning variables just for a select, also assign them for a construct but put them in the variables_sequence. (rasqal_engine_get_next_result, rasqal_engine_query_result_row_update, rasqal_engine_new_query_result_row): Use size of variables from either variables_sequence for construct, otherwise select_variables_count. (rasqal_engine_query_result_row_update, rasqal_engine_new_query_result_row, rasqal_engine_query_results_update): Allow graph results to call this. (rasqal_engine_query_result_row_print): Work for construct too. (rasqal_engine_bind_construct_variables): Added, to substitute in variable bindings from a ordered query result row. (rasqal_engine_execute_order): Run rasqal_engine_bind_construct_variables after ordering. (rasqal_engine_execute_next): Run rasqal_engine_bind_construct_variables after getting next result. * src/rasqal_internal.h: docs - variables may be bound when constructs triples are present as well as when selects variables are around * src/rasqal_query_results.c: (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Check limit when getting results for triples, such as SPARQL CONSTRUCT. offset may work but not tested much. Addresses issue http://bugs.librdf.org/mantis/view.php?id=167 2007-01-24 Dave Beckett * utils/roqet.c: (roqet_query_write_variable): Added. (roqet_query_walk): Use above to print out a variable with possible expression value. * configure.ac: Added LAQRS query language - maintainer only. 2007-01-23 Dave Beckett * src/sparql_parser.y: Added LAQRS tokens EXPLAIN GROUP COUNT AS protected by sparql->extended flag. (ExplainOpt): Added for optional EXPLAIN (SelectQuery): VarList is now a SelectExpressionList (SelectExpressionList): Can take SelectExpression AS VarName when extended. (SelectExpression): Added, to handle variables as well as COUNT(expr), COUNT(*) generating a VARSTAR expression. (GroupClauseOpt): Add GROUP BY to sorting. (Var): Takes a VarName. (rasqal_sparql_query_engine_init): Init extended flag based on language name. (rasqal_init_query_engine_laqrs): Added. * src/sparql_lexer.l: Added LAQRS keywords - EXPLAIN, GROUP, COUNT, AS New state SPID for variable names after AS * src/sparql_common.h: rasqal_sparql_query_engine_s gains SPARQL extended flag * src/rasqal_engine.c: (rasqal_query_build_declared_in): Do not warn if a variable expression is given. * src/rasqal_general.c: (rasqal_init): Init LAQRS if enabled. * src/rasqal_query.c: (rasqal_new_query, rasqal_free_query): Free/init new group_conditions_sequence sequence. (rasqal_query_get_explain, rasqal_query_set_explain): Added to get/set explain flag. (rasqal_query_print): Print explain flag, group conditions sequence. (rasqal_query_get_group_conditions_sequence, rasqal_query_get_group_condition): Added to get all or one group condition. (rasqal_query_write_sparql_variable): Modified to display variable expressions when present. (rasqal_sparql_op_labels): Add LAQRS labels. (rasqal_query_write_sparql_expression, rasqal_query_write_sparql_graph_pattern, ): Handle new LAQRS expressions, group condition sequences and query flags. * src/rasqal_expr.c: (rasqal_free_variable): Free new optional expression field. (rasqal_variable_print): Print new optional expression field. (rasqal_new_0op_expression): Added no-arg (constant) expression constructor. Initially for RASQAL_EXPR_VARSTAR. (rasqal_new_1op_expression): Handle docs mentioning new 1-op expressions RASQAL_EXPR_GROUP_COND_ASC, RASQAL_EXPR_GROUP_COND_DESC, RASQAL_EXPR_COUNT. (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_evaluate, rasqal_expression_print, rasqal_expression_is_constant): Handle new expressions above * src/rasqal.h: rasqal_variable gains expression field. Added expression types RASQAL_EXPR_GROUP_COND_ASC, RASQAL_EXPR_GROUP_COND_DESC, RASQAL_EXPR_COUNT and RASQAL_EXPR_VARSTAR Added prototypes for query methods rasqal_query_get_explain, rasqal_query_set_explain, rasqal_query_get_group_conditions_sequence, rasqal_query_get_group_condition. Added rasqal_new_0op_expression expression constructor with no arguments, a constant. * NEWS.html, configure.ac, src/win32_rasqal_config.h: Bumped version to 0.9.14 * src/rasqal_query_results.c: (rasqal_query_results_write): Allow serializing of finished/empty results. * configure.ac: Fix GNU bison check again, using raptor style. 2007-01-22 Dave Beckett * configure.ac: make bison version check work on V1 version message format 2007-01-20 Dave Beckett * src/rasqal_internal.h: Ensure rasqal_strcasecmp and rasqal_strncasecmp get prototypes. Fixes Issue#0000160 http://bugs.librdf.org/mantis/view.php?id=160 2007-01-16 Dave Beckett * utils/roqet.c: 2007 Use rasqal_license_string and rasqal_home_url_string Add some more rasqal_finish() before exit * src/rasqal.h: Added prototypes for rasqal_license_string and rasqal_home_url_string * src/rasqal_general.c: 2007 Added rasqal_license_string and rasqal_home_url_string 2007-01-07 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_format_register_factory): Gains mime_type arg. (rasqal_init_query_results): Add mime type to query result format registrations. (rasqal_query_results_is_bindings, rasqal_query_results_is_boolean, rasqal_query_results_is_graph): True only if no results formatter is specified. (rasqal_query_results_is_syntax): Added to check if a query result is a syntax. (rasqal_query_results_formats_enumerate_full): Added to return mime type also. (rasqal_get_query_results_formatter_factory): Add mime type arg. (rasqal_query_results_formats_check): Added to check if a formatter exists for the given name, uri and/or mime type. (rasqal_new_query_results_formatter_by_mime_type): Added to construct a formatter by mime type alone. (rasqal_query_results_formatter_get_mime_type): Added to get the mime type of a built formatter. * src/rasqal.h: Added prototypes for rasqal_query_results_is_syntax, rasqal_query_results_formats_enumerate_full, rasqal_query_results_formats_check, rasqal_new_query_results_formatter_by_mime_type and rasqal_query_results_formatter_get_mime_type. * src/rasqal_query.c: (rasqal_free_query): Free query_results_formatter_name if set. * src/rasqal_internal.h: struct rasqal_query_s gains query_results_formatter_name field rasqal-0.9.33/ChangeLog.40000644000175000017500000015706410612607752011751 000000000000002006-11-26 Dave Beckett * configure.ac: libxml minimum version is now 2.6.8 since 2.6.7 crashes on PPC64 Linux. 2.6.8 was released March 2004 so this should be no burden. 2006-11-21 Dave Beckett * configure.ac: Minimum raptor version is 1.4.11 2006-10-30 Dave Beckett * Snapshotted rasqal_0_9_13 for 0.9.13 release * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): Check for RAPTOR_FEATURE_NO_NET before using it. 2006-10-29 Dave Beckett * src/rasqal_engine.c, src/rasqal_expr.c, src/rasqal_graph_pattern.c, src/rasqal_literal.c, src/rasqal_query_results.c, src/rasqal_raptor.c, src/rasqal_redland.c: Correct calls to calloc() - count first, then size. * docs/tmpl/section-general.sgml, docs/tmpl/section-query.sgml: docs 2006-10-24 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_execute_init): Add hacky top-level graph before rasqal_query_results_init() is run so that the gp_data gets set correctly. * src/sparql_lexer.l: Look for NULL *yytext at end of input instead of EOF * src/rdql_lexer.l: Look for NULL *yytext at end of input instead of EOF (rdql_copy_regex_token): int c since it may return EOF which may be negative. 2006-10-23 Dave Beckett * docs/rasqal-sections.txt: add new functions about features 2006-10-14 Dave Beckett * utils/roqet.c: Added -f/--feature option to set query features * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): Use RASQAL_FEATURE_NO_NET to enable parser RAPTOR_FEATURE_NO_NET * src/rasqal.h: Added rasqal_feature RASQAL_FEATURE_NO_NET Added prototypes for rasqal_features_enumerate, rasqal_get_feature_count, rasqal_feature_from_uri, rasqal_feature_value_type, rasqal_query_set_feature_string, rasqal_query_get_feature, rasqal_query_get_feature_string. Prototype of rasqal_query_set_feature changed to return an int. * src/rasqal_internal.h: rasqal_query_s gains features table * src/rasqal_query.c: (rasqal_query_set_feature): Now returns an int and has a feature. (rasqal_query_set_feature_string, rasqal_query_get_feature, rasqal_query_get_feature_string): Added. * src/rasqal_feature.c: Added rasqal_feature.c * src/Makefile.am: Added rasqal_feature.c 2006-10-13 Dave Beckett * src/rasqal_expr.c: (rasqal_free_triple): Free any origin. Fixes Issue#0000133 http://bugs.librdf.org/mantis/view.php?id=133 2006-10-07 Dave Beckett * src/rasqal_map.c: (rasqal_map_node_print_visit): Delete old debug messages. Fixes Issue#0000131 http://bugs.librdf.org/mantis/view.php?id=131 2006-10-05 Dave Beckett * configure.ac: More -W flags * src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Casts * utils/roqet.c: int cast * utils/roqet.c: const * src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rdql_common.h, src/rdql_lexer.l, src/sparql_common.h, src/sparql_lexer.l, src/sparql_parser.y: Add some casting around error/warning handlers. Fix a few signed/unsigned comparisons * src/rasqal_general.c: (rasqal_languages_enumerate, rasqal_escaped_name_to_utf8_string): Discard tests for unsigned int < 0. (rasqal_uri_init, rasqal_uri_finish): Use ANSI style void declaration. * src/rasqal_engine.c: (rasqal_engine_expand_wildcards): Add missing format arg in error. * configure.ac: In maintainer mode, add all the supported -W options to the MAINTAINER_CFLAGS * src/rasqal_internal.h: Added RASQAL_PRINTF_FORMAT to allow declaring of functions with a printf-style format argument declare many error/warning/*varargs prototypes with it if they take a printf-style format argument. 2006-10-01 Dave Beckett * tests/engine/Makefile.am: Add AM_CPPFLAGS/CFLAGS to allow compiling out of source dir with external raptor * utils/Makefile.am: Tidy AM_CPPFLAGS/CFLAGS to remove duplicated symbols 2006-09-28 Dave Beckett * tests/engine/rasqal_graph_test.c: Added 2nd query * tests/engine/rasqal_graph_test.c: parameterise the input data graphs * tests/engine/rasqal_graph_test.c: Add tests structure to make this more data driven. * data/graph-c.ttl: add graph-c.ttl * data/Makefile.am: graph-c.ttl * tests/engine/rasqal_graph_test.c: Rasqal RDF Query GRAPH Tests 2006-09-27 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_do_step): Added a hack to check an outer constraint expression. Fixes Issue#0000129 http://bugs.librdf.org/mantis/view.php?id=129 * tests/engine/Makefile.am: Added rasqal_graph_test.c. Invoke all tests with the data dir * tests/engine/rasqal_order_test.c: Take data dir as a parameter. 2006-09-26 Dave Beckett * docs/tmpl/section-query_results.sgml: update * data/Makefile.am, data/graph-a.ttl, data/graph-b.ttl: Add graph test data files * src/rasqal_raptor.c: (rasqal_raptor_free_triples_source): Free source URIs and literals only if allocated. * src/rasqal_engine.c: (rasqal_engine_query_results_update): Fix logic to set failed flag as well as finished flag when rasqal_engine_get_next_result fails. 2006-09-24 Dave Beckett * src/sparql_parser.y: Fix debug messages since propertyListNotEmpty is now ordered forward. * src/sparql_parser.y: (PropertyListNotEmpty, ObjectList): Take more care not to reverse order of triple patterns as they appeared in the query. * src/rasqal_engine.c: (rasqal_engine_merge_triples): Merge only all adjacent sequences of basic graph pattern triples, not anything with triples such as optional BGP triples. Fixes Issue #0000080 http://bugs.librdf.org/mantis/view.php?id=80 * ChangeLog: add fix bug note * src/rasqal_engine.c: (rasqal_engine_group_graph_pattern_get_next_match, rasqal_engine_triple_graph_pattern_get_next_match): Added from the content of rasqal_engine_graph_pattern_get_next_match. 2006-09-23 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_graph_pattern_get_next_match): Tidy code * src/rasqal_engine.c: (rasqal_reset_triple_meta): Reset executed flag. (rasqal_engine_graph_pattern_get_next_match): When an exact triple match is performed, set the executed flag and next time backtrack. Also set the flag when a pattern triple match is executed. Fixes Issue #0000094 http://bugs.librdf.org/mantis/view.php?id=94 * src/rasqal.h: rasqal_triple_meta gains executed field * src/rasqal_query_results.c: autodocs * docs/rasqal-sections.txt: Remove rasqal_query_results_syntaxes_enumerate * docs/tmpl/section-query_results_formatter.sgml: Title * docs/rasqal-overrides.txt: rasqal_graph_query_results_formatter * docs/tmpl/section-query_results_formatter.sgml: Short + long descriptions * docs/rasqal-docs.xml: Added file section-query_results_formatter.xml * docs/rasqal-sections.txt: Added section-query_results_formatter FILE * utils/roqet.c: Update to use new rasqal_query_results_formatter class. * src/rasqal_query_results.c: Reorganised to create a rasqal_query_results_formatter class for formatting query results. (rasqal_query_results_formats_enumerate): Added, renamed from rasqal_query_results_syntaxes_enumerate. (rasqal_get_query_results_formatter_factory): Added helper function. (rasqal_new_query_results_formatter): Added new constructor (rasqal_free_query_results_formatter): Added new destructor (rasqal_query_results_formatter_write): Added new writer method. (rasqal_query_results_get_results_format_uri_by_name): Deleted public function now handled by constructor. * src/rasqal_internal.h: Added rasqal_query_results_writer typedef. Added rasqal_query_results_format_factory Added struct rasqal_query_results_formatter_s * src/rasqal.h: Added rasqal_query_results_formatter class Added rasqal_query_results_formats_enumerate prototype (was rasqal_query_results_syntaxes_enumerate) Added rasqal_new_query_results_formatter, rasqal_free_query_results_formatter and rasqal_query_results_formatter_write prototypes. Deleted rasqal_query_results_get_results_format_uri_by_name prototype. * tests/engine/Makefile.am: Automakefile for query engine tests * tests/Makefile.am, tests/engine, tests/engine/rasqal_order_test.c (from /rasqal/trunk/tests/rasqal_order_test.c:11290), tests/rasqal_order_test.c: Add engine test dir and move order test there * configure.ac: Added test/engine/Makefile 2006-09-08 Dave Beckett * docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml: Updated for new functions * configure.ac: Allow LEX to be set to things that aren't exactly 'flex' 2006-09-07 Dave Beckett * src/rasqal_engine.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h: Move column field from graph_pattern to execution data * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern, rasqal_graph_pattern_add_triples): Delete fields moved to gp_data. * src/rasqal_engine.c: rasqal_engine_gp_data gains optional_graph_pattern, current_graph_pattern, optional_graph_pattern_matches_count and matches_returned (rasqal_new_gp_data, rasqal_free_gp_data): Init, free new fields. (rasqal_new_engine_execution_data, rasqal_engine_graph_pattern_reset): Add new fields. (rasqal_engine_graph_pattern_init, rasqal_engine_execute_init, rasqal_engine_move_to_graph_pattern, rasqal_engine_do_step, rasqal_engine_do_optional_step, rasqal_engine_get_next_result): Updates to use gp_data not gp for moved fields. 2006-09-06 Dave Beckett * src/rasqal_internal.h: (struct rasqal_graph_pattern_s): Loses fields optional_graph_pattern, current_graph_pattern, optional_graph_pattern_matches_count and matches_returned into execution graph pattern data. * src/rasqal_engine.c: (rasqal_engine_check_limit_offset): Another off-by-1 in offsets (rasqal_engine_execute_order): Skip initial offset of results in an ordering. * tests/rasqal_order_test.c: (main): Add limit/offset=1 tests 2006-09-04 Dave Beckett * tests/rasqal_order_test.c: Add limit & offset testing * tests/Makefile.am, tests/rasqal_order_test.c: Added query result order test * src/Makefile.am: run-rasqal-query-test: build rasqal_query_test * data/Makefile.am: added animals.nt * data/animals.nt: Animals * src/rasqal_engine.c: (rasqal_engine_graph_pattern_reset): Added, taking the resetting part of graph pattern initialising out of rasqal_engine_graph_pattern_init. (rasqal_engine_graph_pattern_init): Now just does once-only initialising, rest moved to new rasqal_engine_graph_pattern_reset. 2006-09-03 Dave Beckett * utils/roqet.c: Remove hard-coded query results format enum and use rasqal_query_results_syntaxes_enumerate to discover them and rasqal_query_results_get_results_format_uri_by_name to find them by user-specified name (-r NAME). (roqet_query_results_print_as_xml): Deleted. * src/rasqal_query_results.c: Added factory for constructing query results into a syntax: rasqal_query_results_format_factory. (rasqal_query_results_format_register_factory and rasqal_free_query_results_format_factory): Added. (rasqal_init_query_results): Added, registering all the query syntax formats using rasqal_query_results_format_register_factory. (rasqal_finish_query_results): Added. (rasqal_query_results_syntaxes_enumerate): Added to get info on query results syntaxes. (rasqal_query_results_write): Find and then use factory function writer to do all the work. (rasqal_query_results_get_results_format_uri_by_name): Added to get the URI for a query result format from it's short name. * src/rasqal.h: Added prototypes for rasqal_query_results_syntaxes_enumerate and rasqal_query_results_get_results_format_uri_by_name * src/rasqal_internal.h: Add prototypes for rasqal_init_query_results and rasqal_finish_query_results * src/rasqal_general.c: (rasqal_init): Call rasqal_init_query_results (rasqal_finish): Call rasqal_finish_query_results 2006-08-25 Dave Beckett * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_LANG - Fail if a variable has an undefined value rather than try to execute a NULL pointer. Fixes issue #0000113 http://bugs.librdf.org/mantis/view.php?id=113 2006-08-23 Dave Beckett * src/win32_rasqal_config.h: Include float.h and #define isnan. Fixes Issue #0000111 http://bugs.librdf.org/mantis/view.php?id=111 2006-08-20 Dave Beckett * autogen.sh: Track where programs are discovered. * src/rdql_parser.y: Added labels for some tokens to enable better error messages. Add %destructor to tidy up tokens when doing error recovery. * src/sparql_parser.y: Added labels for some tokens to enable better error messages. Add %destructor to tidy up tokens when doing error recovery. * configure.ac: flex check - warn before failing * configure.ac: recommend flex 2.5.33 * configure.ac: Update to point at main flex site whichq finally gets 2.5.33 after 9 years 2006-08-18 Dave Beckett * configure.ac: Strip more -O flags from incoming CFLAGS, CXXFLAGS and CPPFLAGS. * configure.ac: Patch configure.ac to remove un-necessary tests for C++ or F77++ compilers that libtool stupidly insists on 2006-07-30 Dave Beckett * src/rasqal_query.c: (rasqal_query_write_sparql_20060406): Add newline after verb when there are no args. * src/rasqal_query.c: (rasqal_query_execute): Add query/query_results link early so reference counting is done right. Fixes Issue#0000095 http://bugs.librdf.org/mantis/view.php?id=95 2006-07-05 Dave Beckett * src/rasqal_query.c: (rasqal_query_print): Rewrite many fprintf to fputs 2006-07-04 Dave Beckett * src/rasqal_engine.c: (rasqal_new_gp_data): Zero new structure * src/rasqal.h: Correct win32 static linking of rasqal Fixes Issue#0000100 http://bugs.librdf.org/mantis/view.php?id=100 * configure.ac: allow PKGCONFIG_REQUIRES to append correctly to an empty string * configure.ac, rasqal.pc.in: Fix PKGCONFIG vars not substituted correctly in configure.ac and remove @LDFLAGS from rasqal.pc.in. Fixes Issue#0000098 http://bugs.librdf.org/mantis/view.php?id=98 * src/rasqal_engine.c: Typedef rasqal_engine_gp_data gains gp and triple_meta field. (rasqal_new_gp_data): Init gp field. (rasqal_free_gp_data): Tidy up triple_meta field content. (rasqal_engine_graph_pattern_get_next_match): Get rasqal_engine_gp_data from sequence of gp_data. Take rasqal_triple_meta from that data. (rasqal_new_engine_execution_data): Init rasqal_engine_gp_data for all graph patterns. (rasqal_engine_graph_pattern_order): Renamed from rasqal_graph_pattern_order. (rasqal_engine_graph_pattern_init): Renamed from rasqal_graph_pattern_init. (rasqal_engine_execute_init): Call rasqal_engine_graph_pattern_init. (rasqal_engine_move_to_graph_pattern): Gains query_results arg. (rasqal_engine_do_step, rasqal_engine_do_optional_step): Call rasqal_engine_move_to_graph_pattern with query_results arg. * src/rasqal_graph_pattern.c: (rasqal_free_graph_pattern): Remove triple_meta cleanup. (rasqal_graph_pattern_order): Deleted and renamed to rasqal_free_gp_data. (rasqal_graph_pattern_init): Deleted and renamed to rasqal_engine_graph_pattern_init. 2006-07-03 Dave Beckett * src/rasqal_query.c: (rasqal_free_query): Free graph_patterns_sequence (rasqal_query_prepare_count_graph_patterns): Add next graph pattern to index sequence. (rasqal_query_prepare): Initialise graph_patterns_sequence using rasqal_query_graph_pattern_visit with rasqal_query_prepare_count_graph_patterns. * src/rasqal_internal.h: (struct rasqal_graph_pattern_s): Remove triple_meta field, now in engine's rasqal_engine_gp_data. rasqal_graph_pattern_init prototype removed. (struct rasqal_query_s): Add graph_patterns_sequence for getting graph pattern by an index. 2006-07-01 Dave Beckett * src/rasqal_expr.c: (rasqal_expression_evaluate): For AND and OR ops, do not free a NULL literal when tidying up on error. Fixes Issue#0000095 http://bugs.librdf.org/mantis/view.php?id=95 2006-04-30 Dave Beckett * docs/librasqal.3: Updated for 0.9.12 (too late for release) * src/rasqal_engine.c: (rasqal_engine_run): Restore query when RASQAL_DEBUG is present * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_AND and RASQAL_EXPR_OR - initialise b1 and b2 to prevent a gcc warning. They were never used unitialised by the logic but gcc couldn't tell. * src/rasqal_query_results.c: (rasqal_free_query_results): Initialise query; happily it wasn't used in 0.9.12 use case * src/rasqal_engine.c: Only define rasqal_engine_step_names for RASQAL_DEBUG * Snapshotted rasqal_0_9_12 for 0.9.12 release 2006-04-29 Dave Beckett * src/rasqal_query_results.c: (rasqal_free_query_results): Add triple field cleanup (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Update field names; query->statement to query_results->result_triple and query->triple to query_results->triple * src/rasqal_query.c: (rasqal_free_query): Remove triple field cleanup * src/rasqal_internal.h: rasqal_query loses triple and statement fields rasqal_query_statement gains them as triple and result_triple field. * src/rasqal_query_results.c: (rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_name, rasqal_query_results_get_binding_value_by_name): Allow returning name/values even if an error occurred or this is the last result. * src/rasqal_engine.c: (rasqal_engine_assign_binding_values): Deleted, only ever used once inside rasqal_engine_query_result_row_update and 2 lines long. * src/rasqal_engine.c: Moved triples_source, new_bindings_count, current_triple_result and results_sequence fields from rasqal_query_s to rasqal_query_results_s (rasqal_new_triples_match, rasqal_engine_graph_pattern_get_next_match, rasqal_engine_execute_finish, rasqal_engine_do_step, rasqal_engine_do_optional_step, rasqal_engine_get_next_result, rasqal_engine_get_results_values, rasqal_engine_get_result_value, rasqal_engine_execute_order): Use query_results arg and update for changes above. * src/rasqal_query_results.c: (rasqal_query_results_init, rasqal_free_query_results): Init and free query_results->triples_source and query_results->results_sequence. (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Use query_results->triples_source and query_results->current_triple_result * src/sparql_parser.y: Comments SPARQL 2006-04-06 * src/rasqal_query.c: (rasqal_new_query): Moved query->results_sequence to query_results. 9rasqal_query_write_sparql_20060406): Renamed from rasqal_query_write_sparql_20060125. (rasqal_query_write): Accept SPARQL 2006-04-06 and use as the default URI. * src/rasqal_internal.h: Moved triples_source, new_bindings_count, current_triple_result and results_sequence fields from rasqal_query_s to rasqal_query_results_s * src/sparql_parser.y: SPARQL grammar updates for SPARQL CR - mostly a rename and some re-ordering of rules since it was already based on an earlier pre-CR rq23 draft. (FilteredBasicGraphPattern): Renamed from BasicGraphPattern) IRIrefOrFunction remains unused/deleted since the lexer does the work for us. 2006-04-28 Dave Beckett * src/rasqal_engine.c, src/rasqal_query.c, src/rdql_parser.y, src/sparql_parser.y: rasqal_query_declare_prefix and rasqal_query_declare_prefixes in rasqal_query.c replace rasqal_engine_declare_prefix, rasqal_engine_undeclare_prefix and rasqal_engine_declare_prefixes in rasqal_engine.c since they operate before query execution * src/rasqal_internal.h: rasqal_query_declare_prefix and rasqal_query_declare_prefixes replace rasqal_engine_declare_prefix, rasqal_engine_undeclare_prefix and rasqal_engine_declare_prefixes * src/rasqal_engine.c: Many new functions moved from rasqal_query.c and rasqal_query_results.c: rasqal_engine_query_result_row_update rasqal_engine_new_query_result_row, rasqal_engine_new_query_result_row_from_query_result_row, rasqal_engine_free_query_result_row, rasqal_engine_get_results_values, rasqal_engine_get_result_value, rasqal_engine_query_result_row_print, rasqal_query_result_literal_sequence_compare, rasqal_engine_query_result_row_compare, rasqal_engine_query_results_update, rasqal_engine_map_free_query_result_row, rasqal_engine_map_print_query_result_row, rasqal_engine_map_add_to_sequence, rasqal_engine_execute_order, rasqal_engine_execute_next * src/rasqal_query_results.c: (rasqal_new_query_results, rasqal_query_results_init): Added from rasqal_query.c and now in public API. (rasqal_query_result_row_print, rasqal_query_result_literal_sequence_compare, rasqal_query_result_row_compare): Moved to rasqal_engine.c and renamed. (rasqal_free_query_results): Call renamed rasqal_engine_free_query_result_row (rasqal_query_results_next): Bulk of code moved to new rasqal_engine_execute_next() in rasqal_engine.c (rasqal_query_results_get_bindings): Results part moved to rasqal_engine_get_results_values() in rasqal_engine.c. 9rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Result part moved to rasqal_engine_get_result_value() in rasqal_engine.c * src/rasqal_query.c: (rasqal_new_query_result_row, rasqal_new_query_result_row_from_query_result_row, rasqal_query_result_row_update, rasqal_query_results_update, rasqal_map_free_query_result_row, rasqal_map_print_query_result_row, rasqal_map_add_to_sequence): Moved to rasqal_engine.c and renamed. (rasqal_new_query_results, rasqal_query_results_init): Moved to rasqal_query_results.c and now public. (rasqal_query_execute): Moved bulk of code to new rasqal_engine_execute_order(). * src/rasqal_internal.h: Added prototypes for: rasqal_engine_execute_order, rasqal_engine_free_query_result_row, rasqal_engine_get_results_values, rasqal_engine_get_result_value, rasqal_engine_execute_next, rasqal_new_query_results and and rasqal_query_results_init. Removed several prototypes now not shared between modules (and moved to rasqal_engine.c): rasqal_query_results_init, rasqal_query_result_row_update, rasqal_query_results_update, rasqal_free_query_result_row, rasqal_query_result_row_print and rasqal_query_result_row_compare 2006-04-27 Dave Beckett * utils/roqet.c: (roqet_graph_pattern_walk): Use rasqal_graph_pattern_get_index * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_index): Added. * src/rasqal.h: Added rasqal_graph_pattern_get_index prototype * utils/roqet.c: (roqet_graph_pattern_walk): Display the graph_pattern index * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_print): Display the graph_pattern index * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Set unused gp_index to -1. * src/rasqal_engine.c: (rasqal_new_triples_source, rasqal_new_engine_execution_data, rasqal_engine_execute_init, rasqal_engine_execute_finish, rasqal_engine_do_optional_step, rasqal_engine_get_next_result, rasqal_engine_run): Take rasqal_query_results arg and use finish/failed fields off query_results. * src/rasqal_query_results.c: (rasqal_free_query_results): Call rasqal_engine_execute_finish. (rasqal_query_results_next, rasqal_query_results_finished, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_name, rasqal_query_results_get_binding_value_by_name, rasqal_query_results_get_bindings_count, rasqal_query_results_get_triple, rasqal_query_results_next_triple, rasqal_query_results_get_boolean, rasqal_query_results_write): Use query_results->finished and failed. Tidy formatting and error check arguments for NULLs. * src/rasqal_query.c: (rasqal_free_query): Moved rasqal_engine_execute_finish to rasqal_free_query_results. (rasqal_query_results_update): Use query_results->finished and query_results arg for rasqal_engine_get_next_result. (rasqal_query_results_init): Init executed, abort, finished, failed and ask_result fields. (rasqal_query_execute): Remove init of query deleted fields finished, executed, ask_result. Use query_results->failed. Call rasqal_engine_execute_init and rasqal_engine_get_next_result with query_results arg. * src/rasqal_internal.h: rasqal_query_results gains fields abort, finished, executed, ask_result moved from rasqal_query rasqal_query_results gains failed field rasqal_engine_execute_init, rasqal_engine_execute_finish and rasqal_engine_run, rasqal_new_triples_source, rasqal_engine_get_next_result now take rasqal_query_results* args. * src/rasqal_query.c: (rasqal_query_prepare_count_graph_patterns): Return 0 * src/rasqal_engine.c: (rasqal_new_gp_data, rasqal_free_gp_data): Added. (rasqal_new_engine_execution_data, rasqal_free_engine_execution_data): Added to build query-engine-specific data for this query engine. (rasqal_engine_execute_init): Construct execution_data and store in the results. Run rasqal_query_results_init. (rasqal_engine_check_limit_offset): Use query_results arg. * src/rasqal_query_results.c: Updates to rename query->result_count to query_results->result_count * src/rasqal_query.c: (rasqal_query_prepare_count_graph_patterns): Added to give each graph pattern a unique index. (rasqal_query_prepare): Call rasqal_query_prepare_count_graph_patterns after all other graph pattern munging is finished to prepare for storing execution data per-gp. (rasqal_query_results_updaet): Rename query->result_count to query_results->result_count and rasqal_engine_check_limit_offset now taking a query_results arg. (rasqal_new_query_results): Added, pulled out of rasqal_query_execute. (rasqal_query_results_init): Added, to re-initialise a results object in-situ. (rasqal_query_execute): Use rasqal_new_query_results and update for query->result_count to query_results->result_count and rasqal_engine_check_limit_offset with query_results arg. * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern, rasqal_new_graph_pattern_from_triples, rasqal_new_graph_pattern_from_sequence): Protect from NULL query arg. (rasqal_new_graph_pattern_from_triples): Protect from NULL triples arg. * src/rasqal_internal.h: rasqal_graph_pattern_s gains a gp_index field to give each rasqal_graph_pattern a unique index rasqal_query_s loses result_count field and gains graph_pattern_count rasqal_engine_execution_data added with skeleton content rasqal_query_results_s gains result_count, execution_data and free_execution_data handler fields rasqal_engine_check_limit_offset now takes a rasqal_query_results parameter added prototype for rasqal_query_results_init 2006-04-26 Dave Beckett * src/rasqal.h: Added prototype for rasqal_query_get_anonymous_variable_sequence 2006-04-23 Dave Beckett * src/rasqal_query.c: (rasqal_query_get_anonymous_variable_sequence): Added to return only anonymous variables. (rasqal_query_get_all_variable_sequence): Corrected to match the definition - return all variables, not just the bound (SELECTed) ones. Fixes Issue#00000079 http://bugs.librdf.org/mantis/view.php?id=79 * docs/rasqal-sections.txt: Added rasqal_query_iostream_write_escaped_counted_string and rasqal_query_escape_counted_string * src/sparql_parser.y: (rasqal_sparql_query_engine_iostream_write_escaped_counted_string): Added to implement factory method iostream_write_escaped_counted_string * src/rasqal.h: Added prototypes for rasqal_query_iostream_write_escaped_counted_string and rasqal_query_escape_counted_string * src/rasqal_query.c: (rasqal_query_iostream_write_escaped_counted_string, rasqal_query_escape_counted_string): Added. * src/rasqal_internal.h: rasqal_query_engine_factory_s gains factory method iostream_write_escaped_counted_string 2006-04-22 Dave Beckett * tests/rdql/Makefile.am, tests/rdql/example_at_8.rdql: Remove obsolete syntax example_at_8.rdql * src/Makefile.am: tweak sibling raptor dir 2006-04-05 Dave Beckett * src/rasqal_query_results.c: Updated sparql json url 2006-03-27 Dave Beckett * win32/rasqal.vcproj: rasqal win32 build files update from John Barstow * src/win32_rasqal_config.h: rasqal win32 build files update from John Barstow * src/rasqal_expr.c: (rasqal_expression_convert_to_literal): Use standard memset not older bzero 2006-03-18 Dave Beckett * src/rasqal_query.c: (rasqal_query_write_sparql_uri): const for raptor_qname_get_namespace 2006-03-05 Dave Beckett * tests/sparql/check-sparql: Use -d debug as check-sparql relies on that to get var names * tests/rdql/testsuite/check-rdql: Use -d debug as check-sparql relies on that to get var names * tests/sparql/check-sparql: Update for new roqet args * tests/rdql/testsuite/check-rdql: Update for new roqet args * src/rasqal_query.c: (rasqal_query_write_sparql_20060125): Handle order conditions. * utils/roqet.c: -d/--dump-query now takes an argument with values 'debug' (same as old -d), 'structure' (same as -w) and new 'sparql' using rasqal_query_write -w deprectated for '-w structure' * configure.ac: Require raptor 1.4.9 now * src/rasqal_query.c: Fix AND and OR SPARQL write tokens. (rasqal_query_write_sparql_graph_pattern): Always print outer ()s for FILTER. 2006-03-05 Dave Beckett * src/rasqal_query.c: (rasqal_query_write): Added to write a query structure into a syntax onto a raptor_iostream. Implements writing SPARQL format when format_uri is NULL, http://www.w3.org/TR/rdf-sparql-query/ or http://www.w3.org/TR/2006/WD-rdf-sparql-query-20060220/ * src/rasqal.h: (rasqal_query_write): Added to write a query structure into a syntax onto a raptor_iostream. 2006-03-04 Dave Beckett * src/rdql_lexer.l: (rdql_copy_regex_token): Handle empty regex // Fixes issue#0000071 http://bugs.librdf.org/mantis/view.php?id=71 2006-02-19 Dave Beckett * src/fix-flex, src/fix-bison: 2006 * AUTHORS: update me 2006-02-16 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_write_json1): Don't write a null * src/rasqal.h: doc fix. RASQAL_EXPR_REGEX not RASQAL_EXPR_STR_REGEX * src/rasqal_query_results.c: (rasqal_query_results_write_json1): Use raptor_iostream_write_string_ntriples to do at least some core needed escapes for writing URIs and literals as strings. * utils/roqet.c: Added -r json with format_uri http://www.mindswap.org/%7Ekendall/sparql-results-json/ * src/rasqal_query_results.c: (rasqal_query_results_write): Add JSON results with URI identifier http://www.mindswap.org/%7Ekendall/sparql-results-json/ (raptor_iostream_write_json_boolean): Added to support: (rasqal_query_results_write_json1): Added for SPARQL Query Results in JSON (http://json.org/) draft Defined in http://www.mindswap.org/%7Ekendall/sparql-results-json/ Version: alt-ser-sparql.rst,v 1.3 2006/02/16 16:03:08 k Exp * src/rasqal_internal.h: Add internal rasqal_prefix_id prototype * src/rasqal_query.c: (rasqal_prefix_id): Internal but no longer inline static. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: split query into query+results files * src/rasqal_query_results.c (from /rasqal/trunk/src/rasqal_query.c:5450): copied rasqal_query.c rasqal_query_results.c to split query from results 2006-01-22 Dave Beckett * tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am: Edit failures reporting message for consistency * tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am: All tests pass * tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am: All tests pass * tests/sparql/part1/Makefile.am: dawg-opt-query-003 passes (again). All tests now pass. * tests/sparql/ValueTesting/Makefile.am: adjust failures order to match manifest * tests/sparql/regex/Makefile.am: regex-query-003 passes. All tests now pass. * src/sparql_parser.y: (RegexExpression): Build new RASQAL_EXPR_REGEX expressions. * src/rasqal_engine.c: (rasqal_engine_check_constraint): On an error return - type error - return false rather than failing query. * src/rasqal_literal.c: (rasqal_literal_as_string_flags) :Added, with flags and error to allow default failure for as_string on URI literals when flags is set to RASQAL_COMPARE_XQUERY. (rasqal_literal_as_string): Rewritten to wrap rasqal_literal_as_string_flags. * src/rasqal_expr.c: (rasqal_new_3op_expression): Added, for new 3-expression arg RASQAL_EXPR_REGEX (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_evaluate, rasqal_expression_print, rasqal_expression_is_constant): Added support for RASQAL_EXPR_REGEX. (rasqal_expression_evaluate): Use rasqal_literal_as_string_flags for conversions and return failure if error is set. For EXPR_STR ignore RASQAL_COMPARE_XQUERY flag to allow explicit stringify to work. Add EXPR_REGEX using same code as RASQAL_EXPR_STR_N?MATCH but with expression arguments for literal and flags. Modify EXPR_CAST to use rasqal_literal_as_string_flags. (array rasqal_op_labels): Add regex. * src/rasqal.h: rasqal_op gains RASQAL_EXPR_REGEX value rasqal_expression gains arg3 field. Added rasqal_new_3op_expression for new 3-expression arg RASQAL_EXPR_REGEX Added rasqal_literal_as_string_flags * tests/sparql/examples/Makefile.am: sparql-query-example-e broken again * src/sparql_parser.y, src/sparql_lexer.l: Delete ~ token - long gone from SPARQL. * src/sparql_parser.y: Define DEBUG_FH as where debug messages go, rather than burn in stdout. * src/sparql_parser.y: (BasicGraphPatternRestOpt): Deleted, merged into BasicGraphPattern (GraphPattern): Added more verbose debug messages. (BasicGraphPattern): Inlined BasicGraphPatternRestOpt. This is now always a group. Constraint are moved from the empty graph pattern they are created on, onto the group graph pattern. BlockOfTriplesOpt is pushed to the start of the group each time. For the BasicGraphPattern alone, the new group is initialised, possibly being empty. * src/rasqal_query.c: (rasqal_query_prepare): Use a loop with a modified flag to repeat modifying query until nothing more is done. Add super verbose debug messages. Make rasqal_engine_merge_graph_patterns visit the query graph pattern. * src/rasqal_engine.c: (rasqal_engine_move_constraints): Added, to move constraints about when merging graph patterns in rasqal_engine_join_graph_patterns (rasqal_engine_merge_graph_patterns): Set modified flag when changes happen. If result is basic but contains graph patterns, turn it back to a group type. (rasqal_engine_merge_triples): Set modified flag. (rasqal_engine_remove_empty_group_graph_patterns): Added to remove empty - zero length - sequences of graph patterns in groups. * src/rasqal_internal.h: Add prototypes for rasqal_engine_remove_empty_group_graph_patterns and rasqal_engine_move_constraints * src/sparql_parser.y: Update for rq23 changes. (TriplesDotListOpt): Added. (TriplesSameSubject, TriplesSameSubjectDotListOpt, BlockOfTriplesOpt): Added, rougly replacing Triples and TriplesOpt. (BasicGraphPattern, BasicGraphPatternRestOpt): Added, roughly replacing GraphPattern1Opt * tests/sparql/examples/Makefile.am: sparql-query-example-e works again * tests/sparql/SyntaxDev/Makefile.am: Added check-sparql-correct to recursive rules * tests/sparql/Makefile.am: Added check-sparql-correct to recursive rules * src/rasqal_engine.c: (rasqal_engine_join_graph_patterns): Protect from NULL args. * src/rasqal_engine.c: (rasqal_engine_group_2_graph_patterns): Added. * src/rasqal_internal.h: Added prototype for rasqal_engine_group_2_graph_patterns * src/rasqal_engine.c: (rasqal_engine_new_graph_pattern_from_formula): Added. * src/rasqal_internal.h: Added prototypes for rasqal_formula_join and rasqal_engine_new_graph_pattern_from_formula * src/rasqal_literal.c: (rasqal_formula_join): Added. 2006-01-21 Dave Beckett * src/sparql_parser.y: (OrderCondition): Removed deprecated ASC[] and DESC[] syntax. * src/sparql_parser.y: (TriplesSameSubject): Renamed from Triples1, after rq23. * tests/sparql/part1/Makefile.am: dawg-opt-query-003 now fails * tests/sparql/examples/Makefile.am: sparql-query-example-e now fails * tests/sparql/ValueTesting/extendedType-ne-pass.rq: removed unused test extendedType-ne-pass.rq * tests/sparql/ValueTesting/Makefile.am: Remove extendedType-ne-pass.rq from distribution, old syntax and not in the dawg test suite. * tests/sparql/SyntaxFull/Makefile.am: Now no expected failures * src/sparql_parser.y: Put tests in debug messages around additional optional values. (FunctionCall): For a function with no arguments, create an empty sequence here as it is not done in ArgsList. * src/rasqal_query.c: (rasqal_query_prepare): Call rasqal_engine_build_constraints_expression here. * src/rasqal_engine.c: (rasqal_engine_prepare, rasqal_engine_merge_triples): Remove rasqal_engine_build_constraints_expression, done by rasqal_query_prepare. 2006-01-20 Dave Beckett * tests/sparql/SyntaxDev/Makefile.am: Added check-sparql-lexer and check-sparql-parser recursive tasks * tests/sparql/Makefile.am: Added check-sparql-lexer and check-sparql-parser recursive tasks * src/rasqal_graph_pattern.c: (rasqal_free_graph_pattern): Let raptor_free_sequence tidy up constraints and rasqal_free_expression do the tree of expressions. (rasqal_graph_pattern_add_constraint): Init destructor when making a new sequence. * src/rasqal_expr.c: (rasqal_expression_convert_to_literal): Copy usage to new expression literal. * src/rasqal_engine.c: (rasqal_engine_build_constraints_expression): Copy expressions when building, easier to keep clear. (rasqal_engine_join_graph_patterns): Tidy long line. Do not delete parts of source gp expressions, the destructor will do that anyway. 2006-01-17 Dave Beckett * src/sparql_parser.y: Major update to align with SPARQL grammar terms. Not yet completed. Down to 1 shift/reduce conflict Renamed many terms to match SPARQL (rq23) tokens. Subject => VarOrTerm, Predicate => Verb, PropertyList => PropertyListOpt, PropertyListTail => PropertyListTailOpt (PatternElement, PatternsEelementList, UnionGraphPattern, UnionGraphPatternList): Deleted (TriplesDotListOpt, Triples1 TriplesOpt, PropertyListNotEmpty, GroupOrUnionGraphPattern, GroupOrUnionGraphPatternList, GraphPatternNotTriples GraphPattern1Opt): Added. * src/fix-bison: Remove malloc/free prototypes * tests/sparql/ValueTesting/Makefile.am: sort test and query files by name * tests/sparql/ValueTesting/Makefile.am, tests/sparql/ValueTesting/boolean-0.n3, tests/sparql/ValueTesting/boolean-EBV-canonical-result.n3, tests/sparql/ValueTesting/boolean-EBV-canonical.rq, tests/sparql/ValueTesting/boolean-equiv-FALSE.rq, tests/sparql/ValueTesting/boolean-equiv-TRUE.rq, tests/sparql/ValueTesting/boolean-equiv-xsdType.rq, tests/sparql/ValueTesting/boolean-false-canonical-result.n3, tests/sparql/ValueTesting/boolean-false-canonical.rq, tests/sparql/ValueTesting/boolean-logical-OR.rq, tests/sparql/ValueTesting/boolean-true-canonical-result.n3, tests/sparql/ValueTesting/boolean-true-canonical.rq, tests/sparql/ValueTesting/manifest.n3: Added boolean-true-canonical boolean-EBV-canonical from DAWG CVS 2006-01-16 Dave Beckett * rasqal.rdf.in: use download.librdf.org * utils/roqet.1: Document --exec and update synopsis for exec use. * src/win32_rasqal_config.h, configure.ac: Bumped version to 0.9.12 2006-01-15 Dave Beckett * tests/rdql/testsuite/README-RDQL-tests.txt, tests/rdql/testsuite/copyright.txt, tests/rdql/testsuite/model0.nt, tests/rdql/testsuite/model1.nt, tests/rdql/testsuite/model2.nt, tests/rdql/testsuite/model3.nt, tests/rdql/testsuite/model4.nt, tests/rdql/testsuite/model5.nt, tests/rdql/testsuite/model5.rdf, tests/rdql/testsuite/model6.nt, tests/rdql/testsuite/model7.nt, tests/rdql/testsuite/model8.n3, tests/rdql/testsuite/model9.n3, tests/rdql/testsuite/modelA.nt, tests/rdql/testsuite/query-dump, tests/rdql/testsuite/result-0-01.n3, tests/rdql/testsuite/result-0-02.n3, tests/rdql/testsuite/result-0-04.n3, tests/rdql/testsuite/result-1-01.n3, tests/rdql/testsuite/result-1-02.n3, tests/rdql/testsuite/result-1-03.n3, tests/rdql/testsuite/result-1-04.n3, tests/rdql/testsuite/result-1-08.n3, tests/rdql/testsuite/result-2-01.n3, tests/rdql/testsuite/result-2-02.n3, tests/rdql/testsuite/result-2-04.n3, tests/rdql/testsuite/result-2-05.n3, tests/rdql/testsuite/result-2-06.n3, tests/rdql/testsuite/result-2-07.n3, tests/rdql/testsuite/result-2-08.n3, tests/rdql/testsuite/result-2-09.n3, tests/rdql/testsuite/result-2-10.n3, tests/rdql/testsuite/result-3-01.n3, tests/rdql/testsuite/result-3-02.n3, tests/rdql/testsuite/result-3-03.n3, tests/rdql/testsuite/result-3-04.n3, tests/rdql/testsuite/result-3-05.n3, tests/rdql/testsuite/result-3-06.n3, tests/rdql/testsuite/result-3-07.n3, tests/rdql/testsuite/result-4-01.n3, tests/rdql/testsuite/result-4-02.n3, tests/rdql/testsuite/result-4-03.n3, tests/rdql/testsuite/result-4-04.n3, tests/rdql/testsuite/result-4-05.n3, tests/rdql/testsuite/result-4-06.n3, tests/rdql/testsuite/result-4-07.n3, tests/rdql/testsuite/result-5-01.n3, tests/rdql/testsuite/result-5-03.n3, tests/rdql/testsuite/result-5-04.n3, tests/rdql/testsuite/result-6-01.n3, tests/rdql/testsuite/result-6-03.n3, tests/rdql/testsuite/result-6-04.n3, tests/rdql/testsuite/result-7-01.n3, tests/rdql/testsuite/result-7-02.n3, tests/rdql/testsuite/result-7-03.n3, tests/rdql/testsuite/result-7-04.n3, tests/rdql/testsuite/result-8-01.n3, tests/rdql/testsuite/result-8-02.n3, tests/rdql/testsuite/result-8-03.n3, tests/rdql/testsuite/result-8-04.n3, tests/rdql/testsuite/result-8-05.n3, tests/rdql/testsuite/result-9-01.n3, tests/rdql/testsuite/result-9-02.n3, tests/rdql/testsuite/result-A-01.n3, tests/rdql/testsuite/result-A-02.n3, tests/rdql/testsuite/result-B-01.n3, tests/rdql/testsuite/result-B-02.n3, tests/rdql/testsuite/result-B-03.n3, tests/rdql/testsuite/result-B-04.n3, tests/rdql/testsuite/result-B-05.n3, tests/rdql/testsuite/result-B-06.n3, tests/rdql/testsuite/result-B-08.n3, tests/rdql/testsuite/result-B-09.n3, tests/rdql/testsuite/result-B-10.n3, tests/rdql/testsuite/result-B-11.n3, tests/rdql/testsuite/result-B-12.n3, tests/rdql/testsuite/result-B-13.n3, tests/rdql/testsuite/result-B-14.n3, tests/rdql/testsuite/result-B-15.n3, tests/rdql/testsuite/result-B-16.n3, tests/rdql/testsuite/result-B-17.n3, tests/rdql/testsuite/result-B-18.n3, tests/rdql/testsuite/result-B-19.n3, tests/rdql/testsuite/result-B-20.n3, tests/rdql/testsuite/result-S-02.n3, tests/rdql/testsuite/result-S-03.n3, tests/rdql/testsuite/result-S-04.n3, tests/rdql/testsuite/result-S-05.n3, tests/rdql/testsuite/result-T-02.n3, tests/rdql/testsuite/result-T-03.n3, tests/rdql/testsuite/result-T-04.n3, tests/rdql/testsuite/result-T-06.n3, tests/rdql/testsuite/result-T-09.n3, tests/rdql/testsuite/test-0-01, tests/rdql/testsuite/test-0-02, tests/rdql/testsuite/test-0-03, tests/rdql/testsuite/test-0-04, tests/rdql/testsuite/test-1-01, tests/rdql/testsuite/test-1-02, tests/rdql/testsuite/test-1-03, tests/rdql/testsuite/test-1-04, tests/rdql/testsuite/test-1-05, tests/rdql/testsuite/test-1-06, tests/rdql/testsuite/test-1-07, tests/rdql/testsuite/test-1-08, tests/rdql/testsuite/test-1-09, tests/rdql/testsuite/test-1-10, tests/rdql/testsuite/test-2-01, tests/rdql/testsuite/test-2-02, tests/rdql/testsuite/test-2-03, tests/rdql/testsuite/test-2-04, tests/rdql/testsuite/test-2-05, tests/rdql/testsuite/test-2-06, tests/rdql/testsuite/test-2-07, tests/rdql/testsuite/test-2-08, tests/rdql/testsuite/test-2-09, tests/rdql/testsuite/test-2-10, tests/rdql/testsuite/test-3-01, tests/rdql/testsuite/test-3-02, tests/rdql/testsuite/test-3-03, tests/rdql/testsuite/test-3-04, tests/rdql/testsuite/test-3-05, tests/rdql/testsuite/test-3-06, tests/rdql/testsuite/test-3-07, tests/rdql/testsuite/test-4-01, tests/rdql/testsuite/test-4-02, tests/rdql/testsuite/test-4-03, tests/rdql/testsuite/test-4-04, tests/rdql/testsuite/test-4-05, tests/rdql/testsuite/test-4-06, tests/rdql/testsuite/test-4-07, tests/rdql/testsuite/test-5-01, tests/rdql/testsuite/test-5-02, tests/rdql/testsuite/test-5-03, tests/rdql/testsuite/test-5-04, tests/rdql/testsuite/test-6-01, tests/rdql/testsuite/test-6-02, tests/rdql/testsuite/test-6-03, tests/rdql/testsuite/test-6-04, tests/rdql/testsuite/test-7-01, tests/rdql/testsuite/test-7-02, tests/rdql/testsuite/test-7-03, tests/rdql/testsuite/test-7-04, tests/rdql/testsuite/test-8-01, tests/rdql/testsuite/test-8-02, tests/rdql/testsuite/test-8-03, tests/rdql/testsuite/test-8-04, tests/rdql/testsuite/test-8-05, tests/rdql/testsuite/test-9-01, tests/rdql/testsuite/test-9-02, tests/rdql/testsuite/test-A-01, tests/rdql/testsuite/test-A-02, tests/rdql/testsuite/test-B-01, tests/rdql/testsuite/test-B-02, tests/rdql/testsuite/test-B-03, tests/rdql/testsuite/test-B-04, tests/rdql/testsuite/test-B-05, tests/rdql/testsuite/test-B-06, tests/rdql/testsuite/test-B-07, tests/rdql/testsuite/test-B-08, tests/rdql/testsuite/test-B-09, tests/rdql/testsuite/test-B-10, tests/rdql/testsuite/test-B-11, tests/rdql/testsuite/test-B-12, tests/rdql/testsuite/test-B-13, tests/rdql/testsuite/test-B-14, tests/rdql/testsuite/test-B-15, tests/rdql/testsuite/test-B-16, tests/rdql/testsuite/test-B-17, tests/rdql/testsuite/test-B-18, tests/rdql/testsuite/test-B-19, tests/rdql/testsuite/test-B-20, tests/rdql/testsuite/test-S-01, tests/rdql/testsuite/test-S-02, tests/rdql/testsuite/test-S-03, tests/rdql/testsuite/test-S-04, tests/rdql/testsuite/test-S-05, tests/rdql/testsuite/test-T-01, tests/rdql/testsuite/test-T-02, tests/rdql/testsuite/test-T-03, tests/rdql/testsuite/test-T-04, tests/rdql/testsuite/test-T-05, tests/rdql/testsuite/test-T-06, tests/rdql/testsuite/test-T-07, tests/rdql/testsuite/test-T-08, tests/rdql/testsuite/test-T-09, tests/rdql/testsuite/test-T-10, tests/rdql/testsuite/vc-db-1.rdf, tests/rdql/testsuite/vc-db-2.rdf, tests/rdql/testsuite/vc-db-3.rdf: Restore CRLF end of lines, set svn:eol-style CRLF * win32/rasqal.dsp, win32/rasqal.dsw, win32/rasqal.vcproj: Restore CRLF end of lines, set svn:eol-style CRLF * src/rdql_lexer.l: Fix C++ comment regex to work with multiple line endings. * .cvsignore, data/.cvsignore, docs/.cvsignore, src/.cvsignore, tests/.cvsignore, tests/rdql/.cvsignore, tests/rdql/testsuite/.cvsignore, tests/sparql/.cvsignore, tests/sparql/Expr1/.cvsignore, tests/sparql/Expr2/.cvsignore, tests/sparql/ExprBuiltins/.cvsignore, tests/sparql/ExprEquals/.cvsignore, tests/sparql/SyntaxDev/.cvsignore, tests/sparql/SyntaxDev/Syntax-SPARQL/.cvsignore, tests/sparql/SyntaxDev/Syntax-SPARQL2/.cvsignore, tests/sparql/SyntaxDev/Syntax-SPARQL3/.cvsignore, tests/sparql/SyntaxFull/.cvsignore, tests/sparql/ValueTesting/.cvsignore, tests/sparql/bound/.cvsignore, tests/sparql/examples/.cvsignore, tests/sparql/part1/.cvsignore, tests/sparql/regex/.cvsignore, tests/sparql/simple/.cvsignore, tests/sparql/sort/.cvsignore, tests/sparql/survey/.cvsignore, tests/sparql/syntax/.cvsignore, utils/.cvsignore, win32/.cvsignore: Delete .cvsignore * Switched to Subversion version control. CVS tag for rasqal 0.9.11: rasqal_0_9_11 Subversion revision ID for rasqal 0.9.11: r5375 * Snapshotted rasqal_0_9_11 for 0.9.11 release * docs/librasqal.3: Updates for 0.9.11 * fix-groff-xhtml: style edits * src/rasqal_query.c: Change results indexing when using ORDER; the query->results_count is now a count (again) so starts from 1 when there is at least 1 result, indexing into item 0 of the query->results_sequence sequence. (rasqal_query_results_update): If result_count goes beyond range, adjust it down and return. (rasqal_query_execute): If a results sequence is created, but it is empty, set result count to 0, otherwise immediately check if it is finished by the limit/offset rules. (rasqal_query_results_next): Check result_count is finished and adjust down if it was. (rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Adjusted to use result_count offset -1. Fixes Issue#0000064 - http://bugs.librdf.org/mantis/view.php?id=64 * src/rasqal_engine.c (rasqal_engine_check_limit_offset): Do not muck about with result_count here. 2006-01-12 Dave Beckett * tests/sparql/ValueTesting/Makefile.am: Add boolean tests to dist. * src/rasqal_literal.c (rasqal_literal_string_to_native): Accept "1" as an xsd:boolean true. 2006-01-11 Dave Beckett * tests/sparql/ValueTesting/boolean-0.n3, tests/sparql/ValueTesting/boolean-equiv-FALSE-result.n3, tests/sparql/ValueTesting/boolean-equiv-FALSE.rq, tests/sparql/ValueTesting/boolean-equiv-TRUE-result.n3, tests/sparql/ValueTesting/boolean-equiv-TRUE.rq, tests/sparql/ValueTesting/boolean-equiv-xsdType-result.n3, tests/sparql/ValueTesting/boolean-equiv-xsdType.rq, tests/sparql/ValueTesting/boolean-logical-OR-result.n3, tests/sparql/ValueTesting/boolean-logical-OR.rq, tests/sparql/ValueTesting/manifest.n3: Added more boolean tests from DAWG (unapproved) 2006-01-10 Dave Beckett * src/rasqal_engine.c (rasqal_graph_pattern_get_next_match, rasqal_engine_get_next_result): Return errors when query fails due to unimplemented sequence/union of graph patterns. * src/rasqal_query.c (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Do not crash with DESCRIBE, return an empty graph always. Fixes Issue#0000050 - http://bugs.librdf.org/mantis/view.php?id=50 2006-01-06 Dave Beckett * configure.ac: Add --disable-pcre and --disable-xml2 options to configure to prevent automatic use of libpcre or libxml2 when found. Patch from Mike Frysinger. Addresses Issue#0000052 - http://bugs.librdf.org/mantis/view.php?id=52 * src/rasqal.h: rasqal_op: RASQAL_EXPR_LANGMATCHES is last * src/rasqal_expr.c (rasqal_expression_evaluate): Make LANG() return "" for non-literals as tests depend on it. Return "" not "-". Update LANGMATCHES() to make the wildcard the second arg; still does not do proper subtag matches. * tests/sparql/ExprBuiltins/Makefile.am: q-langMatches-1 works 2006-01-05 Dave Beckett * src/rasqal_query.c: Do not emit XML header here as raptor 1.4.8 xml writer does that automatically now. 2006-01-03 Dave Beckett * tests/sparql/ValueTesting/Makefile.am: Added expected test failures: typePromotion-decimal-decimal-fail * tests/sparql/ExprBuiltins/Makefile.am: Added expected test failures: datatype-1 LangMatches-1 LangMatches-2 LangMatches-3 LangMatches-4 * tests/sparql/ExprBuiltins/data-builtin-1.ttl, tests/sparql/ExprBuiltins/data-langMatches.ttl, tests/sparql/ExprBuiltins/manifest.ttl, tests/sparql/ExprBuiltins/q-iri-1.rq, tests/sparql/ExprBuiltins/q-langMatches-1.rq, tests/sparql/ExprBuiltins/q-langMatches-2.rq, tests/sparql/ExprBuiltins/q-langMatches-3.rq, tests/sparql/ExprBuiltins/q-langMatches-4.rq, tests/sparql/ExprBuiltins/result-iri-1.ttl, tests/sparql/ExprBuiltins/result-langMatches-1.ttl, tests/sparql/ExprBuiltins/result-langMatches-2.ttl, tests/sparql/ExprBuiltins/result-langMatches-3.ttl, tests/sparql/ExprBuiltins/result-langMatches-4.ttl, tests/sparql/ExprBuiltins/result-str-4.ttl, tests/sparql/ExprEquals/result-eq2-1.ttl, tests/sparql/ExprEquals/result-eq2-graph-1.ttl, tests/sparql/ValueTesting/dateTime-tz0.rq, tests/sparql/ValueTesting/dateTime-tz1.rq, tests/sparql/ValueTesting/extendedType-ne-pass.rq, tests/sparql/ValueTesting/manifest.n3, tests/sparql/ValueTesting/roman-result.n3, tests/sparql/ValueTesting/typePromotion-0.n3, tests/sparql/ValueTesting/typePromotion-decimal-decimal-fail-result.n3, tests/sparql/ValueTesting/typePromotion-decimal-decimal-fail.rq, tests/sparql/ValueTesting/typePromotion-decimal-decimal-pass-result.n3, tests/sparql/ValueTesting/typePromotion-decimal-decimal-pass.rq: Updated DAWG test cases from CVS 2006-01-02 2006-01-02 Dave Beckett * tests/sparql/ExprEquals/result-eq2-graph-1.ttl: new result * docs/tmpl/section-literal.sgml: Added rasqal_new_decimal_literal * docs/tmpl/section-expression.sgml: Added @RASQAL_EXPR_LANGMATCHES: * src/rasqal_literal.c: autodocs * docs/rasqal-sections.txt: Added rasqal_new_decimal_literal * src/sparql_parser.y: Updates for SPARQL Query Language for RDF, 23 November 2005 http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/ Including many renamings of tokens to match grammar. (DECIMAL_LITERAL): Added. (GraphNodeListNotEmpty): Renamed from ItemList (GraphNode): Renamed from Object (GraphTerm): Renamed from RDFTerm. Added DECIMAL_LITERAL option. (VarOrTerm): Added. (VarOrBnodeOrURI): Replaced by VarOrBlankNodeOrIRIref. (Select/Construct/Describe/AskQuery): Renamed from *Clause. (Prolog): Re-added. (BuiltInCall): Added LANGMATCHES option. * src/sparql_lexer.l (DECIMAl, DOUBLE, EXPONENT): Added. Support SPARQL decimal and double literal syntax and return new DECIMAL_LITERAL when there is a '.' else FLOATING_LITERAL with an EXPONENT * src/rasqal_literal.c (rasqal_new_decimal_literal): Added to make a decimal literal (xsd:decimal). * src/rasqal.h: Added prototype for rasqal_new_decimal_literal * tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am: syntax-general-03.rq and syntax-function-01.rq now work (7 failures remain) * tests/sparql/ExprEquals/result-eq2-1.ttl, tests/sparql/ExprEquals/query-eq-2.rq, tests/sparql/ExprEquals/query-eq-graph-2.rq, tests/sparql/ExprEquals/Makefile.am, tests/sparql/ExprEquals/data-eq.ttl, tests/sparql/ExprEquals/manifest.n3: Updates for decimal syntax changes and equality rules 2006-01-01 Dave Beckett * src/sparql_parser.y (PrefixDeclOpt): gcc const string warning fix. * src/sparql_parser.y (PrefixDeclOpt): Generate a warning if a PREFIX appears more than once. Check added after update in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/ * src/rasqal_expr.c (rasqal_expression_evaluate): Added SPARQL trinary logic evaluation of AND and OR expressions for T,F,E following the truth table in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/#truthTable * src/rasqal_expr.c (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_print, rasqal_expression_is_constant): Added SPARQL_EXPR_LANGMATCHEs to switch statements as a new 2-argument expression. (rasqal_expression_evaluate): Added a simple evaluation for SPARQL_EXPR_LANGMATCHES that handles '*' and otherwise does a case independent string compare. This is not a full implementation by any means. Support for the new SPARQL keyword langMatches added in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/ * src/sparql_parser.y (BuiltInCall): Added SPARQL langMatches 2-argument expresson after addition in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/ * src/rasqal.h: Added SPARQL_EXPR_LANGMATCHES for SPARQL langMatches expression * src/sparql_lexer.l: Allow _ at the start of sparql variable names, as changed in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/ (enum sparql_name_check_flags): Remove SPARQL_NAME_CHECK_NO_UL_FIRST for varname. (NCCHAR1p): Renamed from NCCHAR1 - no _. (NCCHAR1): Added to aloow _ (VARNAME, NCCHAR, NCNAME): No need to use _ here, NCCHAR1 has it. (NCNAME_PREFIX): Use NCCHAR1p at start, no _ still. * src/sparql_lexer.l, src/sparql_parser.y: Added LANGMATCHES token (case independent) new in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/ * src/sparql_lexer.l: Allow isiri (case independent) returning ISURI token rasqal-0.9.33/LICENSE.txt0000644000175000017500000000544512271270561011650 00000000000000 Rasqal RDF Query Library - License This package is Free Software available under any one of the specified licenses below. All the licenses below are alternatives and if you select one license, that one alone applies. 1. The GNU Lesser General Public License (LGPL) Version 2.1 or any newer version See http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html or COPYING.LIB for the full license text. __________________________________________________________________ Copyright (C) 2000-2014 David Beckett Copyright (C) 2000-2005 University of Bristol. All Rights Reserved. This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License Version 2.1 as published by the Free Software Foundation or any newer version. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License Version 2.1 for more details. You should have received a copy of the GNU Lesser General Public License Version 2.1 along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA __________________________________________________________________ 2. GNU General Public License (GPL) V2 or any newer version Under Term 3 of the LGPL Version 2.1, you may choose to license the entire package under the GPL. If that option is chosen, then this package is licensed under the terms of the GPL Version 2 or alternatively, any newer version of the GPL. See COPYING for the full GPL license text. 3. The Apache License V2.0 or any newer version See LICENSE-2.0.txt for the full license text. Copyright (C) 2000-2014 David Beckett Copyright (C) 2000-2005 University of Bristol. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. The NOTICE file contains the notices that must be applied according to section 4(d) of the Apache License, Version 2.0. __________________________________________________________________ Copyright (C) 2003-2014 Dave Beckett Copyright (C) 2003-2005 University of Bristol rasqal-0.9.33/ChangeLog.20000644000175000017500000030706310256266203011737 000000000000002004-12-31 Dave Beckett * rasqal_query.c (rasqal_query_results_write): Added, writing query results in form of http://www.w3.org/TR/2004/WD-rdf-sparql-XMLres-20041221/ * sparql_parser.y: Undef RASQAL_DEBUG 2 always 2004-12-23 Dave Beckett * rasqal_query.c (rasqal_free_query): Free variables last. * sparql_lexer.l: LANGUAGETOKEN, PREFIX QNAME use explicit ranges and expand to allow UTF8 \x80-\xff. {NAME}: Use sparql_copy_name .: Add \r\n to silence -s warning. {PREFIX}".": Use sparql_copy_name .: Add \r\n to silence -s warning. {QNAME}: Use sparql_copy_qname (sparql_copy_name): Added and checks XML name is OK. (sparql_copy_qname): Renamed from rdql_copy_token, and checks XML names are OK, before and after : (sparql_token_free): Free qname strings before they are made into URIs. (main): Free query_string. * rdql_lexer.l: LANGUAGETOKEN, PREFIX QNAME use explicit ranges and expand to allow UTF8 \x80-\xff. <*>{NAME}: Use rdql_copy_name .: Add \r\n to silence -s warning. {QNAME}: Use rdql_copy_qname \<{QNAME}\>: Use rdql_copy_qname (rdql_copy_name): Added and checks XML name is OK. (rdql_copy_qname): Renamed from rdql_copy_token, and checks XML names are OK, before and after : (rdql_token_free): Free qname strings before they are made into URIs. (main): Free query_string. 2004-12-08 Dave Beckett * tests/rdql/testsuite/Makefile.am (check-rdql-correct): Set PATH then use -s $(srcdir) rather than lots of envariable passing. * tests/rdql/testsuite/check-rdql: Merged in changes from check-sparql - use -s . argument now. * rasqal_engine.c (rasqal_engine_execute_init): Init current_graph_pattern only if there are graph patterns. (rasqal_engine_get_next_result): Handle 0 graph patterns. * tests/sparql/syntax/Makefile.am: Added manifest.n3 Invoke check-sparql-correct test * tests/sparql/syntax/manifest.n3: Test manifest * tests/sparql/syntax/result-0triples.n3: select with 0 triples result * tests/sparql/syntax/Makefile.am: Added 0triples.rq * tests/sparql/syntax/0triples.rq: Zero graph pattern triples * tests/sparql/syntax/data.n3: typos 2004-12-07 Dave Beckett * sparql_parser.y (PatternElementForms): Handle empty GraphPattern1 (NULL sequences) * tests/sparql/part1/dawg-data-01.n3, tests/sparql/part1/dawg-query-002, tests/sparql/simple/dawg-tp-04.rq, tests/sparql/simple/dawg-data-01.n3: foaf:knowns to foaf:knows 2004-11-30 Dave Beckett * tests/sparql/examples/ex2-1a-result.n3, tests/sparql/examples/ex2-2a-result.n3, tests/sparql/examples/ex2-3a-result.n3, tests/sparql/examples/ex2-4a-result.n3, tests/sparql/examples/ex3-result.n3: . 2004-11-29 Dave Beckett * rasqal_expr.c (rasqal_expression_evaluate): UMINUS, PLUS, MINUS, STAR, SLASH are now done with floating literals. * rasqal_internal.h: Export rasqal_literal_as_floating * rasqal_literal.c (rasqal_new_floating_literal): Changed to take a double arg (rasqal_literal_as_floating): Export. (rasqal_literal_compare): Improve promotion. Promote to float where needed, especially assuming strings could be a float. * sparql_lexer.l, rdql_lexer.l: Do sscanf here and call rasqal_new_floating_literal with the double. * rasqal.h: rasqal_new_floating_literal takes a double arg * tests/sparql/check-sparql, tests/rdql/testsuite/check-rdql: Do the diff backwards - from expected to actual * tests/sparql/part1/dawg-result-002.n3, tests/sparql/part1/dawg-result-003.n3, tests/sparql/simple/result-tp-01.n3, tests/sparql/simple/result-tp-02.n3, tests/sparql/simple/result-tp-03.n3, tests/sparql/simple/result-tp-04.n3, tests/sparql/part1/dawg-result-001.n3: Update to DAWG latest results removing rs:size triples. * rasqal_literal.c (rasqal_literal_as_integer): For RASQAL_LITERAL_STRING, also try to evaluate it as a double with strtod, then return that cast to int if it worked. * sparql_parser.y, rdql_parser.y (UnaryExpression): Make unary plus and minus work; removes 2 shift/reduce conflicts. * rasqal_expr.c: (rasqal_free_expression, rasqal_expression_foreach, rasqal_expression_evaluate, rasqal_expression_print): Added RASQAL_EXPR_UMINUS support. rasqal_op_labels: added uminus * rasqal.h: Added RASQAL_EXPR_UMINUS 2004-11-26 Dave Beckett * configure.ac: --with-dmalloc default is now no 2004-11-21 Dave Beckett * rasqal_engine.c (rasqal_new_graph_pattern_from_triples): Init current column to -1 so no execution or tidy happens. (rasqal_free_graph_pattern): Clean up until reach start_column, not 0. (rasqal_graph_pattern_init): Do triple init work only if there are triples. * sparql_parser.y: s/puts/fputs(..., stdout)/ * rasqal_engine.c (rasqal_new_graph_pattern_from_sequence): Fold sequence of 1 graph pattern into the return value, tidying up. (rasqal_graph_pattern_print): Print just the triple columns that are used. Print flags using words. (rasqal_graph_pattern_get_next_match): Note failing not-implemented sequence of graph_patterns. (rasqal_engine_prepare): Do not invoke rasqal_query_order_triples - does not make sense to do with the graph_pattern code. (rasqal_engine_get_next_result): Note failing not-implemented sequence of graph_patterns. Debug message when an optional graph pattern failed to patch. * rasqal_expr.c (rasqal_variable_set_value): Debug fatal error when there is no name. 2004-11-20 Dave Beckett * rasqal_engine.c (rasqal_new_graph_pattern_from_sequence): lose triples argument (rasqal_graph_pattern_get_next_match, rasqal_engine_get_next_result): Check and fail for sequence of graph_patterns. * rasqal_internal.h: Update rasqal_new_graph_pattern_from_sequence to lose triples argument * rdql_parser.y (rasqal_rdql_query_engine_prepare): Use rasqal_new_graph_pattern_from_triples * rasqal_query.c (rasqal_new_query): Init triples here. (rasqal_query_print): Print graph_patterns * rasqal_internal.h: Add graph_patterns sequence to rasqal_graph_pattern. Added prototypes for rasqal_new_graph_pattern_from_triples and rasqal_new_graph_pattern_from_sequence * rasqal_engine.c (rasqal_new_graph_pattern_from_triples): Renamed from rasqal_new_graph_pattern (rasqal_new_graph_pattern_from_sequence): Added to handle a graph pattern as a sequence of graph patterns. (rasqal_free_graph_pattern): Handle cleanup for sequence. (rasqal_graph_pattern_print): Handle sequence and simplify. (rasqal_engine_execute_init): Abort with messsage if sequence has a NULL graph pattern in it. 2004-11-19 Dave Beckett * rasqal_engine.c (rasqal_engine_execute_init): Init current_graph_pattern. (rasqal_engine_get_next_result): Attempt to walk through graph_patterns without failing on optional ones. * rasqal_internal.h: Added current_graph_pattern to rasqal_query. * sparql_lexer.l (sparql_token_print): Added UNION token * sparql_parser.y: Added UNION token * sparql_lexer.l: Added UNION|union keyword * sparql_parser.y (rasqal_sparql_query_engine_prepare): Add graph pqttern of all triples found. * rdql_parser.y (rasqal_rdql_query_engine_prepare): Add graph pattern of all triples found. * rasqal_engine.c (rasqal_new_graph_pattern): No triples_size. Don't init triple_meta here but on each execution. (rasqal_free_graph_pattern, rasqal_graph_pattern_get_next_match): update triple_meta offset (rasqal_graph_pattern_init): Added, to init for execution. (rasqal_graph_pattern_print): Added for debug printing. (rasqal_engine_execute_init): Use query->graph_patterns - init them with rasqal_graph_pattern_init (rasqal_engine_execute_finish): Do not delete query->graph_pattern. (rasqal_engine_get_next_result): Pick 0th item from query->graph_patterns to execute. * rasqal_query.c (rasqal_new_query, rasqal_free_query): Init/free query->graph_patterns sequence * rasqal_internal.h: Delete triples_count from rasqal_graph_pattern. Only use exactly what's needed: end-start+1 columns Added rasqal_graph_pattern_init and rasqal_graph_pattern_print prototypes Added raptor_sequence of rasqal_graph_pattern* to rasqal_query * sparql_parser.y (PatternElementForms): 'SOURCE * ...' Warn this is ignored. 'Source VarOrURI ...' Set triple origin from the literal (UnaryExpressionNotPlusMinus): Delete ignored ArgList for now. * rasqal_internal.h: Added rasqal_graph_pattern_adjust prototype * rasqal_engine.c (rasqal_new_graph_pattern, rasqal_free_graph_pattern): Docs, code tidy. (rasqal_graph_pattern_adjust): Added, to shift graph pattern columns. (rasqal_graph_pattern_get_next_match): Code tidy. 2004-11-17 Dave Beckett * rasqal_engine.c (rasqal_engine_get_next_result): More code tweaks * rasqal_engine.c (rasqal_engine_get_next_result): Evaluate constraint_expression 2004-11-16 Dave Beckett * rasqal_internal.h, rasqal_engine.c: pattern_graph to graph_pattern * rasqal_engine.c (rasqal_engine_get_next_result): Inner loop logic tidying. * rasqal_engine.c (rasqal_engine_get_next_result): triples_size deleted, never used. * rasqal_engine.c: source re-ordering * rasqal_engine.c (rasqal_engine_prepare): set flags here. (rasqal_engine_execute_init): Always init a new graph_pattern. * rasqal_engine.c (rasqal_engine_execute_init, rasqal_engine_run): Remove remaining use of query->column field. * rasqal_internal.h: rasqal_query remove column field * rasqal_engine.c: (rasqal_engine_execute_init); Added graph_pattern field, using rasqal_new_graph_pattern (rasqal_engine_execute_finish): Tidy up, deleting graph_pattern. (rasqal_graph_pattern_get_next_triple): Renamed from rasqal_engine_get_next_triple_pattern_result and using rasqal_graph_pattern argument. (rasqal_new_graph_pattern): tidy. (rasqal_free_graph_pattern): Delete the triple_meta array. (rasqal_engine_get_next_result): Use rasqal_graph_pattern_get_next_triple and evaluate the constraints here. * rasqal_internal.h: rasqal_query rename to graph_pattern field * rasqal_internal.h: rasqal_graph_pattern add column Remove rasqal_triple_meta field from rasqal_query and add graph_pattern field * rasqal_internal.h: Update rasqal_new_graph_pattern prototype. * rasqal_expr.c: Replace calloc() with RASQAL_CALLOC(type,...) * rasqal_internal.h: Added rasqal_pattern_flags enum. Added rasqal_graph_pattern Added rasqal_new_graph_pattern, rasqal_free_graph_pattern prototypes. * rasqal_engine.c (rasqal_new_graph_pattern, rasqal_free_graph_pattern): Added. * rasqal_engine.c (rasqal_engine_get_next_triple_pattern_result): Added, split off from rasqal_engine_get_next_result. * sparql_parser.y (rasqal_sparql_query_engine_prepare): Call rasqal_engine_prepare. * rdql_parser.y (rasqal_rdql_query_engine_prepare): Call rasqal_engine_prepare. * rasqal_engine.c (rasqal_engine_prepare): Added, split some bits from rasqal_engine_execute_init that were just query preparation, rather than execution. * rasqal_internal.h: Added rasqal_engine_prepare prototype 2004-11-12 Dave Beckett * sparql_parser.y (PatternElementForms): Set triple optional flags. * rasqal_expr.c: Added rasqal_triple_flag_strings consts (rasqal_triple_print): Use rasqal_triple_flag_strings to print flags out. * roqet.c: Cast for c++ * rasqal_engine.c (rasqal_engine_execute_init): Set triple flags RASQAL_TRIPLE_FLAGS_EXACT rather than triple meta is_exact. (rasqal_engine_get_next_result): Use triple flags RASQAL_TRIPLE_FLAGS_EXACT rather than using triple meta is_exact. * rasqal_expr.c (rasqal_triple_set_flags, rasqal_triple_get_flags): Added * rasqal.h: Added enum rasqal_triple_flags Added flags field to rasqal_triple. Added prototypes for rasqal_triple_set_flags and rasqal_triple_get_flags 2004-11-11 Dave Beckett * sparql_parser.y (GraphPattern): Only join non-empty PatternElement (PatternElement.1): Return something. (PatternElementForms): Return NULL for AND Expression part. 2004-11-10 Dave Beckett * sparql_parser.y (rasqal_init_query_engine_sparql): URL now http://www.w3.org/TR/rdf-sparql-query/ * sparql_parser.y (rasqal_init_query_engine_sparql): No alias. * sparql_parser.y: typo * rdql_lexer.l, rdql_parser.y, sparql_lexer.l, sparql_parser.y: Rename terminals: PLUS MINUS STAR SLASH REM TILDE BANG to be the single symbol they are. * rdql_parser.y, rdql_lexer.l: Rename terminals: COMMA LPAREN RPAREN VARPREFIX to be the single symbol they are. * sparql_lexer.l: Rename terminals: COMMA LPAREN RPAREN LSQUARE RSQUARE LCURLY RCURLY VARPREFIX AMP to be the single symbol they are. Added $ terminal. * sparql_parser.y: Enable YYERROR_VERBOSE for now Rename terminals: COMMA LPAREN RPAREN LSQUARE RSQUARE LCURLY RCURLY VARPREFIX AMP to be the single symbol they are. (Var): Allow ? and $ prefix. * sparql_parser.y: Removed ()s for groups. * sparql_parser.y: Added {}s for groups * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/groups.rq: Added groups.rq * rdql_parser.y (ConstraintClause): Don't add constraint sequence here. (CommaAndConstraintClause): Instead, add constraints here. * sparql_parser.y (GraphPattern): Use raptor_sequence_join * rdql_parser.y (Query): Don't set contraints here. (ConstraintClause): Use rasqal_query_add_constraint. * configure.ac: require raptor 1.4.3 * rasqal.h: Applied patch from Ren Puls to allow for Redland public headers to be in a different directory structure. If LIBRDF_OBJC_FRAMEWORK is defined, the headers are in a Redland subdirectory. Only applies to public Redland header files that #include other public header files. rasqal.h includes raptor.h so needs modifying also. 2004-11-02 Dave Beckett * rasqal_raptor.c (ordinal_as_uri): Utterly broken * tests/sparql/check-sparql (run_test): Take array of data files and use them to invoke roqet Tidy some rapper invoking. Add more debug messages. * sparql_parser.y (GraphPattern): Merge the two sequences to make one sequence of triples. (PatternElement): Pass on PatternElementForms sequence (GraphPattern1:) Make a new triple sequence and pass on PatternElementForms. * roqet.c (main): Add sources before prepare. * roqet.c (main): Form a list of files/source URIs to add using a raptor_sequence and add them once the query is created. * configure.ac, win32_rasqal_config.h: Bumped version to 0.9.5 2004-11-01 Dave Beckett * configure.ac: Need raptor 1.4.2 2004-10-29 Dave Beckett * Snapshotted rasqal_0_9_4 for 0.9.4 release * configure.ac: Minimum raptor 1.4.1 * rasqal_raptor.c (ordinal_as_uri): Helper, added to Properly calculate uri_string from rdf:_n ordinals (raptor_statement_as_rasqal_triple): Use above for subject, predicate, object * rasqal_expr.c (rasqal_free_triple): Handle a partially constructed triple. 2004-10-28 Dave Beckett * sparql_parser.y, rdql_parser.y, rasqal_query_test.c: Casts for C++ * tests/sparql/check-sparql: Use PATH to find programs. (run-test): More debug messages Add -s $srcdir arg to find manifest * tests/sparql/syntax/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/examples/Makefile.am: Invoke check-sparql with PATH set and -s $(srcdir) arg * tests/sparql/simple/manifest.n3, tests/sparql/part1/manifest.n3: Update to latest DAWG tests, no file: * sparql_lexer.l, rdql_lexer.l: Remove YY_INPUT since it never worked. (main): Read query string into a buffer and use *_lexer__scan_buffer * sparql_parser.y (main): Use full rasqal_init/finish sequence since setup and cleanup is rather complex now. 2004-10-27 Dave Beckett * sparql_parser.y (sparql_parse): Added workaround to crash when regex is at very end of input, by appending a space to the parsed query string. * rdql_parser.y (rdql_parse): Added workaround to crash when regex is at very end of input, by appending a space to the parsed query string. * tests/sparql/check-sparql, tests/rdql/testsuite/check-rdql: OK to assume raptor 1.4.0 * roqet.1: updated RDQL URL * tests/sparql/syntax/data.n3: skeleton data file * tests/sparql/syntax/Makefile.am: Added check-bad-sparql rule Added nojam.rq bad test * tests/sparql/syntax/nojam.rq: failure with ? and non var * rdql_lexer.l: Restore ID state which is used to allow things like ?select. However, make sure ID state is left on errors. * sparql_lexer.l: In state with unknown token, return to INITIAL and report the error. * rdql_lexer.l: Remove ID state - not used and jams parser with non-matched chars in state. * tests/sparql/Makefile.am: Added syntax dir * sparql_parser.y (VarOrURIList): Fix calls to rasqal_new_variable_literal. * configure.ac: Added dir tests/sparql/syntax * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/describe1.rq: syntax tests for SPARQL * tests/sparql/examples/Makefile.am: Remove check-sparql-works * tests/rdql/testsuite/Makefile.am: Remove check-rdql-works * rasqal_internal.h: Note that describe is a sequence of rasqal_literal* * sparql_parser.y (VarOrURIList): Build a list of rasqal_literal* 2004-10-26 Dave Beckett * roqet.c: fix file reading * roqet.c: Tidy up after failure to get query document * rasqal_raptor.c (rasqal_raptor_error_handler): Added to pass on raptor parser errors to rasqal, and onwards. (rasqal_raptor_new_triples_source): On failure to parser, abort and tidy up. * rasqal_query.c (rasqal_free_query): Tidy up any half-constructed rasqal_expression sequence when query parsing/execution fails. * sparql_lexer.l (sparql_token_free): Free raptor_uri objects in URI_LITERAL. Debug function. * rdql_lexer.l (rdql_token_free): Free raptor_uri objects in URI_LITERAL. Debug function. * rdql_parser.y (main): Use full rasqal_init/finish sequence since setup and cleanup is rather complex now. * rasqal_engine.c (rasqal_new_triples_source): Do not abort when no explict list of sources are given. * sparql_lexer.l: More renames * rdql_lexer.l: Rename static functions to have rdql_ prefix to aid setting breakpoints in debugging. (.): Only return PATTERN_LITERAL if rdql_copy_regex_token worked. (rdql_copy_regex_token): Report EOF in regex rather than continue. (rdql_copy_string_token): Fix debug message parameters. * sparql_lexer.l: Rename static functions to have sparql_ prefix to aid setting breakpoints in debugging. (.): Only return PATTERN_LITERAL if sparql_copy_regex_token worked. (sparql_copy_regex_token): Report EOF in regex rather than continue. * rasqal-config.1: zap ASCII 160 * rasqal-config.1: Fix --libtool-libs desc 2004-10-26 Dave Beckett * rdql_lexer.l: Rename static functions to have rdql_ prefix to aid setting breakpoints in debugging. (.): Only return PATTERN_LITERAL if rdql_copy_regex_token worked. (rdql_copy_regex_token): Report EOF in regex rather than continue. (rdql_copy_string_token): Fix debug message parameters. * sparql_lexer.l: Rename static functions to have sparql_ prefix to aid setting breakpoints in debugging. (.): Only return PATTERN_LITERAL if sparql_copy_regex_token worked. (sparql_copy_regex_token): Report EOF in regex rather than continue. * rasqal-config.1: zap ASCII 160 * rasqal-config.1: Fix --libtool-libs desc 2004-10-25 Dave Beckett * win32_rasqal_config.h, configure.ac, NEWS.html: Bumped version to 0.9.4 * Snapshotted rasqal_0_9_3 for 0.9.3 release * configure.ac: Use AC_TRY_LINK for regcomp test; no need to run it. * roqet.c: Many casts for c++ (roqet_xml_print_xml_attribute, roqet_query_results_print_as_xml): Use type raptor_simple_message_handler for error callbacks. * rasqal_expr.c: Casts for C++ * rasqal_expr.c (rasqal_prefix_print): Handle NULL prefix * configure.ac: Do a 'return 0' after regcomp check to ensure the program exits ok * tests/rdql/testsuite/check-rdql: Handle empty list of vars * Makefile.am: Execute rasqal_query_test specially, passing in full path to $(srcdir)/data/dc.rdf * rasqal_query_test.c: Pass in data file as an argument and allocate the query string with path to the file burnt in. * roqet.c: (roqet_xml_print_xml_attribute, roqet_query_results_print_as_xml): Move experimental XML output code here. * Makefile.am: Remove rasqal_xml.c from library for now. * rasqal.h: Remove rasqal_query_results_print_as_xml from pre-release public API * sparql_parser.y (FromClauseOpt): Store the list of sources got from URIList (URIList): Use rasqal_literal_as_uri to make a list of raptor_uri* from individual rasqal_literal* made by term URI. * rasqal_literal.c (rasqal_literal_as_uri): Added for getting a URI out of a literal. * rasqal_internal.h: Added rasqal_literal_as_uri * sparql_parser.y (sparql_query_error_full): Added, allowing varags. (Literal, URI): Use above to report failure to expand qnames immediately. * sparql_parser.y (Literal, URI): Invoke rasqal_literal_expand_qname when handling a QNAME_LITERAL, RASQAL_LITERAL_QNAME. (sparql_parse): Check for unexpanded QNames. SPARQL does the expansion in order, so do not invoke expansions here. * rasqal_literal.c (rasqal_literal_has_qname): Added, for checking when a QName is leftover. * rasqal_internal.h: Added rasqal_engine_sequence_has_qname, rasqal_engine_constraints_has_qname, rasqal_literal_has_qname, rasqal_expression_has_qname * rasqal_expr.c (rasqal_expression_has_qname): Added for use with rasqal_expression_foreach to check for a leftover QName. * rasqal_engine.c (rasqal_engine_sequence_has_qname, rasqal_engine_constraints_has_qname): Added, for checking when a QName is leftover. * roqet.c: Set the raptor_www error_handler * rasqal.h: Added rasqal_prefix depth field. * rasqal_engine.c (rasqal_engine_declare_prefix): Use query->prefix_depth and increment * rasqal_query.c (rasqal_query_add_prefix): Undeclare older prefixes with the same prefix. * rasqal_internal.h: Added prefix_depth to rasqal_query_s Added rasqal_engine_undeclare_prefix prototype 2004-10-24 Dave Beckett * tests/sparql/examples/Makefile.am: Added missing ex-24a files * roqet.c (main): C99 fix - Move FILE*fh declaration to start of block. * librasqal.3: Updates for 0.9.3 * roqet.c (main): Use raptor_www_fetch_to_string from raptor 1.4.0 * roqet.c: (roqet_get_www_content); Use raptor_stringbuffer_copy_to_string. * configure.ac: enable sparql for regular users 2004-10-23 Dave Beckett * configure.ac, Makefile.am: Added rasqal.rdf.in * rasqal.rdf.in: Rasqal DOAP description 2004-10-21 Dave Beckett * rasqal.spec.in, Makefile.am, MPL.html, LICENSE-2.0.txt, NOTICE: Removed MPL.html. Added LICENSE-2.0.txt and NOTICE * Switched to LGPL / Apache 2.0 license in the sources CVS tags before: rasqal_license_lgpl_mpl, and after: rasqal_license_lgpl_apache2 * win32/rasqal.dsp, win32/rasqal.dsw: win32 updates including sparql (not tested) 2004-10-20 Dave Beckett * rasqal_redland.c (rasqal_redland_bind_match): Take array of 4 bindings. * rasqal_redland.c: Update redland support to changes after addition of origin. * rasqal_general.c: Added rasqal_initialising and rasqal_finishing statics (rasqal_init, rasqal_finish): Use the above to prevent recursion in these methods when rasqal uses redland using rasqal. * configure.ac: use $srcdir not .. when looking for raptor sources nearby * configure.ac: raptor minimum version 1.4.0 * roqet.c: cast for fprintf * configure.ac: autoconf mode 2004-10-18 Dave Beckett * rdql_lexer.l, rdql_parser.y, sparql_lexer.l, sparql_parser.y: Rename rather generic define ERROR to ERROR_TOKEN to help win32. * rdql_lexer.l, sparql_lexer.l: words * rasqal_engine.c (rasqal_set_triples_source_factory): Export this, to match rasqal.h and add docs. 2004-10-17 Dave Beckett * roqet.c: Tidy some #defines (main): Don't print all of huge query_string on errors. * roqet.1: formatting 2004-10-16 Dave Beckett * tests/sparql/check-sparql: Destroy duff relative file: URIs only * tests/sparql/check-sparql: validate $roqet path No Data::Dumper * roqet.c: Remove extra print of query URI * roqet.c (roqet_get_www_content): Remove goto. Fix words. * roqet.1: Update for options changes. Note SPARQL support. * roqet.c (roqet_error_handler): Added, used by www fetching. (roqet_get_www_write_bytes): Added, used by roqet_get_www_content (roqet_get_www_content): Added, creates a big string of a URI content using the raptor_www class routines to retrieve it and raptor_stringbuffer to assemble it. (main): Use roqet_get_www_content to retrieve queries from URIs. * sparql_parser.y, sparql_lexer.l: Deleted FOR and USING tokens * sparql_parser.y: Remove PatternLiteral * tests/sparql/examples/Makefile.am, tests/sparql/examples/ex2-1a-result.n3, tests/sparql/examples/ex2-1a.n3, tests/sparql/examples/ex2-1a.rq, tests/sparql/examples/ex2-1b.rq, tests/sparql/examples/ex2-1c.rq, tests/sparql/examples/ex2-1d.n3, tests/sparql/examples/ex2-1e.rq, tests/sparql/examples/ex2-1f.n3, tests/sparql/examples/ex2-2a-result.n3, tests/sparql/examples/ex2-2a.n3, tests/sparql/examples/ex2-2a.rq, tests/sparql/examples/ex2-3a-result.n3, tests/sparql/examples/ex2-3a.n3, tests/sparql/examples/ex2-3a.rq, tests/sparql/examples/ex2-4a-result.n3, tests/sparql/examples/ex2-4a.n3, tests/sparql/examples/ex2-4a.rq, tests/sparql/examples/ex3-result.n3, tests/sparql/examples/ex3.n3, tests/sparql/examples/ex3.rq, tests/sparql/examples/manifest.n3: SPARQL examples from query WD * tests/sparql/simple/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/Makefile.am, tests/rdql/testsuite/Makefile.am, tests/rdql/Makefile.am: Use indirect rules for the lexer, parser tests for rdql, sparql and roqet * configure.ac: Added tests/sparql/examples/Makefile * sparql_parser.y: Added SPARQL URI token replacing URI_LITERAL | QNAME_LITERAL for clarity. Makes several List tokens shorter * sparql_parser.y (VarOrURIList, VarList): Made left recursive. (VarOrURI): Don't allow a QName. * rdql_parser.y (TriplePatternList): rewrite as left recursive * rdql_parser.y (VarList): rewrite as left recursive * roqet.c (main): When adding source_uri as a triple source, URI is now managed by the query, so drop the source_uri pointer. 2004-10-15 Dave Beckett * sparql_parser.y (PrefixDeclOpt): Actually use query->prefixes list. * sparql_parser.y (PrefixDeclOpt): Add new prefix to existing prefixes list. (main): Update test code to initialise/free static query.prefixes. * rdql_parser.y (Query): Do not initialise query->prefixes. (PrefixDeclList): Shift new prefixes to existing prefixes list. (main): Update test code to initialise/free static query.prefixes. * rasqal_query.c (rasqal_new_query): Init query->prefixes here rather than in each QL implementation. * sparql_parser.y: Remove prefix from %union - not needed * sparql_parser.y, sparql_lexer.l, rasqal_internal.h: Updated SPARQL parser to approximately http://www.w3.org/TR/2004/WD-rdf-sparql-query-20041012/#grammar 2004-10-12 Dave Beckett * tests/sparql/part1/Makefile.am: Use EXPECTED_SPARQL_CORRECT_FAILURES and count the list at run time 2004-10-10 Dave Beckett * sparql_lexer.l, sparql_parser.y, rasqal_expr.c, rasqal_query_test.c, rdql_lexer.l, rdql_parser.y: Use rasqal_basename to make 'program' in test code messages. * rasqal_engine.c (rasqal_engine_execute_finish): Do a terminating loop through columns. * rasqal_internal.h: Added rasqal_basename prototype * rasqal_general.c (rasqal_basename): Added utility function * rasqal_query_test.c (main): Check prepares and multiple executes work. * win32/rasqal.dsp: Rename parser, lexer files. Add sparql * win32_rasqal_config.h: Add RDQL and SPARQL defines * rasqal_expr.c: Make all RASQAL_INLINE functions static. * rasqal_expr.c: RASQAL_INLINE at start of line 2004-10-08 Dave Beckett * sparql_parser.y, sparql_lexer.l, sparql_common.h, rasqal_internal.h, rasqal_general.c, Makefile.am: brql to sparql 2004-09-30 Dave Beckett * tests/sparql/check-sparql: -warnings, new perl only * roqet.c: On query failure (prepare or execute) tidy and exit * tests/rdql/testsuite/Makefile.am: count expected failures the old way * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Handle query parsing, execution errors * tests/rdql/testsuite/Makefile.am: Handle test failures with/without a regex library * tests/sparql/simple/Makefile.am, tests/sparql/part1/Makefile.am: echo messages for correct, works targets * tests/sparql/check-sparql: A few more fixes predicting optional results working. Unique test works * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Handle missing vars or with undef value * tests/sparql/part1/Makefile.am, tests/sparql/simple/Makefile.am: Use check-sparql to run queries driven by manifests and check results are correct. Enable this in check-local * tests/sparql/check-sparql: Read manifest * tests/sparql/simple/Makefile.am: Remove expected test failures code. * tests/sparql/Makefile.am: Added check-sparql * tests/sparql/check-sparql: run sparql tests * tests/rdql/testsuite/check-rdql: Relative to root is ../../.. use -d on roqet to dump query Added -d flag here to run in debug mode * roqet.c: Added -d/--dump-query to print query to stdout * tests/sparql/Makefile.am: sparql tests * Makefile.am: sparql parser/lexer tests * brql_parser.y: sparql label * Makefile.am: BRQL to SPARQL * rasqal_general.c: brql to sparql * tests/sparql/part1/Makefile.am, tests/sparql/simple/Makefile.am: list files * configure.ac: Added sparql subdirs * tests/sparql/part1/Makefile.am, tests/sparql/part1/dawg-data-01.n3, tests/sparql/part1/dawg-query-001, tests/sparql/part1/dawg-query-002, tests/sparql/part1/dawg-query-003, tests/sparql/part1/dawg-result-001.n3, tests/sparql/part1/dawg-result-002.n3, tests/sparql/part1/dawg-result-003.n3, tests/sparql/part1/manifest.n3: sparql part1 tests * tests/sparql/simple/Makefile.am, tests/sparql/simple/data-01.n3, tests/sparql/simple/data-02.n3, tests/sparql/simple/dawg-data-01.n3, tests/sparql/simple/dawg-tp-01.rq, tests/sparql/simple/dawg-tp-02.rq, tests/sparql/simple/dawg-tp-03.rq, tests/sparql/simple/dawg-tp-04.rq, tests/sparql/simple/manifest.n3, tests/sparql/simple/result-tp-01.n3, tests/sparql/simple/result-tp-02.n3, tests/sparql/simple/result-tp-03.n3, tests/sparql/simple/result-tp-04.n3: sparql simple tests * configure.ac, tests/Makefile.am: brql to sparql * Makefile.am: Add rasqal_xml.c * roqet.c: Use rasqal_query_results_print_as_xml * rasqal.h: Added rasqal_query_results_print_as_xml * rasqal_xml.c: Rasqal XML * roqet.c (roqet_print_results_as_xml): If xml, don't print datatype attribute. * roqet.c (roqet_print_results_as_xml): no need to malloc/free when escaped string is same len as original. * roqet.c (roqet_print_results_as_xml): Print XML Literals raw. * roqet.c: Added OUTPUT_FORMAT_XML experiment (roqet_print_xml_attribute): Added, based on librdf_serialize_rdfxml code. (roqet_print_results_as_xml): Added, printing an entire result stream to the given handle in XML. (main): Added the xml output format. * rasqal_literal.c, rasqal.h: Export rasqal_literal_print_type * roqet.c: source_uri check * brql_parser.y: brql to sparql (keeping alias) * roqet.c: terminology s/data/source/ -d/-s --data/--source * rasqal_query.c (rasqal_query_add_source, rasqal_query_get_source): Handle NULL query->sources and initialise it first time when adding. (rasqal_query_add_variable, rasqal_query_get_variable, rasqal_query_has_variable, rasqal_query_set_variable): Handle NULL query->selects and initialise it first time when adding. (rasqal_query_add_triple, rasqal_query_get_triple):Handle NULL query->triples and initialise it first time when adding. (rasqal_query_add_constraint, rasqal_query_get_constraint): Handle NULL query->constraints and initialise it first time when adding. (rasqal_query_add_prefix, rasqal_query_get_prefix): Handle NULL query->prefixes and initialise it first time when adding. * roqet.c: Added -d URI to specify a data URI to load before running the query. 2004-09-26 Dave Beckett * sparql_parser.y: (TriplePatternList) Append constraint to right sequence. * sparql_parser.y: Merged CommaAndConstraintClause into TriplePatternList to remove another shift/reduce conflict with AND. * sparql_parser.y: CommaAndConstraintClause tidy * sparql_parser.y: Removed SOURCE alias for FROM, reducing a shift/reduce cnflict * sparql_parser.y: URIList tidy * fix-bison: Delete yyerrlab1 label only if used in a goto * tests/brql/Q-F2F3-1, tests/brql/Q-F2F3-2: F2F3 bits * rasqal_general.c: debug messages * tests/brql/Q-SOURCE-2, tests/brql/Q-SOURCE-1: PREFIX syntax * rasqal.h: rasqal_triples_source_s: remove source_index. rasqal_triples_source_factory: remove UI from new_triples_source method. * rasqal_redland.c: rasqal_redland_triples_source_user_data: Add source_uris array of size source_uris_count and source_index to use it when loading data. (rasqal_redland_new_triples_source): Walk through each source URI in turn and load data. (rasqal_redland_free_triples_source): Tidy up new array of uris. * rasqal_raptor.c (rasqal_raptor_new_triples_source, rasqal_raptor_free_triples_source): Allocate and free source_uris and source_literals array. * rasqal_redland.c (rasqal_redland_new_triples_source): Handle 0 sources * rasqal_raptor.c: rasqal_raptor_triples_source_user_data: Add source_uris and source_literals array of size source_uris_count and source_index to use it when loading data. (rasqal_raptor_statement_handler): set origin URI as pointer into URI literals array. (rasqal_raptor_new_triples_source): Remove URI arg. Walk through each source URI in turn and load data. (rasqal_raptor_triple_match): Remove URi arg, use origin_uri from triple. (rasqal_raptor_free_triples_source): Tidy up new arrays of data. (rasqal_raptor_bind_match): Update call to triple_match with no URI argument. * rasqal_engine.c (rasqal_new_triples_source): Do not assume there is just one URI source. (rasqal_triples_source_next_source): Deleted. (rasqal_engine_get_next_result): Remove call to rasqal_triples_source_next_source - sources are not applied in order. * sparql_parser.y: expect 4 (TriplePatternList): Rewrite and add SOURCE, OPTIONAL (ConstraintClause): Removed, now in TriplePatternList (URIList): No commas * Makefile.am: Added fix-bison. Use it for rdql and brql parsers. * fix-bison: fix-bison 2004-09-19 Dave Beckett * rasqal_internal.h: Added prototype for rasqal_engine_declare_prefix * rasqal_engine.c (rasqal_engine_declare_prefix): Added to declare a namespace prefix/uri once only in a query. (rasqal_engine_declare_prefixes): Use above. * rasqal.h: Added declared field to rasqal_prefix * sparql_parser.y: Initial BRQL updates post DAWG F2F3 Deleted OPTIONAL, replaced with []s around set of triples using new terms LSQUARE and RSQUARE Removed USING work and replaced with PREFIX earlier. Declare prefixes as soon as they appear. * sparql_lexer.l: Added PREF state for post-PREFIX word handling Define PREFIX, NAME, QNAME more precisely (not checked vs spec) Deleted OPTIONAL Made "PREFIX"/"prefix" set state PREF Added [/LSQUARE and ]/RSQUARE Made state handle foo: and : names for namespace prefixes 2004-09-16 Dave Beckett * rasqal_internal.h: Added prototype for rasqal_triples_source_next_source * rasqal.h: Added origin field to rasqal_triple Added rasqal_triple_set_origin and rasqal_triple_get_origin Made bindings be [4]array Added raptor_uri param to rasqal_triples_soruce_factory method new_triples_source * rasqal_redland.c (rasqal_redland_new_triples_match): Added origin, not checked * rasqal_raptor.c (rasqal_new_triples_source): Set uri from first in list, call updated factory with that uri. (rasqal_free_triples_source): Tidy triples source and user data only if not alreayd done. (rasqal_triples_source_next_source): Added for switching to next data source. (rasqal_triples_match_bind_match): Handle 4 bindings (rasqal_engine_get_next_result): Handle origin queries and switching to next data source when current one exhausted (goto restart) * rasqal_expr.c (rasqal_triple_print): Handle origin. (rasqal_triple_set_origin, rasqal_triple_get_origin): Added * rasqal_engine.c (rasqal_new_triples_source): Set uri from first in list, call updated factory with that uri. (rasqal_free_triples_source): Tidy triples source and user data only if not alreayd done. (rasqal_triples_source_next_source): Added for switching to next data source. (rasqal_triples_match_bind_match): Handle 4 bindings (rasqal_engine_get_next_result): Handle origin queries and switching to next data source when current one exhausted (goto restart) * sparql_parser.y: Added SOURCE ?foo before triple * tests/brql/Makefile.am, tests/brql/E.n3, tests/brql/Q-SOURCE-1, tests/brql/Q-SOURCE-2: tests 2004-09-12 Dave Beckett * rasqal_literal.c (rasqal_literal_as_string): Handle BLANK 2004-09-11 Dave Beckett * rasqal.h: docs * sparql_parser.y (OptionalClause): Make print handler for seq of seq. * rasqal_engine.c (rasqal_engine_assign_variables): Handle no selects * rasqal_raptor.c (rasqal_raptor_new_triples_source): Handle no sources * roqet.c: Use raptor_free_memory on uri_string * Makefile.am: clean up local_tests * tests/brql/Makefile.am: fix tool building paths * rasqal_query_test.c: Use data/dc.rdf * Makefile.am, configure.ac: Added data * data/Makefile.am, data/dc.rdf: data 2004-09-10 Dave Beckett * sparql_lexer.l, rdql_lexer.l (main): Use raptor_free_memory * tests/brql/Makefile.am: BRQL Makefile * tests/rdql/Makefile.am: RDQL Makefile * rasqal_query.c (rasqal_free_query): Added describes, optional_triples and constructs. (rasqal_query_print): Print describes, optional_triples and constructs when present. Make most things printing only if present. * Makefile.am: fix line directives in bison generated files * tests/rdql/testsuite/tests2turtle.patch, tests/rdql/testsuite/check-rdql: Adjustments for dir renaming * rasqal_internal.h: Added constructs, optional_triples, describes sequences Added select_is_describe, construct_all flags. Declare rasqal_init_query_engine_brql prototype * rasqal_general.c (rasqal_init): Use conditionals for query language inits. * rasqal_engine.c (rasqal_engine_expand_triple_qnames): Don't fail if there are no triples. BRQL doesn't need them. * tests/brql/Q-D-1, tests/brql/Q-D-2, tests/brql/Q-D-3, tests/brql/Q-OPT-1, tests/brql/Q-OPT-2, tests/brql/Q-S-1, tests/brql/Q-S-2, tests/brql/D.n3, tests/brql/Q-C-1, tests/brql/Q-C-2: BRQL tests * tests/Makefile.am: Switch to just subdirs here * Makefile.am: Split tests into BRQL and RDQL ones enabled separately. Use makefile conditionals for sources * configure.ac: Added --enable-query-languages and automake conditionals to avoid building them. * Makefile.am: Remove rdql-testsuite dir. Add BRQL sources and tests * sparql_common.h, sparql_lexer.l, sparql_parser.y: BRQL * tests/rdql/dc.rdf, tests/rdql/example1.rdql, tests/rdql/example2.rdql, tests/rdql/example3.rdql, tests/rdql/example4.rdql, tests/rdql/example5.rdql, tests/rdql/example_at_1.rdql, tests/rdql/example_at_2.rdql, tests/rdql/example_at_3.rdql, tests/rdql/example_at_4.rdql, tests/rdql/example_at_5.rdql, tests/rdql/example_at_6.rdql, tests/rdql/example_at_7.rdql, tests/rdql/example_at_8.rdql, tests/rdql/note-ex1.rdql, tests/rdql/note-ex2.rdql, tests/rdql/note-ex3.rdql, tests/rdql/note-ex4.rdql, tests/example_at_2.rdql, tests/example_at_3.rdql, tests/example_at_4.rdql, tests/example_at_5.rdql, tests/example_at_6.rdql, tests/example_at_7.rdql, tests/example_at_8.rdql, tests/note-ex1.rdql, tests/note-ex2.rdql, tests/note-ex3.rdql, tests/note-ex4.rdql, tests/dc.rdf, tests/example1.rdql, tests/example2.rdql, tests/example3.rdql, tests/example4.rdql, tests/example5.rdql, tests/example_at_1.rdql: Moved to rdql subdir 2004-09-07 Dave Beckett * rdql_parser.y (rasqal_rdql_query_engine_terminate): Call rdql_lexer_lex_destroy properly. 2004-09-06 Dave Beckett * rasqal_engine.c (rasqal_engine_execute_finish): Don't free triple_meta before checking the columns * Makefile.am: Added rasqal_query_test to TESTS * rasqal_engine.c (rasqal_engine_execute_init): Init triples_source, triple_meta only if not already done. (rasqal_engine_execute_finish): Free triple_meta and any variables still set if not cleared. * rasqal_raptor.c (rasqal_raptor_free_triples_source): Free the rasqal_triple in the loop. * rasqal_query.c (rasqal_query_execute): Re-execute if wanted. * tests/Makefile.am, tests/dc.rdf: Added dc.rdf * Makefile.am, rasqal_query_test.c: Added rasqal_query_test.c * rasqal_literal.c (rasqal_literal_expand_qname): Zap old string pointer. * rasqal_query.c (rasqal_query_prepare): Allow re-prepare when finished or executed. * rasqal_engine.c (rasqal_engine_execute_init): Do not overwrite query->variables on a re-execute init. 2004-08-29 Dave Beckett * rdql_lexer.l: Fix copy_regex_token prototype - delim is not const. 2004-08-22 Dave Beckett * tests/example_at_8.rdql: RDQL @semantics example 8 * tests/Makefile.am: Added example_at_8.rdql * Makefile.am: Re-fix generation of rdql_parser.c * rdql_parser.y: Allow optional comma in prefix declaration lists. * Makefile.am: Update rdql_parser bison output fix for no .tab.c 2004-08-17 Dave Beckett * rasqal_literal.c (rasqal_literal_as_integer, rasqal_literal_as_floating): Edit casts near strtol, strtod to cause less moaning and still work with C++. * LICENSE.html: More LGPL v2.1 fixes * win32_rasqal_config.h: 0.9.3 * configure.ac: Remove link with expat (!) in posix regex check 2004-08-13 Dave Beckett * Several fixes for building on win32 from Chris Pointon * win32/Makefile.am, win32/rasqal.dsp, win32/rasqal.dsw: win32 build configuration * configure.ac, Makefile.am: Add win32 dir * roqet.c: Use #ifdef HAVE_UNISTD_H ... #endif around include of * rasqal_literal.c, rasqal_expr.c: Use RASQAL_INLINE instead of inline. * win32_rasqal_config.h: win32 updates from Chris Pointon * rasqal_internal.h: Define RASQAL_INLINE here but don't condition it. * rasqal_internal.h: Add RASQAL_INLINE, empty on WIN32 * rasqal.h: Export rasqal_set_triples_source_factory * rdql_parser.y: Use win32_rasqal_config.h * rdql_lexer.l, fix-flex: fix-flex now inserts the raptor and win32 config includes block at the top of the lexer C. * rdql_parser.y, rdql_lexer.l, Makefile.am: Do not generate *.tab.[ch] for rdql parser but process and rename to make .c, .h. 2004-08-03 Dave Beckett * configure.ac: Bumped version to 0.9.3 * Snapshotted rasqal_0_9_2 for 0.9.2 release * roqet.c, rdql_parser.y, rdql_lexer.l, rasqal_raptor.c, rasqal_query.c, rasqal_literal.c, rasqal_internal.h, rasqal_general.c, rasqal_expr.c, rasqal_engine.c: Update for functions using (const|) unsigned char* Casts for C++ to fix many char*/unsigned char* clashes. * rasqal.h: Make many functions use (const|) unsigned char* and return them: rasqal_query_has_variable, rasqal_query_set_variable, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_name, rasqal_query_results_get_binding_value_by_name, rasqal_new_floating_literal, rasqal_new_pattern_literal, rasqal_new_string_literal, rasqal_new_simple_literal, rasqal_literal_as_string, rasqal_new_prefix, rasqal_new_variable 2004-08-02 Dave Beckett * LICENSE.html: Correct the pointer to LGPL v2.1 (not 2) 2004-07-28 Dave Beckett * autogen.sh: move 'rm's inside configure.ac loop * autogen.sh: Ensure subdirs get config.guess, config.sub 2004-07-27 Dave Beckett * rasqal_expr.c: Add #ifndef STANDALONE ... #endif around test functions, linked via library. * configure.ac: Remove -DLIBRDF_DEBUG * configure.ac: Use raptor-config and redland-config with --version-decimal * configure.ac: Remove duplicate redland-config test 2004-07-21 Dave Beckett * strcasecmp.c, roqet.c, rasqal_redland.c, rasqal_raptor.c, rasqal_query.c, rasqal_literal.c, rasqal_general.c, rasqal_expr.c, rasqal_engine.c, Makefile.am, win32_config.h, win32_rasqal_config.h: rename win32_config.h to win32_rasqal_config.h 2004-07-09 Dave Beckett * ChangeLog: ChangeLog in CVS now 2004-06-23 Dave Beckett * Makefile.am: Add rule to make libraptor.la 2004-06-21 Dave Beckett * configure.ac: Added --with-dmalloc * rasqal_redland.c (rasqal_redland_bind_match): free the literal returned by redland_node_to_rasqal_literal since a new one is made by rasqal_literal_as_node. 2004-06-17 Dave Beckett * Makefile.am: Zap extra $@ on rule line 2004-06-14 Dave Beckett * NEWS.html: 0.9.2 skeleton 2004-06-13 Dave Beckett * configure.ac: Bumped version to 0.9.2 * Snapshotted rasqal_0_9_1 for 0.9.1 release * configure.ac: Require raptor 1.3.1 * docs/Makefile.am: README should be maintainer-clean * configure.ac: removed dup enable-release * configure.ac: Only muck about with removing -O2 from flags in maintainer mode. * librasqal.3: Added query results class, moved methods over and renamed. * librasqal.3: example updated 2004-06-12 Dave Beckett * Makefile.am: Added local distclean-compile rule to override the insane one automake uses by default: rm -f *.tab.c * librasqal.3: Add 0.9.1 changelog 2004-06-01 Dave Beckett * rasqal_query.c (rasqal_free_query_results, rasqal_query_results_get_count, rasqal_query_results_next, rasqal_query_results_finished, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_name, rasqal_query_results_get_binding_value_by_name, rasqal_query_results_get_bindings_count): Defensive checking for non-NULL query_results. * docs/kernel-doc: ensure id in the SGML is always same size with md5sum * rasqal_query.c (rasqal_query_remove_query_result): Init prev. * rasqal_query.c: (rasqal_query_results_get_binding_value_by_name) Renamed from rasqal_query_results_get_binding_by_name. * rasqal.h: rasqal_query_results_get_binding_by_name to rasqal_query_results_get_binding_value_by_name * roqet.c: Use rasqal_query_results apis * rasqal_query.c (rasqal_new_query, rasqal_free_query): Use usage. (rasqal_query_execute): Return a new rasqal_query_results* object and add it to the query object with rasqal_query_add_query_result. (rasqal_query_add_query_result, rasqal_query_remove_query_result): Added (rasqal_free_query_results): Added to destroy rasqal_query_results* object Renamings: rasqal_query_get_result_count => rasqal_query_results_get_count rasqal_query_next_result => rasqal_query_results_next rasqal_query_results_finished => rasqal_query_results_finished rasqal_query_get_result_bindings => rasqal_query_results_get_bindings rasqal_query_get_result_binding_value => rasqal_query_results_get_binding_value rasqal_query_get_result_binding_name => rasqal_query_results_get_binding_name rasqal_query_get_result_binding_by_name => +rasqal_query_results_get_binding_by_name rasqal_query_get_bindings_count => rasqal_query_results_get_bindings_count * rasqal_internal.h: rasqal_query_s: Added usage counts, results pointing to active rasqal_query_results* for this query. Added rasqal_query_results_s structure. * rasqal.h: Added rasqal_query_results class. Made rasqal_query_execute return a rasqal_query_result* Renamed all rasqal_query*result* methods to be rasqal_query_result_* Added rasqal_free_query_results to tidy up. * rasqal_engine.c (rasqal_engine_build_constraints_expression): Use AND between constraints. 2004-05-30 Dave Beckett * Makefile.am: Don't use RASQAL_INTERNAL_LIBS except in dependencies of librasqal.la * rasqal_internal.h: remove duplicate and broken YYDEBUG lines 2004-05-29 Dave Beckett * autogen.sh: Add --enable-maintainer-mode 2004-05-28 Dave Beckett * tests/Makefile.am, rdql-testsuite/Makefile.am: Add set +e, set -e around multiple tests so they only fail at the end. * configure.ac: Add flex version check, only in maintainer mode * Makefile.am: Make lex and yacc rules be maintainer only. * configure.ac: Use automakefile conditionals STRCASECMP and GETOPT * Makefile.am: Use automakefile conditionals STRCASECMP and GETOPT for conditional sources. Re-order the directives slightly. 2004-05-27 Dave Beckett * configure.ac: check for perl * Makefile.am: Add fix-flex and use it * fix-flex: Fix flex output 2004-05-15 Dave Beckett * configure.ac: Bumped version to 0.9.1 * Snapshotted rasqal_0_9_0 for 0.9.0 release * rdql-testsuite/Makefile.am: Improve checking works/correct against expected failures. * rdql-testsuite/Makefile.am: Check works/correct RDQL tests against expected failures. * rdql-testsuite/check-rdql: Use portable diff -u in errors 2004-05-14 Dave Beckett * configure.ac: 0.9.0 2004-05-13 Dave Beckett * fix-groff-xhtml: update for rasqal * librasqal.3: updated for release * rasqal.h: dead prototype * rasqal_internal.h, rasqal.h: Export rasqal_literal_as_node. * rasqal_redland.c (rasqal_redland_bind_match): use redland_node_to_rasqal_literal * rasqal_literal.c (rasqal_literal_equals): Boolean literals compare equal to string literals "true" or "false". * rasqal_literal.c: Throughout - use RASQAL_CALLOC (rasqal_literal_as_floating): Added (rasqal_literal_compare): Add more debug messages. Promote to floating right. (rasqal_literal_as_node): Make a new string literal for integer, floating here. * rdql-testsuite/check-rdql: Do not hack around roqet emitng integer, floating, Do hack around rapper/raptor 1.3.0 bug * rasqal_literal.c (rasqal_literal_compare): In promoting comparisons, check both ways round before turning to next type. * rasqal_raptor.c (rasqal_raptor_bind_match): Use rasqal_literal_as_node in setting bindings. * rasqal_internal.h: Add rasqal_literal_as_node * rasqal_literal.c (rasqal_new_string_literal, rasqal_literal_expand_qname): Discard language if datatype is given. * rdql-testsuite/check-rdql: Turn internal integer, floating into typed literals. 2004-05-12 Dave Beckett * rdql-testsuite/check-rdql: report failures 2004-05-11 Dave Beckett * TODO.html: words 2004-05-07 Dave Beckett * rasqal_query.c (rasqal_query_print): Don't try to print NULL sequences. * docs/Makefile.am, docs/api.sgml.in, docs/build-docs, docs/kernel-doc: Rasqal docs and API manual * configure.ac, Makefile.am: Added docs * rasqal_general.c: Rename various functions, moved from here to rasqal_query.c: rasqal_query_get_name, rasqal_query_get_label, rasqal_query_set_fatal_error_handler, rasqal_query_set_error_handler, rasqal_query_set_warning_handler, rasqal_query_set_feature * rasqal_query.c: Rename various functions, moved to this rasqal_query.c: rasqal_query_get_name, rasqal_query_get_label, rasqal_query_set_fatal_error_handler, rasqal_query_set_error_handler, rasqal_query_set_warning_handler, rasqal_query_set_feature * rasqal.h: Renames: Now rasqal_query* for the following name: rasqal_get_name, rasqal_get_label, rasqal_set_fatal_error_handler, rasqal_set_error_handler, rasqal_set_warning_handler, rasqal_set_feature * rdql_parser.y (rasqal_rdql_query_engine_prepare): Handle NULL query_string. * rasqal_internal.h: Internal: rasqal_literal_as_boolean, rasqal_literal_as_integer * rasqal.h: Do not export rasqal_literal_as_boolean * Makefile.am: Add rasqal_literal.c * rasqal_expr.c, rasqal_literal.c: Rasqal literal moved from rasqal_expr.c * rasqal_query.c (rasqal_query_prepare): Note query_string can be NULL. * roqet.c: Use names/values methods for results, no need for a static array. * rasqal_query.c: (rasqal_query_get_bindings_count): Added * roqet.c: Don't use uninitialised values, values. * rasqal.h: Added rasqal_query_get_bindings_count * rasqal_query.c (rasqal_query_prepare): Free raptor-alloced memory with raptor_free_memory. (rasqal_query_get_bindings_count): Added. * roqet.c: Add list of valid inputs for -i/--input errors. * rasqal_query.c: parameter naming consistency (no code changes) docucomments 2004-05-06 Dave Beckett * rasqal.h: Renamed rasqal_query_get_result_binding to rasqal_query_get_result_binding_value. Added rasqal_query_get_result_binding_name * rasqal_query.c (rasqal_query_get_result_binding_value): Renamed from rasqal_query_get_result_binding. Fix dubious offset checking. (rasqal_query_get_result_binding_name): Added. 2004-05-05 Dave Beckett * rasqal.h: Added rasqal_query_get_user_data and rasqal_query_set_user_data * rasqal_query.c (rasqal_query_get_user_data,rasqal_query_set_user_data): Added * rasqal_query.c: docucumments * rasqal.spec.in: date * rasqal.spec.in, rasqal.pc.in, configure.ac: Use new @RAPTOR_MIN_VERSION@ subst. * Makefile.am: Install roqet * Makefile.am: Added roqet.1 and roqet.html, add fix-groff-xhtml * roqet.1: roqet man page * configure.ac: SUBST with_raptor * rasqal-src-config.in: sigh, rasqal uses raptor * rasqal-src-config.in: One more remaining bad raptor cut'n' paste * rdql-testsuite/Makefile.am: Add check-rdql to dist * configure.ac: Added build summary. * rasqal_raptor.c: (raptor_statement_as_rasqal_triple) C99. * configure.ac: Try to find raptor sources better. * rdql-testsuite/Makefile.am: Do not die on test failures for known rasqal bugs. * rasqal_redland.c (rasqal_redland_new_triples_source): Use rasqal_query_get_source. (rasqal_redland_init, rasqal_redland_finish): Make a new librdf_world here and use it in this module only. * rasqal_internal.h: Add prototypes for rasqal_redland_init and rasqal_redland_finish * rasqal_general.c (rasqal_finish): Add redland stop code. * rasqal_general.c (rasqal_finish): No redland stop code now. * rasqal_general.c (rasqal_init, rasqal_finish): Select raptor or redland start/stop code. * rasqal_redland.c (rasqal_redland_new_triples_source): Deal with sources here, moved from rasqal_engine_execute_init. * rasqal_raptor.c (rasqal_raptor_new_triples_source): Deal with sources here, moved from rasqal_engine_execute_init. * rasqal_engine.c (rasqal_new_triples_source): Lose uri argument. (rasqal_engine_execute_init): Do not deal with sources here; push to triples source factories. * rasqal_internal.h: rasqal_new_triples_source loses uri argument. * rasqal.h: Lose uri field from rasqal_triples_source. * Makefile.am: Moved LTLIBOBJS around to allow strcasecmp, rasqal_redland to work right. * configure.ac: Added --redland-config Added --with-triples-source=(raptor|redland) 2004-05-04 Dave Beckett * rasqal_raptor.c, rasqal_expr.c: raptor now exports raptor_xml_literal_datatype_uri_string * rasqal_raptor.c (raptor_statement_as_rasqal_triple): Allocate space for \0 in blank, strings. * rasqal_raptor.c (rasqal_raptor_new_triples_source): fail if there is no uri * rasqal.h: Added rasqal_query_add_prefix, rasqal_query_get_prefix_sequence and rasqal_query_get_prefix * rasqal_query.c (rasqal_query_add_prefix, rasqal_query_get_prefix_sequence, rasqal_query_get_prefix): added, for access to namespace prefixes * rasqal.h: Added rasqal_query_add_constraint, rasqal_query_get_constraint_sequence and rasqal_query_get_constraint * rasqal_query.c (rasqal_query_add_constraint, rasqal_query_get_constraint_sequence, rasqal_query_get_constraint): added, for access to constraint expressions * rasqal.h: Added rasqal_query_add_triple, rasqal_query_get_triple_sequence and rasqal_query_get_triple * rasqal_query.c (rasqal_query_add_triple, rasqal_query_get_triple_sequence, rasqal_query_get_triple): added, for access to triples * rasqal.h: Updated rasqal_query_add_source, rasqal_query_get_source_sequence, rasqal_query_get_source to use raptor_uri types. Added rasqal_query_add_variable, rasqal_query_get_variable_sequence and rasqal_query_get_variable * rasqal_query.c: Docucomments. (rasqal_query_add_source, rasqal_query_get_source_sequence, rasqal_query_get_source): use raptor_uri types. (rasqal_query_add_variable, rasqal_query_get_variable_sequence, rasqal_query_get_variable): added, analagous to above. 2004-05-03 Dave Beckett * rasqal_expr.c (rasqal_literal_compare): break after case for floating. * rdql-testsuite/check-rdql: check-rdql - Run Rasqal against RDQL testsuite * rdql-testsuite/Makefile.am: Add check with roqet and then check it is correct with check-rdql * rdql-testsuite/README: RDQL testsuite notes * rdql-testsuite/Makefile.am: Updated to RDQL testsuite 2.1a Added maintainer rules to aid importing, updating and patching. Added README * rdql-testsuite/tests2turtle.patch: Patch file for RDQL testsuite * rdql-testsuite/README-RDQL-tests.txt, rdql-testsuite/copyright.txt, rdql-testsuite/query-dump, rdql-testsuite/rdql-tests.n3, rdql-testsuite/result-T-07.n3, rdql-testsuite/result-T-08.n3, rdql-testsuite/result-T-09.n3, rdql-testsuite/result-T-10.n3, rdql-testsuite/result-B-19.n3, rdql-testsuite/result-B-20.n3, rdql-testsuite/result-S-01.n3, rdql-testsuite/result-S-02.n3, rdql-testsuite/result-S-03.n3, rdql-testsuite/result-S-04.n3, rdql-testsuite/result-S-05.n3, rdql-testsuite/result-T-01.n3, rdql-testsuite/result-T-02.n3, rdql-testsuite/result-T-03.n3, rdql-testsuite/result-T-04.n3, rdql-testsuite/result-T-05.n3, rdql-testsuite/result-T-06.n3, rdql-testsuite/result-B-06.n3, rdql-testsuite/result-B-07.n3, rdql-testsuite/result-B-08.n3, rdql-testsuite/result-B-09.n3, rdql-testsuite/result-B-10.n3, rdql-testsuite/result-B-11.n3, rdql-testsuite/result-B-12.n3, rdql-testsuite/result-B-13.n3, rdql-testsuite/result-B-14.n3, rdql-testsuite/result-B-15.n3, rdql-testsuite/result-B-16.n3, rdql-testsuite/result-B-17.n3, rdql-testsuite/result-B-18.n3, rdql-testsuite/result-9-02.n3, rdql-testsuite/result-A-01.n3, rdql-testsuite/result-A-02.n3, rdql-testsuite/result-B-01.n3, rdql-testsuite/result-B-02.n3, rdql-testsuite/result-B-03.n3, rdql-testsuite/result-B-04.n3, rdql-testsuite/result-B-05.n3, rdql-testsuite/result-8-01.n3, rdql-testsuite/result-8-02.n3, rdql-testsuite/result-8-03.n3, rdql-testsuite/result-8-04.n3, rdql-testsuite/result-8-05.n3, rdql-testsuite/result-9-01.n3, rdql-testsuite/result-6-01.n3, rdql-testsuite/result-6-02.n3, rdql-testsuite/result-6-03.n3, rdql-testsuite/result-6-04.n3, rdql-testsuite/result-7-01.n3, rdql-testsuite/result-7-02.n3, rdql-testsuite/result-7-03.n3, rdql-testsuite/result-7-04.n3, rdql-testsuite/result-4-06.n3, rdql-testsuite/result-4-07.n3, rdql-testsuite/result-5-01.n3, rdql-testsuite/result-5-02.n3, rdql-testsuite/result-5-03.n3, rdql-testsuite/result-5-04.n3, rdql-testsuite/result-3-06.n3, rdql-testsuite/result-3-07.n3, rdql-testsuite/result-4-01.n3, rdql-testsuite/result-4-02.n3, rdql-testsuite/result-4-03.n3, rdql-testsuite/result-4-04.n3, rdql-testsuite/result-4-05.n3, rdql-testsuite/result-2-07.n3, rdql-testsuite/result-2-08.n3, rdql-testsuite/result-2-09.n3, rdql-testsuite/result-2-10.n3, rdql-testsuite/result-3-01.n3, rdql-testsuite/result-3-02.n3, rdql-testsuite/result-3-03.n3, rdql-testsuite/result-3-04.n3, rdql-testsuite/result-3-05.n3, rdql-testsuite/result-1-04.n3, rdql-testsuite/result-1-05.n3, rdql-testsuite/result-1-06.n3, rdql-testsuite/result-1-07.n3, rdql-testsuite/result-1-08.n3, rdql-testsuite/result-1-09.n3, rdql-testsuite/result-1-10.n3, rdql-testsuite/result-2-01.n3, rdql-testsuite/result-2-02.n3, rdql-testsuite/result-2-03.n3, rdql-testsuite/result-2-04.n3, rdql-testsuite/result-2-05.n3, rdql-testsuite/result-2-06.n3, rdql-testsuite/result-0-01.n3, rdql-testsuite/result-0-02.n3, rdql-testsuite/result-0-03.n3, rdql-testsuite/result-0-04.n3, rdql-testsuite/result-1-01.n3, rdql-testsuite/result-1-02.n3, rdql-testsuite/result-1-03.n3, rdql-testsuite/test-T-05, rdql-testsuite/test-T-06, rdql-testsuite/test-T-07, rdql-testsuite/test-T-08, rdql-testsuite/test-T-09, rdql-testsuite/test-T-10, rdql-testsuite/test-B-18, rdql-testsuite/test-B-19, rdql-testsuite/test-B-20, rdql-testsuite/test-S-01, rdql-testsuite/test-S-02, rdql-testsuite/test-S-03, rdql-testsuite/test-S-04, rdql-testsuite/test-S-05, rdql-testsuite/test-T-01, rdql-testsuite/test-T-02, rdql-testsuite/test-T-03, rdql-testsuite/test-T-04, rdql-testsuite/test-B-05, rdql-testsuite/test-B-06, rdql-testsuite/test-B-07, rdql-testsuite/test-B-08, rdql-testsuite/test-B-09, rdql-testsuite/test-B-10, rdql-testsuite/test-B-11, rdql-testsuite/test-B-12, rdql-testsuite/test-B-13, rdql-testsuite/test-B-14, rdql-testsuite/test-B-15, rdql-testsuite/test-B-16, rdql-testsuite/test-B-17, rdql-testsuite/test-8-01, rdql-testsuite/test-8-02, rdql-testsuite/test-8-03, rdql-testsuite/test-8-04, rdql-testsuite/test-8-05, rdql-testsuite/test-9-01, rdql-testsuite/test-9-02, rdql-testsuite/test-A-01, rdql-testsuite/test-A-02, rdql-testsuite/test-B-01, rdql-testsuite/test-B-02, rdql-testsuite/test-B-03, rdql-testsuite/test-B-04, rdql-testsuite/test-5-01, rdql-testsuite/test-5-02, rdql-testsuite/test-5-03, rdql-testsuite/test-5-04, rdql-testsuite/test-6-01, rdql-testsuite/test-6-02, rdql-testsuite/test-6-03, rdql-testsuite/test-6-04, rdql-testsuite/test-7-01, rdql-testsuite/test-7-02, rdql-testsuite/test-7-03, rdql-testsuite/test-7-04, rdql-testsuite/test-3-02, rdql-testsuite/test-3-03, rdql-testsuite/test-3-04, rdql-testsuite/test-3-05, rdql-testsuite/test-3-06, rdql-testsuite/test-3-07, rdql-testsuite/test-4-01, rdql-testsuite/test-4-02, rdql-testsuite/test-4-03, rdql-testsuite/test-4-04, rdql-testsuite/test-4-05, rdql-testsuite/test-4-06, rdql-testsuite/test-4-07, rdql-testsuite/test-1-10, rdql-testsuite/test-2-01, rdql-testsuite/test-2-02, rdql-testsuite/test-2-03, rdql-testsuite/test-2-04, rdql-testsuite/test-2-05, rdql-testsuite/test-2-06, rdql-testsuite/test-2-07, rdql-testsuite/test-2-08, rdql-testsuite/test-2-09, rdql-testsuite/test-2-10, rdql-testsuite/test-3-01, rdql-testsuite/test-0-03, rdql-testsuite/test-0-04, rdql-testsuite/test-1-01, rdql-testsuite/test-1-02, rdql-testsuite/test-1-03, rdql-testsuite/test-1-04, rdql-testsuite/test-1-05, rdql-testsuite/test-1-06, rdql-testsuite/test-1-07, rdql-testsuite/test-1-08, rdql-testsuite/test-1-09, rdql-testsuite/model4.nt, rdql-testsuite/model5.nt, rdql-testsuite/model5.rdf, rdql-testsuite/model6.nt, rdql-testsuite/model7.nt, rdql-testsuite/model8.n3, rdql-testsuite/model9.n3, rdql-testsuite/modelA.nt, rdql-testsuite/test-0-01, rdql-testsuite/test-0-02, rdql-testsuite/vc-db-1.rdf, rdql-testsuite/vc-db-2.rdf, rdql-testsuite/vc-db-3.rdf, rdql-testsuite/model0.nt, rdql-testsuite/model1.nt, rdql-testsuite/model2.nt, rdql-testsuite/model3.nt: Imported RDQL testsuite 2.1a * rdql_lexer.l (copy_string_token): Copy language and datatype strings always. * rasqal_raptor.c (raptor_statement_as_rasqal_triple): Copy language always. * rasqal_expr.c (rasqal_new_string_literal): Delete language for datatyped literals that are not rdf:XMLLiteral. (rasqal_free_literal): Free flags args for string, pattern. (rasqal_literal_expand_qname): Delete language for convereted datatyped literals that are not rdf:XMLLiteral. 2004-05-02 Dave Beckett * rasqal_expr.c (rasqal_literal_compare): Fix int promotion - store in ints[]. * rasqal_raptor.c (rasqal_raptor_triple_match): Use rasqal_literal_equals to compare for matches; do not want type promotion. * rasqal.h: Added rasqal_literal_equals * rasqal_expr.c (rasqal_literal_compare): Fix ints, doubles setup. (rasqal_literal_equals): Check for equal without promotion. * rasqal_expr.c (rasqal_literal_compare): More regular approach to type promotion. Add promotion to strings, typically used for URIs. * rasqal_raptor.c (raptor_statement_as_rasqal_triple): Copy literal language, when there is no datatype URI. 2004-05-01 Dave Beckett * rasqal_raptor.c (rasqal_raptor_bind_match): Handle intra-triple constraints. * rasqal_engine.c (rasqal_engine_get_next_result): Stop checking constraints if there is an error or one returns false. * rasqal_expr.c (rasqal_literal_as_integer): Try to turn a string to an int using strtol and checking for failure (rasqal_expression_evaluate): Invert all lt/gt/le/ge check cases, was backwards. * rasqal_expr.c (rasqal_expression_evaluate): Fix failing to match regex checks for RASQAL_EXPR_STR_NMATCH 2004-04-30 Dave Beckett * rasqal.spec.in: require raptor 1.3.0 2004-04-28 Dave Beckett * librasqal.3: early man page experiment 2004-04-27 Dave Beckett * Makefile.am: Added EXTRA_librasqal_la_SOURCES with strcasecmp.c rasqal_redland.c * roqet.c (main): open files mode 'r', not append. * roqet.c (main): Report failure of fopen 2004-04-26 Dave Beckett * rasqal_raptor.c (rasqal_raptor_bind_match): Copy bound literals * rasqal_raptor.c: Switch code to make rasqal_triple objects immediately during parsing, much code reduction. 2004-04-25 Dave Beckett * rasqal_raptor.c (raptor_statement_compare): Remove lots of debugging. * rasqal_raptor.c (raptor_node_equals): Reverse uri compare check again. (raptor_statement_compare): Lots of debugging. * rasqal_raptor.c (rasqal_raptor_statement_handler): Append correctly * rasqal_raptor.c (raptor_node_equals): Handle RAPTOR_IDENTIFIER_TYPE_PREDICATE Fix uri check (rasqal_raptor_next_match): Fix compare check. (rasqal_raptor_new_triples_match): get first match here. * rasqal_raptor.c (rasqal_raptor_triple_match): Note FIXMEs * roqet.c: Don't use redland * rasqal_raptor.c: Returns at least 1 result and doesn't crash. * rasqal_internal.h: Add rasqal_raptor_init * rasqal_general.c (rasqal_init): Call rasqal_raptor_init * configure.ac: Remove linking with redland * Makefile.am: Remove rasqal_redland.c * rasqal_raptor.c: Rasqal triple store implementation with raptor * Makefile.am: Added rasqal_raptor.c 2004-04-20 Dave Beckett * Makefile.am: Added strcasecmp.c * configure.ac: Added strcasecmp macros, checks * rasqal_expr.c (rasqal_expression_compare,rasqal_literal_compare): Added flags arg (rasqal_literal_compare): Use RASQAL_COMPARE_NOCASE for string comparisons to select case independent one. Use case independent compare for languages. (rasqal_expression_evaluate): Pass on error return from regexes as a NULL result. * rasqal.h: Added flags arg to rasqal_literal_compare * rasqal_internal.h: Added strcasecmp, stricmp macros * strcasecmp.c: portable strcasecmp 2004-04-16 Dave Beckett * rasqal_expr.c: replace a few wayward free() calls with RASQAL_FREE() (rasqal_expression_foreach): Do not free passed in expression. * rasqal.h: rasqal_expression_is_variable deleted * rasqal_expr.c (rasqal_expression_is_variable): Deleted, not used. * rasqal_expr.c (rasqal_variable_compare): Deleted, not used. * rasqal_expr.c (rasqal_expression_as_boolean, rasqal_expression_as_integer): 1-entry switch zapped. (rasqal_expression_compare): 1-entry switches zapped. * rasqal_expr.c, rasqal.h: Removed RASQAL_EXPR_EXPR - never used * roqet.c: Added -c/--count option. Made quiet flag a local. Tidied help messages to match raptor macros. * rdql_parser.y (rdql_parse): Pass on parsing failure earlier. * rdql_parser.y (rdql_parse): Pass on parsing failure in return. * rasqal_redland.c (rasqal_redland_new_triples_source): Fail (for now) if there is no source URI. * rasqal_query.c (rasqal_query_prepare): Fail if already failed or finished. Fail if factory prepare failed. (rasqal_query_execute): Fail if already failed or finished. Fail if engine execution init or factory execution fails. (rasqal_query_results_finished): Also finished if failed. * rasqal_general.c (rasqal_query_error_varargs): An error is a failure. * rasqal_engine.c: Turn some failures into rasqal_query_error calls. (rasqal_new_triples_source): Handle NULL uri. (rasqal_new_triples_match): Fail if there is no triples_source. (rasqal_engine_execute_init): Fail if no triples_source could be made. (rasqal_engine_get_next_result): Fail if already failed. Fail if one column has no triples_meta. * rasqal_engine.c (rasqal_new_triples_source): Handle a source with no URI - i.e. default. * rasqal_engine.c (rasqal_engine_execute_init): Handle no sources. 2004-04-15 Dave Beckett * rasqal_expr.c, rasqal.h: Export rasqal_literal_compare * rasqal_engine.c (rasqal_engine_get_next_result): Handle rasqal_triples_match_bind_match failing, then move on to the next triple. * rasqal_redland.c (rasqal_redland_bind_match): Check for repeated bindings and that the triple parts match. * rasqal_expr.c (rasqal_variable_get_value): Deleted, not used. * rasqal_expr.c (rasqal_literal_string_to_native): Don't free the string or datatype URI when promoting. * rdql_lexer.l: Use rasqal_new_boolean_literal for true/false. * rasqal_redland.c (rasqal_literal_to_redland_node): Use boolean string also. * rasqal_expr.c (rasqal_new_boolean_literal): Store boolean string. (rasqal_literal_as_string): No need for buffer. * rasqal_redland.c (rasqal_literal_to_redland_node): Use integer string, uris fields for RASQAL_LITERAL_FLOATING. Merge that with string, floating. * rasqal_expr.c (rasqal_new_floating_literal): Store integer string, datatype uri. (rasqal_free_literal): Tidy that up. * rasqal_redland.c (rasqal_literal_to_redland_node): Use floating string, uris fields for RASQAL_LITERAL_FLOATING. * rasqal_expr.c (rasqal_new_floating_literal): Store floating string, datatype uri. (rasqal_free_literal): Tidy that up. * rdql_parser.y, rdql_lexer.l, rasqal_redland.c, rasqal_expr.c, rasqal.h: rasqal_literal struct changed - moved literal string value out of union and into common part * rasqal_engine.c: Use #ifdef RASQAL_DEBUG to wrap various old debugging prints. * rdql_lexer.l: (rdql_token_print) Use RASQAL_DEBUG2 * rasqal_redland.c (rasqal_redland_triple_present): declare variable at start of a block. * rasqal_expr.c (rasqal_expression_evaluate): declare regex variables at start of a block. * rasqal_internal.h, rasqal_expr.c, rasqal_engine.c: Renamed and moved qname expanding functions from engine to expr source file. Now called rasqal_literal_expand_qname and rasqal_expression_expand_qname * rasqal_internal.h, rasqal_expr.c, rasqal_engine.c: Rename rasqal_promote_string_literal_to_native to rasqal_literal_string_to_native * rasqal_expr.c (rasqal_promote_string_literal_to_native): scanf takes %lf for double. * rdql_lexer.l, rasqal_redland.c, rasqal_expr.c: Switch to %g for printing, formatting C double / xsd:double. * rasqal.h, rdql_parser.y, rdql_lexer.l: floating is now a C double * rasqal_internal.h: Added rasqal_promote_string_literal_to_native * rasqal_engine.c: Make all *as_integer, *as_boolean methods return errors. Change all methods and uses throughout. (rasqal_engine_expand_literal_qname): Use rasqal_promote_string_literal_to_native * rasqal_expr.c: Make all *as_integer, *as_boolean methods return errors. Change all methods and uses throughout. (rasqal_promote_string_literal_to_native): Added, to turn RDF datatyped literals into rasqal integer/floating literals. (rasqal_new_string_literal): Use rasqal_promote_string_literal_to_native. (rasqal_literal_compare): An error in converting (rasqal_literal_as_* methods) always makes the comparison return non-0, no error. Make comparisons with one floating number be done as floats. 2004-04-14 Dave Beckett * rdql_lexer.l: comment out debug prints * rasqal_redland.c (rasqal_literal_to_redland_node): Handle integer and floating rasqal_literal types. * rdql_lexer.l (copy_string_token): Make various datatyped literal forms work. * rasqal_expr.c (rasqal_new_string_literal): Store language. * rasqal_redland.c (rasqal_literal_to_redland_node): use datatype when making librdf nodes. Turn literals into xsd:integer. * rasqal_expr.c (rasqal_literal_print): Tidy printing booleans. (rasqal_literal_compare): Check language and datatypes match if present. If only some present, fail to match. * rdql_parser.y (rdql_query_error): Old bug, use %s to format an error string. * rdql_parser.y: Remove ArgList and functioncall from pre-note grammar. * rasqal_engine.c (rasqal_engine_execute_finish): free triples source only when initialised. * rdql_lexer.l: floating point didn't recognise [0-9]+"."[0-9] - without an 'e' or 'E'. * rasqal_engine.c (rasqal_engine_get_next_result): Handle no triples. * rasqal_expr.c (rasqal_literal_as_string): public. * rasqal.h: Export rasqal_literal_as_string * rasqal_redland.c (rasqal_literal_to_redland_node): Use rasqal_literal_as_string to turn other types to strings - should be datatypes. * rdql_lexer.l (copy_regex_token): calloc buffer so when it is copied, we copy used memory. * rdql_lexer.l (copy_token): calloc buffer so when it is copied, we copy used memory. * rdql_parser.y, rasqal_redland.c, rasqal_query.c, rasqal_expr.c, rasqal_engine.c, rasqal.h: Change variable from a part of rasqal_expression to part of rasqal_literal with many changes throughout. * rdql_lexer.l, rasqal_expr.c, rasqal.h: Kill RASQAL_LITERAL_NULL. Use NULL pointer instead. * rasqal_expr.c (rasqal_expression_evaluate): Make POSIX regex debug message use macro. * configure.ac: Default regex-library to posix, no need to require another library. * rasqal_expr.c: Fix regex include to use RASQAL_REGEX_* not HAVE... (rasqal_expression_evaluate): Make POSIX regex code work. * rasqal_expr.c: Declare prototype for rasqal_literal_as_string. (main): Update use of rasqal_expression_evaluate * rasqal_expr.c: Added regex matching using pcre or POSIIX regex. (rasqal_literal_as_string): Added. (rasqal_expression_evaluate): Added query arg, for calling errors. Added regex code for RASQAL_EXPR_STR_MATCH, RASQAL_EXPR_STR_NMATCH * rasqal_redland.c: (rasqal_redland_free_triples_source) Do not delete rts user_data here * rasqal_general.c (rasqal_vsnprintf): Removed, use raptor_vsnprintf. * rasqal_engine.c (rasqal_free_triples_source): Delete rts user_data here, was allocated in this module. * rasqal.h: Add query arg to rasqal_expression_evaluate * configure.ac: Check for regex libraries - pcre or posix (in libc) 2004-04-13 Dave Beckett * rdql_lexer.l (copy_string_token): Copy final char in datatype uri/qname * rasqal_query.c (rasqal_new_query): Don't init rdf, rdfs namespaces here. * rdql_parser.y (rasqal_rdql_query_engine_init): Initialise rdf, rdfs, owl and xsd prefixes and namespaces here. * rdql-testsuite/Makefile.am: Emit roqet output for now. * rdql_parser.y, rasqal_redland.c: Update rasqal_new_string_literal call. * rasqal_expr.c (rasqal_new_string_literal): Store datatype uri or qnames. * rasqal_engine.c (rasqal_engine_expand_qname): Expand literal datatype qnames in literals. * rasqal.h: In rasqal_literal overload use of flags field to store datatype qnames. Update rasqal_new_string_literal prototype. * rdql_lexer.l (copy_string_token): Handle datatype uris and qnames. (rdql_token_print): Handle printing datatypes uris only. * Makefile.am: Compile rasqal_redland against roqet only. * rasqal_redland.c: Separate from working as a rasqal internal module. Add fake librdf debug macros while this remains outside librdf. Use world as the triples source factory user data. (rasqal_redland_new_triples_source): Add factory_user_data argument. (rasqal_redland_init): Add world argument, use as factory user_data argument. * rasqal_engine.c (rasqal_set_triples_source_factory): Add factory user_data argument. (rasqal_new_triples_source): Pass on factory user_data when creating a new triples source from a triples source factory. * rasqal_general.c (rasqal_init): Remove rasqal_redland_init. * roqet.c: No more external redland World; use rasqal_redland_init to init redland triple source support. * rasqal_expr.c (rasqal_free_literal): Free datatype field. (rasqal_literal_print): Print string literal datatype when present. * rasqal_internal.h: Remove rasqal_set_triples_source_factory to public. Remove rasqal_redland_init. * rasqal.h: Add datatype URI to rasqal_literal. Added factory user data to rasqal_triples_source_factory. Added prototype for rasqal_set_triples_source_factory. * roqet.c (main): Print query result count unless quiet * roqet.c (main): Get results using new result api calls. * rasqal_redland.c (rasqal_redland_new_triples_source): const parser_name * rasqal_query.c (rasqal_free_query): Call rasqal_engine_execute_finish. Tidy variable_names and binding_values. (rasqal_query_prepare): Assign and use prepared. (rasqal_query_execute): Assign and use executed. Do not run rasqal_engine_run here, just pull first result. (rasqal_query_get_result_count): Added (rasqal_query_results_finished): Added (rasqal_query_get_result_bindings): Added (rasqal_query_get_result_binding): Added (rasqal_query_get_result_binding_by_name): Added (rasqal_query_next_result): Added * rasqal_engine.c (rasqal_engine_assign_variables): Create rasqal_query fields variable_names and binding_values. (rasqal_engine_execute_init): Initialse new execution rasqal_query fields. (rasqal_engine_get_next_result): Export and handle finished. Added result counting. (rasqal_engine_assign_binding_values): Added, to assign literal binding values to the array. * rasqal_internal.h: Added more fields to rasqal_query for query execution: prepared, executed, variable_names, binding_values, result_count, finished. Added prototypes for rasqal_engine_get_next_result, rasqal_engine_assign_binding_values * rasqal.h: Added rasqal_query_get_result_count, rasqal_query_results_finished, rasqal_query_get_result_bindings, rasqal_query_get_result_binding, rasqal_query_get_result_binding_by_name and rasqal_query_next_result 2004-04-12 Dave Beckett * Makefile.am: Add cppflags to AM_CFLAGS to compile tests against external headers 2004-04-10 Dave Beckett * rdql_lexer.l (copy_string_token): Use raptor_unicode_char_to_utf8 for correct unicode. * rasqal_redland.c (rasqal_redland_uri_heuristic_parser_name): Deleted. (rasqal_redland_new_triples_source): Use raptor_guess_parser_name * rasqal_redland.c (redland_node_to_rasqal_expression): Pass on language, datatype. * rdql_parser.y: Change token types for integer, boolean, string literal to return literal parts of union. Update to use new rasqal_literal constructor forms. * rdql_lexer.l: Use new rasqal_literal constructor forms to return rasqal_literal* here for integer, boolean, string literal tokens. (copy_regex_token): Make a rasqal_literal pattern literal. (rdql_token_print): Fix debug print to match changes. * rasqal_redland.c: Use new rasqal_literal constructor forms. * rasqal_expr.c: Expand one rasqal_literal constructor to many, per type. * rasqal.h: Explain rasqal_literal fields more. Add literal language, pattern flags. Expand one rasqal_literal constructor to many, per type. * rasqal_engine.c (rasqal_engine_run): don't print out triples yet. * rasqal_expr.c (rasqal_literal_as_integer): Turn string to integer. (rasqal_literal_compare): Promote strings to integers if one if them is an integer. Wrong way round? * rasqal_engine.c (rasqal_engine_expand_triple_qnames): Fix return. * rasqal_engine.c (rasqal_engine_execute_init): Do nothing if there are no triples. * rasqal_engine.c (rasqal_engine_expand_triple_qnames): Do nothing if there are no triples. * rdql_parser.y, rdql_common.h: year 2004-04-09 Dave Beckett * rasqal_internal.h, rasqal_expr.c: Replace rasqal_sequence with raptor_sequence. 2004-04-08 Dave Beckett * configure.ac, Makefile.am: More autofoo moving redland-config hack into configure.ac * rasqal_query.c, rasqal_engine.c: more replacing rasqal_sequence with raptor_sequence. * rasqal.h, rdql_parser.y, rasqal_query.c, rasqal_engine.c: Replace rasqal_sequence with raptor_sequence. * Makefile.am: Removed rasqal_sequence * rasqal_sequence.c: deleted rasqal_sequence * rasqal-src-config.in: Remove --static-libs, substitute with_raptor to get libs and cflags for raptor * configure.ac: substitute with_raptor * configure.ac, Makefile.am: autofoo fixes to enable compiling against raptor in nearby source tree ../raptor as well as a system copy 2004-04-06 Dave Beckett * configure.ac: Fix check for internal raptor 2004-04-06 Dave Beckett * rasqal_redland.c (redland_node_to_rasqal_expression): Remove strdup * rasqal_redland.c (rasqal_redland_finish_triples_match): Free context * rasqal_sequence.c (rasqal_new_sequence): calloc structure * rasqal_redland.c (rasqal_redland_triple_present): logic was inverted. * rasqal_engine.c (rasqal_engine_get_next_result): Don't inc column if it's already negative. * rdql_lexer.l (copy_regex_token, copy_string_token): Pass in lval; only portable way. * rdql_common.h: Remove lval from common struct - not portable. * rdql_lexer.l: Use ' as delim for '-quoted strings with copy_string_token. * rasqal_engine.c (rasqal_engine_get_next_result,rasqal_engine_run): Document, use return values right. 2004-04-04 Dave Beckett * rasqal_query.c (rasqal_query_execute): Call rasqal_engine_execute_init, rasqal_engine_run and rasqal_engine_execute_finish. * rasqal_engine.c: Refactoring returning of results. (rasqal_engine_execute_init): Added, setting up execution state. (rasqal_engine_execute_finish): Added, tidying up execution state. (rasqal_engine_get_next_result): Added, with core of rasqal_engine_run code but returning the next result only. (rasqal_engine_run): Uses above function to print results, part of refactoring. * rasqal_internal.h: Added column to rasqal_query for executing. Added rasqal_engine_execute_init, rasqal_engine_execute_finish. 2004-03-27 Dave Beckett * configure.ac, autogen.sh: Use some AM_INIT_AUTOMAKE options. Require automake1.7, which requires autoconf 2.54 * rasqal-src-config.in, rasqal-config.in: Support --help, emit to stdout and exit 0. 2004-03-11 Dave Beckett * configure.ac: Handle old raptor-config, check for raptor sources 2004-02-28 Dave Beckett * rasqal_redland.c (rasqal_redland_triple_present): Inline single use of rasqal_triple_to_redland_statement * roqet.c: Use World redland global temporarily * rasqal_query.c: Moved all redland-specific code to rasqal_redland.c (rasqal_query_execute): Use rasqal_new_triples_source, rasqal_free_triples_source. * rasqal_general.c (rasqal_init): Call rasqal_redland_init temporarily. * rasqal_engine.c: Moved all redland-specific code to rasqal_redland.c Added Triples_Source_Factory single static. (rasqal_new_triples_source,rasqal_free_triples_source, rasqal_triples_source_triple_present): Added. * rasqal_internal.h: Removed redland.h call and moved librdf_* structs to rasqal_redland.c Moved rasqal_triples_match, rasqal_triple_meta, rasqal_triples_source, rasqal_triples_source_factory to public rasqal.h Added rasqal_new_triples_source, rasqal_free_triples_source, rasqal_set_triples_source_factory. Added rasqal_redland_init temporarily. * rasqal.h: Added rasqal_triples_match, rasqal_triple_meta, rasqal_triples_source, rasqal_triples_source_factory as public. * Makefile.am: Added rasqal-redland.c * rasqal_redland.c: Rasqal redland code * rasqal_internal.h: dates Update bind_match method * rasqal_engine.c (rasqal_engine_expand_constraints_qnames): fix return Moved all redland bits into separate callbacks. (rasqal_redland_bind_match): Renamed from rasqal_redland_get_match. (rasqal_engine_run): Moved remaining use of redland statement into rasqal_redland_bind_match. * rasqal.h: dates * tests/example_at_7.rdql, tests/example_at_6.rdql, tests/example_at_5.rdql, tests/example_at_4.rdql, tests/example_at_3.rdql, tests/example_at_2.rdql, tests/example_at_1.rdql, tests/example4.rdql: Update to remove form * rdql_lexer.l (WNAME): Allow - after first char of qname * rdql_parser.y (CommaAndConstraintClause): Do not free constraints in sequence. (rdql_parse): Call rasqal_engine_expand_constraints_qnames * rasqal_query.c (rasqal_free_query): Free new constraints_expression. Added freeing of constraints sequence. (rasqal_query_execute): Call rasqal_engine_build_constraints_expression. * rasqal_internal.h: Added constraints_expression to rasqal_query * rasqal_expr.c (rasqal_new_literal): Use usage counts (rasqal_new_literal_from_literal): Added, inc usage and return. (rasqal_free_literal): Dec usage count, free on 0. (rasqal_expression_foreach): Added. (rasqal_expression_evaluate): Big update to use evaluate on all expression args and turn into boolean afterwards. * rasqal_engine.c (rasqal_engine_expand_qname): Added, helper for use with rasqal_expression_foreach, also used by rasqal_engine_expand_triple_qnames. (rasqal_engine_expand_triple_qnames): Updated to use rasqal_engine_expand_qname. (rasqal_engine_expand_constraints_qnames): Added, to expand any qnames in constraints using rasqal_expression_foreach and rasqal_engine_expand_qname (rasqal_engine_build_constraints_expression): Turn a sequence of constraints into one rasqal_expression ANDed * rasqal.h: Add usage to rasqal_literal. Add rasqal_expression_foreach Add rasqal_new_literal_from_literal * rasqal_expr.c (rasqal_literal_compare): Fix uri compare (equal/not only) (rasqal_variable_get_value): Added. (rasqal_expression_compare): Match when variables are present, repeat until all are literals. * rasqal.h: Export some more functions * rasqal_engine.c (rasqal_engine_run): Check constraints and don't match if fails 2004-02-27 Dave Beckett * rasqal_expr.c: Added TILDE, BANG * rasqal_expr.c (main): Fail if result was NULL * rdql_parser.y, rasqal_query.c, rasqal_engine.c: Renamed all expression print methods to follow method naming. * rasqal.h: Removed all BIT and SHIFT ops Renamed all expression print methods to follow method naming. * Makefile.am: Added rasqal_expr_test * rasqal_expr.c: Lots of changes to get expression evaluation working. Renamed all print methods to follow method naming. Made several more utility methods inline. Removed all BIT and SHIFT ops (rasqal_expression_compare): Renamed from rasqal_expression_equals, returning the difference <0, =0, >0 (rasqal_expression_evaluate): Renamed from rasqal_evaluate_expression and complete the other ops. (main): Added, evaluating integer1+integer1 * rasqal-config.in, configure.ac: Added --version-decimal to rasqal-config * rasqal-config.1: Added --versiond-decimal 2004-02-25 Dave Beckett * rasqal.pc.in, rasqal.spec.in: require raptor 1.2.0+ 2004-02-24 Dave Beckett * rasqal.spec.in: Require raptor 1.3.0 Update the build lines Export library la files * rasqal.pc.in: Require raptor 1.3.0 min * roqet.c (main): filename now a variable. Don't print query after execution. * rasqal_query.c, Makefile.am: Remove rasqal_query_test code, roqet is a replacement * rasqal_query.c (rasqal_new_query): Declare rdf and rdfs namespaces by default. Not sure if this is still needed. (rasqal_query_execute): Expand qnames before ordering, which has problems since it uses functions that don't understand them. (main): Debug messages to stderr, delete some. * rasqal_expr.c (rasqal_print_literal): Tweak printing blank nodes. * rasqal_engine.c: Make debug statements go to stderr. (rasqal_engine_run): After destroying a triples_match, null the pointer so a new one is made next time for this column. * Makefile.am: Add redland-config --cflags to MEM temp * rasqal_engine.c: fixme-- * rasqal_expr.c (rasqal_new_variable): Free duplicate names. * rasqal_sequence.c (rasqal_free_sequence): Free the sequence object. * rasqal_expr.c (rasqal_free_variable): Free name, value. * rdql_common.h: Added scanner_set field. * rdql_parser.y (rasqal_rdql_query_engine_terminate): Add scanner_set to free rdql scanner if needed. (rdql_parse): Call rdql_lexer_lex_destroy. 2004-02-23 Dave Beckett * rasqal_expr.c (rasqal_free_prefix): RASQAL_FREE * rasqal_expr.c (rasqal_free_prefix): Free prefix and uri * rasqal_engine.c: rasqal_triples_match methods take struct rasqal_triples_match_s arg. (rasqal_free_triples_match): Added (destructor). (rasqal_triples_match_get_match, rasqal_triples_match_next_match, rasqal_triples_match_is_end): Added, methods rather than direct calls. * rasqal_internal.h: rasqal_triples_match methods take struct rasqal_triples_match_s arg. * rasqal_expr.c (rasqal_free_expression): Do not call rasqal_free_variable - variables are shared and freed once by the variables_sequence field of rasqal_query. * tests/Makefile.am: Remove check-rdql-queries with rasqal_query-test * configure.ac, Makefile.am: Added rdql-testsuite * rdql-testsuite/Makefile.am: rdql testsuite * rasqal_engine.c: Big rewrite of rasqal_select_next to remove the recursion. Added a triplesmatching API skeleton. (rasqal_triple_present): Added. (rasqal_redland_get_match, rasqal_redland_next_match, rasqal_redland_is_end, rasqal_redland_finish_triples_match, rasqal_new_triples_match): Added with rasqal_new_triples_match creating a new rasqal_triples_match structure. (rasqal_engine_run): The non-recursive version of the rasqal_select_next. * rasqal_query.c (rasqal_query_execute): Call rasqal_engine_run. * rasqal_internal.h: Added struct rasqal_triples_match for wrapping triplesMatch Added is_exact, triples_match, user_data fields to rasqal_triple_meta. * rasqal_engine.c (rasqal_select_next): Now internal and uses rasqal_triple_meta for per-triple info. (rasqal_query_run): Added. Allocates and frees rasqal_triple_meta for each triple in the conjunction. * rasqal_internal.h: Added rasqal_triple_meta typedef * roqet.c: forbid reading queries except from files * rasqal_internal.h: Add SYSTEM_MALLOC/FREE when not debugging. * rasqal_query.c (rasqal_uri_heuristic_parser_name): Fix tests. * Makefile.am: MEM_LIBS includes redland for testing * Makefile.am: fix roqet LDADD * rasqal_query.c (rasqal_uri_heuristic_parser_name): Added. Ewww! (main): Use rasqal_uri_heuristic_parser_name. * rasqal.h: Export version and copyright statics * Makefile.am: remove roqet extra link * Makefile.am: Added no-install roqet utility * roqet.c: Rasqal RDF query utility * configure.ac: Add getopt_long check * getopt.c, rasqal_getopt.h: Public domain getopt * configure.ac: Add getopt and checks. * rdql_parser.y (SELECT *): Set select_all query field. * rasqal_query.c (rasqal_query_execute): Call rasqal_engine_assign_variables. * rasqal_internal.h: Added select_all field to rasqal_query. * rasqal_engine.c (rasqal_engine_assign_variables): Expand SELECT * to list of variables seen. * rasqal.h: Added rasqal_sequence_print_uri * rdql_parser.y (URIList): A list of raptor_uri, so use raptor_free_uri to free, and rasqal_sequence_print_uri to print them. * rasqal_sequence.c (rasqal_sequence_print_uri): Added. * rasqal_engine.c (rasqal_select_next): More debug messages. Move the stream on to return all results. * rasqal_query.c (rasqal_query_execute): Use librdf_uri* only. * rasqal_expr.c (rasqal_variable_set_value): Debug messages. * rasqal_expr.c (rasqal_variable_set_value): Don't return after freeing old value. 2004-02-21 Dave Beckett * rdql_parser.y: Update rasqal_new_variable call with rasqal_query arg. (main): Init variables_sequence. * rasqal_query.c (rasqal_new_query): Init the variables_sequence. (rasqal_free_query): Delete the variables_sequence. * rasqal_internal.h: Added variables_sequence, the primary storage for variable data. Added prototype for rasqal_engine_assign_variables * rasqal_expr.c: Added RASQAL_LITERAL_BLANK support. (rasqal_new_variable): Added an rdf_query arg. Now makes variables unique pointers per query, assigns offsets. * rasqal_engine.c (rasqal_engine_assign_variables): Create the static variables array inside the rasqal_query. (rasqal_expression_to_redland_node,redland_node_to_rasqal_expression): Handle blank nodes. (rasqal_select_next): Use previously bound variable values. * rasqal.h: variable gets an offset Added RASQAL_LITERAL_BLANK. rasqal_new_variable taks a rdf_query arg. 2004-02-20 Dave Beckett * rasqal_internal.h: docs. Added variables, variables_count, select_variables_count. * rasqal.h: rasqal_variable now takes a rasqal_expression value. Added prototypes for rasqal_query_set_variable, rasqal_variable_set_value. * rasqal_engine.c: (rasqal_expression_to_redland_node, redland_node_to_rasqal_expression, rasqal_triple_to_redland_statement, rasqal_select_next): Added - for testing with redland directly. * rasqal_query.c (rasqal_query_set_variable): Added to set variable value. (rasqal_query_execute): Testing configuration using redland directly. (main) global world object initialised here to prevent uri implementation being changed behind the scenes. * rasqal_internal.h: Use redland for testing. * rasqal_expr.c: rasqal_variable now takes a rasqal_expression value. * rdql_parser.y: Handle QNAME_LITERAL in expressions, to allow old form. * rdql_lexer.l: Support syntax with a warning. * Makefile.am: make check-local build the secondary test programs * rasqal_query.c (rasqal_query_prepare): Free the uri_string from raptor. * rasqal_general.c (rasqal_system_malloc, rasqal_system_free): Added for raptor malloced stuff. * rasqal_internal.h: Added rasqal_system_malloc, rasqal_system_free for raptor malloced stuff. * rdql_parser.y: not used var * rdql_parser.y (rasqal_rdql_query_engine_execute): return 0, note FIXME * rasqal_query.c (rasqal_query_execute): Don't call factory execute twice. (main): progname * rasqal_engine.c (rasqal_query_order_triples): calloc memory. * rasqal_engine.c (rasqal_engine_declare_prefixes): Do no work if there are no prefixes. * rdql_parser.y (main): Init/free namespaces * rasqal.h: Added prototypes for rasqal_query_has_variable, rasqal_expression_is_variable, rasqal_expression_as_variable. * rasqal_query.c (rasqal_new_query): Init namespaces. (raqal_free_query): Free namespaces, ordered_triples. (rasqal_query_has_variable): Added. (rasqal_query_execute): Call rasqal_query_order_triples then factory execute method. (rasqal_query_print): Print ordered_triples if present. (main): Call execute, print query afterwards. * rasqal_expr.c (rasqal_expression_as_variable): Added. (rasqal_expression_is_variable): Added. * rasqal_engine.c: Rasqal query engine * rasqal_internal.h: Added namespaces, ordered_triples fields to rasqal_query. Added prototypes for rasqal_query_order_triples, rasqal_engine_declare_prefixes, rasqal_engine_expand_triple_qnames. * rdql_parser.y: (rasqal_rdql_query_engine_init,rasqal_rdql_query_engine_terminate): Removed namespaces code, never called here and should be more general. (rdql_parse): Call new rasqal_engine_declare_prefixes and rasqal_engine_expand_triple_qnames. * rdql_common.h: Moved namespaces field from rdql struct to rasqal_query * Makefile.am: Added rasqal_engine.c Make all test programs use $(DEFS), $(LIBS) 2004-02-19 Dave Beckett * Makefile.am: rasqal_sequence_test needs librasqal.la * Makefile.am: All code needs raptor even if no URIs are being used, at least for the header. * rasqal_general.c, rasqal_sequence.c, rasqal_expr.c: Headers * rasqal_query.c: Headers. (rasqal_query_prepare): Make a base URI if not given. (main): Tidying. * rdql_common.h: ordering struct, lineno. * rasqal_general.c (rasqal_get_query_engine_factory): Warning tweak. * rdql_parser.y (rdql_parse): Init lines and columns from our lineno. (main): Changes to match. Use rdql_parse with new form. * rdql_lexer.l: More updates to match raptor. Add C++ input defines. Count newlines, also in pattren regex. (main): Don't re-reset the scanner to it's address. * rdql_lexer.l, rasqal_general.c, Makefile.am: rdql_lexer_test works again * rdql_parser.y, rdql_lexer.l, rdql_common.h, rasqal_query.c, rasqal_internal.h, rasqal_general.c, rasqal.h, configure.ac, Makefile.am: Added a rasqal_query factory, registration, separation of query from implementation. Imported a lot of raptor code. It now compiles, doesn't work. 2004-02-15 Dave Beckett * rasqal_internal.h: Add locator and base_uri to rasqal_query * rasqal_general.c: Big import of code from raptor, not complete. Adding factory code, registration, error handling, enumeration. * tests/note-ex3.rdql, tests/note-ex4.rdql, tests/note-ex1.rdql, tests/note-ex2.rdql: Examples from W3C RDQL note * tests/Makefile.am: Add examples from RDQL W3C note * rdql_lexer.l: Pass QNAME to grammar as string Pass a URI as a raptor_uri (rdql_lexer_simple_error): Added * rdql_parser.y: Add raptor_uri to grammar/lexer struct Declare QNAME_LITERAL as string (char*) URI_LITERAL is now a uri (raptor_uri) Update rasqal_new_literal calls. Throughout: rename structs (not complete) (rasqal_rdql_qengine_init): Added (main): Update. * rdql_common.h: Rename structure to rasqal_rdql_engine_s Add namespaces * rasqal.h: Include raptor.h Use raptor_uri in rasqal_prefix. Added RASQAL_LITERAL_QNAME Use raptor_uri in rasqal_literal. Change rasqal_new_literal, rasqal_new_prefix to use raptor_uri * configure.ac: Check for vsnprintf, return values * Makefile.am: Added rasqal_expr.c Compile tests with internal cppflags * rasqal_expr.c: Rasqal expression classes 2004-02-05 Dave Beckett * configure.ac: Make tests/Makefile * tests/Makefile.am: build rasqal_query_test * Makefile.am: Moved RDQL tests to tests dir * tests/Makefile.am: Added tests dir * example1.rdql, example2.rdql, example3.rdql, example4.rdql, example5.rdql, example_at_1.rdql, example_at_2.rdql, example_at_3.rdql, example_at_4.rdql, example_at_5.rdql, example_at_6.rdql, example_at_7.rdql: Moved rdql tests to tests/ * rasqal-src-config.in: -lrasql 2004-01-12 Dave Beckett * Makefile.am: Add @RASQAL_INTERNAL_CPPFLAGS@ for some tests that use it to get raptor. * configure.ac, Makefile.am: Remove REDLAND_* macros, in-redland checks rasqal-0.9.33/NEWS0000644000175000017500000004325312443715246010530 00000000000000 Rasqal RDF Query Library - News 2014-12-15 Rasqal Version 0.9.33 Released Added support for reading and writing boolean result formats. Fixed several query engine operator evaluations (AVG, STRBEFORE, STRAFTER, CONCAT) Updated query results class constructor and methods, deprecating older. Portability fixes for ICC, clang and GCC 5. New internal test runner utility Variable bindings query results can be formatted in mKR CSV format. Multiple other fixes and improvements including fixing reported issues: 0000546, 0000568, 0000583 and 0000588. See the Rasqal 0.9.33 Release Notes for the full details of the changes. 2014-02-23 Rasqal Version 0.9.32 Released SPARQL parser now uses and requires Bison 3.0 (for maintainer) Fixed SPARQL 1.0 vs SPARQL 1.1 syntax feature checking Make ossp work as a UUID library option. Fixed configure searching for libgcrypt-config and pcre-config. Made --with-libgcrypt-config and --with-pcre-config work again. Made other fixes and improvements including fixing reported issues: 0000558, 0000560, 0000561, 0000564 and 0000567. See the Rasqal 0.9.32 Release Notes for the full details of the changes. 2013-12-13 Rasqal Version 0.9.31 Released roqet with new -t mode can now read query results formats and act as a results format converter Added read support for SPARQL 1.1 Query Results CSV and TSV Formats Query engine can execute VALUES Multiple configuration and build improvements Several query engine bug fixes Made other fixes and improvements including fixing reported issues: 0000527, 0000536, 0000537, 0000538 and 0000539 See the Rasqal 0.9.31 Release Notes for the full details of the changes. 2013-01-22 Rasqal Version 0.9.30 Released Removed RDQL support as promised. So long and thanks for all the queries. Use SPARQL instead. Improved floating equality, comparison and promotion rules Made other fixes and improvements including fixing reported issues: 0000506, 0000511, 0000517 and 0000523. See the Rasqal 0.9.30 Release Notes for the full details of the changes. 2012-05-13 Rasqal Version 0.9.29 Released Supports all of SPARQL 1.0 by passing 100% of the approved tests Added support for XSD date Made XSD dateTime and XSD date equality and comparison work Make limit and offset check work properly in a subquery Correctly handle errors during aggregation expressions evaluation Fix blank node generation when made in a CONSTRUCT to match SPARQL Added SPARQL 1.1 draft UUID() and STRUUID() support Requires Raptor 2.0.7+ RDQL support will be removed in the next release (0.9.30) Made other fixes and improvements including fixing reported issues: 0000493, 0000494 0000504 See the Rasqal 0.9.29 Release Notes for the full details of the changes. 2011-11-17 Rasqal Version 0.9.28 Released Added full support for SPARQL 1.1 draft STRBEFORE, STRAFTER and REPLACE. Add internal Mersenne Twister PRNG or choose others via configure Language name 'sparql' is now SPARQL 1.1 The query result formats now all use the W3C Format URIs as their primary URI Improved configure check for for ceil(), floor() and round() to prevent GCC optimizing the test away and getting the wrong answer Made other fixes and improvements including fixing reported Issues: 0000466, 0000467, 0000470, 0000471 and 0000474. See the Rasqal 0.9.28 Release Notes for the full details of the changes. 2011-08-23 Rasqal Version 0.9.27 Released sub-SELECTs can now be executed OPTIONAL and UNION fully execute correctly Grouping over sub-graph patterns fully executes correctly CONSTRUCT WHERE abbreviation is supported and executes CONSTRUCT works when working over a query with optionals Updated the CSV and TSV outputs to match the editor's draft SPARQL 1.1 Query Results CSV and TSV Formats Made other fixes and improvements including fixing reported Issues: 0000127, 0000423, 0000434, 0000454 and 0000459. See the Rasqal 0.9.27 Release Notes for the full details of the changes. 2011-06-27 Rasqal Version 0.9.26 Released Query engine improved with new variable scoping approach that makes UNION work better Added SPARQL 1.1 query draft support for MD5(), SHA1(), SHA224(), SHA256(), SHA384() and SHA512() Removed old query engine 1 Added a method to set the query warning level Made other fixes and improvements including fixing reported Issues: #0000430, #0000431, #0000436, #0000438, #0000439 and #0000446. See the Rasqal 0.9.26 Release Notes for the full details of the changes. 2011-02-22 Rasqal Version 0.9.25 Released Added SPARQL 1.1 query draft support for ABS(), CEIL(), FLOOR(), RAND(), ROUND() and TZ() Added SPARQL 1.1 query draft support for BIND(expr AS ?var) Fixed SPARQL 1.1 update draft SILENT with DROP and CLEAR Fixed SPARQL 1.1 query draft ENCODE_FOR_URI() to not preserve language and datatype of argumnet Fixed SPARQL 1.1 query draft GROUP BY to allow an optional AS ?var Added an expression evaluation context class to store state for use with evaluating expressions Fixed triple-quoted literals over-quoting and their use with language and datatypes Added support for initialising the random seed from system sources or a user value via the API Fixed several query execution cases Query engine now handles NULL as a valid value separate from an error Made rasqal_query_set_store_results() actually work Fixed Issues #0000421, #0000427 and #0000428. See the Rasqal 0.9.25 Release Notes for the full details of the changes. 2011-01-30 Rasqal Version 0.9.24 Released Fixed some memory leaks with variables and literals during parsing Added SPARQL 1.1 update draft support for: ADD, MOVE and COPY; DELETE WHERE { }; CLEAR and DROP with graph application qualifiers; SILENT qualifier and using ; to separate multiple operations. See the Rasqal 0.9.24 Release Notes for the full details of the changes. 2011-01-27 Rasqal Version 0.9.23 Released Fixed parsing of SPARQL 1.1 Update draft INSERT and DELETE to return sequences of triples Fixed cleanup for syntax errors due to disabled query language features Fixed Issues: 0000407 and 0000414, 0000415 and 0000417. See the Rasqal 0.9.23 Release Notes for the full details of the changes. 2011-01-12 Rasqal Version 0.9.22 Released WARNING: ABI AND API CHANGED in this release. Rasqal 0.9.22 is binary incompatible with 0.9.21 or earlier. Builds only against Raptor V2 (2.0.0+) from this release Added SPARQL 1.1 editor's draft datetime builtins: DAY, HOURS, MINUTES, MONTH, SECONDS, TIMEZONE and YEAR Added SPARQL 1.1 editor's draft string builtins: CONCAT, CONTAINS, ENCODE_FOR_URI, LCASE, STRENDS, STRLEN, STRSTARTS, SUBSTR and UCASE Added LAQRS datetime extension builtins: NOW / CURRENT_DATETIME, FROM_UNIXTIME and TO_UNIXTIME Added query language names for SPARQL 1.0, 1.1 Query and Update, 1.1 Query, 1.1 Update and LAQRS Added expression evaluation support for new builtins Added an XSD dateTime class and public API Added support for reading and writing RDF-encoded query result formats in RDF/XML and Turtle / N3 Many other API additions, removals and changes all described in the Rasqal reference manual See the Rasqal 0.9.22 Release Notes for the full details of the changes. 2010-12-04 Rasqal Version 0.9.21 Released Updated to handle aggregate expression execution as defined by the SPARQL 1.1 Query W3C working draft of 14 October 2010 Executes grouping of results: GROUP BY Executes aggregate expressions: AVG, COUNT, GROUP_CONCAT, MAX, MIN, SAMPLE, SUM Executes filtering of aggregate expressions: HAVING Parses new syntax: BINDINGS, isNUMERIC(), MINUS, sub SELECT and SERVICE. The syntax format for parsing data graphs at URIs can be explictly declared. The roqet utility can execute queries over SPARQL HTTP Protocol and operate over data from stdin. Added several new APIs Fixed Issue: #0000388 See the Rasqal 0.9.21 Release Notes for the full details of the changes. 2010-08-22 Rasqal Version 0.9.20 Released Updated to handle more of the new syntax defined by the SPARQL 1.1 Query and SPARQL 1.1 Update W3C working drafts of 1 June 2010 Added execution support for new SPARQL 1.1 query built-in expressions IF, URI, STRLANG, STRDT, BNODE, IN and NOT IN. Added an 'html' query result table format from patch by Nicholas J Humfrey Added API support for group by HAVING expressions Added XSD Date comparison support Support building with Raptor V2 API if configured with --with-raptor2. Many other bug fixes and improvements were made. Fixed Issues: #0000352, #0000353, #0000354, #0000360, #0000374, #0000377 and #0000378 See the Rasqal 0.9.20 Release Notes for the full details of the changes. 2010-02-15 Rasqal Version 0.9.19 Released The only change to this release is to fix the pkg-config rasqal.pc file to to restore the dependency on raptor which was accidently deleted. Lesson learnt: do not commit code after midnight local time. 2010-02-14 Rasqal Version 0.9.18 Released Add initial draft parsing and API (NOT execution) support for SPARQL 1.1 Update W3C Working Draft of 2010-01-26. Add public APIs (row, results, result formatter, variables table) so that query results can be built, read and written without a query. Add API resilience checks for invalid NULL pointer arguments. Many other bug fixes and improvements were made. Fixed Issues: #0000320, #0000323 #0000343, #0000345 and #0000347 See the Rasqal 0.9.18 Release Notes for the full details of the changes. 2009-12-16 Rasqal Version 0.9.17 Released WARNING: ABI AND API CHANGED in this release. Rasqal 0.9.17 is binary incompatible with 0.9.16 or earlier. Added a new query engine that implements the SPARQL algebra better All constructors now take a rasqal_world argument Added LAQRS syntax support for SUM, AVG, MIN, MAX, COALESCE() experimental syntax Added query result formatters for CSV, TSV and ASCII tables Prefer pkg-config for configuring Many resilience and resource failure fixes by Lauri Aalto Many other bug fixes and improvements were made Fixed Issues: #0000077, #0000128, #0000168, #0000258, #0000261, #0000271, #0000279 and #0000305 See the Rasqal 0.9.17 Release Notes for the full details of the changes. 2008-07-05 Rasqal Version 0.9.16 Released WARNING: ABI AND API CHANGED in this release. Rasqal 0.9.16 is incompatible with 0.9.15 or earlier. Added a rasqal_world object used for all constructor functions Removed deprecated functions and macros Fixed some memory leaks and made some low-memory resiliance fixes Query result sets can be read/written from sparql XML results format Improved error syntax error reporting See the Rasqal 0.9.16 Release Notes for the full details of the changes. 2007-11-17 Rasqal Version 0.9.15 Released Many updates for supporting W3C SPARQL Proposed Recommendation. Passes over 92% of the DAWG SPARQL Test Suite. Many query engine improvements. Substantial improvements to datatypes support and evaluation. Many improvements and fixes for use in low-memory situations Several new APIs were added including a new XSD decimal class Fixed issues: #0000190, #0000191, #0000193, #0000196, #0000197, #0000198, #0000199, #0000200, #0000201, #0000203, #0000204, #0000219, #0000220, #0000221, #0000225, #0000234, #0000235 and #0000236 WARNING: ABI AND API CHANGE in Rasqal 0.9.16 which will be incompatible with 0.9.15. See the Rasqal 0.9.15 Release Notes for the full details of the changes. 2007-04-22 Rasqal Version 0.9.14 Released Added syntax and API support but no query engine support for an experimental extension to SPARQL: LAQRS: LAQRS Adds to Querying RDF in SPARQL Updated the query results formatter to allow better introspection of formats Updated SPARQL parser for SPARQL Working Draft 2007-03-26 additions. Fixed issues: #0000152, #0000156, #0000160, #0000167 and #0000182 See the Rasqal 0.9.14 Release Notes for the full details of the changes. 2006-10-30 Rasqal Version 0.9.13 Released Added a new rasqal_query_results_formatter class Query engine now implements SPARQL GRAPH Added query features system to set parameters Many internal query engine changes (code reorganisation) Many bug fixes addressing Issues #0000080, #0000094, #0000095, #0000098, #0000100, #0000111, #0000113, #0000118, #0000129, #0000131 and #0000133. See the 0.9.13 Release Notes for the full details of the changes. 2006-04-30 Rasqal Version 0.9.12 Released Added JSON output based on the Serializing SPARQL Query Results in JSON draft Added query writer so you can use rasqal to turn RDQL into SPARQL Updated to SPARQL Query Language for RDF W3C Candidate Rec, 6 April 2006 now accepting all SPARQL syntax Requires raptor 1.4.9 or newer. Win32 build fixes (John Barstow) Many internal code re-organisations See the 0.9.12 Release Notes for the full details of the changes. 2006-01-15 Rasqal Version 0.9.11 Released Updated to SPARQL Query Language for RDF W3C Working Draft, 23 November 2005 making several additions and changes to the syntax and functionality. Using ordering, distinct and limit with query results now works Created an enhanced API reference manual with gtk-doc Requires Raptor 1.4.8 Many updates to the literal and expression handling Major internal source code re-organisation Many other changes, fixes and improvements. See the 0.9.11 Release Notes for the full details of the changes. 2005-06-09 Rasqal Version 0.9.10 Released The query engine now supports sorting query results implementing SPARQL ORDER BY (NOTE: duplicate query results are not yet removed) SPARQL query language support updated for some recent changes See the 0.9.10 Release Notes for the full details of the changes. 2005-05-19 Rasqal Version 0.9.9 Released Updated to SPARQL Query Language for RDF, W3C Working Draft, 19 April 2005 making widespread changes the syntax. Query API extensively added to access more query structure Query engine updated including query results limit and offsets Updated to the revised SPARQL Query Results XML Format (not yet published) Many other bug fixes and improvements See the 0.9.9 Release Notes for the full details of the changes. 2005-04-10 Rasqal Version 0.9.8 Released Updated to SPARQL Query Language for RDF W3C Working Draft of 17 February 2005 Added casting to the engine and in SPARQL Restructured query engine to be based on a tree of graph patterns Constraints now work per-graph pattern Added a Data Graph API Query engine uses and binds graph names in queries (SPARQL LOAD, FROM and GRAPH) Expanded the Graph Pattern API See the 0.9.8 Release Notes for the full details of the changes. 2005-02-27 Rasqal Version 0.9.7 Released Fix a resource cleanup problem when query results were not fully read Fixed some crashes in expression evaluation with invalid types Added a graph pattern API to provide full access to the query structures Added query methods to return just bound or all variables Some updates for syntax changes of SPARQL Query Language for RDF W3C Working Draft of 17 February 2005 Portability fixes for win32 (Dave Viner) See the 0.9.7 Release Notes for the full details of the changes. 2005-02-06 Rasqal Version 0.9.6 Released Added support and API calls for new query result forms graph and boolean Added SPARQL CONSTRUCT, ASK result forms Added 7 new SPARQL built-in functions Allow UTF-8 and Unicode in prefixes and QNames in queries Several other changes and bug fixes. See the 0.9.6 Release Notes for the full details of the changes. 2005-01-16 Rasqal Version 0.9.5 Released Query engine refactored to execute over graph patterns Added support for SPARQL optionals Added formatting of query results according to the SPARQL Variable Binding Results XML Format, W3C Working Draft, 21 December 2004 Updated SPARQL to handle syntax changes Many other improvements and fixes See the 0.9.5 Release Notes for the full details of the changes. 2004-10-29 Rasqal Version 0.9.4 Released Fixed several crashes during query execution Fixed some memory leaks when a query failed Pass on internal raptor errors to rasqal users. See the 0.9.4 Release Notes for the full details of the changes. 2004-10-25 Rasqal Version 0.9.3 Released License changed to LGPL 2.1/Apache 2 Added initial support for the W3C SPARQL Query Language for RDF, 2004-10-12 working draft Queries can now be executed multiple times Portability fixes for building on win32 (Chris Pointon) Various roqet utility improvements See the 0.9.3 Release Notes for the full details of the changes. 2004-08-03 Rasqal Version 0.9.2 Released Fix casts for C++ Add win32 skeleton header file Fix a memory leak when using redland inside rasqal See the 0.9.2 Release Notes for the full details of the changes. 2004-06-13 Rasqal Version 0.9.1 Released Added a query results class separate from the query class and moved all the results methods to the new class. Made portability fixes for the generated RDQL lexer files See the 0.9.1 Release Notes for the full details of the changes. 2004-05-15 Rasqal Version 0.9.0 Released First public release. 2003-08-12 Rasqal Version 0.1.0 Released Initial web site created. Nothing actually released. __________________________________________________________________ Copyright (C) 2003-2014 Dave Beckett Copyright (C) 2003-2005 University of Bristol rasqal-0.9.33/ChangeLog.100000644000175000017500000011456512100414303012003 000000000000002012-12-16 Dave Beckett * src/sparql_parser.y, tests/sparql/bugs/519-result.ttl, tests/sparql/bugs/519.rq, tests/sparql/bugs/519.ttl, tests/sparql/bugs/Makefile.am, tests/sparql/bugs/manifest.ttl: Support integer^^uri-ref Adds tests for this fix Fixes Issue #0000519 http://bugs.librdf.org/mantis/view.php?id=519 * src/sparql_parser.y: Label HATHAT * configure.ac: Test for mpfr_snprintf for MPFR 2.4.0 Fixes Issue #0000523 http://bugs.librdf.org/mantis/view.php?id=523 2012-09-30 Dave Beckett * src/rasqal_literal.c: Return rdf term type string for integer subtypes (rasqal_literal_get_rdf_term_type): Return string for RASQAL_LITERAL_INTEGER_SUBTYPE. Intended to fix Issue #0000519 http://bugs.librdf.org/mantis/view.php?id=519 2012-08-31 Dave Beckett * autogen.sh, configure.ac: Updated configure.ac via autoupdate * autogen.sh: autogen.sh: Added -Wall to aclocal and autoconf invocations 2012-07-29 Dave Beckett * src/sparql_lexer.l: Restore bison 2.6 prototypes * configure.ac: BISON_MIN_VERSION 2.0 (2004-12-25) until we hear otherwise * src/sparql_lexer.l, src/sparql_parser.y: Restore BISON prototypes for BISON < 2.6 * configure.ac: Add version check for bison and define BISON_VERSION * src/sparql_lexer.l, src/sparql_parser.y: Fixes for Bison 2.6 Remove prototypes that are now generated/defined Declare YYPARSE_PARAM in lexer and header two more times so that #include gets the right thing. * configure.ac: Fix for flex version message from OSX The Apple /usr/bin/flex adds an extra field so $NF does not work 2012-07-15 Dave Beckett * src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: lose const const 2012-07-07 Dave Beckett * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate): memset to char 0 not size 0 [gcc warnings] 2012-07-01 Dave Beckett * src/rasqal_query_results.c: (rasqal_literal_to_result_term): Return NULL on alloc failure * docs/tmpl/section-literal.sgml: Update tmpls * src/rasqal_literal.c: (rasqal_new_floating_literal): autodocs * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Add rasqal_new_floating_literal to docs * docs/Makefile.am, src/rasqal_datetime.c, src/rasqal_expr_evaluate.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_query.c: Allow RASQAL_DISABLE_DEPRECATED to flag out deprecated implementations (docs/Makefile.am SCAN_OPTIONS):: invoke gtkdoc-scan with the deprecated guard. * configure.ac: Set automake -W and gcc -W to same as librdf * src/rasqal_algebra.c, src/rasqal_dataset.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_literal.c, src/rasqal_query_transform.c, src/rasqal_random.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row_compatible.c, src/rasqal_rowsource_aggregation.c, src/sparql_lexer.l, src/sparql_parser.y: Condition all #if RASQAL_DEBUG with #if defined() [gcc warnings] 2012-06-26 Dave Beckett * src/rasqal_rowsource_project.c: project rowsource array is int not int* [clang] (rasqal_project_rowsource_ensure_variables) (rasqal_project_rowsource_finish): alloc array of int not int* * Makefile.am: EXTRA_DIST: Remove ChangeLog NEWS since they are in dist by default * src/rasqal_decimal.c: Use rasqal_double_approximately_* utilities for RASQAL_DECIMAL_C99 (rasqal_xsd_decimal_is_zero): Use fabs and RASQAL_DOUBLE_EPSILON for RASQAL_DECIMAL_C99. Tidy code (rasqal_xsd_decimal_compare): raw not row RASQAL_DECIMAL_C99 Remove unused d. (rasqal_xsd_decimal_equals): Use rasqal_double_approximately_equal. * autogen.sh: autogen.sh updates - Abort run if a configuring program fails. - Generate NEWS with old timestamp if missing so automake can run - small doc and message updates 2012-06-25 Dave Beckett * src/rasqal_double.c: docs * src/rasqal_decimal.c, src/rasqal_literal.c, src/rasqal_rowsource_aggregation.c: Update code to use double approximate compare, equality. (rasqal_xsd_decimal_compare): Call rasqal_double_approximately_compare. (rasqal_literal_equals_flags): Call rasqal_double_approximately_equal(). Update test code to use rasqal_double_approximately_equal for checking results. * src/Makefile.am, src/rasqal_double.c, src/rasqal_internal.h: Add double utilities (rasqal_double_approximately_compare) (rasqal_double_approximately_equal): Added based on Knuth's approximate comparison. * src/rasqal_decimal.c, src/rasqal_rowsource_aggregation.c: More float and epsilons * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_literal.c: Add rasqal_new_floating_literal and use only double arithmetic (rasqal_new_floating_literal): Added, deprecating rasqal_new_float_literal. (rasqal_new_double_literal, rasqal_new_float_literal): Now both wrappers for rasqal_new_floating_literal. (rasqal_new_numeric_literal): Use rasqal_new_floating_literal() for a float. (rasqal_literal_as_floating): Removed. (rasqal_new_literal_from_promotion): Always use rasqal_literal_as_double() for a double and then error out if it is outside of the float MIN...MAX range. (rasqal_literal_equals_flags): Set error if equality fails. * configure.ac, src/rasqal_decimal.c, src/rasqal_internal.h, src/rasqal_literal.c: Use careful double comparison Use fabs and RASQAL_DOUBLE_EPSILON which picks up epsilon value from float.h Add float.h check to configure (rasqal_format_integer, rasqal_literal_as_boolean, rasqal_literal_equals_flags): Update to use RASQAL_DOUBLE_EPSILON * src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_xsd_datatypes.c: Use RASQAL_FLOATING_AS_INT for casts that go double to int * configure.ac: Add -Wfloat-equal and -Wundef to gcc warnings Document -Wformat-nonliteral issue too * utils/roqet.c: Improve range truncation in function arguments (roqet_write_indent): Good cast sp since we know it will fit in int. (roqet_init_query): Cast static length. (print_help, main): Use unsigned int for indexes into descriptive info calls * src/rasqal.h.in, src/rasqal_data_graph.c: (rasqal_new_data_graph_from_iostream): Take unsigned int flags. 2012-06-22 Dave Beckett * README.html: Add notes on implemented parts of SPARQL 1.1 2012-06-18 Dave Beckett * configure.ac, src/rasqal_expr_numerics.c: Support UUID support inside libc for OSX 2012-06-17 Dave Beckett * autogen.sh: Support NOCONFIGURE variable, like Lib{XML2,XSLT} 2012-05-20 Dave Beckett * configure.ac: Fix non-POSIX bash syntax == to = 2012-05-14 Dave Beckett * rasqal.rdf.in, rasqal.spec.in: Update package files to remove RDQL * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_regex.c: Update autodocs to mark rdql support as legacy * src/rasqal_internal.h: Remove rasqal_init_query_language_rdql internal prototype * INSTALL.html, README.html, configure.ac, src/Makefile.am, src/rasqal_general.c, src/rasqal_query_test.c, src/rdql_common.h, src/rdql_lexer.l, src/rdql_parser.y, src/win32_rasqal_config.h.in, tests/Makefile.am, tests/rdql/Makefile.am, tests/rdql/dc.rdf, tests/rdql/example1.rdql, tests/rdql/example2.rdql, tests/rdql/example3.rdql, tests/rdql/example4.rdql, tests/rdql/example5.rdql, tests/rdql/example_at_1.rdql, tests/rdql/example_at_2.rdql, tests/rdql/example_at_3.rdql, tests/rdql/example_at_4.rdql, tests/rdql/example_at_5.rdql, tests/rdql/example_at_6.rdql, tests/rdql/example_at_7.rdql, tests/rdql/note-ex1.rdql, tests/rdql/note-ex2.rdql, tests/rdql/note-ex3.rdql, tests/rdql/note-ex4.rdql, tests/rdql/testsuite/Makefile.am, tests/rdql/testsuite/README, tests/rdql/testsuite/README-RDQL-tests.txt, tests/rdql/testsuite/check-rdql, tests/rdql/testsuite/copyright.txt, tests/rdql/testsuite/model0.nt, tests/rdql/testsuite/model1.nt, tests/rdql/testsuite/model2.nt, tests/rdql/testsuite/model3.nt, tests/rdql/testsuite/model4.nt, tests/rdql/testsuite/model5.nt, tests/rdql/testsuite/model5.rdf, tests/rdql/testsuite/model6.nt, tests/rdql/testsuite/model7.nt, tests/rdql/testsuite/model8.n3, tests/rdql/testsuite/model9.n3, tests/rdql/testsuite/modelA.nt, tests/rdql/testsuite/query-dump, tests/rdql/testsuite/rdql-tests.n3, tests/rdql/testsuite/result-0-01.n3, tests/rdql/testsuite/result-0-02.n3, tests/rdql/testsuite/result-0-03.n3, tests/rdql/testsuite/result-0-04.n3, tests/rdql/testsuite/result-1-01.n3, tests/rdql/testsuite/result-1-02.n3, tests/rdql/testsuite/result-1-03.n3, tests/rdql/testsuite/result-1-04.n3, tests/rdql/testsuite/result-1-05.n3, tests/rdql/testsuite/result-1-06.n3, tests/rdql/testsuite/result-1-07.n3, tests/rdql/testsuite/result-1-08.n3, tests/rdql/testsuite/result-1-09.n3, tests/rdql/testsuite/result-1-10.n3, tests/rdql/testsuite/result-2-01.n3, tests/rdql/testsuite/result-2-02.n3, tests/rdql/testsuite/result-2-03.n3, tests/rdql/testsuite/result-2-04.n3, tests/rdql/testsuite/result-2-05.n3, tests/rdql/testsuite/result-2-06.n3, tests/rdql/testsuite/result-2-07.n3, tests/rdql/testsuite/result-2-08.n3, tests/rdql/testsuite/result-2-09.n3, tests/rdql/testsuite/result-2-10.n3, tests/rdql/testsuite/result-3-01.n3, tests/rdql/testsuite/result-3-02.n3, tests/rdql/testsuite/result-3-03.n3, tests/rdql/testsuite/result-3-04.n3, tests/rdql/testsuite/result-3-05.n3, tests/rdql/testsuite/result-3-06.n3, tests/rdql/testsuite/result-3-07.n3, tests/rdql/testsuite/result-4-01.n3, tests/rdql/testsuite/result-4-02.n3, tests/rdql/testsuite/result-4-03.n3, tests/rdql/testsuite/result-4-04.n3, tests/rdql/testsuite/result-4-05.n3, tests/rdql/testsuite/result-4-06.n3, tests/rdql/testsuite/result-4-07.n3, tests/rdql/testsuite/result-5-01.n3, tests/rdql/testsuite/result-5-02.n3, tests/rdql/testsuite/result-5-03.n3, tests/rdql/testsuite/result-5-04.n3, tests/rdql/testsuite/result-6-01.n3, tests/rdql/testsuite/result-6-02.n3, tests/rdql/testsuite/result-6-03.n3, tests/rdql/testsuite/result-6-04.n3, tests/rdql/testsuite/result-7-01.n3, tests/rdql/testsuite/result-7-02.n3, tests/rdql/testsuite/result-7-03.n3, tests/rdql/testsuite/result-7-04.n3, tests/rdql/testsuite/result-8-01.n3, tests/rdql/testsuite/result-8-02.n3, tests/rdql/testsuite/result-8-03.n3, tests/rdql/testsuite/result-8-04.n3, tests/rdql/testsuite/result-8-05.n3, tests/rdql/testsuite/result-9-01.n3, tests/rdql/testsuite/result-9-02.n3, tests/rdql/testsuite/result-A-01.n3, tests/rdql/testsuite/result-A-02.n3, tests/rdql/testsuite/result-B-01.n3, tests/rdql/testsuite/result-B-02.n3, tests/rdql/testsuite/result-B-03.n3, tests/rdql/testsuite/result-B-04.n3, tests/rdql/testsuite/result-B-05.n3, tests/rdql/testsuite/result-B-06.n3, tests/rdql/testsuite/result-B-07.n3, tests/rdql/testsuite/result-B-08.n3, tests/rdql/testsuite/result-B-09.n3, tests/rdql/testsuite/result-B-10.n3, tests/rdql/testsuite/result-B-11.n3, tests/rdql/testsuite/result-B-12.n3, tests/rdql/testsuite/result-B-13.n3, tests/rdql/testsuite/result-B-14.n3, tests/rdql/testsuite/result-B-15.n3, tests/rdql/testsuite/result-B-16.n3, tests/rdql/testsuite/result-B-17.n3, tests/rdql/testsuite/result-B-18.n3, tests/rdql/testsuite/result-B-19.n3, tests/rdql/testsuite/result-B-20.n3, tests/rdql/testsuite/result-S-01.n3, tests/rdql/testsuite/result-S-02.n3, tests/rdql/testsuite/result-S-03.n3, tests/rdql/testsuite/result-S-04.n3, tests/rdql/testsuite/result-S-05.n3, tests/rdql/testsuite/result-T-01.n3, tests/rdql/testsuite/result-T-02.n3, tests/rdql/testsuite/result-T-03.n3, tests/rdql/testsuite/result-T-04.n3, tests/rdql/testsuite/result-T-05.n3, tests/rdql/testsuite/result-T-06.n3, tests/rdql/testsuite/result-T-07.n3, tests/rdql/testsuite/result-T-08.n3, tests/rdql/testsuite/result-T-09.n3, tests/rdql/testsuite/result-T-10.n3, tests/rdql/testsuite/test-0-01, tests/rdql/testsuite/test-0-02, tests/rdql/testsuite/test-0-03, tests/rdql/testsuite/test-0-04, tests/rdql/testsuite/test-1-01, tests/rdql/testsuite/test-1-02, tests/rdql/testsuite/test-1-03, tests/rdql/testsuite/test-1-04, tests/rdql/testsuite/test-1-05, tests/rdql/testsuite/test-1-06, tests/rdql/testsuite/test-1-07, tests/rdql/testsuite/test-1-08, tests/rdql/testsuite/test-1-09, tests/rdql/testsuite/test-1-10, tests/rdql/testsuite/test-2-01, tests/rdql/testsuite/test-2-02, tests/rdql/testsuite/test-2-03, tests/rdql/testsuite/test-2-04, tests/rdql/testsuite/test-2-05, tests/rdql/testsuite/test-2-06, tests/rdql/testsuite/test-2-07, tests/rdql/testsuite/test-2-08, tests/rdql/testsuite/test-2-09, tests/rdql/testsuite/test-2-10, tests/rdql/testsuite/test-3-01, tests/rdql/testsuite/test-3-02, tests/rdql/testsuite/test-3-03, tests/rdql/testsuite/test-3-04, tests/rdql/testsuite/test-3-05, tests/rdql/testsuite/test-3-06, tests/rdql/testsuite/test-3-07, tests/rdql/testsuite/test-4-01, tests/rdql/testsuite/test-4-02, tests/rdql/testsuite/test-4-03, tests/rdql/testsuite/test-4-04, tests/rdql/testsuite/test-4-05, tests/rdql/testsuite/test-4-06, tests/rdql/testsuite/test-4-07, tests/rdql/testsuite/test-5-01, tests/rdql/testsuite/test-5-02, tests/rdql/testsuite/test-5-03, tests/rdql/testsuite/test-5-04, tests/rdql/testsuite/test-6-01, tests/rdql/testsuite/test-6-02, tests/rdql/testsuite/test-6-03, tests/rdql/testsuite/test-6-04, tests/rdql/testsuite/test-7-01, tests/rdql/testsuite/test-7-02, tests/rdql/testsuite/test-7-03, tests/rdql/testsuite/test-7-04, tests/rdql/testsuite/test-8-01, tests/rdql/testsuite/test-8-02, tests/rdql/testsuite/test-8-03, tests/rdql/testsuite/test-8-04, tests/rdql/testsuite/test-8-05, tests/rdql/testsuite/test-9-01, tests/rdql/testsuite/test-9-02, tests/rdql/testsuite/test-A-01, tests/rdql/testsuite/test-A-02, tests/rdql/testsuite/test-B-01, tests/rdql/testsuite/test-B-02, tests/rdql/testsuite/test-B-03, tests/rdql/testsuite/test-B-04, tests/rdql/testsuite/test-B-05, tests/rdql/testsuite/test-B-06, tests/rdql/testsuite/test-B-07, tests/rdql/testsuite/test-B-08, tests/rdql/testsuite/test-B-09, tests/rdql/testsuite/test-B-10, tests/rdql/testsuite/test-B-11, tests/rdql/testsuite/test-B-12, tests/rdql/testsuite/test-B-13, tests/rdql/testsuite/test-B-14, tests/rdql/testsuite/test-B-15, tests/rdql/testsuite/test-B-16, tests/rdql/testsuite/test-B-17, tests/rdql/testsuite/test-B-18, tests/rdql/testsuite/test-B-19, tests/rdql/testsuite/test-B-20, tests/rdql/testsuite/test-S-01, tests/rdql/testsuite/test-S-02, tests/rdql/testsuite/test-S-03, tests/rdql/testsuite/test-S-04, tests/rdql/testsuite/test-S-05, tests/rdql/testsuite/test-T-01, tests/rdql/testsuite/test-T-02, tests/rdql/testsuite/test-T-03, tests/rdql/testsuite/test-T-04, tests/rdql/testsuite/test-T-05, tests/rdql/testsuite/test-T-06, tests/rdql/testsuite/test-T-07, tests/rdql/testsuite/test-T-08, tests/rdql/testsuite/test-T-09, tests/rdql/testsuite/test-T-10, tests/rdql/testsuite/tests2turtle.patch, tests/rdql/testsuite/vc-db-1.rdf, tests/rdql/testsuite/vc-db-2.rdf, tests/rdql/testsuite/vc-db-3.rdf, utils/roqet.1: Remove RDQL * ChangeLog, ChangeLog.9, Makefile.am: ChangeLog.9 for 2011 2012-05-13 Dave Beckett * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.30 * Snapshotted rasqal_0_9_29 for 0.9.29 release (GIT b208e046859c86859449efe2985aca4a3c1bba91) * src/rasqal_query_transform.c: (rasqal_query_prepare_common): Ignore always 0 GP visit return [clang] * src/rasqal_expr_numerics.c: (rasqal_expression_evaluate_uuid): Free URI string when want_uri * src/rasqal_expr_strings.c: Free input literals to strbefore() and strafter() (rasqal_expression_evaluate_strbefore) (rasqal_expression_evaluate_strafter): Free the input literals on success before returning the result * src/rasqal_datetime.c: (rasqal_xsd_datetime_set_from_timeval): Initialise have_tz to Z * src/rasqal_expr_datetimes.c: Free input literals to timezone() and tz() evaluations (rasqal_expression_evaluate_datetime_timezone) (rasqal_expression_evaluate_datetime_tz): Free the input literals on success before returning the result * NEWS.html, RELEASE.html: 0.9.29 * src/rasqal_variable.c: Added variable usage debugging if define RASQAL_DEBUG_VARIABLE_USAGE set * src/rasqal_rowsource_assignment.c: (rasqal_new_assignment_rowsource): Take reference to input var * src/rasqal_projection.c: docs * src/rasqal_query.c: remove dup bound variables print * src/sparql_parser.y: Fix sparql_uri_applies destructor (GraphRefAll): Call it too. * src/sparql_parser.y: (ConstructQuery): !where_gp is a failure * src/sparql_parser.y: (ConstructQuery): Test where_gp not undefined var * src/rasqal_graph_pattern.c: (rasqal_free_graph_pattern): Free variable 2012-05-12 Dave Beckett * src/rasqal_rowsource.c: Fix rowsequence reference loss (rasqal_rowsource_read_row): If calling rasqal_rowsource_read_all_rows internally, do not overwrite a rows_sequence pointer. (rasqal_rowsource_read_all_rows): Code tidy to aid debugging Report saving rows in debug message * src/rasqal_rowsource.c: Code indenting 2012-05-11 Dave Beckett * src/rasqal_engine_sort.c: docs * src/sparql_parser.y: Fix literal reference count loss in BindingsRow (BindingsRow): Do not need to copy literal, rasqal_row_set_value_at does it. * src/rasqal_engine_sort.c, src/rasqal_literal.c, src/rasqal_map.c: Pass obj pointers into rasqal_map compare callback 2012-05-10 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_set_typed_value): free old strings on decimal promotion. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): remove decimal string ownership * src/rasqal_general.c, src/rasqal_internal.h: Move git-version.h include to just one module to speed up recompiles. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): remember string ownership for decimal * src/rasqal_literal.c: (rasqal_literal_set_typed_value): use string for decimal * src/rasqal_literal.c: != !! * src/rasqal_literal.c: (rasqal_literal_set_typed_value): handle reuse of old decimal string * src/rasqal_literal.c: (rasqal_literal_set_typed_value): clear shared decimal string on free 2012-05-09 Dave Beckett * README.html: html * utils/roqet.1, utils/roqet.c: Add -d none option and make it default. * src/rasqal_expr_strings.c: (rasqal_expression_evaluate_concat): Do not copy NULL URI * src/rasqal_literal.c: Cast side-effected returns of size_t to unsigned int [clang] * src/sparql_lexer.l: (rasqal_sparql_name_check): Use & for bit check [clang] * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Do not destroy object refs 2012-05-08 Dave Beckett * src/rasqal_rowsource_aggregation.c: (rasqal_new_aggregation_rowsource): docs and seq usage in test * src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_project.c: Correct variable reference usage in tests and test cleanup * src/rasqal_row.c: (rasqal_new_row_sequence): Do not double reference to var Internal function mostly for tests * NEWS.html, RELEASE.html: 0.9.29 not yet 2012-05-07 Dave Beckett * src/rasqal_variable.c: (main): Fix vars reference count leak in test * ChangeLog, NEWS.html, README.html, RELEASE.html: 0.9.29 * INSTALL.html: Add --with-libgcrypt-config --with-digest-library and tidy 2012-05-05 Dave Beckett * src/rasqal_query_transform.c: Replace out-of-scope FILTER vars with constant FALSE (rasqal_query_filter_variable_scope): Added to check scope of vars in filter using an upwards GP walk wih rasqal_graph_pattern_get_parent() and rasqal_graph_pattern_variable_bound_below(). (rasqal_query_prepare_common): Call rasqal_query_filter_variable_scope() after tree GPs have been enumerated. This has the consequence that constant join conditions may be not optimized out. Fixes last SPARQL 1.0 test suite failure: SPARQL 1.0 Summary: SPARQL 1.0 total passes: 441 SPARQL 1.0 total failures: 0 * src/rasqal_graph_pattern.c, src/rasqal_internal.h: (rasqal_graph_pattern_variable_bound_below): Added * src/rasqal_graph_pattern.c, src/rasqal_internal.h: (rasqal_graph_pattern_get_parent): Added * src/rasqal_rowsource_join.c: Handle a constant join expression correctly. This is not optimal at this point but it is correct. For a FALSE join condition for a LEFT JOIN it should never read anything from the right rowsource. Currently it reads every row and throws them all away 2012-05-03 Dave Beckett * src/rasqal_rowsource_groupby.c: (rasqal_new_groupby_rowsource): Tidy con init [clang] * src/rasqal_rowsource_aggregation.c: (rasqal_new_aggregation_rowsource): Init con to NULL [clang] * src/rasqal_literal.c: (rasqal_new_literal_from_promotion): init len to prevent [clang] warning * libmtwist: Update libmtwist * src/rasqal_regex.c: (rasqal_regex_replace_posix): Free result on failure [clang] * src/rasqal_format_rdf.c: (rasqal_rowsource_rdf_process): Error path for malloc [clang] * src/rasqal_rowsource_aggregation.c: (rasqal_new_aggregation_rowsource): Free con on error [clang] * src/rasqal_rowsource_groupby.c: (rasqal_new_groupby_rowsource): Free con on error [clang] * src/rasqal_rowsource.c: (rasqal_rowsource_add_variable): Arg check [clang] * src/rasqal_literal.c: (rasqal_literal_as_counted_string): Check error_p [clang] * src/rasqal_algebra.c: (rasqal_algebra_basic_graph_pattern_to_algebra): return NULL [clang] 2012-05-02 Dave Beckett * configure.ac, src/rasqal_digest.c, src/rasqal_internal.h: Make libgcrypt work as a digest backend Added configure arg --with-libgcrypt-config=PATH to libgcrypt-config Made --with-digest-library=gcrypt work (rasqal_digest_buffer): gcrypt version works and uses lower level functions. Removed const attribute on an output parameter. * docs/tmpl/section-expression.sgml: Update tmpls * configure.ac, src/rasqal_expr_numerics.c: Fix libuuid configure tests * configure.ac, src/rasqal_expr_numerics.c: Add internal uuid configure and macro * configure.ac, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_numerics.c, src/rasqal_internal.h, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Add UUID and STRUUID rasqal_op gains RASQAL_EXPR_UUID and RASQAL_EXPR_STRUUID (rasqal_expression_evaluate_uuid): Added to evaluate both Implementation uses libuuid if it exists or uses rasqal random to generate a random UUID (v4). (rasqal_expression_evaluate_uriuuid) (rasqal_expression_evaluate_struuid): Added as wrappers to above 2012-04-30 Dave Beckett * docs/tmpl/section-literal.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-utilities.sgml, src/rasqal_regex.c: rasqal_regex_replace arg docs and update tmpls * docs/rasqal-changes.tsv, docs/rasqal-docs.xml, docs/rasqal-sections.txt, docs/tmpl/section-utilities.sgml, src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_regex.c: Move rasqal_regex_replace to the public API (rasqal_regex_replace): Made public Fixes Issue #0000504 http://bugs.librdf.org/mantis/view.php?id=504 * docs/rasqal-docs.xml: 2012 * src/rasqal_query_transform.c: Update query prepartion for rasqal_query_graph_pattern_visit2 (rasqal_query_prepare_count_graph_pattern): Renamed from rasqal_query_prepare_count_graph_patterns since it deals with 1. (rasqal_query_enumerate_graph_patterns): Added, calling rasqal_query_prepare_count_graph_pattern and using rasqal_query_graph_pattern_visit2() result. (rasqal_query_prepare_common): Check return code from rasqal_query_graph_pattern_visit2 calls. Use rasqal_query_enumerate_graph_patterns() to do enumeration. * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_query.c: (rasqal_query_graph_pattern_visit2): Added deprecating rasqal_query_graph_pattern_visit * src/rasqal_algebra.c: Added rasqal_algebra_new_boolean_constant_expr (rasqal_algebra_new_boolean_constant_expr): Renamed from rasqal_algebra_new_true_expr() and added internal docs 2012-04-18 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_graph_pattern_to_algebra): More extra debug info * src/rasqal_algebra.c: (rasqal_algebra_new_true_expr): Added and use it 2012-04-11 Dave Beckett * RELEASE.html: 0.9.29 - no rdql 2012-04-10 Dave Beckett * docs/tmpl/section-xsd.sgml: Update tmpls * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Added rasqal_xsd_datetime_equals2 * src/rasqal_general.c: 2012 * utils/roqet.c: catch another malloc failure * utils/roqet.c: (print_help): added to make main shorter * utils/check_query.c: (check_query_read_file_string): Error handling for malloc * utils/check_query.c: allocate buffer from heap not stack to prevent >4K stack frame 2012-04-03 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_merge_graph_patterns): Do not merge { FILTER } * tests/rdql/testsuite/Makefile.am: Mark RDQL test B-01 as failing - don't care * src/rasqal_literal.c: Enable DISTINCT to use RDF term comparison (rasqal_literal_string_equals_flags): Renamed from rasqal_literal_string_equals and adds flags arg to set the equality mode - value RASQAL_COMPARE_XQUERY, RDF term RASQAL_COMPARE_RDF or RDQL RASQAL_COMPARE_URI. Do not equate "" and ""^^xsd:string unless value or RDQL mode Update callers of rasqal_literal_string_equals to use rasqal_literal_string_equals_flags and pass in flags. (rasqal_literal_same_term): Use literal value comparison with rasqal_literal_string_equals_flags. * src/rasqal_engine_sort.c: rowsorting for distinct uses RDF term comparisons (rasqal_engine_new_rowsort_map): When distinct, set literal compare_flags to use RDF term comparison 2012-04-02 Dave Beckett * src/rdql_lexer.l, src/sparql_lexer.l: (main): Throw away unused values instead of storing in buffer * src/rasqal_random.c: (main): Throw away unused random results in testing * src/rasqal_regex.c: (main): locator is only needed for RASQAL_REGEX_PCRE * src/rasqal_query_results.c: (rasqal_query_results_get_triple): Rewrite loop logic to set skip at end 2012-03-28 Dave Beckett * src/rasqal_query.c, tests/sparql/check-sparql, utils/roqet.c: Update test runner (rasqal_query_print): Print projected variable names for test runner tests/sparql/check-sparql: merge from redland-testing and fixup always get variables from results header utils/roqet: print projected variable names * tests/sparql/check-sparql: preserve v=NULL for roqet output * tests/sparql/check-sparql: return v=NULL for variables unset in a result row * docs/tmpl/section-xsd.sgml: Update xsd tmpl 2012-03-27 Dave Beckett * tests/sparql/check-sparql: (toDebug): quote result str * README.html, RELEASE.html, configure.ac, src/rasqal_expr_strings.c, src/rasqal_general.c: Require Raptor 2.0.7 or newer. 2012-03-26 Dave Beckett * src/rasqal_literal.c: (rasqal_new_string_literal_common): Use bitwise & - thanks Lauri 2012-03-24 Dave Beckett * src/sparql_parser.y: Empty ArgList returns empty seq not NULL * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Move exponent and terminate properly. * src/rasqal_literal.c: (rasqal_new_string_literal_node) docs * src/rasqal_literal.c: (rasqal_literal_string_to_native): Only flag now is canonicalizing (rasqal_new_string_literal_common): Takes native type promotion and canonicalizing flag. * src/rasqal_literal.c: (rasqal_literal_set_typed_value): Add canonicalize parameter to set string * src/rasqal_literal.c, utils/check_query.c: Always rasqal_literal_string_to_native before rasqal_literal_equals_flags * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string): Canonical decimal ends in .0 Correct test results for canonical decimal format * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Return 0.0E0 for zero * src/rasqal_literal.c: Fix numeric promotion with one decimal and one float/double. (rasqal_literal_promote_numerics): Promote decimal with float/double to float/decimal following XPath rules - B1 1.b http://www.w3.org/TR/xpath20/#dt-type-promotion 2012-03-23 Dave Beckett * utils/check_query.c: Call rasqal_query_add_data_graph() after prepare * src/rasqal_expr_evaluate.c: Evaluate COALESCE following sparql 1.1 rules (rasqal_expression_evaluate_coalesce): Ignore evaluation errors in sequence of expressions until a good result is found. 2012-03-19 Dave Beckett * ChangeLog, NEWS.html, RELEASE.html: 0.9.29 * src/rasqal_rowsource_aggregation.c: Fix AVG test to expect a decimal result 2012-03-18 Dave Beckett * src/rasqal_rowsource_aggregation.c: Do not set aggregate expression value on error * src/rasqal_literal.c: (rasqal_literal_divide): Result is decimal if both args are integer * src/rasqal_literal.c: Promote date to datetime in comparisons and ensure Zulu TZ (rasqal_new_literal_from_promotion, rasqal_literal_equals_flags): Promote date to datetime. (rasqal_literal_equals_flags): Use rasqal_xsd_datetime_equals2 returning error for incomparible. * src/rasqal.h.in, src/rasqal_datetime.c: (rasqal_xsd_datetime_equals2): Added, deprecating rasqal_xsd_datetime_equals Return incomparible flag to caller. * docs/rasqal-changes.tsv, src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_literal.c: (rasqal_xsd_date_equals): Returns incomparible pointer This allows the test to fail when across timelines that are incomparible. (rasqal_literal_equals_flags): Update to take error return. * tests/sparql/check-sparql: $core_dumped earlier * src/rasqal_datetime.c: (rasqal_xsd_timezone_format): Generate sign from inverse of adjusted minutes 2012-02-20 Dave Beckett * src/rasqal_datetime.c: (rasqal_xsd_datetime_equals): Work if dt1 or dt2 are NULL * tests/sparql/check-sparql: Update check-sparql from testing repo * src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_xsd_datatypes.c: Move xsd boolean string check to xsd code (rasqal_xsd_boolean_value_from_string): Renamed from rasqal_literal_string_interpreted_as_boolean * src/rasqal.h.in, src/rasqal_datetime.c: autodocs * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_literal.c: Replace rasqal_xsd_date_compare2 with rasqal_xsd_date_compare and rename * docs/rasqal-changes.tsv, docs/rasqal-sections.txt, src/rasqal.h.in, src/rasqal_datetime.c: autodocs * src/rasqal_datetime.c: (rasqal_xsd_timezone_format): How did this ever work? * src/rasqal_datetime.c, src/rasqal_internal.h: Never normalize date or dateTime fields on parsing (rasqal_xsd_date_parse): simplify without normalizing. (rasqal_xsd_date_normalize): Added but internal/standalone tests since it is not a public API or used outside the test code. (rasqal_new_xsd_datetime): make a datetime copy and normalize that to get the time_on_timeline. (rasqal_xsd_datetime_to_counted_string) (rasqal_xsd_date_to_counted_string) (rasqal_xsd_date_string_to_canonical): Updated docs. (rasqal_xsd_datetime_check, rasqal_xsd_date_check): Just parse, do not touch value with normalizing. (rasqal_new_xsd_date): Set hour to noon for normalizing internal datetime using rasqal_xsd_datetime_normalize. (test_datetime_parse_and_normalize) (test_date_parse_and_normalize): Moved to test code from static functions that were only used here. (main): Adjust test code expected results so that parsing and normalizing does not drop the TZ if it was there in the first place, even when normalizing. * src/rasqal_datetime.c: (rasqal_xsd_datetime_normalize): Clearly set have_tz to N or Z * src/rasqal.h.in, src/rasqal_datetime.c: Handle XSD timezone recording and generating properly rasqal_xsd_date and rasqal_xsd_datetime gain a have_tz flag field that indicates the state of the timezone_minutes. (rasqal_xsd_datetime_normalize): Use have_tz to choose when to normalize. (rasqal_xsd_datetime_parse): Record N, Z or Y for have_tz (rasqal_new_xsd_datetime_from_xsd_date): Copy have_tz field. (rasqal_xsd_timezone_format): Renamed from rasqal_xsd_datetime_timezone_format() and take the timezone fields as input. (rasqal_xsd_datetime_to_counted_string) (rasqal_xsd_datetime_get_tz_as_counted_string): Use rasqal_xsd_timezone_format with new args. (rasqal_xsd_datetime_equals): Use have_tz fields. (rasqal_xsd_date_to_counted_string): Use rasqal_xsd_timezone_format and generate timezone field if needed. (rasqal_new_xsd_date): Copy the have_tz field. * utils/roqet.c: Add data graphs after prepare * src/rasqal_internal.h, src/rasqal_query.c, src/sparql_parser.y: Try to not lose data when reparsing into same query (rasqal_query_reset_select_query): Added to delete existing data, used before a parse (rasqal_query_set_modifier): Added to update modifier but free any existing first. (rasqal_sparql_query_language_prepare): SPARQL parser now calls rasqal_query_reset_select_query to do the reset before a parse. * src/rasqal_rowsource_slice.c: Count input and output row offsets for slice rowsource Fixes Issue #0000493 http://bugs.librdf.org/mantis/view.php?id=493 * tests/engine/rasqal_limit_test.c: Test subselect limits * tests/engine/rasqal_limit_test.c: Add subquery limit offset check for Issue #0000493 http://bugs.librdf.org/mantis/view.php?id=493 * src/rasqal_datetime.c: (rasqal_xsd_datetime_get_seconds_as_decimal): Fix str buffer Fixes Issue#0000494 http://bugs.librdf.org/mantis/view.php?id=494 2012-02-18 Dave Beckett * src/rasqal.h.in, src/rasqal_datetime.c: (rasqal_new_xsd_datetime_from_xsd_date): Added constructor from a date * src/rasqal_literal.c: (rasqal_literal_compare): Use non-deprecated date/datetime compare methods * src/rasqal.h.in, src/rasqal_datetime.c: XSD date and dateTime compares use timeontimeline and timezone info (rasqal_xsd_date_compare2): Added deprecating rasqal_xsd_date_compare and returning incomparible state. (rasqal_xsd_datetime_compare2): Added deprecating rasqal_xsd_datetime_compare and returning incomparible state. (rasqal_xsd_timeline_compare): Added internal routine comparing timelines with/without timezones using XSD dateTime order relation rules. (test_date_compare, test_datetime_compare): Added testing code. (main): Call above to test comparisons. * src/rasqal_datetime.c: Compare date equality checking timezones (rasqal_xsd_date_equals): Use timezone_minutes (test_date_equals): Added testing function (main): Added date equality tests using above. * src/rasqal_datetime.c: Compare datetime equality with timeline and timezones (rasqal_xsd_datetime_equals): Uses time_on_timeline. (test_datetime_equals): Tester code aded (main): Added tests * src/rasqal.h.in, src/rasqal_datetime.c: Add time_on_timeline and timezone_minutes fields to date and datetime classes 2012-02-15 Dave Beckett * src/rasqal_algebra.c, src/rasqal_digest_sha1.c, src/rasqal_expr_datetimes.c, src/rasqal_expr_strings.c, src/rasqal_feature.c, src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_query_results.c, src/rasqal_query_write.c, src/rasqal_raptor.c, src/rasqal_row.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_triples.c, src/rasqal_service.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Record good and bad casts to const unsigned char* * src/rasqal_digest.c, src/rasqal_expr_datetimes.c, src/rasqal_literal.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_variable.c, src/rdql_lexer.l, src/sparql_lexer.l: Record good and bad casts to unsigned char* * src/rasqal_datetime.c, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_feature.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_prefix.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_test.c, src/rasqal_raptor.c, src/rasqal_regex.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_service.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/sparql_lexer.l, src/sparql_parser.y: Record good and bad casts to const char* * src/rasqal_datetime.c, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_format_html.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_iostream.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_test.c, src/rasqal_random.c, src/rasqal_result_formats.c, src/rasqal_rowsource_triples.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Record good and bad casts to char* * src/rasqal_algebra.c, src/rasqal_dataset.c, src/rasqal_datetime.c, src/rasqal_digest.c, src/rasqal_expr_numerics.c, src/rasqal_literal.c, src/rasqal_random.c, src/rasqal_rowsource.c, src/snprintf.c, src/strcasecmp.c, utils/roqet.c: Record good and bad casts to unsigned int * src/snprintf.c: (rasqal_format_integer): Fix off by 1 in length calculation for integers wider than width * src/rasqal_datetime.c, src/rasqal_internal.h, src/snprintf.c: (rasqal_format_integer): Change return type to size_t * src/rasqal_algebra.c, src/rasqal_datetime.c, src/rasqal_engine.c, src/rasqal_expr.c, src/rasqal_expr_strings.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_graph_pattern.c, src/rasqal_iostream.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_write.c, src/rasqal_random.c, src/rasqal_regex.c, src/rasqal_rowsource.c, src/rasqal_rowsource_join.c, src/rasqal_update.c, src/rasqal_xsd_datatypes.c, src/snprintf.c, src/sparql_lexer.l, src/sparql_parser.y, src/strcasecmp.c: Record good and bad casts to int Using RASQAL_GOOD_CAST and RASQAL_BAD_CAST macros. When bad there are some notes. * src/rasqal_xsd_datatypes.c: Fix int cast in rasqal_xsd_format_double (rasqal_xsd_format_double): Handle trailing_zero_start as a size_t so add a have_trailing_zero flag to mark when it is valid. rasqal-0.9.33/configure.ac0000644000175000017500000011542212434455625012317 00000000000000dnl -*- Mode: autoconf -*- dnl dnl configure.ac - autoconf file for rasqal dnl (Process this file with autoconf to produce a configure script.) dnl dnl Copyright (C) 2003-2011, David Beckett http://www.dajobe.org/ dnl Copyright (C) 2003-2005, University of Bristol, UK http://www.bristol.ac.uk/ dnl dnl This package is Free Software and part of Redland http://librdf.org/ dnl dnl It is licensed under the following three licenses as alternatives: dnl 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version dnl 2. GNU General Public License (GPL) V2 or any newer version dnl 3. Apache License, V2.0 or any newer version dnl dnl You may not use this file except in compliance with at least one of dnl the above three licenses. dnl dnl See LICENSE.html or LICENSE.txt at the top of this package for the dnl complete terms and further detail along with the license texts for dnl the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. dnl AC_PREREQ([2.62]) AC_INIT([Rasqal RDF Query Library],[0.9.33],[http://bugs.librdf.org/],[rasqal]) AC_CONFIG_SRCDIR([src/rasqal_general.c]) AC_CONFIG_HEADERS([src/rasqal_config.h]) AC_CONFIG_AUX_DIR(build) AC_CONFIG_MACRO_DIR(build) AM_INIT_AUTOMAKE([1.11 check-news std-options -Wobsolete -Wportability -Wsyntax -Wunsupported -Wextra-portability]) AM_MAINTAINER_MODE release_version=no AC_ARG_ENABLE(release, [ --enable-release Turn on optimizations (for maintainer). ], \ if test "$enableval" = "yes"; then \ release_version=yes fi;) if test "$USE_MAINTAINER_MODE" = yes -a $release_version = no; then CFLAGS=`echo $CFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` CXXFLAGS=`echo $CXXFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` CPPFLAGS=`echo $CPPFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` fi dnl Checks for programs. AC_CANONICAL_HOST AM_SANITY_CHECK AM_PROG_AR AC_PROG_CC AM_PROG_CC_C_O AC_MSG_CHECKING(whether $CC is clang) dnl Initialize libtool LT_INIT AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET FLEX_MIN_VERSION=2.5.19 FLEX_REC_VERSION=2.5.36 # Do not want AM_PROG_LEX which adds 'missing' to LEX if it's not around AC_PROG_LEX AC_MSG_CHECKING(flex) if test "$USE_MAINTAINER_MODE" = yes; then # maintainer mode - flex is required if test "X$LEX" = "X:" ; then AC_MSG_RESULT(not present) AC_MSG_WARN(Please get flex from http://flex.sourceforge.net/) AC_MSG_WARN(version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)) AC_MSG_FAILURE(flex not present) fi # some kind of lexer is present if echo "$LEX" | grep flex >/dev/null 2>&1; then # flex is present FLEX_VERSION=`$LEX -V 2>&1 | $AWK '{print $2}'` FLEX_VERSION_DEC=`echo $FLEX_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` FLEX_MIN_VERSION_DEC=`echo $FLEX_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` if test $FLEX_VERSION_DEC -ge $FLEX_MIN_VERSION_DEC; then AC_MSG_RESULT($FLEX_VERSION - OK) else AC_MSG_RESULT(version $FLEX_VERSION - too old) AC_MSG_WARN(Please get flex from http://flex.sourceforge.net/) AC_MSG_WARN(version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)) AC_MSG_FAILURE(flex is too old) fi else AC_MSG_RESULT(present - but is not flex) AC_MSG_WARN(Please get flex from http://flex.sourceforge.net/) AC_MSG_WARN(version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)) AC_MSG_FAILURE($LEX is not not flex) fi else # not maintainer mode; flex is not required AC_MSG_RESULT(not present - not required for non maintainer builds) LEX="$SHELL $missing_dir/missing flex" AC_SUBST(LEX_OUTPUT_ROOT, lex.yy) AC_SUBST(LEXLIB, '') FLEX_VERSION_DEC=00000 fi AC_DEFINE_UNQUOTED(FLEX_VERSION_DECIMAL, $FLEX_VERSION_DEC, [Flex version as a decimal]) BISON_MIN_VERSION=3.0.0 AC_CHECK_PROGS(BISON, bison3 bison) if test "$USE_MAINTAINER_MODE" = yes; then AC_MSG_CHECKING(for GNU bison) # Match these styles of versions # GNU Bison version 1.28 # bison (GNU Bison) 1.875 dnl need to change quotes to allow square brackets changequote(<<, >>)dnl BISON_VERSION=`$BISON --version 2>&1 | sed -ne 's/^.*GNU Bison[^0-9]*//p'` changequote([, ])dnl if test "X$BISON_VERSION" != X; then BISON_VERSION_DEC=`echo $BISON_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` BISON_MIN_VERSION_DEC=`echo $BISON_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` if test $BISON_VERSION_DEC -ge $BISON_MIN_VERSION_DEC; then AC_MSG_RESULT($BISON_VERSION - OK) else AC_MSG_RESULT(version $BISON_VERSION is too old) AC_MSG_WARN(Please get GNU Bison from http://www.gnu.org/software/bison/) AC_MSG_WARN(version $BISON_MIN_VERSION or newer) AC_MSG_FAILURE(GNU Bison too old) fi else AC_MSG_FAILURE($BISON is not GNU bison) fi fi AC_SUBST(BISON) AC_CHECK_PROGS(AWK, awk gawk nawk) # Find a tar command for 'make dist' AC_CHECK_PROGS(TAR, gnutar gtar tar) AC_CHECK_PROGS(PERL, perl) AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AC_CHECK_PROGS(RECHO, echo) RECHO_C= RECHO_N= case `$RECHO -n x` in -n*) case `$RECHO 'xy\c'` in *c*) ;; xy) RECHO_C='\c' ;; esac;; *) RECHO_N='-n' ;; esac dnl compiler checks AC_DEFUN([REDLAND_CC_TRY_FLAG], [ AC_MSG_CHECKING([whether $CC supports $1]) ## backup CFLAGS and werror status redland_save_CFLAGS="$CFLAGS" redland_save_ac_c_werror_flag="${ac_c_werror_flag}" AC_LANG_WERROR CFLAGS="$CFLAGS $1" AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [redland_cc_flag=yes], [redland_cc_flag=no]) ## restore CFLAGS and werror status CFLAGS="$redland_save_CFLAGS" ac_c_werror_flag="${redland_save_ac_c_werror_flag}" if test "X$redland_cc_flag" = "Xyes"; then ifelse([$2], , :, [$2]) else ifelse([$3], , :, [$3]) fi AC_MSG_RESULT($redland_cc_flag) ]) # GCC warning options # http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html # # Too noisy: # # -Wconversion : cases that need RASQAL_GOOD/BAD_CAST etc. # -Wcast-qual : cases that need RASQAL_GOOD/BAD_CAST etc. # -Wswitch-default : noisy cases in flex output # -Wsystem-headers : not debugging system # -Wunused-parameter : variables can be marked __attribute__('unused') # # Apple gcc specific (probably): -Wshorten-64-to-32 possible_warnings="\ -Wall \ -Wc++-compat \ -Wextra \ -Wunused \ \ -Waggregate-return \ -Wbad-function-cast \ -Wcast-align \ -Wdeclaration-after-statement \ -Wdisabled-optimization \ -Wdiv-by-zero \ -Wendif-labels \ -Werror-implicit-function-declaration \ -Wfloat-equal \ -Wformat=2 \ -Wframe-larger-than=4096 \ -Winit-self \ -Winline \ -Wmissing-declarations \ -Wmissing-format-attribute \ -Wmissing-noreturn \ -Wmissing-prototypes \ -Wnested-externs \ -Wold-style-definition \ -Wpacked \ -Wpointer-arith \ -Wredundant-decls \ -Wshadow \ -Wsign-compare \ -Wstrict-prototypes \ -Wswitch-enum \ -Wundef \ -Wunreachable-code \ -Wunsafe-loop-optimizations \ -Wwrite-strings \ \ -Wshorten-64-to-32 \ -Wno-conversion \ -Wno-cast-qual \ -Wno-switch-default \ -Wno-system-headers \ -Wno-unused-parameter \ -Wc90-c99-compat \ -Wc99-c11-compat \ " warning_cflags= if test "$USE_MAINTAINER_MODE" = yes; then AC_MSG_CHECKING(for supported $CC warning flags) AC_MSG_RESULT($warning_cflags) for warning in $possible_warnings; do REDLAND_CC_TRY_FLAG([$warning], [warning_cflags="$warning_cflags $warning"]) done AC_MSG_CHECKING($CC supports warning flags) AC_MSG_RESULT($warning_cflags) fi STANDARD_CFLAGS= MAINTAINER_CPPFLAGS="$warning_cflags" # Externally linked libraries - appear in rasqal-config # -Dfoo -Idir RASQAL_CPPFLAGS=$CPPFLAGS # -Ldir RASQAL_LDFLAGS=$LDFLAGS # -llib RASQAL_LIBS=$LIBS # Internally linked libraries - never given to users # -Dfoo -Idir RASQAL_INTERNAL_CPPFLAGS= # -Ldir -llib RASQAL_INTERNAL_LIBS= # Libraries linked externally also may be internal - just raptor # -Ldir -llib RASQAL_EXTERNAL_LIBS= # Extra pkgconfig requires PKGCONFIG_REQUIRES= PKGCONFIG_LIBS= PKGCONFIG_CFLAGS= dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(errno.h stddef.h stdlib.h stdint.h unistd.h string.h strings.h getopt.h regex.h sys/time.h time.h math.h limits.h errno.h float.h) AC_HEADER_TIME if test "$ac_cv_header_sys_time_h" = "yes"; then HAVE_SYS_TIME_H=1 else HAVE_SYS_TIME_H=0 fi AC_SUBST(HAVE_SYS_TIME_H) if test "$ac_cv_header_time_h" = "yes"; then HAVE_TIME_H=1 else HAVE_TIME_H=0 fi AC_SUBST(HAVE_TIME_H) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_BIGENDIAN AC_MSG_CHECKING(whether __FUNCTION__ is available) AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { printf(__FUNCTION__); }])], [AC_DEFINE([HAVE___FUNCTION__], [1], [Is __FUNCTION__ available]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) # Libtool versioning # # CURRENT # The most recent interface number that this library implements. # # REVISION # The implementation number of the CURRENT interface. # # AGE # The difference between the newest and oldest interfaces that this # library implements. In other words, the library implements all the # interface numbers in the range from number `CURRENT - AGE' to # `CURRENT'. # # Rules: # 1. Start with version information of `0:0:0' for each libtool library. # # 2. Update the version information only immediately before a public # release of your software. More frequent updates are unnecessary, # and only guarantee that the current interface number gets larger # faster. # # 3. If the library source code has changed at all since the last # update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). # # 4. If any interfaces have been added, removed, or changed since the # last update, increment CURRENT, and set REVISION to 0. # # 5. If any interfaces have been added since the last public release, # then increment AGE. # # 6. If any interfaces have been removed since the last public release, # then set AGE to 0. # # syntax: CURRENT[:REVISION[:AGE]] RASQAL_LIBTOOL_VERSION=3:0:0 AC_SUBST(RASQAL_LIBTOOL_VERSION) dnl need to change quotes to allow square brackets changequote(<<, >>)dnl version_major=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\1/'` version_minor=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\2/'` version_release=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\3/'` changequote([, ])dnl version_decimal=`expr $version_major \* 10000 + $version_minor \* 100 + $version_release` AC_DEFINE_UNQUOTED(RASQAL_VERSION_MAJOR, $version_major, [Major version number]) AC_DEFINE_UNQUOTED(RASQAL_VERSION_MINOR, $version_minor, [Minor version number]) AC_DEFINE_UNQUOTED(RASQAL_VERSION_RELEASE, $version_release, [Release version number]) AC_DEFINE_UNQUOTED(RASQAL_VERSION_DECIMAL, $version_decimal, [Release version as a decimal]) # for rasqal-config.in RASQAL_VERSION_MAJOR=$version_major RASQAL_VERSION_MINOR=$version_minor RASQAL_VERSION_RELEASE=$version_release RASQAL_VERSION_DECIMAL=$version_decimal AC_SUBST(RASQAL_VERSION) AC_SUBST(RASQAL_VERSION_MAJOR) AC_SUBST(RASQAL_VERSION_MINOR) AC_SUBST(RASQAL_VERSION_RELEASE) AC_SUBST(RASQAL_VERSION_DECIMAL) dnl Checks for library functions. AC_CHECK_FUNCS(getopt getopt_long stricmp strcasecmp vsnprintf initstate_r initstate random_r random gmtime_r rand_r rand srand timegm gettimeofday) AM_CONDITIONAL(STRCASECMP, test $ac_cv_func_stricmp = no -a $ac_cv_func_strcasecmp = no) AM_CONDITIONAL(GETOPT, test $ac_cv_func_getopt = no -a $ac_cv_func_getopt_long = no) AM_CONDITIONAL(TIMEGM, test $ac_cv_func_timegm = no) dnl Windows only version AM_CONDITIONAL(GETTIMEOFDAY, test $ac_cv_func_gettimeofday = no) AC_MSG_CHECKING(whether need to declare optind) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_GETOPT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif ]], [[int x=optind;]])],[AC_MSG_RESULT(no)],[AC_DEFINE(NEED_OPTIND_DECLARATION, 1, need 'extern int optind' declaration?) AC_MSG_RESULT(yes)]) AC_MSG_CHECKING(whether struct tm has tm_gmtoff field) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_TIME_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif ]], [[struct tm my_time; my_time.tm_gmtoff = 0;]])],[have_tm_gmtoff="yes"],[have_tm_gmtoff="no"]) AC_MSG_RESULT($have_tm_gmtoff) if test $have_tm_gmtoff = "yes" ; then AC_DEFINE(HAVE_TM_GMTOFF, 1, [struct tm has tm_gmtoff field]) fi # raptor V2 is REQUIRED; --enable-raptor2 option was removed RAPTOR_MIN_VERSION=2.0.7 PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES([RAPTOR2],[raptor2],[ RAPTOR_VERSION=`$PKG_CONFIG raptor2 --modversion 2>/dev/null` raptor_too_old=0 AS_VERSION_COMPARE([$RAPTOR_VERSION], $RAPTOR_MIN_VERSION, raptor_too_old="1") if test $raptor_too_old = 1; then AC_MSG_ERROR(Raptor $RAPTOR_VERSION is too old - see http://librdf.org/raptor/ to get a $RAPTOR_MIN_VERSION or newer) fi ],[ AC_MSG_ERROR(Raptor is not installed - see http://librdf.org/raptor/ to get $RAPTOR_MIN_VERSION or newer) ]) AC_SUBST(RAPTOR2_CFLAGS) AC_SUBST(RAPTOR2_LIBS) RAPTOR_VERSION_DEC=`echo $RAPTOR_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` AC_SUBST(RAPTOR_VERSION_DEC) AC_SUBST(RAPTOR_MIN_VERSION) AM_CONDITIONAL(RASQAL_SORT, test $RAPTOR_VERSION_DEC '<' 20015) dnl Checks for regex libraries have_regex_pcre=0 have_regex_posix=0 need_regex_pcre=0 need_regex_posix=0 AC_ARG_ENABLE(pcre, [ --disable-pcre Disable PCRE support (default auto)], [enable_pcre=$enableval], [enable_pcre="auto"]) if test "x$enable_pcre" != "xno" ; then AC_ARG_WITH(pcre-config, [ --with-pcre-config=PATH Location of PCRE pcre-config (auto)], pcre_config="$withval", pcre_config="") if test "X$pcre_config" != "Xno" ; then if test "X$pcre_config" != "X" ; then AC_MSG_CHECKING(for $pcre_config) if test -x $pcre_config ; then PCRE_CONFIG=$pcre_config AC_MSG_RESULT(yes) else AC_MSG_ERROR([pcre-config not found at specified path $pcre_config]) fi fi if test "X$PCRE_CONFIG" = "X" ; then AC_CHECK_PROGS(PCRE_CONFIG, pcre-config) fi fi AC_MSG_CHECKING(for pcre) PCRE_VERSION=`$PCRE_CONFIG --version 2>/dev/null` PCRE_MIN_VERSION=3.9 PCRE_VERSION_DEC=`echo $PCRE_VERSION | $AWK -F. '{printf("%d\n", 100*$1 + $2)};'` PCRE_MIN_VERSION_DEC=`echo $PCRE_MIN_VERSION | $AWK -F. '{printf("%d\n", 100*$1 + $2)};'` if test "X$PCRE_VERSION" = X; then AC_MSG_RESULT(not present) elif test "X$PCRE_VERSION" -a $PCRE_VERSION_DEC -ge $PCRE_MIN_VERSION_DEC; then have_regex_pcre=1 AC_MSG_RESULT($PCRE_VERSION) else AC_MSG_WARN($PCRE_VERSION - too old - need $PCRE_MIN_VERSION) fi if test $have_regex_pcre = 1; then AC_DEFINE(HAVE_REGEX_PCRE, 1, [have PCRE regex - Perl Compatible Regular Expressions]) elif test "x$enable_pcre" = "xyes"; then AC_MSG_ERROR(PCRE requested but not found) fi fi AC_MSG_CHECKING(for posix regex library) oLIBS="$LIBS" if test $ac_cv_header_regex_h = yes; then AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #include ]], [[regex_t reg; char *pat="abc"; regcomp(®, pat, 0);]])],[worked=yes],[worked=no]) if test $worked = yes; then have_regex_posix=1 fi fi LIBS="$oLIBS" if test $have_regex_posix = 1; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_REGEX_POSIX, 1, [have POSIX regex library]) else AC_MSG_RESULT(no) fi AC_ARG_WITH(regex-library, [ --with-regex-library=NAME Use regex library - posix, pcre (auto)], regex_library="$withval", regex_library="") for regex_library_name in $regex_library pcre posix; do case $regex_library_name in pcre) if test $have_regex_pcre = 1; then need_regex_pcre=1 AC_DEFINE(RASQAL_REGEX_PCRE, 1, [Use PCRE regex library]) break fi ;; posix) if test $have_regex_posix = 1; then need_regex_posix=1 AC_DEFINE(RASQAL_REGEX_POSIX, 1, [Use POSIX regex library]) break fi ;; *) AC_MSG_ERROR(No such regex library $regex_library_name) ;; esac done AC_MSG_CHECKING(regex library to use) regex_library= if test $need_regex_pcre = 1; then regex_library=pcre elif test $need_regex_posix = 1; then regex_library=posix else regex_library=none AC_DEFINE(RASQAL_REGEX_NONE, 1, [Use no regex library]) AC_MSG_WARN(No regex library available - please install pcre or a POSIX regex library) fi AC_MSG_RESULT($regex_library) dnl Checks for message digest libraries have_digest_mhash=no have_digest_gcrypt=no dnl always available have_digest_internal=yes need_digest_mhash=no need_digest_gcrypt=no need_digest_internal=no AC_ARG_WITH(mhash, [ --with-mhash=DIR mhash installation prefix (no default)], [mhash_dir=$withval], [mhash_dir=""]) oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" if test "X$mhash_dir" != "X" ; then CPPFLAGS="$CPPFLAGS -I$mhash_dir/include" LIBS="$LIBS -L$mhash_dir/lib" fi LIBS="$LIBS -lmhash" AC_CHECK_HEADERS(mhash.h) AC_MSG_CHECKING(for mhash) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #undef PACKAGE #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef VERSION #include ]], [[ MHASH m; mhash_init(MHASH_MD5); ]])],[have_digest_mhash=yes],[have_digest_mhash=no]) AC_MSG_RESULT($have_digest_mhash) CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" AC_ARG_WITH(libgcrypt-config, [ --with-libgcrypt-config=PATH Location of GCRYPT libgcrypt-config (auto)], libgcrypt_config="$withval", libgcrypt_config="") if test "X$libgcrypt_config" != "Xno" ; then if test "X$libgcrypt_config" != "X" ; then AC_MSG_CHECKING(for $libgcrypt_config) if test -x $libgcrypt_config ; then LIBGCRYPT_CONFIG=$libgcrypt_config AC_MSG_RESULT(yes) else AC_MSG_ERROR([libgcrypt-config not found at specified path $libgcrypt_config]) fi fi if test "X$LIBGCRYPT_CONFIG" = "X" ; then AC_CHECK_PROGS(LIBGCRYPT_CONFIG, libgcrypt-config) fi fi AC_CHECK_HEADERS(gcrypt.h) AC_MSG_CHECKING(for gcrypt) GCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version 2>/dev/null` if test "X$GCRYPT_VERSION" = X; then have_digest_gcrypt=no elif test "$ac_cv_header_gcrypt_h" = "yes"; then oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS `$LIBGCRYPT_CONFIG --cflags`" LIBS="$LIBS `$LIBGCRYPT_CONFIG --libs`" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ gcry_md_hd_t hash; gcry_md_open(hash, GCRY_MD_MD5, 0); ]])],[have_digest_gcrypt=yes],[have_digest_gcrypt=no]) CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" else have_digest_gcrypt=no fi AC_MSG_RESULT($have_digest_gcrypt) AC_ARG_WITH(digest-library, [ --with-digest-library=NAME Use message digest library - mhash, gcrypt, internal (auto)], digest_library="$withval", digest_library="") for digest_library_name in $digest_library mhash gcrypt internal; do case $digest_library_name in mhash) if test $have_digest_mhash = yes; then need_digest_mhash=yes AC_DEFINE(RASQAL_DIGEST_MHASH, 1, [Use mhash library for message digests]) break fi ;; gcrypt) if test $have_digest_gcrypt = yes; then need_digest_gcrypt=yes AC_DEFINE(RASQAL_DIGEST_GCRYPT, 1, [Use gcrypt library for message digests]) break fi ;; internal) need_digest_internal=yes AC_DEFINE(RASQAL_DIGEST_INTERNAL, 1, [Use internal routines for message digests]) break ;; *) AC_MSG_ERROR(No such message digest library $digest_library_name) ;; esac done AC_MSG_CHECKING(message digest library to use) digest_library= if test $need_digest_mhash = yes; then digest_library=mhash elif test $need_digest_gcrypt = yes; then digest_library=gcrypt elif test $need_digest_internal = yes; then digest_library=internal else digest_library=none AC_DEFINE(RASQAL_DIGEST_NONE, 1, [Use no message digest library]) AC_MSG_WARN(No message digest library selected - no message digest support will work) fi AC_MSG_RESULT($digest_library) AM_CONDITIONAL(RASQAL_DIGEST_INTERNAL, test $digest_library = internal) dnl Check for uuid libraries have_uuid_libuuid=no have_uuid_libc=no have_uuid_ossp=no need_uuid_libuuid=no need_uuid_libc=no need_uuid_internal=no need_uuid_ossp=no PKG_CHECK_MODULES(UUID, uuid, [ LIBUUID_VERSION=`$PKG_CONFIG uuid --modversion 2>/dev/null` oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS `$PKG_CONFIG uuid --cflags`" LIBS="$LIBS `$PKG_CONFIG uuid --libs`" dnl check for OSSP uuid defines and error out so we only get linux libuuid AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ #if defined(UUID_LEN_BIN) && defined(UUID_VERSION) FAIL #endif uuid_t data; uuid_clear(&data); ]])],[have_uuid_libuuid=yes],[have_uuid_libuuid=no]) CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" ], [have_uuid_libuuid=no]) AC_MSG_CHECKING(for libuuid) AC_MSG_RESULT($have_uuid_libuuid) AC_CHECK_PROGS(UUID_CONFIG, uuid-config) AC_MSG_CHECKING(for ossp libuuid) if test "X$UUID_CONFIG" != X; then OSSP_UUID_VERSION=`$UUID_CONFIG --version 2>/dev/null` oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS `$UUID_CONFIG --cflags`" LIBS="$LIBS `$UUID_CONFIG --ldflags --libs`" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ uuid_t *data; uuid_create(&data); ]])],[have_uuid_ossp=yes],[have_uuid_ossp=no]) CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" fi AC_MSG_RESULT($have_uuid_ossp) AC_CHECK_HEADERS(uuid/uuid.h) AC_MSG_CHECKING(for UUID in libc) if test "$ac_cv_header_uuid_uuid_h" = "yes"; then AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ uuid_t data; uuid_clear(&data); ]])],[have_uuid_libc=yes],[have_uuid_libc=no]) fi AC_MSG_RESULT($have_uuid_libc) AC_ARG_WITH(uuid-library, [ --with-uuid-library=NAME Use UUID library - libuuid, libc (auto)], uuid_library="$withval", uuid_library="") for uuid_library_name in $uuid_library libuuid ossp libc internal; do case $uuid_library_name in libuuid) if test $have_uuid_libuuid = yes; then need_uuid_libuuid=yes AC_DEFINE(RASQAL_UUID_LIBUUID, 1, [Use libuuid library for UUID]) break fi ;; ossp) if test $have_uuid_ossp = yes; then need_uuid_ossp=yes AC_DEFINE(RASQAL_UUID_OSSP, 1, [Use OSSP library for UUID]) break fi ;; libc) if test $have_uuid_libc = yes; then need_uuid_libc=yes AC_DEFINE(RASQAL_UUID_LIBC, 1, [Use UUID in libc library for UUID]) break fi ;; internal) need_uuid_internal=yes AC_DEFINE(RASQAL_UUID_INTERNAL, 1, [Use internal routines for UUID]) break ;; *) AC_MSG_ERROR(No such UUID library $uuid_library_name) ;; esac done AC_MSG_CHECKING(UUID library to use) uuid_library= if test $need_uuid_libuuid = yes; then uuid_library="libuuid $LIBUUID_VERSION" elif test $need_uuid_ossp = yes; then uuid_library="ossp $OSSP_UUID_VERSION" elif test $need_uuid_libc = yes; then uuid_library=libc elif test $need_uuid_internal = yes; then uuid_library=internal else uuid_library=none AC_DEFINE(RASQAL_UUID_NONE, 1, [Use no UUID library]) AC_MSG_WARN(No UUID library selected - no UUID support will work) fi AC_MSG_RESULT($uuid_library) have_libxml=0 need_libxml=0 AC_ARG_ENABLE(xml2, [ --disable-xml2 Disable XML2 support (default auto)], [enable_xml2=$enableval], [enable_xml2="auto"]) if test "x$enable_xml2" != "xno" ; then AC_ARG_WITH(xml2-config, [ --with-xml2-config=PATH Location of libxml xml2-config ()], xml2_config="$withval", xml2_config="") if test "X$xml2_config" != "X" ; then AC_MSG_CHECKING(for $xml2_config) if test -x $xml2_config ; then XML_CONFIG=$xml2_config AC_MSG_RESULT(yes) else AC_MSG_ERROR([xml2-config not found at specified path $xml2_config]) fi fi if test "X$XML_CONFIG" = "X"; then AC_CHECK_PROGS(XML_CONFIG, xml2-config) fi LIBXML_MIN_VERSION=2.6.8 AC_MSG_CHECKING(for libxml2 library) oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" if test "X$XML_CONFIG" != X; then LIBS="$LIBS `$XML_CONFIG --libs`" CPPFLAGS="`$XML_CONFIG --cflags` $CPPFLAGS" LIBXML_VERSION=`$XML_CONFIG --version` libxml_version_dec=`echo $LIBXML_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` LIBXML_MIN_VERSION_dec=`echo $LIBXML_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` AC_MSG_RESULT(yes - version $LIBXML_VERSION) if test $libxml_version_dec -lt $LIBXML_MIN_VERSION_dec; then AC_MSG_WARN(Using libxml $LIBXML_VERSION is unsupported - $LIBXML_MIN_VERSION or newer required.) else AC_CHECK_HEADERS(libxml/xmlschemas.h libxml/xmlschemastypes.h libxml/schemasInternals.h) if test "$ac_cv_header_libxml_xmlschemas_h" = no; then AC_MSG_WARN(libxml library found but not xml schema headers - disabling) else have_libxml=1 fi fi else AC_MSG_RESULT(no) fi CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" if test $have_libxml = 0 && test "x$enable_xml2" = "xyes" ; then AC_MSG_ERROR(libxml2 requested but not found) fi fi dnl RDF Query Languages sparql_query_language=no laqrs_query_language=no rdf_query_languages_available="sparql laqrs" rdf_query_languages_enabled= # This is needed because autoheader can't work out which computed # symbols must be pulled from acconfig.h into config.h.in if test "x" = "y"; then AC_DEFINE(RASQAL_QUERY_LAQRS, 1, [Building LAQRS query]) AC_DEFINE(RASQAL_QUERY_SPARQL, 1, [Building SPARQL query]) fi AC_MSG_CHECKING(query languages required) AC_ARG_ENABLE(query-languages, [ --enable-query-languages=LIST Enable query languages (default=all)], query_languages="$enableval") if test "X$query_languages" = Xall -o "X$query_languages" = X; then query_languages="$rdf_query_languages_available" AC_MSG_RESULT(all) else AC_MSG_RESULT($query_languages) fi for query_language in $query_languages; do p=$query_language eval $p'_query_language=yes' NAME=`echo $p | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` n=RASQAL_QUERY_${NAME} AC_DEFINE_UNQUOTED($n) rdf_query_languages_enabled="$rdf_query_languages_enabled $query_language" done AM_CONDITIONAL(RASQAL_QUERY_LAQRS, test $laqrs_query_language = yes) AM_CONDITIONAL(RASQAL_QUERY_SPARQL, test $sparql_query_language = yes) RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $RAPTOR2_CFLAGS" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $RAPTOR2_LIBS" if test $need_regex_pcre = 1; then C=`$PCRE_CONFIG --cflags` L=`$PCRE_CONFIG --libs` RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" PKGCONFIG_CFLAGS="$PKGCONFIG_CFLAGS $C" PKGCONFIG_LIBS="$PKGCONFIG_LIBS $L" unset C unset L fi if test $need_digest_mhash = yes; then C="" L="-lmhash" if test "X$mhash_dir" != "X" ; then C="-I$mhash_dir/include" L="-L$mhash_dir/lib $L" fi RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" unset C unset L fi if test $need_digest_gcrypt = yes; then C=`$LIBGCRYPT_CONFIG --cflags` L=`$LIBGCRYPT_CONFIG --libs` RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" unset C unset L fi if test $need_uuid_libuuid = yes; then RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $UUID_CFLAGS" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $UUID_LIBS" PKGCONFIG_CFLAGS="$PKGCONFIG_CFLAGS $UUID_CFLAGS" PKGCONFIG_LIBS="$PKGCONFIG_LIBS $UUID_LIBS" fi if test $need_uuid_ossp = yes; then C=`$UUID_CONFIG --cflags` L=`$UUID_CONFIG --ldflags --libs` RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" unset C unset L fi gmp_lib_dir= gmp_include_dir= AC_ARG_WITH(gmp, [ --with-gmp=DIR GMP install area], gmp_prefix="$withval", gmp_prefix="none") if test "X$gmp_prefix" != "Xnone" ; then gmp_libs="-L$gmp_prefix/lib" gmp_includes="-I$gmp_prefix/include" fi mpfr_lib_dir= mpfr_include_dir= AC_ARG_WITH(mpfr, [ --with-mpfr=DIR MPFR install area], mpfr_prefix="$withval", mpfr_prefix="none") if test "X$mpfr_prefix" != "Xnone" ; then mpfr_libs="-L$mpfr_prefix/lib" mpfr_includes="-I$mpfr_prefix/include" fi oCPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $gmp_includes" AC_CHECK_HEADERS(gmp.h) CPPFLAGS="$oCPPFLAGS" CPPFLAGS="$CPPFLAGS $mpfr_includes" AC_CHECK_HEADERS([mpfr.h], [], [], [ #ifdef HAVE_GMP_H #include #endif ]) CPPFLAGS="$oCPPFLAGS" have_mpfr=0 have_gmp=0 oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" if test "$ac_cv_header_mpfr_h" = yes; then CPPFLAGS="$CPPFLAGS $mpfr_includes" LIBS="$LIBS $mpfr_libs -lmpfr" AC_CHECK_FUNC(mpfr_init, have_mpfr_init=yes, have_mpfr_init=no) # Several functions are used that are not in GMP version of MPFR: # mpfr_get_default_rounding_mode mpfr_equal_p mpfr_free_str # MPFR 2.1.0 released 3 Nov 2004 http://www.mpfr.org/mpfr-2.1.0/ # mpfr_snprintf # MPFR 2.4.0 released 26 January 2009 http://www.mpfr.org/mpfr-2.4.0/ # so just test for the latter. AC_CHECK_FUNC(mpfr_snprintf, have_mpfr_snprintf=yes, have_mpfr_snprintf=no) LIBS="$oLIBS" CPPFLAGS="$oCPPFLAGS" AC_MSG_CHECKING(for working MPFR library) if test $have_mpfr_init = yes -a $have_mpfr_snprintf = yes; then have_mpfr=1 AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" have_gmp_version=0 have_gmp_random=no if test "$ac_cv_header_gmp_h" = yes; then CPPFLAGS="$CPPFLAGS $gmp_includes" LIBS="$LIBS $gmp_libs -lgmp" AC_MSG_CHECKING(for working GNU MP library) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[mpz_t n; mpz_init(n);]])],[have_gmp=1 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for GNU MP library random support) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ gmp_randstate_t r; unsigned int ui = 12345; mpz_t iresult; mpz_t n; mpf_t fresult; gmp_randinit_default(r); gmp_randseed_ui(r, ui); mpz_init(iresult); mpz_init_set_ui(n, 12345); mpz_urandomm(iresult, r, n); mpz_clear(iresult); mpf_urandomb(fresult, r, 5); mpf_clear(fresult); mpz_clear(n); gmp_randclear(r); ]])],[have_gmp_random=yes AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for gmp_version) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[const char* v=gmp_version; ]])],[have_gmp_version=1 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) fi CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" if test $have_gmp_version = 1; then AC_DEFINE(HAVE_GMP_VERSION, 1, [Have gmp_version constant]) fi need_mpfr=0 need_gmp=0 AC_ARG_WITH(decimal, [ --with-decimal=NAME Use decimal library - mpfr (default), gmp, none], decimal="$withval", decimal="mpfr") for decimal_name in $decimal mpfr gmp none; do case $decimal_name in mpfr) if test $have_mpfr = 1; then need_mpfr=1 AC_DEFINE([RASQAL_DECIMAL_MPFR], 1, [Decimal from MPFR library]) break fi ;; gmp) if test $have_gmp = 1; then need_gmp=1 AC_DEFINE([RASQAL_DECIMAL_GMP], 1, [Decimal from GNU MP library]) break fi ;; none) need_mpfr=0 need_gmp=0 AC_DEFINE([RASQAL_DECIMAL_NONE], 1, [Decimal without a library]) break ;; *) AC_MSG_ERROR(No such decimal library $decimal_name) ;; esac done AC_MSG_CHECKING(decimal libraries available) decimal_libraries_available= if test $have_mpfr = 1; then decimal_libraries_available="$decimal_libraries_available mpfr" fi if test $have_gmp = 1; then decimal_libraries_available="$decimal_libraries_available gmp" fi AC_MSG_RESULT($decimal_libraries_available) need_libm=0 AC_MSG_CHECKING(decimal library to use) decimal_library= if test $need_mpfr = 1; then decimal_library="mpfr $MPFR_VERSION" elif test $need_gmp = 1; then decimal_library="gmp $GMP_VERSION" else decimal_library=none fi AC_MSG_RESULT($decimal_library) dnl Random generator random_approaches="mtwist" if test "$have_gmp_random" = yes; then random_approaches="$random_approaches gmp" fi random_approaches="$random_approaches random_r rand_r random rand" AC_ARG_WITH(random-approach, [ --with-random-approach=NAME Use random approach - mtwist, random_r, rand_r, random, rand (auto)], random_with="$withval", random_with="") AC_MSG_CHECKING(random approach) random_approach=none need_mtwist=no for random_algo in $random_with $random_approaches; do case $random_algo in mtwist) random_approach="Internal Mersenne Twister" need_mtwist=yes AC_DEFINE(RANDOM_ALGO_MTWIST, 1, [Use internal Mersenne Twister]) break ;; gmp) if test "$have_gmp_random" = yes; then random_approach="GMP gmp_randseed_ui and mpz_urandomm()" AC_DEFINE(RANDOM_ALGO_GMP_RAND, 1, [Use GMP gmp_randseed_ui() and mpz_urandomm()]) break fi ;; random_r) if test "$ac_cv_func_initstate_r" = "yes" -a "$ac_cv_func_random_r" = "yes"; then random_approach="glibc initstate_r() and random_r()" AC_DEFINE(RANDOM_ALGO_RANDOM_R, 1, [Use glibc initstate_r() and random_r()]) break fi ;; rand_r) if test "$ac_cv_func_rand_r" = "yes"; then random_approach="POSIX rand_r()" AC_DEFINE(RANDOM_ALGO_RAND_R, 1, [Use POSIX rand_r()]) break fi ;; random) if test "$ac_cv_func_initstate" = "yes" -a "$ac_cv_func_random" = "yes"; then random_approach="BSD initstate() and random()" AC_DEFINE(RANDOM_ALGO_RANDOM, 1, [Use BSD initstate() and random()]) break fi ;; rand) if test "$ac_cv_func_srand" = "yes" -a "$ac_cv_func_rand" = "yes"; then random_approach="POSIX srand() and rand()" AC_DEFINE(RANDOM_ALGO_RAND, 1, [Use POSIX srand() and rand()]) break fi ;; *) ;; esac done if test "$random_approach" = none; then AC_MSG_ERROR(No random number generator approach. POSIX rand should always be available) fi AC_MSG_RESULT($random_approach) AM_CONDITIONAL(RASQAL_MTWIST, test $need_mtwist = yes) dnl Always need ceil, floor and round in rasqal_literal_ceil() etc. AC_MSG_CHECKING([for ceil, floor and round in default libs]) ceil_lib=none AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_MATH_H #include #endif #ifdef HAVE_STDLIB_H #include #endif ]], [[ extern char **environ; double t = strtod(environ[0], NULL); return (int)(ceil(t) * floor(t) * round(t)); ]])], AC_MSG_RESULT(yes) ceil_lib=libc, AC_MSG_RESULT(no), ceil_lib=cross) if test $ceil_lib = none; then LIBS="$LIBS -lm" AC_MSG_CHECKING([for ceil, floor and round with -lm]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_MATH_H #include #endif #ifdef HAVE_STDLIB_H #include #endif ]], [[ extern char **environ; double t = strtod(environ[0], NULL); return (int)(ceil(t) * floor(t) * round(t)); ]])], AC_MSG_RESULT(yes) need_libm=1 ceil_lib=libm, AC_MSG_RESULT(no), ceil_lib=cross) LIBS="$oLIBS" fi if test $ceil_lib = cross; then AC_MSG_WARN([Assuming ceil, floor and round are in default libs for cross compiling]) ceil_lib=libc elif test $ceil_lib = none; then AC_MSG_ERROR([Could not find ceil, floor, round in default libs or with -lm]) fi if test $need_libm = 1; then RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS -lm" fi DECIMAL_INCLUDES= DECIMAL_LIBS= if test $need_mpfr = 1; then DECIMAL_INCLUDES="$mpfr_includes" DECIMAL_LIBS="$mpfr_libs -lmpfr" fi if test $need_gmp = 1; then DECIMAL_INCLUDES="$gmp_includes" DECIMAL_LIBS="$gmp_libs -lgmp" fi RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $DECIMAL_INCLUDES" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $DECIMAL_LIBS" if test $need_libxml = 1; then RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS `$XML_CONFIG --cflags`" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS `$XML_CONFIG --libs`" if test "X$PKGCONFIG_REQUIRES" != X; then PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES," fi PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES libxml-2.0 >= $LIBXML_MIN_VERSION" fi # Make final changes to cflags MEM= MEM_LIBS= CPPFLAGS="-DRASQAL_INTERNAL=1 $CPPFLAGS" debug_messages=no AC_ARG_ENABLE(debug, [ --enable-debug Enable debug messages (default no). ], debug_messages=$enableval) if test "$debug_messages" = "yes"; then CPPFLAGS="-g -DRASQAL_DEBUG=1 $CPPFLAGS" fi AC_ARG_WITH(memory-signing, [ --with-memory-signing Sign allocated memory (default=no)], use_memory_signing="$withval", use_memory_signing="no") AC_MSG_CHECKING(using memory signing) AC_MSG_RESULT($use_memory_signing); if test $use_memory_signing = yes; then MEM=-DRASQAL_MEMORY_SIGN=1 MEM_LIBS= fi STANDARD_CFLAGS="$STANDARD_CFLAGS $CFLAGS" if test "$USE_MAINTAINER_MODE" = yes; then CPPFLAGS="-DMAINTAINER_MODE $MAINTAINER_CPPFLAGS $CPPFLAGS" fi AC_SUBST(RASQAL_EXTERNAL_LIBS) AC_SUBST(RASQAL_INTERNAL_CPPFLAGS) AC_SUBST(RASQAL_INTERNAL_LIBS) AC_SUBST(MEM) AC_SUBST(MEM_LIBS) AC_SUBST(STANDARD_CFLAGS) AC_SUBST(RECHO) AC_SUBST(RECHO_N) AC_SUBST(RECHO_C) RASQAL_LIBTOOLLIBS=librasqal.la AC_SUBST(RASQAL_LIBTOOLLIBS) AC_SUBST(PKGCONFIG_REQUIRES) AC_SUBST(PKGCONFIG_LIBS) AC_SUBST(PKGCONFIG_CFLAGS) abs_top_srcdir=`cd $srcdir; pwd` AC_SUBST(abs_top_srcdir) abs_top_builddir=`pwd` AC_SUBST(abs_top_builddir) dnl automake 1.11 AM_SILENT_RULES([no]) AC_CONFIG_FILES([Makefile data/Makefile docs/Makefile docs/version.xml scripts/Makefile libsv/Makefile libmtwist/Makefile getopt/Makefile src/Makefile src/rasqal.h src/win32_rasqal_config.h tests/Makefile tests/algebra/Makefile tests/engine/Makefile tests/laqrs/Makefile tests/laqrs/syntax/Makefile tests/sparql/Makefile tests/sparql/bugs/Makefile tests/sparql/simple/Makefile tests/sparql/part1/Makefile tests/sparql/examples/Makefile tests/sparql/syntax/Makefile tests/sparql/bound/Makefile tests/sparql/survey/Makefile tests/sparql/SyntaxFull/Makefile tests/sparql/sort/Makefile tests/sparql/ValueTesting/Makefile tests/sparql/regex/Makefile tests/sparql/Expr1/Makefile tests/sparql/Expr2/Makefile tests/sparql/ExprBuiltins/Makefile tests/sparql/ExprEquals/Makefile tests/sparql/SyntaxDev/Makefile tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile tests/sparql/update/Makefile tests/sparql/aggregate/Makefile tests/sparql/sparql11/Makefile tests/sparql/federated/Makefile tests/sparql/warnings/Makefile utils/Makefile win32/Makefile rasqal.spec rasqal.rdf rasqal.pc]) AC_CONFIG_FILES([src/rasqal-config], [chmod +x src/rasqal-config]) AC_CONFIG_FILES([rasqal-src-config], [chmod +x rasqal-src-config]) dnl Check for gtk-doc and docbook GTK_DOC_CHECK([1.3]) AC_OUTPUT AC_MSG_RESULT([ Rasqal build summary: RDF query languages available : $rdf_query_languages_available RDF query languages enabled :$rdf_query_languages_enabled Raptor version : $RAPTOR_VERSION Decimal library : $decimal_library Regex library : $regex_library Message digest library : $digest_library UUID library : $uuid_library Random approach : $random_approach ceil, floor, round source : $ceil_lib ]) rasqal-0.9.33/rasqal.rdf.in0000644000175000017500000000645111754356266012424 00000000000000 Rasqal Rasqal RDF Query Library. 2003-08-12 Rasqal is a library providing full support for querying Resource Description Framework (RDF) including parsing query syntaxes, constructing the queries, executing them and returning result formats. It supports parsing and executing the SPARQL Query language. Dave Beckett 970987f991961f2553a1bf2574166fa29befbccb stable 2005-02-01 @VERSION@ Dave Beckett 970987f991961f2553a1bf2574166fa29befbccb rasqal-0.9.33/docs/0000755000175000017500000000000012443715253011030 500000000000000rasqal-0.9.33/docs/version.xml0000644000175000017500000000000712443715244013154 000000000000000.9.33 rasqal-0.9.33/docs/html/0000755000175000017500000000000012443715253011774 500000000000000rasqal-0.9.33/docs/html/reference-manual.html0000644000175000017500000002347212443715253016023 00000000000000 Part I. Reference Manual

This part contains the Rasqal Reference Manual which comprehensively describes every class and function of the API.

Table of Contents

General library facilities — Startup and shutdown, memory handling, version checks and misc functions.
Data Graphs — RDF graph sources for triples.
Expressions — Query language expressions.
Graph patterns — Collections of triple patterns, sub-graph patterns with operators.
Literal — RDF literals and RDF query-specific literals.
Prefixes — XML QName-style prefixes made from a URI and a short text prefix.
Query — Query object API, parsing and execution
Query Results — Query results as variable bindings, boolean or RDF graphs.
Query Results Formatter — Query results formatted into a syntax.
Query Result Row — Result row in a query result set containing a set of literals that are bound to variables.
Service — Execute queries remotely via a SPARQL HTTP Protocol service.
Triples — Triple pattern or RDF triple.
Triples Source — Source of matches to a triple pattern.
Variables — Variable with names and literal value.
Variables Table — A table of variables with optional bound literal values.
Updates — Graph update operations
Utilities — Utility functions.
XML Schema Datetime and Decimals — XML Schema datetime and arbitrary length decimal number arithmetic.
API Changes
Introduction
Changes between Rasqal 0.9.21 and 0.9.22
New functions, types and enums
Deleted functions, types and enums
Renamed function and enums
Changed functions and types
Changes between Rasqal 0.9.22 and 0.9.23
New functions, types and enums
Changes between Rasqal 0.9.23 and 0.9.24
New functions, types and enums
Changes between Rasqal 0.9.24 and 0.9.25
New functions, types and enums
Changes between Rasqal 0.9.25 and 0.9.26
New functions, types and enums
Changes between Rasqal 0.9.26 and 0.9.27
New functions, types and enums
Changes between Rasqal 0.9.27 and 0.9.28
New functions, types and enums
Changes between Rasqal 0.9.28 and 0.9.29
New functions, types and enums
Changed functions and types
Changes between Rasqal 0.9.29 and 0.9.30
New functions, types and enums
Changes between Rasqal 0.9.30 and 0.9.31
New functions, types and enums
Changes between Rasqal 0.9.32 and 0.9.33
New functions, types and enums
Renamed function and enums
Changed functions and types
Changes between Rasqal 0.9.30 and 0.9.30
New functions, types and enums
rasqal-0.9.33/docs/html/rasqal-changes-0-9-30-to-0-9-30.html0000644000175000017500000000437412443715253017371 00000000000000 Changes between Rasqal 0.9.30 and 0.9.30

Changes between Rasqal 0.9.30 and 0.9.30

New functions, types and enums

Enums

rasqal-0.9.33/docs/html/rasqal-section-graph-pattern.html0000644000175000017500000013557612443715253020322 00000000000000 Graph patterns

Graph patterns

Graph patterns — Collections of triple patterns, sub-graph patterns with operators.

Synopsis

typedef             rasqal_graph_pattern;
int                 rasqal_graph_pattern_add_sub_graph_pattern
                                                        (rasqal_graph_pattern *graph_pattern,
                                                         rasqal_graph_pattern *sub_graph_pattern);
rasqal_expression * rasqal_graph_pattern_get_filter_expression
                                                        (rasqal_graph_pattern *gp);
int                 rasqal_graph_pattern_set_filter_expression
                                                        (rasqal_graph_pattern *gp,
                                                         rasqal_expression *expr);
raptor_sequence *   rasqal_graph_pattern_get_flattened_triples
                                                        (rasqal_query *query,
                                                         rasqal_graph_pattern *graph_pattern);
int                 rasqal_graph_pattern_get_index      (rasqal_graph_pattern *gp);
rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator
                                                        (rasqal_graph_pattern *graph_pattern);
rasqal_literal *    rasqal_graph_pattern_get_origin     (rasqal_graph_pattern *graph_pattern);
rasqal_graph_pattern * rasqal_graph_pattern_get_sub_graph_pattern
                                                        (rasqal_graph_pattern *graph_pattern,
                                                         int idx);
raptor_sequence *   rasqal_graph_pattern_get_sub_graph_pattern_sequence
                                                        (rasqal_graph_pattern *graph_pattern);
rasqal_triple *     rasqal_graph_pattern_get_triple     (rasqal_graph_pattern *graph_pattern,
                                                         int idx);
raptor_sequence *   rasqal_graph_pattern_get_triples    (rasqal_query *query,
                                                         rasqal_graph_pattern *graph_pattern);
rasqal_literal *    rasqal_graph_pattern_get_service    (rasqal_graph_pattern *graph_pattern);
rasqal_variable *   rasqal_graph_pattern_get_variable   (rasqal_graph_pattern *graph_pattern);
enum                rasqal_graph_pattern_operator;
const char *        rasqal_graph_pattern_operator_as_string
                                                        (rasqal_graph_pattern_operator op);
int                 rasqal_graph_pattern_print          (rasqal_graph_pattern *gp,
                                                         FILE *fh);
int                 rasqal_graph_pattern_variable_bound_in
                                                        (rasqal_graph_pattern *gp,
                                                         rasqal_variable *v);
int                 (*rasqal_graph_pattern_visit_fn)    (rasqal_query *query,
                                                         rasqal_graph_pattern *gp,
                                                         void *user_data);
int                 rasqal_graph_pattern_visit          (rasqal_query *query,
                                                         rasqal_graph_pattern *gp,
                                                         rasqal_graph_pattern_visit_fn fn,
                                                         void *user_data);

Description

Graph patterns form a a tree structure that build a rasqal_query top-level graph pattern (see rasqal_query_get_query_graph_pattern()) which may have sub-graph patterns. Graph patterns at the leaf of the tree operate over triple patterns (rasqal_triple) matching the RDF triples in the data sources for RASQAL_GRAPH_PATTERN_OPERATOR_BASIC or RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL. Other graph patterns operators operate over sub graph patterns and group them, union them or apply a GRAPH matching keyword (RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH).

Details

rasqal_graph_pattern

rasqal_graph_pattern* graph_pattern;

Rasqal graph pattern class.


rasqal_graph_pattern_add_sub_graph_pattern ()

int                 rasqal_graph_pattern_add_sub_graph_pattern
                                                        (rasqal_graph_pattern *graph_pattern,
                                                         rasqal_graph_pattern *sub_graph_pattern);

Add a sub graph pattern to a graph pattern.

graph_pattern :

graph pattern to add to

sub_graph_pattern :

graph pattern to add inside

Returns :

non-0 on failure

rasqal_graph_pattern_get_filter_expression ()

rasqal_expression * rasqal_graph_pattern_get_filter_expression
                                                        (rasqal_graph_pattern *gp);

Get a filter graph pattern's constraint expression

gp :

rasqal_graph_pattern query object

Returns :

expression or NULL on failure

rasqal_graph_pattern_set_filter_expression ()

int                 rasqal_graph_pattern_set_filter_expression
                                                        (rasqal_graph_pattern *gp,
                                                         rasqal_expression *expr);

Set a filter graph pattern constraint expression

gp :

rasqal_graph_pattern query object

expr :

rasqal_expression expr - ownership taken

Returns :

non-0 on failure

rasqal_graph_pattern_get_flattened_triples ()

raptor_sequence *   rasqal_graph_pattern_get_flattened_triples
                                                        (rasqal_query *query,
                                                         rasqal_graph_pattern *graph_pattern);

Get the triples inside a tree of graph patterns (BASIC + GRAPH) as a single sequence with GRAPHs turned into triple origin.

The returned sequence and all the rasqal_triple in it are owned by the caller (hold references).

query :

query

graph_pattern :

graph pattern

Returns :

new sequence of raptor_triple or NULL on failure

rasqal_graph_pattern_get_index ()

int                 rasqal_graph_pattern_get_index      (rasqal_graph_pattern *gp);

Get the graph pattern absolute index in the array of graph patterns.

The graph pattern index is assigned when rasqal_query_prepare() is run on a query containing a graph pattern.

gp :

rasqal_graph_pattern graph pattern

Returns :

index or <0 if no index has been assigned yet

rasqal_graph_pattern_get_operator ()

rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator
                                                        (rasqal_graph_pattern *graph_pattern);

Get the graph pattern operator .

The operator for the given graph pattern. See also rasqal_graph_pattern_operator_as_string().

graph_pattern :

rasqal_graph_pattern graph pattern object

Returns :

graph pattern operator

rasqal_graph_pattern_get_origin ()

rasqal_literal *    rasqal_graph_pattern_get_origin     (rasqal_graph_pattern *graph_pattern);

Get the graph pattern literal for RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH graph pattern

graph_pattern :

rasqal_graph_pattern graph pattern object

Returns :

graph literal parameter or NULL if wrong graph pattern type or not defined

rasqal_graph_pattern_get_sub_graph_pattern ()

rasqal_graph_pattern * rasqal_graph_pattern_get_sub_graph_pattern
                                                        (rasqal_graph_pattern *graph_pattern,
                                                         int idx);

Get a sub-graph pattern inside a graph pattern.

graph_pattern :

rasqal_graph_pattern graph pattern object

idx :

index into the sequence of sub graph_patterns in the graph pattern

Returns :

rasqal_graph_pattern or NULL if out of range

rasqal_graph_pattern_get_sub_graph_pattern_sequence ()

raptor_sequence *   rasqal_graph_pattern_get_sub_graph_pattern_sequence
                                                        (rasqal_graph_pattern *graph_pattern);

Get the sequence of graph patterns inside a graph pattern .

graph_pattern :

rasqal_graph_pattern graph pattern object

Returns :

a raptor_sequence of rasqal_graph_pattern pointers.

rasqal_graph_pattern_get_triple ()

rasqal_triple *     rasqal_graph_pattern_get_triple     (rasqal_graph_pattern *graph_pattern,
                                                         int idx);

Get a triple inside a graph pattern.

graph_pattern :

rasqal_graph_pattern graph pattern object

idx :

index into the sequence of triples in the graph pattern

Returns :

rasqal_triple or NULL if out of range

rasqal_graph_pattern_get_triples ()

raptor_sequence *   rasqal_graph_pattern_get_triples    (rasqal_query *query,
                                                         rasqal_graph_pattern *graph_pattern);

Get the triples inside this graph pattern (if any).

The returned sequence and all the rasqal_triple in it are owned by the caller (hold references).

query :

query

graph_pattern :

graph pattern

Returns :

new sequence of raptor_triple or NULL on failure or no triples

rasqal_graph_pattern_get_service ()

rasqal_literal *    rasqal_graph_pattern_get_service    (rasqal_graph_pattern *graph_pattern);

Get the literal for RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE graph pattern

graph_pattern :

rasqal_graph_pattern graph pattern object

Returns :

graph variable or NULL if wrong graph pattern or not defined

rasqal_graph_pattern_get_variable ()

rasqal_variable *   rasqal_graph_pattern_get_variable   (rasqal_graph_pattern *graph_pattern);

Get the variable for RASQAL_GRAPH_PATTERN_OPERATOR_LET graph pattern

graph_pattern :

rasqal_graph_pattern graph pattern object

Returns :

graph variable or NULL if wrong graph pattern or not defined

enum rasqal_graph_pattern_operator

typedef enum {
  RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN   = 0,
  RASQAL_GRAPH_PATTERN_OPERATOR_BASIC     = 1,
  RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL  = 2,
  RASQAL_GRAPH_PATTERN_OPERATOR_UNION     = 3,
  RASQAL_GRAPH_PATTERN_OPERATOR_GROUP     = 4,
  RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH     = 5,
  RASQAL_GRAPH_PATTERN_OPERATOR_FILTER    = 6,
  RASQAL_GRAPH_PATTERN_OPERATOR_LET       = 7,
  RASQAL_GRAPH_PATTERN_OPERATOR_SELECT    = 8,
  RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE   = 9,
  RASQAL_GRAPH_PATTERN_OPERATOR_MINUS     = 10,
  RASQAL_GRAPH_PATTERN_OPERATOR_VALUES    = 11,

  RASQAL_GRAPH_PATTERN_OPERATOR_LAST = RASQAL_GRAPH_PATTERN_OPERATOR_VALUES
} rasqal_graph_pattern_operator;

Graph pattern operators

RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN

Internal.

RASQAL_GRAPH_PATTERN_OPERATOR_BASIC

Just triple patterns and constraints.

RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL

Set of graph patterns (ANDed) and constraints.

RASQAL_GRAPH_PATTERN_OPERATOR_UNION

Set of graph patterns (UNIONed) and constraints.

RASQAL_GRAPH_PATTERN_OPERATOR_GROUP

Set of graph patterns (ANDed) and constraints.

RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH

A graph term + a graph pattern and constraints.

RASQAL_GRAPH_PATTERN_OPERATOR_FILTER

A filter graph pattern with an expression

RASQAL_GRAPH_PATTERN_OPERATOR_LET

LET ?var := Expression (LAQRS)

RASQAL_GRAPH_PATTERN_OPERATOR_SELECT

SELECT graph pattern

RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE

SERVICE graph pattern

RASQAL_GRAPH_PATTERN_OPERATOR_MINUS

MINUS graph pattern

RASQAL_GRAPH_PATTERN_OPERATOR_VALUES

VALUES graph pattern

RASQAL_GRAPH_PATTERN_OPERATOR_LAST

Internal.

rasqal_graph_pattern_operator_as_string ()

const char *        rasqal_graph_pattern_operator_as_string
                                                        (rasqal_graph_pattern_operator op);

Get a string for the query verb.

op :

the rasqal_graph_pattern_operator verb of the query

Returns :

pointer to a shared string label for the query verb

rasqal_graph_pattern_print ()

int                 rasqal_graph_pattern_print          (rasqal_graph_pattern *gp,
                                                         FILE *fh);

Print a rasqal_graph_pattern in a debug format.

The print debug format may change in any release.

gp :

the rasqal_graph_pattern object

fh :

the FILE* handle to print to

Returns :

non-0 on failure

rasqal_graph_pattern_variable_bound_in ()

int                 rasqal_graph_pattern_variable_bound_in
                                                        (rasqal_graph_pattern *gp,
                                                         rasqal_variable *v);

Is the variable bound in this graph pattern (not including children)?

gp :

graph pattern

v :

variable

Returns :

non-0 if variable is bound in the given graph pattern.

rasqal_graph_pattern_visit_fn ()

int                 (*rasqal_graph_pattern_visit_fn)    (rasqal_query *query,
                                                         rasqal_graph_pattern *gp,
                                                         void *user_data);

User function to visit an graph_pattern and operate on it with rasqal_graph_pattern_visit() or rasqal_query_graph_pattern_visit()

query :

rasqal_query containing the graph pattern

gp :

current graph_pattern

user_data :

user data passed in

Returns :

non-0 to truncate the visit

rasqal_graph_pattern_visit ()

int                 rasqal_graph_pattern_visit          (rasqal_query *query,
                                                         rasqal_graph_pattern *gp,
                                                         rasqal_graph_pattern_visit_fn fn,
                                                         void *user_data);

Visit a user function over a rasqal_graph_pattern

If the user function fn returns 0, the visit is truncated.

query :

rasqal_query to operate on

gp :

rasqal_graph_pattern graph pattern

fn :

pointer to function to apply that takes user data and graph pattern parameters

user_data :

user data for applied function

Returns :

0 if the visit was truncated.
rasqal-0.9.33/docs/html/rasqal-section-expression.html0000644000175000017500000033224212443715253017732 00000000000000 Expressions

Expressions

Expressions — Query language expressions.

Synopsis

typedef             rasqal_expression;
enum                rasqal_expression_flags;
                    rasqal_evaluation_context;
enum                rasqal_op;
enum                rasqal_compare_flags;
enum                rasqal_pattern_flags;
rasqal_expression * rasqal_new_0op_expression           (rasqal_world *world,
                                                         rasqal_op op);
rasqal_expression * rasqal_new_1op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg);
rasqal_expression * rasqal_new_2op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_expression *arg2);
rasqal_expression * rasqal_new_3op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_expression *arg2,
                                                         rasqal_expression *arg3);
rasqal_expression * rasqal_new_4op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_expression *arg2,
                                                         rasqal_expression *arg3,
                                                         rasqal_expression *arg4);
rasqal_expression * rasqal_new_aggregate_function_expression
                                                        (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         raptor_sequence *params,
                                                         unsigned int flags);
rasqal_expression * rasqal_new_cast_expression          (rasqal_world *world,
                                                         raptor_uri *name,
                                                         rasqal_expression *value);
rasqal_expression * rasqal_new_function_expression      (rasqal_world *world,
                                                         raptor_uri *name,
                                                         raptor_sequence *args,
                                                         raptor_sequence *params,
                                                         unsigned int flags);
rasqal_expression * rasqal_new_group_concat_expression  (rasqal_world *world,
                                                         unsigned int flags,
                                                         raptor_sequence *args,
                                                         rasqal_literal *separator);
rasqal_expression * rasqal_new_literal_expression       (rasqal_world *world,
                                                         rasqal_literal *literal);
rasqal_expression * rasqal_new_set_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         raptor_sequence *args);
rasqal_expression * rasqal_new_string_op_expression     (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_literal *literal);
rasqal_expression * rasqal_new_expression_from_expression
                                                        (rasqal_expression *e);
rasqal_expression * rasqal_new_expr_seq_expression      (rasqal_world *world,
                                                         rasqal_op op,
                                                         raptor_sequence *args);
void                rasqal_free_expression              (rasqal_expression *e);
int                 rasqal_expression_compare           (rasqal_expression *e1,
                                                         rasqal_expression *e2,
                                                         int flags,
                                                         int *error_p);
rasqal_literal *    rasqal_expression_evaluate          (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         rasqal_expression *e,
                                                         int flags);
rasqal_literal *    rasqal_expression_evaluate2         (rasqal_expression *e,
                                                         rasqal_evaluation_context *eval_context,
                                                         int *error_p);
const char *        rasqal_expression_op_label          (rasqal_op op);
int                 rasqal_expression_print             (rasqal_expression *e,
                                                         FILE *fh);
void                rasqal_expression_print_op          (rasqal_expression *e,
                                                         FILE *fh);
int                 (*rasqal_expression_visit_fn)       (void *user_data,
                                                         rasqal_expression *e);
int                 rasqal_expression_visit             (rasqal_expression *e,
                                                         rasqal_expression_visit_fn fn,
                                                         void *user_data);
rasqal_evaluation_context * rasqal_new_evaluation_context
                                                        (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         int flags);
void                rasqal_free_evaluation_context      (rasqal_evaluation_context *eval_context);
int                 rasqal_evaluation_context_set_base_uri
                                                        (rasqal_evaluation_context *eval_context,
                                                         raptor_uri *base_uri);
int                 rasqal_evaluation_context_set_rand_seed
                                                        (rasqal_evaluation_context *eval_context,
                                                         unsigned int seed);

Description

Expressions form an expression tree that can be evaluated using rasqal_expression_evaluate() over rasqal_op operators, rasqal_literal constants and rasqal_variable values bound in some rasqal_query_result. The result is a rasqal_literal value.

Details

rasqal_expression

typedef struct rasqal_expression_s rasqal_expression;

Expression with arguments


enum rasqal_expression_flags

typedef enum {
  RASQAL_EXPR_FLAG_DISTINCT = 1,
  RASQAL_EXPR_FLAG_AGGREGATE = 2
} rasqal_expression_flags;

Flags for expressions.

RASQAL_EXPR_FLAG_DISTINCT

Distinct

RASQAL_EXPR_FLAG_AGGREGATE

Aggregate function expression

rasqal_evaluation_context

typedef struct {
  rasqal_world *world;
  raptor_uri* base_uri;
  raptor_locator *locator;
  int flags;
  unsigned int seed;
  rasqal_random* random;
} rasqal_evaluation_context;

A context for evaluating an expression such as with rasqal_expression_evaluate2()

rasqal_world *world;

rasqal world

raptor_uri *base_uri;

base URI of expression context (or NULL)

raptor_locator *locator;

locator or NULL

int flags;

expression comparison flags

unsigned int seed;

random seeed

rasqal_random *random;

random number generator object

enum rasqal_op

typedef enum {
  /* internal */
  RASQAL_EXPR_UNKNOWN,
  RASQAL_EXPR_AND,
  RASQAL_EXPR_OR,
  RASQAL_EXPR_EQ,
  RASQAL_EXPR_NEQ,
  RASQAL_EXPR_LT,
  RASQAL_EXPR_GT,
  RASQAL_EXPR_LE,
  RASQAL_EXPR_GE,
  RASQAL_EXPR_UMINUS,
  RASQAL_EXPR_PLUS,
  RASQAL_EXPR_MINUS,
  RASQAL_EXPR_STAR,
  RASQAL_EXPR_SLASH,
  RASQAL_EXPR_REM,
  RASQAL_EXPR_STR_EQ,
  RASQAL_EXPR_STR_NEQ,
  RASQAL_EXPR_STR_MATCH,
  RASQAL_EXPR_STR_NMATCH,
  RASQAL_EXPR_TILDE,
  RASQAL_EXPR_BANG,
  RASQAL_EXPR_LITERAL,
  RASQAL_EXPR_FUNCTION,
  RASQAL_EXPR_BOUND,
  RASQAL_EXPR_STR,
  RASQAL_EXPR_LANG,
  RASQAL_EXPR_DATATYPE,
  RASQAL_EXPR_ISURI,
  RASQAL_EXPR_ISBLANK,
  RASQAL_EXPR_ISLITERAL,
  RASQAL_EXPR_CAST,
  RASQAL_EXPR_ORDER_COND_ASC,
  RASQAL_EXPR_ORDER_COND_DESC,
  RASQAL_EXPR_LANGMATCHES,
  RASQAL_EXPR_REGEX,
  RASQAL_EXPR_GROUP_COND_ASC,
  RASQAL_EXPR_GROUP_COND_DESC,
  RASQAL_EXPR_COUNT,
  RASQAL_EXPR_VARSTAR,
  RASQAL_EXPR_SAMETERM,
  RASQAL_EXPR_SUM,
  RASQAL_EXPR_AVG,
  RASQAL_EXPR_MIN,
  RASQAL_EXPR_MAX,
  RASQAL_EXPR_COALESCE,
  RASQAL_EXPR_IF,
  RASQAL_EXPR_URI,
  RASQAL_EXPR_IRI,
  RASQAL_EXPR_STRLANG,
  RASQAL_EXPR_STRDT,
  RASQAL_EXPR_BNODE,
  RASQAL_EXPR_GROUP_CONCAT,
  RASQAL_EXPR_SAMPLE,
  RASQAL_EXPR_IN,
  RASQAL_EXPR_NOT_IN,
  RASQAL_EXPR_ISNUMERIC,
  RASQAL_EXPR_YEAR,
  RASQAL_EXPR_MONTH,
  RASQAL_EXPR_DAY,
  RASQAL_EXPR_HOURS,
  RASQAL_EXPR_MINUTES,
  RASQAL_EXPR_SECONDS,
  RASQAL_EXPR_TIMEZONE,
  RASQAL_EXPR_CURRENT_DATETIME,
  RASQAL_EXPR_NOW,
  RASQAL_EXPR_FROM_UNIXTIME,
  RASQAL_EXPR_TO_UNIXTIME,
  RASQAL_EXPR_CONCAT,
  RASQAL_EXPR_STRLEN,
  RASQAL_EXPR_SUBSTR,
  RASQAL_EXPR_UCASE,
  RASQAL_EXPR_LCASE,
  RASQAL_EXPR_STRSTARTS,
  RASQAL_EXPR_STRENDS,
  RASQAL_EXPR_CONTAINS,
  RASQAL_EXPR_ENCODE_FOR_URI,
  RASQAL_EXPR_TZ,
  RASQAL_EXPR_RAND,
  RASQAL_EXPR_ABS,
  RASQAL_EXPR_ROUND,
  RASQAL_EXPR_CEIL,
  RASQAL_EXPR_FLOOR,
  RASQAL_EXPR_MD5,
  RASQAL_EXPR_SHA1,
  RASQAL_EXPR_SHA224,
  RASQAL_EXPR_SHA256,
  RASQAL_EXPR_SHA384,
  RASQAL_EXPR_SHA512,
  RASQAL_EXPR_STRBEFORE,
  RASQAL_EXPR_STRAFTER,
  RASQAL_EXPR_REPLACE,
  RASQAL_EXPR_UUID,
  RASQAL_EXPR_STRUUID,
  /* internal */
  RASQAL_EXPR_LAST = RASQAL_EXPR_STRUUID
} rasqal_op;

Rasqal expression operators. A mixture of unary, binary and tertiary operators (string matches). Also includes casting and two ordering operators from ORDER BY in SPARQL.

RASQAL_EXPR_UNKNOWN

Internal

RASQAL_EXPR_AND

Expression for AND(A, B)

RASQAL_EXPR_OR

Expression for OR(A, B)

RASQAL_EXPR_EQ

Expression for A equals B

RASQAL_EXPR_NEQ

Expression for A not equals B.

RASQAL_EXPR_LT

Expression for A less than B.

RASQAL_EXPR_GT

Expression for A greather than B.

RASQAL_EXPR_LE

Expression for A less than or equal to B.

RASQAL_EXPR_GE

Expression for A greater than or equal to B.

RASQAL_EXPR_UMINUS

Expression for -A.

RASQAL_EXPR_PLUS

Expression for +A.

RASQAL_EXPR_MINUS

Expression for A-B.

RASQAL_EXPR_STAR

Expression for A*B.

RASQAL_EXPR_SLASH

Expression for A/B.

RASQAL_EXPR_REM

Expression for A/B remainder.

RASQAL_EXPR_STR_EQ

Expression for A string equals B.

RASQAL_EXPR_STR_NEQ

Expression for A string not-equals B.

RASQAL_EXPR_STR_MATCH

Expression for string A matches literal regex B with flags.

RASQAL_EXPR_STR_NMATCH

Expression for string A not-matches literal regex B with flags.

RASQAL_EXPR_TILDE

Expression for binary not A.

RASQAL_EXPR_BANG

Expression for logical not A.

RASQAL_EXPR_LITERAL

Expression for a rasqal_literal.

RASQAL_EXPR_FUNCTION

Expression for a function A with arguments (B...).

RASQAL_EXPR_BOUND

Expression for SPARQL ISBOUND(A).

RASQAL_EXPR_STR

Expression for SPARQL STR(A).

RASQAL_EXPR_LANG

Expression for SPARQL LANG(A).

RASQAL_EXPR_DATATYPE

Expression for SPARQL DATATYPE(A).

RASQAL_EXPR_ISURI

Expression for SPARQL ISURI(A).

RASQAL_EXPR_ISBLANK

Expression for SPARQL ISBLANK(A).

RASQAL_EXPR_ISLITERAL

Expression for SPARQL ISLITERAL(A).

RASQAL_EXPR_CAST

Expression for cast literal A to type B.

RASQAL_EXPR_ORDER_COND_ASC

Expression for SPARQL order condition ascending.

RASQAL_EXPR_ORDER_COND_DESC

Expression for SPARQL order condition descending.

RASQAL_EXPR_LANGMATCHES

Expression for SPARQL LANGMATCHES(A, B).

RASQAL_EXPR_REGEX

Expression for string A matches expression regex B with flags.

RASQAL_EXPR_GROUP_COND_ASC

Obsolete - not used

RASQAL_EXPR_GROUP_COND_DESC

Obsolete - not used

RASQAL_EXPR_COUNT

Expression for LAQRS select COUNT() aggregate function

RASQAL_EXPR_VARSTAR

Expression for LAQRS select Variable *

RASQAL_EXPR_SAMETERM

Expression for SPARQL sameTerm

RASQAL_EXPR_SUM

Expression for LAQRS select SUM() aggregate function

RASQAL_EXPR_AVG

Expression for LAQRS select AVG() aggregate function

RASQAL_EXPR_MIN

Expression for LAQRS select MIN() aggregate function

RASQAL_EXPR_MAX

Expression for LAQRS select MAX() aggregate function

RASQAL_EXPR_COALESCE

Expression for LAQRS COALESCE(Expr+)

RASQAL_EXPR_IF

Expression for LAQRS IF(expr, expr, expr)

RASQAL_EXPR_URI

Expression for LAQRS URI(expr)

RASQAL_EXPR_IRI

Expression for LAQRS IRI(expr)

RASQAL_EXPR_STRLANG

Expression for LAQRS STRLANG(expr, expr)

RASQAL_EXPR_STRDT

Expression for LAQRS STRDT(expr, expr)

RASQAL_EXPR_BNODE

Expression for LAQRS BNODE() and BNODE(expr)

RASQAL_EXPR_GROUP_CONCAT

Expression for LAQRS GROUP_CONCAT(arglist) aggregate function

RASQAL_EXPR_SAMPLE

Expression for LAQRS SAMPLE(expr) aggregate function

RASQAL_EXPR_IN

Expression for LAQRS expr IN ( list of expr )

RASQAL_EXPR_NOT_IN

Expression for LAQRS expr NOT IN ( list of expr )

RASQAL_EXPR_ISNUMERIC

Expression for SPARQL 1.1 isNUMERIC(expr)

RASQAL_EXPR_YEAR

Expression for SPARQL 1.1 YEAR(datetime)

RASQAL_EXPR_MONTH

Expression for SPARQL 1.1 MONTH(datetime)

RASQAL_EXPR_DAY

Expression for SPARQL 1.1 DAY(datetime)

RASQAL_EXPR_HOURS

Expression for SPARQL 1.1 HOURS(datetime)

RASQAL_EXPR_MINUTES

Expression for SPARQL 1.1 MINUTES(datetime)

RASQAL_EXPR_SECONDS

Expression for SPARQL 1.1 SECONDS(datetime)

RASQAL_EXPR_TIMEZONE

Expression for SPARQL 1.1 TIMEZONE(datetime)

RASQAL_EXPR_CURRENT_DATETIME

Expression for LAQRS CURRENT_DATETIME( void )

RASQAL_EXPR_NOW

Expression for LAQRS NOW( void )

RASQAL_EXPR_FROM_UNIXTIME

Expression for LAQRS FROM_UNIXTIME(int)

RASQAL_EXPR_TO_UNIXTIME

Expression for LAQRS TO_UNIXTIME(datetime)

RASQAL_EXPR_CONCAT

Expression for SPARQL 1.1 CONCAT(strings)

RASQAL_EXPR_STRLEN

Expression for SPARQL 1.1 STRLEN(str)

RASQAL_EXPR_SUBSTR

Expression for SPARQL 1.1 SUBSTR(str, start[,offset])

RASQAL_EXPR_UCASE

Expression for SPARQL 1.1 UCASE(str)

RASQAL_EXPR_LCASE

Expression for SPARQL 1.1 LCASE(str)

RASQAL_EXPR_STRSTARTS

Expression for SPARQL 1.1 STRSTARTS(str, str)

RASQAL_EXPR_STRENDS

Expression for SPARQL 1.1 STRENDS(str, str)

RASQAL_EXPR_CONTAINS

Expression for SPARQL 1.1 CONTAINS(str, str)

RASQAL_EXPR_ENCODE_FOR_URI

Expression for SPARQL 1.1 ENCODE_FOR_URI(str)

RASQAL_EXPR_TZ

Expression for SPARQL 1.1 TZ()

RASQAL_EXPR_RAND

Expression for SPARQL 1.1 RAND()

RASQAL_EXPR_ABS

Expression for SPARQL 1.1 ABS()

RASQAL_EXPR_ROUND

Expression for SPARQL 1.1 ROUND()

RASQAL_EXPR_CEIL

Expression for SPARQL 1.1 CEIL()

RASQAL_EXPR_FLOOR

Expression for SPARQL 1.1 FLOOR()

RASQAL_EXPR_MD5

Expression for SPARQL 1.1 MD5()

RASQAL_EXPR_SHA1

Expression for SPARQL 1.1 SHA1()

RASQAL_EXPR_SHA224

Expression for SPARQL 1.1 SHA224()

RASQAL_EXPR_SHA256

Expression for SPARQL 1.1 SHA256()

RASQAL_EXPR_SHA384

Expression for SPARQL 1.1 SHA384()

RASQAL_EXPR_SHA512

Expression for SPARQL 1.1 SHA512()

RASQAL_EXPR_STRBEFORE

Expression for SPARQL 1.1 STRBEFORE()

RASQAL_EXPR_STRAFTER

Expression for SPARQL 1.1 STRAFTER()

RASQAL_EXPR_REPLACE

Expression for SPARQL 1.1 REPLACE()

RASQAL_EXPR_UUID

Expression for SPARQL 1.1 UUID()

RASQAL_EXPR_STRUUID

Expression for SPARQL 1.1 STRUUID()

RASQAL_EXPR_LAST

Internal

enum rasqal_compare_flags

typedef enum {
  RASQAL_COMPARE_NOCASE = 1,
  RASQAL_COMPARE_XQUERY = 2,
  RASQAL_COMPARE_RDF    = 4,
  RASQAL_COMPARE_URI    = 8,
  RASQAL_COMPARE_SAMETERM = 16
} rasqal_compare_flags;

Flags for rasqal_expression_evaluate(), rasqal_literal_compare() or rasqal_literal_as_string_flags()

RASQAL_COMPARE_NOCASE

String comparisons are case independent.

RASQAL_COMPARE_XQUERY

XQuery comparsion rules apply.

RASQAL_COMPARE_RDF

RDF Term comparsion rules apply.

RASQAL_COMPARE_URI

Allow comparison of URIs and allow strings to have a boolean value (unused; was for RDQL)

RASQAL_COMPARE_SAMETERM

SPARQL sameTerm() builtin rules apply.

enum rasqal_pattern_flags

typedef enum {
  RASQAL_PATTERN_FLAGS_OPTIONAL = 1,

  RASQAL_PATTERN_FLAGS_LAST     = RASQAL_PATTERN_FLAGS_OPTIONAL
} rasqal_pattern_flags;

Flags for rasqal_graph_pattern.

RASQAL_PATTERN_FLAGS_OPTIONAL

True when the graph pattern is an optional match.

RASQAL_PATTERN_FLAGS_LAST

Internal

rasqal_new_0op_expression ()

rasqal_expression * rasqal_new_0op_expression           (rasqal_world *world,
                                                         rasqal_op op);

Constructor - create a new 0-operand (constant) expression.

The operators are: RASQAL_EXPR_VARSTAR

The only operator here is the '*' in COUNT(*) as used by LAQRS.

world :

rasqal_world object

op :

Expression operator

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_1op_expression ()

rasqal_expression * rasqal_new_1op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg);

Constructor - create a new 1-operand expression. Takes ownership of the operand expression.

The operators are: RASQAL_EXPR_TILDE RASQAL_EXPR_BANG RASQAL_EXPR_UMINUS RASQAL_EXPR_BOUND RASQAL_EXPR_STR RASQAL_EXPR_LANG RASQAL_EXPR_LANGMATCHES RASQAL_EXPR_DATATYPE RASQAL_EXPR_ISURI RASQAL_EXPR_ISBLANK RASQAL_EXPR_ISLITERAL RASQAL_EXPR_ORDER_COND_ASC RASQAL_EXPR_ORDER_COND_DESC RASQAL_EXPR_COUNT RASQAL_EXPR_SUM RASQAL_EXPR_AVG RASQAL_EXPR_MIN RASQAL_EXPR_MAX

The operator RASQAL_EXPR_TILDE is not used by SPARQL (formerly RDQL).

world :

rasqal_world object

op :

Expression operator

arg :

Operand 1

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_2op_expression ()

rasqal_expression * rasqal_new_2op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_expression *arg2);

Constructor - create a new 2-operand expression. Takes ownership of the operand expressions.

The operators are: RASQAL_EXPR_AND RASQAL_EXPR_OR RASQAL_EXPR_EQ RASQAL_EXPR_NEQ RASQAL_EXPR_LT RASQAL_EXPR_GT RASQAL_EXPR_LE RASQAL_EXPR_GE RASQAL_EXPR_PLUS RASQAL_EXPR_MINUS RASQAL_EXPR_STAR RASQAL_EXPR_SLASH RASQAL_EXPR_REM RASQAL_EXPR_STR_EQ RASQAL_EXPR_STR_NEQ

RASQAL_EXPR_REM RASQAL_EXPR_STR_EQ, RASQAL_EXPR_STR_NEQ and RASQAL_EXPR_REM are unused (formerly RDQL).

world :

rasqal_world object

op :

Expression operator

arg1 :

Operand 1

arg2 :

Operand 2

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_3op_expression ()

rasqal_expression * rasqal_new_3op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_expression *arg2,
                                                         rasqal_expression *arg3);

Constructor - create a new 3-operand expression. Takes ownership of the operands.

The operators are: RASQAL_EXPR_REGEX RASQAL_EXPR_IF RASQAL_EXPR_SUBSTR

world :

rasqal_world object

op :

Expression operator

arg1 :

Operand 1

arg2 :

Operand 2

arg3 :

Operand 3 (may be NULL)

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_4op_expression ()

rasqal_expression * rasqal_new_4op_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_expression *arg2,
                                                         rasqal_expression *arg3,
                                                         rasqal_expression *arg4);

Constructor - create a new 4-operand expression. Takes ownership of the operands.

The operators are: RASQAL_EXPR_REPLACE

world :

rasqal_world object

op :

Expression operator

arg1 :

Operand 1

arg2 :

Operand 2

arg3 :

Operand 3

arg4 :

Operand 4 (may be NULL)

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_aggregate_function_expression ()

rasqal_expression * rasqal_new_aggregate_function_expression
                                                        (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         raptor_sequence *params,
                                                         unsigned int flags);

Constructor - create a new 1-arg aggregate function expression for a builtin aggregate function

Takes ownership of the args and params

world :

rasqal_world object

op :

built-in aggregate function expression operator

arg1 :

rasqal_expression argument to aggregate function

params :

sequence of rasqal_expression function parameters (or NULL)

flags :

extension function bitflags

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_cast_expression ()

rasqal_expression * rasqal_new_cast_expression          (rasqal_world *world,
                                                         raptor_uri *name,
                                                         rasqal_expression *value);

Constructor - create a new expression for casting and expression to a datatype. Takes ownership of the datatype uri and expression value.

world :

rasqal_world object

name :

cast datatype URI

value :

expression value to cast to datatype type

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_function_expression ()

rasqal_expression * rasqal_new_function_expression      (rasqal_world *world,
                                                         raptor_uri *name,
                                                         raptor_sequence *args,
                                                         raptor_sequence *params,
                                                         unsigned int flags);

Constructor - create a new expression for a URI-named function with arguments and optional parameters.

Takes ownership of the name, args and params arguments.

world :

rasqal_world object

name :

function name

args :

sequence of rasqal_expression function arguments

params :

sequence of rasqal_expression function parameters (or NULL)

flags :

extension function bitflags

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_group_concat_expression ()

rasqal_expression * rasqal_new_group_concat_expression  (rasqal_world *world,
                                                         unsigned int flags,
                                                         raptor_sequence *args,
                                                         rasqal_literal *separator);

Constructor - create a new SPARQL group concat expression

Takes an optional distinct flag, a list of expressions and an optional separator string.

Takes ownership of the args and separator

world :

rasqal_world object

flags :

bitset of flags. Only RASQAL_EXPR_FLAG_DISTINCT is defined

args :

sequence of rasqal_expression list arguments

separator :

SEPARATOR string literal or NULL

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_literal_expression ()

rasqal_expression * rasqal_new_literal_expression       (rasqal_world *world,
                                                         rasqal_literal *literal);

Constructor - create a new expression for a rasqal_literal Takes ownership of the operand literal.

world :

rasqal_world object

literal :

Literal operand 1

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_set_expression ()

rasqal_expression * rasqal_new_set_expression           (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         raptor_sequence *args);

Constructor - create a new set IN/NOT IN operation with expression arguments.

Takes ownership of the arg1 and args

world :

rasqal_world object

op :

list operation

arg1 :

expression to look for in list

args :

sequence of rasqal_expression list arguments

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_string_op_expression ()

rasqal_expression * rasqal_new_string_op_expression     (rasqal_world *world,
                                                         rasqal_op op,
                                                         rasqal_expression *arg1,
                                                         rasqal_literal *literal);

Constructor - create a new expression with one expression and one string operand. Takes ownership of the operands.

The operators are: RASQAL_EXPR_STR_MATCH and RASQAL_EXPR_STR_NMATCH (unused: formerly for RDQL)

world :

rasqal_world object

op :

Expression operator

arg1 :

Operand 1

literal :

Literal operand 2

Returns :

a new rasqal_expression object or NULL on failure

rasqal_new_expression_from_expression ()

rasqal_expression * rasqal_new_expression_from_expression
                                                        (rasqal_expression *e);

Copy Constructor - create a new rasqal_expression object from an existing rasqal_expression object.

e :

rasqal_expression object to copy or NULL

Returns :

a new rasqal_expression object or NULL if e is NULL

rasqal_new_expr_seq_expression ()

rasqal_expression * rasqal_new_expr_seq_expression      (rasqal_world *world,
                                                         rasqal_op op,
                                                         raptor_sequence *args);

Constructor - create a new expression with a sequence of expression arguments.

Takes ownership of the args

world :

rasqal_world object

op :

expression operation

args :

sequence of rasqal_expression arguments

Returns :

a new rasqal_expression object or NULL on failure

rasqal_free_expression ()

void                rasqal_free_expression              (rasqal_expression *e);

Destructor - destroy a rasqal_expression object.

e :

rasqal_expression object

rasqal_expression_compare ()

int                 rasqal_expression_compare           (rasqal_expression *e1,
                                                         rasqal_expression *e2,
                                                         int flags,
                                                         int *error_p);

Compare two expressions

The two literals are compared. The comparison returned is as for strcmp, first before second returns <0. equal returns 0, and first after second returns >0. For URIs, the string value is used for the comparsion.

See rasqal_literal_compare() for comparison flags.

If error is not NULL, *error is set to non-0 on error

e1 :

rasqal_expression first expression

e2 :

rasqal_expression second expression

flags :

comparison flags: see rasqal_literal_compare()

error_p :

pointer to error

Returns :

<0, 0, or >0 as described above.

rasqal_expression_evaluate ()

rasqal_literal *    rasqal_expression_evaluate          (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         rasqal_expression *e,
                                                         int flags);

Evaluate a rasqal_expression tree to give a rasqal_literal result or error.

Deprecated: use rasqal_expression_evaluate2() using a rasqal_evaluation_context

world :

rasqal_world

locator :

error locator (or NULL)

e :

The expression to evaluate.

flags :

Flags for rasqal_literal_compare() and RASQAL_COMPARE_NOCASE for string matches.

Returns :

a rasqal_literal value or NULL on failure.

rasqal_expression_evaluate2 ()

rasqal_literal *    rasqal_expression_evaluate2         (rasqal_expression *e,
                                                         rasqal_evaluation_context *eval_context,
                                                         int *error_p);

Evaluate a rasqal_expression tree in the context of a rasqal_evaluation_context to give a rasqal_literal result or error.

e :

The expression to evaluate.

eval_context :

expression context

error_p :

pointer to error return flag

Returns :

a rasqal_literal value or NULL (a valid value). error_p is set to non-0 on failure.

rasqal_expression_op_label ()

const char *        rasqal_expression_op_label          (rasqal_op op);

Get a label for the rasqal expression operator

op :

the rasqal_expression_op object

Returns :

the label (shared string) or NULL if op is out of range or unknown

rasqal_expression_print ()

int                 rasqal_expression_print             (rasqal_expression *e,
                                                         FILE *fh);

Print a Rasqal expression in a debug format.

The print debug format may change in any release.

e :

rasqal_expression object.

fh :

The FILE* handle to print to.

Returns :

non-0 on failure

rasqal_expression_print_op ()

void                rasqal_expression_print_op          (rasqal_expression *e,
                                                         FILE *fh);

Print a rasqal expression operator in a debug format.

The print debug format may change in any release.

e :

the rasqal_expression object

fh :

the FILE* handle to print to

rasqal_expression_visit_fn ()

int                 (*rasqal_expression_visit_fn)       (void *user_data,
                                                         rasqal_expression *e);

User function to visit an expression and operate on it with rasqal_expression_visit()

user_data :

user data passed in with rasqal_expression_visit()

e :

current expression

Returns :

non-0 to truncate the visit

rasqal_expression_visit ()

int                 rasqal_expression_visit             (rasqal_expression *e,
                                                         rasqal_expression_visit_fn fn,
                                                         void *user_data);

Visit a user function over a rasqal_expression

If the user function fn returns non-0, the visit is truncated and the value is returned.

e :

rasqal_expression to visit

fn :

visit function

user_data :

user data to pass to visit function

Returns :

non-0 if the visit was truncated.

rasqal_new_evaluation_context ()

rasqal_evaluation_context * rasqal_new_evaluation_context
                                                        (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         int flags);

Constructor - create a rasqal_evaluation_context for use with rasqal_expression_evaluate2()

world :

rasqal world

locator :

locator or NULL

flags :

expression comparison flags

Returns :

non-0 on failure

rasqal_free_evaluation_context ()

void                rasqal_free_evaluation_context      (rasqal_evaluation_context *eval_context);

Destructor - destroy a rasqal_evaluation_context object.

eval_context :

rasqal_evaluation_context object

rasqal_evaluation_context_set_base_uri ()

int                 rasqal_evaluation_context_set_base_uri
                                                        (rasqal_evaluation_context *eval_context,
                                                         raptor_uri *base_uri);

Set the URI for a rasqal_evaluation_context

eval_context :

rasqal_evaluation_context object

base_uri :

base URI

Returns :

non-0 on failure

rasqal_evaluation_context_set_rand_seed ()

int                 rasqal_evaluation_context_set_rand_seed
                                                        (rasqal_evaluation_context *eval_context,
                                                         unsigned int seed);

Set the random seed for a rasqal_evaluation_context

eval_context :

rasqal_evaluation_context object

seed :

random seed

Returns :

non-0 on failure
rasqal-0.9.33/docs/html/rasqal-section-literal.html0000644000175000017500000023757012443715253017177 00000000000000 Literal

Literal

Literal — RDF literals and RDF query-specific literals.

Synopsis

typedef             rasqal_literal;
enum                rasqal_literal_type;
rasqal_literal *    rasqal_new_typed_literal            (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         const unsigned char *string);
rasqal_literal *    rasqal_new_boolean_literal          (rasqal_world *world,
                                                         int value);
rasqal_literal *    rasqal_new_datetime_literal_from_datetime
                                                        (rasqal_world *world,
                                                         rasqal_xsd_datetime *dt);
rasqal_literal *    rasqal_new_decimal_literal          (rasqal_world *world,
                                                         const char *string);
rasqal_literal *    rasqal_new_decimal_literal_from_decimal
                                                        (rasqal_world *world,
                                                         const char *string,
                                                         rasqal_xsd_decimal *decimal);
rasqal_literal *    rasqal_new_double_literal           (rasqal_world *world,
                                                         double d);
rasqal_literal *    rasqal_new_float_literal            (rasqal_world *world,
                                                         float f);
rasqal_literal *    rasqal_new_floating_literal         (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         double d);
rasqal_literal *    rasqal_new_integer_literal          (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         int integer);
rasqal_literal *    rasqal_new_numeric_literal_from_long
                                                        (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         long value Param3);
rasqal_literal *    rasqal_new_pattern_literal          (rasqal_world *world,
                                                         const char *pattern,
                                                         const char *flags);
rasqal_literal *    rasqal_new_simple_literal           (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         const char *string);
rasqal_literal *    rasqal_new_string_literal           (rasqal_world *world,
                                                         const char *string,
                                                         const char *language,
                                                         raptor_uri *datatype,
                                                         const unsigned char *datatype_qname);
rasqal_literal *    rasqal_new_uri_literal              (rasqal_world *world,
                                                         raptor_uri *uri);
rasqal_literal *    rasqal_new_variable_literal         (rasqal_world *world,
                                                         rasqal_variable *variable);
rasqal_literal *    rasqal_new_literal_from_literal     (rasqal_literal *l);
void                rasqal_free_literal                 (rasqal_literal *l);
rasqal_literal *    rasqal_literal_as_node              (rasqal_literal *l);
const unsigned char * rasqal_literal_as_counted_string  (rasqal_literal *l,
                                                         size_t *len_p,
                                                         int flags,
                                                         int *error_p);
const unsigned char * rasqal_literal_as_string          (rasqal_literal *l);
const unsigned char * rasqal_literal_as_string_flags    (rasqal_literal *l,
                                                         int flags,
                                                         int *error_p);
rasqal_variable *   rasqal_literal_as_variable          (rasqal_literal *l);
int                 rasqal_literal_compare              (rasqal_literal *l1,
                                                         rasqal_literal *l2,
                                                         int flags,
                                                         int *error_p);
raptor_uri *        rasqal_literal_datatype             (rasqal_literal *l);
int                 rasqal_literal_equals               (rasqal_literal *l1,
                                                         rasqal_literal *l2);
char *              rasqal_literal_get_language         (rasqal_literal *l);
rasqal_literal_type rasqal_literal_get_rdf_term_type    (rasqal_literal *l);
rasqal_literal_type rasqal_literal_get_type             (rasqal_literal *l);
int                 rasqal_literal_is_rdf_literal       (rasqal_literal *l);
int                 rasqal_literal_print                (rasqal_literal *l,
                                                         FILE *fh);
void                rasqal_literal_print_type           (rasqal_literal *l,
                                                         FILE *fh);
const char *        rasqal_literal_type_label           (rasqal_literal_type type);
int                 rasqal_literal_same_term            (rasqal_literal *l1,
                                                         rasqal_literal *l2);
rasqal_literal *    rasqal_literal_value                (rasqal_literal *l);

Description

A class for handling RDF terms (URI, blank nodes, strings, datatyped literals) as well as those natively used in a query such as boolean, double, floating, integer, regex pattern and variables.

Details

rasqal_literal

typedef struct rasqal_literal_s rasqal_literal;

Rasqal literal class.


enum rasqal_literal_type

typedef enum {
  /* internal */
  RASQAL_LITERAL_UNKNOWN,
  RASQAL_LITERAL_BLANK,
  RASQAL_LITERAL_URI,
  RASQAL_LITERAL_STRING,
  RASQAL_LITERAL_XSD_STRING,
  RASQAL_LITERAL_BOOLEAN,
  RASQAL_LITERAL_INTEGER,
  RASQAL_LITERAL_FLOAT,
  RASQAL_LITERAL_DOUBLE,
  RASQAL_LITERAL_DECIMAL,
  RASQAL_LITERAL_DATETIME,
  /* internal */
  RASQAL_LITERAL_FIRST_XSD = RASQAL_LITERAL_XSD_STRING,
  /* internal */
  RASQAL_LITERAL_LAST_XSD = RASQAL_LITERAL_DATETIME,
  RASQAL_LITERAL_UDT,
  RASQAL_LITERAL_PATTERN,
  RASQAL_LITERAL_QNAME,
  RASQAL_LITERAL_VARIABLE,
  /* internal */
  RASQAL_LITERAL_INTEGER_SUBTYPE,
  RASQAL_LITERAL_DATE,
  /* internal */
  RASQAL_LITERAL_LAST = RASQAL_LITERAL_DATE
} rasqal_literal_type;

Types of literal.

The order in the enumeration is significant as it encodes the SPARQL term ordering conditions:

Blank Nodes << IRIs << RDF literals << typed literals

which coresponds to in enum values

BLANK << URI << STRING << (BOOLEAN | INTEGER | DOUBLE | FLOAT | DECIMAL | DATETIME | XSD_STRING)

(RASQAL_LITERAL_FIRST_XSD ... RASQAL_LITERAL_LAST_XSD)

Not used (internal): PATTERN, QNAME, VARIABLE

See rasqal_literal_compare() when used with flags RASQAL_COMPARE_XQUERY

RASQAL_LITERAL_UNKNOWN

Internal.

RASQAL_LITERAL_BLANK

RDF blank node literal (SPARQL r:bNode)

RASQAL_LITERAL_URI

RDF URI Literal (SPARQL r:URI)

RASQAL_LITERAL_STRING

RDF Plain Literal - no datatype (SPARQL r:Literal)

RASQAL_LITERAL_XSD_STRING

String xsd:string

RASQAL_LITERAL_BOOLEAN

Boolean literal xsd:boolean.

RASQAL_LITERAL_INTEGER

Integer literal xsd:integer.

RASQAL_LITERAL_FLOAT

Floating point literal xsd:float.

RASQAL_LITERAL_DOUBLE

Double floating point literal xsd:double.

RASQAL_LITERAL_DECIMAL

Decimal integer xsd:decimal.

RASQAL_LITERAL_DATETIME

Date/Time literal xsd:dateTime.

RASQAL_LITERAL_FIRST_XSD

Internal.

RASQAL_LITERAL_LAST_XSD

Internal.

RASQAL_LITERAL_UDT

User defined typed literal with unknown datatype URI

RASQAL_LITERAL_PATTERN

Pattern literal for a regex.

RASQAL_LITERAL_QNAME

XML Qname literal.

RASQAL_LITERAL_VARIABLE

Variable literal.

RASQAL_LITERAL_INTEGER_SUBTYPE

Internal.

RASQAL_LITERAL_DATE

Date literal xsd:date.

RASQAL_LITERAL_LAST

Internal.

rasqal_new_typed_literal ()

rasqal_literal *    rasqal_new_typed_literal            (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         const unsigned char *string);

Constructor - Create a new Rasqal integer literal from a string

The integer decimal number is turned into a rasqal integer literal and given a datatype of xsd:integer

world :

rasqal world object

type :

Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN

string :

lexical form - ownership not taken

Returns :

New rasqal_literal or NULL on failure

rasqal_new_boolean_literal ()

rasqal_literal *    rasqal_new_boolean_literal          (rasqal_world *world,
                                                         int value);

Constructor - Create a new Rasqal boolean literal.

world :

rasqal world object

value :

non-0 for true, 0 for false

Returns :

New rasqal_literal or NULL on failure

rasqal_new_datetime_literal_from_datetime ()

rasqal_literal *    rasqal_new_datetime_literal_from_datetime
                                                        (rasqal_world *world,
                                                         rasqal_xsd_datetime *dt);

Constructor - Create a new Rasqal datetime literal from an existing datetime.

Takes ownership of dt

world :

rasqal world object

dt :

rasqal XSD Datetime

Returns :

New rasqal_literal or NULL on failure

rasqal_new_decimal_literal ()

rasqal_literal *    rasqal_new_decimal_literal          (rasqal_world *world,
                                                         const char *string);

Constructor - Create a new Rasqal decimal literal.

world :

rasqal world object

string :

decimal literal

Returns :

New rasqal_literal or NULL on failure

rasqal_new_decimal_literal_from_decimal ()

rasqal_literal *    rasqal_new_decimal_literal_from_decimal
                                                        (rasqal_world *world,
                                                         const char *string,
                                                         rasqal_xsd_decimal *decimal);

Constructor - Create a new Rasqal decimal literal.

world :

rasqal world object

string :

decimal literal string

decimal :

rasqal XSD Decimal

Returns :

New rasqal_literal or NULL on failure

rasqal_new_double_literal ()

rasqal_literal *    rasqal_new_double_literal           (rasqal_world *world,
                                                         double d);

Constructor - Create a new Rasqal double literal.

world :

rasqal world object

d :

double literal

Returns :

New rasqal_literal or NULL on failure

rasqal_new_float_literal ()

rasqal_literal *    rasqal_new_float_literal            (rasqal_world *world,
                                                         float f);

Constructor - Create a new Rasqal float literal.

Deprecated: Use rasqal_new_floating_literal() with type RASQAL_LITERAL_FLOAT and double value.

world :

rasqal world object

f :

float literal

Returns :

New rasqal_literal or NULL on failure

rasqal_new_floating_literal ()

rasqal_literal *    rasqal_new_floating_literal         (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         double d);

Constructor - Create a new Rasqal float literal from a double.

world :

rasqal world object

type :

type - RASQAL_LITERAL_FLOAT or RASQAL_LITERAL_DOUBLE

d :

floating literal (double)

Returns :

New rasqal_literal or NULL on failure

rasqal_new_integer_literal ()

rasqal_literal *    rasqal_new_integer_literal          (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         int integer);

Constructor - Create a new Rasqal integer literal.

The integer decimal number is turned into a rasqal integer literal and given a datatype of xsd:integer

world :

rasqal world object

type :

Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN

integer :

int value

Returns :

New rasqal_literal or NULL on failure

rasqal_new_numeric_literal_from_long ()

rasqal_literal *    rasqal_new_numeric_literal_from_long
                                                        (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         long value Param3);

Constructor - Create a new Rasqal numeric literal from a long.

The value is turned into a rasqal integer or decimal literal and given a datatype of xsd:integer

world :

rasqal world object

type :

Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN

Returns :

New rasqal_literal or NULL on failure

rasqal_new_pattern_literal ()

rasqal_literal *    rasqal_new_pattern_literal          (rasqal_world *world,
                                                         const char *pattern,
                                                         const char *flags);

Constructor - Create a new Rasqal pattern literal.

The pattern and flags are input parameters and are stored in the literal, not copied. They are freed also on failure. The set of flags recognised depends on the regex library and the query language.

world :

rasqal world object

pattern :

regex pattern

flags :

regex flags

Returns :

New rasqal_literal or NULL on failure

rasqal_new_simple_literal ()

rasqal_literal *    rasqal_new_simple_literal           (rasqal_world *world,
                                                         rasqal_literal_type type,
                                                         const char *string);

Constructor - Create a new Rasqal simple literal.

The string is an input parameter and is stored in the literal, not copied. It is freed also on failure.

world :

rasqal world object

type :

RASQAL_LITERAL_BLANK or RASQAL_LITERAL_BLANK_QNAME

string :

the UTF-8 string value to store

Returns :

New rasqal_literal or NULL on failure

rasqal_new_string_literal ()

rasqal_literal *    rasqal_new_string_literal           (rasqal_world *world,
                                                         const char *string,
                                                         const char *language,
                                                         raptor_uri *datatype,
                                                         const unsigned char *datatype_qname);

Constructor - Create a new Rasqal string literal.

All parameters are input parameters and if present are stored in the literal, not copied. They are freed also on failure.

The datatype and datatype_qname parameters are alternatives; the qname is a datatype that cannot be resolved till later since the prefixes have not yet been declared or checked.

If the string literal is datatyped and of certain types recognised it may be converted to a different literal type.

world :

rasqal world object

string :

UTF-8 string lexical form

language :

RDF language (xml:lang) (or NULL)

datatype :

datatype URI (or NULL for plain literal)

datatype_qname :

datatype qname string (or NULL for plain literal)

Returns :

New rasqal_literal or NULL on failure

rasqal_new_uri_literal ()

rasqal_literal *    rasqal_new_uri_literal              (rasqal_world *world,
                                                         raptor_uri *uri);

Constructor - Create a new Rasqal URI literal from a raptor URI.

The uri is an input parameter and is stored in the literal, not copied. The uri is freed also on failure.

world :

rasqal world object

uri :

raptor_uri uri

Returns :

New rasqal_literal or NULL on failure

rasqal_new_variable_literal ()

rasqal_literal *    rasqal_new_variable_literal         (rasqal_world *world,
                                                         rasqal_variable *variable);

Constructor - Create a new Rasqal variable literal.

variable is an input parameter and stored in the literal, not copied.

world :

rasqal_world object

variable :

rasqal_variable to use

Returns :

New rasqal_literal or NULL on failure

rasqal_new_literal_from_literal ()

rasqal_literal *    rasqal_new_literal_from_literal     (rasqal_literal *l);

Copy Constructor - create a new rasqal_literal object from an existing rasqal_literal object.

l :

rasqal_literal object to copy or NULL

Returns :

a new rasqal_literal object or NULL if l was NULL.

rasqal_free_literal ()

void                rasqal_free_literal                 (rasqal_literal *l);

Destructor - destroy an rasqal_literal object.

l :

rasqal_literal object

rasqal_literal_as_node ()

rasqal_literal *    rasqal_literal_as_node              (rasqal_literal *l);

Turn a literal into a new RDF string, URI or blank literal.

l :

rasqal_literal object

Returns :

the new rasqal_literal or NULL on failure or if the literal was an unbound variable.

rasqal_literal_as_counted_string ()

const unsigned char * rasqal_literal_as_counted_string  (rasqal_literal *l,
                                                         size_t *len_p,
                                                         int flags,
                                                         int *error_p);

Return a counted string format of a literal according to flags.

flag bits affects conversion: RASQAL_COMPARE_XQUERY: use XQuery conversion rules

If error is not NULL, *error is set to non-0 on error

l :

rasqal_literal object

len_p :

pointer to store length of string (or NULL)

flags :

comparison flags

error_p :

pointer to error

Returns :

pointer to a shared string format of the literal.

rasqal_literal_as_string ()

const unsigned char * rasqal_literal_as_string          (rasqal_literal *l);

Return the string format of a literal.

l :

rasqal_literal object

Returns :

pointer to a shared string format of the literal.

rasqal_literal_as_string_flags ()

const unsigned char * rasqal_literal_as_string_flags    (rasqal_literal *l,
                                                         int flags,
                                                         int *error_p);

Return the string format of a literal according to flags.

flag bits affects conversion: RASQAL_COMPARE_XQUERY: use XQuery conversion rules

If error is not NULL, *error is set to non-0 on error

l :

rasqal_literal object

flags :

comparison flags

error_p :

pointer to error

Returns :

pointer to a shared string format of the literal.

rasqal_literal_as_variable ()

rasqal_variable *   rasqal_literal_as_variable          (rasqal_literal *l);

Get the variable inside a literal.

l :

rasqal_literal object

Returns :

the rasqal_variable or NULL if the literal is not a variable

rasqal_literal_compare ()

int                 rasqal_literal_compare              (rasqal_literal *l1,
                                                         rasqal_literal *l2,
                                                         int flags,
                                                         int *error_p);

Compare two literals with type promotion.

The two literals are compared across their range. If the types are not the same, they are promoted. If one is a double or float, the other is promoted to double, otherwise for integers, otherwise to strings (all literals have a string value).

The comparison returned is as for strcmp, first before second returns <0. equal returns 0, and first after second returns >0. For URIs, the string value is used for the comparsion.

flag bits affects comparisons: RASQAL_COMPARE_NOCASE: use case independent string comparisons RASQAL_COMPARE_XQUERY: use XQuery comparison and type promotion rules RASQAL_COMPARE_RDF: use RDF term comparison RASQAL_COMPARE_URI: allow comparison of URIs (typically for SPARQL ORDER)

If error is not NULL, *error is set to non-0 on error

l1 :

rasqal_literal first literal

l2 :

rasqal_literal second literal

flags :

comparison flags

error_p :

pointer to error

Returns :

<0, 0, or >0 as described above.

rasqal_literal_datatype ()

raptor_uri *        rasqal_literal_datatype             (rasqal_literal *l);

Get the datatype URI of a literal

l :

rasqal_literal object

Returns :

shared pointer to raptor_uri of datatype or NULL on failure or no value

rasqal_literal_equals ()

int                 rasqal_literal_equals               (rasqal_literal *l1,
                                                         rasqal_literal *l2);

Compare two literals with no type promotion.

If the l2 data literal value is a boolean, it will match the string "true" or "false" in the first literal l1.

l1 :

rasqal_literal literal

l2 :

rasqal_literal data literal

Returns :

non-0 if equal

rasqal_literal_get_language ()

char *              rasqal_literal_get_language         (rasqal_literal *l);

Get the language of a literal (if set)

l :

literal

Returns :

the literal language or NULL

rasqal_literal_get_rdf_term_type ()

rasqal_literal_type rasqal_literal_get_rdf_term_type    (rasqal_literal *l);

Get the RDF term type of a literal

An RDF term can be one of three choices: 1. URI: RASQAL_LITERAL_URI 2. literal: RASQAL_LITERAL_STRING 3. blank node: RASQAL_LITERAL_BLANK

Other non RDF-term cases include: NULL pointer, invalid literal, unknown type, a variable or other special cases (such as XML QName or Regex pattern) which all turn into RASQAL_LITERAL_UNKNOWN

l :

literal

Returns :

type or RASQAL_LITERAL_UNKNOWN if cannot be an RDF term

rasqal_literal_get_type ()

rasqal_literal_type rasqal_literal_get_type             (rasqal_literal *l);

Get the type of a literal

l :

literal

Returns :

the rasqal literal type or RASQAL_LITERAL_UNKNOWN if l is NULL

rasqal_literal_is_rdf_literal ()

int                 rasqal_literal_is_rdf_literal       (rasqal_literal *l);

Check if a literal is any RDF term literal - plain or typed literal

l :

rasqal_literal literal

Returns :

non-0 if the value is an RDF term literal

rasqal_literal_print ()

int                 rasqal_literal_print                (rasqal_literal *l,
                                                         FILE *fh);

Print a Rasqal literal in a debug format.

The print debug format may change in any release.

l :

the rasqal_literal object

fh :

the FILE handle to print to

Returns :

non-0 on failure

rasqal_literal_print_type ()

void                rasqal_literal_print_type           (rasqal_literal *l,
                                                         FILE *fh);

Print a string form for a rasqal literal type.

l :

the rasqal_literal object

fh :

the FILE* handle to print to

rasqal_literal_type_label ()

const char *        rasqal_literal_type_label           (rasqal_literal_type type);

Get a label for the rasqal literal type

type :

the rasqal_literal_type object

Returns :

the label (shared string) or NULL if type is out of range or unknown

rasqal_literal_same_term ()

int                 rasqal_literal_same_term            (rasqal_literal *l1,
                                                         rasqal_literal *l2);

Check if literals are same term (URI, literal, blank)

l1 :

rasqal_literal literal

l2 :

rasqal_literal data literal

Returns :

non-0 if same

rasqal_literal_value ()

rasqal_literal *    rasqal_literal_value                (rasqal_literal *l);

Get the literal value looking up any variables needed

l :

rasqal_literal object

Returns :

literal value or NULL if has no value
rasqal-0.9.33/docs/html/rasqal.devhelp20000644000175000017500000022447512443715253014650 00000000000000 rasqal-0.9.33/docs/html/rasqal-section-triples-source.html0000644000175000017500000006351012443715253020512 00000000000000 Triples Source

Triples Source

Triples Source — Source of matches to a triple pattern.

Description

A factory that provides the raw triple matches for a triple pattern against some RDF graph. The rasqal_triples_source_factory must create use a new rasqal_triples_source that can be used to initialise and build a rasqal_triples_match for some rasqal_triple (subject, predicate, object, origin URI).

Details

rasqal_triple_meta

typedef struct {
  /* triple (subject, predicate, object) and origin */
  rasqal_variable* bindings[4];

  rasqal_triples_match *triples_match;

  void *context;

  rasqal_triple_parts parts;

  int is_exact;

  int executed;
} rasqal_triple_meta;

Metadata for triple pattern matching for one triple pattern.

rasqal_variable *bindings[4];

Variable bindings for this triple+origin to set.

rasqal_triples_match *triples_match;

The matcher that is setting these bindings.

void *context;

Context data used by the matcher.

rasqal_triple_parts parts;

Bitmask of rasqal_triple_parts flags describing the parts of the triple pattern that will bind to variables. There may also be variables mentioned that are bound in other triple patterns even if parts is 0.

int is_exact;

unused

int executed;

unused

rasqal_triples_match

typedef struct {
  void *user_data;

  rasqal_triple_parts (*bind_match)(struct rasqal_triples_match_s* rtm, void *user_data, rasqal_variable *bindings[4], rasqal_triple_parts parts);

  void (*next_match)(struct rasqal_triples_match_s* rtm, void *user_data);

  int (*is_end)(struct rasqal_triples_match_s* rtm, void *user_data);

  void (*finish)(struct rasqal_triples_match_s* rtm, void *user_data);

  rasqal_world *world;
} rasqal_triples_match;

Triples match structure as initialised by rasqal_triples_source method init_triples_match.

void *user_data;

User data pointer for factory methods.

bind_match ()

The [4]array (s,p,o,origin) bindings against the current triple match only touching triple parts given. Returns parts that were bound or 0 on failure.

next_match ()

Move to next match.

is_end ()

Check for end of triple match - return non-0 if is end.

finish ()

Finish triples match and destroy any allocated memory.

rasqal_world *world;

rasqal_world object

rasqal_triples_source

typedef struct {
  rasqal_query* query;

  void *user_data;

  int (*init_triples_match)(rasqal_triples_match* rtm, struct rasqal_triples_source_s* rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t);

  int (*triple_present)(struct rasqal_triples_source_s* rts, void *user_data, rasqal_triple *t);

  void (*free_triples_source)(void *user_data);
} rasqal_triples_source;

Triples source as initialised by a rasqal_triples_source_factory.

rasqal_query *query;

Source for this query.

void *user_data;

Context user data passed into the factory methods.

init_triples_match ()

Factory method to initalise a new rasqal_triples_match.

triple_present ()

Factory method to return presence or absence of a complete triple.

free_triples_source ()

Factory method to deallocate resources.

rasqal_triples_source_factory

typedef struct {
  int version;
  
  void *user_data;
  size_t user_data_size;

  /* API v1 */
  int (*new_triples_source)(rasqal_query* query, void *factory_user_data, void *user_data, rasqal_triples_source* rts);
  /* API v2 onwards */
  int (*init_triples_source)(rasqal_query* query, void *factory_user_data, void *user_data, rasqal_triples_source* rts, rasqal_triples_error_handler handler);
  /* API v3 onwards */
  int (*init_triples_source2)(rasqal_world* world, raptor_sequence* data_graphs, void *factory_user_data, void *user_data, rasqal_triples_source *rts, rasqal_triples_error_handler2 handler, unsigned int flags);
} rasqal_triples_source_factory;

A factory that initialises rasqal_triples_source structures to returning matches to a triple pattern across the dataset formed from the data graphs recorded in the query object.

int version;

API factory version from 1 to 3

void *user_data;

User data for triples_source_factory.

size_t user_data_size;

Size of user_data for new_triples_source.

new_triples_source ()

Create a new triples source - returns non-zero on failure < 0 is a 'no rdf data error', > 0 is an unspecified error. Error messages are generated by rasqal internally. (V1)

init_triples_source ()

Initialise a new triples source V2 for a particular source URI/base URI and syntax. Returns non-zero on failure with errors reported via the handler callback by the implementation. (V2)

init_triples_source2 ()

Initialise a new triples source V3 for a particular source URI/base URI and syntax and given data graphs. Returns non-zero on failure with errors reported via the handler callback by the implementation. If bit 0 of flags is 1, enforce RAPTOR_FEATURE_NO_NET (V3)

rasqal_triples_source_factory_register_fn ()

int                 (*rasqal_triples_source_factory_register_fn)
                                                        (rasqal_triples_source_factory *factory);

Register a factory for generating triples sources rasqal_triples_source

factory :

factory to register

Returns :

non-0 on failure

enum rasqal_triples_source_feature

typedef enum {
  RASQAL_TRIPLES_SOURCE_FEATURE_NONE,
  RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH
} rasqal_triples_source_feature;

Optional features that may be supported by a triple source factory

RASQAL_TRIPLES_SOURCE_FEATURE_NONE

No feature

RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH

Support raptor_iostream data graphs

rasqal_triples_error_handler ()

void                (*rasqal_triples_error_handler)     (rasqal_query *query,
                                                         raptor_locator *locator,
                                                         const char *message);

Triples source factory error handler callback.

query :

query object

locator :

error locator (or NULL)

message :

error message

rasqal_triples_error_handler2 ()

void                (*rasqal_triples_error_handler2)    (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         const char *message);

Triples source factory error handler callback.

world :

world object

locator :

error locator (or NULL)

message :

error message

rasqal_set_triples_source_factory ()

int                 rasqal_set_triples_source_factory   (rasqal_world *world,
                                                         rasqal_triples_source_factory_register_fn register_fn,
                                                         void *user_data);

Register a factory to generate triple sources.

Registers the factory that returns triples sources. Note that there is only one of these per runtime.

The rasqal_triples_source_factory factory method new_triples_source is called with the user data for some query and rasqal_triples_source.

world :

rasqal_world object

register_fn :

registration function

user_data :

user data for registration

Returns :

non-zero on failure

RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION

#define RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION 1

Lowest accepted rasqal_triples_source_factory API version


RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION

#define RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION 3

Highest accepted rasqal_triples_source_factory API version


RASQAL_TRIPLES_SOURCE_MIN_VERSION

#define RASQAL_TRIPLES_SOURCE_MIN_VERSION 1

Lowest accepted rasqal_triples_source API version


RASQAL_TRIPLES_SOURCE_MAX_VERSION

#define RASQAL_TRIPLES_SOURCE_MAX_VERSION 2

Highest accepted rasqal_triples_source API version

rasqal-0.9.33/docs/html/rasqal-section-updates.html0000644000175000017500000003026712443715253017202 00000000000000 Updates

Updates

Updates — Graph update operations

Description

This class provides a object to record a graph update operation with adding and/or removing triples, using a templated insert/delete with optional where clause. It is designed to be able to record the SPARQL 1.1 (Draft) update format, and is a work in progress as of February 2010.

Details

rasqal_update_operation

typedef struct {
  rasqal_update_type type;

  raptor_uri* graph_uri;

  raptor_uri* document_uri;

  raptor_sequence* insert_templates;

  raptor_sequence* delete_templates;

  rasqal_graph_pattern* where;

  int flags;

  rasqal_update_graph_applies applies;
} rasqal_update_operation;

Update operation - changing the dataset

For LOAD and CLEAR if applies is set (not 0) then the operation applies to just those graph(), otherwise it applies to the graph_uri.

For ADD, MOVE and COPY the source graph is stored in graph_uri field and the destination graph in the document_uri field. The field names have no meaning in this case since both values are always present, always graphs and a NULL value signifies the default graph.

rasqal_update_type type;

type of update

raptor_uri *graph_uri;

optional graph URI (clear, drop, load, with ... delete, insert); source graph (add, move, copy)

raptor_uri *document_uri;

optional document URI (load); destination graph (add, move, copy)

raptor_sequence *insert_templates;

optional sequence of rasqal_triple to insert. Data triples if flags is RASQAL_UPDATE_FLAGS_DATA set, templates otherwise.

raptor_sequence *delete_templates;

optional sequence of rasqal_triple templates to delete

rasqal_graph_pattern *where;

optional where template (insert/delete)

int flags;

update flags - bit-or of flags defined in rasqal_update_flags

rasqal_update_graph_applies applies;

the graph(s) that the update operation applies to, or graph_uri if RASQAL_UPDATE_GRAPH_ONE

enum rasqal_update_type

typedef enum {
  /* internal */
  RASQAL_UPDATE_TYPE_UNKNOWN   = 0,
  RASQAL_UPDATE_TYPE_CLEAR     = 1,
  RASQAL_UPDATE_TYPE_CREATE    = 2,
  RASQAL_UPDATE_TYPE_DROP      = 3,
  RASQAL_UPDATE_TYPE_LOAD      = 4,
  RASQAL_UPDATE_TYPE_UPDATE    = 5,
  RASQAL_UPDATE_TYPE_ADD       = 6,
  RASQAL_UPDATE_TYPE_MOVE      = 7,
  RASQAL_UPDATE_TYPE_COPY      = 8,

  /* internal */
  RASQAL_UPDATE_TYPE_LAST = RASQAL_UPDATE_TYPE_COPY
} rasqal_update_type;

Update type being performed.

RASQAL_UPDATE_TYPE_UNKNOWN

Internal

RASQAL_UPDATE_TYPE_CLEAR

Clear graph.

RASQAL_UPDATE_TYPE_CREATE

Create graph.

RASQAL_UPDATE_TYPE_DROP

Drop graph.

RASQAL_UPDATE_TYPE_LOAD

Load graph.

RASQAL_UPDATE_TYPE_UPDATE

Insert or Delete graph or triples.

RASQAL_UPDATE_TYPE_ADD

Add graph to another graph.

RASQAL_UPDATE_TYPE_MOVE

Move graph to another grpah.

RASQAL_UPDATE_TYPE_COPY

Copy graph to another graph.

RASQAL_UPDATE_TYPE_LAST

Internal

enum rasqal_update_flags

typedef enum {
  RASQAL_UPDATE_FLAGS_SILENT = 1,
  RASQAL_UPDATE_FLAGS_DATA = 2
} rasqal_update_flags;

Bitflags for graph update operations

RASQAL_UPDATE_FLAGS_SILENT

the update operation should be silent

RASQAL_UPDATE_FLAGS_DATA

the update operation is triple data not templates

enum rasqal_update_graph_applies

typedef enum {
  RASQAL_UPDATE_GRAPH_ONE = 0,
  RASQAL_UPDATE_GRAPH_DEFAULT = 1,
  RASQAL_UPDATE_GRAPH_NAMED = 2,
  RASQAL_UPDATE_GRAPH_ALL = 3
} rasqal_update_graph_applies;

The graph(s) that the update operation applies to.

RASQAL_UPDATE_GRAPH_ONE

the update operation applies to 1 graph

RASQAL_UPDATE_GRAPH_DEFAULT

the update operation applies to the default graph

RASQAL_UPDATE_GRAPH_NAMED

the update operation applies to all named graphs

RASQAL_UPDATE_GRAPH_ALL

the update operation applies ALL graphs
rasqal-0.9.33/docs/html/rasqal-section-query-results-formatter.html0000644000175000017500000007404712443715253022406 00000000000000 Query Results Formatter

Query Results Formatter

Query Results Formatter — Query results formatted into a syntax.

Synopsis

typedef             rasqal_query_results_formatter;
enum                rasqal_query_results_format_flags;
int                 rasqal_query_results_formats_check  (rasqal_world *world,
                                                         const char *name,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         int flags);
int                 rasqal_query_results_formats_check2 (rasqal_world *world,
                                                         const char *name,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         int flags);
rasqal_query_results_formatter * rasqal_new_query_results_formatter
                                                        (rasqal_world *world,
                                                         const char *name,
                                                         const char *mime_type,
                                                         raptor_uri *format_uri);
rasqal_query_results_formatter * rasqal_new_query_results_formatter_for_content
                                                        (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         const char *buffer,
                                                         size_t len,
                                                         const unsigned char *identifier);
void                rasqal_free_query_results_formatter (rasqal_query_results_formatter *formatter);
int                 rasqal_query_results_formatter_read (rasqal_world *world,
                                                         raptor_iostream *iostr,
                                                         rasqal_query_results_formatter *formatter,
                                                         rasqal_query_results *results,
                                                         raptor_uri *base_uri);
int                 rasqal_query_results_formatter_write
                                                        (raptor_iostream *iostr,
                                                         rasqal_query_results_formatter *formatter,
                                                         rasqal_query_results *results,
                                                         raptor_uri *base_uri);

Description

Variable bindings and boolean query results can be formatted into different syntaxes such as SPARQL Query Results Format or JSON. The rasqal_query_results_formatter class allows choosing a formatter for a particular syntax and writing the syntax to a raptor_iostream which allows turning the syntax into a string, writing to a file handle or other custom destination.

Details

rasqal_query_results_formatter

rasqal_graph_query_results_formatter* query_results_formatter;

Rasqal query results formatter class.


enum rasqal_query_results_format_flags

typedef enum {
  RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER = 1,
  RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER = 2
} rasqal_query_results_format_flags;

Bitflags for rasqal_query_results_formats_check() to find formats with features.

RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER

format can be read.

RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER

format can be written.

rasqal_query_results_formats_check ()

int                 rasqal_query_results_formats_check  (rasqal_world *world,
                                                         const char *name,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         int flags);

Check if a query results formatter exists for the requested format.

Deprecated: use rasqal_query_results_formats_check2() since the implementation of this function returned an inverted boolean result.

world :

rasqal_world object

name :

the query results format name (or NULL)

uri :

raptor_uri query results format uri (or NULL)

mime_type :

mime type name

flags :

bitmask of flags to signify that format is needed for reading (RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER ) or writing ( RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER )

Returns :

0 if a formatter exists.

rasqal_query_results_formats_check2 ()

int                 rasqal_query_results_formats_check2 (rasqal_world *world,
                                                         const char *name,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         int flags);

Check if a query results formatter exists for the requested format.

world :

rasqal_world object

name :

the query results format name (or NULL)

uri :

raptor_uri query results format uri (or NULL)

mime_type :

mime type name

flags :

bitmask of flags to signify that format is needed for reading (RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER ) or writing ( RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER )

Returns :

non-0 if a formatter exists.

rasqal_new_query_results_formatter ()

rasqal_query_results_formatter * rasqal_new_query_results_formatter
                                                        (rasqal_world *world,
                                                         const char *name,
                                                         const char *mime_type,
                                                         raptor_uri *format_uri);

Constructor - create a new rasqal_query_results_formatter for an identified format.

A query results format can be found by name, mime type or URI, all of which are optional. If multiple fields are given, the first match is given that matches the name, URI, mime_type in that order. The default query results format will be used if all are format identifying fields are NULL.

See rasqal_world_get_query_results_format_description() for obtaining the supported format URIs at run time.

world :

rasqal_world object

name :

the query results format name (or NULL)

mime_type :

the query results format mime type (or NULL)

format_uri :

raptor_uri query results format uri (or NULL)

Returns :

a new rasqal_query_results_formatter object or NULL on failure

rasqal_new_query_results_formatter_for_content ()

rasqal_query_results_formatter * rasqal_new_query_results_formatter_for_content
                                                        (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         const char *buffer,
                                                         size_t len,
                                                         const unsigned char *identifier);

Constructor - create a new queryresults formatter for an identified format.

Uses rasqal_world_guess_query_results_format_name() to find a query results formatter by scoring recognition of the syntax by a block of characters, the content identifier or a mime type. The content identifier is typically a filename or URI or some other identifier.

world :

world object

uri :

URI identifying the syntax (or NULL)

mime_type :

mime type identifying the content (or NULL)

buffer :

buffer of content to guess (or NULL)

len :

length of buffer

identifier :

identifier of content (or NULL)

Returns :

a new rasqal_query_results_formatter object or NULL on failure

rasqal_free_query_results_formatter ()

void                rasqal_free_query_results_formatter (rasqal_query_results_formatter *formatter);

Destructor - destroy a rasqal_query_results_formatter object.

formatter :

rasqal_query_results_formatter object

rasqal_query_results_formatter_read ()

int                 rasqal_query_results_formatter_read (rasqal_world *world,
                                                         raptor_iostream *iostr,
                                                         rasqal_query_results_formatter *formatter,
                                                         rasqal_query_results *results,
                                                         raptor_uri *base_uri);

Read the query results using the given formatter from an iostream

See rasqal_world_get_query_results_format_description() for obtaining the supported format URIs at run time.

world :

rasqal world object

iostr :

raptor_iostream to read the query from

formatter :

rasqal_query_results_formatter object

results :

rasqal_query_results query results format

base_uri :

raptor_uri base URI of the input format

Returns :

non-0 on failure

rasqal_query_results_formatter_write ()

int                 rasqal_query_results_formatter_write
                                                        (raptor_iostream *iostr,
                                                         rasqal_query_results_formatter *formatter,
                                                         rasqal_query_results *results,
                                                         raptor_uri *base_uri);

Write the query results using the given formatter to an iostream

Note that after calling this method, the query results will be empty and rasqal_query_results_finished() will return true (non-0)

See rasqal_world_get_query_results_format_description() for obtaining the supported format URIs at run time.

iostr :

raptor_iostream to write the query to

formatter :

rasqal_query_results_formatter object

results :

rasqal_query_results query results format

base_uri :

raptor_uri base URI of the output format (or NULL)

Returns :

non-0 on failure
rasqal-0.9.33/docs/html/rasqal-section-query-results.html0000644000175000017500000017772312443715253020412 00000000000000 Query Results

Query Results

Query Results — Query results as variable bindings, boolean or RDF graphs.

Synopsis

typedef             rasqal_query_results;
rasqal_query_results * rasqal_new_query_results         (rasqal_world *world,
                                                         rasqal_query *query,
                                                         rasqal_query_results_type type,
                                                         rasqal_variables_table *vars_table);
rasqal_query_results * rasqal_new_query_results2        (rasqal_world *world,
                                                         rasqal_query *query,
                                                         rasqal_query_results_type type);
rasqal_query_results * rasqal_new_query_results_from_string
                                                        (rasqal_world *world,
                                                         rasqal_query_results_type type,
                                                         raptor_uri *base_uri,
                                                         const char *string,
                                                         size_t string_len);
void                rasqal_free_query_results           (rasqal_query_results *query_results);
int                 rasqal_query_results_add_row        (rasqal_query_results *query_results,
                                                         rasqal_row *row);
int                 rasqal_query_results_finished       (rasqal_query_results *query_results);
const unsigned char * rasqal_query_results_get_binding_name
                                                        (rasqal_query_results *query_results,
                                                         int offset);
rasqal_literal *    rasqal_query_results_get_binding_value
                                                        (rasqal_query_results *query_results,
                                                         int offset);
rasqal_literal *    rasqal_query_results_get_binding_value_by_name
                                                        (rasqal_query_results *query_results,
                                                         const char *name);
int                 rasqal_query_results_get_bindings   (rasqal_query_results *query_results,
                                                         const unsigned char ***names,
                                                         rasqal_literal ***values);
int                 rasqal_query_results_get_bindings_count
                                                        (rasqal_query_results *query_results);
int                 rasqal_query_results_get_boolean    (rasqal_query_results *query_results);
int                 rasqal_query_results_get_count      (rasqal_query_results *query_results);
rasqal_query *      rasqal_query_results_get_query      (rasqal_query_results *query_results);
raptor_statement *  rasqal_query_results_get_triple     (rasqal_query_results *query_results);
rasqal_row *        rasqal_query_results_get_row_by_offset
                                                        (rasqal_query_results *query_results,
                                                         int result_offset);
rasqal_query_results_type rasqal_query_results_get_type (rasqal_query_results *query_results);
int                 rasqal_query_results_is_bindings    (rasqal_query_results *query_results);
int                 rasqal_query_results_is_boolean     (rasqal_query_results *query_results);
int                 rasqal_query_results_is_graph       (rasqal_query_results *query_results);
int                 rasqal_query_results_is_syntax      (rasqal_query_results *query_results);
int                 rasqal_query_results_next           (rasqal_query_results *query_results);
int                 rasqal_query_results_next_triple    (rasqal_query_results *query_results);
int                 rasqal_query_results_read           (raptor_iostream *iostr,
                                                         rasqal_query_results *results,
                                                         const char *name,
                                                         const char *mime_type,
                                                         raptor_uri *format_uri,
                                                         raptor_uri *base_uri);
int                 rasqal_query_results_write          (raptor_iostream *iostr,
                                                         rasqal_query_results *results,
                                                         const char *name,
                                                         const char *mime_type,
                                                         raptor_uri *format_uri,
                                                         raptor_uri *base_uri);
enum                rasqal_query_results_type;
const char *        rasqal_query_results_type_label     (rasqal_query_results_type type);
int                 rasqal_query_results_rewind         (rasqal_query_results *query_results);

Description

A query results object is only ever constructed by the internal query engine evaluating a rasqal_query with rasqal_query_execute(). It provides interface to the multiple types of result supported.

There are a large set of methods for returning all or parts of a variable binding query result including the names, values or individuals. A boolean result is straightforward to get with rasqal_query_results_get_boolean() and an RDF graph returns a sequence of raptor triples than can be easily passed to the Raptor library for serializing to a syntax.

Details

rasqal_query_results

rasqal_graph_query_results* query_results;

Rasqal query results class.


rasqal_new_query_results ()

rasqal_query_results * rasqal_new_query_results         (rasqal_world *world,
                                                         rasqal_query *query,
                                                         rasqal_query_results_type type,
                                                         rasqal_variables_table *vars_table);

Constructor - create a new query results set

Deprecated for rasqal_new_query_results2() that loses the unused argument.

The query may be NULL for result set objects that are standalone and not attached to any particular query

world :

rasqal world object

query :

query object (or NULL)

type :

query results (expected) type

vars_table :

This parameter is *IGNORED*

Returns :

a new query result object or NULL on failure

rasqal_new_query_results2 ()

rasqal_query_results * rasqal_new_query_results2        (rasqal_world *world,
                                                         rasqal_query *query,
                                                         rasqal_query_results_type type);

Constructor - create a new query results set

The query may be NULL for result set objects that are standalone and not attached to any particular query

world :

rasqal world object

query :

query object (or NULL)

type :

query results (expected) type

Returns :

a new query result object or NULL on failure

rasqal_new_query_results_from_string ()

rasqal_query_results * rasqal_new_query_results_from_string
                                                        (rasqal_world *world,
                                                         rasqal_query_results_type type,
                                                         raptor_uri *base_uri,
                                                         const char *string,
                                                         size_t string_len);

Constructor - create a new query results set from a results format string

world :

rasqal world object

type :

query results (expected) type; typically RASQAL_QUERY_RESULTS_BINDINGS

base_uri :

base URI of query results format (or NULL)

string :

query results string

string_len :

length of string (or 0 to calculate it here)

Returns :

a new query result object or NULL on failure

rasqal_free_query_results ()

void                rasqal_free_query_results           (rasqal_query_results *query_results);

Destructor - destroy a rasqal_query_results.

query_results :

rasqal_query_results object

rasqal_query_results_add_row ()

int                 rasqal_query_results_add_row        (rasqal_query_results *query_results,
                                                         rasqal_row *row);

Add a query result row to the sequence of result rows

query_results :

query results object

row :

query result row

Returns :

non-0 on failure

rasqal_query_results_finished ()

int                 rasqal_query_results_finished       (rasqal_query_results *query_results);

Find out if binding results are exhausted.

query_results :

rasqal_query_results query_results

Returns :

non-0 if results are finished or query failed

rasqal_query_results_get_binding_name ()

const unsigned char * rasqal_query_results_get_binding_name
                                                        (rasqal_query_results *query_results,
                                                         int offset);

Get binding name for the current result.

query_results :

rasqal_query_results query_results

offset :

offset of binding name into array of known names

Returns :

a pointer to a shared copy of the binding name or NULL on failure

rasqal_query_results_get_binding_value ()

rasqal_literal *    rasqal_query_results_get_binding_value
                                                        (rasqal_query_results *query_results,
                                                         int offset);

Get one binding value for the current result.

query_results :

rasqal_query_results query_results

offset :

offset of binding name into array of known names

Returns :

a pointer to a shared rasqal_literal binding value or NULL on failure

rasqal_query_results_get_binding_value_by_name ()

rasqal_literal *    rasqal_query_results_get_binding_value_by_name
                                                        (rasqal_query_results *query_results,
                                                         const char *name);

Get one binding value for a given name in the current result.

query_results :

rasqal_query_results query_results

name :

variable name

Returns :

a pointer to a shared rasqal_literal binding value or NULL on failure

rasqal_query_results_get_bindings ()

int                 rasqal_query_results_get_bindings   (rasqal_query_results *query_results,
                                                         const unsigned char ***names,
                                                         rasqal_literal ***values);

Get all binding names, values for current result.

If names is not NULL, it is set to the address of a shared array of names of the bindings (an output parameter). These names are shared and must not be freed by the caller

If values is not NULL, it is set to the address of a shared array of rasqal_literal* binding values. These values are shaerd and must not be freed by the caller.

query_results :

rasqal_query_results query_results

names :

pointer to an array of binding names (or NULL)

values :

pointer to an array of binding value rasqal_literal (or NULL)

Returns :

non-0 if the assignment failed

rasqal_query_results_get_bindings_count ()

int                 rasqal_query_results_get_bindings_count
                                                        (rasqal_query_results *query_results);

Get the number of bound variables in the result.

query_results :

rasqal_query_results query_results

Returns :

<0 if failed or results exhausted

rasqal_query_results_get_boolean ()

int                 rasqal_query_results_get_boolean    (rasqal_query_results *query_results);

Get boolean query result.

The return value is only meaningful if this is a boolean query result - see rasqal_query_results_is_boolean()

query_results :

rasqal_query_results query_results

Returns :

boolean query result - >0 is true, 0 is false, <0 on error

rasqal_query_results_get_count ()

int                 rasqal_query_results_get_count      (rasqal_query_results *query_results);

Get number of bindings so far.

query_results :

rasqal_query_results query_results

Returns :

number of bindings found so far or < 0 on failure

rasqal_query_results_get_query ()

rasqal_query *      rasqal_query_results_get_query      (rasqal_query_results *query_results);

Get thq query associated with this query result

query_results :

rasqal_query_results object

Returns :

shared pointer to query object

rasqal_query_results_get_triple ()

raptor_statement *  rasqal_query_results_get_triple     (rasqal_query_results *query_results);

Get the current triple in the result.

The return value is a shared raptor_statement.

query_results :

rasqal_query_results query_results

Returns :

raptor_statement or NULL if failed or results exhausted

rasqal_query_results_get_row_by_offset ()

rasqal_row *        rasqal_query_results_get_row_by_offset
                                                        (rasqal_query_results *query_results,
                                                         int result_offset);

Get stored result row by an offset

The result_offset index is 0-indexed into the subset of results constrained by any query limit and offset.

query_results :

query result

result_offset :

index into result rows

Returns :

row or NULL if result_offset is out of range

rasqal_query_results_get_type ()

rasqal_query_results_type rasqal_query_results_get_type (rasqal_query_results *query_results);

Get query results type

query_results :

rasqal_query_results object

Returns :

non-0 if true

rasqal_query_results_is_bindings ()

int                 rasqal_query_results_is_bindings    (rasqal_query_results *query_results);

Test if rasqal_query_results is variable bindings format.

query_results :

rasqal_query_results object

Returns :

non-0 if true

rasqal_query_results_is_boolean ()

int                 rasqal_query_results_is_boolean     (rasqal_query_results *query_results);

Test if rasqal_query_results is boolean format.

query_results :

rasqal_query_results object

Returns :

non-0 if true

rasqal_query_results_is_graph ()

int                 rasqal_query_results_is_graph       (rasqal_query_results *query_results);

Test if rasqal_query_results is RDF graph format.

query_results :

rasqal_query_results object

Returns :

non-0 if true

rasqal_query_results_is_syntax ()

int                 rasqal_query_results_is_syntax      (rasqal_query_results *query_results);

Test if the rasqal_query_results is a syntax.

Many of the query results may be formatted as a syntax using the rasqal_query_formatter class however this function returns true if a syntax result was specifically requested.

query_results :

rasqal_query_results object

Returns :

non-0 if true

rasqal_query_results_next ()

int                 rasqal_query_results_next           (rasqal_query_results *query_results);

Move to the next result.

query_results :

rasqal_query_results query_results

Returns :

non-0 if failed or results exhausted

rasqal_query_results_next_triple ()

int                 rasqal_query_results_next_triple    (rasqal_query_results *query_results);

Move to the next triple result.

query_results :

rasqal_query_results query_results

Returns :

non-0 if failed or results exhausted

rasqal_query_results_read ()

int                 rasqal_query_results_read           (raptor_iostream *iostr,
                                                         rasqal_query_results *results,
                                                         const char *name,
                                                         const char *mime_type,
                                                         raptor_uri *format_uri,
                                                         raptor_uri *base_uri);

Read the query results from an iostream in a format.

This uses the rasqal_query_results_formatter class and the rasqal_query_results_formatter_read() method to perform the formatting.

See rasqal_world_get_query_results_format_description() for obtaining the supported format URIs at run time.

iostr :

raptor_iostream to read the query from

results :

rasqal_query_results query results format

name :

format name (or NULL)

mime_type :

format mime type (or NULL)

format_uri :

raptor_uri describing the format to read (or NULL for default)

base_uri :

raptor_uri base URI of the input format

Returns :

non-0 on failure

rasqal_query_results_write ()

int                 rasqal_query_results_write          (raptor_iostream *iostr,
                                                         rasqal_query_results *results,
                                                         const char *name,
                                                         const char *mime_type,
                                                         raptor_uri *format_uri,
                                                         raptor_uri *base_uri);

Write the query results to an iostream in a format.

This uses the rasqal_query_results_formatter class and the rasqal_query_results_formatter_write() method to perform the formatting.

Note that after calling this method, the query results will be empty and rasqal_query_results_finished() will return true (non-0)

See rasqal_world_get_query_results_format_description() for obtaining the supported format names, mime_types and URIs at run time.

iostr :

raptor_iostream to write the query to

results :

rasqal_query_results query results format

name :

format name (or NULL)

mime_type :

format mime type (or NULL)

format_uri :

raptor_uri describing the format to write (or NULL for default)

base_uri :

raptor_uri base URI of the output format

Returns :

non-0 on failure

enum rasqal_query_results_type

typedef enum {
  RASQAL_QUERY_RESULTS_BINDINGS,
  RASQAL_QUERY_RESULTS_BOOLEAN,
  RASQAL_QUERY_RESULTS_GRAPH,
  RASQAL_QUERY_RESULTS_SYNTAX,
  RASQAL_QUERY_RESULTS_UNKNOWN,
  RASQAL_QUERY_RESULTS_LAST = RASQAL_QUERY_RESULTS_UNKNOWN
} rasqal_query_results_type;

Query result type.

RASQAL_QUERY_RESULTS_BINDINGS

variable binding

RASQAL_QUERY_RESULTS_BOOLEAN

a single boolean

RASQAL_QUERY_RESULTS_GRAPH

an RDF graph

RASQAL_QUERY_RESULTS_SYNTAX

a syntax

RASQAL_QUERY_RESULTS_UNKNOWN

unknown type

RASQAL_QUERY_RESULTS_LAST

internal

rasqal_query_results_type_label ()

const char *        rasqal_query_results_type_label     (rasqal_query_results_type type);

Get a label for a query results type

type :

rasqal_query_results_type type

Returns :

label or NULL on failure (invalid type)

rasqal_query_results_rewind ()

int                 rasqal_query_results_rewind         (rasqal_query_results *query_results);

Rewind stored query results to start

This requires rasqal_query_set_store_results() to be called before query execution.

query_results :

rasqal_query_results query_results

Returns :

non-0 if rewinding is not available when results are not stored
rasqal-0.9.33/docs/html/rasqal-changes.html0000644000175000017500000001546712443715253015510 00000000000000 API Changes rasqal-0.9.33/docs/html/rasqal-section-variable.html0000644000175000017500000003312712443715253017320 00000000000000 Variables

Variables

Variables — Variable with names and literal value.

Description

A class to hold a variable with optional name and a rasqal_literal value. The name is not required for SPARQL anonymous variables.

Details

rasqal_variable

typedef struct {
  rasqal_variables_table* vars_table;
  const char * name;
  rasqal_literal* value;
  int offset;
  rasqal_variable_type type;
  struct rasqal_expression_s* expression;
  void *user_data;
  int usage;
} rasqal_variable;

Binding between a variable name and a value.

Includes internal field offset for recording the offset into the (internal) rasqal_query variables array.

rasqal_variables_table *vars_table;

variables table that owns this variable

const char *name;

Variable name.

rasqal_literal *value;

Variable value or NULL if unbound.

int offset;

Internal.

rasqal_variable_type type;

Variable type.

struct rasqal_expression_s *expression;

Expression when the variable is a computed SELECT expression

void *user_data;

Pointer to user data associated with a variable. This is not used by rasqal.

int usage;

reference count

rasqal_new_variable_from_variable ()

rasqal_variable *   rasqal_new_variable_from_variable   (rasqal_variable *v);

Copy Constructor - Create a new Rasqal variable from an existing one

This adds a new reference to the variable, it does not do a deep copy

v :

rasqal_variable to copy

Returns :

a new rasqal_variable or NULL on failure.

rasqal_free_variable ()

void                rasqal_free_variable                (rasqal_variable *v);

Destructor - Destroy a Rasqal variable object.

v :

rasqal_variable object

rasqal_variable_print ()

int                 rasqal_variable_print               (rasqal_variable *v,
                                                         FILE *fh);

Print a Rasqal variable in a debug format.

The print debug format may change in any release.

v :

the rasqal_variable object

fh :

the FILE* handle to print to

Returns :

non-0 on failure

rasqal_variable_set_value ()

void                rasqal_variable_set_value           (rasqal_variable *v,
                                                         rasqal_literal *l);

Set the value of a Rasqal variable.

The variable value is an input parameter and is copied in, not shared. If the variable value is NULL, any existing value is deleted.

v :

the rasqal_variable object

l :

the rasqal_literal value to set (or NULL)

enum rasqal_variable_type

typedef enum {
  RASQAL_VARIABLE_TYPE_UNKNOWN   = 0,
  RASQAL_VARIABLE_TYPE_NORMAL    = 1,
  RASQAL_VARIABLE_TYPE_ANONYMOUS = 2
} rasqal_variable_type;

Rasqal variable types.

ANONYMOUS can be used in queries but cannot be returned in a result.

RASQAL_VARIABLE_TYPE_UNKNOWN

Internal.

RASQAL_VARIABLE_TYPE_NORMAL

The regular variable type.

RASQAL_VARIABLE_TYPE_ANONYMOUS

Anonymous variable type.
rasqal-0.9.33/docs/html/right.png0000644000175000017500000000073012443715253013537 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME2 I%=eIDATx!o@.'**M0$$?1~vIeEuLl&4䝠Bݛ|>$ݶoc XML Schema Datetime and Decimals

XML Schema Datetime and Decimals

XML Schema Datetime and Decimals — XML Schema datetime and arbitrary length decimal number arithmetic.

Synopsis

                    rasqal_xsd_date;
rasqal_xsd_date *   rasqal_new_xsd_date                 (rasqal_world *world,
                                                         const char *date_string);
void                rasqal_free_xsd_date                (rasqal_xsd_date *d);
char *              rasqal_xsd_date_to_counted_string   (const rasqal_xsd_date *date,
                                                         size_t *len_p);
char *              rasqal_xsd_date_to_string           (const rasqal_xsd_date *d);
int                 rasqal_xsd_date_equals              (const rasqal_xsd_date *d1,
                                                         const rasqal_xsd_date *d2,
                                                         int *incomparible_p);
int                 rasqal_xsd_date_compare             (const rasqal_xsd_date *d1,
                                                         const rasqal_xsd_date *d2,
                                                         int *incomparible_p);
                    rasqal_xsd_datetime;
#define             RASQAL_XSD_DATETIME_NO_TZ
rasqal_xsd_datetime * rasqal_new_xsd_datetime           (rasqal_world *world,
                                                         const char *datetime_string);
rasqal_xsd_datetime * rasqal_new_xsd_datetime_from_timeval
                                                        (rasqal_world *world,
                                                         struct timeval *tv);
rasqal_xsd_datetime * rasqal_new_xsd_datetime_from_unixtime
                                                        (rasqal_world *world,
                                                         time_t secs);
rasqal_xsd_datetime * rasqal_new_xsd_datetime_from_xsd_date
                                                        (rasqal_world *world,
                                                         rasqal_xsd_date *date);
void                rasqal_free_xsd_datetime            (rasqal_xsd_datetime *dt);
int                 rasqal_xsd_datetime_compare         (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2);
int                 rasqal_xsd_datetime_compare2        (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2,
                                                         int *incomparible_p);
int                 rasqal_xsd_datetime_equals          (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2);
int                 rasqal_xsd_datetime_equals2         (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2,
                                                         int *incomparible_p);
struct timeval *    rasqal_xsd_datetime_get_as_timeval  (rasqal_xsd_datetime *dt);
time_t              rasqal_xsd_datetime_get_as_unixtime (rasqal_xsd_datetime *dt);
rasqal_xsd_decimal * rasqal_xsd_datetime_get_seconds_as_decimal
                                                        (rasqal_world *world,
                                                         rasqal_xsd_datetime *dt);
char *              rasqal_xsd_datetime_get_timezone_as_counted_string
                                                        (rasqal_xsd_datetime *dt,
                                                         size_t *len_p);
char *              rasqal_xsd_datetime_get_tz_as_counted_string
                                                        (rasqal_xsd_datetime *dt,
                                                         size_t *len_p);
int                 rasqal_xsd_datetime_set_from_timeval
                                                        (rasqal_xsd_datetime *dt,
                                                         struct timeval *tv);
int                 rasqal_xsd_datetime_set_from_unixtime
                                                        (rasqal_xsd_datetime *dt,
                                                         time_t clock);
char *              rasqal_xsd_datetime_to_counted_string
                                                        (const rasqal_xsd_datetime *dt,
                                                         size_t *len_p);
char *              rasqal_xsd_datetime_to_string       (const rasqal_xsd_datetime *dt);
void                rasqal_free_xsd_decimal             (rasqal_xsd_decimal *dec);
rasqal_xsd_decimal * rasqal_new_xsd_decimal             (rasqal_world *world);
typedef             rasqal_xsd_decimal;
int                 rasqal_xsd_decimal_abs              (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);
int                 rasqal_xsd_decimal_add              (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);
char *              rasqal_xsd_decimal_as_counted_string
                                                        (rasqal_xsd_decimal *dec,
                                                         size_t *len_p);
char *              rasqal_xsd_decimal_as_string        (rasqal_xsd_decimal *dec);
int                 rasqal_xsd_decimal_ceil             (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);
int                 rasqal_xsd_decimal_compare          (rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);
int                 rasqal_xsd_decimal_divide           (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);
int                 rasqal_xsd_decimal_equals           (rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);
int                 rasqal_xsd_decimal_floor            (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);
double              rasqal_xsd_decimal_get_double       (rasqal_xsd_decimal *dec);
long                rasqal_xsd_decimal_get_long         (rasqal_xsd_decimal *dec,
                                                         int *error_p);
int                 rasqal_xsd_decimal_is_zero          (rasqal_xsd_decimal *d);
int                 rasqal_xsd_decimal_multiply         (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);
int                 rasqal_xsd_decimal_negate           (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);
int                 rasqal_xsd_decimal_print            (rasqal_xsd_decimal *dec,
                                                         FILE *stream);
int                 rasqal_xsd_decimal_round            (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);
int                 rasqal_xsd_decimal_set_double       (rasqal_xsd_decimal *dec,
                                                         double d);
int                 rasqal_xsd_decimal_set_long         (rasqal_xsd_decimal *dec,
                                                         long l Param2);
int                 rasqal_xsd_decimal_set_string       (rasqal_xsd_decimal *dec,
                                                         const char *string);
int                 rasqal_xsd_decimal_subtract         (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Description

Classes for providing XSD datatypes for Datetimes plus Decimals with arbitrary length floating point decimals and standard operators on the Decimals suitable for SPARQL.

Details

rasqal_xsd_date

typedef struct {
  signed int year;
  /* the following fields are integer values not characters */
  unsigned char month;
  unsigned char day;
  signed short timezone_minutes;
  time_t time_on_timeline;
  char have_tz;
} rasqal_xsd_date;

XML schema date datatype (xsd:date)

Examples of timezone fields: "2010-01-02" : timezone_minutes RASQAL_XSD_DATETIME_NO_TZ, have_tz 'N' "2010-01-02Z" : timezone_minutes 0, have_tz 'Z' "2010-01-02+00:00" : timezone_minutes 0, have_tz 'Y' "2010-01-02-01:00" : timezone_minutes -60, have_tz 'Y'

signed int year;

year

unsigned char month;

month 1-12

unsigned char day;

1-31

signed short timezone_minutes;

minutes +/- against UTC or RASQAL_XSD_DATETIME_NO_TZ if there is no timezone in the dateTime.

time_t time_on_timeline;

time on timeline of first instant of date in timezone

char have_tz;

timezone flag: 'Z' if Zulu, 'Y' if has other timezone offset in timezone_minutes, 'N' if there is no timezone

rasqal_new_xsd_date ()

rasqal_xsd_date *   rasqal_new_xsd_date                 (rasqal_world *world,
                                                         const char *date_string);

Constructor - make a new XSD date object from a string

world :

world object

date_string :

XSD date string

Returns :

new datetime or NULL on failure

rasqal_free_xsd_date ()

void                rasqal_free_xsd_date                (rasqal_xsd_date *d);

Destroy XSD date object.

d :

date object

rasqal_xsd_date_to_counted_string ()

char *              rasqal_xsd_date_to_counted_string   (const rasqal_xsd_date *date,
                                                         size_t *len_p);

Convert a rasqal_xsd_date struct to a xsd:date lexical form string.

Caller should rasqal_free_memory() the returned string.

See http://www.w3.org/TR/xmlschema-2/date-canonical-representation

date :

date struct

len_p :

output length (or NULL)

Returns :

lexical form string or NULL on failure.

rasqal_xsd_date_to_string ()

char *              rasqal_xsd_date_to_string           (const rasqal_xsd_date *d);

Convert a rasqal_xsd_date struct to a xsd:date lexical form string.

Caller should rasqal_free_memory() the returned string.

d :

date struct

Returns :

lexical form string or NULL on failure.

rasqal_xsd_date_equals ()

int                 rasqal_xsd_date_equals              (const rasqal_xsd_date *d1,
                                                         const rasqal_xsd_date *d2,
                                                         int *incomparible_p);

Compare two XSD dates for equality.

d1 :

first XSD date

d2 :

second XSD date

incomparible_p :

address to store incomparable flag (or NULL)

Returns :

non-0 if equal.

rasqal_xsd_date_compare ()

int                 rasqal_xsd_date_compare             (const rasqal_xsd_date *d1,
                                                         const rasqal_xsd_date *d2,
                                                         int *incomparible_p);

Compare two XSD dates

If the only one of the two dates have timezones, the results may be incomparible and that will return >0 and set the value of the int point to by incomparible_p to non-0

d1 :

first XSD date

d2 :

second XSD date

incomparible_p :

address to store incomparable flag (or NULL)

Returns :

<0 if d1 is less than d2, 0 if equal, >0 otherwise

rasqal_xsd_datetime

typedef struct {
  signed int year;
  unsigned char month;
  unsigned char day;
  /* the following fields are integer values not characters */
  signed char hour;
  signed char minute;
  signed char second;
  signed int microseconds;
  signed short timezone_minutes;
  time_t time_on_timeline;
  char have_tz;
} rasqal_xsd_datetime;

XML Schema dateTime datatype (xsd:dateTime)

Signed types are required for normalization process where a value can be negative temporarily.

Examples of timezone fields: "2010-01-02T01:02:03" : timezone_minutes RASQAL_XSD_DATETIME_NO_TZ, have_tz 'N' "2010-01-02T01:02:03Z" : timezone_minutes 0, have_tz 'Z' "2010-01-02T01:02:03+00:00" : timezone_minutes 0, have_tz 'Y' "2010-01-02T01:02:03-01:00" : timezone_minutes -60, have_tz 'Y'

signed int year;

year

unsigned char month;

month 1-12

unsigned char day;

1-31

signed char hour;

hour 0-23

signed char minute;

minute 0-59

signed char second;

second 0-60 (yes 60 is allowed for leap seconds)

signed int microseconds;

microseconds

signed short timezone_minutes;

minutes +/- against UTC or RASQAL_XSD_DATETIME_NO_TZ if there is no timezone in the dateTime.

time_t time_on_timeline;

time on timeline

char have_tz;

timezone flag: 'Z' if Zulu, 'Y' if has other timezone offset in timezone_minutes, 'N' if there is no timezone

RASQAL_XSD_DATETIME_NO_TZ

#define RASQAL_XSD_DATETIME_NO_TZ (9999)

Sentinel XSD Decimal timezone value indicating no timezone is present.


rasqal_new_xsd_datetime ()

rasqal_xsd_datetime * rasqal_new_xsd_datetime           (rasqal_world *world,
                                                         const char *datetime_string);

Constructor - make a new XSD datetime object from a string

world :

world object

datetime_string :

XSD Datetime string

Returns :

new datetime or NULL on failure

rasqal_new_xsd_datetime_from_timeval ()

rasqal_xsd_datetime * rasqal_new_xsd_datetime_from_timeval
                                                        (rasqal_world *world,
                                                         struct timeval *tv);

Constructor - make a new XSD datetime object from a timeval

world :

world object

tv :

pointer to struct timeval

Returns :

new datetime or NULL on failure

rasqal_new_xsd_datetime_from_unixtime ()

rasqal_xsd_datetime * rasqal_new_xsd_datetime_from_unixtime
                                                        (rasqal_world *world,
                                                         time_t secs);

Constructor - make a new XSD datetime object from unixtime seconds

world :

world object

secs :

unixtime

Returns :

new datetime or NULL on failure

rasqal_new_xsd_datetime_from_xsd_date ()

rasqal_xsd_datetime * rasqal_new_xsd_datetime_from_xsd_date
                                                        (rasqal_world *world,
                                                         rasqal_xsd_date *date);

Constructor - make a new XSD datetime object from an XSD date

world :

world object

date :

pointer to XSD date

Returns :

new datetime or NULL on failure

rasqal_free_xsd_datetime ()

void                rasqal_free_xsd_datetime            (rasqal_xsd_datetime *dt);

Destroy XSD datetime object.

dt :

datetime object

rasqal_xsd_datetime_compare ()

int                 rasqal_xsd_datetime_compare         (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2);

Compare two XSD dateTimes

Deprecated for rasqal_xsd_datetime_compare2() which can return the incomparible result.

dt1 :

first XSD dateTime

dt2 :

second XSD dateTime

Returns :

<0 if dt1 is less than dt2, 0 if equal, >0 otherwise

rasqal_xsd_datetime_compare2 ()

int                 rasqal_xsd_datetime_compare2        (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2,
                                                         int *incomparible_p);

Compare two XSD dateTimes

If the only one of the two dateTimes have timezones, the results may be incomparible and that will return >0 and set the value of the int point to by incomparible_p to non-0

dt1 :

first XSD dateTime

dt2 :

second XSD dateTime

incomparible_p :

address to store incomparable flag (or NULL)

Returns :

<0 if dt1 is less than dt2, 0 if equal, >0 otherwise

rasqal_xsd_datetime_equals ()

int                 rasqal_xsd_datetime_equals          (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2);

Compare two XSD dateTimes for equality.

Deprecated: for rasqal_xsd_datetime_equals2 that returns incomparibility.

dt1 :

first XSD dateTime

dt2 :

second XSD dateTime

Returns :

non-0 if equal.

rasqal_xsd_datetime_equals2 ()

int                 rasqal_xsd_datetime_equals2         (const rasqal_xsd_datetime *dt1,
                                                         const rasqal_xsd_datetime *dt2,
                                                         int *incomparible_p);

Compare two XSD dateTimes for equality.

dt1 :

first XSD dateTime

dt2 :

second XSD dateTime

incomparible_p :

address to store incomparable flag (or NULL)

Returns :

non-0 if equal.

rasqal_xsd_datetime_get_as_timeval ()

struct timeval *    rasqal_xsd_datetime_get_as_timeval  (rasqal_xsd_datetime *dt);

Get a datetime as struct timeval

The returned timeval must be freed by the caller such as using rasqal_free_memory().

dt :

datetime

Returns :

pointer to a new timeval structure or NULL on failure

rasqal_xsd_datetime_get_as_unixtime ()

time_t              rasqal_xsd_datetime_get_as_unixtime (rasqal_xsd_datetime *dt);

Get a datetime as unix seconds

dt :

datetime

Returns :

unix seconds or 0 if dt is NULL

rasqal_xsd_datetime_get_seconds_as_decimal ()

rasqal_xsd_decimal * rasqal_xsd_datetime_get_seconds_as_decimal
                                                        (rasqal_world *world,
                                                         rasqal_xsd_datetime *dt);

Get the seconds component of a dateTime as a decimal

world :

world object

dt :

XSD dateTime

Returns :

decimal object or NULL on failure

rasqal_xsd_datetime_get_timezone_as_counted_string ()

char *              rasqal_xsd_datetime_get_timezone_as_counted_string
                                                        (rasqal_xsd_datetime *dt,
                                                         size_t *len_p);

Get the timezone of a datetime as a duration format string with optional length count

The returned string is owned by the caller and must be freed by rasqal_free_memory().

dt :

datetime

len_p :

pointer to store returned string length

Returns :

pointer to a new string or NULL on failure

rasqal_xsd_datetime_get_tz_as_counted_string ()

char *              rasqal_xsd_datetime_get_tz_as_counted_string
                                                        (rasqal_xsd_datetime *dt,
                                                         size_t *len_p);

Get the timezone of a datetime as a timezone string

The returned string is owned by the caller and must be freed by rasqal_free_memory().

dt :

datetime

len_p :

pointer to store returned string length

Returns :

pointer to a new string or NULL on failure

rasqal_xsd_datetime_set_from_timeval ()

int                 rasqal_xsd_datetime_set_from_timeval
                                                        (rasqal_xsd_datetime *dt,
                                                         struct timeval *tv);

Set an XSD dateTime from a struct timeval pointer

dt :

datetime

tv :

timeval

Returns :

non-0 on failure

rasqal_xsd_datetime_set_from_unixtime ()

int                 rasqal_xsd_datetime_set_from_unixtime
                                                        (rasqal_xsd_datetime *dt,
                                                         time_t clock);

Set an XSD dateTime from unixtime seconds

dt :

date time

clock :

unix time in seconds

Returns :

non-0 on failure

rasqal_xsd_datetime_to_counted_string ()

char *              rasqal_xsd_datetime_to_counted_string
                                                        (const rasqal_xsd_datetime *dt,
                                                         size_t *len_p);

Convert a rasqal_xsd_datetime struct to a xsd:dateTime lexical form counted string.

Caller should rasqal_free_memory() the returned string.

See http://www.w3.org/TR/xmlschema-2/dateTime-canonical-representation

dt :

datetime struct

len_p :

output length (or NULL)

Returns :

lexical form string or NULL on failure.

rasqal_xsd_datetime_to_string ()

char *              rasqal_xsd_datetime_to_string       (const rasqal_xsd_datetime *dt);

Convert a rasqal_xsd_datetime struct to a xsd:dateTime lexical form string.

Caller should rasqal_free_memory() the returned string.

dt :

datetime struct

Returns :

lexical form string or NULL on failure.

rasqal_free_xsd_decimal ()

void                rasqal_free_xsd_decimal             (rasqal_xsd_decimal *dec);

Destroy XSD Decimal object.

dec :

Decimal object

rasqal_new_xsd_decimal ()

rasqal_xsd_decimal * rasqal_new_xsd_decimal             (rasqal_world *world);

Create a new XSD Decimal object.

world :

rasqal world object

Returns :

new xsd:decimal object or NULL on failure.

rasqal_xsd_decimal

typedef struct rasqal_xsd_decimal_s rasqal_xsd_decimal;

Rasqal XSD Decimal class.


rasqal_xsd_decimal_abs ()

int                 rasqal_xsd_decimal_abs              (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);

Return the absolute value of an XSD Decimal

result :

result variable

a :

argment decimal

Returns :

non-0 on failure

rasqal_xsd_decimal_add ()

int                 rasqal_xsd_decimal_add              (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Add two XSD Decimals and store in result XSD Decimal

result :

result variable

a :

argment decimal 1

b :

argument decimal 2

Returns :

non-0 on failure

rasqal_xsd_decimal_as_counted_string ()

char *              rasqal_xsd_decimal_as_counted_string
                                                        (rasqal_xsd_decimal *dec,
                                                         size_t *len_p);

Get an XSD Decimal as a string lexical form with optional length.

The returned string is shared and owned by the dec object and must be copied. If len_p is not NULL, the length of the returned string is stored.

dec :

XSD Decimal

len_p :

pointer to length variable (or NULL)

Returns :

lexical form string or NULL on failure.

rasqal_xsd_decimal_as_string ()

char *              rasqal_xsd_decimal_as_string        (rasqal_xsd_decimal *dec);

Get an XSD Decimal as a string lexical form.

The returned string is shared and owned by the dec object and must be copied.

dec :

XSD Decimal

Returns :

lexical form string or NULL on failure.

rasqal_xsd_decimal_ceil ()

int                 rasqal_xsd_decimal_ceil             (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);

Return the number with no fractional part closes to argument for an XSD Decimal

result :

result variable

a :

argment decimal

Returns :

non-0 on failure

rasqal_xsd_decimal_compare ()

int                 rasqal_xsd_decimal_compare          (rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Compare two XSD Decimals

a :

first XSD decimal

b :

second XSD decimal

Returns :

<0 if a is less than b, 0 if equal, >1 otherwise

rasqal_xsd_decimal_divide ()

int                 rasqal_xsd_decimal_divide           (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Divide two XSD Decimals and store in result XSD Decimal

If the divisor b is 0, failure is returned

result :

result variable

a :

argment decimal 1

b :

argument decimal 2

Returns :

non-0 on failure

rasqal_xsd_decimal_equals ()

int                 rasqal_xsd_decimal_equals           (rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Compare two XSD Decimals for equality.

a :

first XSD Decimal

b :

second XSD Decimal

Returns :

non-0 if equal.

rasqal_xsd_decimal_floor ()

int                 rasqal_xsd_decimal_floor            (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);

Return the number with no fractional part closes to argument for an XSD Decimal

result :

result variable

a :

argment decimal

Returns :

non-0 on failure

rasqal_xsd_decimal_get_double ()

double              rasqal_xsd_decimal_get_double       (rasqal_xsd_decimal *dec);

Get an XSD Decimal as a double (may lose precision)

dec :

XSD Decimal

Returns :

double value.

rasqal_xsd_decimal_get_long ()

long                rasqal_xsd_decimal_get_long         (rasqal_xsd_decimal *dec,
                                                         int *error_p);

Get an XSD Decimal as a long (may lose precision)

dec :

XSD Decimal

error_p :

pointer to error flag

Returns :

long value or 0 on failure and *error_p is non-0

rasqal_xsd_decimal_is_zero ()

int                 rasqal_xsd_decimal_is_zero          (rasqal_xsd_decimal *d);

Test if an XSD decimal is zero.

d :

decimal

Returns :

non-0 if decimal is zero

rasqal_xsd_decimal_multiply ()

int                 rasqal_xsd_decimal_multiply         (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Multiply two XSD Decimals and store in result XSD Decimal

result :

result variable

a :

argment decimal 1

b :

argument decimal 2

Returns :

non-0 on failure

rasqal_xsd_decimal_negate ()

int                 rasqal_xsd_decimal_negate           (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);

Negate an XSD Decimal

result :

result variable

a :

argment decimal

Returns :

non-0 on failure

rasqal_xsd_decimal_print ()

int                 rasqal_xsd_decimal_print            (rasqal_xsd_decimal *dec,
                                                         FILE *stream);

Print an XSD Decimal to a stream

dec :

XSD Decimal object

stream :

FILE* handle to print to

Returns :

non-0 on failure

rasqal_xsd_decimal_round ()

int                 rasqal_xsd_decimal_round            (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a);

Return the number with no fractional part closes to argument for an XSD Decimal

result :

result variable

a :

argment decimal

Returns :

non-0 on failure

rasqal_xsd_decimal_set_double ()

int                 rasqal_xsd_decimal_set_double       (rasqal_xsd_decimal *dec,
                                                         double d);

Set an XSD Decimal value from a double.

dec :

XSD Decimal

d :

double

Returns :

non-0 on failure

rasqal_xsd_decimal_set_long ()

int                 rasqal_xsd_decimal_set_long         (rasqal_xsd_decimal *dec,
                                                         long l Param2);

Set an XSD Decimal value from a long.

dec :

XSD Decimal

Returns :

non-0 on failure

rasqal_xsd_decimal_set_string ()

int                 rasqal_xsd_decimal_set_string       (rasqal_xsd_decimal *dec,
                                                         const char *string);

Set an XSD Decimal value from a string lexical form

dec :

XSD Decimal

string :

lexical form

Returns :

non-0 on failure

rasqal_xsd_decimal_subtract ()

int                 rasqal_xsd_decimal_subtract         (rasqal_xsd_decimal *result,
                                                         rasqal_xsd_decimal *a,
                                                         rasqal_xsd_decimal *b);

Subtract two XSD Decimals and store in result XSD Decimal

result :

result variable

a :

argment decimal 1

b :

argument decimal 2

Returns :

non-0 on failure
rasqal-0.9.33/docs/html/home.png0000644000175000017500000000121612443715253013352 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME1KvIDATxՕkq?rCp ~CnpCAAJ .B-\'G]:ܠC -(8 Ԁ!fDғklbRoyxwpðIJ<of_-@RHf֟t^ښ$Q|pgv;X^^&s(bwwZF9&3඙ ^IRZUE.0Z]]U PYM8HGIekqqҀ! $۬3n e{-/seeeÌXOͷ$8==USQRR'9-s+B^ Cەs+%<7W :2IENDB`rasqal-0.9.33/docs/html/rasqal-section-variables-table.html0000644000175000017500000005574712443715253020604 00000000000000 Variables Table

Variables Table

Variables Table — A table of variables with optional bound literal values.

Description

A table of rasqal_variable usually associated with a rasqal_query query or rasqal_query_results query result set. The order of the variables in the table may be significant, such as for a standalone query result set in which case it might define the order of variables in resulting rows.

Details

rasqal_variables_table

typedef struct rasqal_variables_table_s rasqal_variables_table;

Internal - for now


rasqal_new_variables_table ()

rasqal_variables_table * rasqal_new_variables_table     (rasqal_world *world);

Constructor - create a new variables table

world :

rasqal world

Returns :

new variables table or NULL On failure

rasqal_free_variables_table ()

void                rasqal_free_variables_table         (rasqal_variables_table *vt);

Destructor - destroy a new variables table

vt :

rasqal variables table

rasqal_variables_table_add ()

rasqal_variable *   rasqal_variables_table_add          (rasqal_variables_table *vt,
                                                         rasqal_variable_type type,
                                                         const char *name,
                                                         rasqal_literal *value);

Constructor - Create a new variable and add it to the variables table

Deprecated: for rasqal_variables_table_add2() which copies the name and value

The name and value become owned by the rasqal_variable structure. If a variable with the name already exists, that is returned and the new value is ignored.

vt :

rasqal_variables_table to associate the variable with

type :

variable type defined by enumeration rasqal_variable_type

name :

variable name

value :

variable rasqal_literal value (or NULL)

Returns :

a new rasqal_variable or NULL on failure.

rasqal_variables_table_add2 ()

rasqal_variable *   rasqal_variables_table_add2         (rasqal_variables_table *vt,
                                                         rasqal_variable_type type,
                                                         const char *name,
                                                         size_t name_len,
                                                         rasqal_literal *value);

Constructor - Create a new variable and add it to the variables table

The name and value fields are copied. If a variable with the name already exists, that is returned and the new value is ignored.

vt :

rasqal_variables_table to associate the variable with

type :

variable type defined by enumeration rasqal_variable_type

name :

variable name

name_len :

length of name (or 0)

value :

variable rasqal_literal value (or NULL)

Returns :

a new rasqal_variable or NULL on failure.

rasqal_variables_table_add_variable ()

int                 rasqal_variables_table_add_variable (rasqal_variables_table *vt,
                                                         rasqal_variable *variable);

Constructor - Add an existing variable to the variables table

The variables table vt takes a reference to variable. This function will fail if the variable is already in the table. Use rasqal_variables_table_contains() to check before calling.

vt :

rasqal_variables_table to associate the variable with

variable :

existing variable to add

Returns :

non-0 on failure (such as name already exists)

rasqal_variables_table_get_by_name ()

rasqal_variable *   rasqal_variables_table_get_by_name  (rasqal_variables_table *vt,
                                                         rasqal_variable_type type,
                                                         const char *name);

Lookup a variable by type and name in the variables table.

Note that looking up for any type RASQAL_VARIABLE_TYPE_UNKNOWN may a name match but for any type so in cases where the query has both a named and anonymous (extensional) variable, an arbitrary one will be returned.

vt :

the variables table

type :

the variable type to match or RASQAL_VARIABLE_TYPE_UNKNOWN for any.

name :

the variable type

Returns :

a shared pointer to the rasqal_variable or NULL if not found

rasqal_variables_table_contains ()

int                 rasqal_variables_table_contains     (rasqal_variables_table *vt,
                                                         rasqal_variable_type type,
                                                         const char *name);

Check if there is a variable with the given type and name in the variables table

vt :

rasqal_variables_table to lookup

type :

variable type

name :

variable name

Returns :

non-0 if the variable is present
rasqal-0.9.33/docs/html/rasqal-section-query.html0000644000175000017500000043761112443715253016706 00000000000000 Query

Query

Query — Query object API, parsing and execution

Synopsis

enum                rasqal_query_verb;
typedef             rasqal_query;
rasqal_query *      rasqal_new_query                    (rasqal_world *world,
                                                         const char *name,
                                                         const char *uri);
void                rasqal_free_query                   (rasqal_query *query);
int                 rasqal_query_add_data_graph         (rasqal_query *query,
                                                         rasqal_data_graph *data_graph);
int                 rasqal_query_add_data_graphs        (rasqal_query *query,
                                                         raptor_sequence *data_graphs);
int                 rasqal_query_add_prefix             (rasqal_query *query,
                                                         rasqal_prefix *prefix);
int                 rasqal_query_add_variable           (rasqal_query *query,
                                                         rasqal_variable *var);
int                 rasqal_query_dataset_contains_named_graph
                                                        (rasqal_query *query,
                                                         raptor_uri *graph_uri);
rasqal_query_results * rasqal_query_execute             (rasqal_query *query);
raptor_sequence *   rasqal_query_get_all_variable_sequence
                                                        (rasqal_query *query);
raptor_sequence *   rasqal_query_get_anonymous_variable_sequence
                                                        (rasqal_query *query);
rasqal_row *        rasqal_query_get_bindings_row       (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_bindings_rows_sequence
                                                        (rasqal_query *query);
rasqal_variable *   rasqal_query_get_bindings_variable  (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_bindings_variables_sequence
                                                        (rasqal_query *query);
raptor_sequence *   rasqal_query_get_bound_variable_sequence
                                                        (rasqal_query *query);
rasqal_triple *     rasqal_query_get_construct_triple   (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_construct_triples_sequence
                                                        (rasqal_query *query);
rasqal_data_graph * rasqal_query_get_data_graph         (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_data_graph_sequence
                                                        (rasqal_query *query);
raptor_sequence *   rasqal_query_get_describe_sequence  (rasqal_query *query);
int                 rasqal_query_get_distinct           (rasqal_query *query);
int                 rasqal_query_get_explain            (rasqal_query *query);
rasqal_expression * rasqal_query_get_group_condition    (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_group_conditions_sequence
                                                        (rasqal_query *query);
rasqal_graph_pattern * rasqal_query_get_graph_pattern   (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_graph_pattern_sequence
                                                        (rasqal_query *query);
rasqal_expression * rasqal_query_get_having_condition   (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_having_conditions_sequence
                                                        (rasqal_query *query);
const char *        rasqal_query_get_label              (rasqal_query *query);
int                 rasqal_query_get_limit              (rasqal_query *query);
const char *        rasqal_query_get_name               (rasqal_query *query);
int                 rasqal_query_get_offset             (rasqal_query *query);
rasqal_expression * rasqal_query_get_order_condition    (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_order_conditions_sequence
                                                        (rasqal_query *query);
rasqal_prefix *     rasqal_query_get_prefix             (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_prefix_sequence    (rasqal_query *query);
rasqal_graph_pattern * rasqal_query_get_query_graph_pattern
                                                        (rasqal_query *query);
rasqal_triple *     rasqal_query_get_triple             (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_triple_sequence    (rasqal_query *query);
void *              rasqal_query_get_user_data          (rasqal_query *query);
rasqal_variable *   rasqal_query_get_variable           (rasqal_query *query,
                                                         int idx);
rasqal_query_verb   rasqal_query_get_verb               (rasqal_query *query);
int                 rasqal_query_get_wildcard           (rasqal_query *query);
int                 rasqal_query_has_variable2          (rasqal_query *query,
                                                         rasqal_variable_type type,
                                                         const char *name);
int                 rasqal_query_has_variable           (rasqal_query *query,
                                                         const char *name);
int                 rasqal_query_prepare                (rasqal_query *query,
                                                         const char *query_string,
                                                         raptor_uri *base_uri);
int                 rasqal_query_print                  (rasqal_query *query,
                                                         FILE *fh);
int                 rasqal_query_graph_pattern_visit2   (rasqal_query *query,
                                                         rasqal_graph_pattern_visit_fn visit_fn,
                                                         void *data);
void                rasqal_query_graph_pattern_visit    (rasqal_query *query,
                                                         rasqal_graph_pattern_visit_fn visit_fn,
                                                         void *data);
void                rasqal_query_set_distinct           (rasqal_query *query,
                                                         int distinct_mode);
void                rasqal_query_set_explain            (rasqal_query *query,
                                                         int is_explain);
void                rasqal_query_set_limit              (rasqal_query *query,
                                                         int limit);
void                rasqal_query_set_offset             (rasqal_query *query,
                                                         int offset);
void                rasqal_query_set_user_data          (rasqal_query *query,
                                                         void *user_data);
int                 rasqal_query_set_variable2          (rasqal_query *query,
                                                         rasqal_variable_type type,
                                                         const char *name,
                                                         rasqal_literal *value);
int                 rasqal_query_set_variable           (rasqal_query *query,
                                                         const char *name,
                                                         rasqal_literal *value);
int                 rasqal_query_set_store_results      (rasqal_query *query,
                                                         int store_results);
void                rasqal_query_set_wildcard           (rasqal_query *query,
                                                         int wildcard);
const char *        rasqal_query_verb_as_string         (rasqal_query_verb verb);
int                 rasqal_query_write                  (raptor_iostream *iostr,
                                                         rasqal_query *query,
                                                         raptor_uri *format_uri,
                                                         raptor_uri *base_uri);
int                 rasqal_query_iostream_write_escaped_counted_string
                                                        (rasqal_query *query,
                                                         raptor_iostream *iostr,
                                                         const unsigned char *string,
                                                         size_t len);
unsigned char *     rasqal_query_escape_counted_string  (rasqal_query *query,
                                                         const char *string,
                                                         size_t len,
                                                         size_t *output_len_p);
int                 rasqal_query_set_feature            (rasqal_query *query,
                                                         rasqal_feature feature,
                                                         int value);
int                 rasqal_query_set_feature_string     (rasqal_query *query,
                                                         rasqal_feature feature,
                                                         const char *value);
int                 rasqal_query_get_feature            (rasqal_query *query,
                                                         rasqal_feature feature);
const unsigned char * rasqal_query_get_feature_string   (rasqal_query *query,
                                                         rasqal_feature feature);
rasqal_query_results_type rasqal_query_get_result_type  (rasqal_query *query);
rasqal_update_operation * rasqal_query_get_update_operation
                                                        (rasqal_query *query,
                                                         int idx);
raptor_sequence *   rasqal_query_get_update_operations_sequence
                                                        (rasqal_query *query);

Description

This class provides the main interface to the library. A query can be constructed by parsing a string, retrieving it from a URI and/or constructing it via API methods to build the query expression.

The query structures can be read via methods to return the query verb rasqal_query_get_verb(), the rasqal_data_graph RDF data sources with rasqal_query_get_data_graph() etc., the rasqal_graph_pattern tree with rasqal_query_get_query_graph_pattern(), the sequence of order conditions with rasqal_query_get_order_condition() etc., the rasqal_variable selected to return with rasqal_query_get_bound_variable_sequence() or rasqal_query_get_all_variable_sequence(), and so on.

To process a query string, the rasqal_query_prepare() method parses the query string in some query language and initialises the rasqal_query structures.

The query can be evaluated with the internal query engine against some source of matches using rasqal_query_execute() to give an rasqal_query_results. There are multiple forms of results that can include variable bindings, a boolean or an RDF graph that can be tested for with methods on rasqal_query_results and then retrieved.

Details

enum rasqal_query_verb

typedef enum {
  /* internal */
  RASQAL_QUERY_VERB_UNKNOWN   = 0,
  RASQAL_QUERY_VERB_SELECT    = 1,
  RASQAL_QUERY_VERB_CONSTRUCT = 2,
  RASQAL_QUERY_VERB_DESCRIBE  = 3,
  RASQAL_QUERY_VERB_ASK       = 4,
  RASQAL_QUERY_VERB_DELETE    = 5,
  RASQAL_QUERY_VERB_INSERT    = 6,
  RASQAL_QUERY_VERB_UPDATE    = 7,

  /* internal */
  RASQAL_QUERY_VERB_LAST = RASQAL_QUERY_VERB_UPDATE
} rasqal_query_verb;

Query main operation verbs describing the major type of query being performed.

RASQAL_QUERY_VERB_UNKNOWN

Internal

RASQAL_QUERY_VERB_SELECT

SPARQL query select verb.

RASQAL_QUERY_VERB_CONSTRUCT

SPARQL query construct verb.

RASQAL_QUERY_VERB_DESCRIBE

SPARQL query describe verb.

RASQAL_QUERY_VERB_ASK

SPARQL query ask verb.

RASQAL_QUERY_VERB_DELETE

LAQRS query delete verb.

RASQAL_QUERY_VERB_INSERT

LAQRS query insert verb.

RASQAL_QUERY_VERB_UPDATE

SPARQL 1.1 (draft) update operation

RASQAL_QUERY_VERB_LAST

Internal

rasqal_query

rasqal_graph_query* query;

Rasqal query class.


rasqal_new_query ()

rasqal_query *      rasqal_new_query                    (rasqal_world *world,
                                                         const char *name,
                                                         const char *uri);

Constructor - create a new rasqal_query object.

A query language can be named or identified by a URI, either of which is optional. The default query language will be used if both are NULL. rasqal_world_get_query_language_description returns the description of the known names, labels, MIME types and URIs.

world :

rasqal_world object

name :

the query language name (or NULL)

uri :

raptor_uri language uri (or NULL)

Returns :

a new rasqal_query object or NULL on failure

rasqal_free_query ()

void                rasqal_free_query                   (rasqal_query *query);

Destructor - destroy a rasqal_query object.

query :

rasqal_query object

rasqal_query_add_data_graph ()

int                 rasqal_query_add_data_graph         (rasqal_query *query,
                                                         rasqal_data_graph *data_graph);

Add a data graph to the query.

query :

rasqal_query query object

data_graph :

data graph

Returns :

non-0 on failure

rasqal_query_add_data_graphs ()

int                 rasqal_query_add_data_graphs        (rasqal_query *query,
                                                         raptor_sequence *data_graphs);

Add a set of data graphs to the query.

The objects in the passed-in data_graphs sequence becomes owne by the query. The data_graphs sequence itself is freed and must not be used after this call.

query :

rasqal_query query object

data_graphs :

sequence of rasqal_data_graph

Returns :

non-0 on failure

rasqal_query_add_prefix ()

int                 rasqal_query_add_prefix             (rasqal_query *query,
                                                         rasqal_prefix *prefix);

Add a namespace prefix to the query.

If the prefix has already been used, the old URI will be overridden.

query :

rasqal_query query object

prefix :

rasqal_prefix namespace prefix, URI

Returns :

non-0 on failure

rasqal_query_add_variable ()

int                 rasqal_query_add_variable           (rasqal_query *query,
                                                         rasqal_variable *var);

Add a projected (named) variable to the query.

See also rasqal_query_set_variable() which assigns or removes a value to a previously added variable in the query.

query :

rasqal_query query object

var :

rasqal_variable variable

Returns :

non-0 on failure

rasqal_query_dataset_contains_named_graph ()

int                 rasqal_query_dataset_contains_named_graph
                                                        (rasqal_query *query,
                                                         raptor_uri *graph_uri);

Test if the query dataset contains a named graph

query :

rasqal_query query object

graph_uri :

query URI

Returns :

non-0 if the dataset contains a named graph

rasqal_query_execute ()

rasqal_query_results * rasqal_query_execute             (rasqal_query *query);

Excute a query - run and return results.

query :

the rasqal_query object

Returns :

a rasqal_query_results structure or NULL on failure.

rasqal_query_get_all_variable_sequence ()

raptor_sequence *   rasqal_query_get_all_variable_sequence
                                                        (rasqal_query *query);

Get the sequence of all variables mentioned in the query.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_variable pointers.

rasqal_query_get_anonymous_variable_sequence ()

raptor_sequence *   rasqal_query_get_anonymous_variable_sequence
                                                        (rasqal_query *query);

Get the sequence of anonymous variables mentioned in the query.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_variable pointers.

rasqal_query_get_bindings_row ()

rasqal_row *        rasqal_query_get_bindings_row       (rasqal_query *query,
                                                         int idx);

Get a rasqal_row* in the sequence of BINDINGS block result rows

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a raptor_sequence of raptor_row pointers

rasqal_query_get_bindings_rows_sequence ()

raptor_sequence *   rasqal_query_get_bindings_rows_sequence
                                                        (rasqal_query *query);

Get the sequence of BINDINGS block result rows

query :

rasqal_query query object

Returns :

a raptor_sequence of raptor_row pointers

rasqal_query_get_bindings_variable ()

rasqal_variable *   rasqal_query_get_bindings_variable  (rasqal_query *query,
                                                         int idx);

Get a rasqal_variable* in the sequence of BINDINGS block variables

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a raptor_sequence of raptor_variable pointers

rasqal_query_get_bindings_variables_sequence ()

raptor_sequence *   rasqal_query_get_bindings_variables_sequence
                                                        (rasqal_query *query);

Get the sequence of BINDINGS block variables

query :

rasqal_query query object

Returns :

a raptor_sequence of raptor_variable pointers

rasqal_query_get_bound_variable_sequence ()

raptor_sequence *   rasqal_query_get_bound_variable_sequence
                                                        (rasqal_query *query);

Get the sequence of projected variables in the query.

This returns the sequence of variables that are explicitly chosen via SELECT in SPARQL. Or all variables mentioned with SELECT *

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_variable pointers.

rasqal_query_get_construct_triple ()

rasqal_triple *     rasqal_query_get_construct_triple   (rasqal_query *query,
                                                         int idx);

Get a triple in the sequence of construct triples.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_triple pointer or NULL if out of the sequence range

rasqal_query_get_construct_triples_sequence ()

raptor_sequence *   rasqal_query_get_construct_triples_sequence
                                                        (rasqal_query *query);

Get the sequence of triples for a construct.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_triple pointers.

rasqal_query_get_data_graph ()

rasqal_data_graph * rasqal_query_get_data_graph         (rasqal_query *query,
                                                         int idx);

Get a rasqal_data_graph* in the sequence of data_graphs.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_data_graph pointer or NULL if out of the sequence range

rasqal_query_get_data_graph_sequence ()

raptor_sequence *   rasqal_query_get_data_graph_sequence
                                                        (rasqal_query *query);

Get the sequence of data_graph URIs.

query :

rasqal_query query object

Returns :

a raptor_sequence of raptor_uri pointers.

rasqal_query_get_describe_sequence ()

raptor_sequence *   rasqal_query_get_describe_sequence  (rasqal_query *query);

Get the sequence of literals described in the query.

This returns the sequence of literals (constants or variables) that are explicitly chosen via DESCRIBE in SPARQL.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_literal pointers.

rasqal_query_get_distinct ()

int                 rasqal_query_get_distinct           (rasqal_query *query);

Get the query distinct mode

See rasqal_query_set_distinct() for the distinct modes.

query :

rasqal_query query object

Returns :

non-0 if the results should be distinct

rasqal_query_get_explain ()

int                 rasqal_query_get_explain            (rasqal_query *query);

Get the query explain results flag.

query :

rasqal_query query object

Returns :

non-0 if the results should be explain

rasqal_query_get_group_condition ()

rasqal_expression * rasqal_query_get_group_condition    (rasqal_query *query,
                                                         int idx);

Get a query grouping expression in the sequence of query grouping conditions.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_expression pointer or NULL if out of the sequence range

rasqal_query_get_group_conditions_sequence ()

raptor_sequence *   rasqal_query_get_group_conditions_sequence
                                                        (rasqal_query *query);

Get the sequence of query grouping conditions.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_expression pointers.

rasqal_query_get_graph_pattern ()

rasqal_graph_pattern * rasqal_query_get_graph_pattern   (rasqal_query *query,
                                                         int idx);

Get a graph_pattern in the sequence of graph_pattern expressions in the top query graph pattern.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_graph_pattern pointer or NULL if out of the sequence range

rasqal_query_get_graph_pattern_sequence ()

raptor_sequence *   rasqal_query_get_graph_pattern_sequence
                                                        (rasqal_query *query);

Get the sequence of graph_patterns expressions inside the top query graph pattern.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_graph_pattern pointers.

rasqal_query_get_having_condition ()

rasqal_expression * rasqal_query_get_having_condition   (rasqal_query *query,
                                                         int idx);

Get a query having expression in the sequence of query havinging conditions.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_expression pointer or NULL if out of the sequence range

rasqal_query_get_having_conditions_sequence ()

raptor_sequence *   rasqal_query_get_having_conditions_sequence
                                                        (rasqal_query *query);

Get the sequence of query having conditions.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_expression pointers.

rasqal_query_get_label ()

const char *        rasqal_query_get_label              (rasqal_query *query);

Get a readable label for the query language.

query :

rasqal_query query object

Returns :

shared string label value

rasqal_query_get_limit ()

int                 rasqal_query_get_limit              (rasqal_query *query);

Get the query-specified limit on results.

This is the limit given in the query on the number of results allowed.

query :

rasqal_query query object

Returns :

integer >=0 if a limit is given, otherwise <0

rasqal_query_get_name ()

const char *        rasqal_query_get_name               (rasqal_query *query);

Get a short name for the query language.

query :

rasqal_query query object

Returns :

shared string label value

rasqal_query_get_offset ()

int                 rasqal_query_get_offset             (rasqal_query *query);

Get the query-specified offset on results.

This is the offset given in the query on the number of results allowed. It is only guaranteed to work after the query is prepared and before it is executed.

query :

rasqal_query query object

Returns :

integer >=0 if a offset is given, otherwise <0

rasqal_query_get_order_condition ()

rasqal_expression * rasqal_query_get_order_condition    (rasqal_query *query,
                                                         int idx);

Get a query ordering expression in the sequence of query ordering conditions.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_expression pointer or NULL if out of the sequence range

rasqal_query_get_order_conditions_sequence ()

raptor_sequence *   rasqal_query_get_order_conditions_sequence
                                                        (rasqal_query *query);

Get the sequence of query ordering conditions.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_expression pointers.

rasqal_query_get_prefix ()

rasqal_prefix *     rasqal_query_get_prefix             (rasqal_query *query,
                                                         int idx);

Get a prefix in the sequence of namespsace prefixes in the query.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_prefix pointer or NULL if out of the sequence range

rasqal_query_get_prefix_sequence ()

raptor_sequence *   rasqal_query_get_prefix_sequence    (rasqal_query *query);

Get the sequence of namespace prefixes in the query.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_prefix pointers.

rasqal_query_get_query_graph_pattern ()

rasqal_graph_pattern * rasqal_query_get_query_graph_pattern
                                                        (rasqal_query *query);

Get the top query graph pattern.

query :

rasqal_query query object

Returns :

a rasqal_graph_pattern of the top query graph pattern

rasqal_query_get_triple ()

rasqal_triple *     rasqal_query_get_triple             (rasqal_query *query,
                                                         int idx);

Get a triple in the sequence of matching triples in the query.

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_triple pointer or NULL if out of the sequence range

rasqal_query_get_triple_sequence ()

raptor_sequence *   rasqal_query_get_triple_sequence    (rasqal_query *query);

Get the sequence of matching triples in the query.

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_triple pointers.

rasqal_query_get_user_data ()

void *              rasqal_query_get_user_data          (rasqal_query *query);

Get query user data.

query :

rasqal_query

Returns :

user data as set by rasqal_query_set_user_data()

rasqal_query_get_variable ()

rasqal_variable *   rasqal_query_get_variable           (rasqal_query *query,
                                                         int idx);

Get a variable in the query

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

pointer to shared rasqal_variable or NULL if out of range

rasqal_query_get_verb ()

rasqal_query_verb   rasqal_query_get_verb               (rasqal_query *query);

Get the query verb.

query :

rasqal_query

Returns :

the operating verb of the query of type rasqal_query_verb

rasqal_query_get_wildcard ()

int                 rasqal_query_get_wildcard           (rasqal_query *query);

Get the query verb is wildcard flag.

query :

rasqal_query

Returns :

non-0 if the query verb was a wildcard (such as SELECT *)

rasqal_query_has_variable2 ()

int                 rasqal_query_has_variable2          (rasqal_query *query,
                                                         rasqal_variable_type type,
                                                         const char *name);

Find if the named variable of the given type is in the query

Note that looking up for any type RASQAL_VARIABLE_TYPE_UNKNOWN may a name match but for any type so in cases where the query has both a named and anonymous (extensional) variable, an arbitrary one will be returned.

query :

rasqal_query query object

type :

the variable type to match or RASQAL_VARIABLE_TYPE_UNKNOWN for any.

name :

variable name

Returns :

non-0 if the variable name was found.

rasqal_query_has_variable ()

int                 rasqal_query_has_variable           (rasqal_query *query,
                                                         const char *name);

Find if the named variable is in the query (of any type)

Deprecated: Use rasqal_query_has_variable2() with the variable type arg

query :

rasqal_query query object

name :

variable name

Returns :

non-0 if the variable name was found.

rasqal_query_prepare ()

int                 rasqal_query_prepare                (rasqal_query *query,
                                                         const char *query_string,
                                                         raptor_uri *base_uri);

Prepare a query - typically parse it.

Some query languages may require a base URI to resolve any relative URIs in the query string. If this is not given, the current directory in the filesystem is used as the base URI.

The query string may be NULL in which case it is not parsed and the query parts may be created by API calls such as rasqal_query_add_source etc.

query :

the rasqal_query object

query_string :

the query string (or NULL)

base_uri :

base URI of query string (optional)

Returns :

non-0 on failure.

rasqal_query_print ()

int                 rasqal_query_print                  (rasqal_query *query,
                                                         FILE *fh);

Print a query in a debug format.

query :

the rasqal_query object

fh :

the FILE* handle to print to.

Returns :

non-0 on failure

rasqal_query_graph_pattern_visit2 ()

int                 rasqal_query_graph_pattern_visit2   (rasqal_query *query,
                                                         rasqal_graph_pattern_visit_fn visit_fn,
                                                         void *data);

Visit all graph patterns in a query with a user function visit_fn.

See also rasqal_graph_pattern_visit().

query :

query

visit_fn :

user function to operate on

data :

user data to pass to function

Returns :

result from visit function visit_fn if it returns non-0

rasqal_query_graph_pattern_visit ()

void                rasqal_query_graph_pattern_visit    (rasqal_query *query,
                                                         rasqal_graph_pattern_visit_fn visit_fn,
                                                         void *data);

Visit all graph patterns in a query with a user function visit_fn.

Deprecated: use rasqal_query_graph_pattern_visit2() that returns the visit_fn status code.

See also rasqal_graph_pattern_visit().

query :

query

visit_fn :

user function to operate on

data :

user data to pass to function

rasqal_query_set_distinct ()

void                rasqal_query_set_distinct           (rasqal_query *query,
                                                         int distinct_mode);

Set the query distinct results mode.

The allowed distinct_mode values are: 0 if not given 1 if DISTINCT: ensure solutions are unique 2 if SPARQL REDUCED: permit elimination of some non-unique solutions

query :

rasqal_query query object

distinct_mode :

distinct mode

rasqal_query_set_explain ()

void                rasqal_query_set_explain            (rasqal_query *query,
                                                         int is_explain);

Set the query explain results flag.

query :

rasqal_query query object

is_explain :

non-0 if explain

rasqal_query_set_limit ()

void                rasqal_query_set_limit              (rasqal_query *query,
                                                         int limit);

Set the query-specified limit on results.

This is the limit given in the query on the number of results allowed. It is only guaranteed to work after the query is prepared and before it is executed.

query :

rasqal_query query object

limit :

the limit on results, >=0 to set a limit, <0 to have no limit

rasqal_query_set_offset ()

void                rasqal_query_set_offset             (rasqal_query *query,
                                                         int offset);

Set the query-specified offset on results.

This is the offset given in the query on the number of results allowed.

query :

rasqal_query query object

offset :

offset for results, >=0 to set an offset, <0 to have no offset

rasqal_query_set_user_data ()

void                rasqal_query_set_user_data          (rasqal_query *query,
                                                         void *user_data);

Set the query user data.

query :

rasqal_query

user_data :

some user data to associate with the query

rasqal_query_set_variable2 ()

int                 rasqal_query_set_variable2          (rasqal_query *query,
                                                         rasqal_variable_type type,
                                                         const char *name,
                                                         rasqal_literal *value);

Bind an existing typed variable to a value to the query.

See also rasqal_query_add_variable() which adds a new binding variable and must be called before this method is invoked.

query :

rasqal_query query object

type :

the variable type to match or RASQAL_VARIABLE_TYPE_UNKNOWN for any.

name :

rasqal_variable variable

value :

rasqal_literal value to set or NULL

Returns :

non-0 on failure

rasqal_query_set_variable ()

int                 rasqal_query_set_variable           (rasqal_query *query,
                                                         const char *name,
                                                         rasqal_literal *value);

Bind an existing named (selected) variable to a value to the query.

Deprecated for rasqal_query_set_variable2() that includes a type arg. This function only sets named variables of type RASQAL_VARIABLE_TYPE_NORMAL

query :

rasqal_query query object

name :

rasqal_variable variable

value :

rasqal_literal value to set or NULL

Returns :

non-0 on failure

rasqal_query_set_store_results ()

int                 rasqal_query_set_store_results      (rasqal_query *query,
                                                         int store_results);

Request that query results are stored during execution

When called after a rasqal_query_prepare(), this tells rasqal_query_execute() to execute the entire query immediately rather than generate them lazily, and store all the results in memory. The results will then be available for reading multiple times using rasqal_query_results_rewind() to move back to the start of the result object. If called after preparation, returns failure.

query :

the rasqal_query object

store_results :

store results flag

Returns :

non-0 on failure.

rasqal_query_set_wildcard ()

void                rasqal_query_set_wildcard           (rasqal_query *query,
                                                         int wildcard);

Set the query projection wildcard flag

query :

rasqal_query query object

wildcard :

wildcard

rasqal_query_verb_as_string ()

const char *        rasqal_query_verb_as_string         (rasqal_query_verb verb);

Get a string for the query verb.

verb :

the rasqal_query_verb verb of the query

Returns :

pointer to a shared string label for the query verb

rasqal_query_write ()

int                 rasqal_query_write                  (raptor_iostream *iostr,
                                                         rasqal_query *query,
                                                         raptor_uri *format_uri,
                                                         raptor_uri *base_uri);

Write a query to an iostream in a specified format.

The supported URIs for the format_uri are:

Default: SPARQL Query Language 2006-04-06 http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/

iostr :

raptor_iostream to write the query to

query :

rasqal_query pointer.

format_uri :

raptor_uri describing the format to write (or NULL for default)

base_uri :

raptor_uri base URI of the output format

Returns :

non-0 on failure

rasqal_query_iostream_write_escaped_counted_string ()

int                 rasqal_query_iostream_write_escaped_counted_string
                                                        (rasqal_query *query,
                                                         raptor_iostream *iostr,
                                                         const unsigned char *string,
                                                         size_t len);

Write a string to an iostream in escaped form suitable for the query string.

query :

rasqal_query object

iostr :

raptor_iostream to write the escaped string to

string :

string to escape

len :

Length of string to escape

Returns :

non-0 on failure

rasqal_query_escape_counted_string ()

unsigned char *     rasqal_query_escape_counted_string  (rasqal_query *query,
                                                         const char *string,
                                                         size_t len,
                                                         size_t *output_len_p);

Convert a string into an escaped form suitable for the query string.

The returned string must be freed by the caller with rasqal_free_memory()

query :

rasqal_query object

string :

string to escape

len :

Length of string to escape

output_len_p :

Pointer to store length of output string (or NULL)

Returns :

the escaped string or NULL on failure.

rasqal_query_set_feature ()

int                 rasqal_query_set_feature            (rasqal_query *query,
                                                         rasqal_feature feature,
                                                         int value);

Set various query features.

The allowed features are available via rasqal_features_enumerate().

query :

rasqal_query query object

feature :

feature to set from enumerated rasqal_feature values

value :

integer feature value

Returns :

non 0 on failure or if the feature is unknown

rasqal_query_set_feature_string ()

int                 rasqal_query_set_feature_string     (rasqal_query *query,
                                                         rasqal_feature feature,
                                                         const char *value);

Set query features with string values.

The allowed features are available via rasqal_features_enumerate(). If the feature type is integer, the value is interpreted as an integer.

query :

rasqal_query query object

feature :

feature to set from enumerated rasqal_feature values

value :

feature value

Returns :

non 0 on failure or if the feature is unknown

rasqal_query_get_feature ()

int                 rasqal_query_get_feature            (rasqal_query *query,
                                                         rasqal_feature feature);

Get various query features.

The allowed features are available via rasqal_features_enumerate().

Note: no feature value is negative

query :

rasqal_query query object

feature :

feature to get value

Returns :

feature value or < 0 for an illegal feature

rasqal_query_get_feature_string ()

const unsigned char * rasqal_query_get_feature_string   (rasqal_query *query,
                                                         rasqal_feature feature);

Get query features with string values.

The allowed features are available via rasqal_features_enumerate(). If a string is returned, it must be freed by the caller.

query :

rasqal_query query object

feature :

feature to get value

Returns :

feature value or NULL for an illegal feature or no value

rasqal_query_get_result_type ()

rasqal_query_results_type rasqal_query_get_result_type  (rasqal_query *query);

Get the result type expected from executing the query.

This function is only valid after rasqal_query_prepare() has been run on the query and will return RASQAL_QUERY_RESULTS_UNKNOWN if called before preparation.

query :

rasqal_query query object

Returns :

result type or RASQAL_QUERY_RESULTS_UNKNOWN if not known or on error

rasqal_query_get_update_operation ()

rasqal_update_operation * rasqal_query_get_update_operation
                                                        (rasqal_query *query,
                                                         int idx);

Get a query update operation in the sequence of update operations

query :

rasqal_query query object

idx :

index into the sequence (0 or larger)

Returns :

a rasqal_update_operation pointer or NULL if out of the sequence range

rasqal_query_get_update_operations_sequence ()

raptor_sequence *   rasqal_query_get_update_operations_sequence
                                                        (rasqal_query *query);

Get the sequence of update operations

query :

rasqal_query query object

Returns :

a raptor_sequence of rasqal_update_operation pointers.
rasqal-0.9.33/docs/html/rasqal-changes-0-9-29-to-0-9-30.html0000644000175000017500000000461312443715253017375 00000000000000 Changes between Rasqal 0.9.29 and 0.9.30

Changes between Rasqal 0.9.29 and 0.9.30

New functions, types and enums

Functions

rasqal-0.9.33/docs/html/rasqal-section-row.html0000644000175000017500000002073312443715253016341 00000000000000 Query Result Row

Query Result Row

Query Result Row — Result row in a query result set containing a set of literals that are bound to variables.

Synopsis

typedef             rasqal_row;
rasqal_row *        rasqal_new_row_for_size             (rasqal_world *world,
                                                         int size);
void                rasqal_free_row                     (rasqal_row *row);
int                 rasqal_row_set_value_at             (rasqal_row *row,
                                                         int offset,
                                                         rasqal_literal *value);

Description

An ordered row of rasqal_literal values that are each bound to rasqal_variable defined in an associated rasqal_variables table inside a rasqal_query_results query result set.

Details

rasqal_row

typedef struct rasqal_row_s rasqal_row;

Rasqal Result Row class.


rasqal_new_row_for_size ()

rasqal_row *        rasqal_new_row_for_size             (rasqal_world *world,
                                                         int size);

Constructor - Create a new query result row of a given size

world :

rasqal_world

size :

width of row

Returns :

a new query result row or NULL on failure

rasqal_free_row ()

void                rasqal_free_row                     (rasqal_row *row);

Destructor - Free a query result row object.

row :

query result row

rasqal_row_set_value_at ()

int                 rasqal_row_set_value_at             (rasqal_row *row,
                                                         int offset,
                                                         rasqal_literal *value);

Set the value of a variable in a query result row

Any existing row value is freed and the literal value passed in is copied.

row :

query result row

offset :

offset into row (column number)

value :

literal value to set

Returns :

non-0 on failure
rasqal-0.9.33/docs/html/rasqal-changes-0-9-32-to-0-9-33.html0000644000175000017500000001541012443715253017367 00000000000000 Changes between Rasqal 0.9.32 and 0.9.33

Changes between Rasqal 0.9.32 and 0.9.33

New functions, types and enums

Functions

Renamed function and enums

0.9.32 function 0.9.33 function Notes
rasqal_query_results_formats_check rasqal_query_results_formats_check2 Correctly implements return value: non-0 if exists.

Changed functions and types

0.9.32 function 0.9.33 function Notes
rasqal_query_results* rasqal_new_query_results(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type, rasqal_variables_table* vars_table) rasqal_query_results* rasqal_new_query_results2(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type) Deprecates rasqal_new_query_results()
0.9.32 type 0.9.33 type Notes
rasqal_triples_source_factory rasqal_triples_source_factory API v3: Added init_triples_source2 handler field using rasqal_triples_error_handler2
rasqal-0.9.33/docs/html/rasqal-section-general.html0000644000175000017500000016000712443715253017146 00000000000000 General library facilities

General library facilities

General library facilities — Startup and shutdown, memory handling, version checks and misc functions.

Synopsis

typedef             rasqal_world;
void                rasqal_free_world                   (rasqal_world *world);
rasqal_world *      rasqal_new_world                    (void);
int                 rasqal_world_open                   (rasqal_world *world);
void                rasqal_world_set_log_handler        (rasqal_world *world,
                                                         void *user_data,
                                                         raptor_log_handler handler);
int                 rasqal_world_set_warning_level      (rasqal_world *world,
                                                         unsigned int warning_level);
raptor_world *      rasqal_world_get_raptor             (rasqal_world *world);
void                rasqal_world_set_raptor             (rasqal_world *world,
                                                         raptor_world *raptor_world_ptr);
const raptor_syntax_description * rasqal_world_get_query_language_description
                                                        (rasqal_world *world,
                                                         unsigned int counter);
const raptor_syntax_description * rasqal_world_get_query_results_format_description
                                                        (rasqal_world *world,
                                                         unsigned int counter);
char *              (*rasqal_generate_bnodeid_handler)  (rasqal_world *world,
                                                         void *user_data,
                                                         unsigned char *user_bnodeid);
int                 rasqal_world_set_generate_bnodeid_handler
                                                        (rasqal_world *world,
                                                         void *user_data,
                                                         rasqal_generate_bnodeid_handler handler);
int                 rasqal_world_set_default_generate_bnodeid_parameters
                                                        (rasqal_world *world,
                                                         char *prefix,
                                                         int base);
const char *        rasqal_world_guess_query_results_format_name
                                                        (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         const char *buffer,
                                                         size_t len,
                                                         const unsigned char *identifier);
extern const unsigned int rasqal_version_decimal;
extern const unsigned int rasqal_version_major;
extern const unsigned int rasqal_version_minor;
extern const unsigned int rasqal_version_release;
extern const char * const rasqal_version_string;
extern const char * const rasqal_copyright_string;
extern const char * const rasqal_short_copyright_string;
extern const char * const rasqal_home_url_string;
extern const char * const rasqal_license_string;
enum                rasqal_feature;
int                 rasqal_language_name_check          (rasqal_world *world,
                                                         const char *name);
int                 rasqal_languages_enumerate          (rasqal_world *world,
                                                         unsigned int counter,
                                                         const char **name,
                                                         const char **label,
                                                         const unsigned char **uri_string);
void *              rasqal_alloc_memory                 (size_t size);
void *              rasqal_calloc_memory                (size_t nmemb,
                                                         size_t size);
void                rasqal_free_memory                  (void *ptr);
rasqal_feature      rasqal_feature_from_uri             (rasqal_world *world,
                                                         raptor_uri *uri);
int                 rasqal_feature_value_type           (const rasqal_feature feature);
int                 rasqal_features_enumerate           (rasqal_world *world,
                                                         const rasqal_feature feature,
                                                         const char **name,
                                                         raptor_uri **uri,
                                                         const char **label);
unsigned int        rasqal_get_feature_count            (void);
#define             RASQAL_DEPRECATED
#define             RASQAL_VERSION
#define             RASQAL_VERSION_MAJOR
#define             RASQAL_VERSION_MINOR
#define             RASQAL_VERSION_RELEASE
#define             RASQAL_VERSION_STRING
#define             RASQAL_RAPTOR_VERSION

Description

The functions in this section cover general library features such as startup and shutdown, checking the current library version and dealing with memory allocation and freeing. It also provides functions to enumerate and check the supported query languages, their names, labels and URI.

Details

rasqal_world

rasqal_world* world;

Rasqal world class.


rasqal_free_world ()

void                rasqal_free_world                   (rasqal_world *world);

Terminate the rasqal library.

Destroys a rasqal_world object and all static information.

world :

rasqal_world object

rasqal_new_world ()

rasqal_world *      rasqal_new_world                    (void);

Allocate a new rasqal_world object.

The rasqal_world is initialized with rasqal_world_open(). Allocation and initialization are decoupled to allow changing settings on the world object before init.

Returns :

rasqal_world object or NULL on failure

rasqal_world_open ()

int                 rasqal_world_open                   (rasqal_world *world);

Initialise the rasqal library.

Initializes a rasqal_world object created by rasqal_new_world(). Allocation and initialization are decoupled to allow changing settings on the world object before init. These settings include e.g. the raptor library instance set with rasqal_world_set_raptor().

The initialized world object is used with subsequent rasqal API calls.

world :

rasqal_world object

Returns :

non-0 on failure

rasqal_world_set_log_handler ()

void                rasqal_world_set_log_handler        (rasqal_world *world,
                                                         void *user_data,
                                                         raptor_log_handler handler);

Set the log handler for this rasqal_world.

Also sets the raptor log handler to the same user_data and handler via raptor_world_set_log_handler(). (Rasqal 0.9.26+)

world :

rasqal_world object

user_data :

user data for log handler function

handler :

log handler function

rasqal_world_set_warning_level ()

int                 rasqal_world_set_warning_level      (rasqal_world *world,
                                                         unsigned int warning_level);

Set the rasqal warning reporting level

The warning levels used are as follows:

  1. Level 10 is used for serious warnings that may be errors.

  2. Level 30 is used for moderate style warnings.

  3. Level 90 is used for strict conformance warnings.

When this method is called to set a warning level, only warnings of less than warning_level are reported. The default warning level is 50.

world :

world

warning_level :

warning level 0..100

Returns :

non-0 on failure

rasqal_world_get_raptor ()

raptor_world *      rasqal_world_get_raptor             (rasqal_world *world);

Get the raptor_world instance used by this rasqal_world.

world :

rasqal_world object

Returns :

raptor_world object or NULL on failure (e.g. not initialized)

rasqal_world_set_raptor ()

void                rasqal_world_set_raptor             (rasqal_world *world,
                                                         raptor_world *raptor_world_ptr);

Set the raptor_world instance to be used with this rasqal_world.

If no raptor_world instance is set with this function, rasqal_world_open() creates a new instance.

Ownership of the raptor_world is not taken. If the raptor library instance is set with this function, rasqal_free_world() will not free it.

world :

rasqal_world object

raptor_world_ptr :

raptor_world object

rasqal_world_get_query_language_description ()

const raptor_syntax_description * rasqal_world_get_query_language_description
                                                        (rasqal_world *world,
                                                         unsigned int counter);

Get query language descriptive information

world :

world object

counter :

index into the list of query languages

Returns :

description or NULL if counter is out of range

rasqal_world_get_query_results_format_description ()

const raptor_syntax_description * rasqal_world_get_query_results_format_description
                                                        (rasqal_world *world,
                                                         unsigned int counter);

Get query result format descriptive syntax information

world :

world object

counter :

index into the list of query result formats

Returns :

description or NULL if counter is out of range

rasqal_generate_bnodeid_handler ()

char *              (*rasqal_generate_bnodeid_handler)  (rasqal_world *world,
                                                         void *user_data,
                                                         unsigned char *user_bnodeid);

User handler used with rasqal_world_set_generate_bnodeid_handler() to set method for generating a blank node ID.

world :

world arg

user_data :

user data given to

user_bnodeid :

user blank node ID string passed in

Returns :

blank node ID string or NULL on failure.

rasqal_world_set_generate_bnodeid_handler ()

int                 rasqal_world_set_generate_bnodeid_handler
                                                        (rasqal_world *world,
                                                         void *user_data,
                                                         rasqal_generate_bnodeid_handler handler);

Set the generate blank node ID handler function

Sets the function to generate blank node IDs. The handler is called with a pointer to the rasqal_world, the user_data pointer and a user_bnodeid which is the value of a user-provided blank node identifier (may be NULL). It can either be returned directly as the generated value when present or modified. The passed in value must be free()d if it is not used.

If handler is NULL, the default method is used

world :

rasqal_world object

user_data :

user data pointer for callback

handler :

generate blank ID callback function

Returns :

non-0 on failure

rasqal_world_set_default_generate_bnodeid_parameters ()

int                 rasqal_world_set_default_generate_bnodeid_parameters
                                                        (rasqal_world *world,
                                                         char *prefix,
                                                         int base);

Set default bnodeid generation parameters

Sets the parameters for the default algorithm used to generate blank node IDs. The default algorithm uses both prefix and base to generate a new identifier. The exact identifier generated is not guaranteed to be a strict concatenation of prefix and base but will use both parts.

For finer control of the generated identifiers, use rasqal_world_set_generate_bnodeid_handler()

If prefix is NULL, the default prefix is used (currently "bnodeid") If base is less than 1, it is initialised to 1.

world :

rasqal_world object

prefix :

prefix string

base :

integer base identifier

Returns :

non-0 on failure

rasqal_world_guess_query_results_format_name ()

const char *        rasqal_world_guess_query_results_format_name
                                                        (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         const char *mime_type,
                                                         const char *buffer,
                                                         size_t len,
                                                         const unsigned char *identifier);

Guess a query results format name for content.

Find a query results format by scoring recognition of the syntax by a block of characters, the content identifier or a mime type. The content identifier is typically a filename or URI or some other identifier.

world :

world object

uri :

URI identifying the syntax (or NULL)

mime_type :

mime type identifying the content (or NULL)

buffer :

buffer of content to guess (or NULL)

len :

length of buffer

identifier :

identifier of content (or NULL)

Returns :

a query results format name or NULL if no guess could be made

rasqal_version_decimal

extern const unsigned int rasqal_version_decimal;

Rasqal version as a decimal number.

Format: major * 10000 + minor * 100 + release


rasqal_version_major

extern const unsigned int rasqal_version_major;

Rasqal major version number.


rasqal_version_minor

extern const unsigned int rasqal_version_minor;

Rasqal minor version number.


rasqal_version_release

extern const unsigned int rasqal_version_release;

Rasqal release version number.


rasqal_version_string

extern const char * const rasqal_version_string;

Rasqal version as a string.


rasqal_copyright_string

extern const char * const rasqal_copyright_string;

Copyright string (multiple lines).


rasqal_short_copyright_string

extern const char * const rasqal_short_copyright_string;

Short copyright string (one line).


rasqal_home_url_string

extern const char * const rasqal_home_url_string;

Rasqal home page URL.


rasqal_license_string

extern const char * const rasqal_license_string;

Rasqal license string.


enum rasqal_feature

typedef enum {
  RASQAL_FEATURE_NO_NET,
  RASQAL_FEATURE_RAND_SEED,
  RASQAL_FEATURE_LAST = RASQAL_FEATURE_RAND_SEED
} rasqal_feature;

Query features.

None currently defined.

RASQAL_FEATURE_NO_NET

Deny network requests.

RASQAL_FEATURE_RAND_SEED

Set rand() / rand_r() seed

RASQAL_FEATURE_LAST

Internal.

rasqal_language_name_check ()

int                 rasqal_language_name_check          (rasqal_world *world,
                                                         const char *name);

Check name of a query language.

world :

rasqal_world object

name :

the query language name

Returns :

non 0 if name is a known query language

rasqal_languages_enumerate ()

int                 rasqal_languages_enumerate          (rasqal_world *world,
                                                         unsigned int counter,
                                                         const char **name,
                                                         const char **label,
                                                         const unsigned char **uri_string);

deprecated: Use rasqal_world_get_query_language_description() instead.

Get information on query languages.

world :

rasqal_world object

counter :

index into the list of syntaxes

name :

pointer to store the name of the syntax (or NULL)

label :

pointer to store syntax readable label (or NULL)

uri_string :

pointer to store syntax URI string (or NULL)

Returns :

non 0 on failure of if counter is out of range

rasqal_alloc_memory ()

void *              rasqal_alloc_memory                 (size_t size);

Allocate memory inside rasqal.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the rasqal shared library that can be freed inside rasqal either internally or via rasqal_free_memory().

size :

size of memory to allocate

Returns :

the address of the allocated memory or NULL on failure

rasqal_calloc_memory ()

void *              rasqal_calloc_memory                (size_t nmemb,
                                                         size_t size);

Allocate zeroed array of items inside rasqal.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the rasqal shared library that can be freed inside rasqal either internally or via rasqal_free_memory().

nmemb :

number of members

size :

size of item

Returns :

the address of the allocated memory or NULL on failure

rasqal_free_memory ()

void                rasqal_free_memory                  (void *ptr);

Free memory allocated inside rasqal.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory allocated by rasqal to be freed.

ptr :

memory pointer

rasqal_feature_from_uri ()

rasqal_feature      rasqal_feature_from_uri             (rasqal_world *world,
                                                         raptor_uri *uri);

Turn a feature URI into an feature enum.

The allowed feature URIs are available via rasqal_features_enumerate().

world :

rasqal_world object

uri :

feature URI

Returns :

< 0 if the feature is unknown

rasqal_feature_value_type ()

int                 rasqal_feature_value_type           (const rasqal_feature feature);

Get the type of a features.

The type of the feature is 0=integer , 1=string. Other values are undefined. Most features are integer values and use rasqal_query_set_feature rasqal_query_get_feature()

feature :

rasqal query feature

Returns :

the type of the feature or <0 if feature is unknown

rasqal_features_enumerate ()

int                 rasqal_features_enumerate           (rasqal_world *world,
                                                         const rasqal_feature feature,
                                                         const char **name,
                                                         raptor_uri **uri,
                                                         const char **label);

Get list of rasqal features.

If uri is not NULL, a pointer to a new raptor_uri is returned that must be freed by the caller with raptor_free_uri().

world :

rasqal_world object

feature :

feature enumeration (0+)

name :

pointer to store feature short name (or NULL)

uri :

pointer to store feature URI (or NULL)

label :

pointer to feature label (or NULL)

Returns :

0 on success, <0 on failure, >0 if feature is unknown

rasqal_get_feature_count ()

unsigned int        rasqal_get_feature_count            (void);

Get the count of features defined.

This is prefered to the compile time-only symbol RASQAL_FEATURE_LAST and returns a count of the number of features which is RASQAL_FEATURE_LAST+1.

Returns :

count of features in the rasqal_feature enumeration

RASQAL_DEPRECATED

#define RASQAL_DEPRECATED __attribute__((deprecated))

When defined before a function, indicates that the function has been deprecated and may be replaced in a future release. With some versions of gcc this may give a compilation warning.


RASQAL_VERSION

#define RASQAL_VERSION 933

Rasqal library version number

Format: major * 10000 + minor * 100 + release


RASQAL_VERSION_MAJOR

#define RASQAL_VERSION_MAJOR 0

Rasqal library major version


RASQAL_VERSION_MINOR

#define RASQAL_VERSION_MINOR 9

Rasqal library minor version


RASQAL_VERSION_RELEASE

#define RASQAL_VERSION_RELEASE 33

Rasqal library release


RASQAL_VERSION_STRING

#define RASQAL_VERSION_STRING "0.9.33"

Rasqal library version string


RASQAL_RAPTOR_VERSION

#define RASQAL_RAPTOR_VERSION 20015

Version of Raptor that Rasqal was configured against.

rasqal-0.9.33/docs/html/rasqal-changes-0-9-25-to-0-9-26.html0000644000175000017500000000742512443715253017402 00000000000000 Changes between Rasqal 0.9.25 and 0.9.26

Changes between Rasqal 0.9.25 and 0.9.26

New functions, types and enums

Functions

Enums

rasqal-0.9.33/docs/html/rasqal-changes-0-9-27-to-0-9-28.html0000644000175000017500000000473112443715253017403 00000000000000 Changes between Rasqal 0.9.27 and 0.9.28

Changes between Rasqal 0.9.27 and 0.9.28

New functions, types and enums

Functions

  • rasqal_expression* rasqal_new_4op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3, rasqal_expression* arg4)

rasqal-0.9.33/docs/html/style.css0000644000175000017500000001210012443715253013560 00000000000000.synopsis, .classsynopsis { /* tango:aluminium 1/2 */ background: #eeeeec; border: solid 1px #d3d7cf; padding: 0.5em; } .programlisting { /* tango:sky blue 0/1 */ background: #e6f3ff; border: solid 1px #729fcf; padding: 0.5em; } .variablelist { padding: 4px; margin-left: 3em; } .variablelist td:first-child { vertical-align: top; } @media screen { sup a.footnote { position: relative; top: 0em ! important; } /* this is needed so that the local anchors are displayed below the naviagtion */ div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name] { display: inline-block; position: relative; top:-5em; } /* this seems to be a bug in the xsl style sheets when generating indexes */ div.index div.index { top: 0em; } /* make space for the fixed navigation bar and add space at the bottom so that * link targets appear somewhat close to top */ body { padding-top: 3.2em; padding-bottom: 20em; } /* style and size the navigation bar */ table.navigation#top { position: fixed; /* tango:scarlet red 0/1 */ background: #ffe6e6; border: solid 1px #ef2929; margin-top: 0; margin-bottom: 0; top: 0; left: 0; height: 3em; z-index: 10; } .navigation a, .navigation a:visited { /* tango:scarlet red 3 */ color: #a40000; } .navigation a:hover { /* tango:scarlet red 1 */ color: #ef2929; } td.shortcuts { /* tango:scarlet red 1 */ color: #ef2929; font-size: 80%; white-space: nowrap; } } @media print { table.navigation { visibility: collapse; display: none; } div.titlepage table.navigation { visibility: visible; display: table; /* tango:scarlet red 0/1 */ background: #ffe6e6; border: solid 1px #ef2929; margin-top: 0; margin-bottom: 0; top: 0; left: 0; height: 3em; } } .navigation .title { font-size: 200%; } div.gallery-float { float: left; padding: 10px; } div.gallery-float img { border-style: none; } div.gallery-spacer { clear: both; } a, a:visited { text-decoration: none; /* tango:sky blue 2 */ color: #3465a4; } a:hover { text-decoration: underline; /* tango:sky blue 1 */ color: #729fcf; } div.table table { border-collapse: collapse; border-spacing: 0px; /* tango:aluminium 3 */ border: solid 1px #babdb6; } div.table table td, div.table table th { /* tango:aluminium 3 */ border: solid 1px #babdb6; padding: 3px; vertical-align: top; } div.table table th { /* tango:aluminium 2 */ background-color: #d3d7cf; } hr { /* tango:aluminium 3 */ color: #babdb6; background: #babdb6; border: none 0px; height: 1px; clear: both; } .footer { padding-top: 3.5em; /* tango:aluminium 3 */ color: #babdb6; text-align: center; font-size: 80%; } .warning { /* tango:orange 0/1 */ background: #ffeed9; border-color: #ffb04f; } .note { /* tango:chameleon 0/0.5 */ background: #d8ffb2; border-color: #abf562; } .note, .warning { padding: 0.5em; border-width: 1px; border-style: solid; } .note h3, .warning h3 { margin-top: 0.0em } .note p, .warning p { margin-bottom: 0.0em } /* blob links */ h2 .extralinks, h3 .extralinks { float: right; /* tango:aluminium 3 */ color: #babdb6; font-size: 80%; font-weight: normal; } .annotation { /* tango:aluminium 5 */ color: #555753; font-size: 80%; font-weight: normal; } /* code listings */ .listing_code .programlisting .cbracket { color: #a40000; } /* tango: scarlet red 3 */ .listing_code .programlisting .comment { color: #a1a39d; } /* tango: aluminium 4 */ .listing_code .programlisting .function { color: #000000; font-weight: bold; } .listing_code .programlisting .function a { color: #11326b; font-weight: bold; } /* tango: sky blue 4 */ .listing_code .programlisting .keyword { color: #4e9a06; } /* tango: chameleon 3 */ .listing_code .programlisting .linenum { color: #babdb6; } /* tango: aluminium 3 */ .listing_code .programlisting .normal { color: #000000; } .listing_code .programlisting .number { color: #75507b; } /* tango: plum 2 */ .listing_code .programlisting .preproc { color: #204a87; } /* tango: sky blue 3 */ .listing_code .programlisting .string { color: #c17d11; } /* tango: chocolate 2 */ .listing_code .programlisting .type { color: #000000; } .listing_code .programlisting .type a { color: #11326b; } /* tango: sky blue 4 */ .listing_code .programlisting .symbol { color: #ce5c00; } /* tango: orange 3 */ .listing_frame { /* tango:sky blue 1 */ border: solid 1px #729fcf; padding: 0px; } .listing_lines, .listing_code { margin-top: 0px; margin-bottom: 0px; padding: 0.5em; } .listing_lines { /* tango:sky blue 0.5 */ background: #a6c5e3; /* tango:aluminium 6 */ color: #2e3436; } .listing_code { /* tango:sky blue 0 */ background: #e6f3ff; } .listing_code .programlisting { /* override from previous */ border: none 0px; padding: 0px; } .listing_lines pre, .listing_code pre { margin: 0px; } rasqal-0.9.33/docs/html/index.html0000644000175000017500000002553712443715253013725 00000000000000 Rasqal RDF Query Library Manual

Dave Beckett

Manual for Rasqal 0.9.33

This documentation is Free Software / Open Source - you can redistribute it and/or modify it under the same licenses as Rasqal. 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 documentation except in compliance with at least one of the above three licenses. See the Rasqal site for the full license terms.


Rasqal Overview
I. Reference Manual
General library facilities — Startup and shutdown, memory handling, version checks and misc functions.
Data Graphs — RDF graph sources for triples.
Expressions — Query language expressions.
Graph patterns — Collections of triple patterns, sub-graph patterns with operators.
Literal — RDF literals and RDF query-specific literals.
Prefixes — XML QName-style prefixes made from a URI and a short text prefix.
Query — Query object API, parsing and execution
Query Results — Query results as variable bindings, boolean or RDF graphs.
Query Results Formatter — Query results formatted into a syntax.
Query Result Row — Result row in a query result set containing a set of literals that are bound to variables.
Service — Execute queries remotely via a SPARQL HTTP Protocol service.
Triples — Triple pattern or RDF triple.
Triples Source — Source of matches to a triple pattern.
Variables — Variable with names and literal value.
Variables Table — A table of variables with optional bound literal values.
Updates — Graph update operations
Utilities — Utility functions.
XML Schema Datetime and Decimals — XML Schema datetime and arbitrary length decimal number arithmetic.
API Changes
Introduction
Changes between Rasqal 0.9.21 and 0.9.22
New functions, types and enums
Deleted functions, types and enums
Renamed function and enums
Changed functions and types
Changes between Rasqal 0.9.22 and 0.9.23
New functions, types and enums
Changes between Rasqal 0.9.23 and 0.9.24
New functions, types and enums
Changes between Rasqal 0.9.24 and 0.9.25
New functions, types and enums
Changes between Rasqal 0.9.25 and 0.9.26
New functions, types and enums
Changes between Rasqal 0.9.26 and 0.9.27
New functions, types and enums
Changes between Rasqal 0.9.27 and 0.9.28
New functions, types and enums
Changes between Rasqal 0.9.28 and 0.9.29
New functions, types and enums
Changed functions and types
Changes between Rasqal 0.9.29 and 0.9.30
New functions, types and enums
Changes between Rasqal 0.9.30 and 0.9.31
New functions, types and enums
Changes between Rasqal 0.9.32 and 0.9.33
New functions, types and enums
Renamed function and enums
Changed functions and types
Changes between Rasqal 0.9.30 and 0.9.30
New functions, types and enums
Index
rasqal-0.9.33/docs/html/rasqal-changes-0-9-28-to-0-9-29.html0000644000175000017500000001571412443715253017410 00000000000000 Changes between Rasqal 0.9.28 and 0.9.29

Changes between Rasqal 0.9.28 and 0.9.29

New functions, types and enums

Functions

Enums

Changed functions and types

0.9.28 type 0.9.29 type Notes
rasqal_literal rasqal_literal Added date to value union.
rasqal_xsd_datetime rasqal_xsd_datetime Added time_on_timeline and have_tz fields.
rasqal-0.9.33/docs/html/rasqal-changes-0-9-23-to-0-9-24.html0000644000175000017500000000704112443715253017370 00000000000000 Changes between Rasqal 0.9.23 and 0.9.24

Changes between Rasqal 0.9.23 and 0.9.24

New functions, types and enums

Functions

Types

Enums

rasqal-0.9.33/docs/html/rasqal-changes-0-9-22-to-0-9-23.html0000644000175000017500000000470012443715253017365 00000000000000 Changes between Rasqal 0.9.22 and 0.9.23

Changes between Rasqal 0.9.22 and 0.9.23

New functions, types and enums

Functions

rasqal-0.9.33/docs/html/indexes.html0000644000175000017500000016017412443715253014252 00000000000000 Index

Index

R

rasqal_alloc_memory, rasqal_alloc_memory ()
rasqal_calloc_memory, rasqal_calloc_memory ()
rasqal_compare_flags, enum rasqal_compare_flags
rasqal_copyright_string, rasqal_copyright_string
rasqal_data_graph, rasqal_data_graph
rasqal_data_graph_flags, enum rasqal_data_graph_flags
rasqal_data_graph_print, rasqal_data_graph_print ()
RASQAL_DEPRECATED, RASQAL_DEPRECATED
rasqal_evaluation_context, rasqal_evaluation_context
rasqal_evaluation_context_set_base_uri, rasqal_evaluation_context_set_base_uri ()
rasqal_evaluation_context_set_rand_seed, rasqal_evaluation_context_set_rand_seed ()
rasqal_expression, rasqal_expression
rasqal_expression_compare, rasqal_expression_compare ()
rasqal_expression_evaluate, rasqal_expression_evaluate ()
rasqal_expression_evaluate2, rasqal_expression_evaluate2 ()
rasqal_expression_flags, enum rasqal_expression_flags
rasqal_expression_op_label, rasqal_expression_op_label ()
rasqal_expression_print, rasqal_expression_print ()
rasqal_expression_print_op, rasqal_expression_print_op ()
rasqal_expression_visit, rasqal_expression_visit ()
rasqal_expression_visit_fn, rasqal_expression_visit_fn ()
rasqal_feature, enum rasqal_feature
rasqal_features_enumerate, rasqal_features_enumerate ()
rasqal_feature_from_uri, rasqal_feature_from_uri ()
rasqal_feature_value_type, rasqal_feature_value_type ()
rasqal_free_data_graph, rasqal_free_data_graph ()
rasqal_free_evaluation_context, rasqal_free_evaluation_context ()
rasqal_free_expression, rasqal_free_expression ()
rasqal_free_literal, rasqal_free_literal ()
rasqal_free_memory, rasqal_free_memory ()
rasqal_free_prefix, rasqal_free_prefix ()
rasqal_free_query, rasqal_free_query ()
rasqal_free_query_results, rasqal_free_query_results ()
rasqal_free_query_results_formatter, rasqal_free_query_results_formatter ()
rasqal_free_row, rasqal_free_row ()
rasqal_free_service, rasqal_free_service ()
rasqal_free_triple, rasqal_free_triple ()
rasqal_free_variable, rasqal_free_variable ()
rasqal_free_variables_table, rasqal_free_variables_table ()
rasqal_free_world, rasqal_free_world ()
rasqal_free_xsd_date, rasqal_free_xsd_date ()
rasqal_free_xsd_datetime, rasqal_free_xsd_datetime ()
rasqal_free_xsd_decimal, rasqal_free_xsd_decimal ()
rasqal_generate_bnodeid_handler, rasqal_generate_bnodeid_handler ()
rasqal_get_feature_count, rasqal_get_feature_count ()
rasqal_graph_pattern, rasqal_graph_pattern
rasqal_graph_pattern_add_sub_graph_pattern, rasqal_graph_pattern_add_sub_graph_pattern ()
rasqal_graph_pattern_get_filter_expression, rasqal_graph_pattern_get_filter_expression ()
rasqal_graph_pattern_get_flattened_triples, rasqal_graph_pattern_get_flattened_triples ()
rasqal_graph_pattern_get_index, rasqal_graph_pattern_get_index ()
rasqal_graph_pattern_get_operator, rasqal_graph_pattern_get_operator ()
rasqal_graph_pattern_get_origin, rasqal_graph_pattern_get_origin ()
rasqal_graph_pattern_get_service, rasqal_graph_pattern_get_service ()
rasqal_graph_pattern_get_sub_graph_pattern, rasqal_graph_pattern_get_sub_graph_pattern ()
rasqal_graph_pattern_get_sub_graph_pattern_sequence, rasqal_graph_pattern_get_sub_graph_pattern_sequence ()
rasqal_graph_pattern_get_triple, rasqal_graph_pattern_get_triple ()
rasqal_graph_pattern_get_triples, rasqal_graph_pattern_get_triples ()
rasqal_graph_pattern_get_variable, rasqal_graph_pattern_get_variable ()
rasqal_graph_pattern_operator, enum rasqal_graph_pattern_operator
rasqal_graph_pattern_operator_as_string, rasqal_graph_pattern_operator_as_string ()
rasqal_graph_pattern_print, rasqal_graph_pattern_print ()
rasqal_graph_pattern_set_filter_expression, rasqal_graph_pattern_set_filter_expression ()
rasqal_graph_pattern_variable_bound_in, rasqal_graph_pattern_variable_bound_in ()
rasqal_graph_pattern_visit, rasqal_graph_pattern_visit ()
rasqal_graph_pattern_visit_fn, rasqal_graph_pattern_visit_fn ()
rasqal_home_url_string, rasqal_home_url_string
rasqal_languages_enumerate, rasqal_languages_enumerate ()
rasqal_language_name_check, rasqal_language_name_check ()
rasqal_license_string, rasqal_license_string
rasqal_literal, rasqal_literal
rasqal_literal_as_counted_string, rasqal_literal_as_counted_string ()
rasqal_literal_as_node, rasqal_literal_as_node ()
rasqal_literal_as_string, rasqal_literal_as_string ()
rasqal_literal_as_string_flags, rasqal_literal_as_string_flags ()
rasqal_literal_as_variable, rasqal_literal_as_variable ()
rasqal_literal_compare, rasqal_literal_compare ()
rasqal_literal_datatype, rasqal_literal_datatype ()
rasqal_literal_equals, rasqal_literal_equals ()
rasqal_literal_get_language, rasqal_literal_get_language ()
rasqal_literal_get_rdf_term_type, rasqal_literal_get_rdf_term_type ()
rasqal_literal_get_type, rasqal_literal_get_type ()
rasqal_literal_is_rdf_literal, rasqal_literal_is_rdf_literal ()
rasqal_literal_print, rasqal_literal_print ()
rasqal_literal_print_type, rasqal_literal_print_type ()
rasqal_literal_same_term, rasqal_literal_same_term ()
rasqal_literal_type, enum rasqal_literal_type
rasqal_literal_type_label, rasqal_literal_type_label ()
rasqal_literal_value, rasqal_literal_value ()
rasqal_new_0op_expression, rasqal_new_0op_expression ()
rasqal_new_1op_expression, rasqal_new_1op_expression ()
rasqal_new_2op_expression, rasqal_new_2op_expression ()
rasqal_new_3op_expression, rasqal_new_3op_expression ()
rasqal_new_4op_expression, rasqal_new_4op_expression ()
rasqal_new_aggregate_function_expression, rasqal_new_aggregate_function_expression ()
rasqal_new_boolean_literal, rasqal_new_boolean_literal ()
rasqal_new_cast_expression, rasqal_new_cast_expression ()
rasqal_new_data_graph_from_data_graph, rasqal_new_data_graph_from_data_graph ()
rasqal_new_data_graph_from_iostream, rasqal_new_data_graph_from_iostream ()
rasqal_new_data_graph_from_uri, rasqal_new_data_graph_from_uri ()
rasqal_new_datetime_literal_from_datetime, rasqal_new_datetime_literal_from_datetime ()
rasqal_new_decimal_literal, rasqal_new_decimal_literal ()
rasqal_new_decimal_literal_from_decimal, rasqal_new_decimal_literal_from_decimal ()
rasqal_new_double_literal, rasqal_new_double_literal ()
rasqal_new_evaluation_context, rasqal_new_evaluation_context ()
rasqal_new_expression_from_expression, rasqal_new_expression_from_expression ()
rasqal_new_expr_seq_expression, rasqal_new_expr_seq_expression ()
rasqal_new_floating_literal, rasqal_new_floating_literal ()
rasqal_new_float_literal, rasqal_new_float_literal ()
rasqal_new_function_expression, rasqal_new_function_expression ()
rasqal_new_group_concat_expression, rasqal_new_group_concat_expression ()
rasqal_new_integer_literal, rasqal_new_integer_literal ()
rasqal_new_literal_expression, rasqal_new_literal_expression ()
rasqal_new_literal_from_literal, rasqal_new_literal_from_literal ()
rasqal_new_numeric_literal_from_long, rasqal_new_numeric_literal_from_long ()
rasqal_new_pattern_literal, rasqal_new_pattern_literal ()
rasqal_new_prefix, rasqal_new_prefix ()
rasqal_new_query, rasqal_new_query ()
rasqal_new_query_results, rasqal_new_query_results ()
rasqal_new_query_results2, rasqal_new_query_results2 ()
rasqal_new_query_results_formatter, rasqal_new_query_results_formatter ()
rasqal_new_query_results_formatter_for_content, rasqal_new_query_results_formatter_for_content ()
rasqal_new_query_results_from_string, rasqal_new_query_results_from_string ()
rasqal_new_row_for_size, rasqal_new_row_for_size ()
rasqal_new_service, rasqal_new_service ()
rasqal_new_set_expression, rasqal_new_set_expression ()
rasqal_new_simple_literal, rasqal_new_simple_literal ()
rasqal_new_string_literal, rasqal_new_string_literal ()
rasqal_new_string_op_expression, rasqal_new_string_op_expression ()
rasqal_new_triple, rasqal_new_triple ()
rasqal_new_triple_from_triple, rasqal_new_triple_from_triple ()
rasqal_new_typed_literal, rasqal_new_typed_literal ()
rasqal_new_uri_literal, rasqal_new_uri_literal ()
rasqal_new_variables_table, rasqal_new_variables_table ()
rasqal_new_variable_from_variable, rasqal_new_variable_from_variable ()
rasqal_new_variable_literal, rasqal_new_variable_literal ()
rasqal_new_world, rasqal_new_world ()
rasqal_new_xsd_date, rasqal_new_xsd_date ()
rasqal_new_xsd_datetime, rasqal_new_xsd_datetime ()
rasqal_new_xsd_datetime_from_timeval, rasqal_new_xsd_datetime_from_timeval ()
rasqal_new_xsd_datetime_from_unixtime, rasqal_new_xsd_datetime_from_unixtime ()
rasqal_new_xsd_datetime_from_xsd_date, rasqal_new_xsd_datetime_from_xsd_date ()
rasqal_new_xsd_decimal, rasqal_new_xsd_decimal ()
rasqal_op, enum rasqal_op
rasqal_pattern_flags, enum rasqal_pattern_flags
rasqal_prefix, rasqal_prefix
rasqal_prefix_print, rasqal_prefix_print ()
rasqal_query, rasqal_query
rasqal_query_add_data_graph, rasqal_query_add_data_graph ()
rasqal_query_add_data_graphs, rasqal_query_add_data_graphs ()
rasqal_query_add_prefix, rasqal_query_add_prefix ()
rasqal_query_add_variable, rasqal_query_add_variable ()
rasqal_query_dataset_contains_named_graph, rasqal_query_dataset_contains_named_graph ()
rasqal_query_escape_counted_string, rasqal_query_escape_counted_string ()
rasqal_query_execute, rasqal_query_execute ()
rasqal_query_get_all_variable_sequence, rasqal_query_get_all_variable_sequence ()
rasqal_query_get_anonymous_variable_sequence, rasqal_query_get_anonymous_variable_sequence ()
rasqal_query_get_bindings_row, rasqal_query_get_bindings_row ()
rasqal_query_get_bindings_rows_sequence, rasqal_query_get_bindings_rows_sequence ()
rasqal_query_get_bindings_variable, rasqal_query_get_bindings_variable ()
rasqal_query_get_bindings_variables_sequence, rasqal_query_get_bindings_variables_sequence ()
rasqal_query_get_bound_variable_sequence, rasqal_query_get_bound_variable_sequence ()
rasqal_query_get_construct_triple, rasqal_query_get_construct_triple ()
rasqal_query_get_construct_triples_sequence, rasqal_query_get_construct_triples_sequence ()
rasqal_query_get_data_graph, rasqal_query_get_data_graph ()
rasqal_query_get_data_graph_sequence, rasqal_query_get_data_graph_sequence ()
rasqal_query_get_describe_sequence, rasqal_query_get_describe_sequence ()
rasqal_query_get_distinct, rasqal_query_get_distinct ()
rasqal_query_get_explain, rasqal_query_get_explain ()
rasqal_query_get_feature, rasqal_query_get_feature ()
rasqal_query_get_feature_string, rasqal_query_get_feature_string ()
rasqal_query_get_graph_pattern, rasqal_query_get_graph_pattern ()
rasqal_query_get_graph_pattern_sequence, rasqal_query_get_graph_pattern_sequence ()
rasqal_query_get_group_condition, rasqal_query_get_group_condition ()
rasqal_query_get_group_conditions_sequence, rasqal_query_get_group_conditions_sequence ()
rasqal_query_get_having_condition, rasqal_query_get_having_condition ()
rasqal_query_get_having_conditions_sequence, rasqal_query_get_having_conditions_sequence ()
rasqal_query_get_label, rasqal_query_get_label ()
rasqal_query_get_limit, rasqal_query_get_limit ()
rasqal_query_get_name, rasqal_query_get_name ()
rasqal_query_get_offset, rasqal_query_get_offset ()
rasqal_query_get_order_condition, rasqal_query_get_order_condition ()
rasqal_query_get_order_conditions_sequence, rasqal_query_get_order_conditions_sequence ()
rasqal_query_get_prefix, rasqal_query_get_prefix ()
rasqal_query_get_prefix_sequence, rasqal_query_get_prefix_sequence ()
rasqal_query_get_query_graph_pattern, rasqal_query_get_query_graph_pattern ()
rasqal_query_get_result_type, rasqal_query_get_result_type ()
rasqal_query_get_triple, rasqal_query_get_triple ()
rasqal_query_get_triple_sequence, rasqal_query_get_triple_sequence ()
rasqal_query_get_update_operation, rasqal_query_get_update_operation ()
rasqal_query_get_update_operations_sequence, rasqal_query_get_update_operations_sequence ()
rasqal_query_get_user_data, rasqal_query_get_user_data ()
rasqal_query_get_variable, rasqal_query_get_variable ()
rasqal_query_get_verb, rasqal_query_get_verb ()
rasqal_query_get_wildcard, rasqal_query_get_wildcard ()
rasqal_query_graph_pattern_visit, rasqal_query_graph_pattern_visit ()
rasqal_query_graph_pattern_visit2, rasqal_query_graph_pattern_visit2 ()
rasqal_query_has_variable, rasqal_query_has_variable ()
rasqal_query_has_variable2, rasqal_query_has_variable2 ()
rasqal_query_iostream_write_escaped_counted_string, rasqal_query_iostream_write_escaped_counted_string ()
rasqal_query_prepare, rasqal_query_prepare ()
rasqal_query_print, rasqal_query_print ()
rasqal_query_results, rasqal_query_results
rasqal_query_results_add_row, rasqal_query_results_add_row ()
rasqal_query_results_finished, rasqal_query_results_finished ()
rasqal_query_results_formats_check, rasqal_query_results_formats_check ()
rasqal_query_results_formats_check2, rasqal_query_results_formats_check2 ()
rasqal_query_results_formatter, rasqal_query_results_formatter
rasqal_query_results_formatter_read, rasqal_query_results_formatter_read ()
rasqal_query_results_formatter_write, rasqal_query_results_formatter_write ()
rasqal_query_results_format_flags, enum rasqal_query_results_format_flags
rasqal_query_results_get_bindings, rasqal_query_results_get_bindings ()
rasqal_query_results_get_bindings_count, rasqal_query_results_get_bindings_count ()
rasqal_query_results_get_binding_name, rasqal_query_results_get_binding_name ()
rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value ()
rasqal_query_results_get_binding_value_by_name, rasqal_query_results_get_binding_value_by_name ()
rasqal_query_results_get_boolean, rasqal_query_results_get_boolean ()
rasqal_query_results_get_count, rasqal_query_results_get_count ()
rasqal_query_results_get_query, rasqal_query_results_get_query ()
rasqal_query_results_get_row_by_offset, rasqal_query_results_get_row_by_offset ()
rasqal_query_results_get_triple, rasqal_query_results_get_triple ()
rasqal_query_results_get_type, rasqal_query_results_get_type ()
rasqal_query_results_is_bindings, rasqal_query_results_is_bindings ()
rasqal_query_results_is_boolean, rasqal_query_results_is_boolean ()
rasqal_query_results_is_graph, rasqal_query_results_is_graph ()
rasqal_query_results_is_syntax, rasqal_query_results_is_syntax ()
rasqal_query_results_next, rasqal_query_results_next ()
rasqal_query_results_next_triple, rasqal_query_results_next_triple ()
rasqal_query_results_read, rasqal_query_results_read ()
rasqal_query_results_rewind, rasqal_query_results_rewind ()
rasqal_query_results_type, enum rasqal_query_results_type
rasqal_query_results_type_label, rasqal_query_results_type_label ()
rasqal_query_results_write, rasqal_query_results_write ()
rasqal_query_set_distinct, rasqal_query_set_distinct ()
rasqal_query_set_explain, rasqal_query_set_explain ()
rasqal_query_set_feature, rasqal_query_set_feature ()
rasqal_query_set_feature_string, rasqal_query_set_feature_string ()
rasqal_query_set_limit, rasqal_query_set_limit ()
rasqal_query_set_offset, rasqal_query_set_offset ()
rasqal_query_set_store_results, rasqal_query_set_store_results ()
rasqal_query_set_user_data, rasqal_query_set_user_data ()
rasqal_query_set_variable, rasqal_query_set_variable ()
rasqal_query_set_variable2, rasqal_query_set_variable2 ()
rasqal_query_set_wildcard, rasqal_query_set_wildcard ()
rasqal_query_verb, enum rasqal_query_verb
rasqal_query_verb_as_string, rasqal_query_verb_as_string ()
rasqal_query_write, rasqal_query_write ()
RASQAL_RAPTOR_VERSION, RASQAL_RAPTOR_VERSION
rasqal_regex_replace, rasqal_regex_replace ()
rasqal_row, rasqal_row
rasqal_row_set_value_at, rasqal_row_set_value_at ()
rasqal_service, rasqal_service
rasqal_service_execute, rasqal_service_execute ()
rasqal_service_set_format, rasqal_service_set_format ()
rasqal_service_set_www, rasqal_service_set_www ()
rasqal_set_triples_source_factory, rasqal_set_triples_source_factory ()
rasqal_short_copyright_string, rasqal_short_copyright_string
rasqal_triple, rasqal_triple
rasqal_triples_error_handler, rasqal_triples_error_handler ()
rasqal_triples_error_handler2, rasqal_triples_error_handler2 ()
rasqal_triples_match, rasqal_triples_match
rasqal_triples_source, rasqal_triples_source
rasqal_triples_source_factory, rasqal_triples_source_factory
RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION, RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION
RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION, RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION
rasqal_triples_source_factory_register_fn, rasqal_triples_source_factory_register_fn ()
rasqal_triples_source_feature, enum rasqal_triples_source_feature
RASQAL_TRIPLES_SOURCE_MAX_VERSION, RASQAL_TRIPLES_SOURCE_MAX_VERSION
RASQAL_TRIPLES_SOURCE_MIN_VERSION, RASQAL_TRIPLES_SOURCE_MIN_VERSION
rasqal_triple_get_origin, rasqal_triple_get_origin ()
rasqal_triple_meta, rasqal_triple_meta
rasqal_triple_parts, enum rasqal_triple_parts
rasqal_triple_print, rasqal_triple_print ()
rasqal_triple_set_origin, rasqal_triple_set_origin ()
rasqal_update_flags, enum rasqal_update_flags
rasqal_update_graph_applies, enum rasqal_update_graph_applies
rasqal_update_operation, rasqal_update_operation
rasqal_update_type, enum rasqal_update_type
rasqal_variable, rasqal_variable
rasqal_variables_table, rasqal_variables_table
rasqal_variables_table_add, rasqal_variables_table_add ()
rasqal_variables_table_add2, rasqal_variables_table_add2 ()
rasqal_variables_table_add_variable, rasqal_variables_table_add_variable ()
rasqal_variables_table_contains, rasqal_variables_table_contains ()
rasqal_variables_table_get_by_name, rasqal_variables_table_get_by_name ()
rasqal_variable_print, rasqal_variable_print ()
rasqal_variable_set_value, rasqal_variable_set_value ()
rasqal_variable_type, enum rasqal_variable_type
RASQAL_VERSION, RASQAL_VERSION
rasqal_version_decimal, rasqal_version_decimal
rasqal_version_major, rasqal_version_major
RASQAL_VERSION_MAJOR, RASQAL_VERSION_MAJOR
rasqal_version_minor, rasqal_version_minor
RASQAL_VERSION_MINOR, RASQAL_VERSION_MINOR
rasqal_version_release, rasqal_version_release
RASQAL_VERSION_RELEASE, RASQAL_VERSION_RELEASE
rasqal_version_string, rasqal_version_string
RASQAL_VERSION_STRING, RASQAL_VERSION_STRING
rasqal_world, rasqal_world
rasqal_world_get_query_language_description, rasqal_world_get_query_language_description ()
rasqal_world_get_query_results_format_description, rasqal_world_get_query_results_format_description ()
rasqal_world_get_raptor, rasqal_world_get_raptor ()
rasqal_world_guess_query_results_format_name, rasqal_world_guess_query_results_format_name ()
rasqal_world_open, rasqal_world_open ()
rasqal_world_set_default_generate_bnodeid_parameters, rasqal_world_set_default_generate_bnodeid_parameters ()
rasqal_world_set_generate_bnodeid_handler, rasqal_world_set_generate_bnodeid_handler ()
rasqal_world_set_log_handler, rasqal_world_set_log_handler ()
rasqal_world_set_raptor, rasqal_world_set_raptor ()
rasqal_world_set_warning_level, rasqal_world_set_warning_level ()
rasqal_xsd_date, rasqal_xsd_date
rasqal_xsd_datetime, rasqal_xsd_datetime
rasqal_xsd_datetime_compare, rasqal_xsd_datetime_compare ()
rasqal_xsd_datetime_compare2, rasqal_xsd_datetime_compare2 ()
rasqal_xsd_datetime_equals, rasqal_xsd_datetime_equals ()
rasqal_xsd_datetime_equals2, rasqal_xsd_datetime_equals2 ()
rasqal_xsd_datetime_get_as_timeval, rasqal_xsd_datetime_get_as_timeval ()
rasqal_xsd_datetime_get_as_unixtime, rasqal_xsd_datetime_get_as_unixtime ()
rasqal_xsd_datetime_get_seconds_as_decimal, rasqal_xsd_datetime_get_seconds_as_decimal ()
rasqal_xsd_datetime_get_timezone_as_counted_string, rasqal_xsd_datetime_get_timezone_as_counted_string ()
rasqal_xsd_datetime_get_tz_as_counted_string, rasqal_xsd_datetime_get_tz_as_counted_string ()
RASQAL_XSD_DATETIME_NO_TZ, RASQAL_XSD_DATETIME_NO_TZ
rasqal_xsd_datetime_set_from_timeval, rasqal_xsd_datetime_set_from_timeval ()
rasqal_xsd_datetime_set_from_unixtime, rasqal_xsd_datetime_set_from_unixtime ()
rasqal_xsd_datetime_to_counted_string, rasqal_xsd_datetime_to_counted_string ()
rasqal_xsd_datetime_to_string, rasqal_xsd_datetime_to_string ()
rasqal_xsd_date_compare, rasqal_xsd_date_compare ()
rasqal_xsd_date_equals, rasqal_xsd_date_equals ()
rasqal_xsd_date_to_counted_string, rasqal_xsd_date_to_counted_string ()
rasqal_xsd_date_to_string, rasqal_xsd_date_to_string ()
rasqal_xsd_decimal, rasqal_xsd_decimal
rasqal_xsd_decimal_abs, rasqal_xsd_decimal_abs ()
rasqal_xsd_decimal_add, rasqal_xsd_decimal_add ()
rasqal_xsd_decimal_as_counted_string, rasqal_xsd_decimal_as_counted_string ()
rasqal_xsd_decimal_as_string, rasqal_xsd_decimal_as_string ()
rasqal_xsd_decimal_ceil, rasqal_xsd_decimal_ceil ()
rasqal_xsd_decimal_compare, rasqal_xsd_decimal_compare ()
rasqal_xsd_decimal_divide, rasqal_xsd_decimal_divide ()
rasqal_xsd_decimal_equals, rasqal_xsd_decimal_equals ()
rasqal_xsd_decimal_floor, rasqal_xsd_decimal_floor ()
rasqal_xsd_decimal_get_double, rasqal_xsd_decimal_get_double ()
rasqal_xsd_decimal_get_long, rasqal_xsd_decimal_get_long ()
rasqal_xsd_decimal_is_zero, rasqal_xsd_decimal_is_zero ()
rasqal_xsd_decimal_multiply, rasqal_xsd_decimal_multiply ()
rasqal_xsd_decimal_negate, rasqal_xsd_decimal_negate ()
rasqal_xsd_decimal_print, rasqal_xsd_decimal_print ()
rasqal_xsd_decimal_round, rasqal_xsd_decimal_round ()
rasqal_xsd_decimal_set_double, rasqal_xsd_decimal_set_double ()
rasqal_xsd_decimal_set_long, rasqal_xsd_decimal_set_long ()
rasqal_xsd_decimal_set_string, rasqal_xsd_decimal_set_string ()
rasqal_xsd_decimal_subtract, rasqal_xsd_decimal_subtract ()
rasqal-0.9.33/docs/html/rasqal-changes-0-9-21-to-0-9-22.html0000644000175000017500000006600612443715253017372 00000000000000 Changes between Rasqal 0.9.21 and 0.9.22

Changes between Rasqal 0.9.21 and 0.9.22

New functions, types and enums

Functions

Enums

Deleted functions, types and enums

Functions

Renamed function and enums

0.9.21 function 0.9.22 function Notes
rasqal_new_function_expression2 rasqal_new_function_expression  
rasqal_query_add_data_graph2 rasqal_query_add_data_graph  
rasqal_query_results_read2 rasqal_query_results_read  
rasqal_query_results_write2 rasqal_query_results_write  

Changed functions and types

0.9.21 function 0.9.22 function Notes
int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler2 handler) int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler)  
int rasqal_query_results_formats_enumerate(rasqal_world* world, unsigned int counter, const char **name, const char **label, const unsigned char **uri_string, const char **mime_type, int* flags) const raptor_syntax_description* rasqal_world_get_query_results_format_description(rasqal_world* world, unsigned int counter)  
void rasqal_query_set_default_generate_bnodeid_parameters(rasqal_query* rdf_query, char *prefix, int base) int rasqal_world_set_default_generate_bnodeid_parameters(rasqal_world* world, char *prefix, int base)  
void rasqal_query_set_generate_bnodeid_handler(rasqal_query* query, void *user_data, rasqal_generate_bnodeid_handler handler) int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler)  
int rasqal_query_add_data_graph(rasqal_query* query, raptor_uri* uri, raptor_uri* name_uri, int flags) int rasqal_query_add_data_graph(rasqal_query* query, rasqal_data_graph* data_graph)  
int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri) int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri)  
int rasqal_query_results_read(raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri) int rasqal_query_results_read(raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri)  
int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type)  
int rasqal_query_results_formats_check2(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type)  
rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, raptor_uri* format_uri)  
rasqal_query_results_formatter* rasqal_new_query_results_formatter2(rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, raptor_uri* format_uri)  
rasqal_query_results_formatter* rasqal_new_query_results_formatter_by_mime_type(rasqal_world* world, const char *mime_type) rasqal_query_results_formatter* rasqal_new_query_results_formatter_for_content(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier)  
rasqal_data_graph* rasqal_new_data_graph(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags) rasqal_data_graph* rasqal_new_data_graph_from_uri(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags, const char* format_type, const char* format_name, raptor_uri* format_uri)  
rasqal_expression* rasqal_new_function_expression(rasqal_world* world, raptor_uri* name, raptor_sequence* args) rasqal_expression* rasqal_new_function_expression(rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags)  
rasqal_expression* rasqal_new_coalesce_expression(rasqal_world* world, raptor_sequence* args) rasqal_expression* rasqal_new_expr_seq_expression(rasqal_world* world, rasqal_op op, raptor_sequence* args) Call it with op RASQAL_EXPR_COALESCE
0.9.21 type 0.9.22 type Notes
rasqal_data_graph rasqal_data_graph Added const for format_type and format_name fields.
rasqal_generate_bnodeid_handler2 rasqal_generate_bnodeid_handler Handler now takes a pointer to the rasqal_world object not rasqal_query.
rasqal_literal rasqal_literal Added datetime to value union.
rasqal-0.9.33/docs/html/index.sgml0000644000175000017500000021005012443715253013705 00000000000000 rasqal-0.9.33/docs/html/rasqal-changes-0-9-30-to-0-9-31.html0000644000175000017500000000460012443715253017362 00000000000000 Changes between Rasqal 0.9.30 and 0.9.31

Changes between Rasqal 0.9.30 and 0.9.31

New functions, types and enums

Functions

rasqal-0.9.33/docs/html/rasqal-section-utilities.html0000644000175000017500000001615112443715253017544 00000000000000 Utilities

Utilities

Utilities — Utility functions.

Synopsis

char *              rasqal_regex_replace                (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         const char *pattern,
                                                         const char *regex_flags,
                                                         const char *subject,
                                                         size_t subject_len,
                                                         const char *replace,
                                                         size_t replace_len,
                                                         size_t *result_len_p);

Description

Miscellaneous utility functions.

Details

rasqal_regex_replace ()

char *              rasqal_regex_replace                (rasqal_world *world,
                                                         raptor_locator *locator,
                                                         const char *pattern,
                                                         const char *regex_flags,
                                                         const char *subject,
                                                         size_t subject_len,
                                                         const char *replace,
                                                         size_t replace_len,
                                                         size_t *result_len_p);

Replace all copies of matches to a pattern with a replacement with subsitution

Intended to be used for SPARQL 1.1 REPLACE() implementation.

world :

world

locator :

locator

pattern :

regex pattern

regex_flags :

regex flags string

subject :

input string

subject_len :

input string length

replace :

replacement string

replace_len :

Length of replacement string

result_len_p :

pointer to store result length (output)

Returns :

result string or NULL on failure
rasqal-0.9.33/docs/html/rasqal.html0000644000175000017500000000350612443715253014071 00000000000000 Rasqal Overview

Rasqal Overview

Rasqal is an RDF query library providing APIs to parse query syntaxes (SPARQL and RDQL), build and manipulate the query structures, form query algebras and execution plans and execute the queries into query result sets.

rasqal-0.9.33/docs/html/rasqal-section-triple.html0000644000175000017500000004414312443715253017032 00000000000000 Triples

Triples

Triples — Triple pattern or RDF triple.

Description

An object for a triple pattern or an RDF triple in a query. It contains the three parts of an RDF triple - subject, predicate, object as well as origin for matching triples in some graph (such as with the SPARQL GRAPH).

Details

rasqal_triple

typedef struct {
  rasqal_literal* subject;
  rasqal_literal* predicate;
  rasqal_literal* object;
  rasqal_literal* origin;
  unsigned int flags;
} rasqal_triple;

A triple pattern or RDF triple.

This is used as a triple pattern in queries and an RDF triple when generating RDF triples such as with SPARQL CONSTRUCT.

rasqal_literal *subject;

Triple subject.

rasqal_literal *predicate;

Triple predicate.

rasqal_literal *object;

Triple object.

rasqal_literal *origin;

Triple origin.

unsigned int flags;

Or of enum rasqal_triple_flags bits.

rasqal_new_triple ()

rasqal_triple *     rasqal_new_triple                   (rasqal_literal *subject,
                                                         rasqal_literal *predicate,
                                                         rasqal_literal *object);

Constructor - create a new rasqal_triple triple or triple pattern. Takes ownership of the literals passed in.

The triple origin can be set with rasqal_triple_set_origin().

subject :

Triple subject.

predicate :

Triple predicate.

object :

Triple object.

Returns :

a new rasqal_triple or NULL on failure.

rasqal_new_triple_from_triple ()

rasqal_triple *     rasqal_new_triple_from_triple       (rasqal_triple *t);

Copy constructor - create a new rasqal_triple from an existing one.

t :

Triple to copy.

Returns :

a new rasqal_triple or NULL on failure.

rasqal_free_triple ()

void                rasqal_free_triple                  (rasqal_triple *t);

Destructor - destroy a rasqal_triple object.

t :

rasqal_triple object.

rasqal_triple_get_origin ()

rasqal_literal *    rasqal_triple_get_origin            (rasqal_triple *t);

Get the origin field of a rasqal_triple.

t :

The triple object.

Returns :

The triple origin or NULL.

enum rasqal_triple_parts

typedef enum {
  RASQAL_TRIPLE_NONE     = 0,
  RASQAL_TRIPLE_SUBJECT  = 1,
  RASQAL_TRIPLE_PREDICATE= 2,
  RASQAL_TRIPLE_OBJECT   = 4,
  RASQAL_TRIPLE_ORIGIN   = 8,
  RASQAL_TRIPLE_GRAPH    = RASQAL_TRIPLE_ORIGIN,
  RASQAL_TRIPLE_SPO      = RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT,
  RASQAL_TRIPLE_SPOG     = RASQAL_TRIPLE_SPO | RASQAL_TRIPLE_GRAPH
} rasqal_triple_parts;

Flags for parts of a triple.

RASQAL_TRIPLE_NONE

no parts

RASQAL_TRIPLE_SUBJECT

Subject present in a triple.

RASQAL_TRIPLE_PREDICATE

Predicate present in a triple.

RASQAL_TRIPLE_OBJECT

Object present in a triple.

RASQAL_TRIPLE_ORIGIN

Origin/graph present in a triple.

RASQAL_TRIPLE_GRAPH

Alias for RASQAL_TRIPLE_ORIGIN

RASQAL_TRIPLE_SPO

Subject, Predicate and Object present in a triple.

RASQAL_TRIPLE_SPOG

Subject, Predicate, Object, Graph present in a triple.

rasqal_triple_print ()

int                 rasqal_triple_print                 (rasqal_triple *t,
                                                         FILE *fh);

Print a Rasqal triple in a debug format.

The print debug format may change in any release.

t :

rasqal_triple object.

fh :

The FILE* handle to print to.

Returns :

non-0 on failure

rasqal_triple_set_origin ()

void                rasqal_triple_set_origin            (rasqal_triple *t,
                                                         rasqal_literal *l);

Set the origin field of a rasqal_triple.

t :

The triple object.

l :

The rasqal_literal object to set as origin.
rasqal-0.9.33/docs/html/rasqal-changes-0-9-24-to-0-9-25.html0000644000175000017500000001602712443715253017376 00000000000000 Changes between Rasqal 0.9.24 and 0.9.25

Changes between Rasqal 0.9.24 and 0.9.25

New functions, types and enums

Functions

Types

Enums

rasqal-0.9.33/docs/html/rasqal-section-data.html0000644000175000017500000006017312443715253016445 00000000000000 Data Graphs

Data Graphs

Data Graphs — RDF graph sources for triples.

Synopsis

                    rasqal_data_graph;
rasqal_data_graph * rasqal_new_data_graph_from_data_graph
                                                        (rasqal_data_graph *dg);
rasqal_data_graph * rasqal_new_data_graph_from_iostream (rasqal_world *world,
                                                         raptor_iostream *iostr,
                                                         raptor_uri *base_uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);
rasqal_data_graph * rasqal_new_data_graph_from_uri      (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);
void                rasqal_free_data_graph              (rasqal_data_graph *dg);
enum                rasqal_data_graph_flags;
int                 rasqal_data_graph_print             (rasqal_data_graph *dg,
                                                         FILE *fh);

Description

Data graphs are used in the query to describe RDF graphs that can be used to query against. The graphs can be used either with raptor_uri to name the graph, or without a name. The query language determines which graphs are used in the query.

Details

rasqal_data_graph

typedef struct {
  rasqal_world* world;
  raptor_uri* uri;
  raptor_uri* name_uri;
  unsigned int flags;
  char* format_type;
  char* format_name;
  raptor_uri* format_uri;
  raptor_iostream* iostr;
  raptor_uri* base_uri;
  int usage;
} rasqal_data_graph;

A source of RDF data for querying.

If iostr is present, the graph can be constructed by parsing the iostream and using base_uri as a base uri. Otherwise the graph can be constructed from the graph at URI uri.

In either case the name_uri is the graph name as long as flags is RASQAL_DATA_GRAPH_NAMED

rasqal_world *world;

rasqal_world object

raptor_uri *uri;

source URI

raptor_uri *name_uri;

name of graph for RASQAL_DATA_GRAPH_NAMED

unsigned int flags;

RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

char *format_type;

MIME Type of data format at uri (or NULL)

char *format_name;

Raptor parser Name of data format at uri (or NULL)

raptor_uri *format_uri;

URI of data format at uri (or NULL)

raptor_iostream *iostr;

Raptor iostream for content, overriding uri if present (or NULL)

raptor_uri *base_uri;

base URI for reading from iostream

int usage;

usage count of this object

rasqal_new_data_graph_from_data_graph ()

rasqal_data_graph * rasqal_new_data_graph_from_data_graph
                                                        (rasqal_data_graph *dg);

Copy Constructor - create a new rasqal_data_graph object from an existing rasqal_data_graph object.

dg :

rasqal_data_graph object to copy or NULL

Returns :

a new rasqal_data_graph object or NULL if dg was NULL.

rasqal_new_data_graph_from_iostream ()

rasqal_data_graph * rasqal_new_data_graph_from_iostream (rasqal_world *world,
                                                         raptor_iostream *iostr,
                                                         raptor_uri *base_uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);

Constructor - create a new rasqal_data_graph from iostream content

The name_uri is used when the flags are RASQAL_DATA_GRAPH_NAMED.

The base_uri is used to provide the Raptor parser a base URI. If a base URI is required but none is given, the parsing will fail and the query that uses this data source will fail.

world :

rasqal_world object

iostr :

source graph format iostream

base_uri :

base URI for iostream content

name_uri :

name of graph (or NULL)

flags :

RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

format_type :

MIME Type of data format at uri (or NULL)

format_name :

Raptor parser Name of data format at uri (or NULL)

format_uri :

URI of data format at uri (or NULL)

Returns :

a new rasqal_data_graph or NULL on failure.

rasqal_new_data_graph_from_uri ()

rasqal_data_graph * rasqal_new_data_graph_from_uri      (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);

Constructor - create a new rasqal_data_graph.

The name_uri is only used when the flags are RASQAL_DATA_GRAPH_NAMED.

world :

rasqal_world object

uri :

source URI

name_uri :

name of graph (or NULL)

flags :

RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

format_type :

MIME Type of data format at uri (or NULL)

format_name :

Raptor parser Name of data format at uri (or NULL)

format_uri :

URI of data format at uri (or NULL)

Returns :

a new rasqal_data_graph or NULL on failure.

rasqal_free_data_graph ()

void                rasqal_free_data_graph              (rasqal_data_graph *dg);

Destructor - destroy a rasqal_data_graph object.

dg :

rasqal_data_graph object

enum rasqal_data_graph_flags

typedef enum {
  RASQAL_DATA_GRAPH_NONE  = 0,
  RASQAL_DATA_GRAPH_NAMED = 1,
  RASQAL_DATA_GRAPH_BACKGROUND = 2
} rasqal_data_graph_flags;

Flags for the type of rasqal_data_graph.

These are used by rasqal_new_data_graph_from_uri() and rasqal_new_data_graph_from_iostream(). See rasqal_data_graph.

RASQAL_DATA_GRAPH_NONE

Internal.

RASQAL_DATA_GRAPH_NAMED

Graphs with a source and name.

RASQAL_DATA_GRAPH_BACKGROUND

Graphs with a source only.

rasqal_data_graph_print ()

int                 rasqal_data_graph_print             (rasqal_data_graph *dg,
                                                         FILE *fh);

Print a Rasqal data graph in a debug format.

The print debug format may change in any release.

dg :

rasqal_data_graph object

fh :

the FILE* handle to print to

Returns :

non-0 on failure
rasqal-0.9.33/docs/html/rasqal-changes-0-9-26-to-0-9-27.html0000644000175000017500000001067412443715253017404 00000000000000 Changes between Rasqal 0.9.26 and 0.9.27

Changes between Rasqal 0.9.26 and 0.9.27

New functions, types and enums

Functions

rasqal-0.9.33/docs/html/left.png0000644000175000017500000000071312443715253013355 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME1&[(XIDATx!OPE*ID%~ꊯ"p'ŏ`sܖrKf hmiIz}ܯI.p\`x l?l[,Hk<#c%\AUx[S7n6rzEs1j@NL$ݤi0 5/}\EKIo͓$a0jdFbkIAh>WlC'?tk;|/t*INZ^`y4Nr]׮ J<ڐt`X1@p䀸dZ')hK $V?%]+LsgUK"w53OIENDB`rasqal-0.9.33/docs/html/rasqal-section-service.html0000644000175000017500000003117412443715253017173 00000000000000 Service

Service

Service — Execute queries remotely via a SPARQL HTTP Protocol service.

Synopsis

typedef             rasqal_service;
rasqal_service *    rasqal_new_service                  (rasqal_world *world,
                                                         raptor_uri *service_uri,
                                                         const unsigned char *query_string,
                                                         raptor_sequence *data_graphs);
void                rasqal_free_service                 (rasqal_service *svc);
rasqal_query_results * rasqal_service_execute           (rasqal_service *svc);
int                 rasqal_service_set_format           (rasqal_service *svc,
                                                         const char *format);
int                 rasqal_service_set_www              (rasqal_service *svc,
                                                         raptor_www *www);

Description

The SPARQL Protocol defines an HTTP binding that enables remote queries to be executed over specified default and named graphs. This class allows that to be constructed and executed, returning a Rasqal query results rasqal_query_results that may be used, for example, with a formatter to generate output.

Details

rasqal_service

typedef struct rasqal_service_s rasqal_service;

Rasqal SPARQL Protocol Service


rasqal_new_service ()

rasqal_service *    rasqal_new_service                  (rasqal_world *world,
                                                         raptor_uri *service_uri,
                                                         const unsigned char *query_string,
                                                         raptor_sequence *data_graphs);

Constructor - create a new rasqal protocol service object.

Create a structure to execute a sparql protocol service at service_uri running the query query_string and returning a sparql result set.

All arguments are copied by the service object

world :

rasqal_world object

service_uri :

sparql protocol service URI

query_string :

query string (or NULL)

data_graphs :

sequence of rasqal_data_graph graphs for service

Returns :

a new rasqal_query object or NULL on failure

rasqal_free_service ()

void                rasqal_free_service                 (rasqal_service *svc);

Destructor - destroy a rasqal_service object.

svc :

rasqal_service object

rasqal_service_execute ()

rasqal_query_results * rasqal_service_execute           (rasqal_service *svc);

Execute a rasqal sparql protocol service

svc :

rasqal service

Returns :

query results or NULL on failure

rasqal_service_set_format ()

int                 rasqal_service_set_format           (rasqal_service *svc,
                                                         const char *format);

Set the MIME Type to use in HTTP Accept when executing the service

svc :

rasqal_service service object

format :

service mime type (or NULL)

Returns :

non 0 on failure

rasqal_service_set_www ()

int                 rasqal_service_set_www              (rasqal_service *svc,
                                                         raptor_www *www);

Set the WWW object to use when executing the service

svc :

rasqal_service service object

www :

WWW object (or NULL)

Returns :

non 0 on failure
rasqal-0.9.33/docs/html/up.png0000644000175000017500000000062612443715253013052 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME2.E#IDATx=J@Fo] !+2[Z<@/9|t$D9nnBjBRIsI:H8UPN1fcsN95M㧖ɵ 束1~pEe$I 7nrDf!;`'ykI䲤sI_]y^^I>O>?YBIENDB`rasqal-0.9.33/docs/html/rasqal-section-prefix.html0000644000175000017500000002377212443715253017035 00000000000000 Prefixes

Prefixes

Prefixes — XML QName-style prefixes made from a URI and a short text prefix.

Synopsis

                    rasqal_prefix;
rasqal_prefix *     rasqal_new_prefix                   (rasqal_world *world,
                                                         const unsigned char *prefix,
                                                         raptor_uri *uri);
void                rasqal_free_prefix                  (rasqal_prefix *p);
int                 rasqal_prefix_print                 (rasqal_prefix *p,
                                                         FILE *fh);

Description

Used inside a rasqal_query to declare syntax prefix abbreviations for URIs. Once a rasqal_query is constructed, these are for information only.

Details

rasqal_prefix

typedef struct {
  rasqal_world* world;
  const char * prefix;
  raptor_uri* uri;
  int declared;
  int depth;
} rasqal_prefix;

Namespace (prefix, uri) pair.

Includes internal flags used for marking when prefixes are declared and at what XML element depth when used in XML formats.

rasqal_world *world;

rasqal_world object

const char *prefix;

short prefix string

raptor_uri *uri;

URI associated with the prefix.

int declared;

Internal flag.

int depth;

Internal flag.

rasqal_new_prefix ()

rasqal_prefix *     rasqal_new_prefix                   (rasqal_world *world,
                                                         const unsigned char *prefix,
                                                         raptor_uri *uri);

Constructor - create a new rasqal_prefix. Takes ownership of prefix and uri.

world :

rasqal_world object

prefix :

Short prefix string to stand for URI (or NULL)

uri :

Name raptor_uri.

Returns :

a new rasqal_prefix or NULL on failure.

rasqal_free_prefix ()

void                rasqal_free_prefix                  (rasqal_prefix *p);

Destructor - destroy a rasqal_prefix object.

p :

rasqal_prefix object.

rasqal_prefix_print ()

int                 rasqal_prefix_print                 (rasqal_prefix *p,
                                                         FILE *fh);

Print a Rasqal prefix in a debug format.

The print debug format may change in any release.

p :

rasqal_prefix object.

fh :

The FILE* handle to print to.

Returns :

non-0 on failure
rasqal-0.9.33/docs/tmpl/0000755000175000017500000000000012443715253012004 500000000000000rasqal-0.9.33/docs/tmpl/section-query_results.sgml0000644000175000017500000001047612443715253017210 00000000000000 Query Results Query results as variable bindings, boolean or RDF graphs. A query results object is only ever constructed by the internal query engine evaluating a #rasqal_query with rasqal_query_execute(). It provides interface to the multiple types of result supported. There are a large set of methods for returning all or parts of a variable binding query result including the names, values or individuals. A boolean result is straightforward to get with rasqal_query_results_get_boolean() and an RDF graph returns a sequence of raptor triples than can be easily passed to the Raptor library for serializing to a syntax. @world: @query: @type: @vars_table: @Returns: @world: @query: @type: @Returns: @world: @type: @base_uri: @string: @string_len: @Returns: @query_results: @query_results: @row: @Returns: @query_results: @Returns: @query_results: @offset: @Returns: @query_results: @offset: @Returns: @query_results: @name: @Returns: @query_results: @names: @values: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @result_offset: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @query_results: @Returns: @iostr: @results: @name: @mime_type: @format_uri: @base_uri: @Returns: @iostr: @results: @name: @mime_type: @format_uri: @base_uri: @Returns: @RASQAL_QUERY_RESULTS_BINDINGS: @RASQAL_QUERY_RESULTS_BOOLEAN: @RASQAL_QUERY_RESULTS_GRAPH: @RASQAL_QUERY_RESULTS_SYNTAX: @RASQAL_QUERY_RESULTS_UNKNOWN: @RASQAL_QUERY_RESULTS_LAST: @type: @Returns: @query_results: @Returns: rasqal-0.9.33/docs/tmpl/section-xsd.sgml0000644000175000017500000001326012443715253015052 00000000000000 XML Schema Datetime and Decimals XML Schema datetime and arbitrary length decimal number arithmetic. Classes for providing XSD datatypes for Datetimes plus Decimals with arbitrary length floating point decimals and standard operators on the Decimals suitable for SPARQL. @year: @month: @day: @timezone_minutes: @time_on_timeline: @have_tz: @world: @date_string: @Returns: @d: @date: @len_p: @Returns: @d: @Returns: @d1: @d2: @incomparible_p: @Returns: @d1: @d2: @incomparible_p: @Returns: @year: @month: @day: @hour: @minute: @second: @microseconds: @timezone_minutes: @time_on_timeline: @have_tz: @world: @datetime_string: @Returns: @world: @tv: @Returns: @world: @secs: @Returns: @world: @date: @Returns: @dt: @dt1: @dt2: @Returns: @dt1: @dt2: @incomparible_p: @Returns: @dt1: @dt2: @Returns: @dt1: @dt2: @incomparible_p: @Returns: @dt: @Returns: @dt: @Returns: @world: @dt: @Returns: @dt: @len_p: @Returns: @dt: @len_p: @Returns: @dt: @tv: @Returns: @dt: @clock: @Returns: @dt: @len_p: @Returns: @dt: @Returns: @dec: @world: @Returns: @result: @a: @Returns: @result: @a: @b: @Returns: @dec: @len_p: @Returns: @dec: @Returns: @result: @a: @Returns: @a: @b: @Returns: @result: @a: @b: @Returns: @a: @b: @Returns: @result: @a: @Returns: @dec: @Returns: @dec: @error_p: @Returns: @d: @Returns: @result: @a: @b: @Returns: @result: @a: @Returns: @dec: @stream: @Returns: @result: @a: @Returns: @dec: @d: @Returns: @dec: @Param2: @Returns: @dec: @string: @Returns: @result: @a: @b: @Returns: rasqal-0.9.33/docs/tmpl/section-triples_source.sgml0000644000175000017500000000427512443715253017324 00000000000000 Triples Source Source of matches to a triple pattern. A factory that provides the raw triple matches for a triple pattern against some RDF graph. The #rasqal_triples_source_factory must create use a new #rasqal_triples_source that can be used to initialise and build a #rasqal_triples_match for some #rasqal_triple (subject, predicate, object, origin URI). @bindings: @triples_match: @context: @parts: @is_exact: @executed: @user_data: @bind_match: @next_match: @is_end: @finish: @world: @query: @user_data: @init_triples_match: @triple_present: @free_triples_source: @version: @user_data: @user_data_size: @new_triples_source: @init_triples_source: @init_triples_source2: @factory: @Returns: @RASQAL_TRIPLES_SOURCE_FEATURE_NONE: @RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH: @query: @locator: @message: @world: @locator: @message: @world: @register_fn: @user_data: @Returns: rasqal-0.9.33/docs/tmpl/section-query_results_formatter.sgml0000644000175000017500000000362112443715253021265 00000000000000 Query Results Formatter Query results formatted into a syntax. Variable bindings and boolean query results can be formatted into different syntaxes such as SPARQL Query Results Format or JSON. The rasqal_query_results_formatter class allows choosing a formatter for a particular syntax and writing the syntax to a raptor_iostream which allows turning the syntax into a string, writing to a file handle or other custom destination. @RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER: @RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER: @world: @name: @uri: @mime_type: @flags: @Returns: @world: @name: @uri: @mime_type: @flags: @Returns: @world: @name: @mime_type: @format_uri: @Returns: @world: @uri: @mime_type: @buffer: @len: @identifier: @Returns: @formatter: @world: @iostr: @formatter: @results: @base_uri: @Returns: @iostr: @formatter: @results: @base_uri: @Returns: rasqal-0.9.33/docs/tmpl/section-variables-table.sgml0000644000175000017500000000272512443715253017315 00000000000000 Variables Table A table of variables with optional bound literal values. A table of #rasqal_variable usually associated with a #rasqal_query query or #rasqal_query_results query result set. The order of the variables in the table may be significant, such as for a standalone query result set in which case it might define the order of variables in resulting rows. @world: @Returns: @vt: @vt: @type: @name: @value: @Returns: @vt: @type: @name: @name_len: @value: @Returns: @vt: @variable: @Returns: @vt: @type: @name: @Returns: @vt: @type: @name: @Returns: rasqal-0.9.33/docs/tmpl/section-expression.sgml0000644000175000017500000001441312443715253016454 00000000000000 Expressions Query language expressions. Expressions form an expression tree that can be evaluated using rasqal_expression_evaluate() over #rasqal_op operators, #rasqal_literal constants and #rasqal_variable values bound in some #rasqal_query_result. The result is a #rasqal_literal value. @RASQAL_EXPR_FLAG_DISTINCT: @RASQAL_EXPR_FLAG_AGGREGATE: @world: @base_uri: @locator: @flags: @seed: @random: @RASQAL_EXPR_UNKNOWN: @RASQAL_EXPR_AND: @RASQAL_EXPR_OR: @RASQAL_EXPR_EQ: @RASQAL_EXPR_NEQ: @RASQAL_EXPR_LT: @RASQAL_EXPR_GT: @RASQAL_EXPR_LE: @RASQAL_EXPR_GE: @RASQAL_EXPR_UMINUS: @RASQAL_EXPR_PLUS: @RASQAL_EXPR_MINUS: @RASQAL_EXPR_STAR: @RASQAL_EXPR_SLASH: @RASQAL_EXPR_REM: @RASQAL_EXPR_STR_EQ: @RASQAL_EXPR_STR_NEQ: @RASQAL_EXPR_STR_MATCH: @RASQAL_EXPR_STR_NMATCH: @RASQAL_EXPR_TILDE: @RASQAL_EXPR_BANG: @RASQAL_EXPR_LITERAL: @RASQAL_EXPR_FUNCTION: @RASQAL_EXPR_BOUND: @RASQAL_EXPR_STR: @RASQAL_EXPR_LANG: @RASQAL_EXPR_DATATYPE: @RASQAL_EXPR_ISURI: @RASQAL_EXPR_ISBLANK: @RASQAL_EXPR_ISLITERAL: @RASQAL_EXPR_CAST: @RASQAL_EXPR_ORDER_COND_ASC: @RASQAL_EXPR_ORDER_COND_DESC: @RASQAL_EXPR_LANGMATCHES: @RASQAL_EXPR_REGEX: @RASQAL_EXPR_GROUP_COND_ASC: @RASQAL_EXPR_GROUP_COND_DESC: @RASQAL_EXPR_COUNT: @RASQAL_EXPR_VARSTAR: @RASQAL_EXPR_SAMETERM: @RASQAL_EXPR_SUM: @RASQAL_EXPR_AVG: @RASQAL_EXPR_MIN: @RASQAL_EXPR_MAX: @RASQAL_EXPR_COALESCE: @RASQAL_EXPR_IF: @RASQAL_EXPR_URI: @RASQAL_EXPR_IRI: @RASQAL_EXPR_STRLANG: @RASQAL_EXPR_STRDT: @RASQAL_EXPR_BNODE: @RASQAL_EXPR_GROUP_CONCAT: @RASQAL_EXPR_SAMPLE: @RASQAL_EXPR_IN: @RASQAL_EXPR_NOT_IN: @RASQAL_EXPR_ISNUMERIC: @RASQAL_EXPR_YEAR: @RASQAL_EXPR_MONTH: @RASQAL_EXPR_DAY: @RASQAL_EXPR_HOURS: @RASQAL_EXPR_MINUTES: @RASQAL_EXPR_SECONDS: @RASQAL_EXPR_TIMEZONE: @RASQAL_EXPR_CURRENT_DATETIME: @RASQAL_EXPR_NOW: @RASQAL_EXPR_FROM_UNIXTIME: @RASQAL_EXPR_TO_UNIXTIME: @RASQAL_EXPR_CONCAT: @RASQAL_EXPR_STRLEN: @RASQAL_EXPR_SUBSTR: @RASQAL_EXPR_UCASE: @RASQAL_EXPR_LCASE: @RASQAL_EXPR_STRSTARTS: @RASQAL_EXPR_STRENDS: @RASQAL_EXPR_CONTAINS: @RASQAL_EXPR_ENCODE_FOR_URI: @RASQAL_EXPR_TZ: @RASQAL_EXPR_RAND: @RASQAL_EXPR_ABS: @RASQAL_EXPR_ROUND: @RASQAL_EXPR_CEIL: @RASQAL_EXPR_FLOOR: @RASQAL_EXPR_MD5: @RASQAL_EXPR_SHA1: @RASQAL_EXPR_SHA224: @RASQAL_EXPR_SHA256: @RASQAL_EXPR_SHA384: @RASQAL_EXPR_SHA512: @RASQAL_EXPR_STRBEFORE: @RASQAL_EXPR_STRAFTER: @RASQAL_EXPR_REPLACE: @RASQAL_EXPR_UUID: @RASQAL_EXPR_STRUUID: @RASQAL_EXPR_LAST: @RASQAL_COMPARE_NOCASE: @RASQAL_COMPARE_XQUERY: @RASQAL_COMPARE_RDF: @RASQAL_COMPARE_URI: @RASQAL_COMPARE_SAMETERM: @RASQAL_PATTERN_FLAGS_OPTIONAL: @RASQAL_PATTERN_FLAGS_LAST: @world: @op: @Returns: @world: @op: @arg: @Returns: @world: @op: @arg1: @arg2: @Returns: @world: @op: @arg1: @arg2: @arg3: @Returns: @world: @op: @arg1: @arg2: @arg3: @arg4: @Returns: @world: @op: @arg1: @params: @flags: @Returns: @world: @name: @value: @Returns: @world: @name: @args: @params: @flags: @Returns: @world: @flags: @args: @separator: @Returns: @world: @literal: @Returns: @world: @op: @arg1: @args: @Returns: @world: @op: @arg1: @literal: @Returns: @e: @Returns: @world: @op: @args: @Returns: @e: @e1: @e2: @flags: @error_p: @Returns: @world: @locator: @e: @flags: @Returns: @e: @eval_context: @error_p: @Returns: @op: @Returns: @e: @fh: @Returns: @e: @fh: @user_data: @e: @Returns: @e: @fn: @user_data: @Returns: @world: @locator: @flags: @Returns: @eval_context: @eval_context: @base_uri: @Returns: @eval_context: @seed: @Returns: rasqal-0.9.33/docs/tmpl/section-row.sgml0000644000175000017500000000162112443715253015061 00000000000000 Query Result Row Result row in a query result set containing a set of literals that are bound to variables. An ordered row of #rasqal_literal values that are each bound to #rasqal_variable defined in an associated #rasqal_variables table inside a #rasqal_query_results query result set. @world: @size: @Returns: @row: @row: @offset: @value: @Returns: rasqal-0.9.33/docs/tmpl/section-graph_pattern.sgml0000644000175000017500000000711212443715253017111 00000000000000 Graph patterns Collections of triple patterns, sub-graph patterns with operators. Graph patterns form a a tree structure that build a #rasqal_query top-level graph pattern (see rasqal_query_get_query_graph_pattern()) which may have sub-graph patterns. Graph patterns at the leaf of the tree operate over triple patterns (#rasqal_triple) matching the RDF triples in the data sources for %RASQAL_GRAPH_PATTERN_OPERATOR_BASIC or %RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL. Other graph patterns operators operate over sub graph patterns and group them, union them or apply a GRAPH matching keyword (%RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH). @graph_pattern: @sub_graph_pattern: @Returns: @gp: @Returns: @gp: @expr: @Returns: @query: @graph_pattern: @Returns: @gp: @Returns: @graph_pattern: @Returns: @graph_pattern: @Returns: @graph_pattern: @idx: @Returns: @graph_pattern: @Returns: @graph_pattern: @idx: @Returns: @query: @graph_pattern: @Returns: @graph_pattern: @Returns: @graph_pattern: @Returns: @RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: @RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: @RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: @RASQAL_GRAPH_PATTERN_OPERATOR_UNION: @RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: @RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: @RASQAL_GRAPH_PATTERN_OPERATOR_FILTER: @RASQAL_GRAPH_PATTERN_OPERATOR_LET: @RASQAL_GRAPH_PATTERN_OPERATOR_SELECT: @RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE: @RASQAL_GRAPH_PATTERN_OPERATOR_MINUS: @RASQAL_GRAPH_PATTERN_OPERATOR_VALUES: @RASQAL_GRAPH_PATTERN_OPERATOR_LAST: @op: @Returns: @gp: @fh: @Returns: @gp: @v: @Returns: @query: @gp: @user_data: @Returns: @query: @gp: @fn: @user_data: @Returns: rasqal-0.9.33/docs/tmpl/section-prefix.sgml0000644000175000017500000000156212443715253015553 00000000000000 Prefixes XML QName-style prefixes made from a URI and a short text prefix. Used inside a #rasqal_query to declare syntax prefix abbreviations for URIs. Once a #rasqal_query is constructed, these are for information only. @world: @prefix: @uri: @declared: @depth: @world: @prefix: @uri: @Returns: @p: @p: @fh: @Returns: rasqal-0.9.33/docs/tmpl/section-utilities.sgml0000644000175000017500000000103612443715253016265 00000000000000 Utilities Utility functions. Miscellaneous utility functions. @world: @locator: @pattern: @regex_flags: @subject: @subject_len: @replace: @replace_len: @result_len_p: @Returns: rasqal-0.9.33/docs/tmpl/section-unused.sgml0000644000175000017500000000275612443715253015567 00000000000000 section-unused Unused Unused @rtm: @user_data: @bindings: @parts: @Returns: @rtm: @user_data: @user_data: @rtm: @rts: @user_data: @m: @t: @Returns: @rtm: @user_data: @Returns: @rtm: @user_data: @user_data: @feature: @Returns: @rts: @user_data: @t: @Returns: rasqal-0.9.33/docs/tmpl/section-updates.sgml0000644000175000017500000000262012443715253015717 00000000000000 Updates Graph update operations This class provides a object to record a graph update operation with adding and/or removing triples, using a templated insert/delete with optional where clause. It is designed to be able to record the SPARQL 1.1 (Draft) update format, and is a work in progress as of February 2010. @type: @graph_uri: @document_uri: @insert_templates: @delete_templates: @where: @flags: @applies: @RASQAL_UPDATE_TYPE_UNKNOWN: @RASQAL_UPDATE_TYPE_CLEAR: @RASQAL_UPDATE_TYPE_CREATE: @RASQAL_UPDATE_TYPE_DROP: @RASQAL_UPDATE_TYPE_LOAD: @RASQAL_UPDATE_TYPE_UPDATE: @RASQAL_UPDATE_TYPE_ADD: @RASQAL_UPDATE_TYPE_MOVE: @RASQAL_UPDATE_TYPE_COPY: @RASQAL_UPDATE_TYPE_LAST: @RASQAL_UPDATE_FLAGS_SILENT: @RASQAL_UPDATE_FLAGS_DATA: @RASQAL_UPDATE_GRAPH_ONE: @RASQAL_UPDATE_GRAPH_DEFAULT: @RASQAL_UPDATE_GRAPH_NAMED: @RASQAL_UPDATE_GRAPH_ALL: rasqal-0.9.33/docs/tmpl/section-literal.sgml0000644000175000017500000001124012443715253015704 00000000000000 Literal RDF literals and RDF query-specific literals. A class for handling RDF terms (URI, blank nodes, strings, datatyped literals) as well as those natively used in a query such as boolean, double, floating, integer, regex pattern and variables. @RASQAL_LITERAL_UNKNOWN: @RASQAL_LITERAL_BLANK: @RASQAL_LITERAL_URI: @RASQAL_LITERAL_STRING: @RASQAL_LITERAL_XSD_STRING: @RASQAL_LITERAL_BOOLEAN: @RASQAL_LITERAL_INTEGER: @RASQAL_LITERAL_FLOAT: @RASQAL_LITERAL_DOUBLE: @RASQAL_LITERAL_DECIMAL: @RASQAL_LITERAL_DATETIME: @RASQAL_LITERAL_FIRST_XSD: @RASQAL_LITERAL_LAST_XSD: @RASQAL_LITERAL_UDT: @RASQAL_LITERAL_PATTERN: @RASQAL_LITERAL_QNAME: @RASQAL_LITERAL_VARIABLE: @RASQAL_LITERAL_INTEGER_SUBTYPE: @RASQAL_LITERAL_DATE: @RASQAL_LITERAL_LAST: @world: @type: @string: @Returns: @world: @value: @Returns: @world: @dt: @Returns: @world: @string: @Returns: @world: @string: @decimal: @Returns: @world: @d: @Returns: @world: @f: @Returns: @world: @type: @d: @Returns: @world: @type: @integer: @Returns: @world: @type: @Param3: @Returns: @world: @pattern: @flags: @Returns: @world: @type: @string: @Returns: @world: @string: @language: @datatype: @datatype_qname: @Returns: @world: @uri: @Returns: @world: @variable: @Returns: @l: @Returns: @l: @l: @Returns: @l: @len_p: @flags: @error_p: @Returns: @subject_en: @replace @replace_len @result_len_p @l: @Returns: @l: @flags: @error_p: @Returns: @l: @Returns: @l1: @l2: @flags: @error_p: @Returns: @l: @Returns: @l1: @l2: @Returns: @l: @Returns: @l: @Returns: @l: @Returns: @l: @Returns: @l: @fh: @Returns: @l: @fh: @type: @Returns: @l1: @l2: @Returns: @l: @Returns: rasqal-0.9.33/docs/tmpl/section-query.sgml0000644000175000017500000002202212443715253015415 00000000000000 Query Query object API, parsing and execution This class provides the main interface to the library. A query can be constructed by parsing a string, retrieving it from a URI and/or constructing it via API methods to build the query expression. The query structures can be read via methods to return the query verb rasqal_query_get_verb(), the #rasqal_data_graph RDF data sources with rasqal_query_get_data_graph() etc., the #rasqal_graph_pattern tree with rasqal_query_get_query_graph_pattern(), the sequence of order conditions with rasqal_query_get_order_condition() etc., the #rasqal_variable selected to return with rasqal_query_get_bound_variable_sequence() or rasqal_query_get_all_variable_sequence(), and so on. To process a query string, the rasqal_query_prepare() method parses the query string in some query language and initialises the #rasqal_query structures. The query can be evaluated with the internal query engine against some source of matches using rasqal_query_execute() to give an #rasqal_query_results. There are multiple forms of results that can include variable bindings, a boolean or an RDF graph that can be tested for with methods on #rasqal_query_results and then retrieved. @RASQAL_QUERY_VERB_UNKNOWN: @RASQAL_QUERY_VERB_SELECT: @RASQAL_QUERY_VERB_CONSTRUCT: @RASQAL_QUERY_VERB_DESCRIBE: @RASQAL_QUERY_VERB_ASK: @RASQAL_QUERY_VERB_DELETE: @RASQAL_QUERY_VERB_INSERT: @RASQAL_QUERY_VERB_UPDATE: @RASQAL_QUERY_VERB_LAST: @world: @name: @uri: @Returns: @query: @query: @data_graph: @Returns: @query: @data_graphs: @Returns: @query: @prefix: @Returns: @query: @var: @Returns: @query: @graph_uri: @Returns: @query: @Returns: @query: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @Returns: @query: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @Returns: @query: @Returns: @query: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: @query: @Returns: @query: @type: @name: @Returns: @query: @name: @Returns: @query: @query_string: @base_uri: @Returns: @query: @fh: @Returns: @query: @visit_fn: @data: @Returns: @query: @visit_fn: @data: @query: @distinct_mode: @query: @is_explain: @query: @limit: @query: @offset: @query: @user_data: @query: @type: @name: @value: @Returns: @query: @name: @value: @Returns: @query: @store_results: @Returns: @query: @wildcard: @verb: @Returns: @iostr: @query: @format_uri: @base_uri: @Returns: @query: @iostr: @string: @len: @Returns: @query: @string: @len: @output_len_p: @Returns: @query: @feature: @value: @Returns: @query: @feature: @value: @Returns: @query: @feature: @Returns: @query: @feature: @Returns: @query: @Returns: @query: @idx: @Returns: @query: @Returns: rasqal-0.9.33/docs/tmpl/rasqal-unused.sgml0000644000175000017500000000000012443715253015362 00000000000000rasqal-0.9.33/docs/tmpl/section-data.sgml0000644000175000017500000000300612443715253015162 00000000000000 Data Graphs RDF graph sources for triples. Data graphs are used in the query to describe RDF graphs that can be used to query against. The graphs can be used either with #raptor_uri to name the graph, or without a name. The query language determines which graphs are used in the query. @world: @uri: @name_uri: @flags: @format_type: @format_name: @format_uri: @iostr: @base_uri: @usage: @dg: @Returns: @world: @iostr: @base_uri: @name_uri: @flags: @format_type: @format_name: @format_uri: @Returns: @world: @uri: @name_uri: @flags: @format_type: @format_name: @format_uri: @Returns: @dg: @RASQAL_DATA_GRAPH_NONE: @RASQAL_DATA_GRAPH_NAMED: @RASQAL_DATA_GRAPH_BACKGROUND: @dg: @fh: @Returns: rasqal-0.9.33/docs/tmpl/section-variable.sgml0000644000175000017500000000215012443715253016035 00000000000000 Variables Variable with names and literal value. A class to hold a variable with optional name and a #rasqal_literal value. The name is not required for SPARQL anonymous variables. @vars_table: @name: @value: @offset: @type: @expression: @user_data: @usage: @v: @Returns: @v: @v: @fh: @Returns: @v: @l: @RASQAL_VARIABLE_TYPE_UNKNOWN: @RASQAL_VARIABLE_TYPE_NORMAL: @RASQAL_VARIABLE_TYPE_ANONYMOUS: rasqal-0.9.33/docs/tmpl/section-service.sgml0000644000175000017500000000230612443715253015713 00000000000000 Service Execute queries remotely via a SPARQL HTTP Protocol service. The SPARQL Protocol defines an HTTP binding that enables remote queries to be executed over specified default and named graphs. This class allows that to be constructed and executed, returning a Rasqal query results #rasqal_query_results that may be used, for example, with a formatter to generate output. @world: @service_uri: @query_string: @data_graphs: @Returns: @svc: @svc: @Returns: @svc: @format: @Returns: @svc: @www: @Returns: rasqal-0.9.33/docs/tmpl/section-triple.sgml0000644000175000017500000000270112443715253015551 00000000000000 Triples Triple pattern or RDF triple. An object for a triple pattern or an RDF triple in a query. It contains the three parts of an RDF triple - subject, predicate, object as well as origin for matching triples in some graph (such as with the SPARQL GRAPH). @subject: @predicate: @object: @origin: @flags: @subject: @predicate: @object: @Returns: @t: @Returns: @t: @t: @Returns: @RASQAL_TRIPLE_NONE: @RASQAL_TRIPLE_SUBJECT: @RASQAL_TRIPLE_PREDICATE: @RASQAL_TRIPLE_OBJECT: @RASQAL_TRIPLE_ORIGIN: @RASQAL_TRIPLE_GRAPH: @RASQAL_TRIPLE_SPO: @RASQAL_TRIPLE_SPOG: @t: @fh: @Returns: @t: @l: rasqal-0.9.33/docs/tmpl/section-general.sgml0000644000175000017500000001074312443715253015674 00000000000000 General library facilities Startup and shutdown, memory handling, version checks and misc functions. The functions in this section cover general library features such as startup and shutdown, checking the current library version and dealing with memory allocation and freeing. It also provides functions to enumerate and check the supported query languages, their names, labels and URI. @world: @void: @Returns: @world: @Returns: @world: @user_data: @handler: @world: @warning_level: @Returns: @world: @Returns: @world: @raptor_world_ptr: @world: @counter: @Returns: @world: @counter: @Returns: @world: @user_data: @user_bnodeid: @Returns: @world: @user_data: @handler: @Returns: @world: @prefix: @base: @Returns: @world: @uri: @mime_type: @buffer: @len: @identifier: @Returns: @RASQAL_FEATURE_NO_NET: @RASQAL_FEATURE_RAND_SEED: @RASQAL_FEATURE_LAST: @world: @name: @Returns: @world: @counter: @name: @label: @uri_string: @Returns: @size: @Returns: @nmemb: @size: @Returns: @ptr: @world: @uri: @Returns: @feature: @Returns: @world: @feature: @name: @uri: @label: @Returns: @void: @Returns: When defined before a function, indicates that the function has been deprecated and may be replaced in a future release. With some versions of gcc this may give a compilation warning. rasqal-0.9.33/docs/README.html0000644000175000017500000000260612340722012012562 00000000000000 Rasqal RDF Query Library - Documentation

Rasqal RDF Query Library - Documentation

DOCUMENTS

The latest documentation is on the Rasqal Web Site.

API DOCUMENTATION

The API documentation is generated automatically from the source code using gtk-doc.


Copyright (C) 2004-2008 Dave Beckett, Copyright (C) 2004-2005 University of Bristol

rasqal-0.9.33/docs/README0000644000175000017500000000112112340724764011626 00000000000000 Rasqal RDF Query Library - Documentation DOCUMENTS The latest documentation is on the Rasqal Web Site. * Installation document * Testing Redland * Frequently Asked Questions * To-do list * News * Release Notes * License API DOCUMENTATION The API documentation is generated automatically from the source code using gtk-doc. * Rasqal API documentation (HTML) __________________________________________________________________ Copyright (C) 2004-2008 Dave Beckett, Copyright (C) 2004-2005 University of Bristol rasqal-0.9.33/docs/Makefile.am0000644000175000017500000000727412421006603013002 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - docs automake file for rasqal # # Copyright (C) 2000-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2000-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. # # # The name of the module. DOC_MODULE=rasqal # The top-level SGML file. DOC_MAIN_SGML_FILE=rasqal-docs.xml # Extra options to supply to gtkdoc-scan SCAN_OPTIONS= --deprecated-guards="RASQAL_DISABLE_DEPRECATED" # The directory containing the source code. Relative to $(srcdir) DOC_SOURCE_DIR=../src # Used for dependencies HFILE_GLOB=$(builddir)/rasqal-fake.h CFILE_GLOB=$(top_srcdir)/src/rasqal_*.c IGNORE_CFILES= \ rasqal_xsd_datatypes.c \ rdql_lexer.c \ rdql_parser.c \ sparql_lexer.c \ sparql_parser.c \ strcasecmp.c \ rasqal_internal.h \ rasqal_graph.c # Use fixed version of rasqal.h EXTRA_HFILES=$(builddir)/rasqal-fake.h # Headers to ignore: yes rasqal.h is intended to be in this list # since it is added as a fixed file rasqal-fake.h by EXTRA_HFILES above IGNORE_HFILES= \ rasqal.h \ rasqal_config.h \ rasqal_getopt.h \ rasqal_internal.h \ rdql_common.h \ rdql_lexer.h \ rdql_parser.h \ sparql_common.h \ sparql_lexer.h \ sparql_parser.h \ win32_rasqal_config.h \ mtwist_config.h # CFLAGS and LDFLAGS for compiling scan program. Only needed # if $(DOC_MODULE).types is non-empty. AM_CPPFLAGS = GTKDOC_LIBS = # Extra options to supply to gtkdoc-mkdb MKDB_OPTIONS=--sgml-mode --output-format=xml --ignore-files="$(IGNORE_CFILES)" # Extra options to supply to gtkdoc-mktmpl MKTMPL_OPTIONS= # Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE) content_files = \ rasqal-changes.xml \ version.xml # Images to copy into HTML directory HTML_IMAGES = # Extra options to supply to gtkdoc-fixref FIXXREF_OPTIONS= # gtkdoc might not define this DISTCLEANFILES= include $(top_srcdir)/gtk-doc.make man_MANS = librasqal.3 EXTRA_DIST+= README.html README \ $(man_MANS) \ version.xml.in \ rasqal-changes.tsv DISTCLEANFILES += \ rasqal-fake.h $(builddir)/rasqal-fake.h: $(top_srcdir)/src/rasqal.h $(srcdir)/../scripts/fix-gtkdoc-header.pl $(PERL) $(srcdir)/../scripts/fix-gtkdoc-header.pl < $< > $@ # Create some text files from HTML sources LYNX=lynx LYNXARGS=-dump -nolist if MAINTAINER_MODE librasqal.html: $(srcdir)/librasqal.3 $(srcdir)/../scripts/fix-groff-xhtml.pl -groff -man -Thtml -P-l $< | tidy -asxml -wrap 1000 2>/dev/null | $(PERL) $(srcdir)/../scripts/fix-groff-xhtml.pl $@ # FIXME: automate updating the rasqal-overrides.txt definition of # rasqal_triples_match rasqal_triples_source # based on the definitions of the struct NAME_s in ../src/rasqal.h # # rasqal-overrides.txt: rasqal-overrides.txt.in $(srcdir)/src/rasqal.h # $(PERL) $(srcdir)/update-overrides $< $(srcdir)/src/rasqal.h $@ $(top_builddir)/src/rasqal.h: cd $(top_builddir)/src && $(MAKE) rasqal.h README: README.html $(LYNX) $(LYNXARGS) $< > $@ rasqal-changes.xml: $(srcdir)/rasqal-changes.tsv $(srcdir)/../scripts/process-changes.pl $(PERL) $(srcdir)/../scripts/process-changes.pl --package rasqal --docbook-xml $@ "Rasqal" $(srcdir)/rasqal-changes.tsv endif rasqal-0.9.33/docs/Makefile.in0000644000175000017500000007136612434455632013034 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 - docs automake file for rasqal # # Copyright (C) 2000-2008, David Beckett http://www.dajobe.org/ # Copyright (C) 2000-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. # # # -*- mode: makefile -*- #################################### # Everything below here is generic # #################################### VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/version.xml.in $(top_srcdir)/gtk-doc.make subdir = docs 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = version.xml CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man3dir = $(mandir)/man3 am__installdirs = "$(DESTDIR)$(man3dir)" NROFF = nroff MANS = $(man_MANS) 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ # The name of the module. DOC_MODULE = rasqal # The top-level SGML file. DOC_MAIN_SGML_FILE = rasqal-docs.xml # Extra options to supply to gtkdoc-scan SCAN_OPTIONS = --deprecated-guards="RASQAL_DISABLE_DEPRECATED" # The directory containing the source code. Relative to $(srcdir) DOC_SOURCE_DIR = ../src # Used for dependencies HFILE_GLOB = $(builddir)/rasqal-fake.h CFILE_GLOB = $(top_srcdir)/src/rasqal_*.c IGNORE_CFILES = \ rasqal_xsd_datatypes.c \ rdql_lexer.c \ rdql_parser.c \ sparql_lexer.c \ sparql_parser.c \ strcasecmp.c \ rasqal_internal.h \ rasqal_graph.c # Use fixed version of rasqal.h EXTRA_HFILES = $(builddir)/rasqal-fake.h # Headers to ignore: yes rasqal.h is intended to be in this list # since it is added as a fixed file rasqal-fake.h by EXTRA_HFILES above IGNORE_HFILES = \ rasqal.h \ rasqal_config.h \ rasqal_getopt.h \ rasqal_internal.h \ rdql_common.h \ rdql_lexer.h \ rdql_parser.h \ sparql_common.h \ sparql_lexer.h \ sparql_parser.h \ win32_rasqal_config.h \ mtwist_config.h # CFLAGS and LDFLAGS for compiling scan program. Only needed # if $(DOC_MODULE).types is non-empty. AM_CPPFLAGS = GTKDOC_LIBS = # Extra options to supply to gtkdoc-mkdb MKDB_OPTIONS = --sgml-mode --output-format=xml --ignore-files="$(IGNORE_CFILES)" # Extra options to supply to gtkdoc-mktmpl MKTMPL_OPTIONS = # Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE) content_files = \ rasqal-changes.xml \ version.xml # Images to copy into HTML directory HTML_IMAGES = # Extra options to supply to gtkdoc-fixref FIXXREF_OPTIONS = # gtkdoc might not define this DISTCLEANFILES = rasqal-fake.h @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute # We set GPATH here; this gives us semantics for GNU make # which are more like other make's VPATH, when it comes to # whether a source that is a target of one rule is then # searched for in VPATH/GPATH. # GPATH = $(srcdir) TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) SETUP_FILES = \ $(content_files) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) README.html README \ $(man_MANS) version.xml.in rasqal-changes.tsv DOC_STAMPS = setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ html-build.stamp pdf-build.stamp \ tmpl.stamp sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ $(DOC_MODULE).interfaces \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals REPORT_FILES = \ $(DOC_MODULE)-undocumented.txt \ $(DOC_MODULE)-undeclared.txt \ $(DOC_MODULE)-unused.txt CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_FALSE@HTML_BUILD_STAMP = @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_TRUE@HTML_BUILD_STAMP = html-build.stamp @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp man_MANS = librasqal.3 # Create some text files from HTML sources LYNX = lynx LYNXARGS = -dump -nolist all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/gtk-doc.make $(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 docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/gtk-doc.make: $(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): version.xml: $(top_builddir)/config.status $(srcdir)/version.xml.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man3dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.3[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(MANS) all-local installdirs: for dir in "$(DESTDIR)$(man3dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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 clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-local dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-data-local install-man 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-man3 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-local uninstall-man uninstall-man: uninstall-man3 .MAKE: install-am install-strip .PHONY: all all-am all-local check check-am clean clean-generic \ clean-libtool clean-local dist-hook distclean \ distclean-generic distclean-libtool distclean-local distdir \ dvi dvi-am html html-am info info-am install install-am \ install-data install-data-am install-data-local install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man3 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-local uninstall-man uninstall-man3 @ENABLE_GTK_DOC_TRUE@all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) @ENABLE_GTK_DOC_FALSE@all-local: docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) $(REPORT_FILES): sgml-build.stamp #### setup #### setup-build.stamp: -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ echo ' DOC Preparing build'; \ files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ if test "x$$files" != "x" ; then \ for file in $$files ; do \ test -f $(abs_srcdir)/$$file && \ cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ done; \ fi; \ test -d $(abs_srcdir)/tmpl && \ { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ chmod -R u+w $(abs_builddir)/tmpl; } \ fi @touch setup-build.stamp #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo ' DOC Scanning header files' @_source_dir='' ; \ for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ done ; \ gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ echo " DOC Introspecting gobjects"; \ scanobj_options=""; \ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ if test "$(?)" = "0"; then \ if test "x$(V)" = "x1"; then \ scanobj_options="--verbose"; \ fi; \ fi; \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ else \ for i in $(SCANOBJ_FILES) ; do \ test -f $$i || touch $$i ; \ done \ fi @touch scan-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true #### templates #### tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt @echo ' DOC Rebuilding template files' @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ if test -w $(abs_srcdir) ; then \ cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ fi \ fi @touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @true $(srcdir)/tmpl/*.sgml: @true #### xml #### sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) @echo ' DOC Building XML' @-chmod -R u+w $(srcdir) @_source_dir='' ; \ for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ done ; \ gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) @touch sgml-build.stamp sgml.stamp: sgml-build.stamp @true #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo ' DOC Building HTML' @rm -rf html @mkdir html @mkhtml_options=""; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ if test "$(?)" = "0"; then \ if test "x$(V)" = "x1"; then \ mkhtml_options="$$mkhtml_options --verbose"; \ fi; \ fi; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) -@test "x$(HTML_IMAGES)" = "x" || \ for file in $(HTML_IMAGES) ; do \ if test -f $(abs_srcdir)/$$file ; then \ cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ fi; \ if test -f $(abs_builddir)/$$file ; then \ cp $(abs_builddir)/$$file $(abs_builddir)/html; \ fi; \ done; @echo ' DOC Fixing cross-references' @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @touch html-build.stamp #### pdf #### pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo ' DOC Building PDF' @rm -f $(DOC_MODULE).pdf @mkpdf_options=""; \ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ if test "$(?)" = "0"; then \ if test "x$(V)" = "x1"; then \ mkpdf_options="$$mkpdf_options --verbose"; \ fi; \ fi; \ if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ if test $$? != 0; then \ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ done; \ fi; \ gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) @touch pdf-build.stamp ############## clean-local: @rm -f *~ *.bak @rm -rf .libs distclean-local: @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ rm -rf tmpl; \ fi maintainer-clean-local: clean @rm -rf xml html install-data-local: @installfiles=`echo $(builddir)/html/*`; \ if test "$$installfiles" = '$(builddir)/html/*'; \ then echo 1>&2 'Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ echo ' $(INSTALL_DATA) '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ fi; \ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ fi uninstall-local: @if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ rm -rf $${installdir} # # Require gtk-doc when making dist # @ENABLE_GTK_DOC_TRUE@dist-check-gtkdoc: @ENABLE_GTK_DOC_FALSE@dist-check-gtkdoc: @ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist" @ENABLE_GTK_DOC_FALSE@ @false dist-hook: dist-check-gtkdoc dist-hook-local @mkdir $(distdir)/tmpl @mkdir $(distdir)/html @-cp ./tmpl/*.sgml $(distdir)/tmpl @cp ./html/* $(distdir)/html @-cp ./$(DOC_MODULE).pdf $(distdir)/ @-cp ./$(DOC_MODULE).types $(distdir)/ @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ @cd $(distdir) && rm -f $(DISTCLEANFILES) @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs $(builddir)/rasqal-fake.h: $(top_srcdir)/src/rasqal.h $(srcdir)/../scripts/fix-gtkdoc-header.pl $(PERL) $(srcdir)/../scripts/fix-gtkdoc-header.pl < $< > $@ @MAINTAINER_MODE_TRUE@librasqal.html: $(srcdir)/librasqal.3 $(srcdir)/../scripts/fix-groff-xhtml.pl @MAINTAINER_MODE_TRUE@ -groff -man -Thtml -P-l $< | tidy -asxml -wrap 1000 2>/dev/null | $(PERL) $(srcdir)/../scripts/fix-groff-xhtml.pl $@ # FIXME: automate updating the rasqal-overrides.txt definition of # rasqal_triples_match rasqal_triples_source # based on the definitions of the struct NAME_s in ../src/rasqal.h # # rasqal-overrides.txt: rasqal-overrides.txt.in $(srcdir)/src/rasqal.h # $(PERL) $(srcdir)/update-overrides $< $(srcdir)/src/rasqal.h $@ @MAINTAINER_MODE_TRUE@$(top_builddir)/src/rasqal.h: @MAINTAINER_MODE_TRUE@ cd $(top_builddir)/src && $(MAKE) rasqal.h @MAINTAINER_MODE_TRUE@README: README.html @MAINTAINER_MODE_TRUE@ $(LYNX) $(LYNXARGS) $< > $@ @MAINTAINER_MODE_TRUE@rasqal-changes.xml: $(srcdir)/rasqal-changes.tsv $(srcdir)/../scripts/process-changes.pl @MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/../scripts/process-changes.pl --package rasqal --docbook-xml $@ "Rasqal" $(srcdir)/rasqal-changes.tsv # 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: rasqal-0.9.33/docs/rasqal-sections.txt0000644000175000017500000002570612443715253014633 00000000000000
section-general rasqal_world rasqal_free_world rasqal_new_world rasqal_world_open rasqal_world_set_log_handler rasqal_world_set_warning_level rasqal_world_get_raptor rasqal_world_set_raptor rasqal_world_get_query_language_description rasqal_world_get_query_results_format_description rasqal_generate_bnodeid_handler rasqal_world_set_generate_bnodeid_handler rasqal_world_set_default_generate_bnodeid_parameters rasqal_world_guess_query_results_format_name rasqal_version_decimal rasqal_version_major rasqal_version_minor rasqal_version_release rasqal_version_string rasqal_copyright_string rasqal_short_copyright_string rasqal_home_url_string rasqal_license_string rasqal_feature rasqal_language_name_check rasqal_languages_enumerate rasqal_alloc_memory rasqal_calloc_memory rasqal_free_memory rasqal_feature_from_uri rasqal_feature_value_type rasqal_features_enumerate rasqal_get_feature_count RASQAL_DEPRECATED RASQAL_VERSION RASQAL_VERSION_MAJOR RASQAL_VERSION_MINOR RASQAL_VERSION_RELEASE RASQAL_VERSION_STRING RASQAL_RAPTOR_VERSION
section-data rasqal_data_graph rasqal_new_data_graph_from_data_graph rasqal_new_data_graph_from_iostream rasqal_new_data_graph_from_uri rasqal_free_data_graph rasqal_data_graph_flags rasqal_data_graph_print
section-expression rasqal_expression rasqal_expression_flags rasqal_evaluation_context rasqal_op rasqal_compare_flags rasqal_pattern_flags rasqal_new_0op_expression rasqal_new_1op_expression rasqal_new_2op_expression rasqal_new_3op_expression rasqal_new_4op_expression rasqal_new_aggregate_function_expression rasqal_new_cast_expression rasqal_new_function_expression rasqal_new_group_concat_expression rasqal_new_literal_expression rasqal_new_set_expression rasqal_new_string_op_expression rasqal_new_expression_from_expression rasqal_new_expr_seq_expression rasqal_free_expression rasqal_expression_compare rasqal_expression_evaluate rasqal_expression_evaluate2 rasqal_expression_op_label rasqal_expression_print rasqal_expression_print_op rasqal_expression_visit_fn rasqal_expression_visit rasqal_new_evaluation_context rasqal_free_evaluation_context rasqal_evaluation_context_set_base_uri rasqal_evaluation_context_set_rand_seed
section-graph_pattern rasqal_graph_pattern rasqal_graph_pattern_add_sub_graph_pattern rasqal_graph_pattern_get_filter_expression rasqal_graph_pattern_set_filter_expression rasqal_graph_pattern_get_flattened_triples rasqal_graph_pattern_get_index rasqal_graph_pattern_get_operator rasqal_graph_pattern_get_origin rasqal_graph_pattern_get_sub_graph_pattern rasqal_graph_pattern_get_sub_graph_pattern_sequence rasqal_graph_pattern_get_triple rasqal_graph_pattern_get_triples rasqal_graph_pattern_get_service rasqal_graph_pattern_get_variable rasqal_graph_pattern_operator rasqal_graph_pattern_operator_as_string rasqal_graph_pattern_print rasqal_graph_pattern_variable_bound_in rasqal_graph_pattern_visit_fn rasqal_graph_pattern_visit
section-literal rasqal_literal rasqal_literal_type rasqal_new_typed_literal rasqal_new_boolean_literal rasqal_new_datetime_literal_from_datetime rasqal_new_decimal_literal rasqal_new_decimal_literal_from_decimal rasqal_new_double_literal rasqal_new_float_literal rasqal_new_floating_literal rasqal_new_integer_literal rasqal_new_numeric_literal_from_long rasqal_new_pattern_literal rasqal_new_simple_literal rasqal_new_string_literal rasqal_new_uri_literal rasqal_new_variable_literal rasqal_new_literal_from_literal rasqal_free_literal rasqal_literal_as_node rasqal_literal_as_counted_string rasqal_literal_as_string rasqal_literal_as_string_flags rasqal_literal_as_variable rasqal_literal_compare rasqal_literal_datatype rasqal_literal_equals rasqal_literal_get_language rasqal_literal_get_rdf_term_type rasqal_literal_get_type rasqal_literal_is_rdf_literal rasqal_literal_print rasqal_literal_print_type rasqal_literal_type_label rasqal_literal_same_term rasqal_literal_value
section-prefix rasqal_prefix rasqal_new_prefix rasqal_free_prefix rasqal_prefix_print
section-query rasqal_query_verb rasqal_query rasqal_new_query rasqal_free_query rasqal_query_add_data_graph rasqal_query_add_data_graphs rasqal_query_add_prefix rasqal_query_add_variable rasqal_query_dataset_contains_named_graph rasqal_query_execute rasqal_query_get_all_variable_sequence rasqal_query_get_anonymous_variable_sequence rasqal_query_get_bindings_row rasqal_query_get_bindings_rows_sequence rasqal_query_get_bindings_variable rasqal_query_get_bindings_variables_sequence rasqal_query_get_bound_variable_sequence rasqal_query_get_construct_triple rasqal_query_get_construct_triples_sequence rasqal_query_get_data_graph rasqal_query_get_data_graph_sequence rasqal_query_get_describe_sequence rasqal_query_get_distinct rasqal_query_get_explain rasqal_query_get_group_condition rasqal_query_get_group_conditions_sequence rasqal_query_get_graph_pattern rasqal_query_get_graph_pattern_sequence rasqal_query_get_having_condition rasqal_query_get_having_conditions_sequence rasqal_query_get_label rasqal_query_get_limit rasqal_query_get_name rasqal_query_get_offset rasqal_query_get_order_condition rasqal_query_get_order_conditions_sequence rasqal_query_get_prefix rasqal_query_get_prefix_sequence rasqal_query_get_query_graph_pattern rasqal_query_get_triple rasqal_query_get_triple_sequence rasqal_query_get_user_data rasqal_query_get_variable rasqal_query_get_verb rasqal_query_get_wildcard rasqal_query_has_variable2 rasqal_query_has_variable rasqal_query_prepare rasqal_query_print rasqal_query_graph_pattern_visit2 rasqal_query_graph_pattern_visit rasqal_query_set_distinct rasqal_query_set_explain rasqal_query_set_limit rasqal_query_set_offset rasqal_query_set_user_data rasqal_query_set_variable2 rasqal_query_set_variable rasqal_query_set_store_results rasqal_query_set_wildcard rasqal_query_verb_as_string rasqal_query_write rasqal_query_iostream_write_escaped_counted_string rasqal_query_escape_counted_string rasqal_query_set_feature rasqal_query_set_feature_string rasqal_query_get_feature rasqal_query_get_feature_string rasqal_query_get_result_type rasqal_query_get_update_operation rasqal_query_get_update_operations_sequence
section-query_results rasqal_query_results rasqal_new_query_results rasqal_new_query_results2 rasqal_new_query_results_from_string rasqal_free_query_results rasqal_query_results_add_row rasqal_query_results_finished rasqal_query_results_get_binding_name rasqal_query_results_get_binding_value rasqal_query_results_get_binding_value_by_name rasqal_query_results_get_bindings rasqal_query_results_get_bindings_count rasqal_query_results_get_boolean rasqal_query_results_get_count rasqal_query_results_get_query rasqal_query_results_get_triple rasqal_query_results_get_row_by_offset rasqal_query_results_get_type rasqal_query_results_is_bindings rasqal_query_results_is_boolean rasqal_query_results_is_graph rasqal_query_results_is_syntax rasqal_query_results_next rasqal_query_results_next_triple rasqal_query_results_read rasqal_query_results_write rasqal_query_results_type rasqal_query_results_type_label rasqal_query_results_rewind
section-query_results_formatter rasqal_query_results_formatter rasqal_query_results_format_flags rasqal_query_results_formats_check rasqal_query_results_formats_check2 rasqal_new_query_results_formatter rasqal_new_query_results_formatter_for_content rasqal_free_query_results_formatter rasqal_query_results_formatter_read rasqal_query_results_formatter_write
section-row rasqal_row rasqal_new_row_for_size rasqal_free_row rasqal_row_set_value_at
section-service rasqal_service rasqal_new_service rasqal_free_service rasqal_service_execute rasqal_service_set_format rasqal_service_set_www
section-triple rasqal_triple rasqal_new_triple rasqal_new_triple_from_triple rasqal_free_triple rasqal_triple_get_origin rasqal_triple_parts rasqal_triple_print rasqal_triple_set_origin
section-updates rasqal_update_operation rasqal_update_type rasqal_update_flags rasqal_update_graph_applies
section-utilities rasqal_regex_replace
section-variable rasqal_variable rasqal_new_variable_from_variable rasqal_free_variable rasqal_variable_print rasqal_variable_set_value rasqal_variable_type
section-variables-table rasqal_variables_table rasqal_new_variables_table rasqal_free_variables_table rasqal_variables_table_add rasqal_variables_table_add2 rasqal_variables_table_add_variable rasqal_variables_table_get_by_name rasqal_variables_table_contains
section-triples_source rasqal_triple_meta rasqal_triples_match rasqal_triples_source rasqal_triples_source_factory rasqal_triples_source_factory_register_fn rasqal_triples_source_feature rasqal_triples_error_handler rasqal_triples_error_handler2 rasqal_set_triples_source_factory RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION RASQAL_TRIPLES_SOURCE_MIN_VERSION RASQAL_TRIPLES_SOURCE_MAX_VERSION
section-xsd rasqal_xsd_date rasqal_new_xsd_date rasqal_free_xsd_date rasqal_xsd_date_to_counted_string rasqal_xsd_date_to_string rasqal_xsd_date_equals rasqal_xsd_date_compare rasqal_xsd_datetime RASQAL_XSD_DATETIME_NO_TZ rasqal_new_xsd_datetime rasqal_new_xsd_datetime_from_timeval rasqal_new_xsd_datetime_from_unixtime rasqal_new_xsd_datetime_from_xsd_date rasqal_free_xsd_datetime rasqal_xsd_datetime_compare rasqal_xsd_datetime_compare2 rasqal_xsd_datetime_equals rasqal_xsd_datetime_equals2 rasqal_xsd_datetime_get_as_timeval rasqal_xsd_datetime_get_as_unixtime rasqal_xsd_datetime_get_seconds_as_decimal rasqal_xsd_datetime_get_timezone_as_counted_string rasqal_xsd_datetime_get_tz_as_counted_string rasqal_xsd_datetime_set_from_timeval rasqal_xsd_datetime_set_from_unixtime rasqal_xsd_datetime_to_counted_string rasqal_xsd_datetime_to_string rasqal_free_xsd_decimal rasqal_new_xsd_decimal rasqal_xsd_decimal rasqal_xsd_decimal_abs rasqal_xsd_decimal_add rasqal_xsd_decimal_as_counted_string rasqal_xsd_decimal_as_string rasqal_xsd_decimal_ceil rasqal_xsd_decimal_compare rasqal_xsd_decimal_divide rasqal_xsd_decimal_equals rasqal_xsd_decimal_floor rasqal_xsd_decimal_get_double rasqal_xsd_decimal_get_long rasqal_xsd_decimal_is_zero rasqal_xsd_decimal_multiply rasqal_xsd_decimal_negate rasqal_xsd_decimal_print rasqal_xsd_decimal_round rasqal_xsd_decimal_set_double rasqal_xsd_decimal_set_long rasqal_xsd_decimal_set_string rasqal_xsd_decimal_subtract
section-unused RASQAL_API RASQAL_LITERAL_UDT_DEFINED RASQAL_QUERY_RESULTS_FORMATTER_DECLARED RASQAL_WORLD_DECLARED bind_match finish free_triples_source init_triples_match is_end next_match rasqal_expression_s rasqal_random support_feature triple_present
rasqal-0.9.33/docs/librasqal.30000644000175000017500000000642012340722012012773 00000000000000.\" .\" librasqal.3 - Rasqal library manual page .\" .\" $Id$ .\" .\" Copyright (C) 2004-2011 David Beckett - http://www.dajobe.org/ .\" Copyright (C) 2004-2005 University of Bristol - http://www.bristol.ac.uk/ .\" .TH librasqal 3 "2011-01-12" .\" Please adjust this date whenever revising the manpage. .SH NAME librasqal \- Rasqal RDF query library .SH SYNOPSIS .nf .B #include .br \ .br .BI rasqal_world* world =rasqal_new_world(); .br .BI "rasqal_query_results *" results ; .br .BI "raptor_uri *" base_uri =raptor_new_uri( "\(dqhttp://example.org/foo\(dq" ); .br .BI "rasqal_query *" rq =rasqal_new_query(world, "\(dqrdql\(dq" , NULL ); .br .BI "const char *" query_string "=\(dqselect * from \(dq;" .br \ .br .BI rasqal_query_prepare( rq , query_string , base_uri ); .br .BI "" results =rasqal_query_execute( rq ); .br .BI "while(!rasqal_query_results_finished(" results "))\ {" .br .BI "\ for(" i "=0;" i " ]> Rasqal RDF Query Library Manual Manual for Rasqal &version; Dave Beckett
http://www.dajobe.org/
This documentation is Free Software / Open Source - you can redistribute it and/or modify it under the same licenses as Rasqal. It is licensed under the following three licenses as alternatives: GNU Lesser General Public License (LGPL) V2.1 or any newer version GNU General Public License (GPL) V2 or any newer version Apache License, V2.0 or any newer version You may not use this documentation except in compliance with at least one of the above three licenses. See the Rasqal site for the full license terms. 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 Dave Beckett 2003 2004 2005 University of Bristol
Rasqal Overview Rasqal is an RDF query library providing APIs to parse query syntaxes (SPARQL and RDQL), build and manipulate the query structures, form query algebras and execution plans and execute the queries into query result sets. Reference Manual This part contains the Rasqal Reference Manual which comprehensively describes every class and function of the API. Index
rasqal-0.9.33/docs/rasqal-changes.xml0000644000175000017500000011766212443707651014403 00000000000000 API Changes This chapter describes the API changes for Rasqal.
Introduction The following sections describe the changes in the API between versions including additions, deletions, renames (retaining the same number of parameters, types and return value type) and more complex changes to functions, types and enums.
Changes between Rasqal 0.9.21 and 0.9.22
New functions, types and enums Functions void rasqal_free_xsd_datetime(rasqal_xsd_datetime* dt) const unsigned char* rasqal_literal_as_counted_string(rasqal_literal* l, size_t *len_p, int flags, int *error) rasqal_literal* rasqal_new_datetime_literal_from_datetime(rasqal_world* world, rasqal_xsd_datetime* dt) rasqal_xsd_datetime* rasqal_new_xsd_datetime(rasqal_world* world, const char *datetime_string) rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_timeval(rasqal_world* world, struct timeval *tv) rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_unixtime(rasqal_world* world, time_t secs) rasqal_query_results_type rasqal_query_get_result_type(rasqal_query* query) rasqal_row* rasqal_query_results_get_row_by_offset(rasqal_query_results* query_results, int result_offset) rasqal_query_results_type rasqal_query_results_get_type(rasqal_query_results* query_results) int rasqal_query_results_rewind(rasqal_query_results* query_results) int rasqal_query_set_store_results(rasqal_query* query, int store_results) const char* rasqal_world_guess_query_results_format_name(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier) void rasqal_world_set_log_handler(rasqal_world* world, void *user_data, raptor_log_handler handler) int rasqal_xsd_datetime_compare(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2) int rasqal_xsd_datetime_equals(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2) struct timeval* rasqal_xsd_datetime_get_as_timeval(rasqal_xsd_datetime *dt) time_t rasqal_xsd_datetime_get_as_unixtime(rasqal_xsd_datetime* dt) rasqal_xsd_decimal* rasqal_xsd_datetime_get_seconds_as_decimal(rasqal_world* world, rasqal_xsd_datetime* dt) char* rasqal_xsd_datetime_get_timezone_as_counted_string(rasqal_xsd_datetime *dt, size_t *len_p) int rasqal_xsd_datetime_set_from_timeval(rasqal_xsd_datetime *dt, struct timeval *tv) int rasqal_xsd_datetime_set_from_unixtime(rasqal_xsd_datetime* dt, time_t clock) char* rasqal_xsd_datetime_to_counted_string(const rasqal_xsd_datetime *dt, size_t *len_p) char* rasqal_xsd_datetime_to_string(const rasqal_xsd_datetime *dt) Types rasqal_xsd_datetime Enums RASQAL_EXPR_CONCAT - Expression for SPARQL 1.1 CONCAT(strings) RASQAL_EXPR_CONTAINS - Expression for SPARQL 1.1 CONTAINS(str, str) RASQAL_EXPR_CURRENT_DATETIME - Expression for LAQRS CURRENT_DATETIME( void ) RASQAL_EXPR_DAY - Expression for SPARQL 1.1 DAY(datetime) RASQAL_EXPR_ENCODE_FOR_URI - Expression for SPARQL 1.1 ENCODE_FOR_URI(str) RASQAL_EXPR_FROM_UNIXTIME - Expression for LAQRS FROM_UNIXTIME(int) RASQAL_EXPR_HOURS - Expression for SPARQL 1.1 HOURS(datetime) RASQAL_EXPR_LCASE - Expression for SPARQL 1.1 LCASE(str) RASQAL_EXPR_MINUTES - Expression for SPARQL 1.1 MINUTES(datetime) RASQAL_EXPR_MONTH - Expression for SPARQL 1.1 MONTH(datetime) RASQAL_EXPR_NOW - Expression for LAQRS NOW( void ) RASQAL_EXPR_SECONDS - Expression for SPARQL 1.1 SECONDS(datetime) RASQAL_EXPR_STRENDS - Expression for SPARQL 1.1 STRENDS(str, str) RASQAL_EXPR_STRLEN - Expression for SPARQL 1.1 STRLEN(str) RASQAL_EXPR_STRSTARTS - Expression for SPARQL 1.1 STRSTARTS(str, str) RASQAL_EXPR_SUBSTR - Expression for SPARQL 1.1 SUBSTR(str, start[,offset]) RASQAL_EXPR_TIMEZONE - Expression for SPARQL 1.1 TIMEZONE(datetime) RASQAL_EXPR_TO_UNIXTIME - Expression for LAQRS TO_UNIXTIME(datetime) RASQAL_EXPR_UCASE - Expression for SPARQL 1.1 UCASE(str) RASQAL_EXPR_YEAR - Expression for SPARQL 1.1 YEAR(datetime) RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER - Bitflag for rasqal_query_results_formats_check() to request formats that can be read. RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER - Bitflag for rasqal_query_results_formats_check() to request formats that can be written. RASQAL_QUERY_RESULTS_UNKNOWN - Unknown result format type RASQAL_XSD_DATETIME_NO_TZ - Sentinel XSD Decimal timezone value indicating no timezone is present.
Deleted functions, types and enums Functions rasqal_new_variable - Replaced by rasqal_variables_table_add2() rasqal_new_variable_typed - Replaced by rasqal_variables_table_add2() rasqal_query_results_formatter_get_mime_type - Use rasqal_world_get_query_results_format_description() to get list of mime types. rasqal_query_set_error_handler - Replaced by rasqal_world_set_log_handler() rasqal_query_set_fatal_error_handler - Replaced by rasqal_world_set_log_handler() rasqal_query_set_warning_handler - Replaced by rasqal_world_set_log_handler()
Renamed function and enums
0.9.21 function 0.9.22 function Notes
rasqal_new_function_expression2 rasqal_new_function_expression  
rasqal_query_add_data_graph2 rasqal_query_add_data_graph  
rasqal_query_results_read2 rasqal_query_results_read  
rasqal_query_results_write2 rasqal_query_results_write  
Changed functions and types
0.9.21 function 0.9.22 function Notes
int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler2 handler) int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler)  
int rasqal_query_results_formats_enumerate(rasqal_world* world, unsigned int counter, const char **name, const char **label, const unsigned char **uri_string, const char **mime_type, int* flags) const raptor_syntax_description* rasqal_world_get_query_results_format_description(rasqal_world* world, unsigned int counter)  
void rasqal_query_set_default_generate_bnodeid_parameters(rasqal_query* rdf_query, char *prefix, int base) int rasqal_world_set_default_generate_bnodeid_parameters(rasqal_world* world, char *prefix, int base)  
void rasqal_query_set_generate_bnodeid_handler(rasqal_query* query, void *user_data, rasqal_generate_bnodeid_handler handler) int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler)  
int rasqal_query_add_data_graph(rasqal_query* query, raptor_uri* uri, raptor_uri* name_uri, int flags) int rasqal_query_add_data_graph(rasqal_query* query, rasqal_data_graph* data_graph)  
int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri) int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri)  
int rasqal_query_results_read(raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri) int rasqal_query_results_read(raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri)  
int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type)  
int rasqal_query_results_formats_check2(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type)  
rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, raptor_uri* format_uri)  
rasqal_query_results_formatter* rasqal_new_query_results_formatter2(rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, raptor_uri* format_uri)  
rasqal_query_results_formatter* rasqal_new_query_results_formatter_by_mime_type(rasqal_world* world, const char *mime_type) rasqal_query_results_formatter* rasqal_new_query_results_formatter_for_content(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier)  
rasqal_data_graph* rasqal_new_data_graph(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags) rasqal_data_graph* rasqal_new_data_graph_from_uri(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags, const char* format_type, const char* format_name, raptor_uri* format_uri)  
rasqal_expression* rasqal_new_function_expression(rasqal_world* world, raptor_uri* name, raptor_sequence* args) rasqal_expression* rasqal_new_function_expression(rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags)  
rasqal_expression* rasqal_new_coalesce_expression(rasqal_world* world, raptor_sequence* args) rasqal_expression* rasqal_new_expr_seq_expression(rasqal_world* world, rasqal_op op, raptor_sequence* args) Call it with op RASQAL_EXPR_COALESCE
0.9.21 type 0.9.22 type Notes
rasqal_data_graph rasqal_data_graph Added const for format_type and format_name fields.
rasqal_generate_bnodeid_handler2 rasqal_generate_bnodeid_handler Handler now takes a pointer to the rasqal_world object not rasqal_query.
rasqal_literal rasqal_literal Added datetime to value union.
Changes between Rasqal 0.9.22 and 0.9.23
New functions, types and enums Functions raptor_sequence* rasqal_graph_pattern_get_flattened_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern)
Changes between Rasqal 0.9.23 and 0.9.24
New functions, types and enums Functions raptor_sequence* rasqal_graph_pattern_get_flattened_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern) Types rasqal_update_graph_applies - Specifies scope that a rasqal_update applies to Enums RASQAL_UPDATE_TYPE_ADD - SPARQL 1.1 Update ADD operation RASQAL_UPDATE_TYPE_COPY - SPARQL 1.1 Update COPY operation RASQAL_UPDATE_TYPE_MOVE - SPARQL 1.1 Update MOVE operation
Changes between Rasqal 0.9.24 and 0.9.25
New functions, types and enums Functions int rasqal_evaluation_context_set_base_uri(rasqal_evaluation_context* eval_context, raptor_uri *base_uri) int rasqal_evaluation_context_set_rand_seed(rasqal_evaluation_context* eval_context, unsigned int seed) rasqal_literal* rasqal_expression_evaluate2(rasqal_expression *e, rasqal_evaluation_context* eval_context, int *error_p) void rasqal_free_evaluation_context(rasqal_evaluation_context* eval_context) rasqal_evaluation_context* rasqal_new_evaluation_context(rasqal_world* world, raptor_locator* locator, int flags) const raptor_syntax_description* rasqal_world_get_query_language_description(rasqal_world* world, unsigned int counter) char* rasqal_xsd_datetime_get_tz_as_counted_string(rasqal_xsd_datetime* dt, size_t *len_p) int rasqal_xsd_decimal_abs(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) int rasqal_xsd_decimal_ceil(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) int rasqal_xsd_decimal_floor(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) int rasqal_xsd_decimal_round(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) Types rasqal_evaluation_context - Evaluation context for rasqal_expression_evaluate2() Enums RASQAL_EXPR_ABS - Expression for SPARQL 1.1 ABS(numeric) RASQAL_EXPR_CEIL - Expression for SPARQL 1.1 CEIL(numeric) RASQAL_EXPR_FLOOR - Expression for SPARQL 1.1 FLOOR(numeric) RASQAL_EXPR_RAND - Expression for SPARQL 1.1 RAND() RASQAL_EXPR_ROUND - Expression for SPARQL 1.1 ROUND(numeric) RASQAL_EXPR_TZ - Expression for SPARQL 1.1 TZ(datetime) timezone accessor
Changes between Rasqal 0.9.25 and 0.9.26
New functions, types and enums Functions int rasqal_world_set_warning_level(rasqal_world* world, unsigned int warning_level) Enums RASQAL_EXPR_MD5 - Expression for SPARQL 1.1 MD5(literal) message digest RASQAL_EXPR_SHA1 - Expression for SPARQL 1.1 SHA1(literal) message digest RASQAL_EXPR_SHA224 - Expression for SPARQL 1.1 SHA224(literal) message digest RASQAL_EXPR_SHA256 - Expression for SPARQL 1.1 SHA256(literal) message digest RASQAL_EXPR_SHA384 - Expression for SPARQL 1.1 SHA384(literal) message digest RASQAL_EXPR_SHA512 - Expression for SPARQL 1.1 SHA512(literal) message digest
Changes between Rasqal 0.9.26 and 0.9.27
New functions, types and enums Functions rasqal_literal* rasqal_new_numeric_literal_from_long(rasqal_world* world, rasqal_literal_type type, long value) int rasqal_query_has_variable2(rasqal_query* query, rasqal_variable_type type, const unsigned char *name) int rasqal_query_set_variable2(rasqal_query* query, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value) void rasqal_query_set_wildcard(rasqal_query* query, int wildcard) int rasqal_variables_table_add_variable(rasqal_variables_table* vt, rasqal_variable* variable) int rasqal_variables_table_contains(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name) rasqal_variable* rasqal_variables_table_get_by_name(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name) long rasqal_xsd_decimal_get_long(rasqal_xsd_decimal* dec, int* error_p)
Changes between Rasqal 0.9.27 and 0.9.28
New functions, types and enums Functions rasqal_expression* rasqal_new_4op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3, rasqal_expression* arg4)
Changes between Rasqal 0.9.28 and 0.9.29
New functions, types and enums Functions void rasqal_free_xsd_date(rasqal_xsd_date* d) rasqal_xsd_date* rasqal_new_xsd_date(rasqal_world* world, const char *date_string) rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_xsd_date(rasqal_world* world, rasqal_xsd_date *date) int rasqal_query_graph_pattern_visit2(rasqal_query* query, rasqal_graph_pattern_visit_fn visit_fn, void* data) char* rasqal_regex_replace(rasqal_world* world, raptor_locator* locator, const char* pattern, const char* regex_flags, const char* subject, size_t subject_len, const char* replace, size_t replace_len, size_t* result_len_p) int rasqal_xsd_date_compare(const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p) int rasqal_xsd_date_equals(const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p) char* rasqal_xsd_date_to_counted_string(const rasqal_xsd_date *d, size_t *len_p) char* rasqal_xsd_date_to_string(const rasqal_xsd_date *d) int rasqal_xsd_datetime_compare2(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p) int rasqal_xsd_datetime_equals2(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p) Types rasqal_xsd_date Enums RASQAL_EXPR_STRUUID - Expression for STRUUID() string UUID RASQAL_EXPR_UUID - Expression for UUID() UUID RASQAL_LITERAL_DATE - Date literal type
Changed functions and types
0.9.28 type 0.9.29 type Notes
rasqal_literal rasqal_literal Added date to value union.
rasqal_xsd_datetime rasqal_xsd_datetime Added time_on_timeline and have_tz fields.
Changes between Rasqal 0.9.29 and 0.9.30
New functions, types and enums Functions rasqal_literal* rasqal_new_floating_literal(rasqal_world *world, rasqal_literal_type type, double d)
Changes between Rasqal 0.9.30 and 0.9.31
New functions, types and enums Functions const char* rasqal_query_results_type_label(rasqal_query_results_type type)
Changes between Rasqal 0.9.32 and 0.9.33
New functions, types and enums Functions raptor_sequence* rasqal_graph_pattern_get_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern) char* rasqal_literal_get_language(rasqal_literal* l) rasqal_literal_type rasqal_literal_get_type(rasqal_literal* l) int rasqal_literal_is_rdf_literal(rasqal_literal* l) rasqal_query_results* rasqal_new_query_results_from_string(rasqal_world* world, rasqal_query_results_type type, raptor_uri* base_uri, const char* string, size_t string_len) int rasqal_variables_table_add2(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, size_t name_len, rasqal_literal *value) - Deprecates rasqal_variables_table_add() Types rasqal_triples_error_handler2 - Added for rasqal_variables_table_add2()
Renamed function and enums
0.9.32 function 0.9.33 function Notes
rasqal_query_results_formats_check rasqal_query_results_formats_check2 Correctly implements return value: non-0 if exists.
Changed functions and types
0.9.32 function 0.9.33 function Notes
rasqal_query_results* rasqal_new_query_results(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type, rasqal_variables_table* vars_table) rasqal_query_results* rasqal_new_query_results2(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type) Deprecates rasqal_new_query_results()
rasqal_data_graph* rasqal_new_data_graph_from_uri(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) rasqal_data_graph* rasqal_new_data_graph_from_uri(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) Made flags argument unsigned
rasqal_expression* rasqal_new_group_concat_expression(rasqal_world* world, int flags, raptor_sequence* args, rasqal_literal* separator) rasqal_expression* rasqal_new_group_concat_expression(rasqal_world* world, unsigned int flags, raptor_sequence* args, rasqal_literal* separator) Made flags argument unsigned
0.9.32 type 0.9.33 type Notes
rasqal_triples_source_factory rasqal_triples_source_factory API v3: Added init_triples_source2 handler field using rasqal_triples_error_handler2
Changes between Rasqal 0.9.30 and 0.9.30
New functions, types and enums Enums RASQAL_GRAPH_PATTERN_OPERATOR_VALUES - Graph pattern for VALUES()
rasqal-0.9.33/docs/rasqal-overrides.txt0000644000175000017500000000260112340722012014756 00000000000000 rasqal_world rasqal_world* world; rasqal_graph_pattern rasqal_graph_pattern* graph_pattern; rasqal_query rasqal_graph_query* query; rasqal_query_results rasqal_graph_query_results* query_results; rasqal_query_results_formatter rasqal_graph_query_results_formatter* query_results_formatter; rasqal_triples_match typedef struct { void *user_data; rasqal_triple_parts (*bind_match)(struct rasqal_triples_match_s* rtm, void *user_data, rasqal_variable *bindings[4], rasqal_triple_parts parts); void (*next_match)(struct rasqal_triples_match_s* rtm, void *user_data); int (*is_end)(struct rasqal_triples_match_s* rtm, void *user_data); void (*finish)(struct rasqal_triples_match_s* rtm, void *user_data); rasqal_world *world; } rasqal_triples_match; rasqal_triples_source typedef struct { rasqal_query* query; void *user_data; int (*init_triples_match)(rasqal_triples_match* rtm, struct rasqal_triples_source_s* rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t); int (*triple_present)(struct rasqal_triples_source_s* rts, void *user_data, rasqal_triple *t); void (*free_triples_source)(void *user_data); } rasqal_triples_source; rasqal-0.9.33/docs/rasqal.types0000644000175000017500000000000012443715253013307 00000000000000rasqal-0.9.33/docs/version.xml.in0000644000175000017500000000001212340722012013540 00000000000000@VERSION@ rasqal-0.9.33/docs/rasqal-changes.tsv0000644000175000017500000005236312443707542014412 00000000000000# OLD VERSIONOLD RETURNOLD NAMEOLD ARGSNEW VERSIONNEW RETURNNEW NAMENEW ARGSNOTES # OLD VERSIONtypeOLD NAME-NEW VERSIONtypeNEW NAME-NOTES # OLD VERSIONenumOLD NAME-NEW VERSIONtypeNEW NAME-NOTES # # Functions # 0.9.21 - - - 0.9.22 void rasqal_world_set_log_handler (rasqal_world* world, void *user_data, raptor_log_handler handler) - 0.9.21 int rasqal_world_set_generate_bnodeid_handler (rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler2 handler) 0.9.22 int rasqal_world_set_generate_bnodeid_handler (rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler) - 0.9.21 int rasqal_query_results_formats_enumerate (rasqal_world* world, unsigned int counter, const char **name, const char **label, const unsigned char **uri_string, const char **mime_type, int* flags) 0.9.22 const raptor_syntax_description* rasqal_world_get_query_results_format_description (rasqal_world* world, unsigned int counter) - 0.9.21 - - - 0.9.22 const char* rasqal_world_guess_query_results_format_name (rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier) - 0.9.21 void rasqal_query_set_fatal_error_handler (rasqal_query* query, void *user_data, raptor_message_handler handler) 0.9.22 - - - Replaced by rasqal_world_set_log_handler() 0.9.21 void rasqal_query_set_error_handler (rasqal_query* query, void *user_data, raptor_message_handler handler) 0.9.22 - - - Replaced by rasqal_world_set_log_handler() 0.9.21 void rasqal_query_set_warning_handler (rasqal_query* query, void *user_data, raptor_message_handler handler) 0.9.22 - - - Replaced by rasqal_world_set_log_handler() 0.9.21 void rasqal_query_set_default_generate_bnodeid_parameters (rasqal_query* rdf_query, char *prefix, int base) 0.9.22 int rasqal_world_set_default_generate_bnodeid_parameters (rasqal_world* world, char *prefix, int base) - 0.9.21 void rasqal_query_set_generate_bnodeid_handler (rasqal_query* query, void *user_data, rasqal_generate_bnodeid_handler handler) 0.9.22 int rasqal_world_set_generate_bnodeid_handler (rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler) - 0.9.21 int rasqal_query_add_data_graph (rasqal_query* query, raptor_uri* uri, raptor_uri* name_uri, int flags) 0.9.22 int rasqal_query_add_data_graph (rasqal_query* query, rasqal_data_graph* data_graph) - 0.9.21 int rasqal_query_add_data_graph2 (rasqal_query* query, rasqal_data_graph* data_graph) 0.9.22 int rasqal_query_add_data_graph (rasqal_query* query, rasqal_data_graph* data_graph) - 0.9.21 - - - 0.9.22 int rasqal_query_set_store_results (rasqal_query* query, int store_results) - 0.9.21 - - - 0.9.22 rasqal_query_results_type rasqal_query_get_result_type (rasqal_query* query) - 0.9.21 - - - 0.9.22 rasqal_query_results_type rasqal_query_results_get_type (rasqal_query_results* query_results) - 0.9.21 - - - 0.9.22 rasqal_row* rasqal_query_results_get_row_by_offset (rasqal_query_results* query_results, int result_offset) - 0.9.21 int rasqal_query_results_write (raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri) 0.9.22 int rasqal_query_results_write (raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri) - 0.9.21 int rasqal_query_results_write2 (raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri) 0.9.22 int rasqal_query_results_write (raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri) - 0.9.21 int rasqal_query_results_read (raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri) 0.9.22 int rasqal_query_results_read (raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri) - 0.9.21 int rasqal_query_results_read2 (raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri) 0.9.22 int rasqal_query_results_read (raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri) - 0.9.21 - - - 0.9.22 int rasqal_query_results_rewind (rasqal_query_results* query_results) - 0.9.21 int rasqal_query_results_formats_check (rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) 0.9.22 int rasqal_query_results_formats_check (rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type) - 0.9.21 int rasqal_query_results_formats_check2 (rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) 0.9.22 int rasqal_query_results_formats_check (rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type) - 0.9.21 rasqal_query_results_formatter* rasqal_new_query_results_formatter (rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) 0.9.22 rasqal_query_results_formatter* rasqal_new_query_results_formatter (rasqal_world* world, const char *name, raptor_uri* format_uri) - 0.9.21 rasqal_query_results_formatter* rasqal_new_query_results_formatter2 (rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) 0.9.22 rasqal_query_results_formatter* rasqal_new_query_results_formatter (rasqal_world* world, const char *name, raptor_uri* format_uri) - 0.9.21 rasqal_query_results_formatter* rasqal_new_query_results_formatter_by_mime_type (rasqal_world* world, const char *mime_type) 0.9.22 rasqal_query_results_formatter* rasqal_new_query_results_formatter_for_content (rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier) - 0.9.21 const char* rasqal_query_results_formatter_get_mime_type (rasqal_query_results_formatter *formatter) 0.9.22 - - - Use rasqal_world_get_query_results_format_description() to get list of mime types. 0.9.21 rasqal_data_graph* rasqal_new_data_graph (rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags) 0.9.22 rasqal_data_graph* rasqal_new_data_graph_from_uri (rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) - 0.9.21 rasqal_expression* rasqal_new_function_expression2 (rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags) 0.9.22 rasqal_expression* rasqal_new_function_expression (rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags) - 0.9.21 rasqal_expression* rasqal_new_function_expression (rasqal_world* world, raptor_uri* name, raptor_sequence* args) 0.9.22 rasqal_expression* rasqal_new_function_expression (rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags) - 0.9.21 rasqal_expression* rasqal_new_coalesce_expression (rasqal_world* world, raptor_sequence* args) 0.9.22 rasqal_expression* rasqal_new_expr_seq_expression (rasqal_world* world, rasqal_op op, raptor_sequence* args) Call it with op #RASQAL_EXPR_COALESCE 0.9.21 - - - 0.9.22 rasqal_literal* rasqal_new_datetime_literal_from_datetime (rasqal_world* world, rasqal_xsd_datetime* dt) - 0.9.21 - - - 0.9.22 const unsigned char* rasqal_literal_as_counted_string (rasqal_literal* l, size_t *len_p, int flags, int *error) - 0.9.21 rasqal_variable* rasqal_new_variable_typed (rasqal_query* rq, rasqal_variable_type type, unsigned char *name, rasqal_literal *value) 0.9.22 - - - Replaced by rasqal_variables_table_add2() 0.9.21 rasqal_variable* rasqal_new_variable (rasqal_query* rq, unsigned char *name, rasqal_literal *value) 0.9.22 - - - Replaced by rasqal_variables_table_add2() 0.9.21 - - - 0.9.22 rasqal_xsd_datetime* rasqal_new_xsd_datetime (rasqal_world* world, const char *datetime_string) - 0.9.21 - - - 0.9.22 rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_unixtime (rasqal_world* world, time_t secs) - 0.9.21 - - - 0.9.22 rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_timeval (rasqal_world* world, struct timeval *tv) - 0.9.21 - - - 0.9.22 void rasqal_free_xsd_datetime (rasqal_xsd_datetime* dt) - 0.9.21 - - - 0.9.22 char* rasqal_xsd_datetime_to_counted_string (const rasqal_xsd_datetime *dt, size_t *len_p) - 0.9.21 - - - 0.9.22 char* rasqal_xsd_datetime_to_string (const rasqal_xsd_datetime *dt) - 0.9.21 - - - 0.9.22 int rasqal_xsd_datetime_equals (const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2) - 0.9.21 - - - 0.9.22 int rasqal_xsd_datetime_compare (const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2) - 0.9.21 - - - 0.9.22 rasqal_xsd_decimal* rasqal_xsd_datetime_get_seconds_as_decimal (rasqal_world* world, rasqal_xsd_datetime* dt) - 0.9.21 - - - 0.9.22 int rasqal_xsd_datetime_set_from_timeval (rasqal_xsd_datetime *dt, struct timeval *tv) - 0.9.21 - - - 0.9.22 int rasqal_xsd_datetime_set_from_unixtime (rasqal_xsd_datetime* dt, time_t clock) - 0.9.21 - - - 0.9.22 time_t rasqal_xsd_datetime_get_as_unixtime (rasqal_xsd_datetime* dt) - 0.9.21 - - - 0.9.22 struct timeval* rasqal_xsd_datetime_get_as_timeval (rasqal_xsd_datetime *dt) - 0.9.21 - - - 0.9.22 char* rasqal_xsd_datetime_get_timezone_as_counted_string (rasqal_xsd_datetime *dt, size_t *len_p) - 0.9.22 - - - 0.9.23 raptor_sequence* rasqal_graph_pattern_get_flattened_triples (rasqal_query* query, rasqal_graph_pattern* graph_pattern) - 0.9.23 - - - 0.9.24 raptor_sequence* rasqal_graph_pattern_get_flattened_triples (rasqal_query* query, rasqal_graph_pattern* graph_pattern) - 0.9.24 - - - 0.9.25 char* rasqal_xsd_datetime_get_tz_as_counted_string (rasqal_xsd_datetime* dt, size_t *len_p) - 0.9.24 - - - 0.9.25 int rasqal_xsd_decimal_abs (rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) - 0.9.24 - - - 0.9.25 int rasqal_xsd_decimal_round (rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) - 0.9.24 - - - 0.9.25 int rasqal_xsd_decimal_ceil (rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) - 0.9.24 - - - 0.9.25 int rasqal_xsd_decimal_floor (rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) - 0.9.24 - - - 0.9.25 rasqal_evaluation_context* rasqal_new_evaluation_context (rasqal_world* world, raptor_locator* locator, int flags) - 0.9.24 - - - 0.9.25 void rasqal_free_evaluation_context (rasqal_evaluation_context* eval_context) - 0.9.24 - - - 0.9.25 int rasqal_evaluation_context_set_base_uri (rasqal_evaluation_context* eval_context, raptor_uri *base_uri) - 0.9.24 - - - 0.9.25 int rasqal_evaluation_context_set_rand_seed (rasqal_evaluation_context* eval_context, unsigned int seed) - 0.9.24 - - - 0.9.25 rasqal_literal* rasqal_expression_evaluate2 (rasqal_expression *e, rasqal_evaluation_context* eval_context, int *error_p) - 0.9.24 - - - 0.9.25 const raptor_syntax_description* rasqal_world_get_query_language_description (rasqal_world* world, unsigned int counter) - 0.9.25 - - - 0.9.26 int rasqal_world_set_warning_level (rasqal_world* world, unsigned int warning_level) - 0.9.26 - - - 0.9.27 rasqal_literal* rasqal_new_numeric_literal_from_long (rasqal_world* world, rasqal_literal_type type, long value) - 0.9.26 - - - 0.9.27 long rasqal_xsd_decimal_get_long (rasqal_xsd_decimal* dec, int* error_p) - 0.9.26 - - - 0.9.27 void rasqal_query_set_wildcard (rasqal_query* query, int wildcard) - 0.9.26 - - - 0.9.27 int rasqal_query_has_variable2 (rasqal_query* query, rasqal_variable_type type, const unsigned char *name) - 0.9.26 - - - 0.9.27 int rasqal_query_set_variable2 (rasqal_query* query, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value) - 0.9.26 - - - 0.9.27 int rasqal_variables_table_add_variable (rasqal_variables_table* vt, rasqal_variable* variable) - 0.9.26 - - - 0.9.27 rasqal_variable* rasqal_variables_table_get_by_name (rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name) - 0.9.26 - - - 0.9.27 int rasqal_variables_table_contains (rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name) - 0.9.27 - - - 0.9.28 rasqal_expression* rasqal_new_4op_expression (rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3, rasqal_expression* arg4) - 0.9.28 - - - 0.9.29 rasqal_xsd_date* rasqal_new_xsd_date (rasqal_world* world, const char *date_string) - 0.9.28 - - - 0.9.29 void rasqal_free_xsd_date (rasqal_xsd_date* d) - 0.9.28 - - - 0.9.29 char* rasqal_xsd_date_to_counted_string (const rasqal_xsd_date *d, size_t *len_p) - 0.9.28 - - - 0.9.29 char* rasqal_xsd_date_to_string (const rasqal_xsd_date *d) - 0.9.28 - - - 0.9.29 int rasqal_xsd_date_equals (const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p) - 0.9.28 - - - 0.9.29 int rasqal_xsd_date_compare (const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p) - 0.9.28 - - - 0.9.29 rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_xsd_date (rasqal_world* world, rasqal_xsd_date *date) - 0.9.28 - - - 0.9.29 int rasqal_xsd_datetime_compare2 (const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p) - 0.9.28 - - - 0.9.29 int rasqal_xsd_datetime_equals2 (const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p) - 0.9.28 - - - 0.9.29 int rasqal_query_graph_pattern_visit2 (rasqal_query* query, rasqal_graph_pattern_visit_fn visit_fn, void* data) - 0.9.28 - - - 0.9.29 char* rasqal_regex_replace (rasqal_world* world, raptor_locator* locator, const char* pattern, const char* regex_flags, const char* subject, size_t subject_len, const char* replace, size_t replace_len, size_t* result_len_p) - 0.9.29 - - - 0.9.30 rasqal_literal* rasqal_new_floating_literal (rasqal_world *world, rasqal_literal_type type, double d) - 0.9.30 - - - 0.9.31 const char* rasqal_query_results_type_label (rasqal_query_results_type type) - 0.9.32 - - - 0.9.33 int rasqal_variables_table_add2 (rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, size_t name_len, rasqal_literal *value) Deprecates rasqal_variables_table_add() 0.9.32 - - - 0.9.33 rasqal_query_results* rasqal_new_query_results_from_string (rasqal_world* world, rasqal_query_results_type type, raptor_uri* base_uri, const char* string, size_t string_len) - 0.9.32 int rasqal_query_results_formats_check (rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) 0.9.33 int rasqal_query_results_formats_check2 (rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) Correctly implements return value: non-0 if exists. 0.9.32 - - - 0.9.33 raptor_sequence* rasqal_graph_pattern_get_triples (rasqal_query* query, rasqal_graph_pattern* graph_pattern) - 0.9.32 rasqal_query_results* rasqal_new_query_results (rasqal_world* world, rasqal_query* query, rasqal_query_results_type type, rasqal_variables_table* vars_table) 0.9.33 rasqal_query_results* rasqal_new_query_results2 (rasqal_world* world, rasqal_query* query, rasqal_query_results_type type) Deprecates rasqal_new_query_results() 0.9.32 - - - 0.9.33 rasqal_literal_type rasqal_literal_get_type (rasqal_literal* l) - 0.9.32 - - - 0.9.33 char* rasqal_literal_get_language (rasqal_literal* l) - 0.9.32 - - - 0.9.33 int rasqal_literal_is_rdf_literal (rasqal_literal* l) - 0.9.32 rasqal_data_graph* rasqal_new_data_graph_from_uri (rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) 0.9.33 rasqal_data_graph* rasqal_new_data_graph_from_uri (rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) Made flags argument unsigned 0.9.32 rasqal_expression* rasqal_new_group_concat_expression (rasqal_world* world, int flags, raptor_sequence* args, rasqal_literal* separator) 0.9.33 rasqal_expression* rasqal_new_group_concat_expression (rasqal_world* world, unsigned int flags, raptor_sequence* args, rasqal_literal* separator) Made flags argument unsigned # # Types # 0.9.21 type rasqal_generate_bnodeid_handler2 - 0.9.22 type rasqal_generate_bnodeid_handler - Handler now takes a pointer to the #rasqal_world object not #rasqal_query. 0.9.21 type rasqal_data_graph - 0.9.22 type rasqal_data_graph - Added const for format_type and format_name fields. 0.9.21 type - - 0.9.22 type rasqal_xsd_datetime - - 0.9.21 type rasqal_literal - 0.9.22 type rasqal_literal - Added datetime to value union. 0.9.23 type - - 0.9.24 type rasqal_update_graph_applies - Specifies scope that a #rasqal_update applies to 0.9.24 type - - 0.9.25 type rasqal_evaluation_context - Evaluation context for rasqal_expression_evaluate2() 0.9.28 type - - 0.9.29 type rasqal_xsd_date - - 0.9.28 type rasqal_literal - 0.9.29 type rasqal_literal - Added date to value union. 0.9.28 type rasqal_xsd_datetime - 0.9.29 type rasqal_xsd_datetime - Added time_on_timeline and have_tz fields. 0.9.32 type rasqal_triples_source_factory - 0.9.33 type rasqal_triples_source_factory - API v3: Added init_triples_source2 handler field using #rasqal_triples_error_handler2 0.9.32 type - - 0.9.33 type rasqal_triples_error_handler2 - Added for rasqal_variables_table_add2() # # Enums # #0.9.21 enum oldenumvalueor- - 0.9.22 enum newenumvalueor- - Note 0.9.21 enum - - 0.9.22 enum RASQAL_XSD_DATETIME_NO_TZ - Sentinel XSD Decimal timezone value indicating no timezone is present. 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_YEAR - Expression for SPARQL 1.1 YEAR(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_MONTH - Expression for SPARQL 1.1 MONTH(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_DAY - Expression for SPARQL 1.1 DAY(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_HOURS - Expression for SPARQL 1.1 HOURS(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_MINUTES - Expression for SPARQL 1.1 MINUTES(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_SECONDS - Expression for SPARQL 1.1 SECONDS(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_TIMEZONE - Expression for SPARQL 1.1 TIMEZONE(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_CURRENT_DATETIME - Expression for LAQRS CURRENT_DATETIME( void ) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_NOW - Expression for LAQRS NOW( void ) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_FROM_UNIXTIME - Expression for LAQRS FROM_UNIXTIME(int) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_TO_UNIXTIME - Expression for LAQRS TO_UNIXTIME(datetime) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_CONCAT - Expression for SPARQL 1.1 CONCAT(strings) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_STRLEN - Expression for SPARQL 1.1 STRLEN(str) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_SUBSTR - Expression for SPARQL 1.1 SUBSTR(str, start[,offset]) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_UCASE - Expression for SPARQL 1.1 UCASE(str) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_LCASE - Expression for SPARQL 1.1 LCASE(str) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_STRSTARTS - Expression for SPARQL 1.1 STRSTARTS(str, str) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_STRENDS - Expression for SPARQL 1.1 STRENDS(str, str) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_CONTAINS - Expression for SPARQL 1.1 CONTAINS(str, str) 0.9.21 enum - - 0.9.22 enum RASQAL_EXPR_ENCODE_FOR_URI - Expression for SPARQL 1.1 ENCODE_FOR_URI(str) 0.9.21 enum - - 0.9.22 enum RASQAL_QUERY_RESULTS_UNKNOWN - Unknown result format type 0.9.21 enum - - 0.9.22 enum RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER - Bitflag for rasqal_query_results_formats_check() to request formats that can be read. 0.9.21 enum - - 0.9.22 enum RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER - Bitflag for rasqal_query_results_formats_check() to request formats that can be written. 0.9.23 enum - - 0.9.24 enum RASQAL_UPDATE_TYPE_ADD - SPARQL 1.1 Update ADD operation 0.9.23 enum - - 0.9.24 enum RASQAL_UPDATE_TYPE_MOVE - SPARQL 1.1 Update MOVE operation 0.9.23 enum - - 0.9.24 enum RASQAL_UPDATE_TYPE_COPY - SPARQL 1.1 Update COPY operation 0.9.24 enum - - 0.9.25 enum RASQAL_EXPR_ABS - Expression for SPARQL 1.1 ABS(numeric) 0.9.24 enum - - 0.9.25 enum RASQAL_EXPR_ROUND - Expression for SPARQL 1.1 ROUND(numeric) 0.9.24 enum - - 0.9.25 enum RASQAL_EXPR_CEIL - Expression for SPARQL 1.1 CEIL(numeric) 0.9.24 enum - - 0.9.25 enum RASQAL_EXPR_FLOOR - Expression for SPARQL 1.1 FLOOR(numeric) 0.9.24 enum - - 0.9.25 enum RASQAL_EXPR_RAND - Expression for SPARQL 1.1 RAND() 0.9.24 enum - - 0.9.25 enum RASQAL_EXPR_TZ - Expression for SPARQL 1.1 TZ(datetime) timezone accessor 0.9.25 enum - - 0.9.26 enum RASQAL_EXPR_MD5 - Expression for SPARQL 1.1 MD5(literal) message digest 0.9.25 enum - - 0.9.26 enum RASQAL_EXPR_SHA1 - Expression for SPARQL 1.1 SHA1(literal) message digest 0.9.25 enum - - 0.9.26 enum RASQAL_EXPR_SHA224 - Expression for SPARQL 1.1 SHA224(literal) message digest 0.9.25 enum - - 0.9.26 enum RASQAL_EXPR_SHA256 - Expression for SPARQL 1.1 SHA256(literal) message digest 0.9.25 enum - - 0.9.26 enum RASQAL_EXPR_SHA384 - Expression for SPARQL 1.1 SHA384(literal) message digest 0.9.25 enum - - 0.9.26 enum RASQAL_EXPR_SHA512 - Expression for SPARQL 1.1 SHA512(literal) message digest 0.9.28 enum - - 0.9.29 enum RASQAL_LITERAL_DATE - Date literal type 0.9.28 enum - - 0.9.29 enum RASQAL_EXPR_STRUUID - Expression for STRUUID() string UUID 0.9.28 enum - - 0.9.29 enum RASQAL_EXPR_UUID - Expression for UUID() UUID 0.9.30 enum - - 0.9.30 enum RASQAL_GRAPH_PATTERN_OPERATOR_VALUES - Graph pattern for VALUES() rasqal-0.9.33/ChangeLog.60000644000175000017500000042434111304557656011754 000000000000002008-12-30 Dave Beckett * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_set_origin): Just set the origin; do not touch all the triples with the origin literal, that's for the query engine to do at some point. See rasqal_query_engine_1_set_origin_triples() for QE#1 where the old triple origin-setting code moved. * src/sparql_parser.y: (GraphGraphPattern): Construct a GP for a GRAPH saving the literal as the origin. * src/rasqal_algebra.c, src/rasqal_internal.h: Added RASQAL_ALGEBRA_OPERATOR_GRAPH. (rasqal_new_graph_algebra_node): Added to use RASQAL_ALGEBRA_OPERATOR_GRAPH (rasqal_algebra_algebra_node_write_internal): Updated to print graph literal. (rasqal_algebra_graph_graph_pattern_to_algebra): Added to use graph pattern origin to make a new graph algebra node over the inner single graph pattern. (rasqal_algebra_graph_pattern_to_algebra): Call the above. * src/rasqal_internal.h, src/rasqal_rowsource.c: Added typedef rasqal_rowsource_visit_fn. (rasqal_rowsource_visit): Added to walk rowsource tree using rasqal_rowsource_get_inner_rowsource. 2008-11-30 Lauri Aalto * src/rasqal_query.c: (rasqal_query_dataset_contains_named_graph): Fixed for raptor v2 2008-11-30 Dave Beckett * src/rasqal_internal.h: Added rasqal_rowsource_ensure_variables prototype * src/rasqal_internal.h: Fix source file names for rowsources * src/rasqal.h, src/rasqal_query.c: (rasqal_query_dataset_contains_named_graph): Added. * src/rasqal_graph_pattern.c, src/rasqal_internal.h: rasqal_graph_pattern gains origin field (rasqal_free_graph_pattern): Free it if set. Uppercase grpah pattern operator labels in rasqal_graph_pattern_operator_labels for easier reading. (rasqal_graph_pattern_write_internal): Print out GP origin if set. * src/rasqal_query_transform.c: (rasqal_graph_patterns_join): Handle merging GRAPH patterns with an origin 2008-11-26 Lauri Aalto * src/rasqal_rowsource.c: (rasqal_rowsource_read_row): casts for c++ 2008-11-16 Dave Beckett * src/rasqal_raptor.c: code style. replace all strcpy() with strncpy() 2008-11-15 Dave Beckett * src/rasqal_graph.c: docs * src/rasqal_graph.c: terminology - use dataset not graph * src/rasqal_graph.c: Add functions to enumerate and alter the dataset of graphs * src/rasqal_graph.c: more api thoughts in code form 2008-11-14 Dave Beckett * src/rasqal_graph.c, src/rasqal_internal.h: Add tentative graph API to replace rasqal_triples_source_factory, rasqal_triples_source, rasqal_triple_meta and rasqal_triples_match maybe. 2008-11-12 Dave Beckett * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource.c: Add simple printing out of rowsource query plan structure. (rasqal_rowsource_write_indent, rasqal_rowsource_write_internal): Added (rasqal_rowsource_write): Added using rasqal_rowsource_write_internal. (rasqal_rowsource_print): Added using rasqal_rowsource_write. * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c: Added get_inner_rowsource factory method for rasqal_rowsource_handler. This allows walking the tree of rowsources aka query execution plan. (rasqal_rowsource_get_inner_rowsource): Added. * src/rasqal_internal.h: docs 2008-11-09 Dave Beckett * src/rasqal_internal.h: Delete unused fields from struct rasqal_query_s * src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_triples.c: Replace query->world with rowsource->world * src/rasqal_engine.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_sparql_xml.c: Add world from struct rasqal_rowsource_s. Add world arg to all rowsource constructors. (rasqal_new_rowsource_from_handler): Add world arg (rasqal_rowsource_get_query): Deleted, never used. * src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c: Remove query from rowsource context, use rowsource->query * src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_internal.h, src/rasqal_query_transform.c, src/rasqal_rowsource.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_sparql_xml.c: Add query to the rasqal_rowsource structure. Remove the get_query method from the rowsource handler and typedef rasqal_rowsource_get_query_func . (rasqal_sort_rowsource_get_query, rasqal_union_rowsource_get_query, rasqal_empty_rowsource_get_query, rasqal_rowsequence_rowsource_get_query, rasqal_project_rowsource_get_query, rasqal_triples_rowsource_get_query, rasqal_rowsource_engine_get_query): Deleted the get_query method from all rowsources. Replace rasqal_expression_evaluate calls with rasqal_expression_evaluate_v2. * src/rasqal.h, src/rasqal_expr.c: (rasqal_expression_evaluate_strmatch): Replace query with world and locator args and call rasqal_expression_evaluate_v2. (rasqal_expression_evaluate_v2): Take world and locator args. (rasqal_expression_evaluate): Call rasqal_expression_evaluate_v2. Deprecate rasqal_expression_evaluate for rasqal_expression_evaluate_v2. * src/rasqal_internal.h: docs 2008-11-07 Dave Beckett * configure.ac: Require raptor 1.4.18 for raptor_sequence_delete_at (at least) * configure.ac: handle empty LEX in test * src/rasqal_rowsource.c: (rasqal_rowsource_read_row): Use raptor_sequence_delete_at to delete/return. * src/rasqal_internal.h, src/rasqal_rowsource.c: struct rasqal_rowsource_s gains rows_sequence and offset vars for storing a sequence of rows in order to generate them 1-by-1. (rasqal_rowsource_read_row): Use rows_sequence and offset above with method rasqal_rowsource_read_all_rows() to convert a sequence of results into an incremental one. 2008-11-05 Dave Beckett * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_read_row): declare i outside debug ifdef * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c: Add set_preserve method to rasqal_rowsource_handler with typedef rasqal_rowsource_set_preserve_func. (rasqal_rowsource_set_preserve): Added (rasqal_filter_rowsource_set_preserve, rasqal_union_rowsource_set_preserve, rasqal_project_rowsource_set_preserve, rasqal_join_rowsource_set_preserve): Added to pass on the set_preserve call to inner rowsource(s). Added preserve_on_all_finished to rasqal_triples_rowsource_context. (rasqal_triples_rowsource_finish): Reset column triple meta. (rasqal_triples_rowsource_get_next_row): Do not trigger reset when last match found if con->preserve_on_all_finished set. (rasqal_triples_rowsource_set_preserve): Set preserve flag. (rasqal_join_rowsource_init): Set preserve flag on inner rowsources. * src/rasqal_rowsource.c: (rasqal_rowsource_read_row): Add debug print of read row * src/rasqal_rowsource_join.c: oops * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_init): Check for constant join expressions and optimize them away if constant and true or false. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_read_row): get vars from rowsource by offset. Replace rasqal_row_set_values_from_variables_table with loop to set row values from variables in rowsource by offset , not in variables table by offset. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_init): Calculate rowsize con->size from columns (rasqal_new_triples_rowsource): Remove initing rowsize from query fields, let rasqal_triples_rowsource_init do it later. * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_triples.c: rasqal_triples_rowsource_context gains declared_in array. (rasqal_triples_rowsource_init): Use passed-in declared_in array rather than make one locally. (rasqal_new_triples_rowsource): Add declared_in parameter. (main): Update test to new calling convention. (rasqal_algebra_basic_algebra_node_to_rowsource): Update to create declared_in and pass it in to rasqal_new_triples_rowsource. * src/rasqal_rowsource_triples.c: Remove new_bindings_count from rasqal_triples_rowsource_context - not used. Removed resets return value variable. 2008-11-02 Dave Beckett * tests/algebra/test-01.out, tests/algebra/test-02.out, tests/algebra/test-03.out, tests/algebra/test-04.out, tests/algebra/test-05.out, tests/algebra/test-06.out, tests/algebra/test-07.out, tests/algebra/test-08.out, tests/algebra/test-09.out: Add Project() to outer scope of all expected results 2008-11-01 Dave Beckett * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_ensure_variables): Allow projecting variables not in input - allowable for cases with optionals. Warn about it when debugging for now. (rasqal_project_rowsource_read_row): Handle projecting variables with no value for optionals. * src/rasqal_rowsource_union.c: (rasqal_union_rowsource_ensure_variables): Allocate array of ints not bytes for right_map * src/rasqal_rowsource_join.c: (rasqal_join_rowsource_ensure_variables): Allocate array of ints not bytes for right_map (rasqal_join_rowsource_build_merged_row): Extra debug info 2008-10-30 Dave Beckett * src/rasqal_engine_algebra.c: (rasqal_algebra_leftjoin_algebra_node_to_rowsource): Added. (rasqal_algebra_node_to_rowsource): Use above to handle LEFTJOIN * src/rasqal_internal.h, src/rasqal_rowsource_join.c: (rasqal_new_join_rowsource): Take join type and join expression. Only support join type 0 - left outer join today 2008-10-29 Dave Beckett * src/rasqal_engine_algebra.c: (rasqal_algebra_project_algebra_node_to_rowsource): Added. (rasqal_algebra_node_to_rowsource): Use rasqal_algebra_project_algebra_node_to_rowsource to convert project algebra nodes. * src/rasqal_algebra.c: (rasqal_new_project_algebra_node): Added (rasqal_free_algebra_node): Free vars_seq. (rasqal_algebra_algebra_node_write_internal): Print project vars. (rasqal_algebra_query_to_algebra): Use rasqal_new_project_algebra_node to add a PROJECT node at the top of every query to select the right variables. * src/rasqal_internal.h: rasqal_algebra_node_s gains vars_seq * src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c: Implement rowsource reset functions (rasqal_filter_rowsource_reset, rasqal_union_rowsource_reset, rasqal_project_rowsource_reset, rasqal_triples_rowsource_reset): Added. (rasqal_join_rowsource_reset): Updated to reset and reset internal rowsources. * src/rasqal_rowsource.c: (rasqal_rowsource_reset): Return 0 if no handler present - it may not be needed. * src/Makefile.am, src/rasqal_rowsource_join.c: Added join rowsource. (rasqal_new_join_rowsource): Added join rowsource constructor. * src/rasqal_rowsource_rowsequence.c: Implement reset method via rasqal_rowsequence_rowsource_reset (rasqal_rowsequence_rowsource_read_row): Copy rows to return them. (rasqal_rowsequence_rowsource_read_all_rows): Create new sequence to return it. (rasqal_rowsequence_rowsource_reset): Added. * src/rasqal_internal.h, src/rasqal_rowsource.c: (rasqal_rowsource_reset): Added. rasqal_rowsource_reset_func added * src/rasqal_rowsource_project.c: (rasqal_project_rowsource_ensure_variables): Fix offset vars (main): Make test use non-trivial projection. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_rowsource_project.c: Added project (variables projection) rowsource (rasqal_new_project_rowsource): Added new project rowsource constructor. 2008-10-28 Dave Beckett * src/rasqal_engine_algebra.c: (rasqal_algebra_union_algebra_node_to_rowsource): Added to use union rowsource to execute UNION. (rasqal_algebra_node_to_rowsource): Call above for UNION operator. * src/rasqal_rowsource_union.c: Union rowsource now works. Constructs a map for moving variable offsets from right rowsource into results via con->right_map. (rasqal_union_rowsource_ensure_variables): Construct map while adding variables from right row to result rowsource. (rasqal_union_rowsource_adjust_right_row): Added to do right row variable offset fixing for a row. (rasqal_union_rowsource_read_row): Expand output row sizes and adjust offsets if needed. Assign output rowsource and correct offset. (rasqal_union_rowsource_read_all_rows): Transform left and right input rowsequences for correct size, offsets, rowsource. Use rasqal_union_rowsource_adjust_right_row to adjust right row orders (main): Update tests to use non-square tables to ensure no confusion of row/columns * src/rasqal_internal.h, src/rasqal_rowsource_rowsequence.c: Add vars_seq to context. (rasqal_rowsequence_rowsource_init): Adjust offset of all rows. (rasqal_rowsequence_rowsource_ensure_variables): Add variables from input variables sequence. (rasqal_new_rowsequence_rowsource) Now takes in variables sequence for handling rowsources that share variables. (main): Update tests to new calling convention and vars_seq. * src/rasqal_internal.h, src/rasqal_rowsource.c: (rasqal_rowsource_add_variable): Return offset to var and <0 on failure. (rasqal_rowsource_print_row_sequence): Added for debugging. (rasqal_rowsource_print_header): Added called by above * src/rasqal_internal.h, src/rasqal_row.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_union.c: (rasqal_new_row_for_size): Renamed from rasqal_new_row_for_variables and now with a size arg. (rasqal_new_row_sequence): Add out parameter vars_seq_p to return variables sequence in order declared.. 2008-10-27 Dave Beckett * src/rasqal_internal.h, src/rasqal_row.c: (rasqal_row_expand_size): Added to expand a row when it gets combined with others * src/rasqal_rowsource_union.c: Union rowsource proper test case with 2 rowsources that return data. Returns correct counts. * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_union.c: (rasqal_rowsource_add_variable): Get int return value to indicate when a dup variable was not stored. (rasqal_rowsource_copy_variables): Do not reset dest size to 0. (rasqal_filter_rowsource_ensure_variables, rasqal_sort_rowsource_ensure_variables): Set dest rowsource size to 0. (rasqal_union_rowsource_ensure_variables): Copy in variables from both sub-rowsources. * src/rasqal_row.c: autodocs * src/rasqal_rowsource.c: (rasqal_rowsource_copy_variables): Ensure dest size is correct. autodocs. * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_sort.c: (rasqal_rowsource_copy_variables): Added to copy variables from one rowsource into another. (rasqal_filter_rowsource_ensure_variables, rasqal_sort_rowsource_ensure_variables): Use to set up variable projection sequence from inner rowsource. 2008-10-27 Lauri Aalto * src/rasqal_engine.c: (rasqal_rowsource_engine_process): Check for rasqal_row_set_order_size() failure * src/rasqal_variable.c: (rasqal_new_variables_table): Set usage count earlier so that tidying with rasqal_free_variables_table() works. * src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_query.c, src/rasqal_query_transform.c: whitespace 2008-10-26 Dave Beckett * Checkpoint in query engine refactoring. SVN 14834 at 2008-10-26 22:28:24 -0700 (Sun, 26 Oct 2008) A top level 'make check' passes at this SVN commit. * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_triples.c, src/rasqal_sparql_xml.c: Restore variables_sequence to rowsource for use as the projected variables from the variables table. (rasqal_new_rowsequence_rowsource): add all named variables using rasqal_rowsource_add_variable. (rasqal_rowsource_add_variable): Added/reverted. (rasqal_sparql_xml_sax2_start_element_handler): Use rasqal_rowsource_add_variable after rasqal_variables_table_add creates the variable, to add it to the projection. (rasqal_triples_rowsource_init): Use rasqal_query_triples_build_declared_in to initialise projected variables in rowsource->variables_sequence. (rasqal_new_rowsource_from_handler, rasqal_free_rowsource): Restore initialise/free of variables_sequence. (rasqal_rowsource_get_variable_by_offset, rasqal_rowsource_get_variable_offset_by_name): Use variables_sequence to walk the variables associated with the row, not the variables table. * src/rasqal_query_transform.c: Document what declared_in functions are for and revert so that they are marked in graph pattern order, for query->variables_declared_in. use. (rasqal_query_triples_build_declared_in_internal): Added, from part of rasqal_query_build_declared_in. (rasqal_query_triples_build_declared_in): Added as internal function for calculating declared_in for a sequence of triples. (rasqal_query_graph_pattern_build_declared_in): Added/reverted to calculate it recursively in graph pattern order. (rasqal_query_build_declared_in): Reverted to do all the work for a query graph pattern. (rasqal_query_prepare_common): Use new rasqal_query_build_declared_in form. 2008-10-25 Dave Beckett * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_init): tidy * src/rasqal_query_transform.c: (rasqal_query_graph_pattern_build_declared_in_variable): Deleted. (rasqal_query_graph_pattern_build_declared_in): Deleted. (rasqal_query_build_declared_in): Comments and work on all triples in a column range. (rasqal_query_check_unused_variables): Added to just do checking and warning. (rasqal_query_prepare_common): Call rasqal_query_build_declared_in and rasqal_query_check_unused_variables * src/rasqal_algebra.c: code style * src/rasqal_variable.c: code style * src/rasqal_query_transform.c: code style * src/rasqal_engine_algebra.c: code style * src/rasqal_engine.c: code style * src/rasqal_rowsource_union.c: code style * src/rasqal_rowsource_union.c: code style * src/rasqal_rowsource_triples.c: code style * src/rasqal_rowsource_sort.c: code style * src/rasqal_rowsource_empty.c: code style * src/rasqal_rowsource_filter.c: ws * src/rasqal_engine_sort.c: ws * src/rasqal_internal.h: rasqal_rowsource docs * src/rasqal_rowsource.c: code style * src/rasqal_query_results.c: update internal docs * src/rasqal_row.c: code style * tests/engine/rasqal_order_test.c: check arg failure before run * tests/engine/rasqal_graph_test.c: check arg failure before run * src/rasqal_query.c: code style * src/rasqal_query_results.c: code style * utils/srxread.c: Update to new rasqal_new_query_results args * src/rasqal_sparql_xml.c: (rasqal_sparql_xml_sax2_end_element_handler): Set variables count/size as soon as possible so that rasqal_new_row() works properly. (rasqal_query_results_get_rowsource_sparql_xml): Now takes variables table arg and sets it internally rather than making a new one. * src/rasqal_result_formats.c: (rasqal_query_results_formatter_read): Pass in variables table from result set when reading results from syntax * src/rasqal_internal.h: rasqal_query_results_get_rowsource_func now has a vars_table arg to write new variables found (read from syntax) into. Added rasqal_query_results_get_variables_table * src/rasqal_query_results.c: (rasqal_new_query_results): autodocs (rasqal_query_results_get_row_from_saved): Handle NULL query (rasqal_query_results_ensure_have_row_internal): Handle NULL execution factory. (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Fail with result set with NULL query. (rasqal_query_results_add_row): Tidy. (rasqal_query_results_execute_and_store_results): Handle being run with NULL query. (rasqal_query_results_get_variables_table): Added. 2008-10-24 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_make_rowsource): Update rasqal_new_rowsource_from_handler call * src/rasqal_sparql_xml.c: rasqal_rowsource_sparql_xml_context gains a vars_table field (rasqal_sparql_xml_sax2_start_element_handler): Add new variable direct to variables table. Use rasqal_rowsource_get_variable_offset_by_name to get offset and rasqal_variables_table_get_named_variables_count to get count. (rasqal_rowsource_sparql_xml_finish): Call rasqal_free_variables_table (rasqal_query_results_get_rowsource_sparql_xml): Create new variables table. * src/rasqal_rowsource_union.c: (rasqal_new_union_rowsource): fail on NULL query, triples_source or triples. Update rasqal_new_rowsource_from_handler call (main): Update test to allocate real world and query objects * src/rasqal_rowsource_triples.c: (rasqal_new_triples_rowsource): fail on NULL query, triples_source or triples. Update rasqal_new_rowsource_from_handler call (main): Update test to allocate real query object * src/rasqal_rowsource_sort.c: (rasqal_new_sort_rowsource): Update rasqal_new_rowsource_from_handler call * src/rasqal_rowsource_rowsequence.c: (rasqal_new_rowsequence_rowsource): Update rasqal_new_rowsource_from_handler call Do not copy variables but use rasqal_variables_table_get_named_variables_count to get row size. (main): Update test to allocate real world and query objects. * src/rasqal_rowsource_filter.c: (rasqal_new_filter_rowsource): fail on NULL query, rowsource or expr. Update rasqal_new_rowsource_from_handler call * src/rasqal_rowsource_empty.c: (rasqal_new_empty_rowsource): fail on NULL query Update rasqal_new_rowsource_from_handler call (main): Update test to allocate real world and query objects. * src/rasqal_internal.h: rasqal_rowsource has a variables table to replace a variables sequence rasqal_new_rowsource_from_handler prototype gains variables table arg rasqal_rowsource_add_variable prototype deleted. rasqal_rowsource_get_variable_offset_by_name has unsigned name * src/rasqal_rowsource.c: (rasqal_new_rowsource_from_handler): Add variables table arg to store variables, shared with other objects such as query/query_results. (rasqal_free_rowsource): Free variables table (rasqal_rowsource_add_variable): Deleted, not needed. (rasqal_rowsource_get_variable_by_offset): Just call rasqal_variables_table_get. (rasqal_rowsource_get_variable_offset_by_name): Just call rasqal_variables_table_get_by_name * src/rasqal_engine.c: (rasqal_engine_make_rowsource): Protect NULL order_conditions_sequence * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_ensure_variables): Do not set order_size * src/rasqal_rowsource.c: (rasqal_new_rowsource_from_handler): Note no @flags have been defined. * src/rasqal_engine.c: (rasqal_rowsource_engine_ensure_variables): Do not set order_size, gone. (rasqal_engine_make_rowsource): Do not use flags for creating rowsource, not needed and none defined now. * src/rasqal_internal.h: Add flags arg back to rasqal_new_rowsource_from_handler but do not use it. * src/rasqal_internal.h: Remove flags from rowsource. * src/rasqal_internal.h: Remove order_size from rowsource. No need for RASQAL_ROWSOURCE_FLAGS_ORDERING flags for rasqal_new_rowsource_from_handler * src/rasqal_engine.c: Calculate order_size once for inner rowsource. (rasqal_rowsource_engine_process): Update row size if needed. (rasqal_rowsource_engine_ensure_variables): Set rowsource order size from context. (rasqal_engine_make_rowsource): Calculate order_size here. * src/rasqal_internal.h, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c: Remove order_size from rowsource - no longer needed, the sort rowsource or other sorting code stores this in row or context. (rasqal_new_row): Use rasqal_rowsource_get_size (rasqal_rowsource_add_variable): Remove (wrong, bad) reference to order_size here. It was adding one per variable, which was never going to be always correct. (rasqal_rowsource_get_size): Renamed from rasqal_rowsource_get_sizes * src/rasqal_internal.h, src/rasqal_row.c: (rasqal_new_row_from_row_deep): Removed, no longer used * src/rasqal_internal.h, src/rasqal_row.c, src/rasqal_rowsource_sort.c: (rasqal_row_set_order_size): renamed from rasqal_row_move_to_rowsource and just sets order_size. * src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_rowsource.c: (rasqal_query_results_set_variables): Deleted, just sets size and this is only needed in 1 place. (rasqal_rowsource_update_variables): Deleted, since vars table is shared between query and query results, there is no need to pass this info along. (rasqal_query_results_formatter_read): Remove call to rasqal_rowsource_update_variables. (rasqal_query_results_execute_with_engine): Remove calls to rasqal_query_results_set_variables and set size of query results based on size of top row returned. 2008-10-22 Dave Beckett * src/rasqal_query_results.c: autodocs * src/rasqal_internal.h, src/rasqal_query_results.c: Remove variables fields from query results structure and use variables table, shared with query object. rasqal_query_results loses order_size field - never used and variable_names, varaibles_Sequence, variables. Gains pointer to vars_table. (rasqal_new_query_results): Add vars_table arg. (rasqal_query_results_execute_with_engine): Use new call for rasqal_new_query_results and rasqal_query_results_set_variables. Do not set useless order_size field. (rasqal_free_query_results): Remove freeing old variables fields, free vars_table. (rasqal_query_results_get_bindings): Switch to use rasqal_variables_table_get_names. (rasqal_query_results_get_binding_name): Switch to use rasqal_variables_table_get. (rasqal_query_results_get_binding_value_by_name): Switch to use rasqal_variables_table_get_by_name. (rasqal_query_results_set_variables): Change from variables seq to variables table. Remove all variables* fields setting. Do not set order_size which is never used. (rasqal_query_results_update_bindings): Use query_results variables table and tidy code. * src/rasqal_query.c: (rasqal_free_query): Do not free vars table twice. * src/rasqal_variable.c: (rasqal_new_variables_table): Set initial usage to 1 * src/rasqal_query_results.c: revert * src/rasqal_query_results.c: (rasqal_free_query_results): Free variables table * src/rasqal_query.c: (rasqal_free_query): Free variables table * src/rasqal_query_results.c: (rasqal_query_results_execute_with_engine): Call rasqal_new_query_results with world * src/rasqal_query_results.c: Use results world field in preference to query world field * src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_new_query_results): Add world and type arg. (rasqal_query_results_execute_with_engine): Update calling convention and compute results type first. * src/rasqal_internal.h: Added prototypes for rasqal_new_variables_table_from_variables_table and rasqal_variables_table_get_names * src/rasqal_variable.c: Add generating of variable names and reference/usage counting. (rasqal_new_variables_table_from_variables_table): Added copy constructor to increase reference count. (rasqal_free_variables_table): Free only when use count is 0. (rasqal_variables_table_add): Delete any variable names list when a new variable is added. (rasqal_variables_table_get_names): Added 2008-10-20 Lauri Aalto * src/rasqal_map.c: (rasqal_new_map): Free compare_data on alloc failure. * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_read_row): Fixed compiler warning about unused variable when not compiling in debug mode 2008-10-18 Dave Beckett * src/rasqal_internal.h, src/rasqal_variable.c: (rasqal_variables_table_get_by_name): Renamed from rasqal_variables_table_find_by_name and made public. * src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_internal.h, src/rasqal_map.c, src/rasqal_rowsource_sort.c: Alter rasqal_compare_fn to take a user data pointer in map comparisons. (rasqal_new_map): Take a compare_user_data pointer and free function to pass in state to comparisons. (rasqal_free_map): Free compare data if a free function is passed. (rasqal_map_node_add_kv): Call compare function with user data. (rasqal_engine_rowsort_compare_literals_sequence): Take compare_flags arg not query, and pass on to rasqal_literal_compare. (rasqal_engine_rowsort_free_compare_data): Added. (rasqal_engine_rowsort_row_compare): Use rowsort_compare_data pointer to get distinct, compare_flags and order_conditions_sequence args context as passed in by rasqal_engine_new_rowsort_map. (rasqal_engine_rowsort_row_compare_distinct): Deleted. (rasqal_engine_new_rowsort_map): add distinct, compare_flags and order_conditions_sequence constructor args. (rasqal_engine_make_rowsource,rasqal_sort_rowsource_init): Update calls to rasqal_engine_new_rowsort_map. * src/rasqal_internal.h: Added prototypes for rasqal_row_set_values_from_variables_table, rasqal_row_move_to_rowsource and rasqal_engine_rowsort_calculate_order_values * src/rasqal_rowsource_triples.c: (rasqal_triples_rowsource_read_row): Use rasqal_row_set_values_from_variables_table to copy/set row values. * src/rasqal_rowsource_sort.c: rasqal_sort_rowsource_context gains an order_size field to save re-calculating this many times. (rasqal_sort_rowsource_init): Calculate order_size for above. Do not init con->seq here since it may not be needed. (rasqal_sort_rowsource_process): Init con->seq here. Use rasqal_row_move_to_rowsource and rasqal_engine_rowsort_calculate_order_values to freshen and calculate any new row fields needed for sorting. (rasqal_sort_rowsource_read_all_rows): If no ordering conditions exist, just call rowsource read_all_rows method. * src/rasqal_row.c: (rasqal_row_set_values_from_variables_table): Added based on former rasqal_engine_row_update code. (rasqal_row_move_to_rowsource): Added to reassign/move a row to a new rowsource and if necessary, allocate the order_values of the new rowsource. * src/rasqal_engine_sort.c: (rasqal_engine_rowsort_calculate_order_values): Added based on former rasqal_engine_row_update code * src/rasqal_engine.c: (rasqal_engine_row_update): Turned into calls to two new functions: rasqal_row_set_values_from_variables_table and rasqal_engine_rowsort_calculate_order_values 2008-10-15 Dave Beckett * src/rasqal_engine.c: rasqal_engine_execution_data gains row size field. (rasqal_engine_get_next_result, rasqal_engine_row_update, rasqal_rowsource_engine_ensure_variables): Do not calc size here, use execution_data->size (rasqal_query_engine_1_execute_init): Init size * src/rasqal_engine_sort.c: autodocs * src/rasqal_engine.c: (rasqal_engine_row_update): Use query direct, do not query_results, can assume that the query results is of right type in this internal function. * src/Makefile.am, src/rasqal_engine_algebra.c, src/rasqal_rowsource_sort.c: (rasqal_algebra_orderby_algebra_node_to_rowsource): Added (rasqal_algebra_node_to_rowsource): Use above for ORDERBY algebra node. Added sort rowsource (rasqal_new_sort_rowsource): Added sort rowsource constructor. * src/rasqal_rowsource_filter.c: (rasqal_filter_rowsource_finish): Free inner rowsource when done. 2008-10-14 Dave Beckett * src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_internal.h: Moved all engine sorting routines into new rasqal_engine_sort.c (rasqal_rowsource_engine_process): Call new rasqal_engine_rowsort_map_add_row to build the map and rasqal_engine_rowsort_map_to_sequence to do the sorting. (rasqal_engine_make_rowsource): Use new rasqal_engine_new_rowsort_map to create the rowsource sorting map, with distinct flags. (rasqal_engine_rowsort_compare_literals_sequence): Added based on rasqal_query_result_literal_sequence_compare. (rasqal_engine_rowsort_literal_sequence_equals): Added based on rasqal_query_result_literal_sequence_equals. Removed query arg. (rasqal_engine_rowsort_row_compare, rasqal_engine_rowsort_row_compare_distinct): Added based on rasqal_engine_row_compare with distinct/not-distinct case pulled out. (rasqal_engine_rowsort_map_free_row): Added based on rasqal_engine_map_free_row. (rasqal_engine_rowsort_map_print_row): Added based on rasqal_engine_map_print_row. (rasqal_engine_new_rowsort_map): Added (rasqal_engine_rowsort_map_add_row): Added (rasqal_engine_rowsort_map_add_to_sequence): Added based on rasqal_engine_map_add_to_sequence. (rasqal_engine_rowsort_map_to_sequence): Added to do the sorting. * src/rasqal_internal.h: struct rasqal_algebra_node_s gains seq for ORDERBY. Added rasqal_new_orderby_algebra_node prototype * src/rasqal_algebra.c: (rasqal_new_orderby_algebra_node): Added with a sequence of expressions in ->seq (rasqal_free_algebra_node): Free sequence. (rasqal_algebra_algebra_node_write_internal): Write conditions seq. (rasqal_algebra_query_to_algebra): Add ORDERBY algebra node if an order conditions sequence is present. (main): Add ORDERBY algebra node to test * src/rasqal_engine.c, src/rasqal_query_results.c: (rasqal_query_results_ensure_have_row_internal): Invoke rasqal_row_to_nodes here after getting a new row, for all query execution engines. (rasqal_query_engine_1_get_row): Remove call from here. 2008-10-13 Dave Beckett * src/rasqal_engine.c: Give rowsources a name * src/rasqal_internal.h, src/rasqal_rowsource.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c, src/rasqal_sparql_xml.c: Give rowsources a name 2008-10-13 Lauri Aalto * src/rasqal_query.c: (rasqal_query_add_query_result): Changed static function to return int error code. Switch order of usage counter increment and sequence push to ensure the sequence free handler does not kill the query object if sequence push fails. (rasqal_query_execute_with_engine): Check return value from rasqal_query_add_query_result() and return failure accordingly. * src/rasqal_engine.c: (rasqal_query_engine_1_execute_init): Set error_p on gp_data alloc/push failure 2008-10-12 Lauri Aalto * src/rasqal_rowsource_triples.c: (main): Fixed test segfaults in RAPTOR_V2_AVAILABLE mode. 2008-10-12 Dave Beckett * src/rasqal_engine_algebra.c: (rasqal_algebra_filter_algebra_node_to_rowsource): Added, calling rasqal_new_filter_rowsource (rasqal_algebra_node_to_rowsource): Handle RASQAL_ALGEBRA_OPERATOR_FILTER * src/rasqal_internal.h: Added rasqal_new_filter_rowsource * src/Makefile.am, src/rasqal_rowsource_filter.c: Added Rasqal filter rowsource class * src/rasqal_query.c: (rasqal_query_get_engine_by_name): Allow overriding query engine with envariable RASQAL_DEBUG_ENGINE * src/Makefile.am: Make rasqal_rowsource_triples_test run * src/rasqal_rowsource_triples.c: (main): unit test work * data/Makefile.am, data/one.nt: Added one.net * src/rasqal_engine_algebra.c: (rasqal_algebra_basic_algebra_node_to_rowsource): Added. (rasqal_algebra_node_to_rowsource): Added, calling rasqal_algebra_basic_algebra_node_to_rowsource for BGP nodes. (rasqal_query_engine_algebra_execute_init): Make triples source, turn the graph pattern tree into algebra and make a rowsource to execute it. (rasqal_query_engine_algebra_get_all_rows, rasqal_query_engine_algebra_get_row): Call rowsource to execute query. (rasqal_query_engine_algebra_execute_finish): Free triples source and rowsource. * src/rasqal_internal.h: Added rasqal_new_triples_rowsource prototype * src/Makefile.am, src/rasqal_rowsource_triples.c: Added rasqal_rowsource_triples.c providing a triple pattern rowsource. (rasqal_new_triples_rowsource): Added - the constructor for this rowsource. * src/rasqal_engine_algebra.c: (rasqal_query_engine_algebra_execute_get_all_rows, rasqal_query_engine_algebra_execute_get_row): Finish immediately 2008-10-11 Dave Beckett * docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-prefix.sgml: api docs tmpls * src/Makefile.am, src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_triples_source.c: Separate triples source from engine V1 Export rasqal_new_triples_source, rasqal_reset_triple_meta, rasqal_free_triples_source, rasqal_triples_source_triple_present, rasqal_new_triples_match, rasqal_triples_match_bind_match, rasqal_triples_match_next_match and rasqal_triples_match_is_end (rasqal_new_triples_source): Change calling convention to take a query. (rasqal_new_triples_match): Change calling convention to take a query and triples_source as made by rasqal_new_triples_source(). * src/rasqal_engine.c: rasqal_new_triples_source switch back to use query direct * src/rasqal_graph_pattern.c: style * src/rasqal_graph_pattern.c: (rasqal_new_filter_graph_pattern): Replace deprecated rasqal_graph_pattern_add_constraint with rasqal_graph_pattern_set_filter_expression * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_add_constraint): Fix autodocs * src/rasqal_query.c: (rasqal_query_write_sparql_graph_pattern): Replace deprecated rasqal_graph_pattern_get_constraint with rasqal_graph_pattern_get_filter_expression. * src/rasqal_engine_algebra.c: copyright * src/rasqal_engine_algebra.c: Transform query into algebra nodes and count nodes. (rasqal_engine_algebra_count_nodes): Added. (rasqal_query_engine_algebra_execute_init): Init algebra_node and print debugging. (rasqal_query_engine_algebra_execute_finish): Free algebra_node if set. * src/rasqal_query_results.c: (rasqal_query_results_ensure_have_row_internal): Increment results count when executing lazy * src/rasqal_query.c: (rasqal_query_set_store_results): Internal not just when debugging * src/rasqal_internal.h: Make rasqal_query_set_store_results prototype just internal * src/rasqal_query.c: (rasqal_query_get_engine_by_name): Check name if not NULL * utils/roqet.c: fix help message to note internal * utils/roqet.c: Add -g/ --engine internal only for now * src/Makefile.am: Add rasqal_engine_algebra.c * src/rasqal_internal.h: Add rasqal_query_get_engine_by_name prototype. Add extern for new algebra query engine * src/rasqal_engine_algebra.c: Query engine over algebra skeleton * src/rasqal_query.c: (rasqal_query_get_engine_by_name): Added to map a name to a query engine. Choose original or query algebra. (rasqal_query_execute_with_engine): Use above. * src/rasqal_internal.h: Added rasqal_query_execute_with_engine Added rasqal_query_results_execute_with_engine replacing rasqal_new_query_results_from_query_execution * src/rasqal_query.c: (rasqal_query_execute_with_engine): Added to allow passing in execution engine (rasqal_query_execute): Call above. * src/rasqal_query_results.c: (rasqal_query_results_execute_with_engine): Renamed from rasqal_new_query_results_from_query_execution and add engine as a parameter. * src/rasqal_query_results.c: (rasqal_new_query_results): Just init fields, do not do any more work; move htat to rasqal_new_query_results_from_query_execution. (rasqal_new_query_results_from_query_execution): Set query results type and variables. * src/rasqal_engine.c: add debug ifdef * src/rasqal_query.c: remove dead ifdef * utils/roqet.c: (roqet_graph_pattern_walk): Use rasqal_graph_pattern_get_filter_expression instead of deprecated rasqal_graph_pattern_get_constraint_sequence which only returns 1 expression now. * tests/engine/Makefile.am: limit test compare * src/Makefile.am, src/rasqal_limit_test.c, tests/engine/Makefile.am, tests/engine/rasqal_limit_test.c: Move rasqal_limit_test to tests/engine * src/rasqal_literal.c: docs * src/sparql_parser.y: docs: language, not engine * src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query.c, src/rdql_common.h, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_common.h, src/sparql_lexer.l, src/sparql_parser.y: Terminology change - rename rdql/sparql functions and structs from *query_engine* to *query_language* 2008-10-10 Dave Beckett * src/rasqal_engine.c: internal docs * src/rasqal_query_results.c: struct rasqal_query_results_s: document fields. removed unused fields: abort, unused* (rasqal_new_query_results): Init all fields. * src/rasqal_query_results.c: internal docs * src/rasqal_query.c: internal docs * src/rasqal_engine.c: (rasqal_new_triples_source): autodocs 2008-10-09 Lauri Aalto * src/rasqal_internal.h: (rasqal_query_execution_factory_s): c++ mode fix * src/fix-bison, src/rasqal.h, src/rasqal_algebra.c, src/rasqal_expr.c, src/rasqal_feature.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_limit_test.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_test.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_sparql_xml.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y, tests/algebra/convert_graph_pattern.c, tests/engine/rasqal_construct_test.c, tests/engine/rasqal_graph_test.c, tests/engine/rasqal_order_test.c, utils/roqet.c, utils/srxread.c: Refactored Rasqal to use Raptor v2 APIs if available. Flagged with RAPTOR_V2_AVAILABLE. API/ABI breaks: (rasqal_new_world): API function changed to allocate rasqal_world only. Initialization decoupled to rasqal_world_open(). (rasqal_features_enumerate, rasqal_feature_from_uri): API functions now require a rasqal_world param. (rasqal_prefix, rasqal_data_graph, rasqal_expression_s): API structs gain rasqal_world *world field. (rasqal_new_data_graph, rasqal_new_function_expression, rasqal_new_cast_expression, rasqal_new_prefix): API constructor functions now require a rasqal_world param. (rasqal_new_0op_expression, rasqal_new_1op_expression, rasqal_new_2op_expression, rasqal_new_3op_expression, rasqal_new_string_op_expression, rasqal_new_literal_expression): API constructor functions changed to require a rasqal_world param for consistency reasons, though not really used for anything. Other API changes: (rasqal_world_open): New API function to initialize a rasqal_world. Pulled from rasqal_new_world(). (rasqal_world_set_raptor): New API function to set raptor instance externally before rasqal_world_open(). (rasqal_world_get_raptor): New API function to access raptor_world associated with the rasqal_world. Other changes: (fix-bison): Hack in YYPARSE_PARAM to %destructors. Required for raptor_free_uri_v2(). (rasqal_raptor_init_triples_match): Check for triples match context alloc failure. (rasqal_raptor_triple_match,ordinal_as_uri): Internal functions now require rasqal_world param. (rdql_token_print, rdql_token_free,sparql_token_print,sparql_token_free): Internal functions now require rasqal_world param. (main): Fixed "#ifdef RASQAL_DEBUG > 1" preprocessor conditionals in rasqal_construct_test. (roqet_error_handler): Pass in rasqal_world* in user_data. 2008-10-09 Dave Beckett * src/rasqal_engine.c: (rasqal_new_triples_source): take an execution_data arg. (rasqal_query_engine_1_execute_init): Call above with new arg. * src/rasqal_internal.h: rasqal_query_results_reset and rasqal_query_results_set_order_conditions prototypes deleted - only used in query_results.c rasqal_query_results_update_bindings deleted - now static and only used inside query_results.c * src/rasqal_query_results.c: (rasqal_new_query_results): Merge in rasqal_query_results_reset code only ever used here and tidy to exit early on allocation failure. (rasqal_new_query_results_from_query_execution): Inline 1-line function rasqal_query_results_set_order_conditions only ever used here. (rasqal_query_results_reset, rasqal_query_results_set_order_conditions): Deleted and merged inline above. (rasqal_query_results_update_bindings): now static * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: Move struct rasqal_query_results_s to rasqal_query_results.c to make it internal. Switch query engine from using query_results->{failed,finished} directly (now no longer possible) to returning execution errors. (rasqal_engine_group_graph_pattern_get_next_match): Return -1 on failure. (rasqal_engine_triple_graph_pattern_get_next_match): Use STEP_ERROR to return failure. (rasqal_engine_do_optional_step): Do not set finished flag. (rasqal_engine_get_next_result): No need to check query_results failed, finished or query triples; caller will do that. Do not set query->failed, return -1 on failure. Handle STEP_ERROR and return failure if seen. rasqal_rowsource_engine_context gains query field. (rasqal_rowsource_engine_init): Init con finished and failed. (rasqal_rowsource_engine_process): Set con finished and failed, not query_results equivalents. (rasqal_rowsource_engine_read_row): Use con finished and failed flags for checks. (rasqal_rowsource_engine_read_all_rows): Use con finished and failed. (rasqal_rowsource_engine_get_query): Get query from con field. (rasqal_engine_make_rowsource): Set query field in con. (rasqal_query_engine_1_get_row): Return NULL if already failed. Switch from using query_results->finished/failed to setting error_p. (rasqal_query_engine_1_execute_init, rasqal_query_engine_1_get_all_rows, (rasqal_query_engine_1_execute_finish): Set error_p on failures. (rasqal_query_results_ensure_have_row_internal, rasqal_query_results_execute_and_store_results): Look for execution engine failures and set query_results failed flag. * src/rasqal_engine.c: (rasqal_engine_check_constraint): Take a rasqal_engine_execution_data arg not query. (rasqal_engine_do_step): Replace rasqal_engine_check_constraint calls with execution_data. No need for unused query variable now. (rasqal_query_engine_1_finish_factory): Fix method - it does not take an error_p * src/rasqal_query_results.c: (rasqal_free_query_results): Note ignore of return * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: execution factory method execute_init now takes a flag arg. (rasqal_engine_make_rowsource): Add need_store_results args. (rasqal_new_query_results_from_query_execution): Init execution_flags. (rasqal_query_engine_1_execute_init): Add flags arg and use it to set need_store_results 2008-10-07 Dave Beckett * src/rasqal_result_formats.c: (rasqal_query_results_write_json1): Returning 1 on failure is sufficient - do not alter query->failed here. * utils/roqet.c: Check to see if rasqal_query_results_formatter_write failed * src/rasqal_sparql_xml.c: (rasqal_query_results_write_sparql_xml): Returning 1 on failure is sufficient - do not alter query->failed here. * src/rasqal_expr.c: (rasqal_expression_evaluate_strmatch): Returning NULL on failure is sufficient - do not alter query->failed here. * src/rasqal_engine.c: autodocs * src/rasqal_engine.c: (rasqal_query_engine_1_get_row): No need to check query_results - interface will ensure it is OK. * src/rasqal_internal.h: execution data autodocs * src/rasqal_query_results.c: (rasqal_query_results_ensure_have_row_internal): Note that parameter validation has already been done. (rasqal_query_results_finished): Return finished if already finished or failed. * src/rasqal_engine.c: (rasqal_query_engine_1_get_row): autodocs * src/rasqal_result_formats.c, src/rasqal_sparql_xml.c: (rasqal_query_results_write_sparql_xml, rasqal_query_results_write_json1): Use rasqal_query_results_get_query. * src/rasqal_query_results.c: (rasqal_new_query_results): autodocs * src/rasqal_engine.c: (rasqal_query_engine_1_execute_finish): autodocs * src/rasqal_engine.c: (rasqal_query_engine_1_get_all_rows): autodocs * src/rasqal_engine.c: (rasqal_engine_do_optional_step): autodocs * src/rasqal_engine.c: (rasqal_engine_do_step): autodocs * src/rasqal_engine.c: (rasqal_new_triples_source): autodocs * src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_query_results_execute_and_store_results): make static * src/rasqal_query_results.c: (rasqal_query_results_execute_and_store_results): Renamed from rasqal_query_results_store_results * src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: (rasqal_new_query_results_from_query_execution): Added based on rasqal_query_execute contents. (rasqal_query_execute): Use rasqal_new_query_results_from_query_execution * src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: Keep pointers to query results inside query as a sequence in query rather than a linked list touch results->next internals. (rasqal_new_query, rasqal_free_query): Init/free query->results sequence. (rasqal_query_add_query_result, rasqal_query_remove_query_result): Switch to use a sequence. (rasqal_query_results_remove_query_reference): Added to just remove the query reference added to when a query results was built. * src/rasqal.h, src/rasqal_query_results.c: (rasqal_query_results_get_query): Added * src/rasqal_engine.c, src/rasqal_internal.h: remove execution engine prepare method - unused * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: Added rasqal_engine_error Make execution engine calls have an error pointer output parameter. Not currently used but passed around. 2008-10-06 Lauri Aalto * src/rasqal_query.c: (rasqal_query_execute): All non-0 return codes from execute_init() are failures. 2008-10-05 Dave Beckett * Checkpoint in query engine refactoring. SVN 14627 at 2008-10-05 20:22:21 -0700 (Sun, 05 Oct 2008) At this point the interface between the query results API and existing query engine has been separated such that the query engine solely generates rows on request (pull, lazy evaluation) or generates all rows as a sequence. The query results API performs all the other operations such as turning rows into triples, returning a boolean result and accessing variables and values in the current row of results. A top level 'make check' passes at this SVN commit. * src/rasqal_query_results.c: (rasqal_query_results_get_row_from_saved): Run rasqal_row_to_nodes on rows from saved, they may not be canonicalized yet. * src/rasqal_query_results.c: (rasqal_query_results_finished): Call rasqal_query_results_ensure_have_row_internal if not finished or failed to ensure attempt to execute, to see if finished * src/rasqal_query_results.c: (rasqal_query_results_ensure_have_row_internal): Does nothing if an existing row is present. (rasqal_query_results_get_current_row): Just call rasqal_query_results_ensure_have_row_internal. (rasqal_query_results_next, rasqal_query_results_next_triple): Free any existing row before moving to next result. (rasqal_query_results_get_triple): Just call rasqal_query_results_ensure_have_row_internal. * src/rdql_parser.y: (rasqal_rdql_query_engine_prepare): Call rasqal_query_expand_wildcards to expand RDQL SELECT * and SPARQL * src/rasqal_query_transform.c: (rasqal_query_expand_wildcards): RDQL and SPARQL * src/rasqal_query_results.c: (rasqal_query_results_ensure_have_row_internal): Renamed from rasqal_query_results_next_internal * src/rasqal_query_results.c: (rasqal_query_results_get_triple): Use rasqal_query_results_next_internal to ensure first triple has a row to read from. * tests/engine/rasqal_construct_test.c: Make construct test multiple triples/row Add serializing of results when debugging 2008-10-04 Dave Beckett * tests/engine/rasqal_construct_test.c: init some vars 2008-10-03 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_next_internal): Moved earlier. (rasqal_query_results_get_current_row): Use rasqal_query_results_next_internal (rasqal_query_results_get_binding_value_by_name): No need to set finished since rasqal_query_results_get_current_row will do it. (rasqal_query_results_store_results): tidy init result_count to 0 * src/rasqal_query.c: (rasqal_query_execute): style. Init store_results flag based on query features. * src/rasqal_engine.c: rasqal_engine_execution_data gains result_count field for checking limit and offset for get_row (rasqal_engine_make_rowsource): Use query results store_results flag to figure out when to store results. style. (rasqal_query_engine_1_execute_init): Init result_count to 0 since new execution model does not get 1 result always. * src/rasqal_internal.h: struct rasqal_query_results_s gains store_results flag field * src/rasqal_query_results.c, src/rasqal_query.c, src/rasqal_internal.h, src/rasqal_engine.c: Moved stored results execution into query results class and made the execution engine only do the 'lazy' work. Execution engine looses next_row method. (rasqal_engine_execute_and_save, rasqal_engine_execute_next_from_saved): Deleted and moved to query results (rasqal_engine_execute_next_lazy): Deleted (rasqal_query_engine_1_get_row): Replaced with rasqal_engine_execute_next_lazy code (rasqal_query_engine_1_execute_init): Tidy and do not start execution of first result (laz) /all results (stored) here. (rasqal_query_engine_1_next_row): Deleted (rasqal_query_results_get_row_from_saved): Added based on rasqal_engine_execute_next_from_saved (rasqal_query_results_get_current_row): Updated to get pointer to current result row as a shared object. (rasqal_query_results_next_internal): Switch to updating current row. (rasqal_query_results_get_triple): Tidy (rasqal_query_results_store_results): Added based on rasqal_query_results_set_all_rows, to do the actual storing of results, calling execution engine and handling construct. * src/rasqal_query_results.c: (rasqal_query_results_next): Removed unused rc * src/rasqal_query_results.c: (rasqal_query_results_next_internal): Added to pull out moving to next item without result type check. (rasqal_query_results_next, rasqal_query_results_next_triple): Use rasqal_query_results_next_internal. * src/rasqal_query_results.c: (rasqal_query_results_next_triple): Move to next row via engine, calling rasqal_query_results_next causes failure since it expects bindings. * tests/engine/rasqal_construct_test.c, tests/engine/Makefile.am: Added rasqal_construct_test (which fails) * src/rasqal_query_results.c: Revert r14601 * src/rasqal_query_results.c: (rasqal_prefix_id): style * src/rasqal_engine.c, src/rasqal_internal.h: Added get_all_rows factory method to execution factory. (rasqal_query_engine_1_get_all_rows): Added to implement it. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: Return triple generating to query results class. (rasqal_query_results_get_triple, rasqal_query_results_next_triple): Move code from rasqal_query_engine_1_get_triple and rasqal_query_engine_1_next_triple. (rasqal_query_engine_1_get_triple, rasqal_query_engine_1_next_triple): Deleted. Deleted get_triple and next_triple from execution factory methods. Move current_triple_result field back into rasqal_query_results. (rasqal_prefix_id): Moved back to rasqal_query_results.c. (rasqal_query_results_reset): Reset current_triple_result here. 2008-10-02 Dave Beckett * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_row.c: (rasqal_row_to_nodes): Added renamed from rasqal_engine_row_to_nodes * docs/tmpl/section-graph_pattern.sgml, src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_query_results_check_limit_offset): Renamed from rasqal_engine_check_limit_offset 2008-09-30 Lauri Aalto * src/rasqal_query_transform.c: (rasqal_query_prepare_common): Pass up error codes from gp merge visitors. 2008-09-29 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_set_variables): Check for raptor_sequence_push() failure. Prevents populating variables/variable_names arrays with stale pointers. * src/rasqal_engine.c: (rasqal_query_engine_1_execute_finish): Check for NULL execution_data. 2008-09-28 Lauri Aalto * src/rasqal_query.c: (rasqal_query_execute): Check for execution_data alloc failure. * src/rasqal_engine.c: (rasqal_query_engine_1_execute_finish): Memory leak fix: free execution_data->seq. Also zero freed pointers to prevent dangling pointer problems. * src/rasqal_query_results.c: (rasqal_query_results_get_triple): Do not return uninitialized pointers. 2008-09-27 Dave Beckett * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: rasqal_engine_execution_data loses fields never used: offset, map ad gains rowsource taken from rasqal_query_results rasqal_query_results has unused5 replacing rowsource field. (rasqal_engine_execute_and_save, rasqal_engine_execute_next_lazy, rasqal_query_engine_1_execute_init, rasqal_query_engine_1_execute_finish): use execution_data to store and own rowsource. (rasqal_free_query_results): No longer free rowsource. * src/rasqal_engine.c: (rasqal_engine_init_execution_data, rasqal_engine_execute_init, rasqal_engine_execute_run): Deleted into rasqal_query_engine_1_execute_init. (rasqal_query_engine_1_execute_transform_hack): Added with transformation of query hack needed from new algebra to what this engine understands. (rasqal_query_engine_1_execute_init): Merge rasqal_engine_init_execution_data, rasqal_engine_execute_init and rasqal_engine_execute_run into here - they are all called only once by this code. Add more comments on what is happening * src/rasqal_query.c: (rasqal_query_execute): execute_init return is a query failure if < 0 * src/rasqal_engine.c: (rasqal_engine_execute_finish): Deleted (rasqal_engine_execute_next): Deleted (rasqal_query_engine_1_next_row): Merge in rasqal_engine_execute_next (rasqal_query_engine_1_execute_finish): Merge in rasqal_engine_execute_finish (rasqal_query_engine_1_next_triple): Use rasqal_query_engine_1_next_row. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: Removed execute_get_value and execute_get_values factory methods of rasqal_query_execution_factory_s. Renamed execute_get method to get_row Renamed execute_next method to next_row (rasqal_engine_get_result_row): Deleted (rasqal_query_results_get_row): Replace rasqal_engine_get_result_row (rasqal_engine_get_result_value): Deleted and inlined. (rasqal_engine_bind_construct_variables): Deleted and inlined using new rasqal_query_results_update_bindings (rasqal_engine_execute_and_save): Removed core of limit and indexing checking to new rasqal_query_results_set_all_rows. (rasqal_engine_row_to_nodes): Use rasqal_query_results_get_current_row. (rasqal_engine_execute_next_from_saved): Use rasqal_query_results_update_bindings. (rasqal_query_engine_1_get_row): Renamed from rasqal_query_engine_1_execute_get. (rasqal_query_engine_1_execute_get_value): Deleted. (rasqal_query_engine_1_execute_get_values): Deleted. (rasqal_query_engine_1_next_row): Renamed from rasqal_query_engine_1_execute_next (rasqal_query_results_next): Use next_row method. (rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Inline get values work using rasqal_query_results_get_current_row. (rasqal_query_results_set_all_rows): Added (rasqal_query_results_get_current_row): Added (rasqal_query_results_update_bindings): Added * src/rasqal_engine.c: (rasqal_engine_get_result_values): Deleted (rasqal_query_engine_1_execute_get_values): Merged in rasqal_engine_get_result_values here. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c: rasqal_query_results loses current_triple_result field. rasqal_engine_execution_data gains current_triple_result field. (rasqal_engine_execute_init): Init current_triple_result. (rasqal_query_engine_1_get_triple, rasqal_query_engine_1_next_triple): use execution_data->current_triple_result (rasqal_query_results_reset): Remove init of current_triple_result. * src/rasqal_engine.c, src/rasqal_internal.h: Moved new_bindings_count from rasqal_query_results to rasqal_engine_execution_data. * src/rasqal_engine.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/sparql_parser.y: (rasqal_new_basic_graph_pattern_from_formula): Renamed from rasqal_engine_new_basic_graph_pattern_from_formula (rasqal_new_2_group_graph_pattern): Renamed from rasqal_engine_group_2_graph_patterns. query_results loses triples_source field, now unused2 rasqal_engine_execution_data gains triples_source field. Altered query engine 1 to uses execution_data->triples_source (rasqal_new_triples_match): Use execution_data parameter. (rasqal_reset_triple_meta): Now static and use execution_data. (rasqal_engine_execute_finish): use execution data. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: Make execution factory methods all take execution data pointers which in the current query engine V1, are pointers to rasqal_engine_execution_data (rasqal_engine_group_graph_pattern_get_next_match, rasqal_engine_triple_graph_pattern_get_next_match, rasqal_engine_graph_pattern_get_next_match, rasqal_engine_graph_pattern_init, rasqal_engine_execute_init, rasqal_engine_execute_finish, rasqal_engine_move_to_graph_pattern, rasqal_engine_do_step, rasqal_engine_do_optional_step, rasqal_engine_get_next_result, rasqal_engine_check_limit_offset, rasqal_engine_row_update, rasqal_engine_get_result_row, rasqal_engine_get_result_values, rasqal_engine_get_result_value, rasqal_engine_bind_construct_variables, rasqal_engine_execute_and_save, rasqal_engine_execute_run, rasqal_engine_row_to_nodes, rasqal_engine_execute_next_from_saved, rasqal_engine_execute_next, rasqal_query_engine_1_execute_init, rasqal_query_engine_1_execute_get, rasqal_query_engine_1_execute_get_value, rasqal_query_engine_1_execute_get_values, rasqal_query_engine_1_execute_next, rasqal_query_engine_1_execute_finish, rasqal_query_engine_1_get_triple, rasqal_query_engine_1_next_triple): Remove query_results parameter. (rasqal_engine_init_execution_data): Add query param. (rasqal_query_execute): Invoke init method with query parameter. (rasqal_free_query_results, rasqal_query_results_next, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name, rasqal_query_results_get_triple, rasqal_query_results_next_triple): Invoke finish method with execution data. * src/rasqal_engine.c: Pass execution_data to a lot of functions. query_results->execution_data is no longer used by this code. Code tidying for long lines. (rasqal_engine_triple_graph_pattern_get_next_match, rasqal_engine_graph_pattern_get_next_match, rasqal_engine_graph_pattern_init, rasqal_engine_move_to_graph_pattern, rasqal_engine_do_step, rasqal_engine_do_optional_step, rasqal_engine_make_rowsource): Add execution_data arg. rasqal_rowsource_engine_context gains execution_data field. (rasqal_rowsource_engine_init): Initialise execution_data in rasqal_rowsource_engine_context (rasqal_rowsource_engine_finish): Pass on execution_data 2008-09-26 Dave Beckett * src/rasqal_engine.c: ws * src/rasqal_query_results.c: (rasqal_new_query_results): Set execution_factory if query_results is set. * src/rasqal_query_results.c: ws * src/Makefile.am, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_row.c: Moved rasqal_row class rom rasqal_query_results.c to rasqal_row.c * src/rasqal_internal.h, src/rasqal_query_transform.c: rasqal_graph_pattern_constraints_has_qname is static * src/Makefile.am, src/rasqal_empty_rowsource.c, src/rasqal_rowsequence_rowsource.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_union.c, src/rasqal_union_rowsource.c: Renamed rowsource implementation files to be rasqal_rowsource_TYPE.c rather than rasqal_TYPE_rowsource.c for TYPE empty, rowsequence and union * src/rasqal_empty_rowsource.c, src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_rowsequence_rowsource.c, src/rasqal_rowsource.c, src/rasqal_sparql_xml.c, src/rasqal_union_rowsource.c: Rename class rasqal_query_result_row to rasqal_row * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rdql_parser.y, src/sparql_parser.y: Moved more query transformation functions from rasqal_engine.c to rasqal_query_transform.c. That leaves rasqal_query.c and rasqal_query_results.c largely free of query execution detail, rasqal_query_transform.c only about altering a rasqal_query, graph pattern or expression - typically behind rasqal_query_prepare() and rasqal_engine.c all about execution - behind rasqal_query_execute(). (rasqal_query_merge_triple_patterns): Renamed from rasqal_engine_merge_triples (rasqal_graph_pattern_move_constraints): Renamed from rasqal_engine_move_constraints (rasqal_query_remove_empty_group_graph_patterns): Renamed from rasqal_engine_remove_empty_group_graph_patterns (rasqal_query_merge_graph_patterns): Renamed from rasqal_engine_merge_graph_patterns (rasqal_expression_foreach_fold): Renamed from rasqal_engine_expression_foreach_fold (rasqal_query_expression_fold): Renamed from rasqal_engine_expression_fold (rasqal_graph_pattern_fold_expressions): Renamed from rasqal_engine_graph_pattern_fold_expressions (rasqal_query_fold_expressions): Renamed from rasqal_engine_query_fold_expressions (rasqal_query_prepare_count_graph_patterns): Renamed from rasqal_query_prepare_count_graph_patterns (rasqal_query_prepare_common): Move code from rasqal_query_prepare, rasqal_sparql_query_engine_prepare and rasqal_rdql_query_engine_prepare that was about query transformation. (rasqal_graph_patterns_join): Renamed from rasqal_engine_join_graph_patterns * src/Makefile.am, src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query_transform.c, src/rdql_parser.y, src/sparql_parser.y: Move query transforming helper routines from rasqal_engine.c to rasqal_query_transform.c. Rename the functions from rasqal_engine_ prefixed to match the type they operate on. (rasqal_query_expand_triple_qnames): Renamed from rasqal_engine_expand_triple_qnames. (rasqal_sequence_has_qname): Renamed from rasqal_engine_sequence_has_qname. (rasqal_query_constraints_has_qname): Renamed from rasqal_engine_query_constraints_has_qname. (rasqal_query_expand_graph_pattern_constraints_qnames): Renamed from rasqal_engine_expand_graph_pattern_constraints_qnames. (rasqal_query_expand_query_constraints_qnames): Renamed from rasqal_engine_expand_query_constraints_qnames. (rasqal_query_build_anonymous_variables): Renamed from rasqal_engine_build_anonymous_variables. (rasqal_query_expand_wildcards): Renamed from rasqal_engine_expand_wildcards. (rasqal_query_remove_duplicate_select_vars): Renamed from rasqal_engine_remove_duplicate_select_vars. (rasqal_query_prepare_common): Renamed from rasqal_engine_prepare 2008-09-26 Lauri Aalto * src/rasqal_result_formats.c: (rasqal_query_results_write_json1): Do not emit double " for distinct/ordered flags. Fixes Issue#0000279 http://bugs.librdf.org/mantis/view.php?id=279 2008-09-26 Dave Beckett * src/rasqal_query_results.c: (rasqal_query_results_next): Call execution factory method execute_next. (rasqal_query_results_get_bindings): Call execution factory method execute_get_values. (rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Call execution factory method execute_get_value. (rasqal_prefix_id): Moved to rasqal_engine.c (rasqal_query_results_get_triple): Move most of code to rasqal_engine.c and call execution_factory method get_triple (rasqal_query_results_next_triple): Move most of code to rasqal_engine.c and call execution_factory method next_triple * src/rasqal_internal.h: Remove a bunch of rasqal_engine from exporting internally * src/rasqal_engine.c: (rasqal_free_engine_execution_data): Removed, unused. (rasqal_engine_execute_finish): Fix return. (rasqal_engine_get_next_result): static and take execution_data (rasqal_engine_get_result_row): static (rasqal_engine_get_result_values): static (rasqal_engine_get_result_value): static (rasqal_rowsource_engine_process): Call rasqal_engine_get_next_result with execution_data (rasqal_engine_execute_run): static and take execution_data (rasqal_engine_execute_next_from_saved, rasqal_engine_execute_next_lazy): take execution_data (rasqal_engine_execute_next): static and take execution_data (rasqal_query_engine_1_execute_get): Added (rasqal_query_engine_1_execute_get_value): Added calling rasqal_engine_get_result_value (rasqal_query_engine_1_execute_get_values): Added calling rasqal_engine_get_result_values (rasqal_query_engine_1_execute_next): Added calling rasqal_engine_execute_next (rasqal_query_engine_1_execute_finish): static (rasqal_prefix_id): moved from rasqal_query_results.c (rasqal_query_engine_1_get_triple): Added based on rasqal_query_results_get_triple (rasqal_query_engine_1_next_triple): Added based on rasqal_query_results_next_triple * src/Makefile.am: Remove rasqal_engine_rowsource_test * src/Makefile.am, src/rasqal_engine_rowsource.c: Remove rasqal_engine_rowsource.c 2008-09-25 Lauri Aalto * src/rasqal_engine.c, src/rasqal_internal.h: (rasqal_query_results_s,rasqal_query_engine_1): Made execution factory const, no need to modify its members after initialization. * src/rasqal_engine.c: (rasqal_engine_execute_finish): Fixed missing return value in assertion. 2008-09-25 Dave Beckett * src/rasqal_internal.h: struct rasqal_query_results_s: lose free_execution_data callback * src/rasqal_query_results.c: (rasqal_free_query_results): Do not free execution data with factory method. * src/rasqal_engine.c: (rasqal_free_engine_execution_data): Removed, only 1 use. * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: Introduce a rasqal_query_execution_factory and move existing query engine to use it. Existing tests still pass. (rasqal_engine_execute_init, rasqal_engine_execute_finish): Now static. (rasqal_engine_init_execution_data): Renamed from rasqal_new_engine_execution_data. (rasqal_free_engine_execution_data): Type the data parameter. (rasqal_engine_execute_init, rasqal_engine_execute_finish): Add execution_data parameter. (rasqal_query_execute, rasqal_free_results): Update to use execution factory. 2008-09-24 Dave Beckett * src/rasqal_internal.h: #comments 2008-09-21 Dave Beckett * src/rasqal_query_results.c: (rasqal_new_query_result_row_from_query_result_row_deep): Added to deep-copy a row to stop somebody (the query engine in this case) changing the fields behind the scenes. * src/rasqal_internal.h: Added rasqal_new_execution_rowsource Export rasqal_engine_get_result_row Added rasqal_new_query_result_row_from_query_result_row_deep * src/rasqal_engine.c: Export rasqal_engine_get_result_row * src/Makefile.am: Added rasqal_engine_rowsource.c * src/rasqal_engine_rowsource.c: comment * src/rasqal_engine_rowsource.c: Rasqal query engine rowsource class * src/rasqal_internal.h, src/rasqal_rowsource.c: (rasqal_rowsource_ensure_variables): Added and called before any rowsource function that tries to refer to the variables sequence. * src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_rowsequence_rowsource.c: (rasqal_new_query_result_row_sequence): Added from make_row_sequence but still internal. (main): Use new function * src/rasqal_rowsequence_rowsource.c: (rasqal_rowsequence_rowsource_read_row): Use raptor_sequence_delete_at to remove it from sequence. * src/rasqal_rowsequence_rowsource.c: more tests * src/rasqal_rowsequence_rowsource.c: (rasqal_rowsequence_rowsource_read_row): Move offset on (main): Add test that rows read on * src/rasqal_rowsequence_rowsource.c: code style * src/rasqal_rowsequence_rowsource.c: docs * src/rasqal_rowsequence_rowsource.c: comments * src/rasqal_rowsequence_rowsource.c: (make_row_sequence): Added to build row test data (main): Use it 2008-09-20 Dave Beckett * src/rasqal_union_rowsource.c: (rasqal_union_rowsource_finish): Free context * src/rasqal_rowsequence_rowsource.c: (rasqal_rowsequence_rowsource_finish): Free context * src/rasqal_empty_rowsource.c: (rasqal_empty_rowsource_finish): Added and used to free context * src/Makefile.am, src/rasqal_internal.h, src/rasqal_rowsequence_rowsource.c, src/rasqal_union_rowsource.c: Added union and rowsequence rowsources * src/rasqal_query_results.c: (rasqal_new_query_result_row_common): Added, pulled out of rasqal_new_query_result_row (rasqal_new_query_result_row): Refactored to use above. (rasqal_new_query_result_row_for_variables): Added, creating a row big enough for all the named variables in a variables table. * src/rasqal_empty_rowsource.c: (main) fail test * src/Makefile.am, src/rasqal_empty_rowsource.c, src/rasqal_internal.h: Added empty rowsource class * src/rasqal_rowsource.c: (rasqal_rowsource_read_all_rows): Return an empty sequence rather than NULL when 0 rows are returned 2008-09-08 Lauri Aalto * src/rasqal.h, src/rasqal_internal.h: Moved EXTERN_C definitions to internal header - no need to expose in API. * src/rasqal.h, src/rasqal_engine.c, src/rasqal_general.c: Workaround for an armcc c++ mode issue regarding function pointers as arguments: Need explicit extern "C" to get C linkage for C function pointers. * src/rdql_lexer.l, src/sparql_lexer.l: casts for c++ 2008-09-06 Dave Beckett * tests/algebra/convert_graph_pattern.c: Casts for c++ * docs/rasqal-docs.xml, docs/rasqal-sections.txt: Update sections * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string): Cast for C++ 2008-09-05 Dave Beckett * src/sparql_parser.y: Fixes for g++ from Fixes Issue#0000271 http://bugs.librdf.org/mantis/view.php?id=271 2008-08-25 Lauri Aalto * src/rasqal_engine.c: (rasqal_engine_remove_filter_graph_patterns): Do not leak sequence on error. * src/rasqal_engine.c: (rasqal_engine_execute_init): Check for errors in rasqal_engine_remove_filter_graph_patterns() visitor. * src/rasqal_engine.c: (rasqal_engine_remove_filter_graph_patterns): Resiliency fix: check raptor_sequence_push() return value to avoid dangling pointers * src/sparql_parser.y: (GroupGraphPattern): Fixed double deletion: raptor_sequence_shift() takes ownership * src/rasqal_engine.c: (rasqal_engine_group_2_graph_patterns): Always take ownership of graph patterns passed in. * src/sparql_parser.y: (OptionalGraphPattern): Fixed double deletion: raptor_sequence_push() takes ownership * src/rasqal_engine.c: Fixed gcc warnings about empty else blocks when RASQAL_DEBUG is not defined. * src/rasqal_engine.c, src/rasqal_graph_pattern.c: (rasqal_graph_pattern_add_sub_graph_pattern): Always take ownership of sub gp. (rasqal_engine_execute_init): Free new_qgp on error and ensure query->query_graph_pattern does not become a dangling pointer. * src/fix-flex: Removed additional OOM checks added to flex-generated ensure_buffer_stack(). flex versions 2.5.34 and later generate the OOM checking code themselves. * src/rasqal_engine.c: (rasqal_engine_remove_duplicate_select_vars): Resiliency fix. Check for raptor_new_sequence() failure. * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern_from_sequence): Resiliency fix. graph_patterns may be NULL. 2008-08-24 Dave Beckett * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: rasqal_query: Switched to use a rasqal_variables_table object. Make all old fields unused. Added prototypes for rasqal_variables_table_get_value, rasqal_variables_table_get_named_variables_count, rasqal_variables_table_get_anonymous_variables_count, rasqal_variables_table_get_total_variables_count, rasqal_variables_table_get_named_variables_sequence and rasqal_variables_table_get_anonymous_variables_sequence. (rasqal_new_query, rasqal_free_query): Create and destroy variables table instead of individual fields. (rasqal_query_get_all_variable_sequence, rasqal_query_get_variable, rasqal_query_has_variable, rasqal_query_execute, rasqal_query_print, rasqal_query_get_variable_by_offset, rasqal_engine_expand_wildcards, rasqal_query_build_declared_in, rasqal_engine_get_next_result, rasqal_engine_query_result_row_update, rasqal_engine_bind_construct_variables, rasqal_rowsource_engine_ensure_variables): Switch to use rasqal_variables_table methods. * src/rasqal_variable.c: (rasqal_new_variable_typed, rasqal_new_variable): Now implemented with rasqal_variables_table_add (rasqal_variables_table_get_value): Added. (rasqal_variables_table_get_named_variables_count, rasqal_variables_table_get_anonymous_variables_count, rasqal_variables_table_get_total_variables_count): Added. (rasqal_variables_table_get_named_variables_sequence, rasqal_variables_table_get_anonymous_variables_sequence): Added. * tests/algebra/Makefile.am: Fix for make distcheck * src/rasqal_engine.c, src/rasqal_internal.h, src/sparql_parser.y: (rasqal_sparql_query_engine_prepare): Move SPARQL-only rasqal_engine_build_anonymous_variables and rasqal_engine_expand_wildcards to SPARQL query prepare code * Checkpoint in query engine refactoring. SVN 14382 at 2008-08-24 16:18:32 -0700 (Sun, 24 Aug 2008) At this point after adding hacks to turn the new query algebra into the old form. the query engine can still execute queries with triple patterns and no OPTIONAL, UNION or GROUP. All the RDQL testsuite pass without any change from the last release. The sparql tests have been updated to expect failure for OPTIONALs that used to work in the last release. A top level 'make check' passes at this SVN commit. * tests/sparql/survey/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/Expr1/Makefile.am: Add failures due to OPTIONAL not implemented in new QE. Add test failure reports. * tests/sparql/SyntaxFull/Makefile.am: Test failures are due to old SPARQL syntax changes - these tests probably need removing: syntax-bnodes-03.rq syntax-bnodes-04.rq * src/rasqal_engine.c: more debug output for query hack code changes * src/sparql_parser.y: (main): output to stdout again * src/rasqal_engine.c: (rasqal_query_build_declared_in): Do not fail when there is no query graph pattern - allowed with a query like 'DESCRIBE ' (rasqal_engine_prepare): Wrap calling rasqal_query_build_declared_in with a check for a query GP. * src/sparql_parser.y: (GroupGraphPattern): Make an empty group GP if both optional args are missing to allow {} to work * src/rasqal_engine.c: (rasqal_engine_group_2_graph_patterns): Allow two NULL params to make an empty group GP * tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am: Count and report failures * RELEASE.html: note hack to be removed * src/rasqal_engine.c: (rasqal_engine_execute_init): Hack: Add a wrapper GROUP GP at the outer level to make the old execution engine work when there is just 1 GP. * src/rasqal_engine.c: Add DEBUG_FH macro * src/rasqal_engine.c: (rasqal_engine_remove_filter_graph_patterns): Added to turn new (GP, FILTER GP) query algebra form pair into what the old execution engine understands: GP+constraints (rasqal_engine_execute_init): Call rasqal_engine_remove_filter_graph_patterns on query GP to allow execution engine to work and be testable. 2008-08-20 Dave Beckett * src/rasqal_engine.c: Remove rasqal_engine_adjust_anon_variables_offset since rasqal_variable constructors now deal with this. * src/rasqal_variable.c: (rasqal_new_variable_typed, rasqal_variables_table_add): Calculate and adjust variable offsets on creation. * src/rasqal_engine.c: (rasqal_engine_adjust_anon_variables_offset): Renamed from rasqal_engine_assign_variables since it just does one thing now * src/rasqal_engine.c: comment * src/rasqal_variable.c: Remove variable_names from table structure - not used * src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c: Removed query->variable_names - no longer needed 2008-08-19 Dave Beckett * src/rasqal_query.c: (rasqal_free_query): Remove use of deleted field variables[]. * src/rasqal_engine.c: Removed query->variables[] array. (rasqal_engine_expand_wildcards): Use rasqal_query_get_variable_by_offset to lookup variables. Set select_variables_count here. (rasqal_engine_remove_duplicate_select_vars): Update Update select_variables_count if modified. (rasqal_engine_assign_variables, rasqal_query_build_declared_in, rasqal_engine_get_next_result, rasqal_engine_query_result_row_update, rasqal_engine_bind_construct_variables): Use rasqal_query_get_variable_by_offset instead of query->variables[] (rasqal_engine_prepare): Remove use of query->variables[]. autodocs. * src/rasqal_internal.h, src/rasqal_query.c: (rasqal_query_get_variable_by_offset): Added * src/rasqal_engine.c: (rasqal_engine_build_anonymous_variables, rasqal_engine_expand_wildcards): autodocs (rasqal_select_NULL_last_compare): Removed (rasqal_engine_remove_duplicate_select_vars): Added, pulled out of rasqal_engine_assign_variables. Remove sort, simplify. (rasqal_engine_assign_variables): Just touches variables, not declared in or selects. (rasqal_query_build_declared_in): Just touch declared in. autodocs. (rasqal_engine_prepare): Call rasqal_engine_remove_duplicate_select_vars, init select variables count. After assign variables, build the declared in array. * src/rasqal_internal.h: rasqal_engine_assign_variables is module-internal * src/rasqal_internal.h: Added typedef rasqal_variables_table Added prototypes for rasqal_new_variables_table, rasqal_free_variables_table, rasqal_variables_table_add, rasqal_variables_table_get, rasqal_variables_table_has and rasqal_variables_table_set * src/rasqal_variable.c: Add variables table 2008-08-18 Dave Beckett * src/Makefile.am, src/rasqal_expr.c, src/rasqal_variable.c (from /rasqal/trunk/src/rasqal_expr.c:14345): Move rasqal_variable code to new rasqal_variable.c 2008-08-17 Dave Beckett * src/sparql_lexer.l: (QUOTEDURI): Make sure first part of or does not grab <> * src/rasqal_engine.c: (rasqal_engine_expand_wildcards): Tidy code. (rasqal_engine_prepare): Handle rasqal_engine_expand_wildcards failure * src/rasqal_engine.c: (rasqal_engine_expand_wildcards): Handle SELECT * only since CONSTRUCT * was removed from SPARQL long ago. (rasqal_engine_prepare): Docs 2008-08-13 Lauri Aalto * tests/algebra: props: ignore convert_graph_pattern.exe, .libs 2008-08-11 Dave Beckett * rasqal-src-config.in: prefer pkg-config raptor 2008-08-09 Lauri Aalto * src/rasqal_raptor.c: (rasqal_raptor_error_handler): Handle negative locator lengths from raptor_format_locator(). 2008-08-05 Dave Beckett * docs/tmpl/section-graph_pattern.sgml: add RASQAL_GRAPH_PATTERN_OPERATOR_FILTER to docs 2008-08-04 Lauri Aalto * src/rasqal_engine.c: (rasqal_engine_group_2_graph_patterns): Do not double delete second_gp - already owned by sequence. * src/rasqal_algebra.c: (rasqal_algebra_remove_znodes): Fixed memory-related crashes. * tests/algebra/Makefile.am: Added $(EXEEXT) for convert_graph_pattern to make it build on e.g. cygwin. 2008-07-23 Dave Beckett * src/rasqal_internal.h: autodocs 2008-07-19 Dave Beckett * tests/algebra/test-08.out, tests/algebra/test-08.rq, tests/algebra/test-09.out, tests/algebra/test-09.rq: Add test-08 test-09 * src/rasqal_query.c: (rasqal_query_prepare): Remove call to deleted rasqal_engine_build_constraints_expression (rasqal_query_write_sparql_graph_pattern): See if a FILTER was seen in initial GP sequence scan, and handle at end. * src/rasqal_engine.c: (rasqal_engine_build_constraints_expression(query->query_graph_pattern): Deleted * src/rasqal_algebra.c: (main): MAke sure node1 owns node8 * src/rasqal_algebra.c: (main): Adjust use of constraint from parser query. Add node8 empty algebra node test for use with FILTER in node1. * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_write_internal): Tidy filter GP output * src/rasqal_expr.c: (rasqal_new_literal_expression): e= not e== * src/rasqal_algebra.c: (rasqal_algebra_basic_graph_pattern_to_algebra): Use single filter_expression instead of list of GP constraints (rasqal_algebra_group_graph_pattern_to_algebra): use filter_expression to recognise a single filter expression, remove list of GP constraints * src/rasqal_graph_pattern.c: (rasqal_free_graph_pattern): Use filter_expression to replace constraints_expression (rasqal_graph_pattern_add_constraint, rasqal_graph_pattern_get_constraint_sequence and rasqal_graph_pattern_get_constraint): Deprecated (replacement rasqal_graph_pattern_set_filter_expression, rasqal_graph_pattern_get_filter_expression): Added to replace above. (rasqal_graph_pattern_write_internal): Use single filter_expression to replace walking a list of constraints. * src/rasqal.h: deprecated rasqal_graph_pattern_add_constraint, rasqal_graph_pattern_get_constraint_sequence and rasqal_graph_pattern_get_constraint Added replacement rasqal_graph_pattern_set_filter_expression and rasqal_graph_pattern_get_filter_expression * src/rasqal_engine.c: (rasqal_engine_graph_pattern_constraints_has_qname, rasqal_engine_expand_graph_pattern_constraints_qnames): Check only filter_expression. (rasqal_engine_build_constraints_expression): NOP that may be removed. (rasqal_engine_check_constraint, rasqal_engine_do_step, rasqal_engine_do_optional_step, rasqal_engine_move_constraints, rasqal_engine_graph_pattern_fold_expressions): Use filter_expression to replace constraints_expression (rasqal_engine_merge_graph_patterns): Use filter_expression to replace constraints_expression and no need to check for >1 constraint per GP. * src/rasqal_internal.h: struct rasqal_graph_pattern_s: note constraints field is for support deprecated functions filter_expression field renamed from constraints_expression to follow new GP name. * src/rasqal_internal.h: struct rasqal_query_s loses constraints_sequence; now void* unused1. * src/rasqal_expr.c: (rasqal_new_1op_expression, rasqal_new_2op_expression, rasqal_new_3op_expression, rasqal_new_string_op_expression, rasqal_new_literal_expression, rasqal_new_function_expression, rasqal_new_cast_expression): Free passed in objects on allocation failure or NULL args. * src/rdql_parser.y: (Query): Set query constraint_expression from ConstraintClause (ConstraintClause, CommaAndConstraintClause): Now return expressions and AND a list of Expressions in order (rasqal_rdql_query_engine_prepare): Build a GROUP graph pattern containing a BASIC graph pattern and optionally, a FILTER. * src/rdql_common.h: Add constraint_expression to struct rasqal_rdql_query_engine_s 2008-07-15 Dave Beckett * src/sparql_parser.y: GroupOrUnionGraphPattern is [25] 2008-07-14 Dave Beckett * tests/algebra/test-07.out: fix result * src/sparql_parser.y: (GroupGraphPattern, GraphPatternListOpt): Merge GPs given as args * src/rasqal_query.c: More debug messages tweaking to DEBUG_FH * src/rasqal_engine.c: (rasqal_engine_merge_graph_patterns): Use outer GP op for resulting merged GP. * src/rasqal_algebra.c: (rasqal_algebra_group_graph_pattern_to_algebra): Handle FILTER GP type: add constraints to expression and make filter algebra object. * src/sparql_parser.y: emit huge amounts of debugging to stderr (GroupGraphPattern): partial updates for SPARQL REC grammar It should return a single list of it's internal GPs, not a recursive group GP of group GPs * tests/algebra/Makefile.am: capture stderr for case of errors * src/rasqal_engine.c: docs * src/rasqal_graph_pattern.c: set DO_INDENTING on if RASQAL_DEBUG 2008-07-13 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_group_graph_pattern_to_algebra): Do not deal with BGP with constraints for now * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_write_internal): Code tidy. * src/rasqal_algebra.c: (rasqal_algebra_graph_pattern_to_algebra): Add FILTER type * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_write_indent, rasqal_graph_pattern_write_plurals): Added. (rasqal_graph_pattern_write_internal): Added to write to iostream with optional indenting (rasqal_graph_pattern_print): Use rasqal_graph_pattern_write_internal to write to FILE* * src/rasqal_graph_pattern.c: Added RASQAL_GRAPH_PATTERN_OPERATOR_FILTER * src/rasqal.h: Added RASQAL_GRAPH_PATTERN_OPERATOR_FILTER * src/rasqal_internal.h: Added prototype for rasqal_new_filter_graph_pattern * src/rasqal_graph_pattern.c: (rasqal_new_filter_graph_pattern): Added. * src/rasqal_engine.c: (rasqal_engine_group_2_graph_patterns): Take 1 or 2 GPs to make a new group GP from them. 2008-07-10 Dave Beckett * src/sparql_parser.y: 2008 * src/sparql_parser.y: reorder ConstructQuery [6], DescribeQuery [7] to match sparql REC grammar 2008-07-09 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_basic_graph_pattern_to_algebra): Make a FILTER() algebra node around any constraints in a BGP. * tests/algebra/Makefile.am, tests/algebra/test-07.out, tests/algebra/test-07.rq: Added test-07 (fails) * tests/algebra/Makefile.am, tests/algebra/test-05.out, tests/algebra/test-06.out, tests/algebra/test-06.rq: Added test-06. Expect LeftJoin in test-05 * src/rasqal_algebra.c: "LeftJoin" not "Leftjoin" to be more like sparql algebra form * tests/algebra/test-05.out: test-05 passes * src/rasqal_internal.h: Added rasqal_algebra_node_is_empty prototype * src/rasqal_algebra.c: (rasqal_algebra_node_is_empty): Added to check if algebra node is an empty BGP aka "Z" (rasqal_algebra_remove_znodes): Added to replace join(Z, A) with A and replace join(A, Z) with A (rasqal_algebra_query_to_algebra): Apply rasqal_algebra_remove_znodes over the resulting node. 2008-07-08 Dave Beckett * src/rasqal_engine.c: (rasqal_engine_graph_pattern_order): Commented out. (rasqal_engine_graph_pattern_init): Do not sort GPs (rasqal_engine_merge_graph_patterns): Only merge for GROUP gp * src/rasqal_internal.h: rasqal_new_filter_algebra_node: Renamed from rasqal_new_expr_algebra_node * src/rasqal_algebra.c: (rasqal_new_filter_algebra_node): Renamed from rasqal_new_expr_algebra_node (rasqal_new_2op_algebra_node, rasqal_new_leftjoin_algebra_node): Handle failure and tidy up ownership of parameters. (rasqal_algebra_basic_graph_pattern_to_algebra): Added with just handling BGP graph pattern operation. (rasqal_algebra_union_graph_pattern_to_algebra): Added with just handling UNION graph pattern operation (rasqal_algebra_group_graph_pattern_to_algebra): Added handling GROUP and OPTIONAL graph pattern operations. (rasqal_algebra_graph_pattern_to_algebra): switch now calls above. (main): Create an empty node for rasqal_new_filter_algebra_node test * src/sparql_parser.y: (OptionalGraphPattern): Optional graph pattern is now a list of 1 group graph patterns. This makes it easier for the algebra and any extra GPs will be removed later. 2008-07-07 Dave Beckett * tests/algebra/Makefile.in: Removed Makefile.in * tests/algebra/Makefile.am: write to out output file and always rm it * tests/algebra/Makefile.am, tests/algebra/Makefile.in, tests/algebra/test-05.out, tests/algebra/test-05.rq: Added test-05 (which fails) * tests/algebra/Makefile.am, tests/algebra/Makefile.in, tests/algebra/convert_graph_pattern.c, tests/algebra/test-03.rq, tests/algebra/test-04.out, tests/algebra/test-04.rq: Make convert_graph_pattern just write algebra to stdout for easier command line debugging and checking. Added test-04 * src/rasqal_algebra.c: (rasqal_algebra_graph_pattern_to_algebra): fix UNION order, sparql rec was correct. * src/sparql_parser.y: (GroupOrUnionGraphPattern): Make the sequence of graph patterns in the document order. * configure.ac, tests/Makefile.am, tests/algebra, tests/algebra/Makefile.am, tests/algebra/Makefile.in, tests/algebra/convert_graph_pattern.c, tests/algebra/test-01.out, tests/algebra/test-01.rq, tests/algebra/test-02.out, tests/algebra/test-02.rq, tests/algebra/test-03.out, tests/algebra/test-03.rq: Adde tests/algebra for testing conversion of graph patterns to algebra tree, based on http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#convertGraphPattern * src/rasqal_internal.h: Altered signature of rasqal_algebra_algebra_node_write to remove indent. Added rasqal_algebra_query_to_algebra * src/rasqal_algebra.c: (rasqal_algebra_algebra_node_write_internal): Renamed from rasqal_algebra_algebra_node_write (rasqal_algebra_algebra_node_write): Now takes no indent arg. (rasqal_algebra_graph_pattern_to_algebra): Initial GP to algebra node expression work. (rasqal_algebra_query_to_algebra): Apply rasqal_algebra_graph_pattern_to_algebra to a query graph pattern. * src/rasqal-config.in: --help has to exit 0 * src/rasqal-config.in: restore --help * src/rasqal_algebra.c: (rasqal_algebra_write_indent, rasqal_algebra_algebra_node_write): Write to iostream. (rasqal_algebra_node_print): Write using an iostream to FILE* * src/rasqal_internal.h: Added prototypes for rasqal_literal_write_type, rasqal_literal_write, rasqal_variable_write, rasqal_triple_write, rasqal_expression_write_op, rasqal_expression_write * src/rasqal_expr.c: (rasqal_variable_write, rasqal_triple_write, rasqal_expression_write_op, rasqal_expression_write): Added for writing a variables, triples and expressions to a raptor_iostream 2008-07-06 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_write_type, rasqal_literal_write): Added for writing a literal to a raptor_iostream * src/rasqal_algebra.c: (main) more expr ownership fixes * src/rasqal_algebra.c: (main) copy expr for expr node * src/rasqal_algebra.c: (main) copy expr for leftjoin test * src/Makefile.am, src/rasqal.h, src/rasqal_algebra.c, src/rasqal_internal.h: Added rasqal_algebra class * src/rasqal_query_test.c: (main): Prefer to test with sparql and fix sparql syntax to REC form. * src/rasqal_engine.c, src/rasqal_internal.h: rasqal_engine_gp_data gains max_optional_graph_pattern field from rasqal_graph_pattern since it is about execution not a GP * src/rasqal-config.in: Convert to a wrapper around pkg-config. --libtool-libs is currently ignored, it should emit the path to the librasqal.la file but generally that is probably discouraged. * NEWS.html, RELEASE.html, configure.ac, src/win32_rasqal_config.h: Bump version to 0.9.17 2008-07-05 Dave Beckett * Snapshotted rasqal_0_9_16 for 0.9.16 release (SVN 14220) 2008-07-03 Dave Beckett * RELEASE.html: deprecate rasqal-config 2008-06-29 Dave Beckett * tests/engine/Makefile.am: Remove RASQAL_EXTERNAL_CPPFLAGS * configure.ac, src/Makefile.am: Remove RASQAL_EXTERNAL_CPPFLAGS since all CFLAGS are internal * rasqal.pc.in: Fix includes and cflags * utils/Makefile.am: Link against only internal libs; librasqal will do other linking. * utils/roqet.c: Pick up store results default from envariable RASQAL_DEBUG_STORE_RESULTS to enable batch testing. * src/rasqal_internal.h: rasqal_query_set_store_results is only available if RASQAL_DEBUG * src/rasqal_query.c: (rasqal_query_set_store_results): Only available if RASQAL_DEBUG * src/rasqal_expr.c: (main): Cast for C++ * src/rasqal_literal.c: (rasqal_literal_equals_flags): Less debug noise 2008-06-28 Dave Beckett * tests/engine/rasqal_graph_test.c: Remove C99 .field = value since C++ (or at least G++ 4.0.0) does not support it. * src/rasqal_decimal.c, src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_raptor.c: Casts for C++ 2008-06-26 Dave Beckett * src/rasqal.h: words * Makefile.am, docs/Makefile.am, tests/Makefile.am, tests/engine/Makefile.am, tests/laqrs/Makefile.am, tests/laqrs/syntax/Makefile.am, tests/rdql/Makefile.am, tests/rdql/testsuite/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/Makefile.am, tests/sparql/SyntaxDev/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, utils/Makefile.am, utils/getopt.c, utils/rasqal_getopt.h, utils/roqet.c: 2008 * INSTALL.html, LICENSE.html, NEWS.html, README.html, RELEASE.html, TODO.html, docs/README.html: 2008 * Makefile.am, docs/Makefile.am, src/Makefile.am, tests/Makefile.am, tests/engine/Makefile.am, tests/laqrs/Makefile.am, tests/laqrs/syntax/Makefile.am, tests/rdql/Makefile.am, tests/rdql/testsuite/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/Makefile.am, tests/sparql/SyntaxDev/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, utils/Makefile.am: 2008 * src/rasqal.h, src/rasqal_datetime.c, src/rasqal_decimal.c, src/rasqal_engine.c, src/rasqal_expr.c, src/rasqal_feature.c, src/rasqal_general.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_limit_test.c, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_test.c, src/rasqal_raptor.c, src/rasqal_redland.c, src/rasqal_result_formats.c, src/rasqal_rowsource.c, src/rasqal_skiplist.c, src/rasqal_sparql_xml.c, src/rasqal_xsd_datatypes.c, src/rdql_common.h, src/sparql_common.h, src/strcasecmp.c, src/win32_rasqal_config.h: 2008 * utils/roqet.c: Add --store-results BOOL when debugging, calling (currently) internal rasqal_query_set_store_results * docs/Makefile.am: note FIXME for updating * src/rasqal.h: autodocs * docs/tmpl/section-triples_source.sgml: templates * docs/rasqal-overrides.txt: override rasqal_triples_source FIXME automate keeping this up-to-date * src/rasqal_general.c: (rasqal_free_world): autodocs * docs/rasqal-sections.txt: Removed rasqal_triples_match_s * docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-query_results_formatter.sgml, docs/tmpl/section-triples_source.sgml, docs/tmpl/section-unused.sgml, docs/tmpl/section-variable.sgml: Update tmpls * docs/rasqal-overrides.txt: override rasqal_triples_match FIXME automate keeping this up-to-date * docs/rasqal-sections.txt: Added rasqal_triples_match_s * docs/tmpl/section-xsd.sgml: title * src/rasqal_engine.c: Remove RASQAL_ENGINE_EVAL_LAZY macro and trigger off query->store_results flag. struct rasqal_rowsource_engine_context gains offset field and renamed need_map to need_store_results (rasqal_rowsource_engine_init): Init row offset (rasqal_rowsource_engine_process): Add read all flag, use context offset and if not reading all, end after one result when not storing. (rasqal_rowsource_engine_read_row, rasqal_rowsource_engine_read_all_rows): Add read all flag. (rasqal_engine_execute_and_save): Remove local rowsource here and use one in query_results so that stored and lazy queries can use it. (rasqal_engine_execute_run): Stored and lazy both use this code an init a rowsource, use rasqal_engine_execute_and_save if necessary. (rasqal_engine_execute_next_lazy): Renamed from rasqal_engine_excute_next_lazy. Removed FIXME to execute with rowsource. * src/rasqal.h: describe rasqal_triples_match function prototypes. another prototype fix. update prototypes to make gtkdoc-scan happier: use param names. * docs/rasqal-overrides.txt: override world * docs/rasqal-sections.txt: more new functions/macros * src/rasqal.h: remove ws for gtkdoc-scan * src/rasqal.h: autodocs * docs/rasqal-sections.txt: Added rasqal_free_world rasqal_new_variable_from_variable rasqal_new_world rasqal_query_results_formatter_read rasqal_query_results_read rasqal_world * docs/rasqal-sections.txt: Removed rasqal_expression_foreach_fn rasqal_expression_foreach rasqal_graph_pattern_get_flags * docs/rasqal-sections.txt: Remove rasqal_finish rasqal_init rasqal_new_floating_literal * src/rasqal_query.c: (rasqal_query_set_store_results): Added. * src/rasqal_internal.h: Added rasqal_query_set_store_results struct rasqal_query_s gains a store_result field. * utils/roqet.c: Separate use of HAVE_GETOPT_H (external header) from HAVE_GETOPT (internal) * src/sparql_parser.y: Include unistd.h if present. * configure.ac: Try unistd.h when searching for optind * src/rasqal_decimal.c: (main): Use %f for double, not %lf * configure.ac: Use AC_PROG_CC and AM_PROG_CC_C_O to replace AM_PROG_CC_STDC (obsolete) to stop configure warnings * src/sparql_parser.y: Separate use of HAVE_GETOPT_H (external header) from HAVE_GETOPT (internal) 2008-06-23 Dave Beckett * src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_redland.c: (rasqal_literal_to_redland_node, rasqal_free_literal, rasqal_literal_print, rasqal_literal_as_boolean, rasqal_literal_as_integer, rasqal_literal_as_floating, rasqal_literal_as_uri, rasqal_literal_as_string_flags, rasqal_literal_rdql_promote_calculate, rasqal_literal_compare, rasqal_literal_equals_flags, rasqal_query_write_sparql_literal, rasqal_query_write_sparql_expression): Replaced abort() with RASQAL_FATAL[12]() mostly as the default: action of switch() statements. This calls abort() only for developer use, just a warning for end users. 2008-06-22 Dave Beckett * utils/roqet.1: split main & other options * utils/roqet.1: formatting * utils/roqet.1: update for 0.9.15 & 0.9.16 * utils/roqet.c: 2008 (rdql_parser_error): Removed, unused code. * docs/librasqal.3: Noted removal of rasqal_init and rasqal_finish 2008-06-21 Dave Beckett * src/rasqal.h, src/rasqal_expr.c, src/rasqal_graph_pattern.c: Removed deprecated functions and macros. (rasqal_graph_pattern_get_flags): Deleted. (rasqal_expression_foreach): Deleted. RASQAL_LITERAL_FLOATING macro deleted. rasqal_expression_foreach_fn typedef deleted. * docs/librasqal.3: Updated for old release 0.9.15 of 2007-11-17 * src/rasqal-config.in: Add /usr/include/rasqal to cflags * src/Makefile.am: Install rasqal headers in /usr/include/rasqal as promised 2008-05-22 Lauri Aalto * src/sparql_lexer.l: Fixed sparql lexer error handling. Do not report OOM for failed function calls that can fail for other reasons besides OOM, e.g. qname expansion fails due to undeclared prefix. (sparql_lexer_fatal_error): Removed abort() call, let caller terminate the lexer. 2008-05-16 Dave Beckett * src/rasqal_result_formats.c: (rasqal_iostream_write_json_boolean): Renamed from raptor_iostream_write_json_boolean and fix to emit a " before the name. 2008-05-06 Lauri Aalto * src/rasqal_query.c: (rasqal_query_prepare): Resiliency fix: avoid raptor_free_memory(0) 2008-05-05 Lauri Aalto * src/rasqal_engine.c: (rasqal_free_gp_data, rasqal_free_engine_execution_data): Assert on passed in pointer, not on uninitialized variable. 2008-05-01 Dave Beckett * src/rasqal_decimal.c, src/rasqal_engine.c, src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_graph_pattern.c, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_rowsource.c, src/rasqal_skiplist.c: Add NULL pointer asset checks for destructors * src/sparql_lexer.l: Use setjmp/longjmp to handle error recovery * src/rdql_lexer.l: Use setjmp/longjmp to handle error recovery * src/rdql_parser.y: (rdql_query_error): Return void, it never has a status * src/rasqal_internal.h: Added asset macros 2008-04-15 Dave Beckett * RELEASE.html: html 2008-04-14 Dave Beckett * src/rdql_common.h, src/rdql_parser.y, src/sparql_common.h, src/sparql_parser.y: Count errors in SPARQL and RDQL syntax parsing and do not report errors after the first one. A workaround instead of adding full bison error parser recovery. 2008-04-14 Lauri Aalto * src/rasqal_literal.c: (rasqal_literal_as_node): Resiliency fix: Check for NULL literal. 2008-04-09 Lauri Aalto * src/rasqal_literal.c: (rasqal_literal_as_node): Turn variables pointing to non-string literals into string literals. Fixes "Triple with unknown object skipped" errors in graph queries like SPARQL CONSTRUCT. 2008-03-29 Dave Beckett * utils/srxread.c: Update for rasqal_new_query_results_formatter world param. 2008-02-25 Lauri Aalto * src/rasqal_general.c, src/rasqal_query.c: Ported rasqal to r13695 raptor error handler changes. 2008-02-24 Lauri Aalto * src/Makefile.am: flex-generated header file does not need fixing with fix-flex. It already has YY_NO_UNISTD_H guard and all other fix-flex issues are for .c files only. Fixes warnings due to multiple inclusion of rasqal_config.h. 2008-02-16 Dave Beckett * autogen.sh, autogen.sh, autogen.sh, autogen.sh, autogen.sh: autogen checks when env prog version is empty. Update all packages to latest autogen.sh 2008-02-12 Lauri Aalto * src/rasqal_engine.c: (rasqal_rowsource_engine_finish): Low-memory leak fix. Ensure map is always freed. 2008-02-07 Lauri Aalto * src/rasqal_engine.c: (rasqal_engine_execute_and_save): Set finished flag if returning finished status. Another fix to prevent reaching the r13516 FIXME HACK abort() branch in rasqal_engine_excute_next_lazy() in low-memory situations. * src/rasqal_engine.c: (rasqal_rowsource_engine_process): Removed unreachable conditional code. * src/rasqal_engine.c: (rasqal_engine_execute_and_save): Set query results to finished state if results_sequence is NULL. Prevents reaching the r13516 FIXME HACK abort() branch in rasqal_engine_excute_next_lazy() on low-memory situations. 2008-02-02 Dave Beckett * src/rasqal_sparql_xml.c: (rasqal_query_results_get_rowsource_sparql_xml): Use updated SVN raptor_error_handlers_init call. 2008-01-29 Lauri Aalto * src/Makefile.am: Fixed configuration error: build rasqal getopt if GETOPT is true, not vice versa. Fixes sparql_parser_test in some environments where getopt.h declares optind/optarg differently from rasqal_getopt. E.g. on cygwin getopt.h has __declspec(dllimport) declarations. 2008-01-28 Lauri Aalto * src/sparql_parser.y: sparql_parser_test: Fixed crash from calling rasqal_free_world() with an uninitialized world. 2008-01-20 Dave Beckett * docs/Makefile.am, tests/rdql/testsuite/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, utils/Makefile.am: Replace bare perl with $(PERL) * src/Makefile.am: Make sparql_parser_test work when getopt isn't around * tests/engine/rasqal_order_test.c: Back to Unix line endings * configure.ac, src/rasqal_decimal.c: Added test for gmp_version * configure.ac: Use gmp.h in mpfr.h check just to prevent configure warning, not to ever use it * configure.ac, docs/tmpl/rasqal-unused.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results_formatter.sgml, docs/tmpl/section-triples_source.sgml: Make MPFR test check for functions in mpfr that are not in ancient gmp version of mpfr 2008-01-15 Lauri Aalto * src/rasqal_engine.c: (rasqal_engine_bind_construct_variables): Create copies of variable values to prevent literal double deletion. * src/rasqal_query_results.c: (rasqal_new_query_results): Explicitly set bindings results type for select queries. Worked previously because RASQAL_QUERY_RESULTS_BINDINGS == 0. (rasqal_query_results_set_variables): Removed commented out code. * src/rasqal_internal.h: Removed rdf uri extern references - uris moved to rasqal_world. 2008-01-14 Lauri Aalto * src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: (rasqal_prefix_id) Moved from rasqal_query.c to rasqal_query_results.c static function. Do not free passed in string. (rasqal_query_results_get_triple) Do not change nodeids of existing blanks but create new blanks for new prefixed nodeids. Fixes Issue#0000242 http://bugs.librdf.org/mantis/view.php?id=242 Do not leak stored query_result->triples. * configure.ac: Applied rasqal_strcasecmp configuration patch from http://bugs.librdf.org/mantis/view.php?id=249 * src/rasqal_literal.c: (rasqal_literal_as_node): Refactored to simpler form. rasqal_new_literal_from_literal(NULL) returns NULL since r12808. * autogen.sh: Do not branch autogen.sh scripts but keep them identical 2008-01-13 Dave Beckett * autogen.sh: automake 1.0 docs 2008-01-13 Lauri Aalto * src/rasqal_engine.c: (rasqal_rowsource_engine_ensure_variables): Update rowsource size properly for construct queries. 2008-01-11 Lauri Aalto * src/rasqal.h, src/rasqal_query.c: (rasqal_query_add_prefix): Changed to return an error code. API function signature touched but source compatibility not broken. * src/rasqal.h, src/rasqal_query.c: (rasqal_query_add_variable): Changed to return an error code. API function signature touched but source compatibility not broken. * src/rasqal.h, (rasqal_graph_pattern_add_sub_graph_pattern): Changed to return an error code. API function signature touched but source compatibility not broken. 2008-01-10 Lauri Aalto * src/rasqal_general.c, src/rasqal_internal.h: (rasqal_world_s) Removed usage field. No longer needed. * src/rasqal.h, src/rasqal_literal.c: API break: Removed rasqal_new_floating_literal() * src/rasqal_internal.h, src/rasqal_literal.c (rasqal_new_numeric_literal): Changed function param ordering to be consistent with e.g. rasqal_new_integer_literal(). * src/rasqal.h, src/rasqal_engine.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_limit_test.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_test.c, src/rasqal_raptor.c, src/rasqal_redland.c, src/rasqal_result_formats.c, src/rdql_parser.y, src/sparql_parser.y, tests/engine/rasqal_graph_test.c, tests/engine/rasqal_order_test.c, utils/roqet.c: API break: Removed rasqal api functions deprecated in the recent re-engineering efforts. Renamed new *2 functions to original names that now take in a rasqal_world pointer. * src/rdql_lexer.l, src/sparql_lexer.l: Fixed lexer tests - initialize query->world needed by rasqal_literal constructors * src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_xsd_datatypes.c, src/sparql_parser.y: Moved xsd namespace uri and datatype uris to rasqal_world. (rasqal_xsd_datatype_uri_to_type, rasqal_xsd_datatype_type_to_uri, rasqal_xsd_is_datatype_uri, rasqal_xsd_datatype_uri_parent_type): Functions now take in a rasqal_world pointer. * utils/srxread.c: Updated srxread to new rasqal_query_results_formatter_read() API * src/rasqal.h, src/rasqal_engine.c, src/rasqal_redland.c: Updated rasqal_redland to new rasqal_literal API. Store rasqal_world pointer to rasqal_triples_match structure. Compiles but not tested. * src/rasqal.h, src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_query_results.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_sparql_xml.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Added rasqal_world pointer to rasqal_literal. (rasqal_new_*_literal, rasqal_new_decimal_literal_from_decimal): API break. rasqal_literal constructors take in rasqal_world pointer. (rasqal_new_floating_literal): Old deprecated function changed to return NULL. (rasqal_new_string_literal_node): Now takes in a rasqal_world* param. (rasqal_query_results_get_rowsource_func): Now takes in a rasqal_world* param. (rasqal_query_results_formatter_read): API break. Takes in rasqal_world pointer. Passed to get_rowsource function. (rasqal_query_results_get_rowsource_sparql_xml): Store rasqal_world* in rowsource context for creating new literals. * src/rasqal_xsd_datatypes.c: (rasqal_xsd_datatype_check): Fixed compiler warning about signed-unsigned comparison * src/rasqal_xsd_datatypes.c: (rasqal_xsd_init, rasqal_xsd_datatype_check, rasqal_xsd_datatype_label): Use compile-time initialization for xsd datatype names and check functions. Prepare for moving xsd uris to rasqal_world. * src/rasqal_expr.c: Fixed xsd init/finish in rasqal_expr tests. 2008-01-09 Lauri Aalto * src/rasqal.h, src/rasqal_general.c, src/rasqal_result_formats.c: const function params make no sense - they will be copies anyway (pointer-to-const params would make sense) * src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: (rasqal_xsd_init, rasqal_xsd_finish): Add world param. Not used yet. * src/rasqal.h, src/rasqal_engine.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_raptor.c, src/rasqal_redland.c: Moved triples_source_factory to rasqal_world. (rasqal_set_triples_source_factory): Deprecated API function. Replaced with rasqal_set_triples_source_factory2() that takes in a world parameter. (rasqal_raptor_init, rasqal_redland_init): Now take a world param and use rasqal_set_triples_source_factory2(). * src/rasqal_internal.h: (rasqal_log_error_varargs): Declare with printf format attribute. Fixes gcc warnings. * src/rasqal_decimal.c: Fixed compiler warning in rasqal_decimal test code with RASQAL_DECIMAL_NONE configuration. * utils/roqet.c: Update roqet to non-deprecated API. * src/rasqal.h, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_sparql_xml.c: Moved static query_results_formats sequence to rasqal_world. (rasqal_query_results_formats_enumerate, rasqal_query_results_formats_check, rasqal_new_query_results_formatter, rasqal_new_query_results_formatter_by_mime_type): Deprecated API functions. Replaced with corresponding *2 versions that take in a rasqal_world pointer. (rasqal_query_results_format_register_factory): Take in rasqal_world param. Return an error code. Use calloc not malloc for structs. Replace RASQAL_FATAL with fatal log message + return error code. (rasqal_init_result_formats): Take in a rasqal_world param. Check and return error codes from rasqal_query_results_format_register_factory() calls. (rasqal_init_result_format_sparql_xml): Take in a rasqal_world param, return an error code. Check and return error codes from rasqal_query_results_format_register_factory() calls. (rasqal_finish_result_formats): Take in a rasqal_world param. (rasqal_query_results_read, rasqal_query_results_write): Use non-deprecated API. * src/rasqal_graph_pattern.c, src/rasqal_query.c, src/rasqal_result_formats.c: Added FIXME notes to places where RASQAL_FATAL macros are used for handling runtime failures and not programming errors. Should change the code to handle runtime failures more gracefully. * src/rasqal_general.c, src/rasqal_internal.h, src/rdql_parser.y, src/sparql_parser.y: (rasqal_query_engine_register_factory): Changed function to return an int error code. On OOM, log an error and return an error code, do not die with a fatal error. (rasqal_init_query_engine_*): Return error code from rasqal_query_engine_register_factory(). * src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_raptor.c, src/rasqal_redland.c, src/rasqal_result_formats.c, src/rdql_parser.y, src/sparql_parser.y: Changed rasqal internal init functions to return an int error code. (rasqal_new_world): Check for init function failures and return NULL on failure. (rasqal_init): Check for NULL world. * src/rasqal_internal.h: (rasqal_world_s) comments * src/rasqal_general.c, src/rasqal_internal.h: Eliminated rasqal_initialised, rasqal_initialising, rasqal_finishing statics. Provide protection against recursive rasqal_init() calls by making the static world object a reference-counted singleton. * src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_internal.h, src/sparql_parser.y: Moved rdf uris to rasqal_world. (rasqal_uri_init): Take in world parameter, return an error code. (rasqal_uri_finish): Take in world parameter. (rasqal_new_world): Check rasqal_uri_init() return value. 2008-01-08 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate_strmatch): Fix error/warning messages in RASQAL_REGEX_{PCRE,NONE} configurations. 2008-01-07 Dave Beckett * src/rdql_parser.y, src/sparql_parser.y: rdql and sparql warnings do not fail the query * src/rasqal_engine.c, src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_result_formats.c, src/rasqal_sparql_xml.c, src/rdql_parser.y, src/sparql_parser.y: Set query failed flag when calling new log error functions * src/rdql_parser.y, src/sparql_parser.y: (rdql_query_error, sparql_query_error): Set failed flag on query * src/rasqal_general.c: (rasqal_new_world): Init error handlers magic here * src/rasqal_query.c: (rasqal_new_query2): Set query->world * src/rasqal_engine.c, src/rasqal_expr.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_sparql_xml.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Replace calls to rasqal_query_warning/error/fatal using rasqal_query with rasqal_log_error_simple or rasqal_log_error_varargs and rasqal_world * src/rasqal_internal.h: Fix RASQAL_PRINTF_FORMAT use for rasqal_log_error_simple * src/rasqal_general.c: (rasqal_log_error_simple, rasqal_log_error_varargs, rasqal_log_error): Added, using error handlers inside rasqal_world* (rasqal_query_simple_error): Added for query errors from namespaces API. (rasqal_query_fatal_error, rasqal_query_fatal_error_varargs, rasqal_query_error, rasqal_query_simple_error, rasqal_query_error_varargs, rasqal_query_warning, rasqal_query_warning_varargs): Removed. * src/rasqal_internal.h: rasqal_query gains a rasqal_world field and loses fatal/error/warning user data and handlers. Added methods of rasqal_world: rasqal_log_error_simple, rasqal_log_error_varargs, rasqal_log_error, rasqal_query_simple_error. Removed rasqal_query_fatal_error, rasqal_query_fatal_error_varargs, rasqal_query_error, rasqal_query_simple_error, rasqal_query_error_varargs, rasqal_query_warning, rasqal_query_warning_varargs. rasqal_world gains error_handlers field. * src/rasqal_general.c, src/rasqal_query.c, src/rdql_parser.y, src/sparql_parser.y: (sparql_parse, rdql_parse, rasqal_query_execute): Remove calls to unused query factory method execute. (rasqal_sparql_query_engine_execute, rasqal_rdql_query_engine_execute): Removed 2008-01-07 Lauri Aalto * tests/engine/rasqal_graph_test.c: Fixed eol style in rasqal_graph_test.c 2008-01-07 Dave Beckett * src/rasqal_internal.h: struct rasqal_query_engine_factory_s remove execute() factory method 2008-01-07 Lauri Aalto * utils/roqet.c, utils/srxread.c: Update utils to non-deprecated APIs. * src/rasqal_limit_test.c, src/rasqal_query_test.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y, tests/engine/rasqal_graph_test.c, tests/engine/rasqal_order_test.c: Update tests to non-deprecated APIs. * src/rasqal.h, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query.c, src/rdql_parser.y, src/sparql_parser.y: First increment on moving rasqal static data to behind a world object like librdf: move query_engines to rasqal_world. Preserve old library API but deprecate functions where a world object would be needed and provide a new function. Deprecated functions provide backwards compatibility with a static rasqal_world variable that can be flagged out at compile time with NO_STATIC_DATA. (rasqal_init, rasqal_finish): Deprecated, use rasqal_new_world() and rasqal_free_world(). (rasqal_languages_enumerate, rasqal_language_name_check, rasqal_new_query): Deprecated, use the the *2 versions with a world object instead. (rasqal_init_query_engine_*, rasqal_query_engine_register_factory, rasqal_get_query_engine_factory): Internal functions to take in rasqal_world parameter. * src/rasqal_engine.c, src/rasqal_rowsource.c: (rasqal_engine_make_rowsource, rasqal_new_rowsource_from_handler): Re-engineer fix from r13534. Make rasqal_new_rowsource_from_handler() to take ownership of the passed in context in all cases. Set rowsource->user_data and rowsource->handler earlier as they are needed by rasqal_free_rowsource(). * src/rasqal_engine.c: (rasqal_engine_make_rowsource): Lowmem leak fix. Free rasqal_rowsource_engine_context if rasqal_new_rowsource_from_handler() fails. * src/rasqal_query_results.c: (rasqal_query_results_set_variables(rasqal_query_results): Set query_results->size late to ensure it is not larger than the number of valid pointers in the arrays. Use calloc and not malloc for pointer arrays. * src/rasqal_query_results.c: (rasqal_query_results_set_variables): Fix low-memory crashes by keeping query_results variables and variable_names in sync with results size. * src/rasqal_query_results.c: (rasqal_query_results_set_variables): Do not leak old variables_sequence. * src/rasqal_query.c: (rasqal_query_execute): Cleaned up commented out code. 2008-01-05 Dave Beckett * src/rasqal_result_formats.c: (rasqal_query_results_formatter_read): error path * src/rasqal_rowsource.c: code style * src/rasqal_sparql_xml.c: Code style * src/rasqal_general.c: 2008 * src/rasqal_query_results.c: (rasqal_free_query_results): Free variables_sequence * src/rasqal_sparql_xml.c: (rasqal_rowsource_sparql_xml_finish): Free any base_uri given. * Last known good revision 13398: 'make check' succeeds. 2008-01-05 Dave Beckett * src/Makefile.am, src/rasqal_result_format_sparql_xml.c, src/rasqal_sparql_xml.c: Filename too long. mv rasqal_result_format_sparql_xml.c rasqal_sparql_xml.c * src/rasqal_engine.c: (rasqal_engine_query_result_row_update): Pass in results, it's not a field of row anymore. (rasqal_engine_query_result_row_compare): Use rasqal_rowsource_get_query to get query from a row's rowsource. Added rowsource for execute and save method with context rasqal_rowsource_engine_context (rasqal_rowsource_engine_init, rasqal_rowsource_engine_finish, rasqal_rowsource_engine_ensure_variables, rasqal_rowsource_engine_read_row, rasqal_rowsource_engine_read_all_rows, rasqal_rowsource_engine_get_query): Added as rowsource handlers for execute and save method. (rasqal_rowsource_engine_process): Added as helper for above. (rasqal_engine_make_rowsource): Added to construct the rowsource for the execute and save method (rasqal_engine_execute_and_save): Cut down into all the rowsource functions above. The rowsource is made here and destroyed here. (rasqal_engine_excute_next_lazy): Call rasqal_new_query_result_row() wrongly with NULL in order to just get it compiling. Added an abort() to ensure nobody ever calls this. Since lazy execution is disabled for now, this should not happen. Added FIXME note. * src/rasqal_result_format_sparql_xml.c: Rename internal functions/structs from *xml_result4* to *sparql_xml* rasqal_rowsource_sparql_xml_context gains rowsource and variables_count fields, loses results and variables_sequence. (rasqal_sparql_xml_sax2_start_element_handler): Remove variables_sequence code. Use rasqal_rowsource_add_variable to add a variable. Use rasqal_rowsource_get_variable_offset_by_name to lookup variable names. (rasqal_sparql_xml_sax2_end_element_handler): Initialise variables_count and indicate header is done at end of 'head' element. (rasqal_rowsource_sparql_xml_init): Init rowsource. (rasqal_rowsource_sparql_xml_finish): Delete variables_sequence free. (rasqal_rowsource_sparql_xml_process): Added, pulled from old rasqal_rowsource_xml_result4_read_row to update needed data. (rasqal_rowsource_sparql_xml_ensure_variables): Added to ensure variables are found via rasqal_rowsource_sparql_xml_process. (rasqal_rowsource_sparql_xml_read_row): Use rasqal_rowsource_sparql_xml_process to get rows. * src/rasqal_query_results.c: (rasqal_new_query_results): Update rasqal_query_results_set_variables call with 0 order_size. (rasqal_free_query_results): Free rowsource with rasqal_free_rowsource. (rasqal_new_query_result_row): Take rowsource arg and delegate all size stuff to rowsource. Use rasqal_rowsource_get_sizes to get the sizes. (rasqal_query_results_set_variables): Add order_size arg. Do a true copy of the incoming variables. (rasqal_query_result_row_print): Use rowsource to get row info. * src/rasqal_query.c: (rasqal_query_execute): Remove old commented out hack and use rasqal_query_results_set_variables with order_size. * src/rasqal_internal.h: rasqal_query_row gains rowsource field replacing results. rasqal_query_results gains rowsource field. rasqal_rowsource_ensure_variables_func renamed from rasqal_rowsource_update_variables_func and no longer takes results arg. Added handlers rasqal_rowsource_read_all_rows_func and rasqal_rowsource_get_query_func rasqal_rowsource_handler gains handlers for read_all_rows and get_query. update_variables handler is renamed ensure_variables. Moved struct rasqal_rowsource_s from rasqal_rowsource.c to here. Updated rasqal_new_rowsource_from_handler to take flag arg and defined one flag RASQAL_ROWSOURCE_FLAGS_ORDERING. Added prototypes for rasqal_rowsource_read_all_rows, rasqal_rowsource_get_query, rasqal_rowsource_add_variable, rasqal_rowsource_get_sizes, rasqal_rowsource_get_variable_by_offset and rasqal_rowsource_get_variable_offset_by_name Adjust rasqal_new_query_result_row prototype to now take a rowsource arg Adjust rasqal_query_results_set_variables to now take an order_size arg too. * src/rasqal_rowsource.c: Moved struct rasqal_rowsource_s back into rasqal_internal.h (rasqal_new_rowsource_from_handler): Added flags arg to allow maintaining an extra of row of values in a rasqal_query_results_row, of size order_size. (rasqal_rowsource_add_variable): Added for adding a variable to the sequence and maintaining the counts for row width and order values row width. (rasqal_rowsource_update_variables): Rename to use ensure_variables factory name. Call rasqal_query_results_set_variables here. (rasqal_rowsource_read_row): field ended is now called finished. (rasqal_rowsource_read_all_rows): Added to get a sequence from the results either via a factory method, or building it here. (rasqal_rowsource_get_query): Added, to return the query associated if any. (rasqal_rowsource_get_sizes): Added, to return the row width and order values row width. (rasqal_rowsource_get_variable_by_offset): Added, to return a variable in the sequence. (rasqal_rowsource_get_variable_offset_by_name): Added to lookup a variable by name. * src/rasqal_expr.c: (rasqal_new_variable_from_variable): Added. (rasqal_new_expression_from_expression): Return NULL if asked to copy NULL. * src/rasqal.h: Added rasqal_new_variable_from_variable 2008-01-04 Dave Beckett * src/rasqal_result_formats.c: (rasqal_query_results_formatter_read): Call rasqal_rowsource_update_variables with results arg. * src/rasqal_internal.h: rasqal_rowsource_update_variables_func gains results arg rasqal_rowsource_update_variables gains results arg. * utils/srxread.c: Removed everything except main code. (main): Rewrite in terms of formatter and use rasqal_query_results_formatter_read to fill in results. * src/rasqal_rowsource.c: (rasqal_new_rowsource_from_handler): Check handler not rowsource->handler * src/Makefile.am, src/rasqal_internal.h, src/rasqal_result_format_sparql_xml.c, src/rasqal_result_formats.c: Move SPARQL XML functions from rasqal_result_formats.c to rasqal_result_format_sparql_xml.c. Add rasqal_result_format_sparql_xml.c to library * utils/srxread.c:: copy src/rasqal_result_format_sparql_xml.c to utils/srxread.c * src/rasqal_result_format_sparql_xml.c: Move utils/srxread.c to src/rasqal_result_format_sparql_xml.c * src/rasqal_result_formats.c: (rasqal_query_results_format_register_factory): Add get_rowsource arg. (rasqal_init_result_formats): Init rowsource for sparql xml reader, remove reader for same. (rasqal_rowsource_xml_result4_init, rasqal_rowsource_xml_result4_finish, rasqal_rowsource_xml_result4_update_variables, rasqal_rowsource_xml_result4_read_row): Skeleton functions added. struct rasqal_rowsource_xml_result4_handler added. (rasqal_query_results_getrowsource_xml_result4): Added. (rasqal_query_results_read_xml_result4): Removed. (rasqal_query_results_formatter_read): Use get_rowsource factory method if the reader method is missing. * src/Makefile.am: Add rasqal_rowsource.c * src/rasqal_rowsource.c: Add rasqal_rowsource.c * utils/srxread.c: rewrite in style of rowsource handler functions. srxread_userdata becomes rasqal_rowsource_xml_result4_context ud becomes con (init_ud): Added (rasqal_rowsource_xml_result4_read_row): Renamed from get_row_ud (rasqal_rowsource_xml_result4_finish): Renamed from free_ud * src/rasqal_internal.h: Added rasqal_rowsource typedef and handler typedefs: rasqal_rowsource_init_func, rasqal_rowsource_finish_func, rasqal_rowsource_update_variables_func, rasqal_rowsource_read_row_func,. Added rasqal_rowsource_handler typedef. Added rasqal_new_rowsource_from_handler, rasqal_free_rowsource, rasqal_rowsource_update_variables, rasqal_rowsource_read_row, rasqal_rowsource_get_rows_count Added rasqal_query_results_get_rowsource_func handler for results formatter. rasqal_query_results_format_factory gains get_rowsource field. * src/rasqal_query_results.c: (rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name, rasqal_query_results_get_boolean): Remove unused var query * utils/srxread.c: Use rasqal_query_result_row_set_value_at * src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_query_result_row_set_value_at): Added 2008-01-03 Dave Beckett * utils/srxread.c: Use raptor_qname_get_counted_value * utils/srxread.c: Document and re-order ud fields. Removed variables_count - can be done by counting sequence. * utils/srxread.c: Switch from init/parse/free ud to create/get row/free ud (create_ud): Renamed from init_ud. Allocate ud (get_row_ud): Renamed from parse_ud: Store rows in temporary array during one SAX2 parse / callback sequence and return first one to caller. (free_ud): Free ud (main): Use get_row_ud to get rows and store in results. * utils/srxread.c: Set variables as soon as possible - at end of head element. Save rows to internal sequence then move after returning from sax2 parse. * src/rasqal_internal.h, src/rasqal_query_results.c: (rasqal_query_results_add_row): Added * utils/srxread.c: (init_ud): returns status, remove sax2 local var (parse_ud): remove printf. (main): Handle init_ud failure * utils/srxread.c: (main): use rasqal_query_results_get_bindings_count * utils/srxread.c: pull userdata code from main() into init_ud(), parse_ud() and free_ud() * utils/srxread.c: Use rasqal_new_string_literal_node to prevent formation of native types. Push rows correctly * src/rasqal_literal.c: (rasqal_new_string_literal_common): static * src/rasqal_engine.c: (rasqal_engine_check_limit_offset, rasqal_engine_bind_construct_variables): Handle NULL query * src/rasqal_literal.c: (rasqal_new_string_literal_common): Added, pulled out of rasqal_new_string_literal with extra flags arg to avoid native type promotion. (rasqal_new_string_literal): Use rasqal_new_string_literal_common with native type promotion (rasqal_new_string_literal_node): Added, using rasqal_new_string_literal_common without native type promotion. * src/rasqal_internal.h: Added rasqal_new_string_literal_node prototype 2008-01-03 Lauri Aalto * src/rasqal_query.c: (rasqal_query_execute): Commented out unused variable. * src/rasqal_query_results.c: (rasqal_query_results_get_binding_name): Fix low-memory crash: check for NULL variables array. Removed unnecessary local variable. * src/rasqal_query.c: (rasqal_query_execute): Commented out unused & leaked variables_sequence copy. * src/rasqal_query_results.c: (rasqal_query_results_set_variables): Do not change query_results type - rasqal_query_results_set_variables() is called from rasqal_query_execute() for all types of queries. * src/rasqal_query.c: (rasqal_query_execute): Added FIXME note for a memory leak. * src/rasqal_query_results.c: (rasqal_free_query_results, rasqal_query_results_set_variables): Do not leak query_results->variables, query_results->variable_names * src/rasqal_query_results.c: (rasqal_free_query_results): Fix double deletion - variables_sequence is owned by query not query_results. 2008-01-03 Dave Beckett * utils/srxread.c: Update to set variables with no values and use query results formatter to emit results. * src/rasqal_query.c: (rasqal_query_execute): Update call to rasqal_query_results_set_variables with a new sequence of variables, not names. It shares variables with rasqal_query for now - this is a HACK and needs fixing. * src/rasqal_query_results.c: (rasqal_new_query_results): Use rasqal_query_results_set_variables when setting bindings. (rasqal_free_query_results): Free variables_sequence (rasqal_query_results_get_count): Handle NULL query (rasqal_query_results_get_bindings): No need for query here, get variable_names from results. (rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_name): Get variables size from query_results size. (rasqal_query_results_get_binding_value_by_name): Get variables from query_results variables[] (rasqal_query_results_set_variables): Just get a variables_sequence, everything else can be computed from it. (rasqal_query_result_row_print): Get variable_names from query_results. * src/rasqal_internal.h: struct rasqal_query_results_s gains fields: variables_sequence, variables just like rasqal_query_s * src/rasqal_expr.c: (rasqal_new_variable_typed): Work when query is NULL. 2008-01-02 Dave Beckett * src/rasqal_query_results.c: (rasqal_new_query_results): Init query results type (rasqal_query_results_is_bindings, rasqal_query_results_is_boolean, rasqal_query_results_is_graph, rasqal_query_results_is_syntax): Use query results type. * src/rasqal_internal.h: Added rasqal_query_results_type enum rasqal_query_results_s gains type field * utils/srxread.c: Replace FILE* to with read raptor_iostream * utils/srxread.c: Conditional-compile tracing with RASQAL_DEBUG > 2 * docs/rasqal-sections.txt: remove rasqal_query_results_formats_enumerate_full * src/rasqal_result_formats.c: compile * utils/roqet.c: Update for rasqal_query_results_formats_enumerate taking mime_type and flags pointer args. * src/rasqal_result_formats.c: (rasqal_query_results_format_register_factory): Add reader arg. (rasqal_init_result_formats): Register readers, only rasqal_query_results_read_xml_result4 for "xml" name. (rasqal_query_results_read_xml_result4): Added. (rasqal_query_results_formats_enumerate_full): Removed (rasqal_query_results_formats_enumerate): Added two args - mime_type and flags. Was rasqal_query_results_formats_enumerate_full with just mime_type. Set flags if pointer is not null. (rasqal_query_results_read_xml_result4): Added, doing no work. (rasqal_query_results_formatter_write): Added, moved from rasqal_query_results.c (rasqal_query_results_formatter_read): Added. * src/rasqal_query_results.c: (rasqal_query_results_formatter_write): Moved to rasqal_result_formats.c (rasqal_query_results_read): Added * src/rasqal_internal.h: Renamed rasqal_query_results_writer typedef to rasqal_query_results_formatter_func rasqal_query_results_format_factory gains reader field. * src/rasqal.h: Added rasqal_query_results_read. Removed rasqal_query_results_formats_enumerate_full and added two args to rasqal_query_results_formats_enumerate: mime_type and flags. Added rasqal_query_results_formatter_read 2008-01-02 Lauri Aalto * src/rasqal_query.c: (rasqal_query_execute) Low-memory fixes. Set query_results->executed flag earlier to enable cleanup with rasqal_free_query_results(). Check for variable_names sequence alloc failure. Pass ownership of variable_names sequence to query_results earlier to clean it up with rasqal_free_query_results() on error. * src/rasqal_query.c: (rasqal_query_execute) Check for var_name alloc failures. rasqal-0.9.33/rasqal-src-config.in0000644000175000017500000000352411513400374013657 00000000000000#!/bin/sh # # rasqal library - utility for getting config to compile against source tree # # Copyright (C) 2003-2009, 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. # # # usage() { cat<&2 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --version) echo @VERSION@ exit 0 ;; --cflags) echo_cflags=yes ;; --libs) echo_libs=yes ;; --help|--usage) usage 0 ;; *) usage 1 1>&2 ;; esac shift done config="pkg-config raptor2" if test "$echo_cflags" = "yes"; then echo -I@abs_top_srcdir@/src `$config --cflags` fi if test "$echo_libs" = "yes"; then echo -L@abs_top_builddir@/src/.libs -lrasqal @LDFLAGS@ `$config --libs` fi rasqal-0.9.33/RELEASE.html0000644000175000017500000054457012443715133012002 00000000000000 Rasqal RDF Query Library - Release Notes

Rasqal RDF Query Library - Release Notes

Rasqal 0.9.33 changes

Issues Fixed:

  • 0000546: Can't take query from URI when using -p
  • 0000568: Filter expression with division does not work
  • 0000583: CONSTRUCT halts at a template triple with unbound variable
  • 0000588: roqet: select from SERVICE returns all NULLs

SPARQL changes

Fixed BASE to override any API base URI.

Datetime class changes

Fixed storing timezone minutes correctly.

Graph pattern class changes

Added new getter functions rasqal_graph_pattern_get_triples(), rasqal_literal_get_type() and rasqal_literal_get_language() from Pull Request #1 by Cosmin Basca. Thanks.

Query engine changes

Fixed the aggregation total evaluation of AVG.

Fixed STRBEFORE and STRAFTER evaluation to match languages if present and add the needle language to the result.

Fixed CONCAT() evaluation to return the correct types and languages.

Sorting now uses sort utility function raptor_sort_r() with context args provided by Raptor 2.0.15+ or an internal simple (not so performant) replacement, if too old.

Query result class changes

Can write variable bindings query results in mKR relation CSV format.

Query result class changes

Made internal changes to support reading and writing boolean result formats. That means rasqal_query_results_formatter_read() may now return boolean results if the formatter supports it, such as SPARQL XML.

Added rasqal_new_query_results_from_string() to make a query results from a string (with optional length). The results format is guessed from the input data - base_uri and string content using rasqal_world_guess_query_results_format_name().

Added rasqal_query_results_formats_check2() deprecating rasqal_query_results_formats_check(). The API change is due to the return value; the result is now non-0 if the format exists.

Added rasqal_new_query_results2() deprecating rasqal_new_query_results() removing the now ignored vars_table parameter. A query result now manages it's own variables table.

Results class changes

Fixed returning the correct variables count for reading SPARQL XML results sets. This caused some queries to fail if the projected variables count did not match the count in the result set. Fixes Issue #0000588

Variables table class changes

Added rasqal_variables_table_add2() deprecating rasqal_variables_table_add(). This takes a more sensible argument style with copying the input parameters name and value, and allowing name length to be optionally given. This results in smaller calling code and better ownership semantics.

Utility changes

roqet(1) now supports using a URI or local file to send to a SPARQL protocol service URI. Fixes Issue #0000546

Other changes

Fixes to make Rasqal build in Travis CI, testing against newest and oldest raptors.

Use __FUNCTION__ (c99) replacing __func__ (c90) in debug macros.

Fixes in Pull Request #3 for building with icc from Sebastian Freundt. Thanks.

Many code quality fixes from clang and coverity primarily in error path cleanups (out of memory cases) and dead code.

Updated the fix-flex and fix-bison scripts to remove dead code that clang and coverity complain about.

Added new C testrunner utility to run the tests to eventually replace the (perl) improve and check-sparql scripts.

Fixed some API changelog mistakes.

Updated gcc / clang warning args used (-Wxxxx) and made multiple minor code fixes such as replacing %d with %u in debug messages or adding missing default: to switches even when all cases were covered.

Added many more internal casts to make -Wconversion happier when enabled.

Rasqal 0.9.32 changes

Issues Fixed:

  • 0000558: sparql11-update causes fallback to sparql10
  • 0000560: "--with-pcre-config" documented but not supported
  • 0000561: 'make check' fails; possibly because raptor2 built in separate directory
  • 0000564: Rasqal fails with linker error for armv7 cross-compilation: duplicate symbol _main
  • 0000567: Segfault based on documentation recommendation

SPARQL changes

Fixed the SPARQL 1.0 and SPARQL 1.1 syntax feature checking so that language sparql11-update allows all SPARQL 1.1 syntax features to be used. Fixes Issue #0000558

Updated the SPARQL parser to use and require Bison 3.0 (for maintainer, building from GIT sources).

Updated the SPARQL lexer for Bison 3.0.

API changes

Made rasqal_new_query() match the documentation in accepting a NULL name. Fixes Issue #0000567

Configuration changes

Make ossp work as a UUID library option. --with-uuid-library=ossp and automatic discovery of ossp UUID now work. Fixed the inclusion of OSSP's uuid.h header.

Fix the searching for the pcre-config and libgcrypt-config configuration utilities. This probably never worked unless the envariables form (PCRE_CONFIG and LIBGCRYPT_CONFIG) were set.

Added a new internal to-ntriples utility to remove all use of rapper(1) so that the raptor utilities do not need to be available for running tests with 'make check'. Fixes Issue #0000561

Make --with-libgcrypt-config work.

Make --with-pcre-config work. Fixes Issue# 0000560

Fix noisy mhash_dir addition error; it was always added the cflags and includes even when mhash_dir was blank.

Improve raptor missing / too old error message.

Other changes

Mention libmtwist near --with-random-approach. Fixes Issue #0000561

Internal changes

Add more STANDALONE if/ifndef STANDALONE blocks around internal code or functions used in tests.

Make rasqal_xsd_check_double_format() an internal non-static symbol. Fixes Issue #0000564

Rasqal 0.9.31 changes

Issues Fixed:

  • 0000527: segmentation fault in roqet when making a SPARQL SERVICE query that returns an HTTP error
  • 0000536: configure accepts bogus values for --with-xml2-config
  • 0000537: configure pkg-config checks not overridable
  • 0000538: work around MSVC 2008's inexcusable lack of stdint.h header
  • 0000539: win32_rasqal_config.h doesn't work on MSVC2008

roqet(1) utility changes

roqet(1) gains a new operating mode: reading query result files in a given format and generating them in different format. This means it can be used to convert result formats. Use this mode with the -t RESULT-FILE major option and -R INPUT-RESULT-FORMAT to set the input format. -r OUTPUT-RESULT-FORMAT can be used to set the output format.

  # Convert a SPARQL TSV result to XML
  $ roqet -t result.tsv -R tsv -r xml

  # Convert a SPARQL XML result (default input format) to TSV
  $ roqet -t result.srx -r tsv

Tidied and improved the help and error messages.

The utility now supports -r simple / --results simple as it says in the documentation.

The debug result format now prints 'row:' when writing. (This format has always promised it may change).

Query result changes

Added support for reading the SPARQL 1.1 Query Results CSV and TSV Formats W3C Recommendation, 21 March 2013. Writing support already existed. This is a modular addition so the APIs that handle reading results automatically get this support.

Added rasqal_query_results_type_label() to get a string label for a rasqal_query_results_type.

Query engine changes

Internal work to support executing the SERVICE graph pattern.

Query engine can execute the new VALUES graph pattern.

SPARQL lexer and parser handles VALUES replacing the old BINDINGS syntax.

Fixed crash when a SERVICE returns no rowsource. Fixes Issue #0000527

Added proper validation of xsd:double and xsd:float literal format.

Correctly handle GROUP BY over no data - returning one row with all bindings missing.

Literal languages are now normalized to lowercase (RDF Concepts)

API changes

rasqal_prefix_id() now uses a q rather than _ to help raptor N-Triples 2008 conformance.

Improved SPARQL 1.1 query formatter to handle VALUES forms and to print in a prettier form with better indenting.

rasqal_graph_pattern_op gains RASQAL_GRAPH_PATTERN_OPERATOR_VALUES

rasqal_new_rowsource_from_handler() now allows a NULL query so that rowsources can be fully independent of a query, such as when building from a syntax string or other independent object.

rasqal_new_rowsequence_rowsource() now allows an empty sequence of rows.

Portability changes

Win32 build fix patches from Michael Stahl: Fixes Issues #0000539 and #0000538

Configuration and build changes

Added new internal convienience library libsv providing support for reading CSV and TSV files (and others potentially). Required for the updated support for reading SPARQL CSV and TSV result formats.

Added new librasqalcmdline convienience library to share code between roqet(1) and check-query (under development, not installed).

Build internal libmtwist, libgetopt (new) as libtool convienience libraries to stop automake moans about subdir-objects.

configure was fixed to correctly find and use OSSP libuuid even in the presence of half installed / broken UUID systems like on OSX where just the headers are present.

Fixes for building with parallel make such as make -jN

Fixed alignments and error paths found via clang.

configure now uses PKG_CHECK_MODULES() to enable overriding discovery of pkg-config if needed. Fixes Issue #0000537

Fix crash if xml2-config(1) when pointed at a non executable file. Patch from Michael Stahl Fixes Issue #0000536

configure ensures CPPFLAGS can be passed through without destruction. This helps Debian hardening

Removed the need for Perl XML::DOM to be installed in order for 'make test' to run via check-sparql. This requires the roqet(1) new '-'t mode.

Add a configure check for the debugging __func__ so that on systems where it does not exist the debug macros work. It may or may not be a macro, so it cannot be tested with #ifdef in the CPP.

Improved the configure check for Flex to allow it to be missing for non-maintainer mode.

Other changes

Flex code generation updates - now recommend flex 2.5.36.

Fixes in tests data for N-Triples conformance that is checked by newer Raptor.

Rasqal 0.9.30 changes

Removed RDQL support as promised. So long and thanks for all the queries. Use SPARQL instead.

Issues Fixed:

  • 0000506: configure.ac has bash -specific (non-POSIX) == syntax
  • 0000511: Add support for OSSP UUID library
  • 0000517: Autoconf errors when checking for several headers and cross-compiling
  • 0000523: mpfr dependency

Decimal class changes

rasqal_xsd_decimal_is_zero() now uses fabs() and an epsilon approach for C99 decimal mode.

Make rasqal_xsd_decimal_compare() work for C99 decimal mode.

rasqal_xsd_decimal_compare() and rasqal_xsd_decimal_equals() use Knuth's approximate equality as decribed below.

Literal class changes

Return rdf term type string from rasqal_literal_get_rdf_term_type() for integer subtypes (RASQAL_LITERAL_INTEGER_SUBTYPE). Fixes Issue #0000519 (Redland librdf)

rasqal_literal_to_result_term() now returns NULL on an alloc failure.

rasqal_new_floating_literal() added, deprecating rasqal_new_float_literal() and takes the float type as an argument.

Query engine changes

Fix some wrong data size allocs found by clang in Project rowsource.

Take more care in promoting literals to float and exceeding the range; turn them into doubles if that happens.

Floating and double comparisons and equality use a proper epsilon check using Knuth's approximate comparison approach, rather than =. Affects rasqal_literal_as_boolean(), rasqal_literal_equals(), rasqal_xsd_decimal_compare(), rasqal_xsd_decimal_equals() and other internal methods.

Query language changes

Updated the SPARQL syntax to support integer^^uri-ref. Fixes Issue #0000519 (Redland librdf)

Removed RDQL support as promised. So long and thanks for all the queries. Use SPARQL instead.

Portability changes

Test for mpfr_snprintf() specifically which appeared in MPFR 2.4.0. Fixes Issue #0000523

The Bison minimum version is now 2.0 (from 2004-12-25) until we hear otherwise.

Use RASQAL_DISABLE_DEPRECATED to flag out deprecated implementation code. Call gtkdoc-scan with the deprecated guard.

Use #if defined(RASQAL_DEBUG) to help portability when it's not defined.

Added good and bad cast macros for checking of type truncation. Helped remove compiler warnings.

Configuration changes

Make configure handle Apple /usr/bin/flex which adds an extra field so awk $NF did not work.

configure now supports finding UUID support inside libc for OSX.

Fix some configure portability with non-POSIX bash syntax and adding some -W flags to autotool calls. Fixes Issue #0000506

Updated autogen.sh to abort run if a configuring program fails, generate NEWS with old timestamp if missing so automake can run and some small doc and message updates.

Rasqal 0.9.29 changes

Rasqal fully supports SPARQL 1.0 from this release. All the approved tests pass.

Requires Raptor 2.0.7 or newer.

RDQL query language support will be removed in the next release. SPARQL has been available for 4 years and is fully supported.

Add support for SPARQL 1.1 draft UUID() and STRUUID().

Issues Fixed:

  • 0000493: Offset in sub-select results in no rows at all.
  • 0000494: Temp buffer to small.
  • 0000504: rasqal_regex_replace() is not public

Datatype changes

Added a new datatype rasqal_xsd_date class for XSD with literal enum RASQAL_LITERAL_DATE, constructor rasqal_new_xsd_date(), destructor rasqal_free_xsd_datetime() and core methods rasqal_xsd_date_to_counted_string(), rasqal_xsd_date_to_string() rasqal_xsd_date_equals() (returning incomparible) and rasqal_xsd_date_compare().

The rasqal_xsd_datetime and new date class above both get the same new fields for comparing datetimes and dates: time_on_timeline and have_tz to record the three timezone possibilities: none ('N'), zulu ('Z') or numeric ('Y'). A "time on timeline" value is calculated on construction and the field values are not normalized.

Added rasqal_xsd_datetime_equals2 deprecating rasqal_xsd_datetime_equals and returning and incomparible flag to caller.

Added rasqal_xsd_datetime_compare2() deprecating rasqal_xsd_datetime_compare() and returning the incomparible state between datetimes. The new rasqal_xsd_date_compare() uses this signature.

Added new rasqal_new_xsd_datetime_from_xsd_date() datetime constructor to build a datetime from a date.

Correct the buffer size in rasqal_xsd_datetime_get_seconds_as_decimal() Fixes Issue #0000494

Graph pattern class changes

Added rasqal_query_graph_pattern_visit2() deprecating rasqal_query_graph_pattern_visit()

Literal class changes

Enum rasqal_op gains new tokens RASQAL_EXPR_UUID and RASQAL_EXPR_STRUUID for the new SPARQL 1.1 draft UUID() and STRUUID built-in functions.

rasqal_literal_divide() result is now a decimal if both args are integer - rule from XPath F&O;

Added support for the XSD:Date datatype with a new rasqal_literal_type enum value RASQAL_LITERAL_DATE. Updated the literal code including the constructor rasqal_new_numeric_literal() to auto-convert to the internal format as well as the core literal methods.

Query engine changes

The rules for in-scope variables for FILTER were corrected to match the SPARQL 1.0 semantics. This fixed the last remaining failure Rasqal had for the SPARQL 1.0 approved test cases.

DISTINCT now compares using RDF term comparison not value comparison so now "" is distinct from ""^^xsd:string. This has a consquence of making RDQL test B-01 as failing but this is no loss. Relatedly, RDQL support will be removed in the next release.

Handle errors found in aggregation expressions following SPARQL standard.

Fix blank node generation when made in a CONSTRUCT to match SPARQL standard.

Make limit and offset check work properly in a subquery. Fixes Issue #0000493

Added support for executing SPARQL 1.1 draft UUID() and STRUUID using either libuuid or internal random API that backs executing RAND().

Resilience changes

Ran entire SPARQL 1.0 and 1.1 test suite through Rasqal and valgrind to check for reference loss and memory leaks. Fixed several issues in newer code.

Fixed several code issues with unused values found by clang. Or changed code that was correct to make clang moan less.

Add code marking of good and bad type casts using macros RASQAL_GOOD_CAST and RASQAL_BAD_CAST macros.

Other changes

The configure test for libgcrypt as a digest backend now works; it really didn't before now. Added option --with-libgcrypt-config=PATH to allow selecting the path to the libgcrypt-config. mhash remains the preferred hash digest library as it provides more digests and is more commonly available.

configure now looks for libuuid with pkg-config to back the SPARQL 1.1 UUID generation support. The UUID backend can be selected with new configure option --uuid-library=NAME

Made rasqal_regex_replace() public with same signature as the internal API. Fixes Issue #0000504

The tests/sparql/check-sparql test runner was updated to understand more of the manifest vocabulary.

Building from GIT now requires automake 1.11.2+ for the -Wextra-portability option.

Added -d none to roqet(1) arguments so it is possible disable debug output on the command line (default).

Rasqal 0.9.28 changes

Issues Fixed:

  • 0000466: zero size calloc does not return object (src/rasqal_row.c)
  • 0000467: Tests fail because diff doesn't accept -u flag
  • 0000470: snprintf portability issues
  • 0000471: Compile error when RASQAL_DEBUG set to > 1
  • 0000474: roqet flags listed in help, but not recognised

SPARQL changes

The language name 'sparql' is now SPARQL 1.1

Added support for SPARQL 1.1 draft string functions STRBEFORE(), STRAFTER() and REPLACE().

Query engine changes

Add parsing and evaluation support for SPARQL 1.1 draft STRBEFORE (2 args), STRAFTER (2 args) and REPLACE (3 or 4 args). The evaluation of REPLACE currently fully works for PCRE regex with Unicode and works for POSIX regex without Unicode.

Clear errno before calling strtol() and checking the result. This caused issues when used in threaded applications, even though Rasqal is not thread-safe.

The (psuedo) random number generation now can use a variety of library random routines, defaulting to a new internal Mersenne Twister implementation - libmtwist. The choice of PRNG can be made with configure --with-random-approach=ALGO to pick from mtwist (the default), gmp (when GMP is available and used for decimals), random_r(), rand_r() then the portable but not so safe: random() and rand().

Expression class changes

Enum rasqal_op gains new tokens RASQAL_EXPR_STRBEFORE, RASQAL_EXPR_STRAFTER and RASQAL_EXPR_REPLACE for the new SPARQL 1.1 string expressions. STRBEFORE(), STRAFTER() and REPLACE() respectively.

Added rasqal_new_4op_expression() to construct 3/4-arg expressions.

Query format and query result format changes

Added the W3C Format URIs to the JSON, XML, CSV and TSV SPARQL result formats. (Nicholas J Humfrey)

Corrected the SPARQL query output for LIMIT and OFFSET

Handle <literal></literal> as empty literal when reading in XML query results.

Other changes

Use a more comprehensive configure build and run test for ceil(), floor() and round() to prevent GCC optimizing it away and getting the wrong answer when checking whether to link with -lm

Removed the obsolete -w option from the roqet --help message which was removed from code some time ago. Fixes Issue 0000474.

Prevent a gcc 4K stack size warning in a few tests.

Reorganized the regex code to a new regex module, adding the new function rasqal_regex_replace() for regex search and replace (all) backing SPARQL 1.1 REPLACE()

Several internal fixes for compiling with RASQAL_DEBUG > 1 (Lauri Aalto) Fixes Issue #0000471

Remove several internal uses of snprintf() for simple integer formatting.

The check-sparql utility used during 'make check' now sets the DIFF envariable for check tests to allow use off GNU Diff. Fixes Issue #0000467 (Peter O'Gorman / pogma)

Code style changes for calling calloc().

Do not calloc() with 0 count for a result row - not portable. Fixes Issue #0000466 (Peter O'Gorman / pogma)

The check_query utility (which is still not complete) can now handle comparing query results when sorting is involved.

Rasqal 0.9.27 changes

Issues Fixed:

  • 0000127: UNION graph pattern support in query engine
  • 0000423: SPARQL UNION with shared variables fails
  • 0000434: OPTIONAL and named graphs don't mix
  • 0000454: xsd:nonNegativeInteger is parsed as RASQAL_LITERAL_QNAME instead of RASQAL_LITERAL_[INTEGER|UDT|INTEGER_SUBTYPE]
  • 0000459: Making a query that binds to a variable with the same name as a bnode fails

SPARQL changes

The parser now supports the optional SILENT keyword for SERVICE.

The parser now supports the CONSTRUCT WHERE abbreviation, expanding the WHERE triples into a triple template with the same triples.

Query engine changes

sub-SELECTs are now supported including those that contain sorting, grouping, limiting and offset as well as projection.

CONSTRUCT works when working over a query with optionals. It previously stopped returning results at the first unbound variable value.

OPTIONAL, sub-graph pattern groups and UNION fully execute correctly. Fixes were made to the variable scoping and join operations.

A lot of refactoring was done to provide the structure to enable sub-SELECT to be turned into a query algebra structure and executed.

An entirely new variable scoping algorithm was implemented to properly compute where a variable is assigned; the assumption was removed that a variable with a given name can only be bound in one place.

Several bugs were fixed in the join implementation which affected the sub-graph pattern grouping (natural join) and optional (left join).

Pulled new internal function rasqal_query_results_formatter_get_read_rowsource() out of rasqal_service_execute() to provide the structure for executing SERVICE queries in the query engine.

Literal class changes

rasqal_new_numeric_literal_from_long() added to make an integer or decimal literal depending if it fits in range.

rasqal_xsd_decimal_get_long() added to convert an arbitrary precision decimal to a C long with an overflow error flag.

xsd:integer subtypes are stored and printed correctly. Fixes Issue #0000454.

Query class changes

rasqal_query_get_distinct() added to get the distinct flag from SELECT DISTINCT ... queries.

rasqal_query_set_wildcard() added to set the '*' flag for SELECT * queries

rasqal_query_has_variable2() added with variable type arg deprecating rasqal_query_has_variable(). Note the warning about using RASQAL_VARIABLE_TYPE_UNKNOWN is ambiguous.

Deprecated rasqal_query_has_variable() for the above. Lookup by any type.

rasqal_query_set_variable2() added with type arg deprecating rasqal_query_set_variable(). Note the warning about using RASQAL_VARIABLE_TYPE_UNKNOWN is ambiguous.

Deprecated rasqal_query_set_variable() for above. Lookup by any type.

Query result format changes

The CSV and TSV query result formats (names csv and tsv respectively) were altered to match the editor's draft SPARQL 1.1 Query Results CSV and TSV Formats which includes no header line, no result number and implementing the specified quoting and end of lines in the specification.

Variable class changes

rasqal_variables_table_add_variable() added to add an existing variable to a variables table.

rasqal_variables_table_get_by_name() added with variable type arg.

rasqal_variables_table_contains() added to check if a variable with the given type and name is in the variables table.

roqet(1) utility changes

Correctly order the help so the -d/--dump-query value list appears after the option description.

Porting changes

Several patches were made to aid compiling on MS Windows were applied based on those made by the KDE Emerge scripts to build KDE on windows. This includes a native replacement for the missing gettimeofday() and timegm() functions. MS Windows remains an unsupported target.

Other changes

The minimum Raptor version needed is now 2.0.4 for the raptor_bnodeid_ntriples_write() function.

The test runner was fixed to fail the suite when there are failures as well as expected failures.

Code style change and cleanup for alloc/free macros. New code style:

  1. var = RASQAL_CALLOC(type, nmem, size)
    Prefering:
    var = RASQAL_CALLOC(type, 1, sizeof(*var))
    when nmem = 1
  2. var = RASQAL_CALLOC(type, size)
  3. RASQAL_FREE(type, var)

The consequence here is allocs that mostly fit into 1 line without so much boilerplate and duplication of types. The RASQAL_MALLOC and RASQAL_CALLOC macros now do the cast to the return type. RASQAL_FREE takes the object type too but always casts arg to void This

Code style change for allocating strings:

  1. len = strlen(); malloc(..., len + 1)
  2. and memcmp(..., len + 1)

Expanded GCC warnings to take advantage of newer analysis which found several issues:

  • Use of int for storing string and buffer lengths: replaced many internal uses with the correct size_t for length computations.
  • Use of int for storing time: replaced with time_t that may be larger
  • Use of void* for pointer differences: replaced with ptrdiff_t where necessary.
  • Precision truncation between int and long, size_t.
  • Precision truncation between float and double.

Made several internal functions to improve the above. There remain some int / size_t errors in the public API that will need new API functions to properly fix for 64-bit machines dealing with strings more than >32bits in length; which should be rare.

Reduced Rasqal's call stack size by ensuring all I/O buffers are dynamically allocated.

configure now always checks for where ceil(), floor() and round() can be found: in libc or libm.

The configure default for --enable-maintainer-mode no longer enables the debugging symbols. These can be added with --enable-debug

The configure gains an option --with-gmp=PATH to set the installation path of the GNU Multiple Precision Arithmetic Library (GMP) if it is not in the standard lib/include prefix.

Rasqal 0.9.26 changes

Issues Fixed:

  • Issue #0000430: Incorrect HTML generated with unknown literal types
  • Issue #0000431: Only a limited number of literal datatypes are displayable in a HTML format.
  • Issue #0000436: queries involving calculations with large numbers return incorrect results unless scientific notation is used
  • Issue #0000438: timegm not available on solaris
  • Issue #0000439: warning when variable is not selected makes 4store tests to fail
  • Issue #0000446: rasqal may require -lm for floor, ceil, round on some systems and architectures

SPARQL 1.1 Query draft language changes

Added support for SPARQL 1.1 message digest functions MD5(), SHA1(), SHA224(), SHA256(), SHA384() and SHA512()

Query engine changes

Many internal query engine changes to more accuractly compute variable scope, use and binding to better support more complex queries with scopes such as UNION (now mostly working) and sub-SELECT (execution is not yet supported).

Added rasqal_world_set_warning_level() to set the query warning level in the 0...100 range where 0 is no warnings, 50 is the default and 100 is all warnings.

Query errors now fail with regular errors not fatal errors that abort(). Query parsing errors are not work killing the process. Also adjusted some error paths to prevent reporting 2 errors at once.

rasqal_op enumeration gains values RASQAL_EXPR_MD5, RASQAL_EXPR_SHA1, RASQAL_EXPR_SHA224, RASQAL_EXPR_SHA256, RASQAL_EXPR_SHA384 and RASQAL_EXPR_SHA512 for message digest expressions corresponding to SPARQL 1.1 message digest functions.

Added message digest support either built with internal MD5 and SHA1 which are always available, or with libmhash which provides the full list of message digests that SPARQL 1.1 requires (and is optimized).

Make ROUND() work with XSD Decimal when compiled against GNU MP.

Check for overflow when converting a string to int and if resulting long won't fit in an int, turn it into a decimal. Fixes Issue #0000436.

Removed Query Engine V1 that was long disabled. configure loses the --with-query-engine-version option.

Query results formatter class changes

Fixed HTML query results generating invalid HTML. Fixes Issue #0000430

Support writing additional literal types in HTML query results. Fixes Issue #0000431

The JSON query result format now accepts the application/sparql-results+json mime type, as specified in the Serializing SPARQL Query Results in JSON W3C WG Note.

roqet(1) utility changes

Added options -W / --warnings level (default 50) to set the warning level and -E to ignore errors.

Other changes

configure gains a --enable-debug option to enable or disable the debugging messages. Useful for when building using autogen.sh from GIT.

Removed internal test/debug 'redland' triples store that has not worked for some time. Removed the --with-triples-source and --with-redland-config options from configure.

Add a portable version of timegm() when it is not present in the system (such as Solaris). Fixes Issue #0000438.

Added configure tests for ceil(), floor() and round() that look for them in libc or libm. Fixes Issue #0000446.

Fixed up several code paths with problems found by clang, mostly unused variables, unnecessary calculations but a couple of bad accesses.

Rasqal 0.9.25 changes

Issues Fixed:

SPARQL 1.1 Query draft language changes

Added support for SPARQL 1.1 numeric functions ABS(), ROUND(), CEIL() and FLOOR().

Added support for SPARQL 1.1 BIND(expr as ?var) using existing RASQAL_GRAPH_PATTERN_OPERATOR_LET.

Added support for SPARQL 1.1 CLEAR and DROP to use optional SILENT keyword.

Added support for SPARQL 1.1 RAND() along with a query API feature for user setting of the random seed.

Added support for SPARQL 1.1 TZ()

Fixed SPARQL 1.1 ENCODE_FOR_URI() to not preserve language and datatype of input.

Fixed support for SPARQL 1.1 BNODE() to work with no argument given.

Fixed SPARQL 1.1 GROUP BY to allow an optional AS ?var.

Fixed support for """-quoted and '''-quoted strings not over-quoting and adding support for optional language. Fixes Issue #0000427 and Issue #0000428.

DateTime class changes

Added rasqal_xsd_datetime_get_tz_as_counted_string() to get back the timezone string component of a datetime.

Datatype class changes

rasqal_xsd_format_double() now correctly formats numbers that have no trailing 0s.

Decimal class changes

Added rasqal_xsd_decimal_abs(), rasqal_xsd_decimal_round(), rasqal_xsd_decimal_ceil() and rasqal_xsd_decimal_floor() to support the ABS(), ROUND(), CEIL() and FLOOR() functions for decimals.

Expression class changes

rasqal_op gains RASQAL_EXPR_ABS, RASQAL_EXPR_ROUND, RASQAL_EXPR_CEIL and RASQAL_EXPR_FLOOR for numeric operations, RASQAL_EXPR_RAND for SPARQL 1.1 RAND() and RASQAL_EXPR_TZ for SPARQL 1.1 TZ() timezone accessor.

Added an evaluation context structure rasqal_evaluation_context for the information needed to evaluate any rasqal_expression tree. This makes expression evaluation independent of a query, but still tied to a rasqal world and (via variables) a variables table. Added constructor rasqal_new_evaluation_context() to set the locator and flags, destructor rasqal_free_evaluation_context(), method rasqal_evaluation_context_set_base_uri() to set/reset the shared reference to the context base URI and method rasqal_evaluation_context_set_rand_seed() to set the random seed for the evaluation.

Added rasqal_expression_evaluate2() taking just an expression and an evaluation context.

rasqal_expression_evaluate() is deprecated for the above.

Added new method rasqal_xsd_datetime_get_tz_as_counted_string() for executing RASQAL_EXPR_TZ for SPARQL 1.1 TZ().

Query Engine changes

Initialise seed for RAND() from either a mixture of system sources or from a value set by user. The user value can be set with new query feature RASQAL_FEATURE_RAND_SEED. Uses rasqal_evaluation_context_set_rand_seed() on the query's internal evaluation context.

Enable rasqal_query_set_store_results() to actually work after a query prepare.

Handle evaluation of FILTER over an empty inner graph pattern such as in a query like ASK WHERE { FILTER ( TRUE ) }

Ignore errors in executing SPARQL 1.1 project expression AS variables.

Update rasqal_literal_as_boolean(), rasqal_literal_as_integer and rasqal_literal_as_floating when evaluating NULL to return a type error not an assertion failure or abort (in debug mode).

Change internal error handling to separate a NULL return from an error return when evaluating expressions. Updated lots of callers of expression evaluation to handle a NULL expression response. Needed since now NULL is a valid expression evalution in some cases; like STRLANG() on non-simple literals.

Updated to use rasqal_evaluation_context for expression evaluation.

Handle support executing empty graph patterns such as in queries like SELECT (expr AS ?var) WHERE {} which just evaluates expr and returns a single row with a single result.

Query Result Formatter class changes

Handle NULL values for RDF and Tables results.

Other changes

Added rasqal_world_get_query_language_description() to get a description of a query language replacing and deprecating rasqal_languages_enumerate().

More fixes to check-query test script.

Make GPL V2 or newer explicit in LICENSE.html.

Rasqal 0.9.24 Changes

SPARQL 1.1 Update draft Language changes

Added support for CLEAR and DROP applying to more than one graph. The options are now: just default graph with DEFAULT, all named graphs with NAMED and all graphs with ALL.

Added support for optional SILENT flag before most update operations.

Added support for ADD, MOVE and COPY operations which both operate between two graphs - either named or default. The source graph is stored in the update structure graph_uri field and the destination graph in the document_uri field; the names have no meaning here since both are graphs and a NULL value signifies the default graph.

Added support for DELETE WHERE {} writing the triple results into the delete_templates field of the update structure.

Added support for multiple update operations in one 'query' separated by ';'.

GROUP_CONCAT() now sets the RASQAL_EXPR_FLAG_AGGREGATE rasqal_expression flag like the other builtin aggregate expressions.

Query Engine changes

Fixed a few memory leaks in aggregate operation with GROUP and with HAVING.

Literal API changes

Fixed a memory leak with datetime literals.

Update API changes

rasqal_update_type gains new enum values RASQAL_UPDATE_TYPE_ADD, RASQAL_UPDATE_TYPE_MOVE and RASQAL_UPDATE_TYPE_COPY for the SPARQL 1.1 Update ADD, MOVE and COPY operations respectively.

Added enum rasqal_update_graph_applies to specify scope that update applies to beyond one graph to either just the default graph, to all named graphs or to all graphs. Applies to CLEAR and DROP operations only

Other changes

Make all object destructors simply return on a NULL object pointer. This was already done but with different code styles.

Rasqal 0.9.23 Changes

Fixed Issues:

  • 0000407: ORDER BY does not appear to handle undefined values correctly
  • 0000414: Type of operation->insert_templates depends on Update syntax
  • 0000415: Graph pattern operator not correctly filled out in SPARQL 1.1 Updates
  • 0000417: SELECT DISTINCT sometimes returns duplicates

Graph pattern class changes

Added rasqal_graph_pattern_get_flattened_triples() to flatten a recursive basic/graph graph pattern to a sequence of triples or triple patterns (have variables).

SPARQL Query Language changes

Fix the parsing of SPARQL 1.1 Update draft INSERT and DELETE to return sequences of triples in the insert_templates and delete_templates fields as documented. It would previously sometimes return that but mostly return a sequence of recursive graph patterns.

When a syntax error happens due to use of a language feature, do proper error handling (no aborting) and clean up parsing resources.

Rasqal 0.9.22 Changes

WARNING: ABI AND API CHANGED IN THIS RELEASE.

This means: functions, enums and types were added, removed and changed.

Consequently the shared library major soname version has changed from 2 to 3.

The main changes in this release were to add more draft SPARQL 1.1 features and to use Raptor V2.

Rasqal now depends on Raptor V2. Raptor V1 is not supported. The minimum Raptor2 version is 2.0.0.

Given the the large dependency change above that requires recompiling with some breakage, this release makes an ABI and API break. All deprecated functions, types and other deprecated functionality have been removed. The libtool library version was bumped to 3.0.0. The detailed API changes are described in the Changes section of the Rasqal reference manual.

Query Engine Changes

Query engine initialises start of execution datetime to enable a NOW() function to provide a stable value during a single execution.

Query Language Changes

Split query language support into more languages with aliases:

  • sparql (and alias sparql10): SPARQL 1.0 query with no 1.1 features.
  • sparql11-query: SPARQL 1.1 query.
  • sparql11-update: SPARQL 1.1 update.
  • sparql11: SPARQL 1.1 with both query and update.
  • laqrs: LAQRS experimental language with all of above plus experiments.

LAQRS Query Language changes

Added experimental datetime builtin methods:

  • NOW() / CURRENT_DATETIME(): Synonyms to return an XSD datetime for the current wall clock date and time. At the first execution / preparation of the query, the value is set as a constant throughout the life of the query execution.
  • FROM_UNIXTIME(): turns an integer value into an XSD DateTime.
  • TO_UNIXTIME(): turns an XSD DateTime into an integer value.

These functions are not opposites and will not roundtrip date times since they do not take into consideration leap seconds or daylight saving time changes.

SPARQL Query Language changes

Fixed SPARQL 1.1 draft isNUMERIC() which was stored wrongly in the parse tree as RASQAL_EXPR_ISLITERAL.

Added SPARQL 1.1 draft dateTime accessor builtin functions along with expression execution support.

  • DAY()
  • HOURS()
  • MINUTES()
  • MONTH()
  • SECONDS()
  • TIMEZONE()
  • YEAR()

Added SPARQL 1.1 draft string builtin functions along with expression execution support.

  • CONCAT()
  • CONTAINS()
  • ENCODE_FOR_URI()
  • LCASE()
  • STRENDS()
  • STRLEN()
  • STRSTARTS()
  • SUBSTR()
  • UCASE()

Data Graph class changes

Removed deprecated rasqal_new_data_graph() constructor replaced by rasqal_new_data_graph_from_uri() with additional arguments.

Datetime class changes

Added rasqal_xsd_datetime class to the public API implementing the XML Schema datatypes (XSD) dateTime with microsecond accuracy (where present) and timezone offsets of minutes accuracy. The new class has constructors:

  • rasqal_new_xsd_datetime()
  • rasqal_new_xsd_datetime_from_timeval()
  • rasqal_new_xsd_datetime_from_unixtime()

destructor:

  • rasqal_free_xsd_datetime()

and methods:

  • rasqal_xsd_datetime_compare()
  • rasqal_xsd_datetime_equals()
  • rasqal_xsd_datetime_get_as_timeval()
  • rasqal_xsd_datetime_get_as_unixtime()
  • rasqal_xsd_datetime_get_seconds_as_decimal()
  • rasqal_xsd_datetime_get_timezone_as_counted_string()
  • rasqal_xsd_datetime_set_from_timeval()
  • rasqal_xsd_datetime_set_from_unixtime()
  • rasqal_xsd_datetime_to_counted_string()
  • rasqal_xsd_datetime_to_string()

Expression class changes

rasqal_expression_evaluate() now evaluates the new SPARQL 1.1 draft strings and datetime builtin functions.

rasqal_op gains new values for SPARQL 1.1 builtin functions:

  • RASQAL_EXPR_CONCAT
  • RASQAL_EXPR_DAY
  • RASQAL_EXPR_HOURS
  • RASQAL_EXPR_MINUTES
  • RASQAL_EXPR_MONTH
  • RASQAL_EXPR_SECONDS
  • RASQAL_EXPR_TIMEZONE
  • RASQAL_EXPR_YEAR

rasqal_op gains new values for LAQRS experimental builtin functions:

  • RASQAL_EXPR_CURRENT_DATETIME
  • RASQAL_EXPR_FROM_UNIXTIME
  • RASQAL_EXPR_NOW
  • RASQAL_EXPR_TO_UNIXTIME

rasqal_new_function_expression() constructor gained params and flags arguments to handle aggregate expressions. This was renamed from rasqal_new_function_expression2().

Removed deprecated rasqal_new_function_expression2() replaced by rasqal_new_function_expression() with same arguments.

Added constructor rasqal_new_expr_seq_expression() replacing rasqal_new_coalesce_expression() and taking an op argument to use for different expression operations.

Removed method rasqal_new_coalesce_expression() replaced by rasqal_new_expr_seq_expression() with additional op argument.

rasqal_expression_evaluate() evalutes experimental LAQRS datetime builtin methods NOW(), CURRENT_DATETIME(), FROM_UNIXTIME() and TO_UNIXTIME().

Fixed RASQAL_EXPR_DATATYPE expression execution to return the result rather than the function argument.

Literal class changes

Support XSD dateTime literals. rasqal_literal value union gains a datetime field.

Added new constructor rasqal_new_datetime_literal_from_datetime() to make a datetime literal.

rasqal_literal_set_typed_value() turns xsd:dateTime literals into rasqal_xsd_datetime objects.

rasqal_literal_equals_flags() and rasqal_literal_compare() now use rasqal_datetime equality and comparison methods.

Added new accessor rasqal_literal_as_counted_string() get the string version of its and its length, letting the caller avoid strlen() on the result.

Query class changes

Added method rasqal_query_get_result_type() to get the expected result type based on the query structure.

Added method rasqal_query_set_store_results to enable storing results of an execution.

Removed deprecated methods: rasqal_query_set_fatal_error_handler() rasqal_query_set_error_handler() rasqal_query_set_warning_handler() replaced by using rasqal_world_set_log_handler() calling a raptor_log_handler.

Removed deprecated methods: rasqal_query_set_default_generate_bnodeid_parameters() rasqal_query_set_generate_bnodeid_handler() that have moved to methods on the rasqal_world object: rasqal_world_set_default_generate_bnodeid_parameters() and rasqal_world_set_generate_bnodeid_handler() respectively.

rasqal_query_add_data_graph() was altered to take a single rasqal_data_graph argument instead of uri, name and flags. This was renamed from rasqal_query_add_data_graph2().

Removed rasqal_query_add_data_graph2() replaced by rasqal_query_add_data_graph() with same arguments.

Query Results class changes

Added support for query result rewinding, if the results were stored in execution via rasqal_query_set_store_results(), new method rasqal_query_results_rewind() may be called to reset back to the initial binding result.

Added rasqal_query_results_get_row_by_offset() to access stored query result rows if storing results was enabled by rasqal_query_set_store_results().

Enum rasqal_query_results_type gains value RASQAL_QUERY_RESULTS_UNKNOWN for when a query result type is unknown or yet to be determined.

Added method rasqal_query_results_get_type() to get the query result type.

rasqal_query_results_read() was altered to take a name, mime_type, format_uri, base_uri args instead of format_uri, base_uri. This was renamed from rasqal_query_results_read2().

Removed rasqal_query_results_read2() replaced by rasqal_query_results_read() with the same arguments.

rasqal_query_results_write() was altered to take a name, mime_type, format_uri, base_uri args instead of format_uri, base_uri. This was renamed from rasqal_query_results_write2().

Removed rasqal_query_results_write2() replaced by rasqal_query_results_write() with same arguments.

Query Results Formatter class changes

Added new constructor rasqal_new_query_results_formatter_for_content() to get a query result formatter based on guessing from format URI, name, mime type, some initial content or an identifier using rasqal_world_guess_query_results_format_name().

Removed rasqal_new_query_results_formatter2() constructor replaced by rasqal_new_query_results_formatter() constructor.

Removed deprecated rasqal_new_query_results_formatter_by_mime_type() replaced by rasqal_new_query_results_formatter_for_content() with additional arguments.

Added world method rasqal_world_guess_query_results_format_name() to guess format based on format URI, mime type, some initial content or an identifier.

Added guessing based on identifier/filename suffix for the 'rdf' (.rdf), 'turtle' (.ttl, .n3) and 'xml' (.srx) formatters.

Added reading support for the existing 'rdfxml' and 'turtle' query result formatters to make both of these read/write formatters.

Added rasqal_world_get_query_results_format_description() to get the list of query results format syntaxes using a raptor_syntax_description structure. This replaced and deprecates the rasqal_query_results_formats_enumerate() and rasqal_query_results_formatter_get_mime_type() methods.

This change allows the query result formats to be identified and discovered by multiple names (aliases) and URI strings when using the rasqal_new_query_results_formatter2() constructor.

rasqal_new_query_results_formatter() constructor was altered to take name, format type, format URI args instead of just name, format URI. This was renamed from rasqal_new_query_results_formatter2().

rasqal_query_results_formats_check() was altered to take name, format URI, mime_type flags instead of name, uri and type. This was renamed from rasqal_query_results_formats_check2().

Removed rasqal_query_results_formats_check2() replaced by rasqal_query_results_formats_check() with the same arguments.

Removed rasqal_query_results_formats_enumerate() replaced by rasqal_world_get_query_results_format_description() using static syntax description approach.

Removed rasqal_query_results_formatter_get_mime_type() replaced by using fields of raptor_syntax_description structure returned by rasqal_world_get_query_results_format_description().

Variable class changes

Removed deprecated constructors rasqal_new_variable_typed() rasqal_new_variable() replaced by the rasqal_variables_table_add() method on a variables table to create and add a variable in a context.

Other changes

Replaced all uses of strcpy() with memcpy() and known lengths.

Refactored huge rasqal_expression_evaluate() switch and case code into sub-methods preparing for possible later change to a jump table based on expression operation.

rasqal_xsd_decimal_as_string(): Fix decimal to string xsd lexical form details: rounding precision, format details (such as 0.0 not 0.0E0) when built with MPFR or GMP instead of the (imprecise) double implementation.

Fix xsd double lexical form formatting to use capital E.

Started creating check-query query test runner utility.

Rasqal 0.9.21 Changes

The main changes in this release are to add support for features of SPARQL 1.1 Query W3C working draft of 14 October 2010:

  • Executing grouping of results: GROUP BY
  • Executing aggregate expressions: AVG, COUNT, GROUP_CONCAT, MAX, MIN, SAMPLE, SUM
  • Executing filtering of aggregate expressions: HAVING
  • Parsing of new syntax: BINDINGS, isNUMERIC(), MINUS, sub SELECT and SERVICE.

Fixed Issues:

  • 0000388: Can only write JSON format for variable binding and boolean results

Query Engine changes

Support executing new SPARQL 1.1 draft function isNUMERIC().

Support executing built-in aggregate expressions:

  • AVG(expr)
  • COUNT(*) and COUNT(expr)
  • GROUP_CONCAT(expr) with optional ;separator = 'string'
  • MAX(expr)
  • MIN(expr)
  • SAMPLE(expr)
  • SUM(expr)

with and without DISTINCT across the arguments.

Support executing grouping of results with GROUP BY (or implicitly if aggregate function was given) and HAVING to filter groups.

LAQRS Query Language changes

Explain more carefully that EXPLAIN and COALESCE() are LAQRS only and remain experimental.

SPARQL Query Language changes

Separate SPARQL 1.0 and SPARQL 1.1 draft language names giving query languages sparql (with alias sparql10 for SPARQL 1.0), sparql11 for SPARQL 1.1 and laqrs for experiments. The sparql name without a version currently points to SPARQL 1.0 but over time will advance to be SPARQL 1.1

Added support for parsing (not executing) new SPARQL 1.1 draft tokens: BINDINGS for variable bindings, UNDEF, SERVICE and MINUS.

Added support for parsing and executing new SPARQL 1.1 draft isNUMERIC() expression.

Added support for parsing (not executing) new SPARQL 1.1 draft sub-SELECT queries.

Support for parsing and executing built-in (not user) aggregate expressions: AVG(expr), COUNT(*) and COUNT(expr), GROUP_CONCAT(expr) with optional ;separator = 'string', MAX(expr), MIN(expr), SAMPLE(expr) and SUM(expr) with and without DISTINCT across the arguments.

Added support for executing grouping of results with GROUP BY (or implicitly if aggregate function was given) and HAVING to filter groups.

Bindings class changes

Added a class to support for SPARQL 1.1 draft BINDINGS in a query specifying a set of variable bindings and a sequence of rows of values to bind to them. Intended for applying to a SPARQL 1.1 draft query SERVICE call.

Added bindings class rasqal_bindings with constructor rasqal_new_bindings, destructor rasqal_free_bindings() and method rasqal_bindings_print()

Added accessor methods for getting bindings variables and rows rasqal_query_get_bindings_variables_sequence(), rasqal_query_get_bindings_variable(), rasqal_query_get_bindings_rows_sequence() and rasqal_query_get_bindings_row()

Data Graph class changes

Turn a data graph into a reference-counted class and add support for specifying the format of a data graph for parsing after retrieval.

typedef rasqal_data_graph gains new optional format_type, format_name and format_uri fields for describing the format of the graph an optional uri field for base URI and a usage field.

Added constructor rasqal_new_data_graph_from_uri() with format_type, format_name and format_uri args deprecating rasqal_new_data_graph() without them, which always guessed the format.

Added constructor rasqal_new_data_graph_from_iostream() taking a raptor_iostream arg to allow getting data graphs from non-URIs which could be strings, memory etc.

Added copy constructor rasqal_new_data_graph_from_data_graph() for data graphs.

Expression and literal class changes

Added support for SPARQL 1.1 draft isNUMERIC() expressions. The rasqal_op gains a new RASQAL_EXPR_ISNUMERIC value.

Added rasqal_expression_op_label() to return the label for an expression operation.

Added rasqal_expression_compare() to compare literals.

Added rasqal_expression_is_aggregate() to test if an expression is an aggregate one - has an aggregate operation or user-defined function.

Added rasqal_literal_type_label() to return the label for a literal type.

Graph pattern class changes

rasqal_graph_pattern_operator enumeration gains new values for SPARQL 1.1 draft features: RASQAL_GRAPH_PATTERN_OPERATOR_SELECT for sub-SELECT, RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE for service binding and RASQAL_GRAPH_PATTERN_OPERATOR_MINUS for minus operation between graph patterns.

Added new constructor rasqal_new_single_graph_pattern() for use with service and minus graph patterns.

Added rasqal_graph_pattern_get_variable() method to get the variable for SPARQL 1.1 draft BIND and LAQRS LET graph patterns.

Added rasqal_graph_pattern_get_service() method to get the service object for SPARQL 1.1 draft SERVICE graph pattern.

Query class changes

Added rasqal_query_add_data_graph2() to add a previously constructed data graph to a query deprecating rasqal_query_add_data_graph() that did construct and add in one go.

Added rasqal_query_add_data_graphs() to add a sequence of data graphs to a query.

Added rasqal_query_add_data_graph_from_iostream() using new rasqal_new_data_graph_from_iostream().

Note in the docs for rasqal_query_set_limit() and rasqal_query_set_offset() that with the new query engine approach, you cannot set the limit or offset until the query is prepared which is after parsing.

Query results class changes

Add a formatter to write a variable bindings query results in Turtle format with the schema used for the W3C DAWG and SPARQL Working group test cases.

rasqal_query_results_formats_check2() added with new flags arg for asking for a format to read or write, deprecating rasqal_query_results_formats_check() without it.

Row class changes

The rasqal_row gains a group_id field for returning group boundaries. Change of groups should be detected by a change in IDs between rows.

Service class changes

Added a rasqal_service class for executing remote queries against a SPARQL HTTP protocol endpoint and getting back a query results set. The data graphs attached get turned into default-graph-uri and named-graph-uri URI parameters to the request.

Added constructor rasqal_new_service(), destructor rasqal_free_service() and methods rasqal_service_set_www() to set the WWW object rasqal_service_set_format() to set the accept request header and rasqal_service_execute() to execute the query returning the results.

Triples source class changes

Add a way for a triples source factory to return meaningful errors by adding a new init_triples_source factory method to the rasqal_triples_source_factory that takes a rasqal_triples_error_handler callback. The RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION is now 2 and ranges 1 to 2 are supported.

Add a way for a triples source to indicate support for optional features by adding a support_feature method toe the rasqal_triples_source structure. The RASQAL_TRIPLES_SOURCE_MAX_VERSION is now 2 and ranges 1 to 2 are supported.

Added enum rasqal_triples_source_feature with value RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH to indicate a triple source supports reading data graphs from a raptor_iostream.

Variable class changes

Now a reference-counted class.

Deprecated rasqal_new_variable() and rasqal_new_variable_typed() for rasqal_variables_table_add().

Internal changes

All destructors accept NULL objects and do nothing.

Add a Raptor V2-style raptor_syntax_description data model to Rasqal and use it to initialise query languages. It is not currently exposed in the API and may not be until Rasqal requires Raptor V2 when it can share code.

Added an internal rasqal_bindings structure for SPARQL 1.1 BINDINGS.

Add an internal query results modifiers structure rasqsal_solution_modifier class for use in storing group by, having, limit, offset information which together SPARQL 1.1 documentationc calls modifiers.

Added rowsources for grouping, executing aggregated queries across groups, having filters per group. Modified the projection rowsource to handle aggregation.

roqet(1) utility changes

Added support for serializing to graphs or bindings with the same Raptor serializer / Rasqal result formatter name such as for example 'json'.

Added -F NAME option for specifying the data graph format; otherwise Raptor uses the guessing mechanism.

Added support for reading a data graph from standard input (stdin) when the -D / --data , -G / --name or -s / --source options are used with value '-'.

Added -p / --protocol SERVICE-URI option to execute a remote query at a SPARQL HTTP protocol URI. This is used with -e query string to specify the query to execute remotely.

Configuration and build changes

Use AC_LANG_SOURCE for gcc flag test.

Other changes

The srxread and srxwrite example programs now build when Rasqal is configured and built with raptor V2.

Rasqal 0.9.20 Changes

The main changes in this release are:

  • Support more SPARQL 1.1 Query and Update draft syntax and some execution semantics for new built-in expressions.
  • Support building with Raptor V2 API as well as Raptor V1 API. The Raptor V2 API is only used if --enable-raptor2 is given to configure.

Fixed Issues:

  • 0000352: CONSTRUCT with a LIMIT doesn't limit query results
  • 0000353: CONSTRUCT with an ORDER always(?) returns an empty graph
  • 0000354: Comparing xsd:int and xsd:integer fails in SPARQL
  • 0000360: [PATCH] HTML Table results format
  • 0000374: Solaris 10 'make check' failures
  • 0000377: Cannot format results in roqet
  • 0000378: Crash when cleaning up after a failed query containing unsupported syntax

Query API changes

Moved generate blank node ID functionality to world class. Deprecated rasqal_query_set_default_generate_bnodeid_parameters() for rasqal_world_set_default_generate_bnodeid_parameters(). Deprecated rasqal_query_set_generate_bnodeid_handler() for new function (with different handler signature) rasqal_world_set_generate_bnodeid_handler().

Added rasqal_query_get_having_conditions_sequence() and rasqal_query_get_having_condition() for getting access to the HAVING expression list in a query.

Expression and literal class changes

Added new literal type RASQAL_LITERAL_INTEGER_SUBTYPE to let subtypes of xsd:integer work in data and expression evaluation.

Add support for SPARQL 1.1 draft FILTER expression operators including execution in the expression evaluation and writing the expression as SPARQL:

New rasqal_op enum SPARQL 1.1 expression
RASQAL_EXPR_IF IF(condition expression, expr if true, expr if false)
RASQAL_EXPR_URI URI(uri string)
RASQAL_EXPR_IRI IRI(iri string)
RASQAL_EXPR_STRLANG STRLANG(literal string, language string)
RASQAL_EXPR_STRDT STRDT(literal string, datatype URI)
RASQAL_EXPR_BNODE BNODE() and BNODE(string)
RASQAL_EXPR_IN Expr IN ( list )
RASQAL_EXPR_NOT_IN Expr NOT IN ( list )

Added expression evaluation and expression formatting support for the above new (non-aggregate) expression operations in: rasqal_expression_clear(), rasqal_expression_visit(), rasqal_expression_write(), rasqal_expression_print(), rasqal_expression_is_constant() and rasqal_query_write_sparql_expression().

Added rasqal_op enumeration values for built-in aggregate functions RASQAL_EXPR_GROUP_CONCAT and RASQAL_EXPR_SAMPLE but no expression execution.

Added new bitflags rasqal_expression_flags for rasqal_expression flags with initial bitflags RASQAL_EXPR_FLAG_DISTINCT for distinct (aggregate functions) and RASQAL_EXPR_FLAG_AGGREGATE for aggregate functions.

Added rasqal_new_function_expression2() for functions with parameters and optional bit flags deprecating rasqal_new_function_expression(). This is not capable of adding a user extension aggregate function.

Added new rasqal_new_aggregate_function_expression() constructor for making a 1-arg built-in aggregate functions. This is not capable of adding a user extension aggregate function.

The never used RASQAL_EXPR_GROUP_COND_ASC and RASQAL_EXPR_GROUP_COND_DESC are marked as obsolete.

Updated documentation for rasqal_expression_visit(), rasqal_graph_pattern_visit_fn and rasqal_expression_visit_fn typedef to match what the code actually does.

Added rasqal_new_group_concat_expression() for building SPARQL GROUP_CONCAT() expressions with flags, non-empty list of expressions and optional literal separator.

SPARQL query language changes

Support latest SPARQL 1.1 Query W3C working draft of 1 June 2010 syntax such as:

For SPARQL 1.1 Query, allow DISTINCT optionally before extension function expressions with new flag RASQAL_EXPR_FLAG_DISTINCT.

Added draft SPARQL 1.1 Query IF(), URI(), IRI(), STRLANG(), STRDT() and BNODE() (with optional expression arg) built-in expressions.

Added draft SPARQL 1.1 Query IN() and NOT IN() operators.

Adjust draft SPARQL 1.1 Query select expression syntax to latest version: '(' Expr 'AS' Var ')' with required braces.

Added draft SPARQL 1.1 Query aggregate functions GROUP_CONCAT() and SAMPLE() with new expression enum RASQAL_EXPR_GROUP_CONCAT and RASQAL_EXPR_SAMPLE as well as formatting to SPARQL and placeholder expression handling implementation - no aggregate expression evaluation. Supports the optional ; SEPARATOR = "string" syntax for GROUP_CONCAT().

Add support for draft SPARQL 1.1 Query syntax GROUP BY a list of select expressions and HAVING with a list of expressions.

Add partial support for draft SPARQL 1.1 Query extension (aggregate) functions with DISTINCT and parameters.

Support latest SPARQL 1.1 Update W3C working draft of 1 June 2010 syntax such as:

  • CLEAR GRAPH DEFAULT
  • CLEAR GRAPH uri
  • DELETE DATA { ... }
  • DELETE DATA { GRAPH uri { ... } } INSERT DATA { GRAPH uri { ... } }
  • DELETE WHERE { ... }
  • DELETE WHERE { GRAPH uri { ... } }
  • DELETE { ... } WHERE { ... }
  • DROP GRAPH uri
  • DROP SILENT GRAPH uri
  • INSERT DATA { ... }
  • INSERT { GRAPH uri { ... } } WHERE { ... }
  • LOAD uri INTO DEFAULT
  • LOAD uri INTO uri
  • LOAD uri
  • WITH uri DELETE { ... } INSERT { ... } USING NAMED uri WHERE { ... }

Not all cases may be covered yet since the grammar is hard to implement and may be ambiguous.

LAQRS syntax support

Start giving deprecated messages for LAQRS SELECT ... AS varname (bare variable name) instead of the draft SPARQL 1.1 Query SELECT ... AS ?varname with $ or ? symbol.

Query engine changes

Make query result limit and offset work when no ORDER BY is part of the query (yes - this is a well-defined count of under-defined actual results) with the original query engine. Related to Issue#0000352.

Add datatype support for xsd:date for value normalization and comparisons.

Handle when results are sorted before used to build triples via CONSTRUCT, which has no practical use since triples are not ordered and is less efficient since you have to read all the results into memory. Anyway, it works now.

Query results formatter class changes

Added an HTML Table results format (name 'table') by Nicholas J Humfrey using patch from Issue#0000360.

A NULL base_uri is valid in rasqal_query_results_formatter_write()

World class changes

Moved generate blank node ID functionality to world class, deprecating the query class methods. Added rasqal_world_set_default_generate_bnodeid_parameters(), rasqal_world_set_generate_bnodeid_handler() with new handler typedef rasqal_generate_bnodeid_handler2.

Other changes

Made all rasqal destructors simply return when given a NULL object pointer. They mostly did this already.

Updated rasqal.spec.in based on fedora spec (not tested)

Replace strncpy() with memcpy() since the the strncpy() zero-checking and zero-filling semantics are never needed.

Minimum raptor version is now 1.4.19 so that the raptor_world typedef is always available.

Rasqal 0.9.19 Changes

The only change to this release is to fix the pkg-config rasqal.pc file to to restore the dependency on raptor which was accidently deleted. Lesson learnt: do not commit code after midnight local time.

Rasqal 0.9.18 Changes

The main changes in this release are:

  • Add initial draft parsing and API (NOT execution) support for SPARQL 1.1 Update W3C Working Draft of 2010-01-26.
  • Add public APIs (row, results, result formatter, variables table) so that query results can be built, read and written without a query.
  • Add API resilience checks for invalid NULL pointer arguments.

Fixed Issues:

  • 0000320: Add a void* user_data field to rasqal_variable
  • 0000323: Official MIME Type for JSON isn't text/json
  • 0000343: Mime type for 'table' results format is text/plan
  • 0000345: MIME Type and URI for TSV and CSV
  • 0000347: rasqal linking fix

Query API Changes

A user data void* user_data field was added to the rasqal_variable structure to allow application code to store additional information.

Added a new rasqal_query_verb enum value for SPARQL 1.1 (draft) Update: RASQAL_QUERY_VERB_UPDATE which indicates that a sequence of update operations are available in the query structure, rather than a query (SELECT, ASK, DESCRIBE).

Added a rasqal_update_operation class for holding an updates that adds and/or removes triples from a graph (with possible conditional where) or does a graph administration operation on a grpah.

Added an rasqal_update_type enum for the types of graph update - clear, drop, delete, insert and, load.

Added rasqal_update_type_label() to get a label for a rasqal-update_type.

  const char* rasqal_update_type_label(rasqal_update_type type);

Added an rasqal_update_flags enum for capturing update operations flags such as SPARQL 1.1 Update SILENT for silent graph administration operations and DATA for bulk insert/delete data, rather than graph pattern templates with variables.

Added rasqal_query_get_update_operations_sequence() to get the sequence of updates from a query. Added rasqal_query_get_update_operation() get an individual update operation from a query via an index.

  raptor_sequence* rasqal_query_get_update_operations_sequence(rasqal_query* query);

  rasqal_update_operation* rasqal_query_get_update_operation(rasqal_query* query,
    int idx);

Query Results Class Changes

rasqal_new_query_results() added to public API to construct a standalone query result set without being the result of a query execution. (The destructor is already present). Added method rasqal_query_results_add_row() to add a row to a query result set.

  rasqal_query_results* rasqal_new_query_results(rasqal_world* world,
     rasqal_query* query, rasqal_query_results_type type,
     rasqal_variables_table* vars_table);

  int rasqal_query_results_add_row(rasqal_query_results* query_results,
     rasqal_row* row);

rasqal_query_results_type enum added to public API for use with rasqal_new_query_results().

Query Results Formatter Class Changes

Registered URIs for the CSV and TSV query result formats and fixed the mime types for those as well as the JSON format as reported in issues Issue #0000345 and Issue #0000323.

Added rasqal_new_query_results_formatter2() with format name, mime type and URI args deprecating rasqal_new_query_results_formatter() and rasqal_new_query_results_formatter_by_mime_type().

  rasqal_query_results_formatter* rasqal_new_query_results_formatter2(rasqal_world* world,
    const char *name, const char *mime_type, raptor_uri* format_uri);

Added rasqal_query_results_write2() and rasqal_query_results_read2() with both name and mime_type args deprecating rasqal_query_results_write() and rasqal_query_results_read() respectively.

  int rasqal_query_results_write2(raptor_iostream *iostr,
    rasqal_query_results *results, const char* name, const char* mime_type,
    raptor_uri *format_uri, raptor_uri *base_uri);

  int rasqal_query_results_read2(raptor_iostream *iostr,
    rasqal_query_results *results, const char* name, const char* mime_type,
    raptor_uri *format_uri, raptor_uri *base_uri);

Query Result Row Class

Export the query result row class to the public API to allow creating standalone query results set without a query.

Added rasqal_new_row_for_size(), rasqal_free_row() to construct and destruct a row and rasqal_row_set_value_at() to set row literal values.

  rasqal_row* rasqal_new_row_for_size(rasqal_world* world, int size);

  void rasqal_free_row(rasqal_row* row);

  int rasqal_row_set_value_at(rasqal_row* row, int offset,
    rasqal_literal* value);

Variables Table Class

Added variables table class rasqal_variables_table to the public API to allow use in creating a standalone query results.

Added rasqal_new_variables_table() and rasqal_free_variables_table() to construct and destroy a variables table. Added method rasqal_variables_table_add() to add a variable to the variables table.

  rasqal_variables_table* rasqal_new_variables_table(rasqal_world* world);

  void rasqal_free_variables_table(rasqal_variables_table* vt);

  rasqal_variable* rasqal_variables_table_add(rasqal_variables_table* vt,
    rasqal_variable_type type, const unsigned char *name,
    rasqal_literal *value);

SPARQL Changes

Added syntax-only and API support (no execution) for the SPARQL 1.1 Update W3C Working Draft of 2010-01-26 syntax. These are only available when using the 'laqrs' query language name, until SPARQL 1.1 is stable.

Added new lexer support for keywords: WITH, CLEAR, CREATE, SILENT, DATA, DROP, LOAD

Added CLEAR and CLEAR GRAPH uri

Added DROP GRAPH uri

Added INSERT DATA { triples }

Added DELETE templates to delete multiple subgraphs.

Added DELETE DATA { triples }

Added LOAD uri and LOAD uri INTO graph-uri

Added WITH uri DELETE { ... } INSERT { ... } WHERE ... update form since other combinations are ambiguous.

NOTE: The older LAQRS experimental INSERT and DELETE formats are supported but deprecated.

Query Engine changes

Nobody reported it, but decimal division was totally broken. Fixed it to do division and not add!

Other Changes

Multiple code style updates and code file reorganizing.

Link roqet directly with -lraptor to get raptor symbols used linked directly, to enable alternate library linking approaches to work. Based on the request in Fixes Issue#0000347 and Fedora bug 564885.

Added checks for the public API methods to ensure NULL pointers are not accepted or used.

Added example code for constructing a query result set without a query

Updated configure and the build system to use silent rules for the maintainer (by default), or when --enable-silent-rules is passed to configure. This feature requires building with automake 1.11 which requires autoconf 2.62 or newer when building from GIT.

autogen.sh script was updated to enforce the autotools versions above.

The rasqal.pc file now uses the Requires.private field for raptor; it should only be in the link line with
pkg-config --static ... is used.

Enforce that only raptor versions <1.9.0 are supported. No Raptor2 or Raptor2 alpha support yet.

Rasqal 0.9.17 Changes

WARNING: ABI AND API CHANGED IN THIS RELEASE.

This means: functions and structs were removed, modified and added.

Consequently the shared library major soname version has changed from 1 to 2.

The main change in this release is to add a new query engine and to enable it as the default query engine. It supports more of the SPARQL query algebra such as groups and optionals. There were many other changes and fixes.

Fixed Issues: (most of them in query engine 2)

  • Issue#0000077: OPTIONAL messes up query results
  • Issue#0000128: GROUP graph pattern support in the query engine
  • Issue#0000168: Wrong processing of the function "bound" with "OPTIONAL"
  • Issue#0000258: Using FILTER with OPTIONAL in SPARQL queries
  • Issue#0000261: Some SPARQL queries with multiple OPTIONAL patterns fail to return results
  • Issue#0000271: rasqal library does not compile cleanly when using g++ compiler
  • Issue#0000279: JSON query binding serializer is returning illegal JSON - extra double quotes before "ordered" and "distinct"
  • Issue#0000305: bound gives incoherent results

Rasqal world API changes

Added methods for setting of an already-opened raptor library to pass into rasqal, rather than it creating one itself. rasqal_world_open() can then be called to do the actual initialisation:

  int rasqal_world_open(rasqal_world* world);

  void rasqal_world_set_raptor(rasqal_world* world,
                               raptor_world* raptor_world_ptr);

  raptor_world *rasqal_world_get_raptor(rasqal_world* world);

Exported new C defines for the library versions: RASQAL_VERSION in 6-digit integer MMNNRR format (Major, miNor, Release), RASQAL_VERSION_STRING in string "MM.NN.RR" format, RASQAL_VERSION_MAJOR for integer major version number, RASQAL_VERSION_MINOR for integer minor version number and RASQAL_VERSION_RELEASE for integer release number.

API CHANGE: rasqal_features_enumerate() gains an initial rasqal_world argument to become a method of the world class:

  int rasqal_features_enumerate(rasqal_world* world,
    const rasqal_feature feature, const char **name,
    raptor_uri **uri, const char **label);

API CHANGE: rasqal_feature_from_uri() gains an initial rasqal_world argument to become a method of the world class:

  rasqal_feature rasqal_feature_from_uri(rasqal_world* world,
    raptor_uri *uri);

Data Graph API changes

API CHANGE: The rasqal_data_graph structure gains a new world reference pointer field.

API CHANGE: rasqal_new_data_graph() gains an initial rasqal_world argument:

  rasqal_data_graph* rasqal_new_data_graph(rasqal_world* world,
    raptor_uri* uri, raptor_uri* name_uri, int flags);

Expression API changes

rasqal_op enumeration gains values for LAQRS (possible SPARQL 1.1) expression operators: RASQAL_EXPR_SUM, RASQAL_EXPR_AVG, RASQAL_EXPR_MIN and RASQAL_EXPR_MAX. It also gains RASQAL_EXPR_COALESCE for LAQRS experimental coalesce expression COALESCE(expression list)

API CHANGE: The rasqal_expression structure gains a new world reference pointer field.

API CHANGE: All rasqal_expression constructors gain an initial rasqal_world argument:

  rasqal_expression* rasqal_new_0op_expression(rasqal_world* world,
    rasqal_op op);
  rasqal_expression* rasqal_new_1op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg);
  rasqal_expression* rasqal_new_2op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2);
  rasqal_expression* rasqal_new_3op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg1,  rasqal_expression* arg2,
    rasqal_expression* arg3);
  rasqal_expression* rasqal_new_string_op_expression(rasqal_world* world,
    rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal);
  rasqal_expression* rasqal_new_literal_expression(rasqal_world* world,
    rasqal_literal* literal);
  rasqal_expression* rasqal_new_function_expression(rasqal_world* world,
    raptor_uri* name, raptor_sequence* args);
  rasqal_expression* rasqal_new_cast_expression(rasqal_world* world,
    raptor_uri* name, rasqal_expression *value);

API CHANGE: rasqal_expression_evaluate() gains an initial rasqal_world argument:

  rasqal_literal* rasqal_expression_evaluate2(rasqal_world *world,
    raptor_locator *locator, rasqal_expression* e, int flags);

Added rasqal_graph_pattern_get_origin() to get the graph from a GRAPH graph pattern:

  rasqal_literal* rasqal_graph_pattern_get_origin(rasqal_graph_pattern* gp);

Added rasqal_graph_pattern_set_filter_expression() and rasqal_graph_pattern_get_filter_expression() methods to set/get an expression for a filter graph pattern:

  int rasqal_graph_pattern_set_filter_expression(rasqal_graph_pattern* gp,
    rasqal_expression* expr);

  rasqal_expression*
    rasqal_graph_pattern_get_filter_expression(rasqal_graph_pattern* gp);

Graph Pattern API changes

rasqal_graph_pattern_operator enumeration gains RASQAL_GRAPH_PATTERN_OPERATOR_FILTER for a filter graph pattern and RASQAL_GRAPH_PATTERN_OPERATOR_LET for LAQRS experimental assignment 'graph pattern'.

API CHANGE: Removed functions rasqal_graph_pattern_add_constraint(), rasqal_graph_pattern_get_constraint_sequence() and rasqal_graph_pattern_get_constraint(). These are replaced by filter graph pattern with expression - functions rasqal_graph_pattern_set_filter_expression and rasqal_graph_pattern_get_filter_expression().

LAQRS Changes

LAQRS is now available in the configuration and does not need to be explicitly selected with configure.

Add SUM(), AVG(), MIN() and MAX() aggregate expressions to LAQRS. Supported in syntax only, not in any of the query engines.

Add LET ?var := expression experimental syntax. Query engine 2 can execute this.

Add COALESCE(expression list) experimental expression to return the first defined expression value in the list. Query engines 1 and 2 can execute this.

Literal API changes

API CHANGE: Reordered rasqal_literal_type enumeration to match numeric type promotion order: float is now between integer and double. Also added RASQAL_LITERAL_XSD_STRING for xsd:string typed literals and RASQAL_LITERAL_UDT for unknown data typed literals. Both were separated out of RASQAL_LITERAL_STRING which is now for RDF plain literals and plain/typed turned into RDF terms only

Added rasqal_literal_get_rdf_term_type() method to return the RDF term type of a literal as a rasqal_literal_type - uri, blank node, literal or cannot be represented (e.g. qname or internal literal types).

  rasqal_literal_type rasqal_literal_get_rdf_term_type(rasqal_literal* l);

Added rasqal_literal_same_term() method to perform SPARQL sameTerm() comparison.

  int rasqal_literal_same_term(rasqal_literal* l1, rasqal_literal* l2);

Added rasqal_literal_is_rdf_literal() method to check if a literal is an RDF literal (not qname or other internal types).

  int rasqal_literal_is_rdf_literal(rasqal_literal* l);

Prefix API changes

API CHANGE: The rasqal_prefix structure gain a new world reference pointer field.

API CHANGE: rasqal_new_prefix() gains an initial rasqal_world argument:

  rasqal_prefix* rasqal_new_prefix(rasqal_world* world,
    const unsigned char* prefix, raptor_uri* uri);

Query API changes

Added rasqal_query_dataset_contains_named_graph() method to check if a named graph is in a dataset:

  int rasqal_query_dataset_contains_named_graph(rasqal_query* query,
                                                raptor_uri *graph_uri);

Query Formatter Changes

SPARQL DESCRIBE no longer writes commas between terms.

Query Results API changes

Added rasqal_query_results_get_query() method to get the associated query:

  rasqal_query*
    rasqal_query_results_get_query(rasqal_query_results* query_results);

Added rasqal_graph_pattern_variable_bound_in() method to check if a graph pattern in a query defines a variable

  int rasqal_graph_pattern_variable_bound_in(rasqal_graph_pattern *gp,
    rasqal_variable *v);

Query Results Formatter Changes

SPARQL/JSON: Do not emit double " for distinct/ordered flags. Fixes Issue #0000279

Added comma-separated values (CSV), tab-separated values (TSV) and text table output formats with names csv, tsv and table.

RDQL Changes

Some updates to handle refactored query list of constraint expressions switching to a filter graph pattern. RDQL only has 0 or 1 such expressions in a single query.

SPARQL Changes

Ensure GroupOrUnionGraphPattern rule constructs the sequence of graph patterns in document order.

OptionalGraphPattern rule is now a list of 1 group graph patterns.

Fix support for <> URI literal.

Support \b, \f, \' and \" escapes in all types of quoted literals.

Fixed optional WHERE in parser to match SPARQL grammar - optional for DESCRIBE, but required for SELECT, CONSTRUCT and ASK queries.

Triples Source API changes

API CHANGE: The rasqal_triples_source and rasqal_triples_source_factory structures gain API version fields that must be set to a known API version.

API CHANGE: The rasqal_set_triples_source_factory() function for registering a triples source factory now take a function with an int error return code, and it returns an int now:

  int rasqal_set_triples_source_factory(rasqal_world* world,
     rasqal_triples_source_factory_register_fn register_fn,
     void* user_data);

Variable API changes

API CHANGE: The rasqal_variable structure gains a variables table pointer.

Other API changes

rasqal_triple_parts adds value RASQAL_TRIPLE_NONE for no parts.

rasqal_compare_flags enumeration gains RASQAL_COMPARE_URI - now also provides RDQL string to bool comparison.

API CHANGE: rasqal_new_xsd_decimal() gains an initial rasqal_world argument:

  rasqal_xsd_decimal* rasqal_new_xsd_decimal(rasqal_world* world);

Removed rasqal_triple_flags enumeration with unused values: RASQAL_TRIPLE_FLAGS_EXACT, RASQAL_TRIPLE_FLAGS_OPTIONAL and RASQAL_TRIPLE_FLAGS_LAST

Configure and Build Changes

configure now prefers pkg-config raptor to raptor-config but will accept both for now. pkg-config will not allow compiling against raptor in source tree in future.

Added --with-query-engine-version to configure to allow selecting default query engine version - values 1 or 2. This is allowed for people to switch to old engine if necessary for some existing query that the new engine cannot handle. This option will be removed at some point.

Add SHAVE support (git clone git://git.lespiau.name/shave ) to "make autotools output sane" which amounts to much less verbose messages when compiling. It is now enabled for the maintainer.

rasqal-config(1) is now a wrapper around pkg-config rasqal. Consequently --prefix=DIR and --libtool-libs are ignored.

Query Engine Changes

An entirely new query execution engine was written. The existing query execution engine was refactored out of a mess of rasqal_query and rasqal_query_results code and data. It is the default query engine as of Rasqal 0.9.17

The query engine to use can be selected at configure time wiht --with-query-engine-version to allow switching to old engine if necessary for some existing query that the new engine cannot handle. This option will be removed at some point.

The interface between the query API and the query engine is now via the rasqal_rowsource abstraction - an evaluation of a query returns a rowsource that generates the result rows of variable bindings.

Rewrote query_results class to be a pure wrapper around the rowsource and variables table, handling such things like generating triples (CONSTRUCT) from rows, creating a boolean result (ASK) by counting at least 1 result rows and generating syntax results using a query results formatter.

Added a new rasqal_query_execution_factory abstraction to provide the interface that the query execution engines implement to return a rowsource to get the results.

Both query engines can potentially be selected at runtime from the query API but ONLY when rasqal is built for development (configure --enable-maintainer-mode).

  1. If the envariable RASQAL_DEBUG_ENGINE is set with value 1 or 2, the query execution engine is chosen.
  2. The roqet(1) utility gains a -g / --engine argument.

Query engine 1 (existing):
Existing lazy evaluated engine that is hard to refactor. Internally, implemented by functions named rasqal_query_engine_1_...(). Execution factory instance rasqal_query_engine_1

Query engine 2 (new):
Based on transforming a tree of SPARQL algebra nodes constructed from the query, into a tree of rowsource-generating expressions that when evaluated at the top, returns the result rows. Each algebra node type and each rowsource type has it's own set of module unit tests built-in. Execution factory instance rasqal_query_engine_algebra

Removed query engine core legacy support for CONSTRUCT * - never in the SPARQL 1.0 language.

Pulled out row sorting code from query engine 1 into a rasqal_engine_sort module so it can be used by all query engines.

Implemented rowsource abstraction rasqal_rowsource for the following types of rowsources:

  • empty rowsource: always returns no rows
  • filter rowsource: filter an inner rowsource with an expression - used for SPARQL FILTER
  • graph rowsource: apply a graph variable to an inner rowsource - used for SPARQL GRAPH matching
  • join rowsource: join two inner rowsources on common variables and an expression. Two types of join supported: left outer join used for SPARQL OPTIONAL and natural join for groups of graph patterns.
  • project rowsource: pick [project] certain variables from an inner rowsource
  • query engine execution rowsource: rows generated by a query execution engine
  • row sequence rowsource: built from a sequence of rows
  • SPARQL xml rowsource: make rows from SPARQL Results XML syntax
  • triples rowsource: create a rowsource by binding variables to an RDF graph sort rowsource: sorts the inner rowsource by an order expression - used for SPARQL ORDERBY
  • union rowsource: union/concatenation of two inner rowsources - used for SPARQL UNION

Renamed row abstraction from rasqal_query_result_row to rasqal_row since it is independent of query results and shorter.

Use new rasqal_engine_error enumeration for query engine/internal errors - OK, FAILED or FINISHED rather than altering rasqal_query_results object fields directly.

Documented query execution engine internals as autodocs.

Added a query algebra abstraction rasqal_algebra with node type rasqal_algebra_node_operator based on SPARQL algebra operators: BGP, FILTER, JOIN, DIFF, LEFTJOIN, UNION, TOLIST, ORDERBY, PROJECT, DISTINCT, REDUCED, SLICE and GRAPH. Some of these are not needed by the query execution engines since they are handled by the high level query API - such as SLICE (limit and offset) and TOLIST (turning results into user data)

Added a variables table abstraction rasqal_variables_table pulled out of the internal query results and query structures which now point to it. Constructor rasqal_new_variables_table(), destructor rasqal_free_variables_table() and methods rasqal_variables_table_add(), rasqal_variables_table_get(), rasqal_variables_table_has(), rasqal_variables_table_set(), rasqal_variables_table_get_value(), rasqal_variables_table_get_named_variables_count(), rasqal_variables_table_get_anonymous_variables_count(), rasqal_variables_table_get_total_variables_count(), rasqal_variables_table_get_named_variables_sequence() and rasqal_variables_table_get_anonymous_variables_sequence().

Allow queries with no graph pattern to be accepted such as SPARQL DESCRIBE uri (which the query engine does not execute at present but now is at least parsed).

Do not warn about unbound variables for variables bound in GRAPH and SELECT expressions.

Renamed query language-specific factory class for creating query structure from SPARQL and RDQL syntaxes from struct rasqal_query_engine_factory to rasqal_query_language_factory since it is about the language, not the engine.

Query engine known problems:

  • Variable binding/use scope is not calculated correctly.
  • Consequently no queries with UNION work correctly.
  • Also consequently, some OPTIONAL queries execute and return results when they shouldn't due to scoping of variable rules especially in nested optionals.
  • DISTINCT uses RDF literal equality not RDF sameTerm equality and thus returns results not to spec.
  • xsd:date comparison is not date-aware, it uses a simple string equality
  • REDUCED is not implemented.

Summary of the approved DAWG SPARQL 1.0 tests as of Rasqal SVN r15841

Fail:       22 (4.99 %)
    algebra                        4
    dataset                        3
    distinct                       4
    graph                          2
    open-world                     3
    optional                       4
    reduced                        2
Pass:      419 (95.01 %)

The above results in EARL: RDF/XML and Turtle

Internal Changes

Added sparql algebra tests based on the examples in the SPARQL 1.0 Query Language Specification section 12.2.1 Converting Graph Patterns

Optionally support the experimental raptor V2 API.

Lots of resiliency fixes in the case of out of memory - Lauri Aalto.

Adjusted internal test suite to use a perl improve script that generates and uses an RDF-based manifest. The test running is now much more consise when successful.

Switch to final DAWG approved testsuite files from http://www.w3.org/2001/sw/DataAccess/tests/r2/ at CVS Revision 1.6 1008

Rasqal 0.9.16 Changes

WARNING: ABI AND API CHANGED IN THIS RELEASE.

This means: functions were removed, modified and added.

Consequently the shared library major soname version has changed from 0 to 1.

The header files moved to be installed in PREFIX/include/rasqal such as /usr/include/rasqal for usual installs.

NOTE: In the next release of rasqal, the rasqal-config utility that provides the compile and link args will be deprecated, generate a warning when run and will turn into a wrapper for pkg-config rasqal ... It will be removed in a future release.

Major Changes (break ABI and API)

Removed rasqal_init() and rasqal_finish() functions.

Added a new rasqal_world object to manage library allocations and classes with new library constructor/initializing function rasqal_world *rasqal_new_world(void) and destructor/cleanup function: void rasqal_free_world(rasqal_world*)

The following functions now take a librdf_world* world argument as the first argument: rasqal_language_name_check(), rasqal_languages_enumerate(), rasqal_new_query(), rasqal_query_results_formats_check (), rasqal_new_query_results_formatter(), rasqal_new_query_results_formatter_by_mime_type(), rasqal_new_integer_literal(), rasqal_new_typed_literal(), rasqal_new_double_literal(), rasqal_new_float_literal(), rasqal_new_uri_literal(), rasqal_new_pattern_literal(), rasqal_new_string_literal(), rasqal_new_simple_literal(), rasqal_new_boolean_literal(), rasqal_new_variable_literal(), rasqal_new_decimal_literal(), rasqal_new_decimal_literal_from_decimal()

Removed deprecated rasqal_new_floating_literal(), rasqal_graph_pattern_get_flags(), rasqal_expression_foreach() functions, RASQAL_LITERAL_FLOATING macro and rasqal_expression_foreach_fn typedef.

Modified rasqal_triples_match struct to add a rasqal_world* world field.

There is no more static data such as error pointers, arrays of query languages, URI objects; it is all attached to the rasqal_world object.

Misc changes

Fixed memory leaks in lang() expression evaluation. (Lauri Aalto)

Made several low-memory resiliance fixes in query construction and execution. (Lauri Aalto)

Library requires raptor 1.4.17 or newer to get the newly public raptor SAX2 API for reading SPARQL XML Results format.

Updated mpfr configure check to look for modern functions rather than functions that are also in the older gmp-mpfr library too.

Only the first error is reported for syntax errors in lex/parse of SPARQL and RDQL since the lack of error recovery means that the consequent messages are of little use.

Fatal errors in SPARQL and RDQL lexer/parser no longer does an abort, but exits via setjmp/longjmp.

Query Engine Changes

Added internal rowsource class to get rows from an execution engine or a syntax (query result formatter).

Graph Pattern Class Changes

Modified rasqal_graph_pattern_add_sub_graph_pattern() to have an int return value for catching allocation failures.

Query Class Changes

Modified rasqal_query_add_variable() and rasqal_query_add_prefix() to have int return values for catching allocation failures.

Query Results Class Changes

Updated the internals to allow construction of a query result outside the query engine, such as from a syntax.

Added rasqal_query_results_read() to read a query results from an iostream in some format.

Modified rasqal_query_results_formats_enumerate() to add a flags argument with RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER and RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER choices to choose formats for read or write enumeration.

Removed function rasqal_query_results_formats_enumerate_full now handled by rasqal_query_results_formats_enumerate().

Added rasqal_query_results_formatter_read() to read query results from a syntax via an iostream.

Variable Class Changes

Added rasqal_new_variable_from_variable() copy constructor.

Rasqal 0.9.15 Changes

General Changes

Many updates for better SPARQL support. Rasqal 0.9.15 passes over 92% of the DAWG SPARQL Test Suite as of 2007-11-13.

Rasqal still does not support either UNION or GROUP and OPTIONAL remains buggy. There remain a few other minor areas not yet completely supported such as XSD date and XSD dateTime equality and comparisons.

WARNING: ABI AND API CHANGE in Rasqal 0.9.16. The next release of Rasqal will be incompatible with this one.

It will have both ABI and API changes that will require source updates.

The shared library major soname will change from 0 to 1.

The header files will move to be installed in PREFIX/include/rasqal such as /usr/include/rasqal for usual installs.

The full details of the API change have not been decided but the driving change is that using the library will be done via a new Rasqal world object,k will now be used to working like a Redland librdf_world. All constructors will take this world object as an argument and all static data will be indirected from the object. Handlers such as the uri_handler/data and error handlers will also move to be set/get via the world object.

There are almost certainly other API changes and cleanups that will be done, and some possibly some of the data structures may be made internal.

Fixed issues:

SPARQL Query Language Changes

Many updates to support the SPARQL Candidate Recommendation and Proposed Recommendation versions of the language including:

  • Added REDUCED syntax support (no query engine support)
  • Added SAMETERM() support.
  • Allowing numbers at the start of local names.
  • Allowing @lang and ^^datatype after triple-quoted literals.
  • Make unary + and - work
  • Remove CONSTRUCT * that is no longer in the spec
  • Removed hexadecimal literals which were never in the spec
  • Made queries with the ASK verb work again.
  • Made LANG() and DATATYPE() work to spec on typed literals.
  • Remove warning about optional SPARQL WHERE although it is still a dumb idea to have useless keywords.

Query Engine Changes

Many internal changes were made including refactoring the engine core and adding of additional internal documentation for the engine functions.

Substantial improvements were made to datatypes support:

  • SPARQL / XQuery / XPath numeric type promotion is now supported, including derived types of xsd:integer etc.
  • Added XSD xsd:decimal implementation either using GNU MP, MPFR, C99 _Decimal (but I have yet to find a working implementation) or by default and inaccurately, C doubles.
  • Added XSD xsd:dateTime initial support for validation.
  • Numeric operations such as +, -, *, / and ! as well as comparisons are now done in the appropriate datatype (which may be a promotion).

Improved the way that literal equality and comparisons work especially with respect to datatypes. Triple pattern matching (equality) works with RDF terms. SPARQL FILTER literal equality and comparisons follow SPARQL rules with possible numeric type promotion, then using RDF Term if the types are different. ORDER comparison or DISTINCT equality checks use RDF Term. RDQL execution uses it's own existing "stringy" rules.

Set the query base URI.

Make queries that bind the origin (SPARQL GRAPH) match correctly against the default graph.

Memory reduction in stack usage when evaluation expressions (such as SPARQL FILTERs).

Public API changes

Added rasqal_home_url_string static constant.

Added rasqal_xsd_decimal class and API calls described below.

Added a decimal part to the rasqal_literal union value for RASQAL_LITERAL_DECIMAL types.

Added a parent_type part to the rasqal_literal when the type can be promoted.

Added RASQAL_EXPR_SAMETERM expression

Added RASQAL_COMPARE_RDF and RASQAL_COMPARE_URI comparison types for RDF Term comparsion rules and allowing URI comparison (without STR()) respectively.

Added rasqal_new_typed_literal() to make an RDF typed literal from a type and string (no language).

Added rasqal_new_float_literal() for wrapping a C float as XSD float.

Added new decimal literal constructor rasqal_literal* rasqal_new_decimal_literal_from_decimal(const unsigned char *string, rasqal_ xsd_decimal* decimal)

Added rasqal_literal_datatype method to get the datatype URI of a literal.

Added rasqal_literal_value method to get the literal value of a literal, looking up any variables to their value. FIXME should this not involve query results?

Added addition rasqal_triple_parts enums: RASQAL_TRIPLE_GRAPH for just the named graph part RASQAL_TRIPLE_SPO for subject, predicate and objects and RASQAL_TRIPLE_SPOG for all parts including named grpah.

Decimal Class

A new rasqal_xsd_decimal class was added to handle XSD decimals with accurate decimal arithmetic.

Constructor:

rasqal_xsd_decimal* rasqal_new_xsd_decimal(void);

Destructor:

void rasqal_free_xsd_decimal(rasqal_xsd_decimal* dec);

Methods:

double rasqal_xsd_decimal_get_double(rasqal_xsd_decimal* dec);
int rasqal_xsd_decimal_set_double(rasqal_xsd_decimal* dec, double d);
iint rasqal_xsd_decimal_set_string(rasqal_xsd_decimal* dec, const char* string);
int rasqal_xsd_decimal_set_long(rasqal_xsd_decimal* dec, long l);
int rasqal_xsd_decimal_print(rasqal_xsd_decimal* dec, FILE* stream);
char* rasqal_xsd_decimal_as_string(rasqal_xsd_decimal* dec);
char* rasqal_xsd_decimal_as_counted_string(rasqal_xsd_decimal* dec, size_t* len_p);

Numeric methods (writing to the result argument):

int rasqal_xsd_decimal_add(rasqal_xsd_decimal* result,
                           rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_subtract(rasqal_xsd_decimal* result,
                                rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_multiply(rasqal_xsd_decimal* result,
                                rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_divide(rasqal_xsd_decimal* result,
                              rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_negate(rasqal_xsd_decimal* result,
                              rasqal_xsd_decimal* a);

Comparison methods:

int rasqal_xsd_decimal_compare(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_equals(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b);
int rasqal_xsd_decimal_is_zero(rasqal_xsd_decimal* d);

Query Results Formatter Class Changes

Updated to the 4th version of the SPARQL XML Results format by removing the ordered and distict attributes. Removed support for all the earlier versions 1 to 3.

roqet Utility Changes

Added -D / --data options for specifying data URis for the default graph and -G / --named for URIs of named graphs (the existing -s is a also a synonym for the latter).

Other Changes

Many internal fixes and cleanups after failures so that memory is not lost and/or rasqal does not crash. These many changes were primarily made by Lauri Aalto.

Several portability fixes for helping with low-memory, embedded systems and using a compiler that is not gcc.

The SPARQL test runner check-sparql was improved to read the SPARQL XML Results format (but not via XML::Simple because it is insanely complex and counterintuitive), handle DAWG test manifests and generate EARL reports. It also has new help and usage messages.

Rasqal 0.9.14 Changes

General Changes

Added syntax and API support (but no query engine support) for experimental extensions to SPARQL called LAQRS: LAQRS Adds to Querying RDF in SPARQL.

Updated the query results formatter to allow better introspection of supported formats.

Fixed issues:

LAQRS Adds to Querying RDF in SPARQL (LAQRS)

LAQRS is experimental and Rasqal provides only syntax and API support (but no query engine support) for:

  • DELETE via query verb RASQAL_QUERY_VERB_DELETE
  • EXPLAIN as a keyword allowed before any query. Returned by rasqal_query_get_explain()
  • INSERT via query verb RASQAL_QUERY_VERB_INSERT
  • COUNT() and COUNT(*) via new expressions RASQAL_EXPR_COUNT and RASQAL_EXPR_VARSTAR
  • SELECT expression AS variable via the new expression field of rasqal_variable
  • GROUP BY results via rasqal_query_get_group_conditions_sequence() and rasqal_query_get_group_condition() and new expressions RASQAL_EXPR_GROUP_COND_ASC and RASQAL_EXPR_GROUP_COND_DESC

Repeating THERE IS NO QUERY ENGINE SUPPORT FOR ANY OF THE ABOVE

LAQRS is not enabled by default in Rasqal (unless using maintainer mode or building from Subversion). To enable it, configure Rasqal like this:

$ ./configure '--enable-query-languages=sparql rdql laqrs'
...

Rasqal build summary:
  RDF query languages available : rdql sparql
  RDF query languages enabled   : sparql rdql laqrs
  Triples source                : raptor 1.4.15
$

The API changes for LAQRS are as follows:

Added new query verbs RASQAL_QUERY_VERB_DELETE and RASQAL_QUERY_VERB_INSERT

Added a constructor to create a constant or 0-operand expression (for COUNT):

rasqal_expression* rasqal_new_0op_expression(rasqal_op op);

Added a query method to get the explain flag:

int rasqal_query_get_explain(rasqal_query* query);

Added a query method to get the 'group by' condition expressions:

raptor_sequence*
rasqal_query_get_group_conditions_sequence(rasqal_query* query);

rasqal_expression*
rasqal_query_get_group_condition(rasqal_query* query, int idx);

Added rasqal_expression expression types:

  • RASQAL_EXPR_GROUP_COND_ASC for group condition ascending.
  • RASQAL_EXPR_GROUP_COND_DESC for group condition descending.
  • RASQAL_EXPR_COUNT for select COUNT()
  • RASQAL_EXPR_VARSTAR for select COUNT(*)

rasqal_variable now has a rasqal_expression* field expression.

Configuration and Build Changes

The pkgconfig rasqal.pc file and the rasqal-config script now separates directly linked shared libraries and indirectly linked ones. This prevents unnecessary references to libraries. The regular libraries includes -L plus -lrasqal and the dynamic and static libraries are available with:

  • pkgconfig rasqal --static --libs
  • rasqal-config --libs --private-libs

So for example to statically link with rasqal, use either:

$ cc .. -o foo foo.c `pkgconfig rasqal --static --libs`

$ cc .. -o foo foo.c `rasqal-config --libs --private-libs`

Query Results Formatter Changes

Made it easier to discover and create of query results in a syntax by using a MIME Type.

Added query results formatter constructor by required mime type:

rasqal_query_results_formatter*
rasqal_new_query_results_formatter_by_mime_type(const char *mime_type);

Added a method to return the mime type of a selected formatter:

const char*
rasqal_query_results_formatter_get_mime_type(
  rasqal_query_results_formatter *formatter);

Added another query results formatter static method to enumerate possible results formats, their names, labels and (new) mime type.

int
rasqal_query_results_formats_enumerate_full(const unsigned int counter,
  const char **name, const char **label,
  const unsigned char **uri_string, const char **mime_type);

Added a static method to check for support for a query results format.

int rasqal_query_results_formats_check(const char *name,
  raptor_uri* uri, const char *mime_type);

SPARQL Query Language Changes

Updated for the SPARQL Query Language for RDF, W3C Working Draft 26 March 2007

  • Added REDUCED token. This entailed changing the distinct flag from a boolean to a mode. rasqal_query_get_distinct and rasqal_query_set_distinct now takes a mode (0, 1 DISTINCT, 2 REDUCED) rather than the former boolean flag. There is no query engine support for REDUCED at present.

Query Engine Changes

Added the possibility that a query's native result is a syntax (rather than natively bindings, boolean or triples) and added a method to check for that:

int rasqal_query_results_is_syntax(rasqal_query_results* query_results);

Many query engine internal changes, but these remain unsupported: OPTIONAL graph pattern (partially working), GROUP graph pattern (no support), UNION graph pattern (no support) and new SELECT REDUCED (no support).

roqet Utility Changes

roqet can use -r to generate a chosen result syntax for bindings results or triples (using raptor).

roqet now generates namespace declarations for triples when serializing output. The result is that they are used when the serializer handles them such as generating RDF/XML (Abbreviated) or Turtle.

Other Changes

rasqal_expression lost the unused rasqal_variable* field variable

Added exported variables to return the license string in rasqal_license_string and home page in rasqal_home_url_string

Rasqal 0.9.13 Changes

General Changes

Added a new rasqal_query_results_formatter class.

Many internal query engine changes, mostly to separate query and query_results internals so that eventually the run-time execution context is entirely separated from the static query structure.

Added query features system with one initial feature RASQAL_FEATURE_NO_NET.

Configuration and Build Changes

Allow shell variable LEX to be set to things that aren't exactly flex Recommend flex 2.5.33 and update configure to point at the main flex site whichq finally gets 2.5.33 after 9 years.

PKGCONFIG vars not substituted correctly in configure.ac. Remove @LDFLAGS from rasqal.pc.in. Fixes Issue#0000098.

Win32 build fixes.Correct win32 static linking of rasqal. (Fixes Issue#0000100) and include float.h and #define isnan on win32. (Fixes Issue#0000111).

In maintainer mode, add all the supported compiler -W warning flags to the CFLAGS.

Declare several rasqal functions with GCC printf-formatting attributes when using a new enough GCC.

Remove broken debug messages. #0000131.

SPARQL Query Language Changes

Added labels to grammar tokens using bison to give better error messages.

Fix looking for EOF in an unsigned variable since it may be negative on some systems.

The query engine now implements SPARQL GRAPH matching.

RDQL Query Language Changes

Added labels to grammar tokens using bison to give better error messages.

Fix looking for EOF in an unsigned variable since it may be negative on some systems.

Query Engine Changes

The query engine now implements SPARQL GRAPH matching.

Merge only all adjacent sequences of basic graph pattern triples, not anything with triples such as optional BGP triples. Fixes Issue#0000080.

When an exact triple match is present, do not execute a query forever. Fixes Issue#0000094.

Fail if a variable argument to LANG() has an undefined value rather than try to execute a NULL pointer. Fixes Issue#0000113.

Add query / query_results link early so reference counting is done right. Fixes Issue#0000095.

Report failure as well as query finished when an error occurs during making results. Fixes Issue#0000118.

Added a hack to check an outer constraint expression. Fixes Issue#0000129.

Free origins (GRAPH nodes) in triples to prevent memory leak. Fixes Issue#0000133.

Query API Changes

Added a new rasqal_query_results_formatter class to format librdf_query_results into a syntax. Also added a rasqal_query_results_formats_enumerate() function to enumerate all the supported formats. The query results method rasqal_query_results_write() was changed to use this class internally.

Added a new feature system to allow setting parameters on the query parser/engine. Initially have one feature RASQAL_FEATURE_NO_NET that prevents network requests during a query execution. Added functions: rasqal_features_enumerate, rasqal_get_feature_count, rasqal_feature_from_uri, rasqal_feature_value_type, rasqal_query_set_feature, rasqal_query_set_feature_string, rasqal_query_get_feature, rasqal_query_get_feature_string.

roqet gained a -f / --feature option to set query features.

Rasqal 0.9.12 Changes

General Changes

Added JSON as a query results format based on the Serializing SPARQL Query Results in JSON draft.

Added query writing to a raptor_iostream which allows reading in one query language and writing in another. The only useful consequence of this now is that it enables roqet to become an RDQL to SPARQL translator.

Rasqal now requires raptor 1.4.9 or newer.

Configuration and Build Changes

Now using subversion.

roqet utility Changes

Altered the -d (--dump-query) option to now take an argument of the query format to dump. The values it can take are debug, structure or sparql.

To convert a query from RDQL to SPARQL, use:

roqet -q -i rdql -d sparql -n query.rdql > query.sparql

Added -r json for JSON query results output based on the draft defined in the Serializing SPARQL Query Results in JSON draft

SPARQL Query Language Changes

Updated to match SPARQL Query Language for RDF, W3C Candidate Recommendation 6 April 2006. All DAWG syntax tests now pass. The update includes near alignment with SPARQL grammar term names except where the flex/bison approach diverged.

Updated SPARQL tests from DAWG CVS

Finally removed long deprecated ASC[] and DESC[] syntax.

RDQL Query Language Changes

Handle empty regex // Fixes Issue#0000071

Query Engine Changes

Some updates to handle latest changes to SPARQL grammar.

Added RASQAL_EXPR_REGEX 3-arg operation to match the SPARQL regex() 2/3-arg function.

Many internal changes to move more of the query execution state from inside rasqal_query to inside rasqal_query_results and related structures. This is not yet complete but when done, you will be able to execute the same query more than once at the same time.

Query API Changes

Added rasqal_query_write to write a query structure into a syntax onto a raptor_iostream. Implements writing SPARQL format with format URI NULL, http://www.w3.org/TR/rdf-sparql-query/ or http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/

Added a JSON SPARQL query results format with format URI identifier http://www.w3.org/2001/sw/DataAccess/json-sparql/ based on the draft defined in http://www.w3.org/2001/sw/DataAccess/json-sparql/ Implemented document with version alt-ser-sparql.rst,v 1.3 2006/02/16 16:03:08 k Exp.

rasqal_query_get_all_variable_sequence was corrected to match the definition - return all variables, not just the bound (SELECTed) ones. Fixes Issue#00000079.

Added rasqal_query_get_anonymous_variable_sequence to return only anonymous variables after change above.

Added rasqal_graph_pattern_get_index to get the absolute index of a graph pattern in a graph.

IOstream class Changes

Added rasqal_query_iostream_write_escaped_counted_string and rasqal_query_escape_counted_string to format an escaped string suitable for using inside a query.

Documentation Changes

Updated roqet.1 for --exec option and new usages.

Rasqal 0.9.11 Changes

General Changes

Duplicated SELECT variables are now detected, give a warning and are removed.

Rasqal now requires raptor 1.4.8 or newer to get the guess parser that uses URI/name and mime type returned from protocol request (if available) to choose the correct parser.

Added an internal rasqal_map key : value map for use with result duplicate detection and ordering.

A major source code regoranisation moved all library source code to the src/ dir, roqet to utils/ and other documentation to docs/. This should only affect packagers, not any functionality.

Many more function documentation were added to the sources for use by gtk-doc.

SPARQL Query Language Changes

Updated to the SPARQL Query Language for RDF W3C Working Draft 23 November 2005:

  • Added isIRI keywords.
  • Updated the name definitions to allow initial _ in variable names.
  • Changed the decimal and double literal syntax.
  • Allow negative numeric literals.
  • Change the AND and OR logic when an error is present.

Added a post 2005-11-23 SPARQL WD syntax change: added langMatches operator and initial query engine support.

Invalid \uHHHH and \UHHHHHHHH hex escapes and floating point number formats are detected and warned.

Updates to the query engine make DISTINCT and ORDER BY now work, including with LIMIT.

The lexer now counts line numbers correctly over multi-line comments.

Updated changes to the valid characters allowed in SPARQL names for variable, prefix and QNames.

RDQL Query Language Changes

The lexer now counts line numbers correctly over multi-line comments.

Query Engine Changes

When query result sorting is used with limit (SPARQL LIMIT) and offset, they now work correctly, performing the limit and offset after ordering the result. This matches the SPARQL query result semantics.

The query engine now implements distinct results (SPARQL DISTINCT) including with ordering (SPARQL ORDER BY).

More cases with optional graph patterns (SPARQL OPTIONALs) are now executed correctly. Note: this does not mean all cases work, there are known problems with executing optional clauses.

Added types for xsd:float (C float) and xsd:double (C double); xsd:decimal (handled as a string) and xsd:datetime (as a string).

Fixed (a compare b) between integers and doubles to be the right sign.

Do not promote literals early on in comparisons to strings "perl style" but do the best type-based comparsion as late as possible.

Query API Changes

Added rasqal_new_double_literal.

Added rasqal_graph_pattern_visit and type for visitor function rasqal_graph_pattern_visit_fn.

Added rasqal_new_expression_from_expression.

Added rasqal_expression_visit and type for visitor function rasqal_expression_visit_fn.

Deprecated function rasqal_new_floating_literal replaced by new rasqal_new_double_literal.

Deprecated function rasqal_expression_foreach, replaced by new rasqal_expression_visit.

Function rasqal_expression_evaluate gains a flag argument of new enum rasqal_compare_flags.

Added enum rasqal_compare_flags flags for rasqal_expression_evaluate or rasqal_literal_compare. Type RASQAL_COMPARE_XQUERY can be used with to ask for use of XQuery comparison and type promotions.

Added rasqal_literal types: RASQAL_LITERAL_DECIMAL, RASQAL_LITERAL_DATETIME, RASQAL_LITERAL_DOUBLE (replacing deprecated RASQAL_LITERAL_FLOATING) and RASQAL_LITERAL_FLOAT. Reordered the rasqal_literal types in the enum.

The enum types in rasqal_literal_type were reordered to make them match sparql type promotion.

roqet utility program changes

roqet gains -e/--exec option to execute a query string directly rather than via a file or URI containing the query.

Now writes out XML results format in format with version URI http://www.w3.org/2005/06/sparqlResults and short name "xml". The previous version is available with short name "xml-v2". The latest version now writes ordered and distinct boolean-valued attributes on the results element.

Configuration Changes

The autogen.sh script for building from CVS was revamped to be more modular.

configure now takes an --enable-gtk-doc option to enable building of the documentation using the gtk-doc utility. It is by default enabled only if the utility is available.

Documentation Changes

The GNOME gtk-doc program is now used to automatically extract documentation from source comments into reference documentation. This is then merged with templates and additional documentation to provide a reference manual for rasqal as XML document which is turned into HTML along with GNOME devhelp support.

This new documentation intended to replace the librasqal manual page/web page as easier to read document with scope for better expanding with more detail of rasqal including examples and tutorial information. The librasqal manual page will continue to contain the summary information for the present.

Rasqal 0.9.10 Changes

General Changes

The query engine now supports ordering query results, in SPARQL this is the ORDER BY clause.

SPARQL Query Language Changes

The SPARQL parser now passes (accepts) all the 70+ SyntaxFull tests in the RDF Data Access Working Group (DAWG) test suite for SPARQL. This mostly means accepting optional punctuation in some places.

Sorting results with ORDER BY now partially works however comparison is not done with the SPARQL literal comparison rules (after XQuery) but using the existing RDQL-style "string-y" comparisons.

Allow <> as a URI.

The SPARQL parser now accepts some changes made by the DAWG after the last published working draft: SPARQL Query Language for RDF, W3C Working Draft, 19 April 2005. This includes:

  • In ORDER BY ASC(expression) replaces ASC[...], DESC(expression) replaces DESC[...], and it also accepts ORDER BY (expression). ORDER BY func() is accepted although at present no extension function support is available that could use it.
  • [] can be used in the triple predicate position as an anonymous existential variable
  • Enforce that ASK queries cannot use ORDER BY, LIMIT or OFFSET

Omitting WHERE gives a warning. Don't do that!

Query Engine Changes

The query engine now allows sorting of results (ORDER BY in SPARQL). It performs comparisons using the existing RDQL style and does not yet support the SPARQL literal comparison rules. Sorting can be done by a sequence of expressions, ascending or descending. If the final result is equality, the object pointers are used.

Note: removal of duplicates is not supported yet.

Some test code for datatypes support was added, not enabled by default and not yet useful.

Query API Changes

Removed functions deprecated in 0.9.9.

Added rasqal_graph_pattern_operator enumeration with values for the main SPARQL graph patterns, graph pattern class method rasqal_graph_pattern_get_operator and graph pattern utility function rasqal_graph_pattern_operator_as_string

Modified the type of the final argument of rasqal_new_graph_pattern_from_sequence and rasqal_graph_pattern_add_triples from an integer to a rasqal_graph_pattern_operator enumeration.

Deprecated function rasqal_graph_pattern_get_flags now always returning 0 replaced by the graph pattern operator functions listed above .

roqet utility program changes

Removed deprecated flags -f and -o

Rasqal 0.9.9 Changes

General Changes

SPARQL is now the default query language

Added a signing memory debugging system to aid checking when rasqal-allocated memory is freed in another library or vice-versa enabled by --with-memory-signing configure option (defaults to on in maintainer mode).

Fixed a few internal malloc/frees to use RASQAL_MALLOC / RASQAL_FREE so that the above signed memory system worked.

SPARQL Query Language Changes

Grammar updated to follow the SPARQL Query Language for RDF, W3C Working Draft, 19 April 2005. This changes many parts of the syntax:

  • Turtle/N3 style for triples with abbreviations
  • { ... } around triple patterns
  • OPTIONAL instead of []
  • GRAPH replaces SOURCE
  • FROM NAMED replaces LOAD
  • FILTER replaces AND
  • REGEX replaces ?var =~ /match/flags and !~
  • Added LIMIT, OFFSET and ORDER BY with ASC[] and DESC[]
  • Changed function syntax to remove &
  • Removed old operator tokens: ne, eq, ==

(Note: the query engine does not support sorting amongst other recently added SPARQL features)

SPARQL keywords are now case independent rather than just upper or lowercase.

Added """long literals""" after N3 (and soon, Turtle) and '''long literals''' for SPARQL only.

Added many SPARQL tests from DAWG most not yet approved by the working group. Not all pass either because not implemented or known bugs.

Added the revised SPARQL Query Results XML Format (the latest version not yet published) support to rasqal_query_results_write when called with format URI http://www.w3.org/2001/sw/DataAccess/rf1/result2.

Query Engine Changes

Uses the query results limit and offset information to skip initial results (offset) and provide a maximum number of results (limit).

Moved some engine-specific operations from RDQL and SPARQL parser.

Added internal rasqal_formula class for the Turtle part of the SPARQL parser

Deprecated the rasqal_triples_source factory method new_triples_match. It is replaced by a new method init_triples_match and will be removed from the next release.

Query API Changes

Added bnode identifier generation functions: rasqal_query_set_default_generate_bnodeid_parameters, rasqal_query_set_generate_bnodeid_handler based on the raptor API for generating blank node identifiers in the Turtle/N3 triple style.

Added order_conditions_sequence to the query structure to store query ordering conditions and added access methods rasqal_query_get_order_conditions_sequence and rasqal_query_get_order_condition to read the resulting expressions.

Added expressions for SPARQL ordering conditions: RASQAL_EXPR_ORDER_COND_ASC, RASQAL_EXPR_ORDER_COND_DESC and RASQAL_EXPR_ORDER_COND_NONE.

Added types for variables in two version - normal and anonymous with an new enum rasqal_variable_type and rasqal_new_variable_typed to allow creating them.

Completed the distinct/limit and offset get/set methods by adding: rasqal_query_set_distinct, rasqal_query_set_limit, rasqal_query_get_offset and rasqal_query_set_offset

Deprecated the rasqal_triple flags field - the value RASQAL_TRIPLE_FLAGS_EXACT was only used in internals of the execution engine. The value RASQAL_TRIPLE_FLAGS_OPTIONAL was never used. Optionals are now noted on graph patterns. Deprecated rasqal_triple_set_flags and rasqal_triple_get_flags.

Added enum rasqal_query_verb for the main query verbs: RASQAL_QUERY_VERB_SELECT RASQAL_QUERY_VERB_CONSTRUCT RASQAL_QUERY_VERB_DESCRIBE and RASQAL_QUERY_VERB_ASK. Added method rasqal_query_get_verb to access the verb.

Added rasqal_query_get_query_graph_pattern to get the top graph pattern.

Added rasqal_query_get_wildcard to get the query verb wildcard flag such as with SPARQL SELECT *

Added rasqal_query_get_construct_triples_sequence and rasqal_query_get_construct_triple to get the triples made from a SPARQL CONSTRUCT query.

roqet utility program changes

Updated roqet to include better query structure walking with -w / --walk including listing query verb, distinct, limit, offset flags, construct triples and easier to read groupings of graph patterns and triples.

Deprecated roqet arguments -f / --format and -o / --output in place of -r / --results as both choose the query results format.

SPARQL is now the default query language for roqet.

Rasqal 0.9.8 Changes

SPARQL Query Language Changes

Grammar updated to follow the SPARQL Query Language for RDF, W3C Working Draft, 17 February 2005.

Added support for casting in constraint expresions for datatyped literals with the syntax qname(literal) such as xsd:decimal("10").

Added named graphs parsing with LOAD and note that UNION cannot be handled yet, SOURCE and [...] syntax for optionals are deprecated.

Query Engine Changes

Engine now operates over a hierarchy of rasqal_graph_pattern objects, where at the root the query has a single query graph rather than a sequence of graph patterns. The query graph contains the former sequence of graph patterns.

Constraints can be applied to any graph pattern, not just at the top level of a query.

Added casting expressions type RASQAL_EXPR_CAST and constructor rasqal_new_cast_expression.

Fixed setting of a triple origin (SPARQL GRAPH) which was not working in 0.9.7

xsd:boolean RDF literals are now promoted into internal RASQAL_LITERAL_BOOLEAN typed rasqal_literal like for XSD integer and double.

The query engine uses the named graph information when evaluating queries, passing it to the rasqal_triples_match factory methods either implemented with raptor or redland as a rasqal_triples_source_factory and returning them as results of variable bindings.

Query API Changes

Added no-arg constructor rasqal_new_graph_pattern

Added method rasqal_graph_pattern_add_triples to add triples to an existing graph pattern.

Added methods rasqal_graph_pattern_add_constraint, rasqal_graph_pattern_get_constraint_sequence and rasqal_graph_pattern_get_constraint to add constraints to a graph pattern.

Added method rasqal_graph_pattern_add_sub_graph_pattern to add a sub-graph pattern to a graph pattern.

Added a Data Graph class with constructor rasqal_new_data_graph, destructor rasqal_free_data_graph and debug method rasqal_data_graph_print.

Added query methods for data graphs: rasqal_query_add_data_graph, rasqal_query_get_data_graph_sequence, rasqal_query_get_data_graph.

Deprecated query methods rasqal_query_add_constraint, rasqal_query_get_constraint_sequence rasqal_query_get_constraint, rasqal_query_add_source, rasqal_query_get_source_sequence and rasqal_query_get_source. These will be removed in the next release.

Removed functions deprecated in previous version: rasqal_query_get_variable_sequence and rasqal_query_add_triple.

Rasqal 0.9.7 Changes

General Changes

Fix a resource clean up when query results are either not read at all or not fully exhausted. This caused a problem in Redland when it held on to MySQL database handles despite a query having ended.

Added option -n/--dryrun to roqet to stop after preparing the query. Added option -w/--walk-query to walk and print the query using the graph API.

New build configuration and portability fixes for win32 (John Barstow)

Portability fixes for win32 - define RASQAL_INLINE and use it as for raptor. (Dave Viner)

Make rasqal tests work when building against raptor in a sibling source tree.

Query Engine Changes

Added a graph pattern API with rasqal_graph_pattern typedef and rasqal_pattern_flags enum with value RASQAL_PATTERN_FLAGS_OPTIONAL to allow complete walking of the query structure.

Two new methods to the query class were added to support this: rasqal_query_get_graph_pattern_sequence to get the raptor_sequence of graph patterns in a query and rasqal_query_get_graph_pattern to get individual an graph pattern by index.

The new graph pattern methods added are:

  • rasqal_graph_pattern_get_triple to get a raptor_triple inside a graph pattern.
  • rasqal_graph_pattern_get_sub_graph_pattern_sequence to get the raptor_sequence of sub-graph patterns.
  • rasqal_graph_pattern_get_sub_graph_pattern to get a sub-graph pattern inside a graph pattern by index.
  • rasqal_graph_pattern_get_flags to get a graph pattern's flags.
  • rasqal_graph_pattern_print to print a graph pattern in a debug form.

Deprecated rasqal_query_add_triple as it doesn't construct the graph patterns and is of little use as it does not build the correct query structures.

Added query API methods to get the bound and all variables in a query: rasqal_query_get_bound_variable_sequence and rasqal_query_get_all_variable_sequence respectively. Deprecated rasqal_query_get_variable_sequence as too ambiguous.

With the aid of gcc -Wswitch-enum, found and fixed cases where switch on enumerated values were missing cases. The remaining cases return failure or an error message rather than abort(). This fixed a crash when comparing for equality a variable ?x with a blank node value and an interger.

Deleted RASQAL_EXPR_PATTERN as it was never used.

Added rasqal_query_get_distinct to get a query-specified distinct results flag.

Added rasqal_query_get_limit to get a query-specified limit on the number of results.

SPARQL Query Language Changes

Updated some of the SPARQL syntax to match the changes in the SPARQL Query Language for RDF W3C Working Draft of 17 February 2005. Added GRAPH replacing SOURCE and WITH replacing FROM. Added warnings about using the older forms and about using [...] instead of OPTIONAL.

Added recording of DISTINCT and LIMIT in the query structures but not yet used by the query engine.

RDQL Query Language Changes

None.

Rasqal 0.9.6 Changes

General Changes

Fix a bug in writing a query result to XML when blank nodes are used. Now also correctly uses the base URI when pass in to the writing method.

Added support for three types of query result - bindings (the only one in previous versions), an RDF graph and a boolean. Added rasqal_query_results methods to test the type of the result: rasqal_query_results_is_bindings, rasqal_query_results_is_boolean and rasqal_query_results_is_graph.

Added rasqal_query_results_get_triple to get current triple as a raptor_statement and rasqal_query_results_next_triple to move to the next triple.

Added rasqal_query_results_get_boolean to get a boolean query result value.

Added rasqal_triple copy constructor rasqal_new_triple_from_triple.

Query Engine Changes

Constructs an RDF graph result as a sequence of triples. This enables the SPARQL CONSTRUCT form to work.

Can return a boolean result indicating that there were variable binding results, but not returning them. This enables the SPARQL ASK form to work.

Added a new function expression - rasqal_op enum value RASQAL_EXPR_FUNCTION, added new name and args fields to the rasqal_expression structure and added rasqal_new_function_expression to construct this expression.

Added new 1-argument expression RASQAL_EXPR_STR returning a string version of the expression.

Added new 1-argument expressions operating on RDF literals: RASQAL_EXPR_LANG returning the language string of an RDF literal, RASQAL_EXPR_DATATYPE returning the datatype URI of an RDF literal.

Added new 1-argument testing expressions returning booleans: RASQAL_EXPR_BOUND true if the variable argument is bound to a value, RASQAL_EXPR_ISURI true if the argument is a URI, RASQAL_EXPR_ISBLANK true if the argument is a blank node and RASQAL_EXPR_ISLITERAL true if the argument is an RDF literal.

Fixed a problem in optional results returning extra results with no new bindings.

SPARQL Query Language Changes

The SPARQL Parser now allows UTF-8 and \u, \U in prefixes and QNames.

Now supports CONSTRUCT and ASK queries using the updated query engine features.

OPTIONAL can now be used wherever [ ... ] could be used (parser bug fix).

Now supports the SPARQL built-in functions STR() returning a string version of the expression, LANG() returning the language string of an RDF literal, DATATYPE() returning the datatype URI of an RDF literal, BOUND() testing if a variable is bound, ISURI() testing if an expression is a URI, ISBLANK() testing if an expression is a blank node and ISLITERAL() testing if an expression is an RDF literal.

Now supports SPARQL BASE directive for setting the base URI of a query. This is experimental and may not be in the next version or may not be in the final SPARQL language.

The parser now expands QNames correctly when used in literals like "blah"^^xsd:string.

RDQL Query Language Changes

The RDQL Parser now allows UTF-8 and \u, \U in prefixes and QNames. This makes RDQL testsuite tests S-03, S-04 and S-05 work.

Rasqal 0.9.5 Changes

A release with major changes internal to the query engine to operate over graph patterns instead of sequences of triple patterns and to add execution of optional graph patterns. Additionally the query results can now be written in a recognised XML format.

This version of Rasqal requires Raptor 1.4.4.

Core Changes

Added a rasqal_graph_pattern class for handling matching a graph pattern (set of triple patterns) in an rasqal_query. RDQL only has one of these wheras SPARQL may have many, and they may be nested (this may change, as SPARQL is under development).

Added rasqal_query_results_write method to write variable binding query results to a raptor_iostream in the XML format defined by SPARQL Variable Binding Results XML Format, W3C Working Draft, 21 December 2004.

Query Engine Changes

Updated the query engine to operate over graph patterns rather than a single sequence of triple patterns. The graph patterns may be optional, which is used to implement SPARQL optionals. Nested graph patterns are constructed but cannot yet be executed.

Added a unary minus expression type.

Improved the type promotion for expression evaluation. Try to evaluate strings as doubles or integers if the operation contains one double or integer respectively.

Fixed a memory leak with string matches/non-matches.

SPARQL Query Language Changes

Optional graph patterns OPTIONAL and [ ... ] now work.

Added the { ... } group syntax and removed the ( ... ) form.

$ was added as an allowed variable prefixes.

A warning was added to show SOURCE * is ignored.

Added the UNION keyword, unsupported.

Rasqal now passes the DAWG SPARQL test cases: Optional triples (dawg-opt-query-001, dawg-opt-query-002, dawg-opt-query-003, dawg-opt-query-004) and examples from query WD (sparql-query-example-2.1a, sparql-query-example-2.2a, sparql-query-example-2.3a, sparql-query-example-2.4a, sparql-query-example-3)

Allow UTF-8 qname prefixes and check name against XML name constraints.

Recover lexer state from errors in regexes.

Terminate the lexer on a syntax error, rather than produce multiple errors.

RDQL Query Language Changes

The lexer now handles UTF-8 qname prefixes, enabling RDQL testsuite test S-02 to pass.

Allow UTF-8 qname prefixes and check name against XML name constraints.

Recover lexer state from errors in regexes.

Terminate the lexer on a syntax error, rather than produce multiple errors.

Rasqal 0.9.4 Changes

Pass on raptor parser errors to rasqal's error routines and upwards.

Clean up several memory allocations when a query fails to prepare or execute fully.

Fixed lexer jams when a query contained an illegal variable name after a '?'.

Fixed lexer crashes when a query ended in a regex pattern like /abc/.

Tidied up the testing framework so 'make distcheck' works.

Rasqal 0.9.3 Changes

Rasqal's License was changed from LGPL 2.1/MPL 1.1 to LGPL 2.1/Apache 2

Added support for the SPARQL Query Language for RDF, W3C Working Draft, 12 October 2004 from the W3C RDF Data Access Working Group (DAWG). The support is at the basic syntax level - token lexer and grammar parser which passes the first simple tests from the proposed DAWG testcases. No additional query engine support has been added for SPARQL features that are not supported by RDQL.

Queries can now be prepared and then executed multiple times.

Added configure --enable-query-languages option with rdql and sparql as the choices.

Thanks to Chris Pointon for several patches to make Rasqal easier to build under Win32. Applied with some modifications. Renamed the RDQL and SPARQL syntax tokens ERROR to ERROR_TOKEN to help.

Added experimental support for querying multiple sources; the same query is executed over each source in turn. Also added some support for returning the source URI which is not yet enabled as this feature is in flux in the DAWG work. This may change or be removed in future versions.

roqet can specify a data source URI on the command line with -s / --source) URI for queries executing against an implicit model.

Added the DAWG SPARQL test cases driven from the manifest.n3 format. Created tests from the examples in the working draft.

Added an experimental XML result format for bindings, based on DAWG work. Enabled in roqet with -o xml. This is very likely to change or replaced in future versions.

Added roqet argument -d / --dump-query to dump the processed query, rather than do it by default (0.9.2 and earlier).

roqet can now read queries from URIs, using the raptor_www class to do the retrieval.

Fixed the configure checks for a posix regex function regcomp to correctly discover it is present.

Internal changes

Added support for declaring prefixes for XML-style QNames both before and after their use.

The struct rasqal_prefix gained a declared field.

The struct rasqal_triple gained an origin field; not used at present but intended to support work on tracking triple provenance such as provided by Redland Contexts.

Added methods rasqal_triple_set_origin and rasqal_triple_get_origin to support the above.

struct rasqal_triple_meta now takes a 4-array of bindings, the fourth being the origin.

Exported function rasqal_set_triples_source_factory publically as originally intended.

Rasqal 0.9.2 Changes

This release made minor portability fixes for building with C++ and Win32 (untested).

Several functions changed their parameters or return values from char* to unsigned char* or const unsigned char* to reflect the actual use.

Changed to return a const unsigned char*:
rasqal_literal_as_string

Changed to take const unsigned char* (or add const):
rasqal_new_floating_literal
rasqal_new_pattern_literal
rasqal_new_prefix
rasqal_new_simple_literal
rasqal_new_string_literal
rasqal_new_variable
rasqal_query_has_variable
rasqal_query_results_get_binding_name
rasqal_query_results_get_binding_value_by_name
rasqal_query_results_get_bindings
rasqal_query_set_variable

Rasqal 0.9.1 Changes

This release changed the way that results were returned. A new rasqal_query_results class was created. This allows for a clean separation of the two concepts allowing multiple form of the results to be retrieved as methods of the query_results class, rather than the query class. The only form of results currently available is variable bindings, but RDF graphs will be returned in future, as a set of triples in a serialised form.

The execution method rasqal_query_execute was changed to return a new object of that class rather than an int success or failure.

The following methods of the rasqal_query class were renamed and moved to the new rasqal_query_results class:

0.9.0 name 0.9.1+ name
rasqal_query_get_result_count rasqal_query_results_get_count
rasqal_query_next_result rasqal_query_results_next
rasqal_query_results_finished rasqal_query_results_finished
rasqal_query_get_result_bindings rasqal_query_results_get_bindings
rasqal_query_get_result_binding_value rasqal_query_results_get_binding_value
rasqal_query_get_result_binding_name rasqal_query_results_get_binding_name
rasqal_query_get_result_binding_by_name rasqal_query_results_get_binding_value_by_name
rasqal_query_get_bindings_count rasqal_query_results_get_bindings_count

A new rasqal_free_query_results destructor was created to delete the query results. (There is no public constructor).

Other minor bugs were fixed such as multiple constraints now being ANDed and not ORed, and adding defensive code for when queries fail and results methods are invoked.

Rasqal 0.9.0 Changes

It is all new.


Copyright (C) 2004-2014 Dave Beckett
Copyright (C) 2003-2005 University of Bristol

rasqal-0.9.33/rasqal.spec.in0000644000175000017500000000601111754356266012573 00000000000000# -*- RPM-SPEC -*- %define name @PACKAGE@ %define version @VERSION@ %define release SNAP Name: %{name} Version: %{version} Release: %{release} Summary: Rasqal RDF Query Library Group: System Environment/Libraries License: LGPLv2+ or ASL 2.0 Source: http://download.librdf.org/source/%{name}-%{version}.tar.gz URL: http://librdf.org/rasqal/ BuildRoot: /tmp/%{name}-%{version} BuildRequires: libxml2-devel BuildRequires: mpfr-devel BuildRequires: pcre-devel BuildRequires: raptor2-devel >= @RAPTOR_MIN_VERSION@ # for the testsuite BuildRequires: perl(XML::DOM) Packager: Dave Beckett # Not needed since raptor2-devel require above will pull this in. # Requires: raptor2 >= @RAPTOR_MIN_VERSION@ %description Rasqal is a library providing full support for querying Resource Description Framework (RDF) including parsing query syntaxes, constructing the queries, executing them and returning result formats. It supports parsing and executing the SPARQL query language. %package devel Summary: Development files for the Rasqal RDF query library Group: Development/Libraries Requires: rasqal = %{version} Requires: gtk-doc Requires: pkgconfig Requires: raptor2-devel >= @RAPTOR_MIN_VERSION@ %description devel Libraries, includes etc to develop with the Rasqal RDF query language library. %prep %setup -q %build %configure --enable-release %{__make} OPTIMIZE="$RPM_OPT_FLAGS" %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT%{_mandir}/man1 install -d $RPM_BUILD_ROOT%{_mandir}/man3 %makeinstall # Fedora deletes .la files here %clean [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-, root, root) %doc AUTHORS COPYING COPYING.LIB ChangeLog LICENSE.txt NEWS README %doc LICENSE-2.0.txt NOTICE %doc *.html %{_bindir}/roqet %{_libdir}/librasqal*.so.* %doc %{_mandir}/man1/roqet.1* %files devel %defattr(-, root, root) %doc docs/README.html %{_bindir}/rasqal-config %{_includedir}/rasqal/ %{_libdir}/librasqal*.so %{_libdir}/pkgconfig/rasqal.pc %{_mandir}/man1/rasqal-config.1* %{_mandir}/man3/librasqal.3* %{_datadir}/gtk-doc/html/rasqal/ # Fedora rasqal-devel package does not include these %{_libdir}/librasqal*.a %{_libdir}/librasqal*.la %changelog * Tue Feb 1 2011 Dave Beckett - Raptor 2 attempt * Wed Aug 11 2005 Dave Beckett - Update Source: - Use %makeinstall * Wed Aug 10 2005 Dave Beckett - Use %configure. * Fri Jul 28 2005 Dave Beckett - Updated for gtk-doc locations * Fri Oct 22 2004 - License now LGPL/Apache 2 - Added LICENSE-2.0.txt and NOTICE * Wed May 5 2004 - Ship roqet and roqet.1 * Sat May 1 2004 - Requires raptor 1.3.0 * Mon Feb 24 2004 - Requires raptor * Mon Aug 11 2003 - Initial packaging rasqal-0.9.33/LICENSE.html0000644000175000017500000000701412270641655011774 00000000000000 Rasqal RDF Query Library - License

Rasqal RDF Query Library - License

This package is Free Software available under any one of the specified licenses below. All the licenses below are alternatives and if you select one license, that one alone applies.

1. The GNU Lesser General Public License (LGPL) Version 2.1 or any newer version

See http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html or COPYING.LIB for the full license text.


Copyright (C) 2000-2014 David Beckett
Copyright (C) 2000-2005 University of Bristol. All Rights Reserved.

This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License Version 2.1 as published by the Free Software Foundation or any newer version.

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License Version 2.1 for more details.

You should have received a copy of the GNU Lesser General Public License Version 2.1 along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


2. GNU General Public License (GPL) V2 or any newer version

Under Term 3 of the LGPL Version 2.1, you may choose to license the entire package under the GPL. If that option is chosen, then this package is licensed under the terms of the GPL Version 2 or alternatively, any newer version of the GPL. See COPYING for the full GPL license text.

3. The Apache License V2.0 or any newer version

See LICENSE-2.0.txt for the full license text.

Copyright (C) 2000-2014 David Beckett
Copyright (C) 2000-2005 University of Bristol.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

The NOTICE file contains the notices that must be applied according to section 4(d) of the Apache License, Version 2.0.


Copyright (C) 2003-2014 Dave Beckett
Copyright (C) 2003-2005 University of Bristol

rasqal-0.9.33/ChangeLog.30000644000175000017500000043115410425034165011735 000000000000002005-12-21 Dave Beckett * docs/librasqal.3, utils/roqet.1, fix-groff-xhtml, rasqal-src-config.in, RELEASE.html, TODO.html, configure.ac, NEWS.html, README.html, LICENSE.html, Makefile.am, INSTALL.html: updated urls 2005-11-20 Dave Beckett * src/Makefile.am, src/rasqal_internal.h: Disable skiplist code for now (don't ship it) 2005-09-22 Dave Beckett * tests/sparql/SyntaxFull/Makefile.am: Add new tests, 2 fail * tests/sparql/SyntaxFull/Makefile.am: Added new tests, 2 fail * tests/sparql/SyntaxFull/syntax-keywords-01.rq, tests/sparql/SyntaxFull/syntax-keywords-02.rq, tests/sparql/SyntaxFull/syntax-keywords-03.rq, tests/sparql/SyntaxFull/syntax-qname-01.rq, tests/sparql/SyntaxFull/syntax-qname-02.rq, tests/sparql/SyntaxFull/syntax-qname-03.rq, tests/sparql/SyntaxFull/syntax-qname-04.rq, tests/sparql/SyntaxFull/syntax-qname-05.rq, tests/sparql/SyntaxFull/syntax-qname-06.rq, tests/sparql/SyntaxFull/syntax-struct-11.rq, tests/sparql/SyntaxFull/syntax-struct-12.rq, tests/sparql/ExprEquals/Makefile.am, tests/sparql/ExprEquals/query-eq-graph-1.rq, tests/sparql/ExprEquals/query-eq-graph-2.rq, tests/sparql/ExprEquals/query-eq-graph-3.rq, tests/sparql/ExprEquals/query-eq-graph-4.rq, tests/sparql/ExprEquals/query-eq-graph-5.rq, tests/sparql/ExprEquals/query-eq2-graph-1.rq, tests/sparql/ExprEquals/result-eq-graph-1.ttl, tests/sparql/ExprEquals/result-eq-graph-2.ttl, tests/sparql/ExprEquals/result-eq-graph-3.ttl, tests/sparql/ExprEquals/result-eq-graph-4.ttl, tests/sparql/ExprEquals/result-eq-graph-5.ttl: Added new tests * tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am: Added the 9 EXPECTED_SPARQL_PARSER_FAILURES * tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am: Added 3 EXPECTED_SPARQL_PARSER_FAILURES: syn-05.rq syn-06.rq syn-07.rq * tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am: ADded 3 EXPECTED_SPARQL_CORRECT_FAILURES: syn-05.rq syn-06.rq syn-07.rq * tests/sparql/check-sparql: If returning no results and expect fail, return 1 * tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am: Added 9 EXPECTED_SPARQL_CORRECT_FAILURES * tests/sparql/ExprEquals/Makefile.am: Failures +1: "Equality - 2 var - test equals -- graph", total 3 * tests/sparql/check-sparql: report if expected failure happens OK early on * tests/sparql/ExprEquals/manifest.n3: Update to DAWG CVS 2005-09-12 Dave Beckett * src/sparql_parser.y (ConstructTriplesList): renamed from TriplesList and allow an empty list. * src/sparql_parser.y (GraphGraphPattern): Handle return of NULL graph pattern * src/sparql_lexer.l ({QUOTEDURI}\(?): Pass the matched string through rasqal_escaped_name_to_utf8_string to expand \u and \Us and fail on errors, then make a new URI. (rasqal_sparql_name_check): Add debug messages. (sparql_copy_qname, sparql_copy_string_token): Report name errors in prefix or local name part of a qname. * src/rasqal_general.c (rasqal_escaped_name_to_utf8_string): Calculate dest size from result pointers, not original string source. * configure.ac, tests/sparql/Makefile.am, tests/sparql/SyntaxDev/.cvsignore, tests/sparql/SyntaxDev/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/.cvsignore, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/manifest.ttl, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-basic-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-bnodes-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-expr-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-forms-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-forms-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-limit-offset-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-limit-offset-08.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-limit-offset-09.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lists-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-08.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-09.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-10.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-11.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-12.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-13.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-lit-14.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-order-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-pat-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-qname-08.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-08.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-09.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-10.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-11.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-struct-12.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-union-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL/syntax-union-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/.cvsignore, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/manifest.ttl, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-bnode-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-bnode-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-bnode-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-ask-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-ask-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-construct06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-describe01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-describe02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-select-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-select-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-general-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-general-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-general-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-graph-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-keywords-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-keywords-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-keywords-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/.cvsignore, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/bnode-dot.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/bnodes-missing-pvalues-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/bnodes-missing-pvalues-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/empty-optional-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/empty-optional-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/filter-missing-parens.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/lone-list.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/lone-node.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/manifest.ttl, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-08.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-01.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-02.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-03.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-04.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-05.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-06.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-07.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-08.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-09.rq, tests/sparql/SyntaxDev/Syntax-SPARQL3/syn-bad-10.rq: Added unapproved sparql syntax tests from DAWG SyntaxDev area * tests/sparql/check-sparql: Ad -n flag if no data is present * tests/sparql/check-sparql: Handle expect fail tests of type mfx:TestBadSyntax Check return code of roqet for failing. * tests/sparql/check-sparql: Handle mfx:SyntaxType rdf:typed actions and in that case pick up the action node as the query to use (no data, no result) Only evaluate queries that have files 2005-09-09 Dave Beckett * Reached 100% function and structure coverage according to gtkdoc-mkdb: 100% symbol docs coverage (190 symbols documented, 0 symbols incomplete, 0 not documented) * src/rasqal.h: autodocs * docs/rasqal-sections.txt: No rasqal_variable_s * src/rasqal_query.c (rasqal_query_graph_pattern_visit): autodocs * docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-query.sgml: add new fns * docs/tmpl/section-literal.sgml: remove dup text * src/rasqal_graph_pattern.c: autodocs * docs/rasqal-sections.txt: add new fns * src/Makefile.am, utils/Makefile.am: Include @RASQAL_INTERNAL_LIBS@ in linking flags to ensure internal raptor is used. 2005-09-01 Dave Beckett * src/sparql_lexer.l: "true" and "false" are now case independent 2005-08-31 Dave Beckett * configure.ac: Added --with-redland-config * src/rasqal_internal.h: Updated rasqal_engine_merge_graph_patterns and rasqal_engine_merge_triples prototypes to return an int status. * src/rasqal_engine.c: (rasqal_engine_merge_graph_patterns, rasqal_engine_merge_triples): Visitor function now returns a status. * src/rasqal_query.c: Moved rasqal_graph_pattern_visit to rasqal_graph_pattern.c * src/rasqal.h: Added rasqal_graph_pattern_visit_fn. Added prototype for rasqal_graph_pattern_visit * src/rasqal_graph_pattern.c (rasqal_graph_pattern_visit:): Moved from rasqal_query.c * docs/tmpl/section-expression.sgml, docs/tmpl/section-query_results.sgml: docs * src/sparql_lexer.l, src/sparql_parser.y: Remove NULL_LITERAL - not in SPARQL 2005-08-23 Dave Beckett * docs/tmpl/section-triples_source.sgml: section title * docs/tmpl/section-triples_source.sgml, src/rasqal_expr.c: autodocs * docs/rasqal-sections.txt: Added rasqal_new_expression_from_expression * src/rasqal_expr.c: Added usage count to rasqal_expression constructors (rasqal_new_expression_from_expression): Added copy constructor. * src/rasqal_engine.c (rasqal_engine_join_graph_patterns): Move constraints taking care to copy then free correctly. * src/rasqal.h: Added usage count to rasqal_expression. Added rasqal_new_expression_from_expression prototype. 2005-08-19 Dave Beckett * src/rasqal.h, src/rasqal_expr.c: autodocs fixes - use %RASQAL_ * docs/tmpl/section-graph_pattern.sgml: use %RASQAL 2005-08-18 Dave Beckett * docs/tmpl/section-query_results.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-query.sgml: document literal, query, query_results types * docs/rasqal-sections.txt: Add rasqal_query and rasqal_query_results * docs/rasqal-overrides.txt: override rasqal_query and rasqal_query_results * docs/Makefile.am: Make gtkdoc-mkdb ignore the C files * src/rasqal_query.c (rasqal_graph_pattern_visit): Make this recursive. * tests/sparql/ExprBuiltins/Makefile.am: datatype-1 works * src/rasqal_expr.c (rasqal_expression_evaluate): For datatype, if is a typed literal it has a datatype field then return that, otherwise fail. * tests/sparql/ExprBuiltins/Makefile.am: str-1 passes 2005-08-13 Dave Beckett * docs/tmpl/section-unused.sgml, docs/tmpl/section-variable.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-triple.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/rasqal-sections.txt: autodocs - sections intros * src/rasqal.h, src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_engine.c: autodocs * src/rasqal.h: Remove unused rasqal_new_variable_expression prototype. Deprecate rasqal_expression_foreach for rasqal_expression_visit Add rasqal_expression_visit prototype and rasqal_expression_visit_fn. * docs/rasqal-sections.txt: Add rasqal_expression_visit_fn rasqal_expression_visit 2005-08-11 Dave Beckett * autogen.sh: programs spello * autogen.sh: Add gtkdocize and swig (for bindings) only if seen in top-level configure.ac Add swig-specific version check, different from gnu style * autogen.sh: update autogen.sh again * autogen.sh: Rewrite with functions, generalize to any redland package. Add docs. * src/rasqal_engine.c: restore undef RASQAL_DEBUG * tests/sparql/part1/dawg-query-003.rq: Declare rdf: * src/sparql_parser.y (rasqal_sparql_query_engine_init): Do not declare any namespaces by default. * tests/sparql/syntax/Makefile.am: Added namespaces.rq * tests/sparql/syntax/namespaces.rq: namespaces.rq * rasqal.spec.in: - Update Source: - Use %makeinstall 2005-08-10 Dave Beckett * src/rasqal_engine.c (rasqal_engine_merge_graph_patterns): Renamed from rasqal_engine_make_basic_graph_pattern and added some docucomments. It no longer handles UNIONS - they are never merged, the code was just handling them in order to descend down the tree, now done by the visitor calling this function. Remove calling lower sub-GPs. (rasqal_engine_merge_triples): Renamed from rasqal_engine_merge_basic_graph_patterns and added some docucomments. * src/rasqal_internal.h: Added rasqal_graph_pattern_visit_fn typdef. Added prototype for rasqal_query_graph_pattern_visit * src/rasqal_query.c (rasqal_query_prepare): Rewrite to use rasqal_query_graph_pattern_visit to do graph pattern transforms. (rasqal_graph_pattern_visit): Added, called by: (rasqal_query_graph_pattern_visit): Added to walk all graph patterns in a query. * src/rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): Do not lose sub-grpah pattern UNION type. * src/sparql_parser.y (PrimaryExpression): Explain rq23 weirdness * tests/sparql/survey/query-survey-13.rq, tests/sparql/survey/query-survey-11.rq, tests/sparql/survey/query-survey-10.rq: FILTER() syntax * rasqal.spec.in: Use %configure * src/sparql_lexer.l: Remove '%' as a token. (sparql_token_print): Remove '%' * src/sparql_parser.y: Remove '%' as a token. Whitespace style fixes near rule definitions. * src/sparql_parser.y: Make FILTER use Constraint for multiple forms. (Constraint): Added. Allow the BrackettedExpression, BuiltInCall or FunctionCall alternatives. (Expression): Added. 9ConditionalOrExpression): Make it recursive rather than just allow 0 or 1 &&s. (MultiplicativeExpression): Remove '%' operator, not in SPARQL. (BuiltInCall): Renamed from CallExpression and remove FunctionCall from it. (PrimaryExpression): use BuiltInCall and add FunctionCall from above. * tests/sparql/ValueTesting/Makefile.am: +3 more tests, extendedType-literal-ne fails. * tests/sparql/syntax/cast1.rq, tests/sparql/syntax/cast0.rq, tests/sparql/bound/bound1.rq: FILTER() syntax * tests/sparql/examples/ex11.2.3.8_0.rq, tests/sparql/examples/ex3.rq: Updates from DAWG for FILTER() * tests/sparql/simple/manifest.n3, tests/sparql/SyntaxFull/manifest.ttl, tests/sparql/sort/manifest.ttl, tests/sparql/examples/manifest.n3: Update to DAWG tests - some approved * tests/sparql/ValueTesting/extendedType-eq-pass-result.n3, tests/sparql/ValueTesting/extendedType-eq-pass.rq, tests/sparql/ValueTesting/extendedType-graph-result.n3, tests/sparql/ValueTesting/extendedType-graph.rq, tests/sparql/ValueTesting/extendedType-literal-eq-result.n3, tests/sparql/ValueTesting/extendedType-literal-eq.rq, tests/sparql/ValueTesting/extendedType-literal-ne-result.n3, tests/sparql/ValueTesting/extendedType-literal-ne.rq, tests/sparql/ValueTesting/extendedType-ne-fail-result.n3, tests/sparql/ValueTesting/extendedType-ne-fail.rq, tests/sparql/ValueTesting/manifest.n3: Update to DAWG tests 2005-08-04 Dave Beckett * src/rasqal_engine.c (rasqal_engine_join_graph_patterns): Renamed from rasqal_engine_join_basic_graph_patterns. Warn if types are different. Merge sub graph sequences. (rasqal_engine_make_basic_graph_pattern): Operate over unions recursively for any lower-level basic graph patterns. Don't merge if all sub-graph patterns aren't of the same type. Never merge union sequences of size>1 * src/rasqal_internal.h: rasqal_engine_join_basic_graph_patterns now rasqal_engine_join_graph_patterns 2005-08-03 Dave Beckett * configure.ac: gtk-doc 1.3 is ok 2005-08-01 Dave Beckett * utils/Makefile.am: Add AM_CPPFLAGS and AM_CFLAGS back 2005-07-31 Dave Beckett * Source re-organisation - librasqal code moved to new src/ dir. roqet moved to new utils/ dir. Other manual pages to docs/. 2005-07-30 Dave Beckett * rasqal_expr.c, rasqal.h: autodocs * docs/tmpl/section-variable.sgml, docs/tmpl/section-unused.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-triple.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-graph_pattern.sgml: Updated templates. * docs/tmpl/section-expression.sgml: short and long desc add rasqal_compare_flags not #defines * docs/tmpl/section-data.sgml: short and long desc * docs/rasqal-overrides.txt: override some things to hide internals. * docs/rasqal-sections.txt, docs/rasqal-docs.xml, rasqal_literal.c, rasqal_expr.c, rasqal_general.c, rasqal.h: more autodocs * rasqal_query.c, rasqal_general.c, rasqal_expr.c: more autodocs and fixes for gtk-doc style * rasqal_expr.c: autodocs for rasqal_data_graph * rasqal_query.c, rasqal_expr.c, rasqal_graph_pattern.c, rasqal.h: Source code arg fixes for gtk-doc 2005-07-29 Dave Beckett * docs/rasqal.types: empty types for gtk-doc * Makefile.am: Added DISTCHECK_CONFIGURE_FLAGS * rasqal.spec.in: Updated for gtk-doc locations * docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-triple.sgml, docs/tmpl/section-unused.sgml, docs/tmpl/section-variable.sgml, docs/rasqal-overrides.txt, autogen.sh, configure.ac, docs/.cvsignore, docs/Makefile.am, docs/api.sgml.in, docs/build-docs, docs/kernel-doc, docs/rasqal-docs.xml, docs/rasqal-sections.txt, rasqal.h, rasqal_engine.c, rasqal_expr.c, rasqal_general.c, rasqal_graph_pattern.c, rasqal_literal.c, rasqal_map.c, rasqal_query.c, rasqal_raptor.c, rasqal_skiplist.c: Switch to gtkdoc for autodocs. Adjust source code comment style. * docs/version.xml.in: version xml * autogen.sh: run gtkdocize * configure.ac: require gtk-doc 1.4 2005-07-28 Dave Beckett * roqet.1: Update for newer result formats. * tests/sparql/syntax/manifest.n3, tests/sparql/syntax/Makefile.am: distinct-with-undef-var * tests/sparql/syntax/distinct-undef.rq, tests/sparql/syntax/result-distinct-undef.ttl: tests for distinct with an undef var * rasqal_query.c (rasqal_query_result_literal_sequence_compare): Two NULL literals means equality not a final comparison result, so keep searching. * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/manifest.n3, tests/sparql/syntax/order-distinct.rq, tests/sparql/syntax/order.ttl, tests/sparql/syntax/result-order-distinct.ttl: Added order and distinct check * sparql_parser.y (PatternElement): Error recovery from NULL triples but do return a graph pattern of some sort. * sparql_parser.y (PatternElement): Error recovery - do not die when triples is NULL. 2005-07-27 Dave Beckett * sparql_parser.y, roqet.c, rdql_parser.y, rasqal_map.c: gcc4 ignored return warning fixes: Discard fwrite() return values since fprintf/fputs() aren't checked. Check fread() return values and throw a user error. * rasqal_skiplist.c, rasqal_map.c: autodocs * rasqal_query.c (rasqal_query_execute): For a stored sequence of result rows, use result_count as an offset so initialise to 0 always (rasqal_query_results_next, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Adjust to use offset. * rasqal_query.c: Removed RASQAL_MAP define; it's the default now. * rasqal_skiplist.c (main): Update for new rasqal_new_skiplist API * rasqal_query.c: General: rasqal_tree renamed to rasqal_map and code moved to rasqal_map.c (rasqal_new_query_result_row, rasqal_free_query_result_row): Init/use usage counting. (rasqal_new_query_result_row_from_query_result_row): Added. (rasqal_query_result_row_compare): Take void* args, like a qsort() compare Do a distinct comparison on values before an ordering, if needed and discard duplicates there. (rasqal_map_print_query_result_row, rasqal_map_free_query_result_row): Added as rasqal_map helpers. (rasqal_query_execute): Make a new map, not tree, calling above helpers. * rasqal_map.c: autodocs * rasqal_map.c (rasqal_free_map_node): follow subtrees recursively. * rasqal_skiplist.c: rasqal_skiplist_s gains split key/value print handler methods (rasqal_new_skiplist): Split print_fn into print_key_fn and print_value_fn (rasqal_skiplist_node_print): Use new functions. * rasqal_internal.h: rasqal_query_result_row gains usage count Changed skiplist API to split key/value print handler methods Added rasqal_map class, methods. * Makefile.am: Added rasqal_map.c * rasqal_map.c: Rasqal simple Key:Value Map with duplicates allowed * rasqal_query.c (rasqal_query_execute): If added a duplicate, free the row. * rasqal_raptor.c (ordinal_as_uri): off by 1 in making ordinal URI. 2005-07-26 Dave Beckett * rasqal_query.c: sparql-results * roqet.c, rasqal_query.c: Changed results namespace from http://www.w3.org/2005/06/sparqlResults to http://www.w3.org/2005/sparql-results# 2005-07-21 Dave Beckett * rasqal_query.c (rasqal_query_results_write_xml_result2, rasqal_query_results_write_xml_result3): Use RASQAL_XSD_BOOLEAN_TRUE and RASQAL_XSD_BOOLEAN_FALSE for boolean result value. (rasqal_query_results_write_xml_result3): Add ordered and distinct attributes to element. * rasqal_literal.c (rasqal_literal_string_to_native, rasqal_new_boolean_literal): Use RASQAL_XSD_BOOLEAN_TRUE and RASQAL_XSD_BOOLEAN_FALSE. * rasqal_internal.h: Added RASQAL_XSD_BOOLEAN_TRUE and RASQAL_XSD_BOOLEAN_FALSE, maybe could be pointers to a shared string but compilers can work it out. 2005-07-18 Dave Beckett * rasqal_raptor.c (rasqal_raptor_new_triples_source): Use raptor guess parser. * configure.ac: Require raptor 1.4.8 for guess parser. 2005-07-14 Dave Beckett * sparql_parser.y: Update to rq23 CVS 1.423 2005/07/14 12:04:17 * Makefile.am: rasqal_skiplist_test is in TESTS * rasqal_internal.h, rasqal_skiplist.c: Moved internal struct rasqal_skiplist_node into rasqal_skiplist.c again. * rasqal_internal.h, rasqal_skiplist.c: Moved rasqal_skiplist headers into rasqal_internal.h for now. * rasqal_skiplist.c: Skip list implememntation * Makefile.am: Added rasqal_skiplist.c and rasqal_skiplist_test 2005-07-13 Dave Beckett * rasqal_query.c (rasqal_query_results_write_xml_result3): Indent by 2 * roqet.c: Added new xml format with URI http://www.w3.org/2005/06/sparqlResults and made old one available via xml-v2 * rasqal_query.c (rasqal_query_results_write): comments docs for URI http://www.w3.org/2005/06/sparqlResults. * rasqal_query.c (rasqal_query_results_write): Allow NULL URI for default format. Add format V3 with URi http://www.w3.org/2005/06/sparqlResults. (rasqal_query_results_write_xml_result3): Added for latest format and new namespace. * sparql_lexer.l (// comment rule, # comment rule): Use better grab-till-newline form. * tests/sparql/SyntaxFull/manifest.ttl, tests/sparql/ValueTesting/extendedType-0.n3, tests/sparql/ValueTesting/extendedType-eq-pass.rq, tests/sparql/regex/regex-query-003.rq, tests/sparql/regex/regex-query-004.rq: Update tests from DAWG CVS * sparql_lexer.l (rasqal_sparql_name_check): Ignore 0 length names - checked in parser. Make all name problems into errors rather than warnings. 2005-07-12 Dave Beckett * sparql_lexer.l: Reference rq23 Added sparql_name_check_flags enum for sparql name checking. Updated SPARQL name tokens to match latest rq23 - lots of comments. (// C++ comment rule): Use pattern to find end of line with multiple line endings. Count line. (/* C comment block rule): Use returned lines to bump the current line number. ({VARNAME} rule): Check varnames. ({NCNAME_PREFIX}":" rule): Check prefix. ({BNAME} rule): Check ncname. (rasqal_sparql_name_check): Added to do XML Name 1.1 check and others. (sparql_copy_name): Add check_flag and use it with rasqal_sparql_name_check instead of raptor_xml_name_check. (sparql_copy_qname, sparql_copy_string_token): Use rasqal_sparql_name_check instead of raptor_xml_name_check. (sparql_skip_cpp_comment): Deleted. * rdql_lexer.l (// C++ comment rule): Use pattern to find end of line with multiple line endings. Count line. (/* C comment block rule): Use returned lines to bump the current line number. (rdql_skip_cpp_comment): Deleted. * tests/sparql/SyntaxFull/manifest.ttl, tests/sparql/SyntaxFull/syntax-qname-08.rq, tests/sparql/SyntaxFull/syntax-qname-14.rq: Updates from DAWG tests 2005-07-01 Dave Beckett * configure.ac: time headers * configure.ac: Test for srandomdev for skiplists 2005-06-29 Dave Beckett * rasqal_query.c (rasqal_query_execute): Do the result making outside #ifdef RASQAL_DEBUG ... #endif Oops! * rasqal_expr.c (main): Add flags arg to rasqal_expression_evaluate * tests/sparql/survey/Makefile.am: survey-10 works. now 1 failure * rasqal_query.c: Added alternate results sorting using RASQAL_TREE define trigger to merge into a b-tree. (rasqal_query_result_row_update): Pass query compare_flags argument to rasqal_expression_evaluate. (rasqal_query_result_literal_sequence_compare): Added with main contant from rasqal_engine_query_results_compare. Operates over arrays of values of the given size. (rasqal_query_results_row_compare): Call above for order conditions or row values to handle ORDER BY(with/without DISTINCT) or DISTINCT alone. (rasqal_query_results_compare): Added. (rasqal_new_tree_node, rasqal_free_tree_node, rasqal_new_tree, rasqal_free_tree, rasqal_tree_node_add_row, rasqal_tree_add_row, rasqal_tree_node_write_indent, rasqal_tree_node_print_internal, rasqal_tree_print, rasqal_tree_node_visit, rasqal_tree_visit, rasqal_tree_add_to_sequence): Added to implement tree of rows sorted on add with optional distinct results. (rasqal_query_execute): Add alternate tree results collation enabled by RASQAL_TREE implementing distinct. * tests/sparql/sort/Makefile.am: sort-6 now passes. no sort failures * tests/sparql/ExprEquals/Makefile.am: "Equality 1-1" and "Equality 1-2" now pass. down to 2 failures * rasqal_engine.c (rasqal_engine_check_constraint, rasqal_engine_expression_foreach_fold): Use flags argument in. rasqal_expression_evaluate taken from query compare_flags field. * sparql_parser.y (rasqal_sparql_query_engine_init): Set query compare_flags to RASQAL_COMPARE_XQUERY enabling XQuery comparison and promotions. * rasqal_expr.c (rasqal_expression_evaluate): Added flags argument, to pass down to rasqal_literal_compare. Pass it down to internal uses of rasqal_expression_evaluate also. * rasqal_literal.c: rasqal_literal_type_labels reordered to match changes to rasqal_literal_type in rasqal.h (rasqal_literal_compare): Added RASQAL_COMPARE_XQUERY to use XQuery comparison and type promotions. When the above flag is set, only promote numeric types and otherwise compare different types using the order in rasqal_literal_type enum. * rasqal_internal.h: rasqal_query gains compare_flags structure * rasqal.h: Reordered the types in rasqal_literal_type to make them useful for sparql type promotion. Added define RASQAL_COMPARE_XQUERY Added flags argument to rasqal_expression_evaluate prototype. * roqet.c (roqet_write_indent): Handle any depth indenting. 2005-06-28 Dave Beckett * rasqal_engine.c: Fixes for C++. * tests/sparql/check-sparql: Warn short form of cmd lines 2005-06-26 Dave Beckett * rasqal_engine.c (rasqal_engine_prepare): Call rasqal_engine_query_fold_expressions. (rasqal_engine_expression_foreach_fold): Added to use with rasqal_expression_foreach. (rasqal_engine_expression_fold): Added, to fold an expression tree until no changes are made. (rasqal_engine_graph_pattern_fold_expressions): Added, to fold expressions inside a graph pattern - in sub graph patterns and in constraint expression. (rasqal_engine_query_fold_expressions): Added, to fold expressions inside a graph - in graph patterns and order conditions. * rasqal_expr.c (rasqal_expression_clear): Added, to deallocate a static rasqal_expression. (rasqal_free_expression): Use above. (rasqal_expression_foreach): Do current node explicitly first, before op check is done so that the user function could change the op potentially. Handle op LITERAL and op FUNCTION correctly. (rasqal_expression_is_constant): Added to check if the expression tree is a constant expression. (rasqal_expression_convert_to_literal): Convert an expression tree into a literal in-situ. * rasqal_literal.c (rasqal_literal_is_constant): Added returning non-0 if literal is a constant i.e. not a variable. * rasqal_internal.h: Added prototypes for rasqal_engine_expression_fold, rasqal_engine_graph_pattern_fold_expressions, rasqal_engine_query_fold_expressions, rasqal_literal_is_constant, rasqal_expression_is_constant, rasqal_expression_clear and rasqal_expression_convert_to_literal. * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-isLiteral works. 3 fail now. * tests/sparql/examples/ex11_0.n3, tests/sparql/examples/ex11.2.3.5_0.n3, tests/sparql/examples/ex11.2.3.2_0.n3, tests/sparql/examples/ex11.2.3.1_1.n3: Date fixes from DAWG CVS * tests/sparql/examples/ex11_1.rq, tests/sparql/examples/ex11_0.rq, tests/sparql/examples/ex11.2.3.7_0.rq, tests/sparql/examples/ex11.2.3.2_1.rq, tests/sparql/examples/ex11.2.3.2_0.rq, tests/sparql/examples/ex11.2.3.1_1.rq, tests/sparql/examples/ex11.2.3.1_0.rq: Update for FILTER() * tests/sparql/examples/Makefile.am: Correct test failures, count remains same 2005-06-25 Dave Beckett * tests/sparql/survey/Makefile.am: survey-13 now passes. now 2 failures * rasqal_query.c (rasqal_query_results_write_xml_20041221, rasqal_query_results_write_xml_result2): Use string_len rather than strlen(). * rasqal_internal.h: Added prototype for rasqal_literal_ebv. Added constants rasqal_xsd_decimal_uri, rasqal_xsd_datetime_uri and rasqal_xsd_string_uri. * rasqal_literal.c (rasqal_new_integer_literal, rasqal_new_double_literal, rasqal_new_pattern_literal, rasqal_new_string_literal, rasqal_new_simple_literal, rasqal_new_boolean_literal): Initialise the string_len field. (rasqal_literal_string_to_native): Initialise string_len field when turning into a boolean. (rasqal_literal_expand_qname): Use string_len field to initialise raptor_qname_string_to_uri. (rasqal_literal_as_node): When making a new typed literal, initialise string_len field. (rasqal_literal_ebv): Added, to return the Effective Boolean Value (EBV) of a literal. * rasqal.h: rasqal_literal gains string_len field. * sparql_parser.y (sparql_is_builtin_xsd_datatype): Added to check for the types that sparql supports. (FunctionCall): Use sparql_is_builtin_xsd_datatype to distinguish a cast from a function - name is the datatype URI, has 1 arg. * rasqal_general.c: Added constants rasqal_xsd_decimal_uri, rasqal_xsd_datetime_uri and rasqal_xsd_string_uri constants. (rasqal_uri_init, rasqal_uri_finish): Init and free rasqal_xsd_decimal_uri, rasqal_xsd_datetime_uri and rasqal_xsd_string_uri. 2005-06-24 Dave Beckett * tests/sparql/SyntaxFull/syntax-qname-07.rq, tests/sparql/SyntaxFull/syntax-qname-08.rq, tests/sparql/ValueTesting/extendedType-0.n3, tests/sparql/regex/regex-query-001.rq, tests/sparql/regex/regex-query-002.rq, tests/sparql/regex/regex-query-003.rq, tests/sparql/regex/regex-query-004.rq, tests/sparql/Expr1/expr-1.rq, tests/sparql/Expr1/expr-2.rq, tests/sparql/Expr1/expr-3.rq, tests/sparql/Expr2/query-bev-1.rq, tests/sparql/Expr2/query-bev-3.rq, tests/sparql/Expr2/query-bev-4.rq, tests/sparql/Expr2/query-bev-5.rq, tests/sparql/Expr2/query-bev-6.rq, tests/sparql/ExprBuiltins/q-datatype-1.rq, tests/sparql/ExprBuiltins/q-str-1.rq, tests/sparql/ExprBuiltins/q-str-2.rq, tests/sparql/ExprBuiltins/q-str-3.rq, tests/sparql/ExprBuiltins/q-str-4.rq, tests/sparql/ExprEquals/query-eq-1.rq, tests/sparql/ExprEquals/query-eq-2.rq, tests/sparql/ExprEquals/query-eq-3.rq, tests/sparql/ExprEquals/query-eq-4.rq, tests/sparql/ExprEquals/query-eq-5.rq, tests/sparql/ExprEquals/query-eq2-1.rq, tests/sparql/ExprEquals/query-eq2-2.rq, tests/sparql/SyntaxFull/manifest.ttl, tests/sparql/SyntaxFull/syntax-expr-01.rq, tests/sparql/SyntaxFull/syntax-expr-05.rq, tests/sparql/SyntaxFull/syntax-expr-06.rq: Updates from DAWG CVS * rasqal_query.c: Moved rasqal_query_result_row to rasqal-internal.h (rasqal_new_query_result_row): Handle no order_conditions_sequence present. Set NULL literal values when they appear, as from OPTIONAL. (rasqal_query_results_update): Added, based on core of rasqal_query_results_next to get next result from query engine, including offsets. (rasqal_query_execute): Use rasqal_query_results_update when not sorting and make a query_results->row (rasqal_free_query_results): Free any row field used. (rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Return row values, using query_results row field for stream results. * rasqal_raptor.c (rasqal_raptor_bind_match): Use rasqal_new_literal_from_literal when binding literal values, do not turn them into nodes this early. * tests/sparql/sort/Makefile.am: sort-4 sort-7 pass now only fail sort-6 * rasqal_expr.c (rasqal_expression_evaluate): For case RASQAL_EXPR_LT, RASQAL_EXPR_GT, RASQAL_EXPR_LE, RASQAL_EXPR_GE - invert the test for the result of rasqal_literal_compare test as it was totally backwards for ints and doubles. * rasqal_literal.c (rasqal_literal_compare): Return correct <0, 0, >0 for integers and doubles. It was formerly negative the right result. * rasqal_internal.h: Added struct rasqal_query_result_row internal for now. rasqal_query_results gains field row for use as the current result row when streaming results. * tests/sparql/check-sparql: tidy messages * rasqal_query.c (rasqal_new_query_result_row): Just do allocations here, and use rasqal_query_result_row_update to update the contents from the current query engine result. (rasqal_query_result_row_update): Added, updating the given row with the current query engine result. 2005-06-23 Dave Beckett * rasqal_literal.c (rasqal_literal_print): Fix formats for decimal, datetime * rasqal_query.c (rasqal_query_results_write_xml_20041221, rasqal_query_results_write_xml_result2, rasqal_query_results_get_triple): Handle RASQAL_LITERAL_FLOAT (as a double), RASQAL_LITERAL_DECIMAL (as a string) and RASQAL_LITERAL_DATETIME (as a string). * rasqal_literal.c (rasqal_new_double_literal): Added, based on rasqal_new_floating_literal. (rasqal_new_floating_literal): Now a wrapper around the above. (rasqal_literal_string_to_native): Promote xsd:float too. (rasqal_free_literal, rasqal_literal_print, rasqal_literal_as_boolean, rasqal_literal_as_integer, rasqal_literal_as_floating, rasqal_literal_as_string, rasqal_literal_compare, rasqal_literal_equals, rasqal_literal_as_node): Handle RASQAL_LITERAL_FLOAT (as a double), RASQAL_LITERAL_DECIMAL (as a string) and RASQAL_LITERAL_DATETIME (as a string). * rasqal_redland.c: Use RASQAL_LITERAL_DOUBLE instead of RASQAL_LITERAL_FLOATING * sparql_lexer.l, rdql_lexer.l, rasqal_expr.c: Replace rasqal_new_floating_literal with rasqal_new_double_literal * rasqal_general.c: Added rasqal_xsd_float_uri URI constant. (rasqal_uri_init, rasqal_uri_finish): Init/free it. * rasqal_internal.h: Added rasqal_xsd_float_uri. * rasqal.h: Added RASQAL_LITERAL_DOUBLE (formerly RASQAL_LITERAL_FLOATING), RASQAL_LITERAL_FLOAT, RASQAL_LITERAL_DECIMAL and RASQAL_LITERAL_DATETIME. float uses the 'double floating' field. decimal and datetime use the string field, for now. Deprecated rasqal_new_floating_literal Added prototype for rasqal_new_double_literal * roqet.c: Added a -e/--exec option to execute a query string directly. Usage updated to show the two forms. 2005-06-22 Dave Beckett * Makefile.am: Added ChangeLog.1 ChangeLog.2 * win32_rasqal_config.h: win32 fixes from John Barstow. 2005-06-17 Dave Beckett * Fixes for GCC 4.0 warnings: * sparql_lexer.l, rdql_lexer.l: Check for sscanf failure and return errors for hex, floating, \u and \U constants. * rasqal_literal.c (rasqal_literal_string_to_native): Add error handler and data args. Use it if sscanf fails on converting a float string. (rasqal_new_string_literal): If rasqal_literal_string_to_native fails, tidy up and return NULL. (rasqal_literal_expand_qname): if rasqal_literal_string_to_native fails, tidy up and return 1. * rasqal_internal.h: Update rasqal_literal_string_to_native prototype to take an error handler and data. * rasqal_general.c (rasqal_escaped_name_to_utf8_string): Check for sscanf failure with \u and \U such as \uGHIJ which isn't hex. * rasqal.spec.in: License not Copyright header 2005-06-15 Dave Beckett * tests/sparql/check-sparql: updated messages * tests/sparql/regex/Makefile.am: 1 failure * tests/sparql/ExprEquals/Makefile.am: 4 failures. Add explicit count. * tests/sparql/ExprBuiltins/Makefile.am: 4 failures * tests/sparql/Expr2/Makefile.am: 6 failures. Add explict count. * tests/sparql/Expr1/Makefile.am: 2 failures. Add explict count. * tests/sparql/ExprBuiltins/Makefile.am: manifest.ttl * configure.ac: Add tests/sparql regex, Expr1, Expr2, ExprBuiltins, ExprEquals dirs * tests/sparql/Expr1/Makefile.am, tests/sparql/Expr1/data-1.ttl, tests/sparql/Expr1/expr-1-result.ttl, tests/sparql/Expr1/expr-1.rq, tests/sparql/Expr1/expr-2-result.ttl, tests/sparql/Expr1/expr-2.rq, tests/sparql/Expr1/expr-3-result.ttl, tests/sparql/Expr1/expr-3.rq, tests/sparql/Expr1/manifest.n3, tests/sparql/Expr2/Makefile.am, tests/sparql/Expr2/data-1.ttl, tests/sparql/Expr2/data-2.ttl, tests/sparql/Expr2/manifest.n3, tests/sparql/Expr2/query-bev-1.rq, tests/sparql/Expr2/query-bev-2.rq, tests/sparql/Expr2/query-bev-3.rq, tests/sparql/Expr2/query-bev-4.rq, tests/sparql/Expr2/query-bev-5.rq, tests/sparql/Expr2/query-bev-6.rq, tests/sparql/Expr2/result-bev-1.ttl, tests/sparql/Expr2/result-bev-2.ttl, tests/sparql/Expr2/result-bev-3.ttl, tests/sparql/Expr2/result-bev-4.ttl, tests/sparql/Expr2/result-bev-5.ttl, tests/sparql/Expr2/result-bev-6.ttl, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprBuiltins/data-builtin-1.ttl, tests/sparql/ExprBuiltins/manifest.ttl, tests/sparql/ExprBuiltins/q-blank-1.rq, tests/sparql/ExprBuiltins/q-datatype-1.rq, tests/sparql/ExprBuiltins/q-str-1.rq, tests/sparql/ExprBuiltins/q-str-2.rq, tests/sparql/ExprBuiltins/q-str-3.rq, tests/sparql/ExprBuiltins/q-str-4.rq, tests/sparql/ExprBuiltins/q-uri-1.rq, tests/sparql/ExprBuiltins/result-blank-1.ttl, tests/sparql/ExprBuiltins/result-datatype-1.ttl, tests/sparql/ExprBuiltins/result-str-1.ttl, tests/sparql/ExprBuiltins/result-str-2.ttl, tests/sparql/ExprBuiltins/result-str-3.ttl, tests/sparql/ExprBuiltins/result-str-4.ttl, tests/sparql/ExprBuiltins/result-uri-1.ttl, tests/sparql/ExprEquals/Makefile.am, tests/sparql/ExprEquals/data-eq.ttl, tests/sparql/ExprEquals/manifest.n3, tests/sparql/ExprEquals/query-eq-1.rq, tests/sparql/ExprEquals/query-eq-2.rq, tests/sparql/ExprEquals/query-eq-3.rq, tests/sparql/ExprEquals/query-eq-4.rq, tests/sparql/ExprEquals/query-eq-5.rq, tests/sparql/ExprEquals/query-eq2-1.rq, tests/sparql/ExprEquals/query-eq2-2.rq, tests/sparql/ExprEquals/result-eq-1.ttl, tests/sparql/ExprEquals/result-eq-2.ttl, tests/sparql/ExprEquals/result-eq-3.ttl, tests/sparql/ExprEquals/result-eq-4.ttl, tests/sparql/ExprEquals/result-eq-5.ttl, tests/sparql/ExprEquals/result-eq2-1.ttl, tests/sparql/ExprEquals/result-eq2-2.ttl, tests/sparql/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/regex/manifest.n3, tests/sparql/regex/regex-data-01.n3, tests/sparql/regex/regex-query-001.rq, tests/sparql/regex/regex-query-002.rq, tests/sparql/regex/regex-query-003.rq, tests/sparql/regex/regex-query-004.rq, tests/sparql/regex/regex-result-001.n3, tests/sparql/regex/regex-result-002.n3, tests/sparql/regex/regex-result-003.n3, tests/sparql/regex/regex-result-004.n3: Import Expr1 Expr2 ExprBuiltins ExprEquals regex from DAWG tests 2005-06-14 Dave Beckett * rasqal_engine.c (rasqal_select_NULL_last_compare): Added helper for removing duplicate select variables. (rasqal_engine_assign_variables): Look for duplicate select variables, warn about them and remove them by sorting and then deleting NULL variables. * tests/sparql/syntax/Makefile.am: Added select-dup.rq * tests/sparql/syntax/select-dup.rq: Test for duplicates in select 2005-06-13 Dave Beckett * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-isBlank now works * tests/sparql/survey/Makefile.am: survey-2 now works. * rasqal_query.c (rasqal_query_prepare): Call rasqal_engine_merge_basic_graph_patterns * rasqal_engine.c (rasqal_engine_join_basic_graph_patterns): Move the triples and constraints from a source to a destination graph pattern. (rasqal_engine_make_basic_graph_pattern): Use rasqal_engine_join_basic_graph_patterns to merge: 1) a group of all basic graph patterns 2) an optional group of all basic graph patterns 3) a graph pattern with 1 sub-graph pattern Have to play some games with graph pattern operators. (rasqal_engine_merge_basic_graph_patterns): Use rasqal_engine_join_basic_graph_patterns to merge all basic graph patterns in a group into group of a single basic graph pattern of all the triples and constraints. * rasqal_internal.h: Added prototypes for rasqal_engine_join_basic_graph_patterns and rasqal_engine_merge_basic_graph_patterns * rasqal_query.c (rasqal_query_execute): For ordering results, directly use rasqal_engine_get_next_result to avoid doing limit and offset checks too early. Start off from result_count 1. (rasqal_query_results_next): For ordered results, handle limit and offset with a loop and a check with rasqal_engine_check_limit_offset. For streaming results, move check code to rasqal_engine_check_limit_offset and use it. (rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): For ordered results, use result_count-1 as an index. * rasqal_engine.c (rasqal_engine_check_limit_offset): Added to check the current query result is in the range specified by limit and offset * rasqal_internal.h: Added prototype for rasqal_engine_check_limit_offset 2005-06-09 Dave Beckett * win32_rasqal_config.h, configure.ac: Bumped version to 0.9.11 * Snapshotted rasqal_0_9_10 for 0.9.10 release * tests/sparql/ValueTesting/Makefile.am: extendedType-eq-pass passes * rasqal_query.c (rasqal_new_query_result_row): Added offset to store original sort order in case it is needed to order two identical literals. (rasqal_query_result_row_print): Print offset. (rasqal_engine_query_results_compare): Renamed from rasqal_engine_query_results_sort. Lots more debug messages and checks. Order NULL literals before other types. (rasqal_query_execute): Pass result offset into rasqal_new_query_result_row. * rasqal_literal.c (rasqal_literal_compare): Make comparison stable for URIs and datatyped strings - use strcmp on string values of URIs. * tests/sparql/sort/Makefile.am: sort-3 works * librasqal.3: Updates for 0.9.10 2005-06-08 Dave Beckett * win32_rasqal_config.h: Undefine OPTIONAL as something in win32 defines it. * sparql_parser.y, roqet.c, rasqal_query.c, rasqal_internal.h, rasqal_graph_pattern.c, rasqal_engine.c: Rename rasqal_graph_pattern_operator variables called 'operator' to 'op' for C++. Other casts for C++ * rasqal_internal.h: Added RASQAL_DEPRECATED_WARNING to generate a rasqal warning once only. * sparql_parser.y (OrderCondition): Use RASQAL_DEPRECATED_WARNING to explain ASC[] and DESC[] have been replaced. * sparql_parser.y (OrderCondition): Use RASQAL_EXPR_ORDER_COND_ASC or DESC not NONE which is deleted. * rasqal_query.c, rasqal_expr.c, rasqal.h: Deleted RASQAL_EXPR_ORDER_COND_NONE * rasqal_query.c (rasqal_engine_query_results_sort): If result is 0 at the end, use the difference between the object pointers to create a stable sort when duplicates occur. * Makefile.am: Do not build rasqal_xsd_datatypes_test unless RASQAL_DATATYPES makefile conditional is enabled. * configure.ac: Add makefile conditional RASQAL_DATATYPES true when datatypes enabled. * rasqal.pc.in: Add PKGCONFIG_REQUIRES, PKGCONFIG_LIBS and PKGCONFIG_CFLAGS * configure.ac: Tidy specification of min versions Added pkgconfig specific additions: +PKGCONFIG_REQUIRES, PKGCONFIG_LIBS and PKGCONFIG_CFLAGS substituted into rasqal.pc.in Add PCRE cflags, libs to PKGCONFIG cflags/libs when used. Add libxml-2.0 to PKGCONFIG requires when used. * rasqal_query.c (rasqal_query_execute): When sorting, set finished flag if there are no results. (rasqal_query_results_next): When sorting, set finished flag if match or exceed number of results. (rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): When sorting, set finished flag if current row is beyond results. 2005-06-07 Dave Beckett * tests/sparql/ValueTesting/extendedType-ne-fail.rq, tests/sparql/ValueTesting/extendedType-eq-pass-result.n3: Update to DAWG cvs * tests/sparql/ValueTesting/extendedType-eq-pass-result.n3: delete results from extendedType-eq-pass-result.n3 * tests/sparql/ValueTesting/Makefile.am: 2 fail * configure.ac: Added tests/sparql/ValueTesting * tests/sparql/Makefile.am, tests/sparql/ValueTesting/.cvsignore, tests/sparql/ValueTesting/Makefile.am, tests/sparql/ValueTesting/extendedType-0.n3, tests/sparql/ValueTesting/extendedType-eq-pass-result.n3, tests/sparql/ValueTesting/extendedType-eq-pass.rq, tests/sparql/ValueTesting/extendedType-ne-fail-result.n3, tests/sparql/ValueTesting/extendedType-ne-fail.rq, tests/sparql/ValueTesting/manifest.n3: Added ValueTesting * rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): Allow OPTIONAL to gather up inner basic graph patterns. Print operator type when debugging. * rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): More debug explanations of why merging/not merging. Only work on a GROUP graph pattern. * rasqal_query.c (rasqal_new_query, rasqal_free_query): Init/free query->results_sequence. Added internal rasqal_query_result_row (rasqal_new_query_result_row): Added to make a row out from a copy of all of the values of the current query result including the values of the ordering expressions for this row. (rasqal_free_query_result_row): Added to free a row. (rasqal_query_result_row_print): Added to print a row. (rasqal_engine_query_results_sort): Sequence helper function to do the query results ordering using rasqal_literal_compare. (rasqal_query_execute): If an ordering condition sequence is present, gather all the results, order them and store them in query->results_sequence. (rasqal_query_results_next, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_value_by_name): Handle getting ordered result values from query->results_sequence. * rasqal_expr.c (rasqal_expression_evaluate): Return the expression argumetn for ordering conditions. * tests/sparql/sort/Makefile.am: Fail 4 now it does something * tests/sparql/check-sparql: Handle sorted results by not sorting, and unsorted results by sorting. Clear? * rasqal_internal.h: rasqal_query structure gains internal results_sequence * rasqal_literal.c (rasqal_literal_as_node): Handle unbound variable values. * librasqal.3: rasqal_query_results_write: Note 2005-05-27 WD and add format uris * rasqal_query.c (rasqal_query_results_write): Note 2005-05-27 WD and add format uris * sparql_parser.y (PatternElementsList 2): Added debugging. * sparql_parser.y (PatternElementsList): Doesn't need mygp 2005-06-04 Dave Beckett * rasqal_engine.c (rasqal_engine_execute_init): Update the hack modification to report it with a debug dump after, and set top graph pattern operator to GROUP * sparql_parser.y (PatternElementsList): Set graph pattern operator to GROUP bydefault. * configure.ac: Simplify libxml check Add message/report for datatypes support * configure.ac: Check for libxml2, add xml2-config and xmlschema header files. Added --enable-datatypes method to enable linking libxml for datatypes. * rasqal_xsd_datatypes.c: Protect xml includes with HAVE_LIBXML_XMLSCHEMAS_H 2005-06-03 Dave Beckett * Makefile.am: Remove XML2_CONFIG 2005-06-02 Dave Beckett * rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): Change resulting graph parent pattern operator to BASIC if it was GROUP * tests/sparql/SyntaxFull/Makefile.am: 0 failures now * sparql_parser.y: Document the 12 shift/reduce conflicts now. (PropertyListOpt): Docs. (PropertyListTail): Use PropertyListOpt to allow ending on a ';' * sparql_parser.y (AskClause): ASK is done * tests/sparql/SyntaxFull/Makefile.am: Update lists * tests/sparql/SyntaxFull/syntax-forms-03.arq: Remove unused tests * tests/sparql/SyntaxFull/syntax-query-pat-01.rq, tests/sparql/SyntaxFull/syntax-query-pat-02.rq, tests/sparql/SyntaxFull/syntax-query-pat-03.rq, tests/sparql/SyntaxFull/syntax-query-pat-04.rq, tests/sparql/SyntaxFull/syntax-query-pat-05.rq: Delete old tests * tests/sparql/SyntaxFull/syntax-bnodes-08.rq, tests/sparql/SyntaxFull/syntax-bnodes-09.rq: Remove unused tests * tests/sparql/SyntaxFull/Makefile.am: Added check-sparql-correct target * tests/sparql/SyntaxFull/syntax-bnodes-08.rq, tests/sparql/SyntaxFull/syntax-bnodes-09.rq, tests/sparql/SyntaxFull/syntax-query-pat-01.rq, tests/sparql/SyntaxFull/syntax-query-pat-02.rq, tests/sparql/SyntaxFull/syntax-query-pat-03.rq, tests/sparql/SyntaxFull/syntax-query-pat-04.rq, tests/sparql/SyntaxFull/syntax-query-pat-05.rq: Added syntax-bnodes-08.rq syntax-bnodes-09.rq syntax-query-pat-01.rq syntax-query-pat-02.rq syntax-query-pat-03.rq syntax-query-pat-04.rq syntax-query-pat-05.rq tests * tests/sparql/SyntaxFull/Makefile.am: 3 to 1 failure * rasqal_xsd_datatypes.c: Pull in libxml schema headers * sparql_parser.y (OrderClauseOpt, LimitClauseOpt, OffsetClauseOpt): Check that ORDER BY is not used with ASK, LIMIT or OFFSET rather than put in grammar now. (OrderCondition): Allow FunctionCall, Var and '(' Expression ')' after rq23 latest. * Makefile.am: Added XML2_CONFIG for datatypes testing * rasqal_xsd_datatypes.c (main): run rasqal_init/finish. * sparql_parser.y: Document 6 shift/reduce * tests/sparql/SyntaxFull/Makefile.am: from 4 to 3 failures * sparql_lexer.l: Ensure <> does not get grabbed as LT GT * tests/sparql/SyntaxFull/Makefile.am: from 8 to 4 failures * sparql_parser.y: Added PropertyListOpt as an outer triple in SPARQL can be just a subject [ :a :b ] (ObjectTail): Added to tidy up Object lists, remove duplicates. * rasqal_graph_pattern.c (rasqal_graph_pattern_print): No \n after ( * sparql_parser.y (GraphPattern): Do not set graph pattern operator here. (PropertyListTail): Added after last WD grammer to aid in allowing a trailing ; (PatternElementsList): Set default operator to basic. (PropertyList): Use PropertyListTail (PropertyList): Added (VarOrBnodeOrURI): Moved '[' ']' to BlankNode. (BlankNode): Allow '[' ']' in all cases. 2005-06-01 Dave Beckett * tests/sparql/SyntaxFull/Makefile.am: crashes stopped * sparql_parser.y (VarOrBnodeOrURI): Added, used for Predicate and allows explicit bnode or [] * rasqal_graph_pattern.c (rasqal_graph_pattern_init): Add init of current_graph_pattern field when there are sub-graph patterns. Moved from rasqal_engine_execute_init. * rasqal_engine.c (rasqal_engine_execute_init): Move init of current_graph_pattern field into rasqal_graph_pattern_init * tests/sparql/examples/ex11.2.3.1_0-result.n3, tests/sparql/examples/ex11.2.3.2_0-result.n3, tests/sparql/examples/ex11.2.3.5_0-result.n3, tests/sparql/examples/ex11_0-result.n3, tests/sparql/examples/ex11_1-result.n3: Updated DAWG tests. Examples * tests/sparql/sort/query-sort-6.rq, tests/sparql/sort/query-sort-5.rq, tests/sparql/sort/query-sort-4.rq, tests/sparql/sort/query-sort-3.rq, tests/sparql/sort/query-sort-2.rq: Updated DAWG tests. using ASC() and DESC() * tests/sparql/sort/manifest.ttl: Updated DAWG tests. rdfs:comment * tests/sparql/SyntaxFull/Makefile.am: 10 failures * tests/sparql/SyntaxFull/Makefile.am: note latest failures * tests/sparql/SyntaxFull/Makefile.am: Added new tests * tests/sparql/SyntaxFull/manifest.ttl: Updated DAWG tests. Added tests syntax-bnodes-0[567] syntax-limit-offset-0[789] and syntax-order[06] * tests/sparql/SyntaxFull/syntax-limit-offset-07.rq, tests/sparql/SyntaxFull/syntax-limit-offset-08.rq, tests/sparql/SyntaxFull/syntax-limit-offset-09.rq: Updated DAWG tests. Tests for limit and offset * tests/sparql/SyntaxFull/syntax-bnodes-03.rq, tests/sparql/SyntaxFull/syntax-bnodes-04.rq, tests/sparql/SyntaxFull/syntax-bnodes-05.rq, tests/sparql/SyntaxFull/syntax-bnodes-06.rq, tests/sparql/SyntaxFull/syntax-bnodes-07.rq: Updated DAWG tests. More bnodes forms * tests/sparql/SyntaxFull/syntax-order-02.rq, tests/sparql/SyntaxFull/syntax-order-03.rq, tests/sparql/SyntaxFull/syntax-order-04.rq, tests/sparql/SyntaxFull/syntax-order-05.rq, tests/sparql/SyntaxFull/syntax-order-06.rq: Updated DAWG tests. ASC/DESC using () not []s * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-RDFterm-equal now passes * sparql_parser.y (OrderCondition): Accept ASC() and DESC() deprecating ASC[] and DESC[] * sparql_lexer.l: ASC and DESC are just the tokens, no [ 2005-05-31 Dave Beckett * roqet.c (roqet_graph_pattern_walk): Print graph pattern operator * sparql_parser.y: Updates for graph pattern operators, not flags. (GraphPattern): Set group graph pattern operator. (PatternElementsList): Start off with an unknown grpah pattern operator, to catch missing cases. (PatternElement): Set basic graph pattern operator. (OptionalGraphPattern): Set optional graph pattern operator. (GraphGraphPattern): Set graph graph pattern operator. (UnionGraphPattern): Set union graph pattern operator. * rdql_parser.y (rasqal_rdql_query_engine_prepare): Make a root basic graph pattern. * rasqal_engine.c (rasqal_engine_get_next_result): Print the graph pattern operator and update to check for optional step by operator. (rasqal_engine_make_basic_graph_pattern): Fold in a set of sub-graph patterns that are all basic graph patterns. * rasqal_graph_pattern.c (rasqal_new_graph_pattern_from_sequence, rasqal_graph_pattern_add_triples): Final argument is now a graph pattern operator. (rasqal_graph_pattern_order): Sort optionals by operator. (rasqal_graph_pattern_init): Check for graph pattern operator. (rasqal_graph_pattern_get_operator, rasqal_graph_pattern_operator_as_string): Added. (rasqal_graph_pattern_print): Print the graph pattern operator. * rasqal_query.c (rasqal_graph_pattern_get_flags): Deprecated, always returns 0. * rasqal_internal.h: Added operator field to rasqal_graph_pattern. Change final argument of rasqal_new_graph_pattern_from_sequence and rasqal_graph_pattern_add_triples to operator. * rasqal.h: Added rasqal_graph_pattern_operator Deprecated rasqal_graph_pattern_get_flags Added prototypes for rasqal_graph_pattern_get_operator and rasqal_graph_pattern_operator_as_string * sparql_parser.y: Update grammar doc references to use SPARQL Query Language for RDF, 19 April 2005 http://www.w3.org/TR/2005/WD-rdf-sparql-query-20050419/ 2005-05-24 Dave Beckett * roqet.c: Removed deprecated flags -f and -o * rasqal_expr.c (rasqal_triple_set_flags, rasqal_triple_get_flags): Removed deprecated functions. * rasqal_engine.c (rasqal_new_triples_match): Removed rasqal_triples_source deprecated factory method new_triples_match. * rasqal_query.c: (rasqal_new_query, rasqal_free_query, rasqal_query_add_data_graph): Removed rasqal_query deprecated list sources. (rasqal_query_add_source, rasqal_query_get_source_sequence, rasqal_query_get_source, rasqal_query_add_constraint, rasqal_query_get_constraint_sequence, rasqal_query_get_constraint): Removed deprecated functions. * rasqal_internal.h: Removed rasqal_query deprecated list sources. * rasqal.h: Removed deprecated functions: rasqal_query_add_source, rasqal_query_get_source_sequence, rasqal_query_get_source, rasqal_query_add_constraint, rasqal_query_get_constraint_sequence, rasqal_query_get_constraint, rasqal_triple_set_flags and rasqal_triple_get_flags. Removed rasqal_triples_source deprecated factory method new_triples_match * rasqal_engine.c (rasqal_set_triples_source_factory): Does not need RASQAL_API in the C * rasqal_engine.c (rasqal_reset_triple_meta): Removed code that will never be called, freeing triples_match field for the second time * rasqal_engine.c (rasqal_engine_expand_wildcards): Added, containing code from rasqal_engine_assign_variables to handle wildcard *. Handle remaining query verbs. (rasqal_engine_assign_variables): Moved wildcard handling code above. (rasqal_engine_prepare): Call rasqal_engine_expand_wildcards. 2005-05-19 Dave Beckett * win32_rasqal_config.h, configure.ac: Bumped version to 0.9.10 * Snapshotted rasqal_0_9_9 for 0.9.9 release * rasqal_engine.c (rasqal_new_triples_match): Restore but deprecate rasqal_triples_source factory method new_triples_match for now. * rasqal.h: Restore rasqal_triples_source factory method new_triples_match for now. * win32/README.txt, win32/Makefile.am, win32/rasqal.vcproj: Import configuration from John Barstow * rasqal.h: RASQAL_API before public statics * win32_rasqal_config.h: Added #define YY_NO_UNISTD_H 2005-05-18 Dave Beckett * sparql_parser.y: Add print handler to all sequences, not conditional on debugging. * configure.ac: default memory-signing no * rasqal_general.c: (rasqal_free_memory, rasqal_alloc_memory, rasqal_calloc_memory): Added, for allocating and freeingmemory inside rasqal. * rasqal.h: Added prototypes for rasqal_free_memory, rasqal_alloc_memory and rasqal_calloc_memory * librasqal.3: Updates for 0.9.9 * rasqal_query.c: thethe * configure.ac, roqet.c: Bugs to http://bugs.librdf.org/ * sparql_lexer.l (NCCHAR): Add _ which the comment says but wasn't actually done. (NCCHARV): Adjust comment to match regex 2005-05-17 Dave Beckett * rasqal_redland.c (rasqal_redland_init_triples_match): Renamed from rasqal_redland_new_triples_match. Takes an existing rasqal_triples_match structure and returns non-0 on failure. * rasqal_raptor.c (rasqal_raptor_init_triples_match): Renamed from rasqal_raptor_new_triples_match. Takes an existing rasqal_triples_match structure and returns non-0 on failure. * rasqal_engine.c (rasqal_new_triples_match): Call init_triples_match factory method with an already alloced rasqal_triples_match structure. Free it here on error. * rasqal.h: rasqal_triples_source factory method new_triples_match changed to init_triples_match, taking an initialised rtm field, returning a status. * rasqal_literal.c, rasqal_general.c, rasqal_expr.c, rasqal_engine.c, rasqal.h: Casts for RASQAL_FREE. * rdql_lexer.l, sparql_lexer.l: Use RASQAL_MALLOC/CALLOC/FREE * configure.ac: Added --with-memory-signing rasqal signing memory debugging * rasqal_general.c (rasqal_sign_malloc, rasqal_sign_calloc, rasqal_sign_realloc, rasqal_sign_free): Added rasqal signing memory debugging trigged by RASQAL_MEMORY_SIGN. * rasqal_internal.h: Added rasqal signing memory debugging trigged by RASQAL_MEMORY_SIGN * rasqal_query_test.c (main): Use RASQAL_MALLOC/FREE 2005-05-14 Dave Beckett * sparql_parser.y (TriplesList): Do not lose triples sequence after sequence join. * rasqal_expr.c: docs 2005-05-13 Dave Beckett * sparql_parser.y, roqet.c, rasqal_query.c, rasqal_expr.c: Casts for C++ * sparql_parser.y (DefaultGraphClause, NamedGraphClause): Free URI literal * sparql_parser.y: ItemList is now a raptor_sequence of rasqal_formula. (ItemList): Update to do that, copy over any underlying triples (Collection): Walk the list of formula to create the RDF collection triples. 2005-05-12 Dave Beckett * tests/sparql/survey/Makefile.am: survey-11 works * rasqal_engine.c (rasqal_engine_assign_variables): adjust anon variables offsets to point to absolute index in full list of variables (rasqal_query field variables) * sparql_parser.y (Triples): When predicate list is empty, return subject formula. * sparql_parser.y (Triples): Protect when list is empty * sparql_parser.y (Triples): Copy along any triples from subject formula. * rasqal_query.c, rasqal_engine.c (rasqal_query_prepare, rasqal_engine_execute_init): Move rasqal_engine_make_basic_graph_pattern call to rasqal_query_prepare after factory has prepared (parsed) * roqet.c: Really make sparql the default * roqet.c (roqet_graph_pattern_walk): space * roqet.c (roqet_graph_pattern_walk): Add {}s around constraints * roqet.c (roqet_query_walk): Print bound variables. * roqet.1: Updates for 0.9.9 Do not mention deprecated -f/--format and -o/--output. Merge -f and -o into in -r/--results and complete the list. Added V1 and V2 of sparql query results xml format. For -i, note sparql is default query language. * rasqal_general.c (rasqal_init): sparql is now the default query language. * roqet.c: Deprecated -f/--format and -o/--output both now in -r/--results. Add V1 and V2 xml results formats. Deleted invalid argument help for -r, see usage instead. * roqet.c (roqet_write_indent): Added. (roqet_graph_pattern_walk): Add lots of {...}s around blocks. use #number for gps, triples. Change to use roqet_write_indent. (roqet_query_walk): Take indent arg, use it with roqet_write_indent. Walk constructed triples. * rasqal_query.c (rasqal_query_get_construct_triples_sequence, rasqal_query_get_construct_triple): Added, to get access to construct triples via API. (rasqal_query_verb_as_string): Added to get a string for a verb. (rasqal_query_print): Use the above. * rasqal.h: Added prototypes for rasqal_query_get_construct_triples_sequence and rasqal_query_get_construct_triple * roqet.c: Make -c/--count work properly. Print count to stdout. Tidy result format wording. * rasqal_query.c (rasqal_query_results_get_count): Adjust the returned count by any offset. (rasqal_query_results_next): Implement limit and offset. Addresses Issue#0000005 - http://bugs.librdf.org/mantis/view.php?id=5 * rasqal_query.c (rasqal_query_results_next): Adjust result_count here. * rasqal_engine.c (rasqal_engine_get_next_result): Move result_count to rasqal_query_results_next. 2005-05-08 Dave Beckett * rasqal_query.c (rasqal_query_results_write_xml_20041221): Check only variable bindings are asked for. (rasqal_query_results_write_xml_result2): Check only variable bindings or boolean are asked for. Add boolean results format. * rasqal_query.c (rasqal_query_results_write_xml_result2): Write with name attribute. * rasqal_query.c (rasqal_query_results_write_xml_result2): Write out bnode strings right. * roqet.c: Default to unpublished version2 of the XML results format. * rasqal_query.c (rasqal_query_results_write_xml_20041221): Added, renamed from rasqal_query_results_write contents to emit the 2004-12-21 XML format (rasqal_query_results_write_xml_result2): Added, to emit the unpublished version2 of the XML format. (rasqal_query_results_write): Call above functions depending on the format_uri. 2005-05-06 Dave Beckett * librasqal.3: Updated for 0.9.9 * rasqal_query.c: typo 2005-05-05 Dave Beckett * rasqal_query.c (rasqal_query_get_wildcard): Added * rasqal.h: Added prototype for rasqal_query_get_wildcard * rasqal.h: Added prototypes for rasqal_query_get_order_conditions_sequence rasqal_query_get_order_condition * rasqal_query.c: (rasqal_query_get_order_conditions_sequence, rasqal_query_get_order_condition): Added to return query order conditions. 2005-05-04 Dave Beckett * sparql_lexer.l (VARNAME): Use NCCHARV to allow vars to start with _, [0-9] too. * tests/sparql/SyntaxFull/.cvsignore: ignore autostuff 2005-05-03 Dave Beckett * configure.ac: Added tests/sparql/sort dir * tests/sparql/Makefile.am: Added sort dir * tests/sparql/sort/result-sort-3.rdf, tests/sparql/sort/result-sort-4.rdf, tests/sparql/sort/result-sort-5.rdf, tests/sparql/sort/result-sort-6.rdf, tests/sparql/sort/result-sort-7.rdf, tests/sparql/sort/result-sort-8.rdf, tests/sparql/sort/query-sort-5.rq, tests/sparql/sort/query-sort-6.rq, tests/sparql/sort/result-sort-1.rdf, tests/sparql/sort/result-sort-2.rdf, tests/sparql/sort/query-sort-3.rq, tests/sparql/sort/query-sort-4.rq, tests/sparql/sort/manifest.ttl, tests/sparql/sort/query-sort-1.rq, tests/sparql/sort/query-sort-2.rq, tests/sparql/sort/data-sort-1.ttl, tests/sparql/sort/data-sort-3.ttl, tests/sparql/sort/data-sort-4.ttl, tests/sparql/sort/data-sort-6.ttl, tests/sparql/sort/data-sort-7.ttl, tests/sparql/sort/data-sort-8.ttl, tests/sparql/sort/.cvsignore, tests/sparql/sort/Makefile.am: added dawg sort tests 2005-05-02 Dave Beckett * tests/sparql/survey/Makefile.am: More diagnosis of failures * rasqal_engine.c (rasqal_engine_assign_variables): Add anonymous variables to the variables/variables_declared_in arrays. (rasqal_query_graph_pattern_build_declared_in_variable): Added helper. (rasqal_query_graph_pattern_build_declared_in): Use above (rasqal_engine_do_optional_step): Check any outermost constraint expression if there is a match. (rasqal_engine_make_basic_graph_pattern): Use rasqal_graph_pattern_add_constraint when moving constraints. Rebuild constraints expression after moving constraints. * tests/sparql/survey/Makefile.am: 5 failures now * roqet.c (roqet_query_walk): Start from top graph pattern, not contents of it. * rasqal_query.c (rasqal_query_get_query_graph_pattern): Added to get the top graph pattern. * rasqal.h: Added prototype for rasqal_query_get_query_graph_pattern * rasqal_engine.c (rasqal_engine_assign_variables): Use the wildcard flag for SELECT * and CONSTRUCT * * rasqal_query.c: Added rasqal_query_verb_labels for debug printing. (rasqal_query_print): Print out the query verb. (rasqal_query_results_is_bindings, rasqal_query_results_is_boolean, rasqal_query_results_is_graph): Use the query verb to decide this. (rasqal_query_get_verb): Added. * sparql_parser.y (Report): Set the query verb to SELECT, CONSTRUCT, DESCRIBE or ASK. Do not use select_is_describe or ask. (SelectClause): Set wildcard flag with SELECT (DISTINCT) * (ConstructClause): Set the wildcard flag with CONSTRUCT * * rdql_parser.y (Query): Set query verb to SELECT. (SelectClause): Set wildcard flag with SELECT * * rasqal_internal.h: rasqal_query gains a verb and wildcard fields replacing select_all, select_is_describe, construct_all and ask * rasqal.h: Added rasqal_query_verb enum. Added prototype for rasqal_query_get_verb * sparql_parser.y (OptionalGraphPattern): Do not set optional flags on triples. * rasqal_graph_pattern.c (rasqal_graph_pattern_init): Record triple_meta is_exact field. * rasqal_expr.c: Removed rasqal_triple_flag_strings (rasqal_triple_print): Removed printing flags. (rasqal_triple_set_flags, rasqal_triple_get_flags): Note deprecated. * rasqal_engine.c (rasqal_graph_pattern_get_next_match): Use triple_meta file is_exact instead of rasqal_triple flag field (rasqal_engine_prepare): No longer init triple flags. * rasqal.h: Deprecated rasqal_triple flags field. - the value EXACT was only used in the execution engine and properly lives in rasqal_triple_meta. The value OPTIONAL was never used. Added is_exact file to rasqal_triple_meta. Deprecated rasqal_triple_set_flags and rasqal_triple_get_flags. * rasqal_engine.c (rasqal_engine_execute_init): Transform the query graph pattern for execution purposes - make basic graph patterns and make sure the top is always a sequence of graph patterns, for now. * sparql_parser.y (rasqal_sparql_query_engine_prepare): Remove the building of basic graph patterns from here. Just build the simplest graph pattern and let the execution engine change it if it needs to. * rdql_parser.y (rasqal_rdql_query_engine_prepare): Just build the simplest graph pattern here, let the executionengine change it if it needs to. 2005-05-01 Dave Beckett * tests/sparql/SyntaxFull/Makefile.am: Updated for tests updates, removals for required top level graph pattern. * tests/sparql/SyntaxFull/syntax-bnodes-06.rq, tests/sparql/SyntaxFull/syntax-bnodes-07.rq, tests/sparql/SyntaxFull/syntax-bnodes-08.rq, tests/sparql/SyntaxFull/syntax-bnodes-09.rq: Removed renamed syntax-bnodes tests * tests/sparql/SyntaxFull/syntax-query-pat-03.rq, tests/sparql/SyntaxFull/syntax-query-pat-04.rq, tests/sparql/SyntaxFull/syntax-query-pat-05.rq, tests/sparql/SyntaxFull/syntax-query-pat-01.rq, tests/sparql/SyntaxFull/syntax-query-pat-02.rq: Removed WHERE no {} tests 2005-04-27 Dave Beckett * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-str works with right data * tests/sparql/examples/Makefile.am: sparql-query-example-Testing-Values-str fails * sparql_parser.y (CallExpression): use nflags for pattern expression flags * tests/sparql/SyntaxFull/Makefile.am: fix dup terms * tests/sparql/SyntaxFull/Makefile.am: Added empty.nt * tests/sparql/SyntaxFull/empty.nt: empty.nt * tests/sparql/SyntaxFull/syntax-bnodes-04.rq, tests/sparql/SyntaxFull/syntax-bnodes-03.rq, tests/sparql/SyntaxFull/syntax-bnodes-02.rq, tests/sparql/SyntaxFull/syntax-bnodes-01.rq, tests/sparql/SyntaxFull/manifest.ttl, tests/sparql/SyntaxFull/Makefile.am: Added syntax-bnodes-01,02,03 and 04 * tests/sparql/check-sparql: Handle no result in manifest * rasqal_engine.c (rasqal_engine_convert_blank_node_to_anonymous_variable): Helper added. (rasqal_engine_build_anonymous_variables): Added to turn bnodes inside graph pattern triples into variables. ISSUE: should not do this with construct triples * rasqal_query.c (rasqal_new_query, rasqal_free_query): init/free anon_variables_sequence (rasqal_query_print): Print anonymous variables * rasqal_expr.c (rasqal_new_variable_typed): Added with type parameter. (rasqal_new_variable): Changed to use it. (rasqal_variable_print): Print variable type. * rasqal_internal.h: Added anon_variables_sequence and anon_variables_count * rasqal.h: typo * rasqal.h: Added rasqal_variable_type enum. rasqal_variable gained field 'type' Added prototypes for rasqal_query_set_distinct, rasqal_query_set_limit, rasqal_query_set_offset and rasqal_new_variable_typed * rasqal_query.c (rasqal_query_set_distinct, rasqal_query_set_limit, rasqal_query_set_offset): Added. * sparql_parser.y, sparql_lexer.l: Removed unused tokens PATTERN_LITERAL and '&'. * tests/sparql/survey/Makefile.am: fix failure count * tests/sparql/syntax/cast1.rq: no == operator * tests/sparql/survey/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/bound/Makefile.am: Remove check-sparql-works targets - check-sparql-correct does it better and using manifest * tests/sparql/examples/ex11.2.3.5_0-result.n3, tests/sparql/examples/ex11.2.3.5_0.n3, tests/sparql/examples/ex11.2.3.6_0-result.n3: Fix what I think are test query/data bugs * tests/sparql/examples/Makefile.am: Added ex11_1.rq ex11_1-result.n3 Note which query files have the failing query. * tests/sparql/examples/ex11_1-result.n3, tests/sparql/examples/ex11_1.rq: example ex11_1 * tests/sparql/examples/manifest.n3, tests/sparql/examples/ex11.2.3.6_0-result.n3, tests/sparql/examples/ex11_0-result.n3: Sync tests to dawg 2005-04-26 Dave Beckett * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql (toDebug): Handle no value. * tests/sparql/survey/Makefile.am: Added expected failures * sparql_lexer.l: Remove == token * sparql_lexer.l: Align name tokens with rq23 post WD 2005-04-19 CVS 1.326 * tests/sparql/bound/bound1.rq: new turtley syntax * tests/sparql/examples/Makefile.am: Annotate failures. * sparql_parser.y: less super-debuggy * sparql_parser.y: (CallExpression) Copy the string from rasqal_literal_as_string when making pattern literals or flags. Free the unused literal args. * rasqal_expr.c: (rasqal_expression_evaluate) For the RASQAL_EXPR_STR operation, copy the string from rasqal_literal_as_string. * sparql_parser.y (rasqal_sparql_query_engine_prepare): Restore hack to build an outer list of GPs if the folding made it all into one. * sparql_parser.y (rasqal_sparql_query_engine_prepare): Just call rasqal_engine_make_basic_graph_pattern on the query graph pattern. * rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): More debug messages. Always merge a GP with a GP of size 1 inside. Ignore any inner OPTIONAL GPs Merge sequences of triples if seen. * tests/sparql/SyntaxFull/Makefile.am: syntax-struct-01.rq no longer crashes * sparql_parser.y (OptionalGraphPattern): Don't die if no GraphPattern. * sparql_parser.y: Debug messages * rasqal_graph_pattern.c (rasqal_graph_pattern_print): Print graph pattern/triple sequence sizes. * rasqal_query.c (rasqal_new_query): Set initial offset to unset (<0) * rasqal_engine.c (rasqal_query_build_declared_in): warning wording * rasqal_engine.c (rasqal_query_build_declared_in): No \n in warning. * sparql_parser.y (UnionGraphPatternList): Added. (UnionGraphPattern): Make a graph pattern with the contained union graphs. Renamed from OptionalGraphPatternList. * tests/sparql/SyntaxFull/Makefile.am: Fixed syntax-union-02.rq * sparql_parser.y (OptionalGraphPatternList): Require UNION between GPs * tests/sparql/SyntaxFull/Makefile.am: Typo * rasqal_expr.c (rasqal_expression_evaluate): Warn and then return false for function expressions - not implemented. * sparql_parser.y: Removed string operators STR_EQ STR_NE STR_MATCH STR_NMATCH (OptionalGraphPatternList): List cannnot be empty Lots of renaming of grammar terms to match rq23 / WD 19 April 2005 (RelationalExpression): Renamed from ValueLogical and merged with former RelationalExpression. (CallExpression): Renamed from BuiltinExpression and reordered to match rq23 * sparql_lexer.l: Removed regex pattern literals, PATTERN state, sparql_copy_regex_token, EQ/eq, NE/NE, =~, ~~, !~ * sparql_parser.y (OptionalGraphPatternList): Added, to allow GraphPattern UNION GraphPattern* * rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): Verbose debugging if RASQAL_DEBUG > 1 2005-04-25 Dave Beckett * tests/sparql/SyntaxFull/Makefile.am: Note failures so far * sparql_parser.y (BuiltinExpression): Move URIBrace work into FunctionCall (FunctionCall): Pick cast or function, I choose function * sparql_lexer.l: Widen QUOTEDURI and include <> * sparql_parser.y (WhereClauseOpt): Warn WHERE omitted. (BuiltinExpression): Call FunctionCall (PrimaryExpression): Add '(' Expression ')' (FunctionCall): Add URI name. (ArgList): Now a list of expressions * sparql_parser.y (OrderClauseOpt): Use OrderConditionList and store it in query field order_conditions_seequence. (OrderConditionList): Added, making a raptor_sequence of expressions (OrderCondition): Implemented ASC/DESC/none (OrderExpression): Added, using FunctionCall or Var (ItemList): Init $$->triples and set formula. (PrimaryExpression): Use FunctionCall (FunctionCall): Restored, now it's used twice. * rasqal.h: Added RASQAL_EXPR_ORDER_COND_ASC, RASQAL_EXPR_ORDER_COND_DESC and RASQAL_EXPR_ORDER_COND_NONE * rasqal_internal.h: Added order_conditions_sequence to query * rasqal_query.c (rasqal_query_print): Print order conditions. * rasqal_query.c (rasqal_new_query,rasqal_free_query): Init and free order_conditions_sequence * rasqal_expr.c (rasqal_free_expression, rasqal_expression_foreach, rasqal_expression_evaluate, rasqal_expression_print): Added cases for RASQAL_EXPR_ORDER_COND_ASC, RASQAL_EXPR_ORDER_COND_DESC and RASQAL_EXPR_ORDER_COND_NONE * sparql_lexer.l: ASC, DESC take following [ too (sparql_token_print): Added ASC, DESC * sparql_parser.y, sparql_lexer.l: Added ASC, DESC * sparql_lexer.l (PREFIX, NAME): Allow . after first char * sparql_lexer.l: Added '''strings''' (not in Turtle) * sparql_lexer.l: Added """string""" literals * tests/sparql/SyntaxFull/syntax-union-01.rq, tests/sparql/SyntaxFull/syntax-union-02.rq, tests/sparql/SyntaxFull/syntax-struct-09.rq, tests/sparql/SyntaxFull/syntax-struct-10.rq, tests/sparql/SyntaxFull/syntax-struct-07.rq, tests/sparql/SyntaxFull/syntax-struct-08.rq, tests/sparql/SyntaxFull/syntax-struct-06.rq, tests/sparql/SyntaxFull/syntax-struct-03.rq, tests/sparql/SyntaxFull/syntax-struct-04.rq, tests/sparql/SyntaxFull/syntax-struct-05.rq, tests/sparql/SyntaxFull/syntax-query-pat-04.rq, tests/sparql/SyntaxFull/syntax-query-pat-05.rq, tests/sparql/SyntaxFull/syntax-struct-01.rq, tests/sparql/SyntaxFull/syntax-struct-02.rq, tests/sparql/SyntaxFull/syntax-qname-14.rq, tests/sparql/SyntaxFull/syntax-query-pat-01.rq, tests/sparql/SyntaxFull/syntax-query-pat-02.rq, tests/sparql/SyntaxFull/syntax-query-pat-03.rq, tests/sparql/SyntaxFull/syntax-qname-12.rq, tests/sparql/SyntaxFull/syntax-qname-13.rq, tests/sparql/SyntaxFull/syntax-qname-11.rq, tests/sparql/SyntaxFull/syntax-qname-09.rq, tests/sparql/SyntaxFull/syntax-qname-10.rq, tests/sparql/SyntaxFull/syntax-qname-07.rq, tests/sparql/SyntaxFull/syntax-qname-08.rq, tests/sparql/SyntaxFull/syntax-pat-04.rq, tests/sparql/SyntaxFull/syntax-pat-03.rq, tests/sparql/SyntaxFull/syntax-pat-01.rq, tests/sparql/SyntaxFull/syntax-pat-02.rq, tests/sparql/SyntaxFull/syntax-order-04.rq, tests/sparql/SyntaxFull/syntax-order-05.rq, tests/sparql/SyntaxFull/syntax-order-01.rq, tests/sparql/SyntaxFull/syntax-order-02.rq, tests/sparql/SyntaxFull/syntax-order-03.rq, tests/sparql/SyntaxFull/syntax-lit-14.rq, tests/sparql/SyntaxFull/syntax-lit-13.rq, tests/sparql/SyntaxFull/syntax-lit-12.rq, tests/sparql/SyntaxFull/syntax-lit-11.rq, tests/sparql/SyntaxFull/syntax-lit-10.rq, tests/sparql/SyntaxFull/syntax-lit-09.rq, tests/sparql/SyntaxFull/syntax-lit-07.rq, tests/sparql/SyntaxFull/syntax-lit-08.rq, tests/sparql/SyntaxFull/syntax-lit-06.rq, tests/sparql/SyntaxFull/syntax-lit-05.rq, tests/sparql/SyntaxFull/syntax-lit-04.rq, tests/sparql/SyntaxFull/syntax-lit-02.rq, tests/sparql/SyntaxFull/syntax-lit-03.rq, tests/sparql/SyntaxFull/syntax-lists-03.rq, tests/sparql/SyntaxFull/syntax-lists-04.rq, tests/sparql/SyntaxFull/syntax-lists-05.rq, tests/sparql/SyntaxFull/syntax-lit-01.rq, tests/sparql/SyntaxFull/syntax-lists-01.rq, tests/sparql/SyntaxFull/syntax-lists-02.rq, tests/sparql/SyntaxFull/syntax-forms-01.rq, tests/sparql/SyntaxFull/syntax-forms-02.rq, tests/sparql/SyntaxFull/syntax-forms-03.arq, tests/sparql/SyntaxFull/syntax-expr-04.rq, tests/sparql/SyntaxFull/syntax-expr-05.rq, tests/sparql/SyntaxFull/syntax-expr-06.rq, tests/sparql/SyntaxFull/syntax-expr-01.rq, tests/sparql/SyntaxFull/syntax-expr-02.rq, tests/sparql/SyntaxFull/syntax-expr-03.rq, tests/sparql/SyntaxFull/syntax-bnodes-07.rq, tests/sparql/SyntaxFull/syntax-bnodes-08.rq, tests/sparql/SyntaxFull/syntax-bnodes-09.rq, tests/sparql/SyntaxFull/syntax-basic-05.rq, tests/sparql/SyntaxFull/syntax-basic-06.rq, tests/sparql/SyntaxFull/syntax-bnodes-06.rq, tests/sparql/SyntaxFull/syntax-basic-01.rq, tests/sparql/SyntaxFull/syntax-basic-02.rq, tests/sparql/SyntaxFull/syntax-basic-03.rq, tests/sparql/SyntaxFull/syntax-basic-04.rq, tests/sparql/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/SyntaxFull/manifest.ttl, configure.ac: Added SyntaxFull tests from dawg 2005-04-20 Dave Beckett * tests/sparql/survey/Makefile.am: data is survey-sample.ttl 2005-04-19 Dave Beckett * rasqal_expr.c (rasqal_expression_evaluate): Handle unbound variable values in RASQAL_EXPR_DATATYPE, RASQAL_EXPR_ISURI, RASQAL_EXPR_ISBLANK, RASQAL_EXPR_ISLITERAL * sparql_lexer.l: Make keyword tokens case independent not just upper or lowercase. * tests/sparql/examples/Makefile.am: Update for new example files * sparql_parser.y: No conflicts * tests/sparql/examples/ex11.2.3.1_0.n3, tests/sparql/examples/ex11.2.3.1_0.rq, tests/sparql/examples/ex11.2.3.1_1.n3, tests/sparql/examples/ex11.2.3.1_1.rq, tests/sparql/examples/ex11.2.3.2_0.n3, tests/sparql/examples/ex11.2.3.2_0.rq, tests/sparql/examples/ex11.2.3.2_1.rq, tests/sparql/examples/ex11.2.3.3_0.n3, tests/sparql/examples/ex11.2.3.3_0.rq, tests/sparql/examples/ex11.2.3.4_0.n3, tests/sparql/examples/ex11.2.3.4_0.rq, tests/sparql/examples/ex11.2.3.5_0.n3, tests/sparql/examples/ex11.2.3.5_0.rq, tests/sparql/examples/ex11.2.3.6_0.n3, tests/sparql/examples/ex11.2.3.6_0.rq, tests/sparql/examples/ex11.2.3.7_0.n3, tests/sparql/examples/ex11.2.3.7_0.rq, tests/sparql/examples/ex11.2.3.8_0.n3, tests/sparql/examples/ex11.2.3.8_0.rq, tests/sparql/examples/ex11_0.n3, tests/sparql/examples/ex11_0.rq, tests/sparql/examples/ex3.rq, tests/sparql/examples/ex11.2.3.1_0-result.n3, tests/sparql/examples/ex11.2.3.1_1-result.n3, tests/sparql/examples/ex11.2.3.2_0-result.n3, tests/sparql/examples/ex11.2.3.2_1-result.n3, tests/sparql/examples/ex11.2.3.3_0-result.n3, tests/sparql/examples/ex11.2.3.4_0-result.n3, tests/sparql/examples/ex11.2.3.5_0-result.n3, tests/sparql/examples/ex11.2.3.6_0-result.n3, tests/sparql/examples/ex11.2.3.7_0-result.n3, tests/sparql/examples/ex11.2.3.8_0-result.n3, tests/sparql/examples/ex11_0-result.n3, tests/sparql/examples/manifest.n3: Imported updated examples * tests/sparql/check-sparql: remove debug print * sparql_parser.y: Make construct work again. Now %type : TriplesList ConstructTemplate (ConstructClause): Take triples from seq ConstructTemplate (ConstructTemplate): Use TriplesList (TriplesList): Added, making a raptor_sequence of triples from triples in Triples formulas. * rasqal_graph_pattern.c (rasqal_new_graph_pattern): Init columns to defaults here. * rasqal_engine.c (rasqal_engine_make_basic_graph_pattern): Added. * rasqal_internal.h: Added rasqal_engine_make_basic_graph_pattern prototype. * sparql_parser.y (rasqal_sparql_query_engine_prepare): Call rasqal_engine_make_basic_graph_pattern on the top level subgraph patterns. * tests/sparql/syntax/Makefile.am: Print failure summaries * tests/sparql/syntax/offset0.rq, tests/sparql/syntax/cast1.rq, tests/sparql/syntax/cast0.rq: updates for turtle sparql syntax * tests/sparql/check-sparql: Read manfiest.ttl or manifest.n3 * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Emit failing roqet line when roqet returns errors. * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Emit failing roqet line on FAILURE 2005-04-17 Dave Beckett * sparql_parser.y: Updates to SPARQL rq23 around $Revision: 1.303 $ of $Date: 2005/04/16 17:13:51 $ Removed AND, WITH. Added NAMED. Removed many %type that were used with NULL value or none. (DatasetClauseOpt, DefaultGraphClause): Added after rq23 (NamedGraphClauseList): Added (PatternElementsList): Renamed from PatternElementList and now in rq23, returns a graph pattern. FILTER handled here, not in older PatternElementConstraint. (PatternElementConstraint): Deleted. (ItemList): Moved adjacent to Collection which it serves. (URIList): Deleted, no longer used. * rasqal_engine.c (rasqal_engine_build_constraints_expression): Handle no graph pattern. (rasqal_engine_execute_init): Handle no graph pattern. * tests/sparql/syntax/groups.rq, tests/sparql/syntax/describe1.rq, tests/sparql/syntax/construct1.rq, tests/sparql/syntax/limit0.rq, tests/sparql/syntax/distinct0.rq, tests/sparql/syntax/construct2.rq, tests/sparql/syntax/construct0.rq, tests/sparql/syntax/ask0.rq: Update to turtle query syntax * rasqal_graph_pattern.c (rasqal_new_graph_pattern_from_sequence): Do not flatten gps. * tests/sparql/part1/dawg-query-003, tests/sparql/part1/dawg-query-003.rq, tests/sparql/part1/dawg-query-004, tests/sparql/part1/dawg-query-004.rq, tests/sparql/part1/manifest.n3, tests/sparql/part1/Makefile.am, tests/sparql/part1/dawg-query-001, tests/sparql/part1/dawg-query-001.rq, tests/sparql/part1/dawg-query-002, tests/sparql/part1/dawg-query-002.rq: Updated to turtle query syntax and renamed dawg-query-001.rq dawg-query-002.rq dawg-query-003.rq dawg-query-004.rq * tests/sparql/examples/ex2-1a.rq, tests/sparql/examples/ex2-1b.rq, tests/sparql/examples/ex2-1c.rq, tests/sparql/examples/ex2-1e.rq, tests/sparql/examples/ex2-2a.rq, tests/sparql/examples/ex2-3a.rq, tests/sparql/examples/ex2-4a.rq, tests/sparql/examples/manifest.n3: update to turtle syntax queries, latest naming * tests/sparql/simple/data-03.n3, tests/sparql/simple/dawg-tp-05.rq: import from dawg * tests/sparql/simple/dawg-tp-01.rq, tests/sparql/simple/dawg-tp-02.rq, tests/sparql/simple/dawg-tp-03.rq, tests/sparql/simple/dawg-tp-04.rq, tests/sparql/simple/manifest.n3: update to turtle syntax queries * rdql_parser.y (rasqal_rdql_query_engine_prepare): Init query graph pattern. * rasqal_query.c (rasqal_new_query): Start with a NULL query graph pattern. * sparql_lexer.l: -AND * sparql_lexer.l: -WITH, +NAMED * tests/sparql/survey/manifest.ttl: Added manifest.ttl * tests/sparql/survey/query-survey-8.rq, tests/sparql/survey/query-survey-9.rq, tests/sparql/survey/result-survey-10.ttl, tests/sparql/survey/result-survey-3.ttl, tests/sparql/survey/survey-sample.ttl, tests/sparql/survey/query-survey-1.rq, tests/sparql/survey/query-survey-10.rq, tests/sparql/survey/query-survey-11.rq, tests/sparql/survey/query-survey-12.rq, tests/sparql/survey/query-survey-13.rq, tests/sparql/survey/query-survey-2.rq, tests/sparql/survey/query-survey-3.rq: Update to latest DAWG versions of test * tests/sparql/survey/Makefile.am: manifest file is manifest.ttl * autogen.sh: allow envariables to override the programs 2005-04-14 Dave Beckett * sparql_parser.y: First set of sparql turtle syntax changes Added %token: ORDER, BY, REGEX Added %type: OrderClauseOpt, PatternElementList, DotOptional, ConstructTemplate, Triples, PropertyList, ObjectList, ItemList Collection, Subject, Predicate Object, TriplesNode, GraphPattern, GraphGraphPattern, UnionGraphPattern (based on rq23) Removed %type: VarOrURIOrBNode as turtle syntax rules cover it Many terms renamed to match rq23 terms, updated to use formula. Other changes: (Query): Added OrderClauseOpt (BaseDeclOpt, PrefixDeclOpt): moved in source, no change. (WhereClauseOpt): Just assign GraphPattern value (OrderClauseOpt): Skeletal and incomplete. (GraphPattern): Take a list of .-separated triples, with optional . or an empty {} (DotOptional): Added (Triples, PropertyList, ObjectList, ItemList, Subject, Predicate, Object, Collection): imported for turtle and updated to pass around rasqal_formula and use them to store triples + literal value. (TriplesNode): Imported from rq23 partially. (BuiltinExpression): Added REGEX * sparql_lexer.l: Added tokens: ORDER, By, REGEX, ., ; for rq23 sparql Noted FIXME to remove old comparison ops EQ/eq, NE/ne, ==, != * rasqal.h: Added rasqal_generate_bnodeid_handler typedef. Added prototypes for rasqal_query_set_default_generate_bnodeid_parameters and rasqal_query_set_generate_bnodeid_handler * rasqal_graph_pattern.c: docs * rasqal_internal.h: Added bnodeid handler params to query. Added prototype for rasqal_query_set_generate_bnodeid_handler. Added extern references for rasqal_rdf_namespace_uri, rasqal_rdf_first_uri, rasqal_rdf_rest_uri and rasqal_rdf_nil_uri * rasqal_general.c: Add rdf uris for namespace, rdf:first, rdf:rest, rdf:nul (rasqal_uri_init, rasqal_uri_finish): Init and tidy up above. (rasqal_query_set_default_generate_bnodeid_parameters, rasqal_query_set_generate_bnodeid_handler, rasqal_default_generate_bnodeid_handler, rasqal_query_generate_bnodeid): Added, import from raptor. * rasqal_literal.c: Added rasqal_formula for sparql parser. (rasqal_new_formula): Added constructor (rasqal_free_formula): Added destructor (rasqal_formula_print): Added print method, for sequences of formulas * rasqal_internal.h: Added rasqal_formula for sparql parser. Added prototypes for rasqal_new_formula, rasqal_free_formula and rasqal_formula_print * tests/sparql/syntax/cast1.rq, tests/sparql/syntax/cast0.rq: AND to FILTER * tests/sparql/syntax/Makefile.am: Added offset0.rq * sparql_parser.y: Added tokens FILTER OFFSET A Now up to expecting 3 shift/reduce (filter + offset can both be missing) Added LimitClauseOpt OffsetClauseOpt types (Query): Added OffsetClause (OffsetClauseOpt): Added, not in 2005-02-17 SPARQL WD (PatternElementConstraint): Deprecate AND (removed 2005-04-19 SPARQL WD) and add FILTER. * roqet.c (roqet_query_walk): Print any result offset (main): Fix help message * tests/sparql/syntax/offset0.rq: LIMIT and OFFSET test * rasqal_engine.c (rasqal_engine_query_constraints_has_qname): Handle no query_graph_pattern present. * sparql_lexer.l: Added FILTER, OFFSET, A tokens * rasqal_query.c (rasqal_query_get_offset): Added, returning the query results offset. (rasqal_query_print): Print query results offset * rasqal.h: Added rasqal_query_get_offset prototype. * rasqal_internal.h: Added offset to query structure 2005-04-11 Dave Beckett * sparql_lexer.l: Deleted keyword LOAD * sparql_parser.y (LoadClauseOpt): Deleted, along with old keyword LOAD * sparql_parser.y: Removed deprecated [ ... ] syntax for optionals * sparql_parser.y, sparql_lexer.l: Removed deprecated SOURCE keyword * configure.ac: Added tests/sparql/survey/Makefile * tests/sparql/Makefile.am: Added survey dir * tests/sparql/survey/result-survey-12.ttl, tests/sparql/survey/result-survey-13.ttl, tests/sparql/survey/result-survey-2.ttl, tests/sparql/survey/result-survey-3.ttl, tests/sparql/survey/result-survey-8.ttl, tests/sparql/survey/result-survey-9.ttl, tests/sparql/survey/survey-sample.ttl, tests/sparql/survey/query-survey-2.rq, tests/sparql/survey/query-survey-3.rq, tests/sparql/survey/query-survey-8.rq, tests/sparql/survey/query-survey-9.rq, tests/sparql/survey/result-survey-1.ttl, tests/sparql/survey/result-survey-10.ttl, tests/sparql/survey/result-survey-11.ttl, tests/sparql/survey/.cvsignore, tests/sparql/survey/Makefile.am, tests/sparql/survey/query-survey-1.rq, tests/sparql/survey/query-survey-10.rq, tests/sparql/survey/query-survey-11.rq, tests/sparql/survey/query-survey-12.rq, tests/sparql/survey/query-survey-13.rq: dawg survey tests 2005-04-10 Dave Beckett * win32_rasqal_config.h, configure.ac: Bumped version to 0.9.9 * Snapshotted rasqal_0_9_8 for 0.9.8 release 2005-03-21 Dave Beckett * rasqal_graph_pattern.c (rasqal_graph_pattern_init): Set origin parts only if there is an origin. * rasqal_engine.c (rasqal_query_graph_pattern_build_declared_in): Set origin vars only if there is an origin. * rasqal_query.c (rasqal_graph_pattern_set_origin): Set all columns, not 1 less. * rasqal_graph_pattern.c (rasqal_graph_pattern_init): Add origin triple parts. * rasqal_engine.c (rasqal_query_graph_pattern_build_declared_in): Mark vars declared in origin. * rdql_parser.y (Query): Add background data graphs as this rdql does not allow origin queries. * sparql_parser.y (LoadClauseOpt): Add named data graphs from LOAD (GraphOrPattern, NamedGraphPattern, OptionalGraphPattern): Add FIXMEs for UNION, GRAPH *, SOURCE *, deprecated SOURCE, deprecated [] * rasqal_query.c (rasqal_query_add_data_graph, rasqal_query_add_variable, rasqal_query_add_prefix): Add data graphs, sources, variables, prefixes to the end of the sequence - more sensible and also quicker. * rasqal_graph_pattern.c (rasqal_graph_pattern_add_constraint): Add constraints to end of sequence - more sensible and also quicker. * rdql_parser.y (Query): Make data graphs here, don't edit deprecated sources list. * rasqal_raptor.c (rasqal_raptor_new_triples_source): Pass in graph names as base URIs to parsing. * rasqal_redland.c (rasqal_redland_new_triples_source): Use data graphs to gather source URIs and graph URI names. Pass in graph names as base URIs to parsing. * rasqal_raptor.c (rasqal_raptor_new_triples_source): Use data graphs to gather source URIs and graph URI names 2005-03-20 Dave Beckett * sparql_parser.y (NamedGraphClauseOpt): Set name uri when adding a data graph, to same uri as source uri * librasqal.3: style, refs, 0.9.8 API changes * rasqal.h, rasqal_query.c: (rasqal_query_get_variable_sequence, rasqal_query_add_triple): Removed. Were announced deprecated in 0.9.7 * rasqal_expr.c (main): Call rasqal_uri_init and rasqal_uri_finish around test code. * rasqal_literal.c (rasqal_new_integer_literal): Use rasqal_xsd_integer_uri. (rasqal_new_floating_literal): Use rasqal_xsd_double_uri. (rasqal_literal_string_to_native): Use rasqal_xsd_integer_uri and rasqal_xsd_double_uri. Also convert xsd:boolean rdf literals into internal RASQAL_LITERAL_BOOLEAN * rasqal_expr.c (main): Call rasqal_uri_init and rasqal_uri_finish around test code. * rasqal_literal.c (rasqal_new_integer_literal): Use rasqal_xsd_integer_uri. (rasqal_new_floating_literal): Use rasqal_xsd_double_uri. (rasqal_literal_string_to_native): Use rasqal_xsd_integer_uri and rasqal_xsd_double_uri. Also convert xsd:boolean rdf literals into internal RASQAL_LITERAL_BOOLEAN * rasqal_general.c (rasqal_init): Call rasqal_uri_init (rasqal_finish): Call rasqal_uri_finish and always call raptor_finish. (rasqal_uri_init, rasqal_uri_finish): Added to initialise/free URIs used in the library. * rasqal_internal.h: Added internal URIs rasqal_xsd_namespace_uri, rasqal_xsd_integer_uri, rasqal_xsd_double_uri and rasqal_xsd_boolean_uri. Added prototypes for rasqal_uri_init and rasqal_uri_finish to make them. * tests/sparql/syntax/cast1.rq: Type check should be xsd:integer. 2005-03-17 Dave Beckett * rasqal_engine.c (rasqal_engine_get_next_result): Finish if the query has no query graph or the query graph has no graph patterns in it. 2005-03-16 Dave Beckett * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/cast1.rq: Added cast1.rq * sparql_parser.y (PatternElementConstraint): Added, Taking the AND Expression out of PatternElement, ensuring the constraint gets added to the adjacent graph pattern rather than one with no other content. Replaced all other references to PatternElement with this term. [now have 2 shift/reduce conflicts] * rasqal_engine.c (rasqal_query_build_declared_in): Less debug noise for defined variables * tests/sparql/syntax/describe1.rq: use ?p in the query * tests/sparql/syntax/groups.rq: select ?mbox mentioned in query 2005-03-15 Dave Beckett * Makefile.am, rasqal_engine.c, rasqal_graph_pattern.c, rasqal_internal.h: Move rasqal_graph_pattern to new rasqal_graph_pattern.c 2005-03-14 Dave Beckett * rasqal_engine.c (rasqal_engine_query_constraints_has_qname): Check for query constraints in sub-graph patterns via rasqal_engine_graph_pattern_constraints_has_qname on query_graph_pattern. (rasqal_engine_graph_pattern_constraints_has_qname): Check in sub-graph patterns here. (rasqal_engine_expand_graph_pattern_constraints_qnames): Expand qnames in sub graph patterns via recursion. (rasqal_engine_expand_query_constraints_qnames): Expand via rasqal_engine_expand_graph_pattern_constraints_qnames on query_graph_pattern. (rasqal_engine_build_constraints_expression): Build constraints in sub graph patterns via recursion. (rasqal_new_graph_pattern_from_triples): Use rasqal_graph_pattern_add_triples to init. (rasqal_graph_pattern_add_triples): Added, to add triples to an existing graph pattern. (rasqal_graph_pattern_init): Init sub graph_patterns by recusion. Optional flags are now stored per graph pattern. (rasqal_query_graph_pattern_build_declared_in): Added to build the variables_declared_in fields per graph_pattern. (rasqal_query_build_declared_in): Use the above to init from the query_graph_pattern down. (rasqal_engine_prepare): Use rasqal_engine_build_constraints_expression to init query_graph_pattern constraints. (rasqal_engine_execute_init): Moved graph pattern sequence init into rasqal_graph_pattern_init. (rasqal_engine_move_to_graph_pattern): Move within an outer graph pattern not a query. (rasqal_engine_do_step, rasqal_engine_do_optional_step): Perform a step within an outer graph_pattern containing graph pattern gp. (rasqal_engine_get_next_result): Execute over contents of query's query_graph_pattern. * sparql_parser.y (WhereClauseOpt): Append to query_graph_pattern * rdql_parser.y (rasqal_rdql_query_engine_prepare): Use rasqal_graph_pattern_add_sub_graph_pattern on query_graph_pattern * rasqal_query.c (rasqal_new_query, rasqal_free_query): Remove graph_patterns and optional_graph_pattern fields. (rasqal_query_add_constraint, rasqal_query_get_constraint_sequence, rasqal_query_get_constraint): Still deprecated, but now use the query's query_graph_pattern field. (rasqal_query_get_graph_pattern_sequence, rasqal_query_get_graph_pattern): Use the graph pattern sequence inside the query's query_graph_pattern. (rasqal_graph_pattern_add_sub_graph_pattern): Added. (rasqal_query_print): Print from the query_graph_pattern. * rasqal_internal.h: Moved from structure rasqal_query to rasqal_graph_pattern fields: current_graph_pattern, max_optional_graph_pattern, optional_graph_pattern_matches_count to graph_pattern structure for execution of sub-graph patterns. Added prototype of rasqal_graph_pattern_add_triples. * rasqal.h: Added prototype for rasqal_graph_pattern_add_sub_graph_pattern 2005-03-13 Dave Beckett * rasqal_engine.c (rasqal_new_graph_pattern): Added. * rasqal_query.c (rasqal_new_query, rasqal_free_query): Init query_graph_pattern using rasqal_new_graph_pattern. * rasqal_internal.h: Added prototype for rasqal_new_graph_pattern * sparql_parser.y, rdql_parser.y: execute factory method takes rasqal_query_results* arg * rasqal_engine.c: style * rasqal_query.c (rasqal_query_execute): execute factory method takes rasqal_query_results* * rasqal_internal.h: execute method takes rasqal_query_results* * rasqal_internal.h: style 2005-03-10 Dave Beckett * sparql_parser.y (rasqal_sparql_query_engine_prepare): Move qname expansion checks from sparql_parse. * sparql_parser.y: Restore TriplePatternList as first part of PatternElement. * tests/sparql/syntax/data.n3: Add something for casting * rasqal_expr.c (rasqal_expression_evaluate): Evaluate RASQAL_EXPR_CAST. * rdql_parser.y (main): Cast for C++ * tests/sparql/syntax/Makefile.am: Added cast0.rq * tests/sparql/syntax/cast0.rq: Added cast test * sparql_lexer.l: and {QUOTEDURI} add optional ')' and return URI_LITERAL_BRACE, QNAME_LITERAL_BRACE instead of URI_LITERAL / QNAME_LITERAL. * sparql_parser.y: Added tokens URI_LITERAL_BRACE QNAME_LITERAL_BRACE for URI+'(' and QNAME+'(' (URIBrace): Added for handling the two above, replacing two alternatives in BuiltinExpression, removing a conflict. * rasqal_expr.c (rasqal_new_cast_expression): Added for type casting (rasqal_free_expression, rasqal_expression_foreach, rasqal_expression_evaluate, rasqal_expression_print): Added RASQAL_EXPR_CAST support * rasqal.h: Added RASQAL_EXPR_CAST for sparql type casting Added prototype for rasqal_new_cast_expression * sparql_lexer.l, rdql_lexer.l: Tidy to use .|\n to match any char * rdql_lexer.l, sparql_lexer.l ('-strings, and "-strings): Count passed into sparql_copy_string_token is one too small. * rasqal_query.c (rasqal_graph_pattern_set_origin): Set origin only on this graph pattern's columns/triples. * roqet.c: Indenting tidying 2005-03-09 Dave Beckett * roqet.c (roqet_graph_pattern_walk): Print constraints per-graph pattern. * rasqal_engine.c (rasqal_graph_pattern_get_constraint): use idx * sparql_lexer.l: Remove NOT * sparql_parser.y: Updates to grammar structure to match that of the 17 February 2005 WD in http://www.w3.org/TR/2005/WD-rdf-sparql-query-20050217/ Remove unused NOT token 1 shift/reduce conflcit near: URI '(' which can be a cast in a rule part of BuiltinExpression or a Literal. * sparql_parser.y (sparql_parse): Use rasqal_engine_query_constraints_has_qname. * rdql_parser.y: Construct constraints in parsing via query field constraints_sequence (rasqal_rdql_query_engine_prepare): Init constraints_sequence and after parsing, assign to the main graph pattern and delete it. Then do the qname expansion. (rdql_parse): Remove qname expansion to above function. (main): Use rasqal_query_prepare rather than writing internal fields directly. * rasqal.h: Deprecate rasqal_query_add_constraint, rasqal_query_get_constraint_sequence and rasqal_query_get_constraint Added prototypes for rasqal_graph_pattern_add_constraint, rasqal_graph_pattern_get_constraint_sequence and rasqal_graph_pattern_get_constraint * rasqal_query.c: Moved constraints code to graph_pattern (rasqal_free_query): Removed constraints code. (rasqal_query_add_source, rasqal_query_get_source_sequence, rasqal_query_get_source, rasqal_query_get_variable_sequence): Add RASQAL_DEPRECATED_MESSAGE pointing at new choice. (rasqal_query_add_constraint, rasqal_query_get_constraint_sequence, rasqal_query_get_constraint): Deprecated to methods on a rasqal_graph_pattern (rasqal_query_print): Remove constraints printing. * rasqal_engine.c (rasqal_engine_query_constraints_has_qname): Renamed from rasqal_engine_constraints_has_qname (rasqal_engine_graph_pattern_constraints_has_qname): Added. (rasqal_engine_expand_graph_pattern_constraints_qnames): Renamed from rasqal_engine_expand_constraints_qnames (rasqal_engine_expand_query_constraints_qnames): Added. (rasqal_free_graph_pattern): Free constraints_expression and constraints when present (moved from rasqal_free_query). (rasqal_graph_pattern_add_constraint): Added, based on rasqal_query_add_constraint. (rasqal_graph_pattern_get_constraint_sequence): Added, based on rasqal_query_get_constraint_sequence (rasqal_graph_pattern_get_constraint): Added, based on rasqal_query_get_constraint (rasqal_graph_pattern_print): Add printing of constraints (rasqal_engine_prepare): Build constraints expressions per graph pattern. (rasqal_engine_check_constraint, rasqal_engine_do_step, rasqal_engine_do_optional_step): Operate constraints per-current graph pattern. * rasqal_internal.h: RASQAL_DEPRECATED_MESSAGE gains a count so it warns just once. rasqal_graph_pattern gains constraints, constraints_expression fields. rasqal_query internal looses constraints. Gains constraints_equence for rdql parsing use. Added prototypes for rasqal_engine_query_constraints_has_qname, rasqal_engine_graph_pattern_constraints_has_qname, rasqal_engine_expand_query_constraints_qnames and rasqal_engine_expand_graph_pattern_constraints_qnames 2005-03-01 Dave Beckett * roqet.c: Update to use rasqal_data_graph* and methods. * rasqal_query.c (rasqal_query_print): Prefer printing query->data_graphs not sources. * sparql_parser.y (FromClauseOpt): Add either a NAMED or BACKGROUND rasqal_data_graph with FROM and WITH respectively. * rasqal_internal.h: rasqal_query gains data_graphs field, note sources is DEPRECATED. * rasqal_query.c (rasqal_new_query, rasqal_free_query): Added data_graphs field init, tidy. (rasqal_query_add_data_graph, rasqal_query_get_data_graph_sequence, rasqal_query_get_data_graph): Added for rasqal_data_graph access (rasqal_query_add_source, rasqal_query_get_source_sequence, rasqal_query_get_source): Added deprecated docs * rasqal_expr.c (rasqal_query_add_source, rasqal_query_get_source_sequence and rasqal_query_get_source): Added deprecated notices. (rasqal_new_data_graph, rasqal_free_data_graph, rasqal_data_graph_print): Added for rasqal_data_graph class. * rasqal.h: Added rasqal_data_graph and rasqal_data_graph_flags. Deprecated rasqal_query_add_source, rasqal_query_get_source_sequence and rasqal_query_get_source Added prototypes for rasqal_query_add_data_graph, rasqal_query_get_data_graph_sequence, rasqal_query_get_data_graph, rasqal_new_data_graph, rasqal_free_data_graph, rasqal_data_graph_print 2005-02-27 Dave Beckett * win32_rasqal_config.h, configure.ac, NEWS.html, ChangeLog: Bumped version to 0.9.8 * configure.ac, win32_rasqal_config.h: Bumped version to 0.9.8 * Snapshotted rasqal_0_9_7 for 0.9.7 release 2005-02-24 Dave Beckett * roqet.1: roqet is a query util * roqet.c (roqet_graph_pattern_walk): Renamed from roqet_walk_graph_pattern * roqet.c (roqet_query_walk): Added to do all query API walking. * rasqal_query.c (rasqal_query_print): Tweak distinct, limits wording> * tests/sparql/syntax/Makefile.am: Added distinct0.rq limit0.rq * tests/sparql/syntax/distinct0.rq, tests/sparql/syntax/limit0.rq: Tests for DISTINCT and LIMIT syntax * librasqal.3: Added rasqal_query_get_distinct and rasqal_query_get_limit * sparql_parser.y (LimitClauseOpt): Set limit field. * rasqal_query.c: Tidy some docucomments. (rasqal_new_query): Initialise distinct, limit fields. (rasqal_query_get_distinct): Added, returning if query results should be distinct. (rasqal_query_get_limit): Added, returning the query results limit specified in the query. (rasqal_query_print): Print distinct, limit fields. * rasqal.h: Added rasqal_query_get_distinct and rasqal_query_get_limit * rasqal_internal.h: Added limit field to struct rasqal_query_s * rasqal_literal.c (rasqal_literal_compare): Recheck for NULL variable values so that ?var1 compare ?var2 fails properly when one is not bound. * sparql_parser.y: tweak optional warning 2005-02-23 Dave Beckett * roqet.c: Casts for C++ * rasqal_redland.c (rasqal_redland_new_triples_source): Return -1 on no data. * rasqal_raptor.c (rasqal_raptor_new_triples_source): Return -1 on no data. * rasqal_query.c (rasqal_query_prepare): Init line, column, byte to undefined. * rasqal_engine.c (rasqal_new_triples_source): Throw no data/general error when new triple source factory fails to construct. (rasqal_engine_execute_init): Remove error throwing from here. * rasqal.h: new_triples_source factory method document return value * roqet.c: Use raptor_stringbuffer to read large queries from files, > buffer size. 2005-02-19 Dave Beckett * tests/sparql/part1/Makefile.am: Add dawg-query-004 dawg-result-004.n3 * tests/sparql/part1/dawg-query-001, tests/sparql/part1/dawg-query-002, tests/sparql/part1/dawg-query-003, tests/sparql/part1/dawg-query-004: 2005-02-17 WD syntax changes 2005-02-18 Dave Beckett * tests/sparql/syntax/construct1.rq, tests/sparql/syntax/construct2.rq, tests/sparql/syntax/ask0.rq, tests/sparql/syntax/construct0.rq: FROM to WITH for 2005-02-17 WD * sparql_parser.y (PatternElementForms): Remove unused vars. * sparql_parser.y: Some updates for 2005-02-17 SPARQL query WD. Added GRAPH, WITH tokens (FromClauseOpt): Warn about FROM, add WITH. (PatternElementForms): Warn with SOURCE, add GRAPH. Use rasqal_graph_pattern_set_origin to pass on the varOrURI (PatternElementForms): Warn about [] * sparql_lexer.l: Added graph, with * rasqal_internal.h: Added rasqal_graph_pattern_set_origin prototype. * rasqal_query.c (rasqal_graph_pattern_set_origin): Added, to recursively set the origin on all triples inside. 2005-02-17 Dave Beckett * librasqal.3: Document 0.9.7 and graph pattern api calls. * roqet.1: Document -d, -n * roqet.c: Added -n/--dryrun to stop after preparing the query. Added -w/--walk-query to walk and print the query using the API. (roqet_walk_graph_pattern): Added to walk the tree. * rasqal_query.c (rasqal_graph_pattern_get_triple): fix range check * rasqal_query.c (rasqal_query_add_triple): Deprecated as it doesn't construct the graph patterns and is of little use. (rasqal_query_get_graph_pattern_sequence, rasqal_query_get_graph_pattern): Added to get the rasqal_graph_patterns inside a query. (rasqal_graph_pattern_get_triple): Added to get a rasqal_triple inside a graph_pattern. (rasqal_graph_pattern_get_sub_graph_pattern_sequence, (rasqal_graph_pattern_get_sub_graph_pattern): Added to get a sub-graph pattern inside a graph pattern. (rasqal_graph_pattern_get_flags): Added to get graph pattern flags. * rasqal_internal.h: Move rasqal_graph_pattern typedef, rasqal_pattern_flags and rasqal_graph_pattern_print to public api. Added RASQAL_DEPRECATED_MESSAGE macro. * rasqal.h: Export rasqal_graph_pattern typedef Export rasqal_pattern_flags enum with value RASQAL_PATTERN_FLAGS_OPTIONAL Deprecate rasqal_query_add_triple as it doesn't construct the graph patterns and is of little use. Added prototypes for rasqal_query_get_graph_pattern_sequence, rasqal_query_get_graph_pattern, rasqal_graph_pattern_get_triple, rasqal_graph_pattern_get_sub_graph_pattern_sequence, rasqal_graph_pattern_get_sub_graph_pattern, rasqal_graph_pattern_get_flags and exported rasqal_graph_pattern_print * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql: Handle roqet select: and bound variables: * rasqal.h: Added RASQAL_DEPRECATED macro. Deprecated rasqal_query_get_variable_sequence Added rasqal_query_get_bound_variable_sequence and rasqal_query_get_all_variable_sequence. * rasqal_query.c (rasqal_query_get_variable_sequence): Deprecate, prefer rasqal_query_get_bound_variable_sequence (rasqal_query_get_bound_variable_sequence): Added, returning the sequence of rasqal_variable* that are to be bound - appearing in the query result. (rasqal_query_get_all_variable_sequence): Added, return the sequence of all rasqal_variable* mentioned in the query. (rasqal_query_print): Print all variables as well as selected. * rasqal_literal.c (rasqal_literal_as_integer, rasqal_literal_as_floating, rasqal_literal_as_string, rasqal_literal_compare): Added remaining LITERAL enums for -Wswitch-enum. (rasqal_literal_compare): Handle two literal values. (rasqal_literal_as_node): Handle RASQAL_LITERAL_BOOLEAN into a xsd:boolean typed value. * rasqal_query.c (rasqal_query_results_get_binding_name): Work even when query results are finished. * rasqal_query.c (rasqal_query_set_feature): Added RASQAL_FEATURE_LAST case for -Wswitch-enum (there are no features). (rasqal_query_results_write, rasqal_query_results_get_triple): Added RASQAL_LITERAL_UNKNOWN case for -Wswitch-enum. (rasqal_query_results_get_triple): Added remaining LITERAL enums for -Wswitch-enum. Note why forbidden - literal subjects, predicates, bnode predicates. * rasqal_expr.c (rasqal_free_expression, rasqal_expression_foreach, rasqal_expression_evaluate, rasqal_expression_print): Added RASQAL_EXPR_UNKNOWN case for -Wswitch-enum. Deleted "pattern" from rasqal_op_labels. (rasqal_expression_print): Deleted RASQAL_EXPR_PATTERN. Handle RASQAL_EXPR_FUNCTION. * rasqal_literal.c (rasqal_free_literal, rasqal_literal_print, rasqal_literal_as_boolean, rasqal_literal_as_integer, rasqal_literal_as_floating, rasqal_literal_as_string, rasqal_literal_compare, rasqal_literal_equals): Added RASQAL_LITERAL_UNKNOWN case for -Wswitch-enum. (rasqal_literal_as_integer, rasqal_literal_as_floating): Return RASQAL_LITERAL_BLANK as an error. * rasqal.h: Deleted RASQAL_EXPR_PATTERN - never used. * configure.ac: Add -Wswitch-enum to maintainer-mode gcc switches to catch missing enum values in switches. Lots of those near expression and literal handling. 2005-02-14 Dave Beckett * win32_rasqal_config.h: Define RASQAL_INLINE to __inline * rasqal_query.c: Change inline to RASQAL_INLINE * rasqal_internal.h: Add RASQAL_INLINE protection and set RASQAL_DEBUG if LIBRDF_DEBUG set. * rasqal.h: rasqal_query_results_write with RASQAL_API prefix. 2005-02-12 Dave Beckett * rasqal_engine.c (rasqal_reset_triple_meta): End any triples match when resetting rasqal_triple_meta; this frees any resources that were providing a source of triples. 2005-02-10 Dave Beckett * rasqal_query_test.c (main): Execute a query/free twice with no checking of results in between. 2005-02-08 Dave Beckett * tests/sparql/bound/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/syntax/Makefile.am, configure.ac, tests/rdql/testsuite/Makefile.am: Add @RAPPER_PATH@ to the PATH before check-rdql/sparql calls so that if both raptor and rasqal are being built, rapper can be found before installation. 2005-02-06 Dave Beckett * configure.ac, win32_rasqal_config.h: Bumped version to 0.9.7 * Snapshotted rasqal_0_9_6 for 0.9.6 release 2005-02-04 Dave Beckett * autogen.sh: Add autoheader and libtoolize to the path search. * configure.ac: AM_PROG_LIBTOOL to AC_PROG_LIBTOOL seems to make things happier 2005-02-03 Dave Beckett * sparql_lexer.l, rasqal_expr.c: casts for C++ * configure.ac: In maintainer mode, stop if flex is too old, no flex or YACC is not GNU bison. * sparql_lexer.l (sparql_copy_string_token): Fix wrong length on checking qname. * sparql_lexer.l ({QNAME}): Now assigns a uri using sparql_copy_qname. (sparql_copy_qname): expands and returns a raptor_uri* here. When running standalone as rasqal_lexer_test, ignore unexpanded qnames. (sparql_copy_string_token): When running standalone as rasqal_lexer_test, ignore unexpanded qnames. * sparql_lexer.l (sparql_copy_string_token): Check and expand datatype qnames here, since prefixes are always defined before qname use.. * rasqal_expr.c: Added support for expressions: STR, LANG, DATATYPE, ISURI, ISBLANK and ISLITERAL (rasqal_free_expression, rasqal_expression_foreach, rasqal_expression_print_op, rasqal_expression_print): Updated to handle the expression types above. (rasqal_expression_evaluate): Print evaluation before and after debug messages. Edit main body to not return in cases. Implement the expressions above. * sparql_parser.y: Added tokens STR, LANG, DATATYPE, ISURI, ISBLANK and ISLITERAL (BuiltinExpression): Use the tokens above to implement built in functions of the same names. * sparql_lexer.l: Added keywords STR, LANG, DATATYPE, ISURI, ISBLANK and ISLITERAL * rasqal.h: Added rasqal_op RASQAL_EXPR_STR, RASQAL_EXPR_LANG, RASQAL_EXPR_DATATYPE, RASQAL_EXPR_ISURI, RASQAL_EXPR_ISBLANK, RASQAL_EXPR_ISLITERAL, * librasqal.3, rasqal_literal.c: Updates for 0.9.6 2005-02-02 Dave Beckett * rasqal.rdf.in: Updates for schema 2005-02-01 Dave Beckett * rasqal_engine.c (rasqal_engine_do_optional_step): When the constraint fails, zero the new_bindings_count since none matter now. * sparql_lexer.l: Added BNAME token ({BNAME}): Added to just do a blank node. * configure.ac: Added dir tests/sparql/bound * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/construct2.rq: Construct with bnodes in construct2.rq * tests/sparql/bound/.cvsignore, tests/sparql/bound/Makefile.am, tests/sparql/bound/bound1-result.n3, tests/sparql/bound/bound1.rq, tests/sparql/bound/data.n3, tests/sparql/bound/manifest.n3: DAWG BOUND tests * tests/sparql/Makefile.am: added bound * sparql_lexer.l ({QNAME}): If it starts _:, make a BLANK_LITERAL (sparql_token_print, sparql_token_free): Added BLANK_LITERAL support. * sparql_parser.y: Added tokens BLANK_LITERAL ConstructPattern (rq23) BNode (rq23), TripleTemplate (rq23) and VarOrLiteralOrBNode VarOrURIOrBNode (ConstructClause): Now using ConstructPattern (ConstructPattern): Added from rq23, using TripleTemplate (TripleTemplate): Added from rq23, using VarOrURIOrBNode for subject and VarOrLiteralOrBNode for object. (VarOrURIOrBNode): Added, using BNode (VarOrLiteralOrBNode): Added, using BNode (BNode): Added from rq23 * rasqal_expr.c (rasqal_free_expression, rasqal_expression_evaluate, rasqal_expression_print_op): Added RASQAL_EXPR_BOUND support. * rasqal.h: Added RASQAL_EXPR_BOUND * sparql_parser.y: Updates from http://www.w3.org/2001/sw/DataAccess/rq23/ $Revision: 1.187 $ of $Date: 2005/02/01 10:56:24 $ Added tokens BASE LOAD BOUND Renumbered some of comments to rq23 above. (ReportFormat) Moved big () inside Query here (SelectClause, DescribeClause, ConstructClause): Note now in rq23 (AskClause): Added from rq23. (LoadClauseOpt): Added from rq23. (LimitCaluseOpt): Added from rq23. (PatternElementForms OPTIONAL GraphPattern1): Mark the graph pattern as optional in the flags. (BaseDeclOpt): Added from rq23. (UnaryExpression): Call BuiltinExpression (BuiltinExpression): Added from rq23 just with BOUND * sparql_lexer.l: Added OPTIONAL, BASE, LOAD and BOUND tokens and keywords 2005-01-31 Dave Beckett * rasqal_query.c (rasqal_query_execute): Init ask_result. (rasqal_free_query_results, rasqal_query_results_is_bindings, rasqal_query_results_is_boolean, rasqal_query_results_is_graph): Docs. (rasqal_query_results_next, rasqal_query_results_get_triple, rasqal_query_results_next_triple): C style. (rasqal_query_results_get_triple): FIXME about bnodeids is done. (rasqal_query_results_get_boolean): Docs and implement by getting first result and storing if it worked. * rasqal_internal.h: Added ask_result to rasqal_query. * tests/sparql/syntax/Makefile.am: Added ask0.rq * tests/sparql/syntax/ask0.rq: ASK test 2005-01-30 Dave Beckett * rasqal_engine.c (rasqal_engine_assign_variables): C99 * rasqal_xsd_datatypes.c: Casts for C++ * rasqal_redland.c (rasqal_redland_bind_match): Updated untested redland origin code. * rasqal_query.c: Casts for C++ * rasqal_engine.c (rasqal_graph_pattern_get_next_match): int parts * librasqal.3: Updates for API changes to 2005-01-30 2005-01-29 Dave Beckett * roqet.1: Document -f/--format. Reference -o xml spec * roqet.c: Note that -o xml writes the SPARQL xml format. * rasqal_engine.c (rasqal_engine_assign_variables): variables_declared_in is now an array of integer (triple) column numbers not pointers to graph patterns. (rasqal_reset_triple_meta): Return number of variables that were set to NULL. (rasqal_graph_pattern_init): Update to compare triple column numbers, not graph patterns for defining vars. (rasqal_query_build_declared_in): Update for variables_declared_in changed. (rasqal_graph_pattern_get_next_match): Adjust new_bindings_count by number of variables reset by rasqal_reset_triple_meta. Only run the bind_match factory method if there are triple parts to bind. If it is run, adjust the new_bindings_count when variables are set. (rasqal_engine_do_optional_step): If there were new bindings, return a result otherwise continue searching. (rasqal_engine_get_next_result): Reset new_bindings_count on entry. * rasqal_internal.h: rasqal_query: variables_declared_in is now an array of integer column numbers. Added new_bindings_count * rasqal_query.c (rasqal_free_query): tidy free of variables_declared_in, now an intarray. 2005-01-28 Dave Beckett * roqet.c: Add -f / --format to set output syntax format for graph results. * roqet.c: Update for rasqal_query_results_get_triple returning a shared raptor_statement. Use a raptor_serializer to format it. * rasqal_query.c (rasqal_free_query): Free rasqal_triple allocated. (rasqal_prefix_id): Prefix a blank node id with 'r''_' (rasqal_query_results_get_triple): Return a shared raptor_statement. (rasqal_query_results_next_triple): Free the internal rasqal_triple before moving on. * rasqal_internal.h: Added rasqal_triple internal to rasqal_query * rasqal.h: Changed rasqal_query_results_get_triple to return raptor_statement * rasqal_internal.h: Added raptor_statement to rasqal_query 2005-01-27 Dave Beckett * tests/rdql/testsuite/check-rdql, tests/sparql/check-sparql (run_test): don't delete test output files here, let main do it. * roqet.c: Free returned triple result * roqet.c: Tidy the query result messages * roqet.c (main): Format bindings, triples and boolean results. * rasqal_query.c (rasqal_query_execute): Init current_triple_result. (rasqal_query_results_is_bindings, rasqal_query_results_is_boolean, rasqal_query_results_is_graph): Added to test query result formats. (rasqal_query_results_get_count, rasqal_query_results_next, rasqal_query_results_finished, rasqal_query_results_get_bindings, rasqal_query_results_get_binding_value, rasqal_query_results_get_binding_name, rasqal_query_results_get_binding_value_by_name, rasqal_query_results_get_bindings_count): Fail if result type is not bindings. (rasqal_query_results_get_triple): Added, to get the current triple from a graph result. (rasqal_query_results_next_triple): Added, to move to the next triple in a graph result. (rasqal_query_results_get_boolean): Added, always false for now. * rasqal_literal.c (rasqal_literal_as_node): Handle variable values, convert the variable result. * rasqal_internal.h: Added current_triple_result to rasqal_query * rasqal.h: Added rasqal_query_results_is_bindings, rasqal_query_results_is_boolean, rasqal_query_results_get_boolean, rasqal_query_results_is_graph, rasqal_query_results_get_triple and rasqal_query_results_next_triple * rasqal_engine.c (rasqal_engine_assign_variables): Build construct triples when CONSTRUCT * is given * rasqal_expr.c (rasqal_new_triple_from_triple): Added copy constructor * rasqal.h: Added rasqal_new_triple_from_triple * tests/sparql/syntax/Makefile.am, tests/sparql/syntax/construct0.rq, tests/sparql/syntax/construct1.rq: CONSTRUCT syntax 2005-01-24 Dave Beckett * rasqal_expr.c (rasqal_new_function_expression): Added to create a function call expression. (rasqal_free_expression, rasqal_expression_print): Handle RASQAL_EXPR_FUNCTION. * rasqal.h: Added name, args fields to rasqal_expression Added rasqal_new_function_expression * Makefile.am: Added rasqal_xsd_datatypes_test * rasqal_xsd_datatypes.c: Rasqal XSD datatypes 2005-01-21 Dave Beckett * tests/rdql/testsuite/Makefile.am: S-03, S-04, S-05 work * sparql_lexer.l (PREFIX): Allow \ (NAME): Allow \ ({NAME}, {PREFIX}, {QNAME}) Terminate when a name is not created. (sparql_copy_name, sparql_copy_qname): Use rasqal_escaped_name_to_utf8_string to turn the escaped name into just UTF-8, then check it is a legal XML name. * rdql_lexer.l (PREFIX): Allow \ (NAME): Allow \ (<*>{NAME}, {QNAME}, <{QNAME}>) Terminate when a name is not created. (rdql_copy_name, rdql_copy_qname): Use rasqal_escaped_name_to_utf8_string to turn the escaped name into just UTF-8, then check it is a legal XML name. * rasqal_internal.h: Added prototype for rasqal_escaped_name_to_utf8_string * rasqal_general.c (rasqal_escaped_name_to_utf8_string): Added to turn a UTF-8 and/or \u-escaped name as a UTF-8 string. Intended as a lexer helper function. A combination of raptor_ntriples_string_as_utf8_string and raptor_ntriples_term with the parsing part stripped out, and just \u, \U allowed, always allowing UTF-8 and working just on full strings. 2005-01-18 Dave Beckett * tests/rdql/testsuite/Makefile.am: Remove S-02 from expected failures now that the formatting matches the expected N-Triples escaped output. * rasqal_literal.c (rasqal_literal_print): Print string as N-Triples-escaped using raptor_print_ntriples_string. 2005-01-16 Dave Beckett * rasqal_query.c (rasqal_query_results_write): Copy original base_uri each time, don't lose the original reference. * rasqal_query.c (rasqal_query_results_write): Handle RASQAL_LITERAL_BLANK. Doh! * win32_rasqal_config.h, configure.ac, NEWS.html: Bumped version to 0.9.6 * Snapshotted rasqal_0_9_5 for 0.9.5 release * Makefile.am: Add @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) to all *_LDADD It seems to help mysterious shared library linking problems on Solaris. * Makefile.am: Remove AM_LDFLAGS, libtool works that out from the LIBADD for librasqal and adds it into the .la and uses it from there. * Makefile.am: Make the tests using automake rules rather than hand-crafted compile and link rules which were tricky to maintain. Added EXTRA_PROGRAMS for the tests. * rasqal_query_test.c: Handle rdql or sparql tests * rasqal_query_test.c: (main) Handle no rdql available with an warning and exit 0 2005-01-15 Dave Beckett * rasqal_literal.c (rasqal_literal_compare): Move declarations to start of block. * librasqal.3: Updates for 0.9.5 * configure.ac: Require raptor 1.4.4 * sparql_parser.y (URIList): Copy the URI before freeing the rasqal_literal. 2005-01-14 Dave Beckett * tests/sparql/part1/dawg-result-004.n3, tests/sparql/part1/manifest.n3, tests/sparql/part1/dawg-query-004: Import dawg-query-004 dawg-result-004.n3 2005-01-13 Dave Beckett * win32_rasqal_config.h: RASQAL_INTERNAL should be defined in the build configuration 2005-01-12 Dave Beckett * sparql_lexer.l: Updated to use yyterminate() when an error is reported, either in the lexer or in a failing function called. Deleted use of ERROR_TOKEN. Mention SPARQL in all the error and warning messages. * rdql_lexer.l: Updated to use yyterminate() when an error is reported, either in the lexer or in a failing function called. Deleted use of ERROR_TOKEN. Mention RDQL in all the error and warning messages. * sparql_parser.y: Delete ERROR_TOKEN (PatternElementForms): Add SPARQL to warning message. (sparql_parse): Add SPARQL to error message. * rdql_parser.y: Delete ERROR_TOKEN * rasqal_expr.c (rasqal_expression_evaluate): For STR_MATCH, STR_NMATCH ensure the literal returned from the lhs expression evaluation is always freed. 2005-01-11 Dave Beckett * rdql_parser.y (rdql_parse): set parsing debug flag before starting parse when RASQAL_DEBUG > 2 * rasqal_engine.c (rasqal_engine_do_optional_step): Handle an all optional query and finish all results when first optional finishes. * rasqal_query.c (rasqal_query_results_write): Handle NULL base_uri, pass it on the XML writer. * tests/sparql/examples/ex2-4a.rq: Kill the , between SELECT vars * rasqal_xml.c: Removed, not used 2005-01-10 Dave Beckett * rasqal_raptor.c (rasqal_raptor_finish_triples_match): Free any literals copied into the triple used for comparing matches. * rasqal_raptor.c (rasqal_raptor_bind_match): Reformatting. (rasqal_raptor_new_triples_match): Set unbound triple matches literal values as shared pointers, not copies of literals. * rasqal_redland.c (rasqal_redland_bind_match): Update return value. * rasqal_engine.c (rasqal_free_graph_pattern): Zap triple_meta pointer when done. * sparql_lexer.l, rdql_lexer.l (.): Recover state after an error in a regex. * rasqal_engine.c (rasqal_graph_pattern_order): Sort using pointers in data, not array pointers. * rasqal_query.c (rasqal_free_query): Delete ordered_triples tidy. (rasqal_query_print): Delete ordered_triples print. * rasqal_engine.c: (rasqal_query_order_triples_score, rasqal_query_order_triples): Deleted - no longer used. * rasqal_internal.h: Deleted unused ordered_triples field from rasqal_query. 2005-01-09 Dave Beckett * tests/sparql/part1/Makefile.am: All tests pass, empty EXPECTED_SPARQL_CORRECT_FAILURES * rasqal_internal.h: Added max_optional_graph_pattern to query. * rasqal_engine.c (rasqal_engine_do_step): Set gp->matched flag here (rasqal_engine_do_optional_step): Set gp->matched flag (rasqal_engine_get_next_result): Do not set gp->matched flag here. For an optional step, if no bound values were returned ensure search continues. * rasqal_engine.c: Add a few more debug messages. * rasqal_engine.c: delete a #if 1 * rasqal_engine.c (rasqal_engine_move_to_graph_pattern): Use max_optional_graph_patterns to walk through combinations of optional graph patterns. (rasqal_engine_do_optional_step): Check against max_optional_graph_patterns limit and lower it when backtracking. (rasqal_engine_get_next_result): Count # returned values and continue searching when=0. This is a fixup hack, not a final solution. * rasqal_engine.c (rasqal_engine_move_to_graph_pattern): Use max_optional_graph_patterns to walk through combinations of optional graph patterns. (rasqal_engine_do_optional_step): Check against max_optional_graph_patterns limit and lower it when backtracking. (rasqal_engine_get_next_result): Count # returned values and continue searching when=0. This is a fixup hack, not a final solution. * rasqal_engine.c (rasqal_engine_move_to_graph_pattern): Take a delta since only ever moving by +1 or -1. When there are no optionals, just move. When backtracking optionals, re-init the finished graph pattern. (rasqal_engine_do_step, rasqal_engine_do_optional_step): Update calls to above. 2005-01-08 Dave Beckett * rasqal_engine.c (rasqal_reset_triple_meta): Added. (rasqal_free_graph_pattern, rasqal_graph_pattern_get_next_match): Call new rasqal_reset_triple_meta (rasqal_engine_do_optional_step): Comment out duff test * rasqal_engine.c: messages * rasqal_engine.c (rasqal_engine_do_optional_step): Copy tidying * rasqal_engine.c (rasqal_engine_get_next_result): Debug messages. * rasqal_engine.c (rasqal_engine_check_constraint): Added, from body of rasqal_engine_get_next_result. (rasqal_engine_do_step): Now just for mandatory graph patterns rasqal_engine_do_optional_step): Added, just for optional graph patterns. (rasqal_engine_get_next_result): Call rasqal_engine_do_step or rasqal_engine_do_optional_step depending on graph pattern optional flag. * rasqal_engine.c (rasqal_engine_do_step): Added, from body of rasqal_engine_get_next_result (rasqal_engine_get_next_result): Smaller, see above. * rasqal_engine.c: Added rasqal_engine_step and use in (rasqal_engine_get_next_result): Replace step=X; break with step=X; continue to let the loop do the work * rasqal_engine.c: Added rasqal_engine_step and use in rasqal_engine_get_next_result * rasqal_engine.c (rasqal_engine_move_to_graph_pattern): No need for return * rasqal_engine.c (rasqal_engine_get_next_result): Init all matched flags to 0 at start. * rasqal_engine.c: Comment out not-used triple ordering code. (rasqal_triples_match_bind_match): Add parts arg and pass on to factory bind_match method. (rasqal_new_graph_pattern_from_triples): Add query arg at start. Init query, finished, matches_returned. (rasqal_new_graph_pattern_from_sequence): Add query arg at start. Init query, finished, matches_returned. (rasqal_free_graph_pattern): Free variables matching the parts. (rasqal_graph_pattern_init): Initialise the triple meta parts depending on the variables_declared_in information. (rasqal_query_build_declared_in): Added to mark which in graph pattern variables are first declared in the query so that they are never bound multiple times. Also warns of selected but never used variables. (rasqal_graph_pattern_get_next_match): After a triple match ends, free variables matching the parts only. (rasqal_engine_prepare): Disable ordering triples. Call rasqal_query_build_declared_in. (rasqal_engine_move_to_graph_pattern): Helper added for: (rasqal_engine_get_next_result): Many changes trying to get optionals working. * rasqal_internal.h: Add query, finished, matches fields to graph_pattern. Add query arg to start of rasqal_new_graph_pattern_from_triples and rasqal_new_graph_pattern_from_sequence Add variables_declared_in array field, optional_graph_pattern_matches_count field to query. * rasqal_redland.c (rasqal_redland_bind_match): Take parts argument and use to just bind those parts of the triple. * rasqal_raptor.c (rasqal_raptor_bind_match): Take parts argument and use to just bind those parts of the triple. * rdql_parser.y, sparql_parser.y: Add query arg at start of rasqal_new_graph_pattern_from_triples and rasqal_new_graph_pattern_from_sequence calls. * rasqal.h: Added triple parts to rasqal_triple_meta. * rasqal_query.c (rasqal_free_query): Tidy query->variables_declared_in. 2005-01-06 Dave Beckett * rasqal.h: Added rasqal_triple_parts rasqal_triples_match factory method bind_match now takes and returns rasqal_triple_parts, returns 0 on failure * rasqal_redland.c, rasqal_raptor.c, rasqal_engine.c, rasqal.h: Invert return value of rasqal_triples_match factory method bind_match. Now returns 0 on failure. * rasqal_engine.c (rasqal_engine_get_next_result): Handle failed constraint by moving to next match. * tests/sparql/part1/dawg-data-01.n3, tests/sparql/part1/dawg-result-003.n3: to * tests/sparql/check-sparql: Remove =NULL from roqet output to handle optionals * rasqal_query.c (rasqal_new_query): Init gp->optional_graph_pattern. * rasqal_internal.h: Add finished, matches, optional_graph_pattern to rasqal_graph_pattern Add optional_graph_pattern to rasqal_query. * rasqal_engine.c (rasqal_new_graph_pattern_from_triples): Init gp->optional_graph_pattern. (rasqal_graph_pattern_init): Init optional_graph_pattern, finished and matches. (rasqal_graph_pattern_order): Added, to sort graph_patterns in a query into mandatory first, optional last. (rasqal_engine_execute_init): Sort graph_patterns using raptor_sequence_sort and above helper Initialise query->optional_graph_pattern to the index of the first optional graph_pattern. (rasqal_engine_get_next_result): Many changes on the way to getting optionals working. Track what patterns have ended with the finished flag, and count matches to determine when nothing matched. 2005-01-04 Dave Beckett * rasqal_query.c (rasqal_new_query): Init sources sequence always. (rasqal_query_add_source): No need to init sources sequence here. * sparql_parser.y (WhereClauseOpt): Don't overwrite query->graph_patterns sequence, append if necessary. * sparql_parser.y (FromClauseOpt): Don't overwrite query->sources sequence, append if necessary. * rdql_parser.y (Query): Don't overwrite query->sources sequence, append if necessary. (TriplePattern): Append to query->triples sequence, don't overwrite it. 2005-01-03 Dave Beckett * roqet.c (main): Declare query_string as void* to prevent type punning warning. * sparql_lexer.l, roqet.c, rdql_lexer.l, rasqal_query.c: casts for C++ 2005-01-01 Dave Beckett * roqet.c (roqet_xml_print_xml_attribute): Deleted (roqet_query_results_print_as_xml): Replaced with call to rasqal_query_results_write. (main): Set error and fatal_error handlers for query. Remove xml format warning. * rasqal_query.c (rasqal_query_results_write): Added docs. Declare own namespace stack and free up elements. * rasqal.h: Added rasqal_query_results_write rasqal-0.9.33/scripts/0000755000175000017500000000000012443715254011570 500000000000000rasqal-0.9.33/scripts/fix-groff-xhtml.pl0000755000175000017500000000376612434455625015110 00000000000000#!/usr/bin/perl # # Format XHTML generated by groff -Thtml (via tidy) for websites # # Usage: groff -Thtml -P-l something.man | tidy -asxml ... | perl fix-groff-xhtml.pl OUTPUT-FILE # # (C) Copyright 2003-2014 Dave Beckett # use strict; use File::Basename; my $progname=basename $0; my $raptor_title="Raptor RDF Parser Toolkit"; my $redland_title="Redland RDF Application Framework"; my $rasqal_title="Rasqal RDF Query Library"; die "USAGE: $progname OUTPUT-FILE\n" if @ARGV < 1; my $doc_title; my($file)=@ARGV; open(OUT, ">$file") or die "$progname: Cannot create $file - $!\n"; open(IN, "-"); while() { s%libraptor%$raptor_title - Raptor API%; s%

libraptor

%

$raptor_title - Raptor API

%; s%rapper%$raptor_title - Raptor RDF parser utility%; s%

rapper

%

$raptor_title - Raptor RDF parser utility

%; s%rdfproc%$redland_title - Redland RDF processor utility%; s%

rdfproc

%

$redland_title - Redland RDF processor utility

%; s%librasqal%$rasqal_title - Rasqal API%; s%

librasqal

%

$rasqal_title - Rasqal API

%; s%roqet%$rasqal_title - Rasqal RDF parser utility%; s%

roqet

%

$rasqal_title - Rasqal RDF parser utility

%; next if /^]*>%%; # This is not xhtml s% cols="\d+" % %; s%(name|id)="([^"]+)"%my($at,$val)=($1,$2); $val =~ s/ /_/g; qq{$at="$val"};%eg; s%(Dave Beckett|Institute for Learning and Research Technology .ILRT.|University of Bristol) (?:- |)(http://[^<]+)%$1%; my $year=1900+(localtime)[5]; print OUT <<"EOT" if m%^%;

Copyright 2002-$year Dave Beckett
2002-2005 University of Bristol

EOT print OUT; } close(IN); close(OUT); rasqal-0.9.33/scripts/Makefile.am0000644000175000017500000000157712421006603013541 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal scripts # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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_DIST= \ fix-bison.pl \ fix-flex.pl \ fix-groff-xhtml.pl \ fix-gtkdoc-header.pl \ process-changes.pl rasqal-0.9.33/scripts/Makefile.in0000644000175000017500000003140112434455632013555 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal scripts # # Copyright (C) 2010, David Beckett http://www.dajobe.org/ # # 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = scripts DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ EXTRA_DIST = \ fix-bison.pl \ fix-flex.pl \ fix-groff-xhtml.pl \ fix-gtkdoc-header.pl \ process-changes.pl all: all-am .SUFFIXES: $(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 scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: rasqal-0.9.33/scripts/fix-gtkdoc-header.pl0000755000175000017500000000225712434455625015346 00000000000000#!/usr/bin/perl -w # # Edit main header so that gtk-doc is happy about it # # USAGE: # perl fix-gtkc-header.pl < header.h > header.i # # Copyright (C) 2010-2014, David Beckett http://www.dajobe.org/ # # 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. while(<>) { # Remove trailing macros s{RAPTOR_PRINTF_FORMAT\(\d+, \d+\);}{;}; # gtk-doc hates const in some places s/const char\* const\* (\w+)/const char\* $1/; # and unsigned char s/const unsigned char \*(\w+)/const char \* $1/; # and unsigned char in a handler typedef s/typedef unsigned char\s*\*/typedef char \*/; print; } rasqal-0.9.33/scripts/fix-bison.pl0000755000175000017500000000433312434455625013754 00000000000000#!/usr/bin/perl # # Format output code generated by bison # # Usage: # bison -b foo_parser -p foo_parser_ -d -v foo_parser.y # perl fix-bison.pl foo_parser.tab.c > $tmp # mv $tmp foo_parser.tab.c # # Copyright (C) 2004-2014, David Beckett http://www.dajobe.org/ # Copyright (C) 2004, University of Bristol, UK http://www.bristol.ac.uk/ # my $seen_yyerrlab1=0; my $line_offset=1; # #line directives always refer to the NEXT line while(<>) { # Remove code that causes a warning if(/Suppress GCC warning that yyerrlab1/) { do { $_=<>; $line_offset--; # skipped a line } while(!/^\#endif/); $line_offset--; # skipped a line next; } $seen_yyerrlab1=1 if /goto yyerrlab1/; s/^yyerrlab1:// unless $seen_yyerrlab1; # Do not use macro name for a temporary variable s/unsigned int yylineno = /unsigned int yylineno_tmp = /; s/yyrule - 1, yylineno\)/yyrule - 1, yylineno_tmp\)/; # Do not (re)define prototypes that the system did better if(m%^void \*malloc\s*\(%) { $line_offset--; # skipped a line next; } if(m%^void free\s*\(%) { $line_offset--; # skipped a line next; } if(m%^\# undef YYCASE_$%) { # Add a default value for yyformat for coverity CID 10838 my $line=$_; print qq{ default: yyformat = YY_("syntax error");\n}; $line_offset++; # extra line print $line; next; } if(m%yysyntax_error_status = YYSYNTAX_ERROR%) { # Set yytoken to non-negative value for coverity CID 29259 my $line=$_; print qq{if(yytoken < 0) yytoken = YYUNDEFTOK;\n}; $line_offset++; # extra line print $line; next; } # Suppress warnings about empty declarations s/(^static int .*_init_globals.*);$/$1/; # Remove always false condition if(m%if \(/\*CONSTCOND\*/ 0\)%) { $line_offset--; # skipped a line $_ = <>; $line_offset--; # skipped a line next; } # Remove always false condition; this macro is #defined to 0 if(m%if \(yytable_value_is_error \(yyn\)\)%) { $line_offset--; # skipped a line $_ = <>; $line_offset--; # skipped a line next; } # Fixup pending filename renaming, see above. # Fix line numbers. my $line=$. +$line_offset; s/^(\#line) \d+ (.*)\.tab\.c/$1 $line $2.c/; print; } rasqal-0.9.33/scripts/process-changes.pl0000755000175000017500000005157412443707542015151 00000000000000#!/usr/bin/perl -w # # Format changes TSV file # # USAGE: # process-changes.pl [OPTIONS] CHANGES-TSV-FILE # # Copyright (C) 2010-2011, David Beckett http://www.dajobe.org/ # # 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. # # # Example of Format (9 fields): # OLD VERSIONtype | enum | OLD RETURNOLD NAMEOLD ARGSNEW VERSIONtype | enum | NEW RETURNNEW NAMENEW ARGSNOTES # # Functions # 0.9.21voidoldfunctionor-(args)0.9.22voidnewfunctionor-(args)NOTES # Types # 0.9.21typeoldtypenameor--0.9.22typenewtypeor--NOTES # Enums # 0.9.21enumoldenumvalueor--0.9.22enumnewenumvalueor--NOTES # use strict; use File::Basename; use IO::File; use Getopt::Long; use Pod::Usage; our $program = basename $0; our $nbsp = ' '; our $id_prefix = undef; sub print_start_chapter_as_docbook_xml($$$$) { my($fh, $id, $title, $intro_para)=@_; print $fh <<"EOT"; $title $intro_para EOT } sub print_end_chapter_as_docbook_xml($) { my($fh)=@_; print $fh <<"EOT"; EOT } sub print_docbook_xml($$$@) { my($fh, $id, $title, @list)=@_; print $fh <<"EOT";
$title EOT print $fh <<"EOT";
EOT } sub print_start_section_as_docbook_xml($$$) { my($fh, $id, $title)=@_; print $fh <<"EOT";
$title EOT } sub format_function_name_as_docbook_xml($) { my($name)=@_; my $escaped_name = $name; $escaped_name =~ s/_/-/g; return qq{$name}; } sub format_type_name_as_docbook_xml($) { my($name)=@_; my $escaped_name = $name; $escaped_name =~ s/_/-/g; if($escaped_name =~ /^[-A-Z0-9]+$/) { $escaped_name .= ":CAPS"; } return qq{$name}; } sub format_enum_name_as_docbook_xml($) { my($name)=@_; my $escaped_name = $name; $escaped_name =~ s/_/-/g; if($escaped_name =~ /^[-A-Z0-9]+$/) { $escaped_name .= ":CAPS"; } return qq{$name}; } sub format_fn_sig($$$$$) { my($format_name, $show_sig, $fn_return, $fn_name, $fn_args)=@_; my $formatted_name = $format_name ? format_function_name_as_docbook_xml($fn_name) : $fn_name; return $show_sig ? $fn_return . " " . $formatted_name . $fn_args : $formatted_name; } sub format_notes($$) { my($is_inline,$notes)=@_; if ($notes eq '') { return $is_inline ? '' : $nbsp; } $notes =~ s{#((?:raptor|librdf|rasqal)\w+)}{format_type_name_as_docbook_xml($1)}ge; $notes =~ s{#?((?:RAPTOR|LIBRDF|RASQAL)_\w+)}{format_enum_name_as_docbook_xml($1)}ge; $notes =~ s{((?:raptor|librdf|rasqal)_\w+?)\(}{format_function_name_as_docbook_xml($1)."("}ge; return $is_inline ? "- " . $notes : $notes; } sub print_functions_list_as_docbook_xml($$$$@) { my($fh, $title, $format_name, $show_sig, @list)=@_; return if !@list; print $fh <<"EOT"; Functions EOT print $fh " $title\n" if defined $title; # Sort by fn_name name @list = sort { $a->[1] cmp $b->[1] } @list; for my $item (@list) { my($fn_return, $fn_name, $fn_args, $notes) = @$item; my $formatted_fn = format_fn_sig($format_name, $show_sig, $fn_return, $fn_name, $fn_args); $notes = format_notes(1, $notes); print $fh " $formatted_fn $notes\n"; } print $fh <<"EOT"; EOT } sub format_type_sig($$) { my($format_name, $type_name)=@_; return $format_name ? format_type_name_as_docbook_xml($type_name) : $type_name; } sub format_enum_sig($$) { my($format_name, $enum_name)=@_; return $format_name ? format_enum_name_as_docbook_xml($enum_name) : $enum_name; } sub print_types_list_as_docbook_xml($$$$@) { my($fh, $title, $format_name, $show_sig, @list)=@_; return if !@list; print $fh <<"EOT"; Types EOT print $fh " $title\n" if defined $title; # Sort by type name @list = sort { $a->[0] cmp $b->[0] } @list; for my $item (@list) { my($type_name, $notes) = @$item; my $formatted_fn = format_type_sig($format_name, $type_name); $notes = format_notes(1, $notes); print $fh " $formatted_fn $notes\n"; } print $fh <<"EOT"; EOT } sub print_enums_list_as_docbook_xml($$$$@) { my($fh, $title, $format_name, $show_sig, @list)=@_; return if !@list; print $fh <<"EOT"; Enums EOT print $fh " $title\n" if defined $title; # Sort by format name @list = sort { $a->[0] cmp $b->[0] } @list; for my $item (@list) { my($enum_name, $notes) = @$item; my $formatted_fn = format_enum_sig($format_name, $enum_name); $notes = format_notes(1, $notes); print $fh " $formatted_fn $notes\n"; } print $fh <<"EOT"; EOT } sub print_renamed_functions_as_docbook_xml($$$$@) { my($fh, $title, $old_function_header, $new_function_header, @list)=@_; return if !@list; print $fh <<"EOT"; EOT print $fh " \n" if defined $title; # Sort by from name @list = sort { $a->[0] cmp $b->[0] } @list; print $fh <<"EOT"; EOT for my $item (@list) { my($from, $to, $notes) = @$item; my $formatted_name = format_function_name_as_docbook_xml($to); $notes = format_notes(0, $notes); print $fh " \n \n \n"; } print $fh <<"EOT";
$title
$old_function_header $new_function_header Notes
$from $formatted_name $notes
EOT } sub print_changed_functions_as_docbook_xml($$$$@) { my($fh, $title, $old_function_header, $new_function_header, @list)=@_; return if !@list; print $fh <<"EOT"; EOT print $fh " \n" if defined $title; print $fh <<"EOT"; EOT for my $item (@list) { my($old_fn_return, $old_fn_name, $old_fn_args, $new_fn_return, $new_fn_name, $new_fn_args, $notes) = @$item; my $old_formatted_fn = format_fn_sig(0, 1, $old_fn_return, $old_fn_name, $old_fn_args); my $new_formatted_fn = format_fn_sig(1, 1, $new_fn_return, $new_fn_name, $new_fn_args); $notes = format_notes(0, $notes); print $fh " \n \n \n"; } print $fh <<"EOT";
$title
$old_function_header $new_function_header Notes
$old_formatted_fn $new_formatted_fn $notes
EOT } sub print_end_section_as_docbook_xml($) { my($fh)=@_; print $fh <<"EOT";
EOT } sub print_changed_types_as_docbook_xml($$$$@) { my($fh, $title, $old_type_header, $new_type_header, @list)=@_; return if !@list; print $fh <<"EOT"; EOT print $fh " \n" if defined $title; # Sort by old type name @list = sort { $a->[0] cmp $b->[0] } @list; print $fh <<"EOT"; EOT for my $item (@list) { my($old_type_name, $new_type_name, $notes) = @$item; my $old_formatted_type = format_type_sig(0, $old_type_name); my $new_formatted_type = format_type_sig(1, $new_type_name); $notes = format_notes(0, $notes); print $fh " \n \n \n"; } print $fh <<"EOT";
$title
$old_type_header $new_type_header Notes
$old_formatted_type $new_formatted_type $notes
EOT } sub print_renamed_enums_as_docbook_xml($$$$@) { my($fh, $title, $old_enum_header, $new_enum_header, @list)=@_; return if !@list; print $fh <<"EOT"; EOT print $fh " \n" if defined $title; # Sort by from name @list = sort { $a->[0] cmp $b->[0] } @list; print $fh <<"EOT"; EOT for my $item (@list) { my($from, $to, $notes) = @$item; my $formatted_name = format_enum_name_as_docbook_xml($to); $notes = format_notes(0, $notes); print $fh " \n \n \n"; } print $fh <<"EOT";
$title
$old_enum_header $new_enum_header Notes
$from $formatted_name $notes
EOT } sub print_deletes_as_perl_script($$@) { my($out_fh, $title, @names) = @_; print $out_fh "\n# $title\n"; for my $entry (@names) { my($name,$note)=@$entry; $note ||= ''; print $out_fh qq{s|^(.*$name.*)\$|/\\* WARNING: $name - deleted. $note \\*/ \$1|g;\n}; } } sub print_renames_as_perl_script($$$@) { my($out_fh, $title, $is_function, @names) = @_; print $out_fh "\n# $title\n"; for my $entry (@names) { my($from, $to, $note)=@$entry; $note ||= ''; my $suffix = ($is_function ? '\\(' : ''); print $out_fh qq{s|$from$suffix|$to$suffix|g;\n}; } } sub print_changes_as_perl_script($$@) { my($out_fh, $title, @names) = @_; print $out_fh "\n# $title\n"; for my $entry (@names) { my($from, $to, $note)=@$entry; $note ||= ''; print $out_fh qq{s|^(.*)($from)(.*)\$|/\\* WARNING: $from. $note \\*/ \$\{1\}$to\$\{3\}|g;\n}; } } sub print_statement_field_renames_as_perl_script($) { my($out_fh)=@_; # These are tricky / tedious to deal with entirely by hand but # the replacement for subject and object can only be determined by a person my(%statement_field_maps) = ( 'subject' => 'subject.value.uri or subject.value.blank.string /* WARNING: must choose one */', 'subject_type' => 'subject.type', 'predicate' => 'predicate.value.uri', 'predicate_type' => 'predicate.type', 'object' => 'object.value.uri or object.value.literal.string or object.value.blank.string /* WARNING: must choose one */', 'object_type' => 'object.type', 'object_literal_datatype' => 'object.value.literal.datatype', 'object_literal_language' => 'object.value.literal.language' ); print $out_fh "\n# Replace statement fields with term fields.\n"; while(my($old,$new) = each %statement_field_maps) { print $out_fh qq{s|->$old|->$new|g;\n}; } print $out_fh "\n"; } sub to_id($) { my $id=shift; $id =~ s/\W/-/g; $id =~ s/\-+/-/g; $id =~ s/^\-//; $id =~ s/\-$//; return $id; } # main my $docbook_xml_file = undef; my $upgrade_script_file = undef; my $usage = undef; GetOptions( 'docbook-xml=s' => \$docbook_xml_file, 'upgrade-script=s' => \$upgrade_script_file, 'package=s' => \$id_prefix, 'help|h|?' => \$usage ) || pod2usage(2); pod2usage(-verbose => 2) if $usage; # Arguments our($package, $file) = @ARGV; $id_prefix ||= $package; # Read in data our $expected_n_fields = 9; # "$old-$new" versions in order our(@version_pairs); # and seen our(%version_pairs_seen); # Hashes keyed by $version_pair. Value is array of descriptive # arrays specific to each type my(%new_functions); my(%deleted_functions); my(%renamed_functions); my(%changed_functions); my(%new_types); my(%deleted_types); my(%changed_types); my(%new_enums); my(%deleted_enums); my(%renamed_enums); open(IN, "<$file") or die "$program: Cannot read $file - $!\n"; while() { chomp; next if /^#/; my(@fields)=split(/\t/); my $actual_n_fields=scalar(@fields); die "$program: Bad line has $actual_n_fields fields expected $expected_n_fields $.: $_\n" unless $actual_n_fields == $expected_n_fields; if($fields[1] eq 'type') { my($old_ver, $dummy1, $old_name, $old_args, $new_ver, $dummy2, $new_name, $new_args,$notes)=@fields; my $version_pair = $old_ver."-".$new_ver; if(!$version_pairs_seen{$version_pair}) { push(@version_pairs, [$old_ver, $new_ver]); $version_pairs_seen{$version_pair} = 1; } $notes = '' if $notes eq '-'; if($old_name eq '-') { push(@{$new_types{$version_pair}}, [$new_name, $notes]); } elsif($new_name eq '-') { push(@{$deleted_types{$version_pair}}, [$old_name, $notes]); } elsif(($old_name eq $new_name) && $notes eq '') { # same } else { # renamed and maybe something else changed - in the notes push(@{$changed_types{$version_pair}}, [$old_name, $new_name, $notes]); } } elsif($fields[1] eq 'enum') { my($old_ver, $dummy1, $old_name, $old_args, $new_ver, $dummy2, $new_name, $new_args,$notes)=@fields; my $version_pair = $old_ver."-".$new_ver; if(!$version_pairs_seen{$version_pair}) { push(@version_pairs, [$old_ver, $new_ver]); $version_pairs_seen{$version_pair} = 1; } $notes = '' if $notes eq '-'; if($old_name eq '-') { push(@{$new_enums{$version_pair}}, [$new_name, $notes]); } elsif($new_name eq '-') { push(@{$deleted_enums{$version_pair}}, [$old_name, $notes]); } elsif(($old_name eq $new_name) && $notes eq '') { # same } else { push(@{$renamed_enums{$version_pair}}, [$old_name, $new_name, $notes]); } } else { my($old_ver, $old_return, $old_name, $old_args, $new_ver, $new_return, $new_name, $new_args,$notes)=@fields; my $version_pair = $old_ver."-".$new_ver; if(!$version_pairs_seen{$version_pair}) { push(@version_pairs, [$old_ver, $new_ver]); $version_pairs_seen{$version_pair} = 1; } $notes = '' if $notes eq '-'; if($old_name eq '-') { push(@{$new_functions{$version_pair}}, [$new_return, $new_name, $new_args, $notes]); } elsif($new_name eq '-') { push(@{$deleted_functions{$version_pair}}, [$old_return, $old_name, $old_args, $notes]); } elsif($old_return eq $new_return && $old_name eq $new_name && $old_args eq $new_args) { # same warn "$program: Line records no function change old: $old_return $old_name $old_args to new: $new_return $new_name $new_args\n$.: $_\n"; } elsif($old_return eq $new_return && $old_name ne $new_name && $old_args eq $new_args) { # renamed but nothing else changed push(@{$renamed_functions{$version_pair}}, [$old_name, $new_name, $notes]); } else { # something changed - args and/or return push(@{$changed_functions{$version_pair}}, [$old_return, $old_name, $old_args, $new_return, $new_name, $new_args, $notes]); } } } close(IN); sub version_for_sort($) { map { sprintf("%02d", $_) } split(/\./, $_[0]); } # Write Docbook XML output if(defined $docbook_xml_file) { my $out_fh = new IO::File; $out_fh->open(">$docbook_xml_file"); our $intro_title = "API Changes"; our $intro_para = <<"EOT"; This chapter describes the API changes for $package. EOT print_start_chapter_as_docbook_xml($out_fh, $id_prefix.'-changes', $intro_title, $intro_para); print_start_section_as_docbook_xml($out_fh, $id_prefix.'-changes-intro', "Introduction"); print $out_fh <<"EOT"; The following sections describe the changes in the API between versions including additions, deletions, renames (retaining the same number of parameters, types and return value type) and more complex changes to functions, types and enums. EOT print_end_section_as_docbook_xml($out_fh); # Sort by new version, newest first for my $vp (sort { version_for_sort($b->[1]) cmp version_for_sort($a->[1]) } @version_pairs) { my($old_version, $new_version)= @$vp; my $id = to_id($old_version) . "-to-" . to_id($new_version); my $version_pair = $old_version."-".$new_version; print_start_section_as_docbook_xml($out_fh, $id_prefix.'-changes-'.$id, "Changes between $package $old_version and $new_version"); my(@f, @t, @e); @f = @{$new_functions{$version_pair} || []}; @t = @{$new_types{$version_pair} || []}; @e = @{$new_enums{$version_pair} || []}; if(@f || @t || @e) { print_start_section_as_docbook_xml($out_fh, $id_prefix.'-changes-new-'.$id, "New functions, types and enums"); print_functions_list_as_docbook_xml($out_fh, undef, 1, 1, @f); print_types_list_as_docbook_xml($out_fh, undef, 1, 1, @t); print_enums_list_as_docbook_xml($out_fh, undef, 1, 1, @e); print_end_section_as_docbook_xml($out_fh); } @f = @{$deleted_functions{$version_pair} || []}; @t = @{$deleted_types{$version_pair} || []}; @e = @{$deleted_enums{$version_pair} || []}; if(@f || @t || @e) { print_start_section_as_docbook_xml($out_fh, $id_prefix.'-changes-deleted-'.$id, "Deleted functions, types and enums"); print_functions_list_as_docbook_xml($out_fh, undef, 0, 0, @f); print_types_list_as_docbook_xml($out_fh, undef, 0, 1, @t); print_enums_list_as_docbook_xml($out_fh, undef, 0, 1, @e); print_end_section_as_docbook_xml($out_fh); } @f = @{$renamed_functions{$version_pair} || []}; @e = @{$renamed_enums{$version_pair} || []}; if(@f || @e) { print_start_section_as_docbook_xml($out_fh, $id_prefix.'-changes-renamed-'.$id, "Renamed function and enums"); print_renamed_functions_as_docbook_xml($out_fh, undef, "$old_version function", "$new_version function", @f); print_renamed_enums_as_docbook_xml($out_fh, undef, "$old_version enum", "$new_version enum", @e); print_end_section_as_docbook_xml($out_fh); } @f = @{$changed_functions{$version_pair} || []}; @t = @{$changed_types{$version_pair} || []}; if(@f || @t) { print_start_section_as_docbook_xml($out_fh, $id_prefix.'-changes-changed-'.$id, "Changed functions and types"); print_changed_functions_as_docbook_xml($out_fh, undef, "$old_version function", "$new_version function", @f); print_changed_types_as_docbook_xml($out_fh, undef, "$old_version type", "$new_version type", @t); print_end_section_as_docbook_xml($out_fh); } print_end_section_as_docbook_xml($out_fh); } # end pair of old/new versions print_end_chapter_as_docbook_xml($out_fh); $out_fh->close; } # Write Upgrade script output if(defined $upgrade_script_file) { my $out_fh = new IO::File; $out_fh->open(">$upgrade_script_file"); print $out_fh "#!/usr/bin/perl -pi~\n"; for my $vp (@version_pairs) { my($old_version, $new_version)= @$vp; my $version_pair = $old_version."-".$new_version; print $out_fh "# Perl script to upgrade $package $old_version to $new_version\n\n"; print_statement_field_renames_as_perl_script($out_fh); my(@f, @t, @e); @f = @{$deleted_functions{$version_pair} || []}; @t = @{$deleted_types{$version_pair} || []}; @e = @{$deleted_enums{$version_pair} || []}; print_deletes_as_perl_script($out_fh, 'Deleted functions', (map { [ $_->[1], $_->[3] ] } @f)); print_deletes_as_perl_script($out_fh, 'Deleted types', @t); print_deletes_as_perl_script($out_fh, 'Deleted enums', @e); @f = @{$renamed_functions{$version_pair} || []}; @e = @{$renamed_enums{$version_pair} || []}; print_renames_as_perl_script($out_fh, 'Renamed functions', 1, @f); print_renames_as_perl_script($out_fh, 'Renamed enums', 0, @e); @f = @{$changed_functions{$version_pair} || []}; @t = @{$changed_types{$version_pair} || []}; print_changes_as_perl_script($out_fh, 'Changed functions', (map { [ $_->[1], $_->[4], $_->[6] ] } @f)); print_changes_as_perl_script($out_fh, 'Changed types', @t); } # end of version pair loop $out_fh->close; } exit 0; __END__ =head1 NAME process-changes - turn changes TSV into files =head1 SYNOPSIS process-changes [options] PACKAGE-NAME TSV-FILE =head1 OPTIONS =over 8 =item B<--help> Give command help summary. =item B<--docbook-xml> DOCBOOK-XML Set the output docbook XML file =item B<--upgrade-script> UPGRADE-SCRIPT-PL Set the output perl script to upgrade the function and type names where possible. =back =head1 DESCRIPTION Turn a package's changes TSV file into docbook XML. =cut rasqal-0.9.33/scripts/fix-flex.pl0000755000175000017500000001067212434455625013603 00000000000000#!/usr/bin/perl # # Format output generated by flex 2.5.31 # # Usage: # flex -o$output $input # perl fix-flex $output > $tmp # mv $tmp $output # # (C) Copyright 2004-2014 Dave Beckett http://www.dajobe.org/ # (C) Copyright 2004 University of Bristol # my $line_offset = 1; # #line directives always refer to the NEXT line print <<'EOT'; #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif EOT $line_offset += 8; # added 8 lines above to output my $debug = 0; # Lexer symbol prefix such as 'turtle_lexer_' my $prefix = undef; # Current function or undef if out of function my $cur_function = undef; # State for current function for rules to use. my(%fn_state); while(<>) { # find lexer prefix if(!defined($prefix) && /^void\s*(.+?)restart\s*\(.*;$/) { $prefix = $1; warn "$.: Lexer prefix $prefix\n" if $debug > 0; } # Remove generated yy_fatal_error declaration and definition to avoid warnings about unused/non-defined static function # declaration if(/^static void yy_fatal_error\s*\(.*\)\s*\;\s*$/) { $line_offset--; # skipped 1 line next; } # definition if(/^static void yy_fatal_error\s*\(.*\)\s*[^\;]\s*$/) { do { $_=<>; $line_offset--; # skipped 1 line } while(!/^}/); $line_offset--; # skipped 1 line next; } # Replace calls to yy_fatal_error("msg", yyscanner) to YY_FATAL_ERROR("msg") macro s/(^\s*)yy_fatal_error\s*\(\s*(\".*\")\s*,\s*yyscanner\s*\)/$1YY_FATAL_ERROR($2)/; # flex has %option nounistd however it does not work in 2.5.31 # It is safe to add yet another wrapper. if(m%^(\#include \)$%) { $_=<<"EOT"; #ifndef YY_NO_UNISTD_H $1 #endif EOT $line_offset += 2; # added 2 lines to output } # Fix .[ch] line references because we have added lines to it my $line = $. + $line_offset; s/^#line \d+ (\".*\.[ch]\")/#line $line $1/; # Fix signed / unsigned comparison gcc 4.x warning: # int n : in the macro YY_INPUT definition # (size_t)num_to_read : which is silly since num_to_read is an int! s/yyg->yy_n_chars, \(size_t\) num_to_read \)/yyg->yy_n_chars, num_to_read \)/; # Match prefixed functions and a couple of static ones starting yy_ if(!defined($cur_function) && /^.*?((?:${prefix}|yy_)\w+)\s+\((.*)$/) { my($f,$rest)=($1,$2); if($rest !~ /;$/) { $cur_function=$1; warn "$.: Now in $cur_function: $_\n" if $debug > 1; %fn_state=(); } } elsif(defined($cur_function) && /^\}/) { warn "$.: End of $cur_function\n" if $debug > 1; $cur_function = undef; %fn_state=(); } # Fix declaration of signed 'i' operating over range of yy_size_t if($cur_function eq $prefix."_scan_bytes") { s/int i;/yy_size_t i;/; } # Add $prefix_cleanup() call at the end of $prefix_lex_destroy() # find the start of lex_destroy function definition and capture prefix # look for lexer_free(yyscanner, yyscanner) statement within the function and place the cleanup call before it if($cur_function eq $prefix."lex_destroy") { if(/(^\s*)(${prefix}free\s*\(\s*yyscanner\s*,\s*yyscanner\s*\)\s*\;)\s*$/) { $_=<<"EOT"; $1/* clean up leaks if any before freeing yyscanner */ $1${prefix}cleanup(yyscanner); $1$2 EOT $line_offset += 2; # added 2 lines to output } } if($cur_function eq $prefix."_switch_to_buffer" || $cur_function eq $prefix."restart" || $cur_function eq $prefix."push_buffer_state") { if(!exists($fn_state{'seen_ensure'})) { s%(^\s*if\s*\(\s*!\s*)YY_CURRENT_BUFFER(\s*\)\s*\{.*$)%${1}yyg->yy_buffer_stack${2}%; if(m%^\s*${prefix}ensure_buffer_stack\s*\(%) { $fn_state{'seen_ensure'} = 1; } } else { # In condition with whitespace s%(\s+)YY_CURRENT_BUFFER(\s+)%${1}YY_CURRENT_BUFFER_LVALUE${2}%; # In parameter or condition s%([,\(])YY_CURRENT_BUFFER([,\)])%${1}YY_CURRENT_BUFFER_LVALUE${2}%; } } if($cur_function eq 'yy_get_next_buffer') { if(!exists($fn_state{'seen_yyinput'}) && m%^\s*YY_INPUT\(%) { $fn_state{'seen_yyinput'} = 1; } elsif(exists($fn_state{'seen_yyinput'})) { # Remove dead code after YY_INPUT - which is a return NULL s%^\s*YY_CURRENT_BUFFER_LVALUE->yy_n_chars\s*=\s*yyg->yy_n_chars;%%; } } if($cur_function eq $prefix.'pop_buffer_state') { # Change last if use of YY_CURRENT_BUFFER macro to unconditional value s%^(\s*if \(\s*)YY_CURRENT_BUFFER(\s*\)\s*\{.*)$%${1}YY_CURRENT_BUFFER_LVALUE${2}%; } print; } rasqal-0.9.33/ChangeLog.80000644000175000017500000047174011520154176011751 000000000000002010-12-30 Dave Beckett * src/rasqal_expr_strings.c: Count number of Unicode characters not byte length (rasqal_unicode_utf8_strlen): Added to count number of UTF-8 encoded characters in a string. (rasqal_expression_evaluate_strlen): Use above to return strlen * tests/sparql/check-sparql: Handle vars mentioned in select expresssions, partially * src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c: Use rasqal_expression_evaluate_str_prefix_suffix() to implement CONTAINS() * src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: Implement SPARQL 1.1 STRSTARTS() and STRENDS() (rasqal_literals_sparql11_compatible): Added to check literal compatibility for matching according to SPARQL 1.1 draft string matching rules. (rasqal_expression_evaluate_str_prefix_suffix): Added to implement prefix and suffix matching if the literals are compatible. * src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: (rasqal_expression_evaluate_set_case): Added implementing UCASE() and LCASE() for ASCII * src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: (rasqal_expression_evaluate_strlen): Added implementing STRLEN() * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_expr_evaluate.c, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Added tokens and parsing for 7 more SPARQL 1.1 string functions rasqal_op gains: RASQAL_EXPR_STRLEN, RASQAL_EXPR_SUBSTR, RASQAL_EXPR_UCASE, RASQAL_EXPR_LCASE, RASQAL_EXPR_STRSTARTS, RASQAL_EXPR_STRENDS, RASQAL_EXPR_CONTAINS, RASQAL_EXPR_ENCODE_FOR_URI Added SPARQL parsing support for above builtin functions. (rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_expression_compare, rasqal_query_write_sparql_expression, sparql_token_print): Add support (rasqal_expression_evaluate): Add cases to switch with not-implemented. (STRLEN, SUBSTR, UCASE, LCASE, STRSTARTS, STRENDS, CONTAINS, ENCODE_FOR_URI): Added terminal tokens. (SPARQL grammar token StringExpression): Added token * src/rasqal_format_rdf.c: (rasqal_query_results_rdf_init): Only declare raptor_world_ptr for Raptor V2 * src/rasqal_format_rdf.c: (rasqal_query_results_rdf_init): For unknown name, set write format to NULL. * src/rasqal_expr_evaluate.c: remove unused var s * src/rasqal_expr_evaluate.c: Remove regex headers * src/Makefile.am, src/rasqal_expr_datetimes.c, src/rasqal_expr_evaluate.c, src/rasqal_internal.h: Split date and time expression evaluations out into rasqal_expr_datetimes.c * src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: (rasqal_expression_evaluate_langmatches): Added * src/Makefile.am, src/rasqal_expr_evaluate.c, src/rasqal_expr_strings.c, src/rasqal_internal.h: Split string expression evaluations out into rasqal_expr_strings.c * src/rasqal_expr_evaluate.c: Code style * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate): Report eror failure for executing aggregate expressions. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate): Remove unused i * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_bnode_constructor): Added and make it tidy up. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_uri_constructor): Added. * src/rasqal_expr_evaluate.c: Handle IN and NOT_IN with one function (rasqal_expression_evaluate_in_set): Renamed from rasqal_expression_evaluate_in and invert result for NOT_IN. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_in): Added. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_sameterm): Added. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_datatype): Added * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_lang): Added * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_str): Added * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_coalesce): Added. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_if): Added * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_bound): Added. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_istype): Added for checking term types * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_strlang): Added and may even work now. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_strdt): Copy lang string * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_strdt): Added. * src/rasqal_literal.c: docs * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_concat): Added. Preserves literal datatype. * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_datetime_part): Free literal * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_datetime_part): Added Also make TIMEZONE() report an error and fail rather than abort() * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_from_unixtime): Added * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_to_unixtime): Added * src/rasqal_expr_evaluate.c: #ws * src/rasqal_expr_evaluate.c: (rasqal_expression_evaluate_now): Added * src/Makefile.am, src/rasqal_expr.c, src/rasqal_expr_evaluate.c: Move expression evaluate code to new file rasqal_expr_evaluate.c 2010-12-29 Dave Beckett * src/rasqal_expr.c: code style - newline after case break; remove fallthrough * src/rasqal_result_formats.c: (rasqal_get_query_results_formatter_factory): Fix searching by uri * utils/roqet.c: Compile when built with Raptor V1 for now. * src/rasqal.h.in, src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_result_formats.c, src/rdql_parser.y, src/sparql_parser.y: Update factories to use raptor V2 1.9.2+ or internal syntax description * configure.ac: Raptor V2 min version is now 1.9.2 for syntax description changes. 2010-12-28 Dave Beckett * utils/srxread.c: Use rasqal_world_get_query_results_format_description() and print all mime types. * utils/roqet.c: Use rasqal_world_get_query_results_format_description() * src/rasqal_internal.h, src/rasqal_result_formats.c: Set query results format flags in registration (rasqal_world_register_query_results_format_factory): Set desc.flags based on presence/absence of factory methods. Tidy code and rename arg to be register_factory * src/rasqal_format_rdf.c: Copy mime type information from raptor syntax descriptions for Raptor V2 (rasqal_query_results_format_rdf_copy_syntax_description_from_parser): Added to copy mime type static info for RDF query result formats. * src/rasqal.h.in, src/rasqal_result_formats.c: Added method to get syntax description for query results formats (rasqal_world_get_query_results_format_description): Added, deprecating rasqal_query_results_formats_enumerate() and rasqal_query_results_formatter_get_mime_type() * src/rasqal_format_rdf.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Add finish cleanup method for query results formatter context rasqal_query_results_finish_func added for finish method. rasqal_query_results_format_factory gains finish factory method. (rasqal_free_query_results_formatter): Call finish method if present before cleaning up context. rasqal_query_results_format_rdf gains static URIs used for reading (rasqal_query_results_rdf_init, rasqal_query_results_rdf_finish): Allocate and free static URIs. (rasqal_query_results_rdf_write): Use static URIs rather than allocate each time. Use rasqal_query_results_rdf_finish in rdfxml and turtle format cleanup factory methods. * src/Makefile.am, src/rasqal_format_rdf.c, src/rasqal_format_turtle.c: Provide read/write for turtle query results using RDF formatter for reading rasqal_query_results_format_rdf gains read and write format name fields. (rasqal_query_results_rdf_init): Init read and write format name fields based on formatter name used. (rasqal_query_results_rdf_write): Renamed from rasqal_query_results_write_rdf. Use write_format_name from formatter context. (rasqal_rowsource_rdf_process): use read_format_name from formatter context. (rasqal_query_results_rdf_get_rowsource): Renamed from rasqal_query_results_get_rowsource_rdf. (rasqal_query_results_rdfxml_register_factory): Updated for renames above. (rasqal_query_results_turtle_write): Merge turtle writer function into the rdf formatter code. Still preserved since prettier than what raptor does for rdf query results in turtle. (rasqal_query_results_turtle_register_factory): Merged into rdf formatter code and uses rasqal_query_results_rdf_get_rowsource to read turtle query results. l 2010-12-27 Dave Beckett * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rasqal_format_turtle.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Query result formatter gains init method, optional context and pass in formatter Following raptor_parser factory pattern allow each formatter to have some saved state on construction that can be used. Adjust the factory methods to pass in formatter arg to get at formatter->context. rasqal_query_results_init_func typedef added for init function. rasqal_query_results_format_factory gains context_length field and init function. Loses mime_type field that is now handled by factory syntax description. rasqal_query_results_formatter gains context field. (rasqal_new_query_results_formatter2): Allocate context field if needed and call init function if present. (rasqal_free_query_results_formatter): Free context if present. (rasqal_query_results_formatter_get_mime_type): use first mime type string from factory syntax description. (rasqal_query_results_formatter_write, rasqal_query_results_formatter_read): Pass in formatter arg to factory methods. (rasqal_query_results_rdf_init): Added as init function for rdf formatter. * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rasqal_format_turtle.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Remove unused rasqal_query_results_format_factory method reader; rename writer to write * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_rdf.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rasqal_format_turtle.c: Switch query result formats to use static rasqal_query_results_format_factory initialisation * src/rasqal_internal.h, src/rasqal_result_formats.c: Switch rasqal_query_results_format_factory to use a raptor_syntax_description * utils/srxread.c: Show format mime type 2010-12-26 Dave Beckett * src/rasqal_dataset.c: (rasqal_dataset_load_graph_iostream): Handle being called multiple times. * utils/roqet.c, utils/srxread.c: Remove bogus use of feature count for query results format enumeration. * utils/srxwrite.c: Remove SRX branding * utils/srxread.c: Usage message, remove SRX branding * src/rasqal_result_formats.c: (rasqal_query_results_formats_enumerate): set reader flag if get_rowsource is there. 2010-12-26 Dave Beckett * src/rasqal_internal.h, src/rasqal_raptor.c: Make rasqal_raptor_error_handler static again * src/rasqal_dataset.c: rasqal_dataset_raptor_error_handler is static * src/rasqal_dataset.c: (rasqal_dataset_raptor_error_handler): Added for Raptor V1 * src/rasqal_dataset.c: Handle base URI in triple match (if present) * utils/.gitignore: ignore less * src/rasqal_format_sparql_xml.c: crash fix when called on non sparql XML * src/rasqal_format_rdf.c: code tidy * src/rasqal_format_rdf.c: Move RDF formatter to rasqal_dataset internal API * src/Makefile.am: Add rasqal_dataset internal API * src/rasqal_dataset.c, src/rasqal_internal.h: Add rasqal_dataset internal API * src/rasqal_data_graph.c: # code style 2010-12-25 Dave Beckett * src/rasqal_format_rdf.c: Do not build rasqal_query_results_write_rdf for raptor V1 * src/rasqal_format_sparql_xml.c, src/rasqal_literal.c: Allow writing RASQAL_LITERAL_UDT in Turtle and SPARQL XML * src/rasqal_format_rdf.c: Fix rs:resultVariable URI. Serialize RASQAL_LITERAL_UDT * src/rasqal_format_rdf.c: message * src/rasqal_format_rdf.c: Free resource * src/rasqal_format_rdf.c: (rasqal_query_results_write_rdf): Implement writing rdfxml * utils/Makefile.am, utils/rdfr_read.c: Remove rdfr_read example; srxread.c can do it * src/rasqal_format_rdf.c, src/rasqal_internal.h, src/rasqal_raptor.c: Export rasqal_raptor_error_handler() internally * src/Makefile.am, src/rasqal_format_rdf.c, src/rasqal_internal.h, src/rasqal_raptor.c, src/rasqal_result_formats.c: Add RDF Query Results format reading * utils/rdfr_read.c: uri allocation tidy * utils/rdfr_read.c: ws * utils/rdfr_read.c: Add binding iterator. Add get_source/get_target helpers * utils/rdfr_read.c: code tidy * utils/rdfr_read.c: Added (sigh) yet another iterator class. * utils/rdfr_read.c: Added simple iterator * utils/.gitignore, utils/Makefile.am, utils/rdfr_read.c: Add skeleton of code for reading rdf serialized query results * src/rasqal_internal.h, src/rasqal_raptor.c: Make raptor_statement_as_rasqal_triple() available to internal code. 2010-12-22 Dave Beckett * src/sparql_parser.y: Start state is Sparql with Query or Update alternatives. * src/sparql_common.h, src/sparql_parser.y: Split SPARQL 1.1 into sparql11-query, sparql11-update and sparql11 languages struct rasqal_sparql_query_language_s gains flags for sparql_query and sparql11_query plus some comments. Updated SPARQL query grammar tokens to check for sparql_query flag and return error. Updated SPARQL update grammar tokens to reword error message to mention update. (rasqal_sparql11_query_language_register_factory, rasqal_sparql11_update_language_register_factory): Added to register the sparql11-query and sparql11-update names with different descriptions and URIs. 2010-12-20 Dave Beckett * src/rasqal_decimal.c: Restrict decimal as double range to DBL_DIG digits * src/rasqal_decimal.c: Fix XSD decimal formatting to match canonical lexical format. (rasqal_xsd_decimal_as_string): Use appropriate library snprintf and then prune trailing 0s * src/rasqal_decimal.c: Canonical XSD decimal 0 is 0.0 not 0.0E0 * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Canonical xsd:double uses capital E. * src/rasqal_rowsource_having.c: (rasqal_having_rowsource_read_row): Do not rebind row. 2010-12-20 Lauri Aalto * src/rasqal_rowsource_aggregation.c: (rasqal_builtin_agg_expression_execute_step): Fixed debug conditional 2010-12-19 Dave Beckett * src/rasqal_decimal.c: (rasqal_xsd_decimal_as_string): Round to precision digits for MPFR/GMP. * src/rasqal_decimal.c, src/rasqal_rowsource_aggregation.c: MPFR operation return code is rounding not an error code - ignore. Add debugging for agg step values * tests/sparql/check-sparql: Handle SPARQL 1.1 test namespace, sparql11 language and new update types. * tests/sparql/check-sparql: Use GIT * src/rasqal_literal.c: Fix promotion of numerics to decimal (rasqal_new_literal_from_promotion): Promote to decimal via double rather than string values which is both better and more accurate. * src/rasqal_rowsource_aggregation.c: (rasqal_builtin_agg_expression_execute_step): Set error if result is NULL. 2010-12-18 Dave Beckett * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 CONCAT() rasqal_op gains RASQAL_EXPR_CONCAT (rasqal_new_expr_seq_expression): Added, replacing deprecated rasqal_new_coalece_expression (rasqal_new_coalesce_expression): Deprecated for above. Add init/free/print code for CONCAT() Execute concat by evaluating values as strings and building a plain literal. Not clear if it is allowed to work on URIs or what to do with errors; right now it stringify URIs and stops at an expression in the arg with an error. (CoalesceExpression): Use rasqal_new_expr_seq_expression (BuiltInCall): Added CONCAT() support using rasqal_new_expr_seq_expression() 2010-12-16 Dave Beckett * src/rasqal_expr.c: Add new laqrs keywords to rasqal_op_labels * docs/tmpl/section-expression.sgml: Update doc tmpls 2010-12-15 Dave Beckett * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_query_results.c, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y: Add experimental LAQRS NOW()/CURRENT_DATETIME(), FROM_UNIXTIME() and TO_UNIXTIME() builtin functions Added builtins enabled by use of the 'laqrs' query language. NOW()/CURRENT_DATETIME() are synonyms to return an XSD datetime for the current datetime. At the first execution/preparation of the query, the value is set as a constant throughout the life of the query execution. FROM_UNIXTIME() turns an integer value into an XSD DateTime TO_UNIXTIME() turns an XSD DateTime into an integer value. These functions are likely not opposites since they do not take into consideration leap seconds or daylight saving time changes. LAQRS (SPARQL) grammar gains new terminals NOW, CURRENT_DATETIME, FROM_UNIXTIME and TO_UNIXTIME. (DatetimeExtensions) Added to grammar, only allowing the terms when query language is LAQRS. (BuiltInCall): Call above. rasqal_op gains new expressions RASQAL_EXPR_CURRENT_DATETIME, RASQAL_EXPR_NOW, RASQAL_EXPR_FROM_UNIXTIME and RASQAL_EXPR_TO_UNIXTIME. (rasqal_expression_clear, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_expression_is_compare, rasqal_query_write_sparql_expression): Updated all expression functions to handle new expressions operations. (rasqal_expression_evaluate): Execute new operations. * src/rasqal_general.c, src/rasqal_internal.h: Add methods to world class for getting current datetime timeval. (rasqal_world_reset_now): Invalidate any cached current datetime (rasqal_world_get_now_timeval): Get current datetime as a timeval. rasqal_world_s gains a struct timeval now field and a bit flag to know when it is set. * src/rasqal.h.in, src/rasqal_datetime.c: (rasqal_new_xsd_datetime_from_timeval): Added to make a new datetime from struct timeval* * src/rasqal.h.in, src/rasqal_literal.c: (rasqal_new_datetime_literal_from_datetime): Added to make a datetime literal * src/rasqal.h.in, src/rasqal_datetime.c: (rasqal_new_xsd_datetime_from_unixtime): Added to create a datetime from a unix time int 2010-12-14 Dave Beckett * src/rasqal.h.in: autodocs * configure.ac, src/rasqal_datetime.c: Define HAVE_TM_GMTOFF and use to detect this non-portable field of struct tm 2010-12-14 Lauri Aalto * src/rasqal_datetime.c: (rasqal_xsd_datetime_set_from_timeval): Fix compilation errors systems where time_t and struct timeval tv_sec are of different types (e.g. long, int) * src/rasqal_expr.c: (rasqal_expression_evaluate): Init vars.i in any case to keep some optimizing compilers happy 2010-12-13 Dave Beckett * configure.ac, src/rasqal.h.in, src/rasqal_datetime.c: Add datetime to/from unix times and timevals (rasqal_xsd_datetime_set_from_timeval, rasqal_xsd_datetime_set_from_unixtime, rasqal_xsd_datetime_get_as_unixtime, rasqal_xsd_datetime_get_as_timeval): Added. Added automake substitutions so that sys/time.h and/or time.h get include in rasqal.h in order to get the timeval and time_t definitions. * src/rasqal.h.in, src/rasqal_datetime.c: Store full timezone minutes offset in rasqal_xsd_datetime rasqal_xsd_datetime gains timezone_minutes field with sentinel value RASQAL_XSD_DATETIME_NO_TZ when there is no timezone. (rasqal_xsd_datetime_normalize): Normalize timezone to Zulu here. (rasqal_xsd_datetime_parse): Save but do not normalize timezone. (rasqal_xsd_datetime_to_counted_string): Generate none, Zulu or timezone offset setings. 2010-12-12 Dave Beckett * src/rasqal_datetime.c: Fix datetime equals method (rasqal_xsd_datetime_equals): Compare field by field since memcmp fails due to padding bytes. * src/rasqal_datetime.c: Fix rasqal_xsd_datetime_compare comparison order (rasqal_xsd_datetime_compare): Datetime comparison should be negative for dt1 earlier than dt2. * src/rasqal_literal.c: (rasqal_literal_compare): break after datetime compare 2010-12-07 Dave Beckett * src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_expr.c: (rasqal_xsd_datetime_get_seconds_as_decimal): Added * src/rasqal_expr.c: Add "isnumeric" to rasqal_op_labels * src/rasqal_expr.c: Make SECONDS() return decimal correctly * src/sparql_parser.y: Accept datetime accessor builtins (DatetimeBuiltinAccessors): Added (BuiltInCall): Use above as an alternative * src/rasqal_expr.c: Add labels for datetime accessors * src/sparql_parser.y: (BuiltInCall): Initialize isnumeric expression properly. Now works. * src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_literal.c, src/rasqal_query_write.c, src/rasqal_xsd_datatypes.c, src/sparql_lexer.l, src/sparql_parser.y: Added datetime accessor builtin functions: YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS and TIMEZONE rasqal_op gains RASQAL_EXPR_YEAR, RASQAL_EXPR_MONTH, RASQAL_EXPR_DAY, RASQAL_EXPR_HOURS, RASQAL_EXPR_MINUTES, RASQAL_EXPR_SECONDS, RASQAL_EXPR_TIMEZONE. (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_expression_compare, rasqal_query_write_sparql_expression): Added handling for datetime accessor builtins. (rasqal_expression_evaluate): Evaluate datetime accessor builtins mostly returning integer, seconds returns decimal and timezone TBD. rasqal_sparql_op_labels: Add labels for the builtins. (YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS, TIMEZONE): Added tokens to SPARQL grammar * src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_internal.h: rasqal_xsd_datetime functions take/return const char* strings * src/rasqal.h.in: rasqal_data_graph format_type and format_name fields are not const. * src/rasqal_data_graph.c: (rasqal_new_data_graph_common): Replace strncpy with memcpy. * src/rasqal.h.in, src/rasqal_datetime.c, src/rasqal_literal.c: Added equals and compare methods for XSD datetime (rasqal_xsd_datetime_equals, rasqal_xsd_datetime_compare): Added. (rasqal_literal_compare): Use rasqal_xsd_datetime_compare. (rasqal_literal_equals_flags): Use rasqal_xsd_datetime_equals. * src/rasqal.h.in, src/rasqal_literal.c: Add datetime to rasqal literal union Now xsd:dateTime objects use the rasqal_xsd_datetime class and get a new literal union value. (rasqal_literal_set_typed_value): Set value.datetime as well as the string field when a datetime is found. (rasqal_free_literal): Free datetime. * src/rasqal.h.in, src/rasqal_datetime.c: (rasqal_xsd_datetime_to_counted_string): Added. (rasqal_xsd_datetime_to_string): Edit to wrap above * src/rasqal_datetime.c: Split datetime parsing and normalizing (rasqal_xsd_datetime_parse): Renamed from rasqal_xsd_datetime_parse_and_normalize_common and remove call to rasqal_xsd_datetime_normalize() at end. (rasqal_xsd_datetime_parse_and_normalize, rasqal_xsd_date_parse_and_normalize, rasqal_new_xsd_datetime): Update callers to call rasqal_xsd_datetime_parse() and rasqal_xsd_datetime_normalize() in order. * src/rasqal.h.in, src/rasqal_datetime.c: XSD datetime holds microseconds now rasqal_xsd_decimal gains int microseconds field replacing second_frac string. (rasqal_xsd_datetime_parse_and_normalize_common): Fill microseconds field. (rasqal_xsd_datetime_to_string): Format microseconds in result. (main): Adjust tests to allow 4th digit of decimal digits to work. 2010-12-06 Dave Beckett * src/rasqal.h.in, src/rasqal_datetime.c: Added XSD DateTime class to public API Made rasqal_xsd_datetime struct public with public fields. (rasqal_new_xsd_datetime, rasqal_free_xsd_datetime): Added constructor and destructor. (rasqal_xsd_datetime_to_string): Added method to get datetime as canonical string format. * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.22 2010-12-05 Dave Beckett * NEWS.html: 0.9.21 add release notes pointer 2010-12-04 Dave Beckett * Snapshotted rasqal_0_9_21 for 0.9.21 release (GIT ec8c54cccd2cf2fdc716ac90dfb66f5d06b0a138) * INSTALL.html, README.html: update notes encouraging use of release tarballs, more using rasqal sections * docs/tmpl/section-service.sgml: Add section-service descriptions * utils/Makefile.am: Update for moved fix script * docs/.gitignore: Ignore rasqal-fake.i * docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results_formatter.sgml, docs/tmpl/section-triples_source.sgml, docs/tmpl/section-variable.sgml: Update tmpls * Makefile.am, configure.ac, docs/Makefile.am, fix-groff-xhtml, scripts/Makefile.am, scripts/fix-bison, scripts/fix-flex, scripts/fix-groff-xhtml, scripts/fix-gtkdoc-header.pl, src/Makefile.am, src/fix-bison, src/fix-flex: Add scripts dir, move fix* scripts there and fixup gtkdoc-header with fake mechanism like raptor 2010-12-03 Dave Beckett * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_raptor.c, src/rasqal_triples_source.c: Rename rasqal_triple_source_feature to rasqal_triples_source_feature to match other names * src/rasqal.h.in: autodocs * src/rasqal.h.in: Add RASQAL_API for rasqal_expression_compare * src/rasqal_literal.c: rasqal_literal_sequence_equals debug print less * src/rasqal.h.in: Declare RASQAL_RAPTOR_VERSION to record what version of raptor was built with. * configure.ac: Save raptor version that rasqal was built with in RAPTOR_VERSION_DEC 2010-12-02 Dave Beckett * src/rasqal_datetime.c: internal docs * src/rasqal_datetime.c: code style * tests/sparql/aggregate/Makefile.am: Add group-concat-4 files to dist * tests/sparql/aggregate/Makefile.am, tests/sparql/aggregate/group-concat-4.rq, tests/sparql/aggregate/group-concat-4.ttl, tests/sparql/aggregate/manifest.n3: Add group-concat-4* test for GROUP DISTINCT * src/rasqal_rowsource_aggregation.c: Initialise group DISTINCT at start/end of each group (rasqal_aggregation_rowsource_init): Remove init of distinct map (rasqal_aggregation_rowsource_read_row): Destroy/create a distinct map at the group boundaries. * tests/sparql/aggregate/group-concat-2.rq: Test GROUP_CONCAT() with default separator * configure.ac, tests/algebra/Makefile.am, tests/engine/Makefile.am, tests/laqrs/syntax/Makefile.am, tests/rdql/Makefile.am, tests/rdql/testsuite/Makefile.am, tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile.am, tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/aggregate/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/bugs/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/federated/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/sparql11/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, tests/sparql/update/Makefile.am: Use local echo subst vars RECHO* and real echo program * src/rasqal_rowsource_aggregation.c: Add DISTINCTing of aggregate expression results in aggregate expressions. Remove literal_seq from expr_data (rasqal_aggregation_rowsource_read_row): Use rasqal_expression_sequence_evaluate() to make a new sequence of literals each time. If a duplicate is found, do not evaluate a step. * src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_having.c: Make rasqal_expression_sequence_evaluate() return a new seq of literal each time (rasqal_expression_sequence_evaluate): Lose literals_seq argument This was an unused and confusing approach. A new list each time is easier to deal with. Update all callers to rasqal_expression_sequence_evaluate() * src/rasqal_literal.c: Add tests for literal sequence sort map 2010-11-27 Dave Beckett * src/rasqal_map.c: (rasqal_free_map_node): Free key / value only if there is a free handler. * src/rasqal_map.c: (rasqal_free_map_node): Free value properly * src/rasqal_internal.h: Fixes for building with raptor V1 * src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_rowsource_aggregation.c: Added literal sequence sorting support (rasqal_new_literal_sequence_sort_map): Added (rasqal_literal_sequence_sort_map_add_literal_sequence): Added. * src/rasqal_literal.c: (rasqal_literal_sequence_equals): Added * src/Makefile.am, src/rasqal_internal.h, src/rasqal_literal.c: Add rasqal_literal_test 2010-11-25 Dave Beckett * src/rasqal_algebra.c, src/rasqal_engine_sort.c, src/rasqal_internal.h, src/rasqal_map.c: Alter rasqal_map signature to take separate key/value free methods Add new typedef for raptor V1 for raptor_data_print_handler. (rasqal_new_map): Replaces rasqal_kv_free_fn free_fn arg with raptor_data_free_handler free_key_fn and free_value_fn. Remove prototype ifdef for raptor V1/V2. Update all callers of rasqal_new_map(). (rasqal_free_map_node): Pass in map arg down when freeing tree. 2010-11-19 Dave Beckett * src/rasqal_engine_sort.c, src/rasqal_internal.h, src/rasqal_literal.c: Move literal array equals/compare functions to literal module (rasqal_literal_array_compare): Renamed from rasqal_engine_rowsort_compare_literals_sequence - takes two arrays not sequences. (rasqal_literal_array_equals): Renamed from rasqal_engine_rowsort_literal_sequence_equals() - takes two arrays not sequences. * src/Makefile.am, src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_having.c, tests/sparql/aggregate/agg-1.ttl, tests/sparql/aggregate/group-concat-3.rq, tests/sparql/aggregate/group-concat-3.ttl: Add support for SPARQL 1.1 query HAVING rasqal_algebra_node_operator gains new algebra operator RASQAL_ALGEBRA_OPERATOR_HAVING rasqal_algebra_node updated field notes for having to use seq of expressions. (rasqal_new_having_algebra_node): Added. (rasqal_algebra_query_add_having): Added to add a having algebra node to the tree of algebra nodes (rasqal_algebra_having_algebra_node_to_rowsource): Added to turn a having algebra node into a having rowsource. (rasqal_algebra_node_to_rowsource): Call above for RASQAL_ALGEBRA_OPERATOR_HAVING. * src/rasqal_rowsource_groupby.c: (rasqal_groupby_rowsource_read_row): Bind result row to variables. * docs/tmpl/section-variable.sgml: update tmpls 2010-11-17 Dave Beckett * src/rasqal_engine_algebra.c: (rasqal_query_engine_algebra_execute_init): Project before Order By * src/rasqal_rowsource_aggregation.c: Support COUNT(*) and COUNT(expr list) * src/rasqal.h.in: rasqal_variable gains usage field. * src/rasqal_algebra.c, src/rasqal_bindings.c, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_triples.c, src/rasqal_variable.c, src/rdql_parser.y, src/sparql_parser.y: Switch rasqal_variable to sane reference counting model 2010-11-16 Dave Beckett * src/rasqal_format_turtle.c, src/rasqal_internal.h, src/rasqal_literal.c: Improve turtle query results output (rasqal_literal_write_turtle): Added Turtle results format registration uses turtle mime type, no URI Only support variable bindings for Turtle Code style and tidy. * tests/sparql/check-sparql: More carefully make @vars_order from roqet debug output * tests/sparql/aggregate/Makefile.am: Add CLEANFILES * tests/sparql/aggregate/Makefile.am: Add SPARQL_TEST_FILES to dist * tests/sparql/aggregate/Makefile.am, tests/sparql/aggregate/agg-1.ttl, tests/sparql/aggregate/agg-2.ttl, tests/sparql/aggregate/agg-3.ttl, tests/sparql/aggregate/group-concat-1.ttl, tests/sparql/aggregate/group-concat-2.ttl, tests/sparql/aggregate/group-concat-3.ttl, tests/sparql/aggregate/manifest.n3: Add aggregate query execution tests * tests/sparql/check-sparql: Fix detecting variables order with bind-variables. Also add some debug prints * src/Makefile.am, src/rasqal_format_turtle.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Add turtle results format * tests/sparql/check-sparql: Add -i QUERY-LANGUAGE support * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_read_row): Handle doing nothing if input rowsource is empty * src/rasqal_algebra.c, src/rasqal_rowsource_aggregation.c: Remove all uses of rasqal_new_variable_from_variable for now until variable reference counting is sane * src/rasqal_algebra.c: (rasqal_algebra_query_add_modifiers): Do nothing if there are no modifiers * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_read_row): Bind agg value results to variables. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Apply GROUP BY algebra node before aggregation, separate from other modifiers (rasqal_algebra_query_add_group_by): Added, pulled out of rasqal_algebra_query_add_modifiers (rasqal_query_engine_algebra_execute_init): Call above before aggregation node is added. * src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_query_transform.c: Build variable use data and rebuild if query adds a variable in planning (rasqal_query_build_variables_use): Added. (rasqal_query_prepare_common): Call above (rasqal_algebra_query_prepare_aggregates): Call above when aggregate variables are added. * src/rasqal_query_transform.c: (rasqal_query_build_bound_in): Handle being called 2+ times * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): Handle being called 2+ times 2010-11-15 Dave Beckett * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_rowsource_triples.c: Remove bound_in use from triples rowsource (rasqal_new_triples_rowsource): Lose bound_in and size args. (rasqal_algebra_basic_algebra_node_to_rowsource): Do not construct/copy bound_in from query variables. (rasqal_query_get_bound_in_column_for_variable): Added rasqal_rowsoruce_Triples_context loses bound_in and bound_in_size fields. (rasqal_triples_rowsource_init): Do not use above fields but call rasqal_query_get_bound_in_column_for_variable() * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Revert 7038b5a52a555fa19d9cf07ff97a2981a3f5b68e and make tests pass again 2010-11-14 Dave Beckett * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Move bound_in calculation outside algebra node (rasqal_algebra_basic_algebra_node_to_rowsource): Remove creation of bound_in to rasqal_algebra_make_bound_in_for_all_query_variables() (rasqal_algebra_make_bound_in_for_gp): Added containing calculaton for a graph pattern, taking into consideration variable use. (rasqal_algebra_make_bound_in_for_all_query_variables): Added providing old approach of assuming all selected variables are bound in triples. Wrong. rasqal_algebra_node gains bound_in and bound_in_size fields. (rasqal_new_triples_algebra_node): Add bound_in and bound_in_size args. (rasqal_algebra_basic_graph_pattern_to_algebra): Calculate bound_in for basic graph pattern before constructing triples algebra node. (rasqal_algebra_basic_graph_pattern_to_algebra): Free bound_in field. (main): Update test to create test bound_in. * src/rasqal_query_transform.c: Declare a variable bound in a triple only if unbound. (rasqal_query_triples_build_bound_in_internal): Assign column only if not already bound in a triple using test for BOUND_IN_UNBOUND. 2010-11-13 Dave Beckett * src/rasqal_rowsource.c: more debug prints * src/rasqal_internal.h: Use unsigned 1 bit flags in structs rasqal_algebra_aggregate field adding_new_vars_is_error is unsigned 1 bit flag rasqal_rowsource fields finished and generate_group are now unsigned 1 bit flags. * src/rasqal_algebra.c: (rasqal_algebra_extract_aggregate_expression_visit): Ignore non-agg exprs * src/rasqal_algebra.c: (rasqal_algebra_query_add_aggregation): Added * src/rasqal_algebra.c, src/rasqal_internal.h: (rasqal_algebra_extract_aggregate_expressions): Add agg_vars_seq to store variables during aggregation preparation * src/rasqal_algebra.c: debug print * src/rasqal_rowsource_aggregation.c: (rasqal_new_aggregation_rowsource): Copy args exprs_seq and vars_seq * src/rasqal_engine_algebra.c: (rasqal_query_engine_algebra_execute_init): Tidy if rasqal_algebra_query_add_aggregation fails. * src/rasqal_rowsource_project.c: (rasqal_new_project_rowsource): copy input projection sequence. * src/rasqal_variable.c: (rasqal_variable_copy_variable_sequence): Do not free variables in seq. * src/rasqal_rowsource_join.c, src/rasqal_rowsource_triples.c, src/rasqal_rowsource_union.c: autodocs * src/rasqal_algebra.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_query_write.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_rowsequence.c: Code style: use exprs_seq and vars_seq for sequences of expressions and variables * src/rasqal_internal.h, src/rasqal_variable.c: (rasqal_variable_copy_variable_sequence): Added * src/rasqal_internal.h: docs * src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_distinct.c, src/rasqal_rowsource_empty.c, src/rasqal_rowsource_filter.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_project.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c: autodocs 2010-11-12 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_extract_aggregate_expression_visit): Add key:exp, value:var * src/rasqal_algebra.c: (rasqal_algebra_query_prepare_aggregates): Tidy on failures Free ae with rasqal_free_algebra_aggregate if things fail. * src/rasqal_expr.c: (rasqal_expression_convert_aggregate_to_variable): Malloc right size. * src/rasqal_rowsource_aggregation.c: Pass through/sample scalar variable values to output row rasqal_aggregation_rowsource_context gains a sequence of input_values, a counter and a step counter to know when to sample input rows for scalars. (rasqal_aggregation_rowsource_init, rasqal_aggregation_rowsource_finish): Init and free the new sequence. Reset the step count. (rasqal_aggregation_rowsource_ensure_variables): Copy in all input variables and record the count/offset in input_values_count for use later. (rasqal_aggregation_rowsource_read_row): If at first row of group, copy in all values into input_values sequence for use in generating the output row. When generating output row, use those. (main): Update tests to expect input vars/values in output rows 2010-11-11 Dave Beckett * src/rasqal_query_transform.c: (rasqal_query_build_variables_use_map): use row offsets correctly. 2010-11-08 Lauri Aalto * src/rasqal_rowsource_aggregation.c: (rasqal_builtin_agg_expression_execute_step): fixed warning: result may be used before being set 2010-11-07 Dave Beckett * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Return rasqal_algebra_aggregate to engine (rasqal_algebra_query_prepare_aggregates): return rasqal_algebra_aggregate. (rasqal_free_algebra_aggregate): Export internally. (rasqal_query_engine_algebra_execute_init): Update call to above and free returned structure. * src/rasqal_algebra.c: When looking for aggregate expressions, preserve scalar ones (rasqal_algebra_extract_aggregate_expression_visit): Add scalar exprs to agg_exprs list. (rasqal_algebra_query_prepare_aggregates): Debug message when no agg exprs found. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Store sequence of expr + vars in algebra node for aggregation (rasqal_new_aggregation_algebra_node): Change params to be two sequences of expressions and variables. rasqal_algebra_node update docs for AGGREGATION using of sequence fields. 2010-11-06 Dave Beckett * src/rasqal_rowsource_aggregation.c: docs * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_finish): code style * src/rasqal_internal.h, src/rasqal_rowsource_aggregation.c: Aggregate rowsource now operates on seq of input expr/output vars rasqal_aggregation_rowsource_context gains sequence of expression input and sequence of output variables. (rasqal_aggregation_rowsource_finish): Free new seqs. (rasqal_new_aggregation_rowsource): Args now are the two sequences of expressions and variables. * src/rasqal_rowsource_aggregation.c: code style * src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_aggregation.c: Remove func arg/field from aggregation rowsource and rasqal_algebra_node * src/rasqal_expr.c, src/rasqal_internal.h: (rasqal_expression_mentions_aggregate): Added 2010-11-05 Dave Beckett * src/rasqal_rowsource_aggregation.c: Rename builtin_agg struct/methods to rasqal_builtin_agg_expression_execute* * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_init): Request grouping. * src/rasqal_internal.h, src/rasqal_rowsource.c: Allow rowsource users to request groups rasqal_rowsource gains bit flag for marking request. Turn finished flag into bitflag too while here. (rasqal_rowsource_request_grouping): Added to set flag. (rasqal_rowsource_read_row): Synthesise group if not in output row (rasqal_rowsource_read_rows): If seq is returned, check for group ID in first row and if missing, add to rest of rows. If no seq is returned, filter each returned row and set a group ID if missing. * src/rasqal_rowsource_aggregation.c: Add rasqal_agg_expr_data for per-agg expr execution data. rasqal_agg_expr_data added with all data that is per-aggregate expression incuding input: expr, expr_seq (args) and output: variable to write to, sequence of literals and the per-execution data agg_user_data. rasqal_aggregation_rowsource_context loses a bunch of fields to above. Refactor remaining code to add loops around per-expr data, only supporting 1-arg initialising at this time. * src/rasqal_rowsource_aggregation.c: Added rasqal_builtin_aggregation_reset to reset state to avoid finish/init pair 2010-11-04 Dave Beckett * src/rasqal_expr.c: (rasqal_expression_clear): Do not try to clear name field for group_concat. * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_read_row): Free builtin_agg data after result. * docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-triples_source.sgml, src/rasqal_internal.h, src/rasqal_rowsource_groupby.c: Fixes for building with raptor V1 * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_aggregation.c: Alter rowsource aggregation calling convention to take an expression (rasqal_new_aggregation_rowsource): Take an expression; ditch op, parameters, flags. Parameters will return later but is not used now for GROUP_CONCAT() rasqal_algebra_node loses unused/not used used fields op, parameters, flags. (rasqal_new_aggregation_algebra_node): Take an expression; ditch op, paramaters and flags. Parameters will return later but is not used now for GROUP_CONCAT(). Creates or initialises an expression sequence based on the expression passed in. rasqal_aggregation_rowsource_context loses expr_seq_size, op, func and parameters fields. Gains expr field. builtin_agg gains expr field. (rasqal_builtin_aggregation_init): expr param replaces expr_seq, op, parameters. Parameters will return later. (rasqal_aggregation_rowsource_finish): Destroy expr field. Updated test code to make/use an expression for agg testing. (rasqal_algebra_aggregation_algebra_node_to_rowsource): Update calling convention for aggregation rowsource. 2010-11-02 Dave Beckett * src/rasqal_rowsource_aggregation.c: Made GROUP_CONCAT work with fixed ' ' separator. builtin_agg gains stringbuffer and separator (rasqal_builtin_aggregation_init): Init above for group concat. (rasqal_builtin_aggregation_finish): Free stringbuffer. (rasqal_builtin_aggregation_step): At each step, concat the literal string and put a separator before it if not first literal. (rasqal_builtin_aggregation_result): Compute result from stringbuffer. (main): Add group concat test * src/rasqal_engine_algebra.c: (rasqal_query_engine_algebra_execute_init): code tidy * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Pull out more algebra transformations and all take/return nodes (rasqal_algebra_query_add_modifiers): Take and return a node so that the algebra node tree gets modified. (rasqal_algebra_query_add_projection): Added to add projection node to algebra node tree. (rasqal_algebra_query_add_distinct): Added to add distinct node to algebra node tree. (rasqal_query_engine_algebra_execute_init): Call new functions above to transform algebra node tree. * tests/algebra/convert_graph_pattern.c: (main): Add new pulled-out query transforms. code style * src/rasqal_internal.h: rasqal_algebra_aggregate gains error fields * src/rasqal_algebra.c: (rasqal_algebra_replace_aggregate_expressions): Added to transform expression sequences with aggregages. * src/rasqal_algebra.c: (rasqal_algebra_query_prepare_aggregates): Print agg expressions in debugging * src/rasqal_internal.h: rasqal_algebra_aggregate renames project_exprs field to agg_exprs and values are rasqal_expression * src/rasqal_algebra.c: Store aggregate expression in rasqal_algebra_aggregate agg_exprs seq rasqal_algebra_aggregate renames project_exprs field to agg_exprs and values are rasqal_expression (rasqal_algebra_extract_aggregate_expressions): Alter raptor_new_sequence args. * src/rasqal_internal.h: docs * src/rasqal_algebra.c, src/rasqal_internal.h: Introduce internal rasqal_algebra_aggregate (rasqal_free_algebra_aggregate): Added. (rasqal_algebra_query_prepare_aggregates): Dynamically create the rasqal_algebra_aggregate* and free with above. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: (rasqal_algebra_query_prepare_aggregates): Added pulled out of rasqal_algebra_query_to_algebra. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: (rasqal_algebra_query_add_modifiers): Pulled out of rasqal_algebra_query_to_algebra. 2010-11-02 Lauri Aalto * src/rasqal_algebra.c: (rasqal_algebra_query_to_algebra): don't attempt to debugprint query->selects for construct queries 2010-11-01 Dave Beckett * src/rasqal_algebra.c: Add initial code for transforming project expression to handle aggregates struct agg_extract added for handling state during walk of select expression trees. (rasqal_agg_expr_var_compare, rasqal_free_agg_expr_var): Added for support a rasqal_map of k:expression, v:variable when scanning for aggregate expressions. (rasqal_algebra_extract_aggregate_expression_visit): Added as a rasqal_expression tree visit function to do an in-line change of aggregate expressions to new internal variables. (rasqal_algebra_extract_aggregate_expressions): Added to wrap above transformation. (rasqal_algebra_query_to_algebra): Call above with initialised working state and print out result. Free working state. * src/rasqal_expr.c, src/rasqal_internal.h: (rasqal_expression_convert_aggregate_to_variable): Added to do an inplace edit of an expression to replace an aggregate. This feels like a hack but at least it's in one place * src/rasqal_expr.c, src/rasqal_internal.h: (rasqal_expression_is_aggregate): Added * src/rasqal.h.in, src/rasqal_expr.c: (rasqal_expression_compare): Added * src/rasqal_expr.c, src/rasqal_literal.c: Move rasqal_literal_sequence_compare to rasqal_literal.c 2010-10-31 Dave Beckett * tests/sparql/aggregate/data-2.ttl: make ex:year data integer for later numeric testing * src/rasqal_algebra.c: code style * tests/sparql/aggregate/Makefile.am, tests/sparql/aggregate/agg-3.rq, tests/sparql/aggregate/data-2.ttl: Add agg-3.rq GROUP BY test with SAMPLE (lexes, parses, does not execute correctly) * src/sparql_lexer.l: Add SAMPLE * src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_map.c, src/rasqal_rowsource_aggregation.c: Switch aggregation parameters from sequence to map Switch raptor_sequence* parameters to rasqal_map* parameters in aggregation rowsource and algebra node structures and functions. * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h: Start adding algebra nodes for grouping and aggregation rasqal_algebra_node_operator gains RASQAL_ALGEBRA_OPERATOR_GROUP and RASQAL_ALGEBRA_OPERATOR_AGGREGATE rasqal_algebra_node gains fields for aggregation: expr_op, func, parameters and flags. group reuses seq. (rasqal_new_groupby_algebra_node, rasqal_new_aggregation_algebra_node): Added. rasqal_algebra_node_operator_labels gains labels for two new algebra operators. (rasqal_algebra_group_algebra_node_to_rowsource, rasqal_algebra_aggregation_algebra_node_to_rowsource): Added. (rasqal_algebra_query_to_algebra): Use rasqal_new_groupby_algebra_node() when group conditions expression is present to make a group algebra node. (Does not yet do aggregation). (rasqal_algebra_node_to_rowsource): Use rasqal_algebra_group_algebra_node_to_rowsource() and rasqal_algebra_aggregation_algebra_node_to_rowsource(). * src/rasqal_rowsource_aggregation.c: docs * src/rasqal_map.c: code style * src/rasqal.h.in: Fix rasqal_literal_type arg in source header * src/rasqal_rowsource_aggregation.c: (rasqal_builtin_aggregation_step): Fix max/min compare (main): Add tests for final row outputs of aggregations * src/rasqal_literal.c: Fix rasqal_literal_write_type * src/rasqal.h.in, src/rasqal_literal.c: (rasqal_literal_type_label): Added and used for debug prints 2010-10-30 Dave Beckett * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_read_row): Create output row connected to rowsource. * src/rasqal_rowsource_aggregation.c: Add MIN, SUM, AVG, SAMPLE to tests * src/rasqal_row.c: (rasqal_new_row_sequence): Make integer literals from things that strtol() likes i.e. match ^[0-9]$ * src/rasqal_rowsource_aggregation.c: Implement SAMPLE and AVG * src/rasqal_rowsource_aggregation.c: Aggregation works over multiple group inputs rasqal_aggregation_rowsource_context gains last_group_id to know boundaries, saved_row to store a row when a boundary change happens and offset to mark output rows correctly. (rasqal_aggregation_rowsource_init): Move agg init into read_row factory method. Init last_group_id and offset. (rasqal_aggregation_rowsource_finish): Tidy up saved_row if left. (rasqal_aggregation_rowsource_read_row): Restructured to recognize start/end of group boundaries and end of input to know when to init/finish aggregation. Otherwise, read input rows. (main): Make test expect 2 row results as it should be. * src/rasqal_rowsource_aggregation.c: Move literal_seq to a field of rasqal_aggregation_rowsource_context for reuse across groups. * src/rasqal_rowsource_aggregation.c: (rasqal_aggregation_rowsource_read_row): Evaluate expressions to form list of literals for aggregations step. * src/rasqal.h.in, src/rasqal_expr.c: (rasqal_expression_op_label): Added public function (rasqal_expression_write_op, rasqal_expression_print_op): Internal functions just call above. * src/rasqal_internal.h: (rasqal_new_aggregation_rowsource): Add flags arg. * src/rasqal_rowsource_aggregation.c: (rasqal_new_aggregation_rowsource): Add flags arg. 2010-10-28 Dave Beckett * src/rasqal_internal.h, src/rasqal_rowsource_aggregation.c: Initial aggregation rowsource executes There are many issues to fix primarily in the execution steps to use the expression sequence and the issue of what to name the result variable, which the execution engine needs to decide. * src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_groupby.c: Implement get_inner_rowsource rowsource method for groupby and aggregation rowsources * src/Makefile.am, src/rasqal_internal.h, src/rasqal_rowsource_aggregation.c: Add skeleton aggregation rowsource with test that just copies rows through (cat rowsource) * src/rasqal_literal.c: less verbose when debugging * src/rasqal_rowsource_groupby.c: aargh * src/rasqal_format_table.c: (rasqal_query_results_write_table_bindings): Fix for raptor V2 * src/rasqal_rowsource_groupby.c: Make group ID orders work for avltree ordering and raptor V1 sequence ordering * src/rasqal_rowsource_groupby.c: (raptor_avltree_search): compare correctly for raptor * src/rasqal_format_table.c: (rasqal_query_results_write_table_bindings): Remove unused world var 2010-10-28 Lauri Aalto * src/rasqal_query_results.c: (rasqal_query_results_update_bindings): Do not access row values beyond row size 2010-10-27 Dave Beckett * src/rasqal_rowsource_groupby.c: (main): Check number of groups returned is as expected * src/rasqal_rowsource_groupby.c: Add US Senators data test #3 with 2 group by vars, many groups * src/rasqal_expr.c: (rasqal_literal_sequence_compare): Make less debug verbose * src/rasqal_row.c: (rasqal_new_row_sequence): Remove local reference to new literal. * src/rasqal_rowsource_groupby.c: Fix variable ownership and cleanup in tests * src/rasqal_rowsource_groupby.c: Fix groupby rowsource row returning to always return a new row (rasqal_groupby_rowsource_process): Do not copy row, let sequence own it. (rasqal_groupby_rowsource_read_row): Delete row from sequence so reference is passed back. * src/rasqal_rowsource_groupby.c: (Fake raptor_avltree_print): Return int on error * src/rasqal_rowsource_rowsequence.c: (rasqal_rowsequence_rowsource_finish): Free owned vars_seq * src/rasqal_rowsource_groupby.c: Memory tracking (rasqal_groupby_rowsource_finish): Ensure avltree iterator is destroyed (rasqal_groupby_rowsource_process): Copy/take reference to row before saving. * src/rasqal_rowsource_groupby.c: Refactor tests to be data driven * src/rasqal_rowsource_groupby.c: Print out grouping when computed and debugging 2010-10-26 Dave Beckett * src/rasqal_rowsource_groupby.c: Add a fake rasqal_avltree to make groups work for Raptor V1 2010-10-25 Dave Beckett * src/rasqal_internal.h: Added rasqal_row_bind_variables and fixed rasqal_new_groupby_rowsource() * src/rasqal_row.c: (rasqal_row_bind_variables): Added. * src/rasqal_rowsource_groupby.c: GROUP BY rowsource passes unit tests for no grouping / grouping (rasqal_groupby_rowsource_process): Using processed flag to know when to do no work so that when there are no expressions, the group ID is setup. Use rasqal_row_bind_variables() to bind variables from the row into the variables table. Add the node containing rows to the avltree in order to group them. (rasqal_groupby_rowsource_read_row): Handle no expression case as well as avltree/expression list case. (rasqal_new_groupby_rowsource): Add rowsource arg and save it. Tidy error cleanup path. (main): Add test case for no group by expression and one from SPARQL 1.1 query draft * src/rasqal_row.c: Set/show group IDs in rows (rasqal_new_row_common): Set default row group_id to -1 (rasqal_row_print): Print group_id if in range >= 0 * src/rasqal_expr.c: (rasqal_expression_sequence_evaluate): Save a copy/free literal. * src/rasqal_expr.c: (rasqal_expression_sequence_evaluate): Do ignore errors when ignore_errors arg is set. (rasqal_literal_sequence_compare): Docs * src/rasqal_rowsource_groupby.c: Update groupby rowsource to use raptor_avltree for grouping Added typedef rasqal_groupby_tree_node to use as nodes in avltree. (rasqal_free_groupby_tree_node, rasqal_free_groupby_tree_print_node): Added. (rasqal_rowsource_groupby_literal_sequence_compare): Added to compare a sequence of literals in an avltree comparison. (rasqal_groupby_rowsource_init): Init group_id and row offset. (rasqal_groupby_rowsource_finish): Destry input rowsource, avltree if set. (rasqal_groupby_rowsource_ensure_variables): Call input rowsource. (rasqal_groupby_rowsource_process): Added to do the grouping logic - read all input rows, add them to the avltree if new, extend sequence of rows. Initilise an avltree iterator and sequence index. (rasqal_groupby_rowsource_read_row): Call above to ensure group data is there then deliver rows from store using the avltree iterator and sequence index. (rasqal_groupby_new_map): Deleted. * src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_rowsource_groupby.c: (rasqal_expression_sequence_evaluate): Put OUT parameters at end. * src/rasqal_rowsource_groupby.c: Group by rowsource gains map for grouping and map factory method. Added but looks like a raptor_avltree would be better since it allows lookups. (rasqal_groupby_new_map): Added to make a map for grouping. * src/rasqal_expr.c, src/rasqal_internal.h: (rasqal_literal_sequence_compare, rasqal_expression_sequence_evaluate): Added. * src/Makefile.am, src/rasqal_internal.h, src/rasqal_rowsource_groupby.c: Added skeleton of groupby rowsource (rasqal_new_groupby_rowsource): Added taking sequence of expressions. Need to add HAVING conditions and possibly other flags. * src/rasqal_expr.c, src/rasqal_internal.h: (rasqal_expression_copy_expression_sequence): Added 2010-10-21 Lauri Aalto * src/strcasecmp.c: (rasqal_strcasecmp,rasqal_strncasecmp): Fixed gcc "array subscript has type ‘char’" warnings * src/rasqal_query_transform.c: #ws 2010-10-20 Dave Beckett * src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_rowsource_sort.c, src/sparql_parser.y: Move solution modifiers in query from fields to rasqal_modifier fields. rasqal_query loses fields limit, offset, order_conditions_sequence, group_conditions_sequence and having_conditions_sequence. (rasqal_new_query, rasqal_free_query): Do not init/free fields. (rasqal_query_get_limit, rasqal_query_set_limit, rasqal_query_get_offset, rasqal_query_set_offset, rasqal_query_get_order_conditions_sequence, rasqal_query_get_order_condition, rasqal_query_get_group_conditions_sequence, rasqal_query_get_group_condition, rasqal_query_get_having_conditions_sequence, rasqal_query_get_having_condition, rasqal_query_print): Update for field changes and do not access modifier if it is NULL. Adjust docs to note cannot set limit or offset until query is prepared, ie after parsing. (rasqal_algebra_query_to_algebra, rasqal_engine_make_rowsource, rasqal_engine_rowsort_calculate_order_values, rasqal_query_results_execute_with_engine, rasqal_query_results_check_limit_offset, rasqal_query_results_get_count, rasqal_query_results_execute_and_store_results, rasqal_query_build_variables_use_map, rasqal_query_write_sparql_20060406, rasqal_sort_rowsource_init): Use query methods to get limit, offset fields rather than direct access. (SPARQL parser WhereClauseOpt): Return solution modifier and do not write to query fields. 2010-10-19 Dave Beckett * utils/roqet.c: Make dryrun be success (exit 0) * utils/roqet.c: (roqet_init_query): Do not free data graphs here, let main() do it * src/rasqal_service.c: Cleanup allocations (rasqal_free_service): Free object (rasqal_service_content_type_handler): Only check content type for ; or ' ' if not NULL. Code tidy * src/rasqal.h.in, src/rasqal_service.c, utils/roqet.c: rasqal_new_service now takes an optional list of data graphs (rasqal_new_service): Add new raptor_sequence* data_graphs arg. (rasqal_service_execute): Use data graphs to add default-graph-uri and named-graph-uri parameters to the sparql protocol service URI that is resolved. Update roqet to pass in data graphs from command line. * src/rasqal.h.in, src/rasqal_data_graph.c: Add usage counting and copy constructor for rasqal_data_graph rasqal_data_graph gains new int usage field. (rasqal_new_data_graph_from_data_graph): Added (rasqal_new_data_graph_common, rasqal_free_data_graph): Handle usage counts. * utils/roqet.c: # code style 2010-10-18 Dave Beckett * utils/roqet.c: docs * src/rasqal_service.c: Tidy some service function args (rasqal_new_service): Allow NULL query_string. (rasqal_free_service): autodocs (rasqal_service_set_www): autodocs for NULL www (rasqal_service_set_format): autodocs for NULL format * src/rasqal_service.c: Restore local raptor_stringbuffer_append_uri_escaped_counted_string() * utils/roqet.c: Switch to using rasqal_service to execute sparql protocol service * src/rasqal_service.c: Make rasqal_service_execute use correct variables (rasqal_service_execute): Fix aliasing of www var with svc->www. Rename sb to uri_sb for clarity since there is a local and svc stringbuffer in use. * src/Makefile.am, src/rasqal.h.in, src/rasqal_service.c: Added rasqal_service class for executing remote queries Added public rasqal_service Internal typedef rasqal_service_s (rasqal_new_service, rasqal_free_service): Added constructor and destructor. Args will change since no data graphs are passed in yet. (rasqal_service_set_www): Added to set WWW object (rasqal_service_set_format): Added to set request Accept header. (rasqal_service_execute): Added to execute remote query and get back a result set. May need to be changed to use a rowsource for internal execution inside a query for a SPARQL 1.1 SERVICE. * utils/roqet.c: Remove raptor_world* from roqet_call_sparql_service() * utils/roqet.c: Also conditionally define raptor_stringbuffer_append_hexadecimal * configure.ac, utils/roqet.c: Use raptor_stringbuffer_append_uri_escaped_counted_string() when present. (raptor_stringbuffer_append_uri_escaped_counted_string): Defined here if not available in raptor2. * utils/roqet.c: Use HAVE_RAPTOR_STRINGBUFFER_APPEND_HEXADECIMAL to not use internal version. * configure.ac: Add configure test for raptor_stringbuffer_append_hexadecimal() defining HAVE_RAPTOR_STRINGBUFFER_APPEND_HEXADECIMAL * src/rasqal.h.in, src/rasqal_query_transform.c, src/rasqal_variable.c, src/rdql_parser.y, src/sparql_parser.y: Deprecate rasqal_new_variable() and rasqal_new_variable_typed() for rasqal_variables_table_add() (rasqal_new_variable, rasqal_new_variable_typed): Already were calling rasqal_variables_table_add() but add deprecated docs and flag to prototype. Update all callers to use rasqal_variables_table_add(). * utils/roqet.c: Use and allow -p URI and -e QUERY for protocol invocations. * utils/roqet.1: Document -p 2010-10-18 Lauri Aalto * src/rasqal_projection.c: #filename in boilerplate * src/rasqal_query.c: (rasqal_query_add_data_graph): docs: Clarify ownership of passed in data_graphs. 2010-10-17 Dave Beckett * utils/roqet.c: One more raptor_www_free() for Raptor V1 * utils/roqet.c: Use raptor_www_free() for Raptor V1 * utils/roqet.c: Use Raptor V1 or V2 raptor_new_iostream_from_string() call * src/rasqal_format_sparql_xml.c: (rasqal_query_results_write_sparql_xml): One more rasqal_world_simple_error needed * src/rasqal_format_sparql_xml.c: (rasqal_query_results_write_sparql_xml): use rasqal_world_simple_error() for error reporting with Raptor V1 * src/rasqal_general.c, src/rasqal_internal.h: Add rasqal_world_simple_error() to help building with raptor1 and passing errors up without a query * utils/roqet.c: Roqet is a sparql protocol client (roqet_stringbuffer_append_hexadecimal): Added. (roqet_stringbuffer_append_uri_escaped_string): Added to escape a URI string for a query parameter, using above. (roqet_call_sparql_service): Uses above to correctly form the sparql query parameter with encoding. Does not send default or named graph parameters. (main): Fix some cleanups * utils/roqet.c: FIXME note that this isn't calling using sparql protocol yet * utils/roqet.c: Add support for reading from SPARQL protocol services Added -p/--protocol SERVICE-URI Added internal struct roqet_results_write_state (roqet_results_write_bytes, roqet_results_content_type_handler): Added. (roqet_call_sparql_service): Added to call a SPARQL protocol with a query string (optional - not yet used here) against a service URI. (main): Validate that -e and -p are not used together Move -r validation to after result format has been chosen. (I thought I did that already) Add help message and verbose message for sparql protocol -p uses. * src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c: Do not assume a query_results has a query in formatting. (rasqal_query_results_write_table_bindings, rasqal_query_results_write_sparql_xml): Use rasqal_query_results_get_world() to get rasqal world. * src/sparql_parser.y: (BindingsRowList): Set row offset * utils/roqet.c: Add bindings block to query walk using API * src/rasqal.h.in, src/rasqal_query.c: Added API access to bindings variables and rows (rasqal_query_get_bindings_variables_sequence, rasqal_query_get_bindings_variable, rasqal_query_get_bindings_rows_sequence, rasqal_query_get_bindings_row): Added. * src/rasqal_internal.h, src/rasqal_query_write.c: Elimiate graph pattern field where and use existing graph_patterns * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_service): Add again * utils/roqet.c: (roqet_graph_pattern_walk): Print LET variable, GRAPH and SERVICE literals using rasqal public APIs Code tidy: reorder options * src/rasqal.h.in, src/rasqal_graph_pattern.c: (rasqal_graph_pattern_get_service): Added 2010-10-16 Dave Beckett * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/sparql_parser.y: Added SPARQL SERVICE and MINUS syntax and graph pattern support rasqal_graph_pattern_operator gains RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE and RASQAL_GRAPH_PATTERN_OPERATOR_MINUS (rasqal_new_single_graph_pattern): Added. Added service and minus to rasqal_graph_pattern_operator_labels. rasqal_graph_pattern: Document use of origin for service literal and where for MINUS graph pattern. (ServiceGraphPattern, MinusGraphPattern): use rasqal_new_single_graph_pattern() to store service and minus graph patterns. * src/rasqal_bindings.c, src/rasqal_projection.c, src/rasqal_solution_modifier.c: Code style - allow NULL free pointer for destructors (rasqal_free_projection, rasqal_free_solution_modifier, rasqal_free_bindings): Do nothing with NULL reference * src/rasqal_bindings.c: remove unused functions * src/rasqal_bindings.c: rasqal bindings added * configure.ac, src/Makefile.am, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_write.c, src/sparql_parser.y, tests/sparql/Makefile.am, tests/sparql/federated/Makefile.am, tests/sparql/federated/bindings-1.rq, tests/sparql/federated/bindings-2.rq, tests/sparql/federated/bindings-3.rq, tests/sparql/federated/data-1.ttl, tests/sparql/federated/data-2.ttl, tests/sparql/federated/data-3.ttl, tests/sparql/federated/data-4.ttl, tests/sparql/federated/data-5.ttl, tests/sparql/federated/service-1.rq, tests/sparql/federated/service-2.rq: Add SPARQL BINDINGS federated query data structures Added (internal) rasqal_bindings datatype. rasqal_query gains bindings structure. (rasqal_free_query, rasqal_query_print): Handle bindings (rasqal_new_bindings, rasqal_free_bindings, rasqal_bindings_print): Added. (rasqal_query_write_sparql_bindings, rasqal_write_sparql_row): Added for writing bindings. (rasqal_query_write_sparql_20060406): Add SPARQL formatting for BINDINGS Updated SPARQL grammar for full BINDINGS support. (BindingsClauseOpt): Now is a rasqal_bindings type and stores fields properly. (SelectQuery): Store bindings. (VarList): Fixed to not free variables and fix error handling (MinusGraphPattern): Fix comment. Added syntax tests from http://www.w3.org/2009/sparql/docs/fed/service draft in tests/sparql/federated * src/rasqal_raptor.c: RASQAL_RAPTOR_READ_BUFFER_SIZE again * src/rasqal_raptor.c: RASQAL_RAPTOR_READ_BUFFER_SIZE * src/Makefile.am, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_projection.c, src/rasqal_query_write.c, src/sparql_parser.y: Add select projection class Added internal class rasqal_projection to wrap SELECT variables, wildcard flag, distinct/reduced mode. (rasqal_new_projection, rasqal_free_projection, rasqal_projection_get_variables_sequence): Added. rasqal_graph_pattern replace select variables field with a projection. (rasqal_new_select_graph_pattern, rasqal_free_graph_pattern, rasqal_graph_pattern_write_internal): Adjust to use rasqal_projection rather than variable sequence. (rasqal_query_write_sparql_graph_pattern): Adjust to use rasqal_projection_get_variables_sequence() to get select variables for sub SELECT. SPARQL grammar: Add projection to token union (SelectClause, SelectExpressionList): Now return projection. (SelectQuery): Use returned projection object to write old fields in query object. At this point there is very little, if any, writing direct to fields of the query object deep in the SPARQL parse tree, it is mostly to objects passed back. * src/sparql_parser.y: (SolutionModifier): Do not pass in sequences to solution_modifier for now. * src/sparql_parser.y: Remove grammar checks for ASK verb that can never happen (GroupClauseOpt, HavingClauseOpt, LimitOffsetClausesOpt, OrderCondition, LimitClause): Remove checks for group by, having, limit, offset with ASK that will never happen due to the grammar not allowing it. * src/sparql_parser.y: Make limit and offsets pass data up to higher level structures Add limit_offset integer pair and integer int to token union (GroupClauseOpt, HavingClauseOpt, OrderClauseOpt): now return sequences or NULL rather than write to query object. (LimitOffsetClausesOpt): Now returns an int pair in (limit, offset) (LimitClause. OffsetClause): Now return int rather than write to query object. (SolutionModifier): Write group, having, order, limit and offset to query structure. * src/Makefile.am, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_solution_modifier.c, src/sparql_parser.y: Add solution modifier class and use for sub SELECT parsing Add private structure rasqal_solution_modifier with fields for order, group, having, limit and offset for modifying a solution. (rasqal_new_select_graph_pattern): Change last arg to rasqal_solution_modifier* pointer. (rasqal_free_graph_pattern): Free modifier. rasqal_graph_pattern now points to a modifier for sub-SELECT. rasqal_query gains a filed pointing to a modifier (not used yet). (rasqal_free_query): Destroy above. (rasqal_new_solution_modifier, rasqal_free_solution_modifier): Added constructor and destructor for new class. SPARQL parsing token union gains a modifier field. (SolutionModifier): returns a modifier. (SelectQuery, ConstructQuery, DescribeQuery): Store modifier in query modifier field. (SubSelect): Pass modifier to select graph pattern. (SolutionModifier): Construct a modifier object from empty fields for now. * src/sparql_parser.y: (BuiltInCall): FIXME is done - RASQAL_EXPR_ISNUMERIC exists * src/sparql_parser.y: Add support for BINDINGS variables and lists of rows Extended parser token to contain a rasqal_row (BindingsRowList, BindingsRowListOpt): Added as sequences of rasqal_row (BindingValueList): Added as sequence of rasqal_literals (BindingsRow): Added as a rasqal_row (VarList): Added as a sequence of variables (BindingsClause): Rewritten to follow SPARQL 1.1 grammar and construct a sequence of variables and sequence of rows. All are discarded rather than stored for now. * src/sparql_parser.y: Fix BindingsClause defn 2010-10-15 Dave Beckett * tests/sparql/sparql11/Makefile.am, tests/sparql/sparql11/subquery-1.rq, tests/sparql/sparql11/subquery-1.ttl: Add subquery - sub SELECT from SPARQL 1.1 Query 2010-10-14 WD * src/rasqal_query_write.c: (rasqal_query_write_sparql_graph_pattern): Write sub-SELECT except modifiers. * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_print_indent): Improve SELECT GP printing * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_query_transform.c, src/sparql_parser.y: Add start of SELECT graph pattern support rasqal_graph_pattern_operator gains RASQAL_GRAPH_PATTERN_OPERATOR_SELECT rasqal_graph_pattern gains internal fields for variables and where along with temporary void* for modifiers, yet to be implemented. (rasqal_new_select_graph_pattern): Added with new fields for variables and where graph pattern. (rasqal_free_graph_pattern): Free new fields. (rasqal_algebra_select_graph_pattern_to_algebra, rasqal_query_select_build_variables_use_map_in_internal): Added skeleton algebra supports - fail with error. rasqal_graph_pattern_operator_labels gains select label (rasqal_graph_pattern_write_internal): Code style. SPARQL grammar: store select graph pattern for sub SELECT. (rasqal_graph_pattern_write_internal): Print new fields. * src/rasqal.h.in, src/rasqal_query.c, src/sparql_parser.y: Use rasqal_data_graph inside SPARQL parser. (rasqal_query_add_data_graphs): Added to add a list of data graphs in a raptor_sequence Add data_graph to SPARQL token union. (DatasetClauseList, DatasetClauseListOpt): Now raptor_sequence of rasqal_data_graph (DatasetClause): Added, taking a rasqal_data_graph type. (DefaultGraphClause, NamedGraphClause): Now rasqal_data_graph types. (SelectQuery, ConstructQuery, DescribeQuery, AskQuery, DeleteQuery, InsertQuery, LoadQuery): Store data graphs in query object. * tests/engine/rasqal_triples_test.c: Updated tests to use rasqal_new_data_graph_from_uri() * tests/engine/rasqal_graph_test.c: Updated tests to use rasqal_new_data_graph_from_uri() * configure.ac, src/rasqal.h.in, src/rasqal_expr.c, src/rasqal_query_write.c, src/sparql_lexer.l, tests/sparql/Makefile.am, tests/sparql/sparql11/Makefile.am, tests/sparql/sparql11/data-1.ttl, tests/sparql/sparql11/isnumeric-1.rq: Add SPARQL 1.1 isNUMERIC() rasqal_op gains RASQAL_EXPR_ISNUMERIC (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_evaluate, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_query_write_sparql_expression): Added support for RASQAL_EXPR_ISNUMERIC Added sparql11 tests dir with isnumeric-1.rq test 2010-10-14 Dave Beckett * src/sparql_lexer.l, src/sparql_parser.y: Update SPARQL grammar for 1.1 2010-10-14 draft Added new tokens: BINDINGS, UNDEF, SERVICE, MINUS, isNUMERIC (case independent all) Still not added: any property path tokens (SPARQL grammar tokens Path to PathOneInPropertyClass) (sparql_token_print): Print new tokens (SelectQuery): Split into new SelectClause (SubSelect): Added, to be implemented. (BindingsCLauseOpt): Added, to be implemented. (BindingValueList): Added for above. (BindingValue): Added, UNDEF to be implemented maybe. (GroupGraphPattern): Add SubSelect. (GroupGraphPatternSub): Added with old GroupGraphPattern code. (GraphPatternNotTriples): Add MinusGraphPattern and ServiceGraphPattern. (ServiceGraphPattern): Added, to be implemented. (MinusGraphPattern): Added, to be implemented. (BuiltInCall): Accept isNUMERIC, to be implemented in expression code. * src/sparql_parser.y: Remove SPARQL grammar term numbers, keep changing too much 2010-10-13 Lauri Aalto * src/rasqal.h.in: (rasqal_graph_pattern_get_variable): Added RASQAL_API to public API function 2010-10-11 Dave Beckett * src/rasqal.h.in, src/rasqal_graph_pattern.c: Add rasqal_graph_pattern_get_variable to get variable for LAQRS LET graph patterns 2010-10-09 Dave Beckett * utils/roqet.c: Replace internal data_graph with rasqal_data_graph and functions Save a list of rasqal_data_graph from the -s/-D/-G args using rasqal_new_data_graph_from_iostream() and rasqal_new_data_graph_from_uri() then later on use rasqal_query_add_data_graph2() * src/rasqal_raptor.c: (rasqal_raptor_init_triples_source): Set parser base URI from rasqal_data_graph 2010-10-08 Dave Beckett * src/rasqal.h.in, src/rasqal_query.c, src/rdql_parser.y, src/sparql_parser.y, utils/roqet.c: Replace rasqal_query_add_data_graph_from_uri/iostream() with rasqal_query_add_data_graph2() (rasqal_query_add_data_graph2): Added just to append to sequence. (rasqal_query_add_data_graph_from_uri, rasqal_query_add_data_graph_from_iostream): Removed Update rdql and sparql parsers * utils/roqet.c: Add base_uri to roqet data_graph and use for iostream * src/rasqal.h.in, src/rasqal_data_graph.c, src/rasqal_query.c: Add base_uri to rasqal_data_graph and functions for iostream The iostream functions for a data graph need a separate base URI. rasqal_data_graph gains uri field (query_add_data_graph_from_iostream, rasqal_new_data_graph_from_iostream, rasqal_new_data_graph_common, rasqal_free_data_graph): Gain base_uri arg and use/store/free it. (rasqal_data_graph_print): Print base URI 2010-10-07 Dave Beckett * utils/roqet.c: Set fake base URI for now when reading from stdin * src/rasqal_data_graph.c: (rasqal_data_graph_print): Fix print fields * src/rasqal_internal.h, utils/roqet.c: Add support for data graph from stdin to roqet Accept -D/-G/-s with '-' arg to mean use stdin as a source of a data graph. Use rasqal_query_add_data_graph_from_iostream() to set up the data graph. Add an internal data_graph struct to hold flags arg. This is a stopgap, should be able to use rasqal_data_graph here. * src/rasqal_raptor.c: Support data graphs from iostreams via a rasqal_data_graph (rasqal_raptor_parse_iostream): Added internal for raptor V1 to support same feature as raptor V2 raptor_parser_parse_iostream() (rasqal_raptor_init_triples_source): Support parsing from an iostream with no URI using name_uri as base URI * src/rasqal.h.in, src/rasqal_query.c: Added rasqal_query_add_data_graph_from_iostream() wrapping rasqal_new_data_graph_from_iostream() * src/rasqal_raptor.c: (rasqal_raptor_support_feature): Declare support for RASQAL_TRIPLE_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_raptor.c, src/rasqal_triples_source.c: Add rasqal_triples_source_factory API V2: support. RASQAL_TRIPLES_SOURCE_MAX_VERSION now 2 Added enum rasqal_triple_source_feature for factories to respond to. rasqal_triples_source gains support_feature factory method for API V2 (rasqal_triples_source_support_feature): Added internal check method. (rasqal_raptor_init_triples_source): Declare support for API V2 * src/rasqal.h.in: rasqal_data_graph autodocs * src/rasqal_data_graph.c: (rasqal_data_graph_print): Print fix * src/rasqal_data_graph.c: (rasqal_data_graph_print): Support iostream/uri data graphs * src/rasqal.h.in, src/rasqal_data_graph.c: Added rasqal_new_data_graph_from_iostream to get data graphs from non-URIs. rasqal_data_graph gains raptor_iostream field. (rasqal_new_data_graph_common): Added internal function to support all data graph constructors. (rasqal_new_data_graph_from_iostream): Added taking a raptor_iostream arg (shared) using rasqal_new_data_graph_common() (rasqal_new_data_graph_from_uri): Now using rasqal_new_data_graph_common() * src/rasqal_triples_source.c: (rasqal_new_triples_source): Only use init_triples_source if factory API version >=2 2010-10-06 Dave Beckett * src/rasqal.h.in, src/rasqal_data_graph.c, src/rasqal_query.c: Rename rasqal_new_data_graph2() to rasqal_new_data_graph_from_uri() * utils/roqet.c: Rename rasqal_query_add_data_graph2() to rasqal_query_add_data_graph_from_uri() * src/rasqal.h.in, src/rasqal_query.c, src/rdql_parser.y, src/sparql_parser.y: Rename rasqal_query_add_data_graph2() to rasqal_query_add_data_graph_from_uri() * src/rasqal.h.in: Lets assume OSX GCC precompiled headers are working after many years * src/rdql_parser.y, src/sparql_parser.y: Replace calls to rasqal_query_add_data_graph() with rasqal_query_add_data_graph2() * src/rasqal.h.in, src/rasqal_result_formats.c: Added rasqal_query_results_formats_check2() allowing checking for a readable and/or writable result format. (rasqal_query_results_formats_check2): Added with new flags arg, deprecating rasqal_query_results_formats_check. (rasqal_query_results_formats_check): Calls above and deprecated. * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/let4.rq: Add let4 example with a SELECT * 2010-10-04 Dave Beckett * utils/srxread.c, utils/srxwrite.c: Newlines in error messages * utils/srxread.c, utils/srxwrite.c: Provide raptor2 support in example programs srxread.c and srxwrite.c * src/rasqal_raptor.c: (rasqal_raptor_init_triples_source): Fix raptor_world_ptr reference. * utils/roqet.1: Document -F/--format * utils/roqet.c: Re-order help args to be alphabetic * utils/roqet.c: Document -F/--format * src/rasqal_raptor.c: (rasqal_raptor_init_triples_source): Support using parser name * utils/roqet.c: Add -F NAME format arg for specifying data graph formats (main): Add -F support and check it is a legal parser na,e. Use rasqal_query_add_data_graph2() to pass in parser name as format. * src/rasqal.h.in, src/rasqal_data_graph.c, src/rasqal_internal.h, src/rasqal_query.c: Added data graph constructors/helpers that add format args (rasqal_query_add_data_graph2): Added with format args deprecating rasqal_query_add_data_graph() (rasqal_query_add_data_graph): Deprecated for above. (rasqal_new_data_graph2): Added with format args deprecating rasqal_new_data_graph(). (rasqal_new_data_graph): Deprecated for above. * src/rasqal.h.in: Add new data graph format fields to rasqal_data_graph * src/rasqal_data_graph.c, src/rasqal_query_write.c: Add format mime type, name and uri to rasqal_data_graph (rasqal_free_data_graph): Free new fields. (rasqal_data_graph_print): Print new fields (rasqal_query_write_data_format_comment): Add to print new fields to sparql query output as a comment. (rasqal_query_write_sparql_20060406): Use above. 2010-10-03 Dave Beckett * src/rasqal_raptor.c: Make raptor triples source provide new init method init_triples_source (rasqal_raptor_init_triples_source): Added to implement the new triples source factory initialisation. Call the handler with locator and message. (rasqal_raptor_new_triples_source): Rewritten to call rasqal_raptor_init_triples_source() with rasqal_triples_source_error_handler as error handler. (rasqal_raptor_register_triples_source_factory): Indicate this supports triples source factory API v2 * src/rasqal_internal.h: Export rasqal_triples_source_error_handler for internal use * src/rasqal_triples_source.c: Support using new triples source factory init method init_triples_source (rasqal_triples_source_error_handler): Added. (rasqal_new_triples_source): Use above to provide an error handler when making a rasqal triples source. Keep generic error code for V1 triples source factory init method (new_triples_source) * src/rasqal.h.in: Add a way for a triples source factory to return meaningful errors. Added typedef rasqal_triples_error_handler for triples source factory error callback. rasqal_triples_source_factory bumps max API version to 2 and adds new @init_triples_source factory method to replace @new_triples_source allowing an error callback arg. RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION is now 2 * src/sparql_parser.y: (CoalesceExpression): COALESCE is in SPARQL 1.1 2010-10-02 Dave Beckett * tests/sparql/update/Makefile.am: Switch to -i sparql11 * src/sparql_parser.y: Do not register sparql11 name twice * src/rasqal_general.c, src/rasqal_internal.h, src/sparql_parser.y: Separate SPARQL 1.0 and SPARQL 1.1 language names (rasqal_sparql11_query_language_register_factory): Added to register SPARQL 1.1 (rasqal_world_open): Register SPARQL 1.1 with rasqal_sparql11_query_language_register_factory. * src/sparql_parser.y: Use rasqal_language_name_check() to check language and code tidy * utils/roqet.c: code style * src/sparql_common.h, src/sparql_parser.y: Add sparql query language feature flags to separate sparql 1.0, 1.1 and experiments in laqrs rasqal_sparql_query_language_s gains bit flags to replace extended field. Update grammar to use appropriate flags for family language features. Alter some error messages to mention can only be used in LAQRS such as EXPLAIN, COALESCE (rasqal_sparql_query_language_init): Initialise the query language family flags. * src/sparql_parser.y: Update SPARQL and LAQRS query language registrations adding aliases (rasqal_sparql_query_language_register_factory): Updated for new registration model. Adds aliases sparql10 and sparql11 for sparql. (rasqal_laqrs_query_language_register_factory): Added for new registration model but calling same functions as rasqal_sparql_query_language_register_factory * src/rdql_parser.y: (rasqal_rdql_query_language_register_factory): Updated for new registration model. * src/rasqal_query.c: (rasqal_query_get_name, rasqal_query_get_label): Use syntax description fields. * src/rasqal_general.c: Initialise query languages using raptor-style syntax description model (rasqal_world_open): Initialise sequence and re-order initialisation of languages since it's now default-first instead of default-last. (rasqal_free_query_language_factory): Just free query languages sequence now. (rasqal_query_language_register_factory): Updated to just use a callback function to do registration returning int status, and this function returns the factory it makes. Alter logic based on Raptor V2 raptor_world_register_parser_factory() (rasqal_get_query_language_factory): Updated to use sequence and logic based on Raptor V2 raptor_world_get_parser_factory() (rasqal_languages_enumerate): Simplify using query languages sequence. * src/rasqal_internal.h: Add a Raptor V2-style raptor_syntax_description data model to rasqal. For now this requires importing bits of Raptor V2 raptor_syntax_description public API if building with Raptor V1. Specifically, import: typedef raptor_data_free_handler, raptor_type_q and raptor_syntax_description from Raptor rasqal_query_language_factory_s gains world arg and loses name, label, alias, mime_type, uri_string fields. The latter replaced by raptor_syntax_description static. typedef rasqal_query_language_register_factory loses most args and just uses a callback to (sic) call. Return value is the factory. Callback returns an error int. typedef rasqal_world replaces linked list of query languages with a raptor_sequence * src/rasqal_internal.h, utils/roqet.c: Add more Raptor V1 backward compatiblity defines for roqet.c 2010-09-30 Dave Beckett * utils/roqet.c: Set default graph format to "ntriples" again. * utils/roqet.c: (print_formatted_query_results): Move error reporting here * utils/roqet.c: (print_formatted_query_results): Create/destroy formatter here * utils/roqet.c: Delay -r FORMAT checking until result type is known. Fixes Issue#0000388 http://bugs.librdf.org/mantis/view.php?id=388 (print_graph_result): Move graph serializer format checking here. (main): For each result type decide if simple or if formatted * utils/roqet.c: (print_formatted_query_results): Added making formatted query results from code in main() * utils/roqet.c: (print_graph_result): Added making graph results from code in main() * utils/roqet.c: (print_boolean_result_simple): Added with simple boolean results out of main() * utils/roqet.c: (print_bindings_result_simple): Added to refactor out huge main() * NEWS.html, configure.ac, src/rasqal.h.in: Bumped version to 0.9.21 2010-09-24 Dave Beckett * Use AC_LANG_SOURCE for gcc flag test 2010-09-24 Dave Beckett * configure.ac: Use AC_LANG_SOURCE for gcc flag test 2010-08-29 Dave Beckett * LICENSE.html: or any newer versions * utils/Makefile.am: Link srxread and srxwrite using `@RAPTOR_CONFIG@ --libs` approach like roqet. * utils/Makefile.am: Link to raptor2 for utilities Updating approach used in http://bugs.librdf.org/mantis/view.php?id=347 for Raptor V2 2010-08-22 Dave Beckett * Snapshotted rasqal_0_9_20 for 0.9.20 release (GIT 6b842b7e85565693bb8fe7a250710443f8d3a2a3) 2010-08-22 Nicholas J Humfrey * rasqal.rdf.in: Updated repository section to new Git repository on Github * rasqal.rdf.in: Normalised tabs into spaces #ws 2010-08-21 Dave Beckett * README.html, RELEASE.html: Remove links to TODO.html * README.html: words * RELEASE.html: 0.9.20 * NEWS.html: 0.9.20 * src/rasqal_expr.c: (rasqal_expression_evaluate): Return error failure not abort on attempt to evaluate SAMPLE() and GROUP_CONCAT() * TODO.html: Empty document and point at bugs.librdf.org * README.html: requires raptor 1.4.19 * README.html: words - jena RDQL links are all broken; comment out. * LICENSE.html: Link to specific LGPL 2.1 version doc. Wording and formatting * INSTALL.html: words * src/rasqal_general.c: Removed dmalloc support * configure.ac, src/rasqal_internal.h: Removed dmalloc support * docs/rasqal-sections.txt, docs/tmpl/section-expression.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-unused.sgml: Updated docbook tmpls and sections * src/rasqal.h.in, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/sparql_parser.y, tests/sparql/aggregate/Makefile.am, tests/sparql/aggregate/group-concat-1.rq, tests/sparql/aggregate/group-concat-2.rq, tests/sparql/aggregate/group-concat-3.rq: Add support for SPARQL 1.1 HAVING (rasqal_query_get_having_conditions_sequence, rasqal_query_get_having_condition): Added. struct rasqal_query gains new internal field having_conditions_sequence. (rasqal_free_query, rasqal_query_print, rasqal_query_write_sparql_20060406): Handle new sequence of having conditions. (rasqal_query_build_variables_use_map): Scan HAVING expr for variable use. Removes a fixme. (SPARQL parser token HavingClauseOpt): Store having conditions sequence. Removes a fixme. Added teses for above. * src/rasqal_expr.c: (rasqal_new_group_concat_expression): Allow separator to be NULL * src/rasqal.h.in: Add rasqal_new_group_concat_expression header * src/rasqal_expr.c, src/rasqal_query_write.c, src/sparql_lexer.l, src/sparql_parser.y, tests/sparql/aggregate/Makefile.am, tests/sparql/aggregate/group-concat-1.rq: Add full GROUP_CONCAT() syntax and representation support. Added tests/sparql/aggregate/group-concat-1.rq (nothing in spec yet) (rasqal_new_group_concat_expression): Added taking distinct flag, sequence of expressions and literal separator (rasqal_expression_clear, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_query_write_sparql_expression): updated for above change. Fix SPARQL lexer token to be GROUP_CONCAT not GROUPCONCAT. Oops - that's why a test is needed. (SeparatorOpt): Use EQ not '=' which never gets here. (ExpressionList): added for a comma-separated list of expressions. (GroupConcatAggregateExpression): Use ExpressionList and create new expression from rasqal_new_group_concat_expression(). 2010-08-20 Dave Beckett * src/rasqal_engine_algebra.c: Zero out freed node pointer (rasqal_algebra_graph_algebra_node_to_rowsource): After "case #2" when rasqal_free_algebra_node() is called, zap out the pointer. Addresses Issue#0000378 http://bugs.librdf.org/mantis/view.php?id=378 * src/rasqal_rowsource_empty.c: (rasqal_empty_rowsource_ensure_variables): Use to set row width to 0 2010-08-19 Dave Beckett * docs/Makefile.am, src/Makefile.am: Do not ship rasqal.h in tarball since it is system-dependent (raptor2 or not) Add nodist_ before list of installed includes: rasqal.h must be installed but not distributed. Add docs dependency rule for rasqal.h for gtk-doc scanning. * tests/sparql/bugs/353-result.ttl, tests/sparql/bugs/353.ttl: Add bug353 ttl files * tests/sparql/check-sparql: remove debug print 2010-08-18 Dave Beckett * 000-README-GIT.txt: Remove 000-README-GIT.txt intended for old repo * tests/sparql/bugs/353-result.ttl, tests/sparql/bugs/353.rq, tests/sparql/bugs/Makefile.am, tests/sparql/bugs/manifest.ttl: Add test for 353 - currently fails * tests/sparql/check-sparql: Handle RDF graph results type as well as bindings * tests/sparql/check-sparql: debug messages when reading results 2010-08-18 Lauri Aalto * src/rasqal_query_results.c: (rasqal_query_results_update_bindings): Avoid using uninitialized pointer 2010-08-17 Dave Beckett * src/rasqal_algebra.c: Ensure CONSTRUCT sets up variables for projection. (rasqal_algebra_get_variables_mentioned_in): Added to get list of variables mentioned in a construct. (rasqal_algebra_query_to_algebra): For a CONSTRUCT, get the mentioned vars and use those in the projection and free the sequence after. * AUTHORS: Added Lauri Aalto * 000-README-GIT.txt: Moved to GitHub at http://github.com/dajobe/rasqal * README.html: Update for github 2010-08-05 Dave Beckett * src/rasqal_result_formats.c: (rasqal_query_results_formatter_write): document NULL base_uri is allowed 2010-08-04 Dave Beckett * src/rasqal_raptor.c: Update rasqal_raptor_generate_id_handler to handle new raptor generate nodeid API 2010-07-27 Dave Beckett * src/.gitignore: Ignore generated rasqal.h * src/sparql_parser.y: Add VarOrBadVarName state to track deprecated LAQRS .. AS varname ... (SelectTerm): Use VarOrBadVarName for deprecated LAQRS SELECT ... AS varname, instead of the draft SPARQL 1.1 Query SELECT ... AS ?varname (VarOrBadVarName): Added generating a warning for a bare varname. * src/sparql_lexer.l: Restore SPID state after AS and return $, ? and VarName tokens * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/group-by1.rq: Remove group-by1.rq - syntax was never added to sparql 1.1 and this was never in shipped rasqal release * src/sparql_parser.y: Make SELECT AS, HAVING, GROUP_CONCAT with SEPARATOR partially work Added tokens HAVING and SEPARATOR (SelectTerm): Use AS Var not VarName. (SelectExpression): Deleted, SelectQuery uses Expression direct. (AggregateExpression): Add annotations. (SeparatorOpt): Added to handle ; SEPARATOR = "string" for GROUP_CONCAT. (GroupConcatAggregateExpression): Use SeparatorOpt but throw away the string for now - FIXME. (SolutionModifier): Add HavingClauseOpt (GroupCondition): Use AS Var not VarName (HavingCondition): Added, just alias for Constraint. (HavingConditionList): Added as list of HavingCondiiton (HavingClauseOpt): Added for HAVING. Throws away result for now - FIXME. (PrimaryExpression): Add AggregateExpression here; so you can put an aggregate expression such as as SUM() etc. anywhere an expression can go! 2010-07-26 Dave Beckett * src/sparql_lexer.l: Added HAVING, GROUP_CONCAT, SEPARATOR tokens * configure.ac, tests/sparql/Makefile.am, tests/sparql/aggregate/Makefile.am, tests/sparql/aggregate/agg-1.rq, tests/sparql/aggregate/agg-2.rq, tests/sparql/aggregate/bad-1.rq, tests/sparql/aggregate/data-1.ttl: Add SPARQL 1.1 aggregate function tests * src/sparql_lexer.l: Accept ( Expr AS Var ) not ( Expr as VarName ) (AS): Return AS, do not enter SPID state. (SPID state): Deleted * RELEASE.html: words * RELEASE.html: words * words and formatting 2010-07-25 Dave Beckett * src/sparql_parser.y: Allow SPARQL 1.1 UPDATE 2010-06-01 CLEAR GRAPH /DEFAULT * tests/sparql/update/clear-4.rq: CLEAR GRAPH DEFAULT * tests/sparql/update/clear-1.rq: note CLEAR is not legal syntax anymore * tests/sparql/update/Makefile.am, tests/sparql/update/clear-1.rq, tests/sparql/update/clear-2.rq, tests/sparql/update/clear-3.rq, tests/sparql/update/create-1.rq, tests/sparql/update/create-2.rq, tests/sparql/update/delete-1.rq, tests/sparql/update/delete-2.rq, tests/sparql/update/delete-data-1.rq, tests/sparql/update/delete-data-2.rq, tests/sparql/update/delete-insert-1.rq, tests/sparql/update/delete-where-1.rq, tests/sparql/update/delete-where-2.rq, tests/sparql/update/drop-1.rq, tests/sparql/update/drop-2.rq, tests/sparql/update/insert-1.rq, tests/sparql/update/insert-2.rq, tests/sparql/update/insert-data-1.rq, tests/sparql/update/insert-data-2.rq, tests/sparql/update/insert-data-3.rq, tests/sparql/update/insert-data-4.rq, tests/sparql/update/insert-delete-1.rq, tests/sparql/update/load-1.rq, tests/sparql/update/load-2.rq: Updated tests for http://www.w3.org/TR/2010/WD-sparql11-update-20100601/ 2010-05-17 Dave Beckett * rasqal.pc.in: set have_raptor2_api boolean for rasqal pkgconfig 2010-05-16 Dave Beckett * src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_raptor.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_variable.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y, utils/roqet.c: Replace #ifdef RAPTOR_V2_AVAILABLE with #ifdef HAVE_RAPTOR2_API - controlled by configure --enable-raptor2 * src/rasqal_general.c: (rasqal_world_set_log_handler): Enable with HAVE_RAPTOR2_API * src/rasqal_query.c: Stub out raptor1 error handler functions. (rasqal_query_set_fatal_error_handler, rasqal_query_set_error_handler, rasqal_query_set_warning_handler): Declare as stubs * src/rasqal.h.in: When HAVE_RAPTOR2_API, declare raptor1 APIs with void* arg * configure.ac, src/rasqal.h, src/rasqal.h.in: Define HAVE_RAPTOR2_API subst var and alter API depending on raptor2 availability * configure.ac: Add --enable-raptor configure arg Raptor2 is only considered if --enable-raptor2 is given to configure. When raptor2 is present and sufficient, #define HAVE_RAPTOR2_API and add automakefile variable RAPTOR2 * src/rasqal_datetime.c, src/rasqal_decimal.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_raptor.c, src/rasqal_row.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/sparql_lexer.l: code style: replace strncpy with memcpy - never need strncpy zero-checking/filling semantics. * src/rasqal_raptor.c: Update to latest raptor_term blank field structure. 2010-05-03 Lauri Aalto * src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_variable.c, src/rdql_parser.y, src/sparql_parser.y, utils/roqet.c: Ported to raptor2 head - funcptr typedef changes 2010-04-24 Dave Beckett * src/rasqal_data_graph.c, src/rasqal_decimal.c, src/rasqal_expr.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_prefix.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_triple.c, src/rasqal_variable.c: Make all rasqal destructors simply return when given a NULL object pointer. They mostly did this already - just remove macros to make it obvious. * src/rasqal_graph.c: Mark autodocs as INTERNAL 2010-04-16 Dave Beckett * src/rasqal_query_results.c, src/rasqal_result_formats.c: autodocs noting that formatting query results drains them 2010-04-14 Lauri Aalto * src/rasqal_format_table.c: (rasqal_query_results_write_table_bindings): Made function compile on raptor2 again. 2010-04-13 Dave Beckett * docs/tmpl/section-expression.sgml, docs/tmpl/section-general.sgml: Updated docbook tmpls * src/rasqal.h: rasqal_expression_s autodocs * src/rasqal.h: autodocs * src/rasqal.h: autodocs * src/rasqal.h: autodocs * docs/rasqal-sections.txt: Added new funcs * docs/rasqal-sections.txt, src/rasqal.h, src/rasqal_literal.c: rasqal_literal_equals_flags is internal * docs/rasqal-sections.txt: remove unused unused raptor world tokens * docs/rasqal-sections.txt: Added rasqal_new_function_expression2 * src/rasqal.h: rasqal_compare_flags: autodocs do not refer to internal funcs * docs/rasqal-sections.txt: Add rasqal_literal_equals_flags * docs/rasqal-sections.txt: Add new funcs rasqal_world_set_generate_bnodeid_handler rasqal_world_set_default_generate_bnodeid_parameters * src/rasqal_literal.c: (rasqal_new_string_literal): autodocs do not link to internal rasqal_literal_string_to_native * src/rasqal_format_table.c: (rasqal_query_results_write_table_bindings): Remove unused query var. 2010-04-12 Lauri Aalto * src/rasqal_expr.c: (rasqal_expression_evaluate): Pack local vars in union to save some stack. * src/rasqal_format_table.c: #ws 2010-04-11 Dave Beckett * RELEASE.html: 0.9.20 notes 2010-04-11 Nicholas J Humfrey * src/rasqal_format_table.c: Added boolean result support to the Table results format. 2010-04-06 Lauri Aalto * configure.ac, rasqal.pc.in: Proper pkg-config dependencies when built with raptor2. * configure.ac: Support configuring with raptor2. Prefer installed raptor2 over raptor v1. * utils/Makefile.am: Support linking with libraptor2 * utils/roqet.c: Ported to raptor2 git head. Support raptor_syntax_description. 2010-03-31 Dave Beckett * src/rasqal_query_write.c: , * src/rasqal_query_write.c: write a, b not a ,b * src/sparql_parser.y: (RelationalExpression): Add IN and NOT IN * src/rasqal.h, src/rasqal_expr.c: (rasqal_new_set_expression): Added for expr IN/NOT-IN list ops * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/in1.rq: Add IN test * src/rasqal_format_sv.c: T is for TAB * src/rasqal_query_write.c: (rasqal_query_write_sparql_expression): Emit DISTINCT for func * src/rasqal_query_write.c: (rasqal_query_write_sparql_variable): Write ( expr AS var ) * tests/laqrs/syntax/count2.rq, tests/laqrs/syntax/count4.rq: Update expr AS Var format * src/rasqal_expr.c: (rasqal_new_function_expression_common): Fix arg test * configure.ac: fix raptor version test check * src/rasqal_expr.c: (rasqal_expression_evaluate): Implement executing of IN and NOT IN * src/rasqal_expr.c, src/rasqal_query_write.c: Added expression handling for IN and NOT IN - no executing yet. (rasqal_expression_clear, rasqal_expression_evaluate, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_query_write_sparql_expression): Added support for IN and NOT IN (rasqal_expression_visit): Added support for IN and NOT IN; adjusted checking of result values for other forms to ensure visit is truncated on a return value of non-0 * src/rasqal.h: Added expression enums for IN and NOT IN expressions rasqal_op gains RASQAL_EXPR_IN and RASQAL_EXPR_NOT_IN * src/sparql_lexer.l, src/sparql_parser.y: Add NOT and IN tokens to sparql lexer and parser 2010-03-30 Dave Beckett * tests/laqrs/syntax/explain.rq: Adjust to require () around renamed vars * src/sparql_parser.y: Accept ( Expr AS Var ) with required braces in select and group by (SelectTerm): SelectExpression does not include ()s (SelectExpression): Remove optional ()s (GroupCondition): Accept ( Expr AS Var ) and store expression in var field expression. Not totally a good idea, should be a new rename expression probably. * tests/laqrs/syntax/avg1.rq, tests/laqrs/syntax/coalesce1.rq, tests/laqrs/syntax/count1.rq, tests/laqrs/syntax/count3.rq, tests/laqrs/syntax/coverage.rq, tests/laqrs/syntax/group-by1.rq, tests/laqrs/syntax/max1.rq, tests/laqrs/syntax/min1.rq, tests/laqrs/syntax/sum1.rq: Update rename expr as var syntax from latest SPARQL 1.1 draft * src/sparql_parser.y: (GroupCondition): Do not free unused variable $3 - not owned here. * src/rasqal_query_transform.c: Support finding mentioned variables in GROUP BY (rasqal_query_expression_build_variables_use_map): Renamed from rasqal_query_filter_build_variables_use_map_in_internal (rasqal_query_graph_pattern_build_variables_use_map): Rename as above for FILTER expression. (rasqal_query_expression_build_variables_use_map_row): Renamed from rasqal_expression_expr_build_variables_use_map_row (rasqal_query_build_expressions_sequence_use_map_row) Lose unused query arg. (rasqal_query_build_variables_use_map): Tidy code and implement finding mentioned vars in list of GROUP BY expressions. Does not yet find declared EXPR as Var since SPARQL parser doesn't store it anywhere yet. * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/group-by1.rq: Add group-by1.rq for group by conditions * src/sparql_parser.y: (GroupClauseOpt): Do not add group asc/desc to group conditions list. * src/rasqal_expr.c: (rasqal_new_0op_expression): Remove RASQAL_EXPR_GROUP_COND_ASC and RASQAL_EXPR_GROUP_COND_DESC from autodocs * src/rasqal.h: Mark RASQAL_EXPR_GROUP_COND_ASC and RASQAL_EXPR_GROUP_COND_DESC as obsolete. * src/sparql_parser.y: Update for GroupCondition rules. (GroupConditionList): Added list of GroupCondition. (GroupCondition): Added. FIXME: what does Expression AS Var mean in GROUP BY? (GroupClauseOpt): Now a list of GroupConditionList * src/sparql_parser.y: Implement GROUP_CONCAT and SAMPLE and update other builtin agg functions. (AggregateExpression): Added group concat and sample. (ExpressionOrStar): Added pulled out of CountAggregateExpression. (CountAggregateExpression): Simplified duplicate code handling an expression and * in one place. Use rasqal_new_aggregate_function_expression() and set distinct flags. (SumAggregateExpression, AvgAggregateExpression, MinAggregateExpression, MaxAggregateExpression): Use rasqal_new_aggregate_function_expression() and set distinct flags. (GroupConcatAggregateExpression, SampleAggregateExpression): Added using rasqal_new_aggregate_function_expression() and setting distinct flags. * src/rasqal.h, src/rasqal_expr.c: Add rasqal_new_aggregate_function_expression() for built-in aggregate functions (rasqal_new_function_expression_common): Added internal function based on core of rasqal_new_function_expression2 and taking optional arg1 rasqal_expression for internal aggregate functions. (rasqal_new_function_expression2): Rewritten in terms of rasqal_new_function_expression_common. (rasqal_new_aggregate_function_expression): Added. based on rasqal_new_function_expression_common. * src/rasqal.h: autodocs * src/sparql_lexer.l: (sparql_token_print): Handle GROUP_CONCAT and SAMPLE tokens * src/rasqal_expr.c, src/rasqal_query_write.c: Added expression class suport for group_concat() and sample() (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_query_write_sparql_expression): Add support for RASQAL_EXPR_SAMPLE and RASQAL_EXPR_GROUP_CONCAT. (rasqal_expression_evaluate): Add placeholders for group_concat() and sample() evaluation. Do they have any meaning for non-aggregate function evaluation? * src/rasqal.h: Added RASQAL_EXPR_GROUP_CONCAT and RASQAL_EXPR_SAMPLE for SPARQL 1.1 agg functions. * src/sparql_parser.y: Added optional DISTINCT for built-in aggregate functions, setting bitflags. (%union): Added uninteger unsigned int for flags. (DistinctOpt): Moved earlier (CountAggregateExpression, SumAggregateExpression, AvgAggregateExpression, MinAggregateExpression, MaxAggregateExpression, FunctionCall): Add DistinctOpt and set expression flags if present. * src/rasqal.h: Added rasqal_expression_flags for rasqal_expression bitflags * src/rasqal_expr.c: #ws * tests/laqrs/syntax/agg-function-1.rq, tests/laqrs/syntax/agg-function1.rq: Rename test * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/agg-function-1.rq: Test agg function with zero params * tests/laqrs/syntax/function-distinct1.rq: Update to latest draft aggregate function syntax; note example is not real. * src/sparql_parser.y: Start to handle latest draft aggregate function style (DISTINCT + parameters) 2010-03-29 Dave Beckett * src/sparql_parser.y: (FunctionCall): Use rasqal_new_function_expression2 * src/rasqal.h, src/rasqal_expr.c: Added support for sparql 1.1 function parameters and flags. (rasqal_new_function_expression2): Added. (rasqal_new_function_expression): Deprecated for above * src/sparql_parser.y: Add support for function with optional DISTINCT. (DistinctOpt): Added, returning boolean (integer) flag. (FunctionCall): Add new clause for DISTINCT * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/function-distinct1.rq: Added test for function with DISTINCT for sparql 1.1 * src/sparql_parser.y: Add ArgList including braces, rename old ArgList to ArgListNoBraces. 2010-03-28 Dave Beckett * rasqal.spec.in: Updates based on fedora spec - not tested. 2010-03-24 Dave Beckett * src/rasqal_format_html.c, src/rasqal_internal.h: Rewrite in RAPTOR V2 API terms with raptor_xml_escape_string_write Add raptor_xml_escape_string_write for Raptor V1 to older function. * src/rasqal_format_html.c: code style * src/Makefile.am, src/rasqal_format_html.c, src/rasqal_internal.h, src/rasqal_result_formats.c: Add HTML Table results format Applied patch from http://bugs.librdf.org/mantis/view.php?id=360 * src/rasqal_expr.c: (rasqal_expression_evaluate): Implement RASQAL_EXPR_IF * tests/laqrs/syntax/if1.rq: turn into a constant IF expr that can be evaluated at parse time * configure.ac, src/rasqal.h: Update minimum raptor to 1.4.19 so that raptor_world typedef is always available 2010-03-23 Lauri Aalto * src/rasqal.h: Use RAPTOR_V2_AVAILABLE instead of RAPTOR_WORLD_DECLARED (no longer available) to decide whether to declare raptor_world type * src/rasqal_xsd_datatypes.c: Fixed gcc4 warnings about using a char where an int is required * src/sparql_parser.y: (LoadQuery): Allow DEFAULT graphs i.e. NULL graph_uri. * src/rasqal_expr.c: (rasqal_expression_evaluate): Use raptor_world not rasqal_world for raptor_new_uri() 2010-03-22 Dave Beckett * src/sparql_parser.y: (UpdateQuery): Handle WITH URI INSERT DATA * src/rasqal.h: Record deprecated bnodeid functions.Adjust macros. Add RASQAL_DEPRECATED for rasqal_query_set_default_generate_bnodeid_parameters and rasqal_query_set_generate_bnodeid_handler. If RASQAL_DISABLE_DEPRECATED is defined, remove all deprecated prototypes and typedefs. * src/sparql_parser.y: Handle LOAD ... list of DocUris... (INTO GraphUri) (IriRefList): Added to build a raptor_sequence of raptor_uri (LoadQuery): Use IriRefList to iterate over doc uris and make an update operation for each of them. This may not correspond to the actual sparql update semantics, to be determined. If the list-load is one operation, it will need a rasqal_update_operation API change * src/sparql_parser.y: Handle updated SPARQL 1.1 update draft syntax removing GRAPH keyword in update operations, adding DEFAULT keyword * src/sparql_lexer.l: Added DEFAULT token * src/rasqal_expr.c: (rasqal_expression_evaluate): RASQAL_EXPR_BNODE fix for no arg. * src/rasqal_expr.c: Handle BNODE() with NULL expression arg. (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_evaluate, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant): Handle optional arg1 for RASQAL_EXPR_BNODE. * src/rasqal.h, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query.c: Move generate blank node ID functionality to world class and deprecate query class methods rasqal_generate_bnodeid_handler2 added handler typedef taking world arg. rasqal_world gains bnodeid generating parameter fields and handler/user data fields. rasqal_query loses the bnodeid generating parameter fields, renamed to unused1-3. (rasqal_world_set_default_generate_bnodeid_parameters, rasqal_world_set_generate_bnodeid_handler): Added (rasqal_query_set_default_generate_bnodeid_parameters): Deprecated for rasqal_world_set_default_generate_bnodeid_parameters and now is a wrapper for it. (rasqal_query_set_generate_bnodeid_handler): Deprecated but still has to be stored since handler signature is not the same as new rasqal_generate_bnodeid_handler2 typedef. (rasqal_query_generate_bnodeid): Prefer world bnodeid handler, then query handler, then world generate bnodeid functionality. * src/rasqal_general.c: Renamed some internal functions (rasqal_query_default_generate_bnodeid_handler): Renamed from rasqal_default_generate_bnodeid_handler * src/rasqal_general.c: autodocs * src/rasqal.h, src/rasqal_expr.c: Fix rasqal_expression_visit, rasqal_graph_pattern_visit_fn and rasqal_expression_visit_fn docs to match code * src/sparql_parser.y: (BuiltInCall): Handle BNODE() and BNODE(expr) * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/bnode2.rq: Add test for BNODE() with no args * tests/sparql/update/Makefile.am, tests/sparql/update/clear-4.rq, tests/sparql/update/insert-data-2.rq, tests/sparql/update/insert-data-3.rq, tests/sparql/update/insert-data-4.rq, tests/sparql/update/load-3.rq, tests/sparql/update/load-4.rq: Added laqrs / SPARQL 1.1 update draft syntax examples from http://lists.w3.org/Archives/Public/public-rdf-dawg/2010JanMar/0569.html * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/bnode1.rq, tests/laqrs/syntax/strdt1.rq, tests/laqrs/syntax/strdt2.rq: Update laqrs tests for bnode() and strdt() * src/rasqal_expr.c: Implement expression evaluation for IRI, URI, STRLANG, STRDT, BNODE. (rasqal_expression_evaluate): Implement RASQAL_EXPR_IRI, RASQAL_EXPR_URI, RASQAL_EXPR_STRLANG, RASQAL_EXPR_STRDT and RASQAL_EXPR_BNODE. * tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/bnode1.rq, tests/laqrs/syntax/if1.rq, tests/laqrs/syntax/iri1.rq, tests/laqrs/syntax/strdt1.rq, tests/laqrs/syntax/strlang1.rq, tests/laqrs/syntax/uri1.rq: Add LAQRS tests for new LAQRS (draft SPARQL 1.1) expressions * src/rasqal_expr.c, src/rasqal_query_write.c: Add expression support for STRLANG, STRDT, IF, URI, IRI and BNODE. (rasqal_expression_clear, rasqal_expression_visit, rasqal_expression_write, rasqal_expression_print, rasqal_expression_is_constant, rasqal_query_write_sparql_expression): Added cases for new expressions. rasqal_op_labels and rasqal_sparql_op_labels gain labels for new tokens. (rasqal_expression_evaluate): Added dummy support for these expressions, causing a fatal error. * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL lexer/parser for STRLANG, STRDT, IF, IRI, URI and BNODE. * src/rasqal.h: Added operations for IF, URI, IRI, STRLANG, STRDT and BNODE expressions. rasqal_op gains RASQAL_EXPR_IF, RASQAL_EXPR_URI, RASQAL_EXPR_IRI, RASQAL_EXPR_STRLANG, RASQAL_EXPR_STRDT and RASQAL_EXPR_BNODE 2010-03-22 Lauri Aalto * utils/roqet.c: Ported to raptor2 git head. raptor_parser_get_option_count() -> raptor_option_get_count() 2010-03-06 Dave Beckett * src/rasqal.h: Note datetime does not write to literal value * src/rasqal_internal.h: Added prototypes for rasqal_xsd_date_check and rasqal_xsd_date_string_to_canonical * src/rasqal_datetime.c: Adjust normalized xsd:date - no trailing Z * src/rasqal_datetime.c: Fix rasqal_xsd_datetime_parse_and_normalize_common() for dates. Add tests. (rasqal_xsd_datetime_parse_and_normalize_common): Handle day in common code and allow xsd:date to terminate on Z or +/- timezone. (rasqal_xsd_date_to_string): Terminate in Z Add test framework for xsd:date and adjust dateTime tests to check timezones with dates that canonicalize to a different date. * src/rasqal_datetime.c: (main): Rename d var to dt for dateTime * src/rasqal_datetime.c: Add rasqal_xsd_date and xsd:date check, normalization functions rasqal_xsd_date added based on y/m/d from rasqal_xsd_dateTime (rasqal_xsd_date_parse_and_normalize): Added calling rasqal_xsd_datetime_parse_and_normalize_common and copying the result fields over on success. (rasqal_xsd_date_to_string): Added. (rasqal_xsd_date_string_to_canonical): Added. (rasqal_xsd_date_check): Added. * src/rasqal_datetime.c: Start letting rasqal_xsd_datetime_parse_and_normalize_common() handle date (rasqal_xsd_datetime_parse_and_normalize_common): Renamed from rasqal_xsd_datetime_parse_and_normalize and takes is_dateTime boolean arg. If set, checks hour, mins, secs and fractions of secs, otherwise sets that to 12:00:00.00 for xsd:date. (rasqal_xsd_datetime_parse_and_normalize): Call rasqal_xsd_datetime_parse_and_normalize_common with flag set. * src/rasqal_datetime.c: code style 2010-03-04 Dave Beckett * NEWS.html, configure.ac, src/rasqal.h: Bumped version to 0.9.20 * tests/sparql/bugs/352-result.ttl, tests/sparql/bugs/352.rq, tests/sparql/bugs/352.ttl, tests/sparql/bugs/Makefile.am, tests/sparql/bugs/manifest.ttl: Add tests for bug 352 * docs/tmpl/section-general.sgml, docs/tmpl/section-literal.sgml: Update doc tmpls * docs/rasqal-sections.txt: Add rasqal_world_set_log_handler * tests/sparql/.gitignore, tests/sparql/bugs/354-result.ttl, tests/sparql/bugs/354.nt, tests/sparql/bugs/354.rq, tests/sparql/bugs/Makefile.am, tests/sparql/bugs/manifest.ttl: Add sparql bugs dir * configure.ac, tests/sparql/Makefile.am: Add bugs test area and test for Issue#0000354 * src/rasqal_xsd_datatypes.c: code style * src/rasqal.h, src/rasqal_format_json.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_literal.c, src/rasqal_query_results.c, src/rasqal_query_write.c, src/rasqal_xsd_datatypes.c: Added literal type RASQAL_LITERAL_INTEGER_SUBTYPE to let subtypes of xsd:integer work. rasqal_literal_type gains (internal) RASQAL_LITERAL_INTEGER_SUBTYPE to handle literals that are sub-types of xsd:integer - so their parent is always RASQAL_LITERAL_INTEGER and for all other purposes, act as integer. (rasqal_literal_set_typed_value): If type is RASQAL_LITERAL_INTEGER_SUBTYPE, do not rewrite the datatype URI based on the literal type, but assume URI already there and parent type are correct. (rasqal_xsd_datatype_uri_to_type): Recognize when a type URI is found that is a subtype of xsd:integer, set literal type to RASQAL_LITERAL_INTEGER_SUBTYPE. (rasqal_xsd_datatype_is_numeric): Accept RASQAL_LITERAL_INTEGER_SUBTYPE as a numeric type. (rasqal_xsd_datatype_parent_type): Return RASQAL_LITERAL_INTEGER as parent type for RASQAL_LITERAL_INTEGER_SUBTYPE. Update all literal type switches to use RASQAL_LITERAL_INTEGER_SUBTYPE as RASQAL_LITERAL_INTEGER. * src/rasqal_xsd_datatypes.c: code style 2010-03-02 Lauri Aalto * src/rasqal.h, src/rasqal_format_sparql_xml.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query.c, utils/roqet.c: Ported to raptor2 git head while retaining support for raptor1. (rasqal_query_set_fatal_error_handler, rasqal_query_set_error_handler, rasqal_query_set_warning_handler): Flagged out for raptor2. Use rasqal_world_set_log_handler() instead. (rasqal_world_set_log_handler): Added new API function for raptor2 only. (rasqal_rowsource_sparql_xml_context): Flagged out error_handlers. Not needed with raptor2. (rasqal_query_results_get_rowsource_sparql_xml): No need to init error_handlers. raptor2 raptor_new_sax2() takes a raptor_locator*, not error_handlers containing raptor_locator*. (rasqal_world_open): Flagged out error_handlers magic. (rasqal_log_error_varargs): Support raptor2 raptor_log_messages and raptor_log_handlers. (rasqal_log_error): Removed unused internal function declaration. (rasqal_world_s): Flagged out error_handlers. Added support for raptor_log_handlers. (roqet_log_handler): Added. (main): Use raptor2 log_handler in roqet. 2010-02-28 Dave Beckett * src/rasqal_query_results.c: Check for limit and offsets when reading incremental query results (rasqal_query_results_ensure_have_row_internal): When calling the execution factory get_row() method, check the query result limit and offsets are met and select a subsequence of the returned results. Intended to address Issue#000352 but may also be better done with other changes to QE1 to remove it's duplicate limit/offset checking in favour of this check. 2010-02-23 Dave Beckett * src/rasqal_internal.h: Declare rasqal_escaped_name_to_utf8_string with printf format arg. 2010-02-22 Lauri Aalto * src/rasqal_general.c, src/rasqal_internal.h, src/rdql_lexer.l, src/sparql_lexer.l: raptor2 raptor_unicode_utf8_string_put_char(), raptor_unicode_utf8_string_get_char() 2010-02-21 Lauri Aalto * src/rasqal_algebra.c, src/rasqal_format_sparql_xml.c, src/rasqal_general.c, src/rasqal_query.c, src/rasqal_query_test.c, src/rasqal_raptor.c, src/rasqal_row.c, src/rasqal_rowsource_triples.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y, tests/algebra/convert_graph_pattern.c, tests/engine/rasqal_construct_test.c, tests/engine/rasqal_graph_test.c, tests/engine/rasqal_limit_test.c, tests/engine/rasqal_order_test.c, tests/engine/rasqal_triples_test.c, utils/roqet.c: raptor2 raptor_new_uri() with preprocessor macro for raptor1 compatibility * src/rasqal_algebra.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_rowsource.c, tests/algebra/convert_graph_pattern.c, utils/roqet.c: raptor2 raptor_new_iostream_to_file_handle() with preprocessor macro for raptor1 compatibility * src/rasqal_format_json.c, src/rasqal_format_sv.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_query_write.c, src/sparql_parser.y: raptor2 raptor_string_ntriples_write() with preprocessor macro for raptor1 raptor_iostream_write_string_ntriples() compatibility * src/rasqal_feature.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_xsd_datatypes.c: raptor2 raptor_new_uri_from_uri_local_name() with preprocessor macro for raptor1 compatibility * src/rasqal_expr.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rdql_parser.y, src/sparql_parser.y: raptor2 RAPTOR_LOG_LEVEL_WARN with preprocessor macro for raptor1 compatibility * src/rasqal_general.c, src/rasqal_internal.h: raptor_unicode_decode_utf8_char() -> raptor_unicode_utf8_string_get_char() 2010-02-19 Lauri Aalto * src/rasqal_algebra.c, src/rasqal_expr.c, src/rasqal_format_json.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_query_write.c, src/rasqal_rowsource.c, src/rasqal_triple.c, src/rasqal_variable.c, src/sparql_parser.y, tests/algebra/convert_graph_pattern.c: Ported to raptor2 git head. - raptor_iostream_*() - raptor_uri_write() - raptor_new_qname_from_namespace_local_uri() Use preprocessor defines to maintain compatibility with raptor1. 2010-02-18 Lauri Aalto * src/rasqal_literal.c: (rasqal_literal_print): DRY: Use rasqal_literal_write(). (rasqal_literal_print_type): DRY: Use rasqal_literal_write_type(). (rasqal_literal_write): raptor2 raptor_iostream_write_string_ntriples() -> raptor_string_ntriples_write() * utils/roqet.c: updated roqet.c to compile on raptor2 git head * src/sparql_parser.y: (rasqal_sparql_query_language_iostream_write_escaped_counted_string): raptor2 raptor_iostream_write_string_ntriples() -> raptor_string_ntriples_write() * src/rasqal_format_json.c, src/rasqal_format_sv.c: (rasqal_query_results_write_json1,rasqal_query_results_write_sv): raptor2 raptor_iostream_write_string_ntriples() -> raptor_string_ntriples_write() * src/rasqal_query_write.c: (rasqal_query_write_sparql_uri,rasqal_query_write_sparql_literal): raptor2 raptor_iostream_write_qname() -> raptor_qname_write(), raptor_iostream_write_string_ntriples() -> raptor_string_ntriples_write() * src/rasqal_raptor.c: (ordinal_as_uri): Flagged out function needed only with raptor1 * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): raptor2 raptor_parse_uri() -> raptor_parser_parse_uri() 2010-02-16 Lauri Aalto * src/rasqal_result_formats.c: (rasqal_query_results_formatter_write): NULL base_uri is valid. * src/fix-bison: Removed fix-bison %destructor hack. Was required to get the raptor_world* param to raptor_free_uri() - no longer needed. 2010-02-15 Dave Beckett * Snapshotted rasqal_0_9_19 for 0.9.19 release * NEWS.html, RELEASE.html, configure.ac, src/rasqal.h: 0.9.19 * rasqal.pc.in: Restore Requires: raptor ... * README.html: GIT 2010-02-14 Dave Beckett * Snapshotted rasqal_0_9_18 for 0.9.18 release * utils/Makefile.am: Add -lraptor to internal linking of utility and example programs. Added -lraptor to linking roqet, srxread and srxwrite so that on systems where indirect library symbols (here in libraptor) are not automatically found by looking up the base library (here librasqal), the programs work. This should not affect user programs that link with rasqal since they use pkg-config rasqal --libs or rasqal-config --libs both of which add -lraptor. See also Fedora bug 564885 for rasqal https://bugzilla.redhat.com/show_bug.cgi?id=564885 nd http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking https://fedoraproject.org/wiki/UnderstandingDSOLinkChange Fixes Issue#0000347 http://bugs.librdf.org/mantis/view.php?id=347 2010-02-13 Dave Beckett * src/rasqal.h: reorder to put query results methods together * src/rasqal_general.c: 2010 2010-02-12 Dave Beckett * src/rasqal.h: reorder to group query_results functions * src/rasqal_literal.c: (rasqal_literal_as_node): Return NULL rather than reswitch and die. * src/rasqal_literal.c: autodocs * src/rasqal_literal.c: (rasqal_literal_as_node): Let reswitch - variable values return a NULL value for an unbound variable. * src/sparql_lexer.l: (sparql_copy_string_token): copy language NUL * src/sparql_lexer.l: code style * src/rdql_lexer.l: code style * src/rasqal_prefix.c: add includes * src/Makefile.am: Add rasqal_prefix.c to lib * src/rasqal_result_formats.c: code style * src/rasqal_expr.c, src/rasqal_prefix.c: Move rasqal_prefix class to rasqal_prefix.c * src/Makefile.am, src/rasqal_data_graph.c, src/rasqal_expr.c: Move rasqal_data_graph class to rasqal_data_graph.c * src/Makefile.am, src/rasqal_expr.c, src/rasqal_triple.c: Move rasqal_triple class to rasqal_triple.c * ChangeLog, ChangeLog.7, Makefile.am: Add ChangeLog.7 for 2009 * .gitignore: do not ignore ChangeLog 2010-02-12 Lauri Aalto * .gitignore: ignore *.stackdump files * src/rasqal_general.c: raptor2 compatible rasqal_log_level_labels * src/rasqal_query_results.c: (rasqal_query_results_get_triple): break out of switch properly with raptor2. * tests/algebra/convert_graph_pattern.c, tests/engine/rasqal_construct_test.c, tests/engine/rasqal_graph_test.c, tests/engine/rasqal_limit_test.c, tests/engine/rasqal_order_test.c, tests/engine/rasqal_triples_test.c: Ported test code to raptor2 git HEAD with RAPTOR_V2_AVAILABLE flagging. * src/rasqal_algebra.c: raptor2 raptor_new_sequence() compatibility in test code. * utils/roqet.c: Ported roqet to raptor2 git HEAD with RAPTOR_V2_AVAILABLE flagging. * src/rdql_lexer.l, src/rdql_parser.y: RDQL parser/lexer: raptor2 raptor_uri calls * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): raptor2 statement_handler, generate_id_handler settings. Removed error_handler setting. (rasqal_raptor_statement_handler): Signature changed to accept non-const raptor_statement for raptor2. (rasqal_raptor_error_handler): Flagged out as unneeded with raptor2. * src/rasqal_raptor.c: (rasqal_raptor_error_handler): raptor2 raptor_locator_format() * src/rasqal_raptor.c: (raptor_statement_as_rasqal_triple): raptor2 compatible variant of the function 2010-02-11 Lauri Aalto * src/rasqal_raptor.c: (rasqal_raptor_new_triples_source): raptor2 raptor_new_parser() call * src/rasqal_algebra.c, src/rasqal_expr.c, src/rasqal_format_json.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_sv.c, src/rasqal_general.c, src/rasqal_query.c, src/rasqal_query_test.c, src/rasqal_query_write.c, src/rasqal_result_formats.c, src/rasqal_row.c, src/rasqal_rowsource.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_rowsequence.c, src/rasqal_rowsource_sort.c, src/rasqal_rowsource_triples.c, src/rasqal_variable.c, src/rasqal_xsd_datatypes.c, src/rdql_lexer.l, src/rdql_parser.y, src/sparql_lexer.l, src/sparql_parser.y: Work-in-progress to make rasqal compile with raptor2 git HEAD (with RAPTOR_V2_AVAILABLE defined). Changed RAPTOR_LOG_LEVEL_WARNING to RAPTOR_LOG_LEVEL_WARN Changed function call args: * raptor_uri calls * raptor_print_locator() -> raptor_locator_print() * raptor_new_sequence(): raptor_sequence_{free,print}_handler -> raptor_data_..._handler * raptor_qname_string_to_uri() * tests/.gitignore: ignore roqet.tmp in tests 2010-02-10 Dave Beckett * src/rasqal_literal.c: (rasqal_literal_divide): Make decimal division call rasqal_xsd_decimal_divide() not add! * src/Makefile.am, src/rasqal_formula.c, src/rasqal_literal.c: Added rasqal_formula.c for rasqal_formula class code * src/rasqal_variable.c: Revert "(rasqal_new_variable_from_variable): Do not copy NULL expression" This reverts commit 124173f9eddde4a57ed184ebd650418503d53e5b. * src/rasqal_rowsource_join.c: Revert "(rasqal_new_join_rowsource): Do not copy a NULL expr" This reverts commit f9e92a72533cd8432c78175e0d65dce3392951da. * src/rasqal_expr.c: (rasqal_new_expression_from_expression): Allow NULL arg again for the sake of code simplicity. * src/rasqal_variable.c: Revert "(rasqal_new_variable_from_variable): Do not try to copy NULL literal pointer." This reverts commit b1df8da1d6fadab183457ead62ab019eccde81ec. * src/rasqal_literal.c: (rasqal_new_literal_from_literal): Allow NULL arg again for the sake of code simplicity. * src/rasqal_variable.c: (rasqal_new_variable_from_variable): Do not try to copy NULL literal pointer. * src/rasqal_literal.c: More assertions for NULL args for literal class. Tidied internal autodocs. * src/rasqal_literal.c: (rasqal_new_decimal_literal_from_decimal): Remove assertions already checked in code * src/rasqal_literal.c: casts for literal class arg checking * src/rasqal_internal.h, src/rasqal_literal.c, src/sparql_parser.y: rasqal_new_formula() gains a world arg. * src/rasqal_literal.c: Code style: use var = ... calloc ( ... sizeof(*var) ) * docs/tmpl/section-row.sgml, docs/tmpl/section-variables-table.sgml: doc words * docs/rasqal-docs.xml, docs/rasqal-sections.txt, docs/tmpl/section-query_results.sgml, docs/tmpl/section-row.sgml, docs/tmpl/section-variable.sgml, docs/tmpl/section-variables-table.sgml: Update docs to add row and variables-table sections and new functions * src/rasqal_query_results.c: (rasqal_query_results_add_row): This is public. autodocs and check params 2010-02-10 Lauri Aalto * .gitignore: ignore .libs, *.exe * src/rasqal_raptor.c: raptor_uri * src/rasqal_query_results.c: (rasqal_query_results_get_triple): Construct raptor_statement using v2 raptor_terms. (rasqal_new_query_results): Init static raptor_statement. (rasqal_free_query_results): Free terms owned by static raptor_statement. 2010-02-09 Lauri Aalto * src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_expr.c, src/rasqal_feature.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_general.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c, src/rasqal_query_write.c, src/rasqal_raptor.c, src/rdql_lexer.l, src/sparql_lexer.l: Work-in-progress to make rasqal compile with raptor2 git HEAD (with RAPTOR_V2_AVAILABLE defined). (rasqal_escaped_name_to_utf8_string): Changed internal function signature to be compatible with both raptor1 and raptor2. (rasqal_query_results_get_triple): Construct raptor_statement using v2 raptor_terms. (rasqal_new_query_results): Init static raptor_statement. (rasqal_free_query_results): Free terms owned by static raptor_statement. Changed RAPTOR_LOG_LEVEL_WARNING to RAPTOR_LOG_LEVEL_WARN Changed function call args: * raptor_new_namespaces() * raptor_new_xml_writer() * raptor_new_qname(), raptor_new_qname_from_namespace_local_name() * raptor_qname_string_to_uri() * raptor_error_handlers_init() * raptor_new_sax2() * raptor_new_iostream_to_string(), raptor_new_iostream_to_file_handle() * raptor_uri calls * raptor_print_ntriples_string() * raptor_new_sequence(), raptor_sequence_{free,print}_handler -> raptor_data_..._handler * src/rasqal_general.c, src/rasqal_internal.h, src/rdql_lexer.l, src/sparql_lexer.l: (rasqal_escaped_name_to_utf8_string): Changed internal function signature to be compatible with both raptor1 and raptor2. 2010-02-09 Dave Beckett * src/rasqal_expr.c: (rasqal_new_prefix): Allow NULL prefix * src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern_from_sequence): Allow NULL graph_patterns seq. * src/rasqal_variable.c: (rasqal_new_variable_from_variable): Do not copy NULL expression value. * src/rasqal_expr.c: (rasqal_expression_evaluate): Allow locator arg to be NULL. * src/rasqal_rowsource_join.c: (rasqal_new_join_rowsource): Do not copy a NULL expr * src/rasqal_expr.c, src/rasqal_graph_pattern.c, src/rasqal_result_formats.c: Add a lot of assertions for validating parameters are not NULL. * src/rasqal_feature.c, src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_query.c, src/rasqal_query_results.c: Add a lot of assertions for validating parameters are not NULL. * tests/.gitignore: Ignore test output junk * utils/.gitignore: Ignore example exes * src/rasqal_format_json.c: (rasqal_query_results_write_json1): Work when query is NULL and take world from query results. * src/rasqal_internal.h, src/rasqal_query_results.c: Add rasqal_query_results_get_world() * utils/Makefile.am: Add examples target * utils/Makefile.am: Added srxwrite example to create a query results via API and write it * utils/srxwrite.c: Added srxwrite example to create a query results via API and write it * src/rasqal_query_results.c: (rasqal_query_results_get_binding_name): Use variables table to get projection order if there is no query * src/rasqal_format_sparql_xml.c, src/rasqal_row.c: Change rasqal_row_set_value_at semantics to copy the passed-in literal. (rasqal_row_set_value_at): Free any existing literal and copy the literal given. Update all callers to above semantics. * src/rasqal.h, src/rasqal_row.c, src/rasqal_rowsource_assignment.c, src/rasqal_rowsource_graph.c, src/rasqal_rowsource_join.c, src/rasqal_rowsource_project.c: Give row construct a world parameter like other constructors (rasqal_new_row_for_size): Gains world param. (rasqal_new_row_common): Gains world parameter. Update all callers. 2010-02-08 Lauri Aalto * src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_string_to_native): Deleted error_handler, error_data args from internal function - not used. * src/rasqal_format_sparql_xml.c: (rasqal_query_results_get_rowsource_sparql_xml): Removed redundant call to raptor_sax2_set_characters_handler(). * src/rasqal_algebra.c, src/rasqal_engine.c, src/rasqal_engine_sort.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_map.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c: raptor_new_sequence(), raptor_sequence_{free,print}_handler -> raptor_data_..._handler * src/rasqal_literal.c: raptor_qname_string_to_uri() * src/rasqal_literal.c: raptor_print_ntriples_string() * src/rasqal_internal.h, src/rasqal_literal.c: (rasqal_literal_string_to_native): Deleted error_handler, error_data args from internal function - not used. * src/rasqal_algebra.c, src/rasqal_graph_pattern.c: raptor_new_iostream_to_file_handle() * src/rasqal_expr.c, src/rasqal_feature.c, src/rasqal_format_sparql_xml.c, src/rasqal_general.c, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_query_write.c: raptor_uri * src/rasqal_format_table.c: raptor_new_iostream_to_string() * src/rasqal_format_sparql_xml.c: (rasqal_query_results_get_rowsource_sparql_xml): Removed redundant call to raptor_sax2_set_characters_handler(). * src/rasqal_format_sparql_xml.c: raptor_new_sax2() * src/rasqal_format_sparql_xml.c: raptor_error_handlers_init() * src/rasqal_format_sparql_xml.c: raptor_new_qname_from_namespace_local_name() * src/rasqal_format_sparql_xml.c: raptor_new_qname() * src/rasqal_format_sparql_xml.c: raptor_new_xml_writer() * src/rasqal_format_sparql_xml.c, src/rasqal_query.c, src/rasqal_query_write.c: raptor_new_namespaces() * src/rasqal_expr.c, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c: RAPTOR_LOG_LEVEL_WARNING -> RAPTOR_LOG_LEVEL_WARN * src/rasqal_internal.h: raptor_simple_message_handler -> raptor_message_handler 2010-02-08 Dave Beckett * src/rasqal.h, src/rasqal_internal.h, src/rasqal_variable.c: Export rasqal_variables_table_add to public API. * utils/srxread.c: Use only public API. * src/rasqal.h, src/rasqal_internal.h, src/rasqal_query_results.c, src/rasqal_row.c, src/rasqal_variable.c: Export to public API functions and structs to allow creating standalone results rasqal_variables_table added to public API (opaque struct) rasqal_new_variables_table() and rasqal_free_variables_table() added to public API to make a variables table and free it. rasqal_query_results_type enum added to public API for use with rasqal_new_query_results(). rasqal_new_query_results() added to public API to create a static query result set. rasqal_query_results_add_row() added to public API to add a row to a static query result set. Adjust to return a failure status. rasqal_new_row_for_size(), rasqal_free_row() and rasqal_row_set_value_at() added to public API to make a row with literal values. Add docs plus argument and offset checking to rasqal_row_set_value_at(). * utils/srxread.c: #ws * utils/srxread.c: Use rasqal_new_query_results_formatter2 * docs/rasqal-docs.xml, docs/tmpl/section-data.sgml, docs/tmpl/section-expression.sgml, docs/tmpl/section-graph_pattern.sgml, docs/tmpl/section-literal.sgml, docs/tmpl/section-prefix.sgml, docs/tmpl/section-query.sgml, docs/tmpl/section-query_results.sgml, docs/tmpl/section-query_results_formatter.sgml, docs/tmpl/section-triple.sgml, docs/tmpl/section-updates.sgml, docs/tmpl/section-variable.sgml: Updated doc templates. Added section updates. * src/rasqal.h: rasqal_update_operation - autodocs for flags * src/rasqal_expr.c: rasqal_prefix_print - autodocs * docs/rasqal-sections.txt: Add section-updates * src/rasqal_query_results.c: autodocs * src/rasqal.h, src/rasqal_query_results.c: Added query read and write functions with name, mime type and format args. (rasqal_query_results_write2, rasqal_query_results_read2): Added with new name and mime_type args deprecating versions without the 2 suffix. * src/rasqal_query_results.c: Use rasqal_new_query_results_formatter2 in query results read/write methods. (rasqal_query_results_write, rasqal_query_results_read): Use rasqal_new_query_results_formatter2 with NULL name and mime type args. * utils/roqet.c, utils/srxread.c: Use rasqal_new_query_results_formatter2 in utilities * src/rasqal.h, src/rasqal_result_formats.c: Added rasqal_new_query_results_formatter2 with format name, mime type and URI args. (rasqal_new_query_results_formatter2): Added (rasqal_new_query_results_formatter, rasqal_new_query_results_formatter_by_mime_type): Deprecated for the above. * src/rasqal.h, src/rasqal_algebra.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_map.c: Add status return code for literal, algebra node, map print methods. (rasqal_literal_print, rasqal_map_print, rasqal_algebra_node_print): Return int status. * src/rasqal_variable.c: autodocs * src/rasqal_expr.c: autodocs * src/rasqal_graph_pattern.c: autodocs * src/rasqal_expr.c: autodocs * src/rasqal_query_write.c: Update query writing for older laqrs insert/delete forms. (rasqal_query_write_sparql_20060406): Handles LAQRS INSERT/DELETE experimental forms. Add comments for what SPARQL 1.1 (Draft) Update forms are done. * tests/sparql/update/Makefile.am: insert-2.rq and delete-data-2.rq now pass 2010-02-07 Dave Beckett * src/rasqal_query_write.c: Format SPARQL Update 1.1 output (rasqal_query_write_sparql_triple_data): Added to help write triple data blocks - GP known to contain just triples. * src/sparql_parser.y: Set RASQAL_UPDATE_FLAGS_SILENT for CREATE / DROP SILENT * src/rasqal.h, src/rasqal_query.c, src/rasqal_query_results.c, src/rasqal_query_transform.c: Delete RASQAL_QUERY_VERB_CLEAR / CREATE / DROP / LOAD * src/sparql_parser.y: Use RASQAL_UPDATE_FLAGS_DATA to mark INSERT / DELETE DATA is using triples. * src/rasqal.h: Add RASQAL_UPDATE_FLAGS_DATA to rasqal_update_flags for triple data. * src/sparql_parser.y: Add UpdateOperationList to allow sequences of update operations * tests/sparql/update/Makefile.am: delete-2.rq passes * src/sparql_parser.y: (UpdateQuery): Use WhereClauseOpt to allow optional WHERE * tests/sparql/update/Makefile.am, tests/sparql/update/clear-1.rq, tests/sparql/update/clear-2.rq, tests/sparql/update/clear-3.rq, tests/sparql/update/create-1.rq, tests/sparql/update/create-2.rq, tests/sparql/update/delete-1.rq, tests/sparql/update/delete-2.rq, tests/sparql/update/delete-data-1.rq, tests/sparql/update/delete-data-2.rq, tests/sparql/update/drop-1.rq, tests/sparql/update/drop-2.rq, tests/sparql/update/insert-1.rq, tests/sparql/update/insert-2.rq, tests/sparql/update/insert-data-1.rq, tests/sparql/update/insert-delete-1.rq, tests/sparql/update/load-1.rq, tests/sparql/update/load-2.rq: Update tests from http://www.w3.org/TR/2010/WD-sparql11-update-20100126/ * tests/sparql/update/Makefile.am, tests/sparql/update/delete-data-2.rq: Add delete-data-2.rq from http://www.w3.org/TR/2010/WD-sparql11-update-20100126/ * src/rasqal.h, src/rasqal_internal.h, src/rasqal_update.c, src/sparql_parser.y: Each rasqal_update_operation can now do inserts and deletes in one. Remove update types insert, delete and merge into RASQAL_UPDATE_TYPE_UPDATE. Added enum RASQAL_UPDATE_FLAGS_SILENT for capturing SILENT from SPARQL update. rasqal_update_operation gains both an insert and delete set of templates. (rasqal_new_update_operation): Gains two templates args to replace one and a flags arg. Update callers to create one rasqal_update_operation instead of 1 or 2. * src/sparql_parser.y: Moved WITH ... INSERT/DELETE ... WHERE query into rasqal_update_operation form * src/rasqal.h, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_update.c, src/sparql_parser.y: Added rasqal_new_basic_graph_pattern_from_triples() (rasqal_new_basic_graph_pattern_from_triples): Added to create a basic graph pattern form a sequence of triples. * src/sparql_parser.y: improve error message for beyond SPARQL 1.0 extensions. * src/sparql_parser.y: Write update operations into query updates Add update to lexer/parser union of type rasqal_update_operation. Add destructor for GraphTriples as type rasqal_update_operation Make all update queries return RASQAL_QUERY_VERB_UPDATE except for previously used RASQAL_QUERY_VERB_INSERT and RASQAL_QUERY_VERB_DELETE that are deprecated now. (GraphTriples) creates and returns an update operation. (InsertQuery, UpdateQuery, DeleteQuery, ClearQuery, DropQuery): Create updates rather than store in query structure directly. * src/rasqal_internal.h, src/rasqal_query.c: Remove query graph_uri and document_uri fields in preference to updates field. * src/rasqal_update.c: rasqal_new_update_operation args can be NULL for CLEAR. * src/rasqal.h, src/rasqal_update.c: Sort rasqal_update_type and fix labels * src/rasqal.h, src/rasqal_expr.c, src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_query.c, src/rasqal_row.c, src/rasqal_update.c, src/rasqal_variable.c: Debug print methods now return int status to match raptor_sequence_print_handler method. * src/sparql_parser.y: (LoadQuery): Store document and graph URIs in update operations. * src/rasqal_update.c: cast for malloc * src/rasqal.h, src/rasqal_internal.h, src/rasqal_query.c: Added rasqal_query_add_update_operation - internal for now * src/rasqal.h, src/rasqal_internal.h, src/rasqal_query.c: Add update reading methods to query class (rasqal_query_get_update_operations_sequence): Added to get sequence of updates. (rasqal_query_get_update_operation): Added to get an operation from sequence of updates. rasqal_query_s gains updates sequence field. (rasqal_free_query): Free updates sequence. (rasqal_query_print): Print updates * src/rasqal.h, src/rasqal_internal.h, src/rasqal_update.c: Add document_uri to rasqal_update_operation * src/Makefile.am, src/rasqal.h, src/rasqal_internal.h, src/rasqal_update.c: Add rasqal graph update type, structure and object functions Added rasqal_update_type enum for types of graph update Added rasqal_update_operation for holding an individual update (rasqal_update_type_label): Added to get label for update type. (rasqal_new_update_operation, rasqal_free_update_operation): Added constructor and destructor for update operation. (rasqal_update_operation_print): Added debug print method * src/rasqal_query.c: Add update operations to rasqal_query_verb_labels * src/rasqal.h, src/rasqal_query_results.c, src/rasqal_query_transform.c: Added RASQAL_QUERY_VERB_UPDATE for update operations rasqal_query_verb gains RASQAL_QUERY_VERB_UPDATE Update switch statements on this type to add new case. * src/sparql_parser.y: Restored LAQRS old INSERT and DELETE syntax with deprecated warnings. * tests/improve: allow recursive running of a test to skip dirs where it isn't supported * tests/sparql/update/Makefile.am: Mark insert-2.rq as expected to fail * src/sparql_parser.y: Revert "Improve ConstructTemplate and ConstructTriples rules" This reverts commit f3e05dc3d465ce12677fc2daa12c80dc4ffc278e. Get older tests to work at the cost of new test insert-2 failing. * src/sparql_parser.y: debug message fix * src/sparql_parser.y: Improve ConstructTemplate and ConstructTriples rules Down from expect 31 shift/reduce conflicts to 13 (ConstructTriplesRest): Added for second optional clause in ConstructTriples to reduce conflicts. * src/sparql_parser.y: Adjust comment - EXPLAIN is LAQRS, not in SPARQL 1.1 draft 2010-02-06 Dave Beckett * src/sparql_parser.y: Re-add SPARQL 1.1 WITH .. DELETE/INSERT From 5 shift/reduce conflicts to 31 shift/reduce conflicts - seems to be choices between two optional sequences of triples nearby. Add UpdateQuery option that (for now) marks it as an INSERT. (DeleteQuery): Switch to list of modify templates - which are discarded. (GraphTemplate): Added (ModifyTemplate, ModifyTemplateList): Added. (InsertQuery): Switch to list of modify templates - which are discarded. (UpdateQuery): Added for WITH alternatives. * src/sparql_parser.y: Split ConstructTriplesOpt into ConstructTriples and ConstructTriplesOpt (ConstructTriplesOpt): Moved empty case here (ConstructTriples): Added, calling ConstructTriplesOpt and handling a non-empty list of construct triples. The above makes ConstructTemplate closer to the SPARQL 1.0 grammar for construct triples. The difference is probably extra optional '.'s * src/sparql_parser.y: Revert to make existing sparql tests work Revert commits 83d66dd1c115b9f18b2043f13122630daad594d8 18ce2f8f3fc61dd641068f6ff5fddc01df4106bc so that the older SPARQL tests work. This makes the SPARQL 1.1 draft insert & delete forms tests fail. * tests/improve: truncate log to 15 lines only if too long * tests/rdql/testsuite/check-rdql: (toDebug): Discard @lang from "string"@lang^^datatype * tests/rdql/testsuite/check-rdql: #2010 * .gitignore: Remove rdf files from top level .gitignore * docs/tmpl/section-query.sgml, docs/tmpl/section-variable.sgml: updated generated docs * tests/sparql/update/data.ttl: Data for sparql update test * RELEASE.html: 0.9.18 * src/rasqal_algebra.c, src/rasqal_expr.c, src/rasqal_graph_pattern.c, src/rasqal_query.c, src/rasqal_rowsource.c, src/rasqal_variable.c: Use FILE* for autodocs not #FILE* * src/rasqal.h: rasqal_data_graph autodocs * src/rasqal_literal.c: rasqal_literal_print_type autodocs * src/rasqal.h: rasqal_data_graph autodocs * src/rasqal_literal.c: rasqal_literal_print autodocs * src/rasqal_query.c: remove autodocs indicator * src/rasqal_query_results.c: remove autodocs indicator * src/rasqal_general.c: rasqal_query_set_default_generate_bnodeid_parameters autodocs * src/rasqal_engine.c: remove autodocs indicator * .gitignore, RELEASE.html, autogen.sh, build/.gitignore, build/shave-libtool.in, build/shave.in, build/shave.m4, configure.ac: Use AM_SILENT_RULES and move autotools helper files to build/ dir Update autogen.sh with latest version; dependent on automake 1.11 and it's dependencies to get AM_SILENT_RULES. Update configure.ac to invoke AM_SILENT_RULES defaulting to 'no'. Delete SHAVE. * NEWS.html, configure.ac, src/rasqal.h: Bumped version to 0.9.18 * src/sparql_lexer.l: Make sparql_token_free static * src/rasqal.h: Add user_data field to rasqal_variable. rasqal_variable gains user_data field. Fixes Issue#0000320 http://bugs.librdf.org/mantis/view.php?id=320 * src/rasqal_format_json.c: Use application/json for JSON results format mime type (rasqal_init_result_format_json): Register mime type application/json instead of text/json for JSON results format. Fixes Issue#0000323 http://bugs.librdf.org/mantis/view.php?id=323 2010-02-05 Dave Beckett * src/rasqal_format_sv.c: Give CSV and TSV query result formats mime types and URIs (rasqal_init_result_format_sv): Register result format 'csv' with URI http://www.ietf.org/rfc/rfc4180.txt and result format 'tsv' with mime type text/tab-separated-values and URI http://www.iana.org/assignments/media-types/text/tab-separated-valuesValues taken from Issue#0000345. Fixes Issue#0000345 http://bugs.librdf.org/mantis/view.php?id=345 2010-02-05 Lauri Aalto * src/rasqal_format_table.c: (rasqal_init_result_format_table): Fixed typo in result format MIME type. Fixes Issue #0000343 http://bugs.librdf.org/mantis/view.php?id=343 2010-02-01 Dave Beckett * configure.ac: Set and enforce raptor max version of <= 1.8.99 2010-01-31 Dave Beckett * src/sparql_lexer.l: Make sparql_token_free usable outside this module. 2010-01-24 Dave Beckett * rasqal.pc.in: Use pkg-config (undocumented) Requires.private for raptor 2010-01-19 Dave Beckett * src/sparql_parser.y: Alter DELETE to take a list of templates (sub-graphs) to delete. * src/sparql_parser.y: make WITH DELETE ... INSERT ... WHERE .. SPARQL 1.1 update (draft) work Because the grammar is ambiguous in several places and unstable, in this grammar WITH is required, not optional as the grammar makes it. Shift/reduce conflicts goes from 5 to 13 probably because of insert/delete ambiguity. (ConstructTriples): Added; was part of ConstructTriplesOpt (GraphTemplate): Added. (ModifyTemplate, ModifyTemplateList): To form list of graphs to update. This data is thrown away now, not stored. (UpdateQuery): Added but pretending to be INSERT verb. Only supports WITH DELETE { ... } INSERT { ... } WHERE ... form with no optional WITH; otherwise this is even more ambiguous. * tests/sparql/update/insert-1.rq: ws * src/sparql_lexer.l, src/sparql_parser.y: Add SPARQL 1.1 update draft LOAD [ INTO ] Added INTO keyword to sparql lexer (LoadQuery): Added with the two forms, storing the document URI as well as the optional graph URI * src/rasqal_internal.h, src/rasqal_query.c: Add document_uri field to rasqal_query for SPARQL 1.1 update LOAD document URI * src/rasqal.h, src/rasqal_query_results.c, src/rasqal_query_transform.c: Add RASQAL_QUERY_VERB_LOAD for SPARQL 1.1 update draft LOAD command * src/sparql_parser.y: Code style - break lines and whitespace * src/sparql_parser.y: Code style - break lines, whitespace, move seq size out of loops. * src/sparql_parser.y: Code style - break long lines. * src/sparql_parser.y: Add DELETE triples syntax from SPARQL 1.1 update draft (DeleteQuery): Add DELETE DATA { triples} form, storing the triples to delete in the rasqal_query constructs field, for now. * src/sparql_parser.y: Add INSERT triples syntax from SPARQL 1.1 update draft (GraphTriples): Added to turn a block of triples with optional graph URI into query structure. The insert triples are stored in the query construct triples field. (InsertQuery): Allow SPARQL 1.1 update draft form inserting a set of triples with INSERT DATA { triples }. (GraphpatternListOpt): Fix error message label * src/sparql_parser.y: Add CREATE and DROP syntax from SPARQL 1.1 update draft * src/rasqal.h, src/rasqal_query_results.c, src/rasqal_query_transform.c: Add RASQAL_QUERY_VERB_CREATE and RASQAL_QUERY_VERB_DROP for SPARQL 1.1 update draft * src/sparql_parser.y: Added SPARQL 1.1 Update CLEAR & CLEAR GRAPH (ClearQuery): Added. Stores graph URI when given, in rasqal_query field graph_uri. * tests/sparql/update/Makefile.am: Use -i laqrs in testing for now * src/sparql_lexer.l: (sparql_token_print): Add missing tokens * src/rasqal_internal.h, src/rasqal_query.c: rasqal_query gains graph_uri field for storing CLEAR/DROP graph uri * src/rasqal.h, src/rasqal_query_results.c, src/rasqal_query_transform.c: Added RASQAL_QUERY_VERB_CLEAR for SPARQL 1.1 update CLEAR verb * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 Update LOAD keyword * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 Update DROP keyword * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 Update DATA keyword * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 Update SILENT keyword * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 Update CREATE keyword * src/sparql_lexer.l, src/sparql_parser.y: Added SPARQL 1.1 Update CLEAR keyword * configure.ac, tests/sparql/Makefile.am, tests/sparql/update/Makefile.am, tests/sparql/update/bad-1.rq, tests/sparql/update/clear-1.rq, tests/sparql/update/clear-2.rq, tests/sparql/update/clear-3.rq, tests/sparql/update/create-1.rq, tests/sparql/update/create-2.rq, tests/sparql/update/delete-1.rq, tests/sparql/update/delete-data-1.rq, tests/sparql/update/drop-1.rq, tests/sparql/update/drop-2.rq, tests/sparql/update/insert-1.rq, tests/sparql/update/insert-2.rq, tests/sparql/update/insert-data-1.rq, tests/sparql/update/insert-delete-1.rq, tests/sparql/update/load-1.rq, tests/sparql/update/load-2.rq: Add SPARQL 1.1 Update tests * src/sparql_lexer.l, src/sparql_parser.y: Added WITH keyword to SPARQL 1.1 (draft) / LAQRS 2010-01-06 Dave Beckett * LICENSE.html: 2010 * TODO.html: 2010 * INSTALL.html: 2010 * RELEASE.html: 2010 * README.html: 2010 * NEWS.html: 2010 2010-01-02 Dave Beckett * tests/engine/.gitignore: Ignore deps * docs/tmpl/.gitignore: Update another .gitignore * .gitignore, build/.gitignore, docs/.gitignore, src/.gitignore, tests/algebra/.gitignore, tests/engine/.gitignore, utils/.gitignore: Add .gitignore to replace SVN properties svn:ignore rasqal-0.9.33/win32/0000755000175000017500000000000012443715253011042 500000000000000rasqal-0.9.33/win32/Makefile.am0000644000175000017500000000030010674751740013014 00000000000000EXTRA_DIST=\ README.txt \ rasqal.dsp rasqal.dsw rasqal.vcproj # Make some empty dirs that may be needed dist-hook: for dir in Debug Release; do \ mkdir $(distdir)/$$dir; \ done rasqal-0.9.33/win32/Makefile.in0000644000175000017500000003024712434455633013040 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = win32 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ EXTRA_DIST = \ README.txt \ rasqal.dsp rasqal.dsw rasqal.vcproj all: all-am .SUFFIXES: $(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 win32/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu win32/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook 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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ dist-hook distclean distclean-generic distclean-libtool \ 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am # Make some empty dirs that may be needed dist-hook: for dir in Debug Release; do \ mkdir $(distdir)/$$dir; \ done # 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: rasqal-0.9.33/win32/rasqal.dsp0000644000175000017500000001311010136040021012726 00000000000000# Microsoft Developer Studio Project File - Name="rasqal" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=rasqal - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "rasqal.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "rasqal.mak" CFG="rasqal - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "rasqal - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "rasqal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "rasqal - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RASQAL_EXPORTS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RASQAL_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 !ELSEIF "$(CFG)" == "rasqal - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "c:\bin\Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RASQAL_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\raptor-1.3.3" /I "..\..\redland-0.9.19\librdf" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RASQAL_INTERNAL" /D "_MT" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib raptor.lib librdf.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\raptor-1.3.3\win32\Debug" /libpath:"..\..\redland-0.9.19\librdf\win32\Debug" !ENDIF # Begin Target # Name "rasqal - Win32 Release" # Name "rasqal - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\getopt.c # End Source File # Begin Source File SOURCE=..\rasqal_engine.c # End Source File # Begin Source File SOURCE=..\rasqal_expr.c # End Source File # Begin Source File SOURCE=..\rasqal_general.c # End Source File # Begin Source File SOURCE=..\rasqal_literal.c # End Source File # Begin Source File SOURCE=..\rasqal_query.c # End Source File # Begin Source File SOURCE=..\rasqal_raptor.c # End Source File # Begin Source File SOURCE=..\rasqal_redland.c # End Source File # Begin Source File SOURCE=..\rdql_lexer.c # End Source File # Begin Source File SOURCE=..\rdql_parser.c # End Source File # Begin Source File SOURCE=..\roqet.c # End Source File # Begin Source File SOURCE=..\strcasecmp.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\rasqal.h # End Source File # Begin Source File SOURCE=..\rasqal_getopt.h # End Source File # Begin Source File SOURCE=..\rasqal_internal.h # End Source File # Begin Source File SOURCE=..\rdql_common.h # End Source File # Begin Source File SOURCE=..\rdql_lexer.h # End Source File # Begin Source File SOURCE=..\rdql_parser.h # End Source File # Begin Source File SOURCE=..\rdql_parser.h # End Source File # Begin Source File SOURCE=..\sparql_common.h # End Source File # Begin Source File SOURCE=..\sparql_lexer.h # End Source File # Begin Source File SOURCE=..\sparql_parser.h # End Source File # Begin Source File SOURCE=..\sparql_parser.h # End Source File # Begin Source File SOURCE=..\win32_rasqal_config.h # End Source File # End Group # End Target # End Project rasqal-0.9.33/win32/Release/0000755000175000017500000000000012443715253012422 500000000000000rasqal-0.9.33/win32/README.txt0000644000175000017500000000122010362621550012445 00000000000000This is user contributed win32 configuration for building rasqal using MS Windows development environments. The latest files are the *.vcproj files for MS Visual Studio 8, provided by John Barstow. The *.dsp *.dsw files are older and from MS Developer Studio provided by several prople. The various project files assume that raptor have been installed or compiled in sibling top level directories. See the rasqal.vcproj (newest) or rasqal.dsp (older) files for the exact paths used, which can be version-number dependant. I do not test this configuration since I don't use Windows. I am happy to receive patches to fix things though. Dave 2005-05-19 rasqal-0.9.33/win32/rasqal.vcproj0000644000175000017500000001377010412155714013474 00000000000000 rasqal-0.9.33/win32/Debug/0000755000175000017500000000000012443715253012070 500000000000000rasqal-0.9.33/win32/rasqal.dsw0000644000175000017500000000150410136040021012741 00000000000000Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "raptor"="..\..\raptor-1.3.3\win32\raptor.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "rasqal"=".\rasqal.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name raptor End Project Dependency }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### rasqal-0.9.33/libsv/0000755000175000017500000000000012443715251011215 500000000000000rasqal-0.9.33/libsv/ChangeLog0000644000175000017500000001337712271267126012724 000000000000002014-01-19 Dave Beckett * Update dist rules to package svtest and autostuff * Do not build example by default * (sv_parse_line): Fix double quoted quotes Use a lookahead for doubling quotes * Fix quote tests 12, 13 and 14 * svtest: Add optional test index arg to run just one (svtest_run_test): Pulled out of main * GNU configureize 2014-01-17 Dave Beckett * (sv_set_option_vararg): sv_line_callback cast for C++ 2014-01-15 Dave Beckett * test missing final newlines on header line, data lines * Call sv_parse_chunk() a second time for final line processing * (sv_parse_chunk_line): handle being called with/without final NL * Call sv_parse_chunk at end of input for final line * (sv_parse_chunk): Parse final line only if buffer is not empty. * (sv_parse_chunk): Given NULL buffer or 0 length, handle final line * Move fields_count from sv_parse_chunk_line arg (sv_parse_chunk_line): Lose fields_count_p arg; make it a local. (sv_parse_chunk): Lose var and remove it from call * (sv_parse_chunk_line): Added pulled out of sv_parse_chunk * Give all the structs and vars svtest_ prefix names * remove junk in test data * Use line callback to emit lines seen before parsing * Move line_callback to sv_parse_chunk so it is done once. * fix * Update GNUMakefile for newer code 2014-01-12 Dave Beckett * Clean EXTRA_PROGRAMS * Add sv2c to convert data to C (approx) * Add tests from test1.csv * Use my_sv_line_callback() to save line for better error messages * Add SV_OPTION_LINE_CALLBACK to set a callback per line * less debug * script * Fix make * Travis CI 2014-01-11 Dave Beckett * (sv_init_fields): malloc corect size array [clang] * Add SV_OPTION_QUOTE_CHAR * Add SV_OPTION_QUOTE_CHAR to set quote char (default is ") * Add SV_OPTION_STRIP_WHITESPACE whitespace removal test * Terminate after whitespace removal. * cast * debug * Add check target * Add test suite * Add SV_OPTION_STRIP_WHITESPACE to strip whitespace around fields 2013-12-03 Dave Beckett * README into markdown 2013-12-01 Dave Beckett * Now libsv repo 2013-11-29 Dave Beckett * Add option to control quoting fields between separators sv_option_t gains SV_OPTION_QUOTED_FIELDS (sv_init): Set quoted fields default on. (sv_set_option_vararg): Parse SV_OPTION_QUOTED_FIELDS into internal flag. (sv_parse_line): Add conditions around doing quoting 2013-11-27 Dave Beckett * Make all status returns be sv_status_t (sv_set_option): Returns sv_status_t (sv_init_fields, sv_ensure_fields_buffer_size, sv_set_option_vararg): Internal functions return sv_status_t 2013-11-26 Dave Beckett * Support \n, \r, \r\n * Switch init flags to a call to sv_set_option sv_option_t: Added (sv_set_option): Added. * tests * \ * add test1.csv * Tidy status and returns * code style * Return sv_status_t from calls and use SV_STATUS_LINE_FIELDS * Add SV_STATUS_LINE_FIELDS * Guess sep * sv_parse_line label * Handle quoting more robustly. Tidy debug messages Error lines are now not fatal unless flag SV_FLAGS_BAD_DATA_ERROR is set. Rename skip -> skip_line * Add bad records count * Add flag SV_FLAGS_BAD_DATA_ERROR 2013-11-25 Dave Beckett * (sv_dump_buffer): Added for debugging * Start line numbers at 1 * Print filename * Fix empty line support and line numbers * debug output * header is not a record * zero.tsv with no data * Use and report headers seen * Improve header decoding Add header fields callback. Set header widths (sv_init): Gains header_callback arg * Add one.tsv 2013-11-24 Dave Beckett * (sv_init) check * Add field_sep arg to sv_init * sv * Add example * libsv * Cleanups * Use #if defined * No test yet * Remove Makefile from repo * Ignore more * GNUMakefile for old makefile * automake pieces 2013-07-31 Dave Beckett * More tests 2009-05-29 Dave Beckett * Add more quote test cases and make some corner cases work better * Ignore tarballs * Ignore stuff 2009-05-28 Dave Beckett * Added readme * Added makefile * Added package bits and pieces - copyright docs and header. Added example with test file 2009-05-26 Dave Beckett * h * *** empty log message *** * Update for TSV status * Added tsv_status for error results * casts for C++ * Use pointinpoly.h * Use pointinpoly.h * Added pointinpoly.h * Added header * unsigned/signed stuff 2009-05-24 Dave Beckett * fix warnings * Add lots of warnings * abort callback * end lines on error * (tsv_parse_chunk): Return 1 on failure from callback * style * print tags shorter * Use flickcurl_photo_as_page_uri 2009-05-23 Dave Beckett * Uses flickcurl API to search for photos by WOEID of countries seen and get at most 1 photo, print the tags 2009-05-22 Dave Beckett * Update to new init and use headers when verbose. * Added flags arg to tsv_init to allow saving of header. Added const char* tsv_get_header(tsv *t, unsigned int i, size_t *width_p); to return them. * use memmove for overlap copy * code depends on tsv * adjust tsv_init call * remove unused FH * remove unused FH * save a memcpy * Move fields_buffer to tsv structure and grow only when needed * Count records * Allocate fields, fields_widths for first line only, save lots of per-line malloc/frees * Add verbose flag * Added tsv parsing module and use with file * internal header * use internal.h * srcs * Initial import rasqal-0.9.33/libsv/one.tsv0000644000175000017500000000001612246733341012452 00000000000000foo bar a b rasqal-0.9.33/libsv/sv.c0000644000175000017500000003763512317663610011750 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sv.c - Parse separated-values (CSV, TSV) files * * Copyright (C) 2009-2014, David Beckett http://www.dajobe.org/ * * This package is Free Software * * 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.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 SV_CONFIG #include #endif #include #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include /* bit flags */ #define SV_FLAGS_SAVE_HEADER (1<<0) /* error out on bad data lines */ #define SV_FLAGS_BAD_DATA_ERROR (1<<1) /* allow fields to be quoted */ #define SV_FLAGS_QUOTED_FIELDS (1<<2) /* strip (non-separator) whitespace around fields */ #define SV_FLAGS_STRIP_WHITESPACE (1<<3) struct sv_s { /* field separator: '\t' or ',' */ char field_sep; int line; /* row callback */ void *callback_user_data; sv_fields_callback header_callback; sv_fields_callback data_callback; /* current buffer */ char *buffer; /* size allocated */ size_t size; /* size used */ size_t len; unsigned int fields_count; char **fields; size_t *fields_widths; /* memory buffer used for constructing fields for user; * array above 'fields' points into this */ char* fields_buffer; size_t fields_buffer_size; /* first row is saved as headers */ char **headers; size_t *headers_widths; unsigned int flags; /* error state */ sv_status_t status; int bad_records; char last_char; char quote_char; /* called with the line (before parsing) */ sv_line_callback line_callback; }; /** * sv_new: * @user_data: user data to use for callbacks * @header_callback: callback to receive headers (or NULL) * @data_callback: callback to receive data rows (or NULL) * @field_sep: field separator ',' or '\t' * * Constructor - create an SV object * * Return value: new SV object or NULL on failure. */ sv* sv_new(void *user_data, sv_fields_callback header_callback, sv_fields_callback data_callback, char field_sep) { sv *t; if(field_sep != '\t' && field_sep != ',') return NULL; t = (sv*)malloc(sizeof(*t)); if(!t) return NULL; t->field_sep = field_sep; t->line = 1; t->callback_user_data = user_data; t->header_callback = header_callback; t->data_callback = data_callback; t->buffer = NULL; t->size = 0; t->len = 0; t->fields_count = 0; t->fields = NULL; t->fields_widths = NULL; t->fields_buffer = NULL; t->fields_buffer_size = 0; t->headers = NULL; t->headers_widths = NULL; /* default flags */ t->flags = SV_FLAGS_SAVE_HEADER | SV_FLAGS_QUOTED_FIELDS; t->status = SV_STATUS_OK; t->bad_records = 0; t->last_char = '\0'; t->quote_char = '"'; t->line_callback = NULL; return t; } static sv_status_t sv_init_fields(sv *t) { t->fields = (char**)malloc(sizeof(char*) * (t->fields_count+1)); if(!t->fields) goto failed; t->fields_widths = (size_t*)malloc(sizeof(size_t) * (t->fields_count+1)); if(!t->fields_widths) goto failed; t->headers = (char**)malloc(sizeof(char*) * (t->fields_count+1)); if(!t->headers) goto failed; t->headers_widths = (size_t*)malloc(sizeof(size_t) * (t->fields_count+1)); if(!t->headers_widths) goto failed; return SV_STATUS_OK; failed: if(t->fields) { free(t->fields); t->fields = NULL; } if(t->fields_widths) { free(t->fields_widths); t->fields_widths = NULL; } if(t->headers) { free(t->headers); t->headers = NULL; } return SV_STATUS_NO_MEMORY; } /** * sv_free: * @t: SV object * * Destructor: destroy an SV object * */ void sv_free(sv *t) { if(!t) return; if(t->headers_widths) free(t->headers_widths); if(t->headers) { unsigned int i; for(i = 0; i < t->fields_count; i++) free(t->headers[i]); free(t->headers); } if(t->fields_buffer) free(t->fields_buffer); if(t->fields_widths) free(t->fields_widths); if(t->fields) free(t->fields); if(t->buffer) free(t->buffer); free(t); } /* Ensure fields buffer is big enough for len bytes total */ static sv_status_t sv_ensure_fields_buffer_size(sv *t, size_t len) { char *nbuffer; size_t nsize; if(len < t->fields_buffer_size) return SV_STATUS_OK; nsize = len + 8; #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "%d: Growing buffer from %d to %d bytes\n", t->line, (int)t->fields_buffer_size, (int)nsize); #endif nbuffer = (char*)malloc(nsize + 1); if(!nbuffer) return SV_STATUS_NO_MEMORY; if(t->fields_buffer) free(t->fields_buffer); t->fields_buffer = nbuffer; t->fields_buffer_size = nsize; return SV_STATUS_OK; } /* Ensure internal buffer is big enough for len more bytes */ static sv_status_t sv_ensure_line_buffer_size(sv *t, size_t len) { char *nbuffer; size_t nsize; if(t->len + len < t->size) return SV_STATUS_OK; nsize = (len + t->len) << 1; nbuffer = (char*)malloc(nsize + 1); if(!nbuffer) return SV_STATUS_NO_MEMORY; if(t->len) memcpy(nbuffer, t->buffer, t->len); nbuffer[t->len] = '\0'; if(t->buffer) free(t->buffer); t->buffer = nbuffer; t->size = nsize; return SV_STATUS_OK; } /** * sv_get_line: * @t: sv object * * Get current SV line number * * Return value: line number or <0 on failure */ int sv_get_line(sv *t) { if(!t) return -1; return t->line; } /** * sv_get_header: * @t: sv object * @i: header index 0 * @width_p: pointer to store width (or NULL) * * Get an SV header with optional width * * Return value: shared pointer to header or NULL if out of range */ const char* sv_get_header(sv *t, unsigned int i, size_t *width_p) { if(!t || !t->headers || i > t->fields_count) return NULL; if(width_p) *width_p = t->headers_widths[i]; return (const char*)t->headers[i]; } #if defined(SV_DEBUG) && SV_DEBUG > 1 static void sv_dump_buffer(FILE* fh, const char* label, const char* buffer, size_t len) { size_t mylen=len; fprintf(fh, "%s (%zu bytes) >>>", label, len); if(mylen > 100) mylen = 100; fwrite(buffer, 1, mylen, fh); if(mylen != len) fputs("...", fh); fputs("<<<\n", fh); } #endif static sv_status_t sv_parse_line(sv *t, char *line, size_t len, unsigned int* field_count_p) { unsigned int column; int field_width = 0; int field_offset = 0; char* current_field = NULL; char* p = NULL; char** fields = t->fields; size_t* fields_widths = t->fields_widths; sv_status_t status; int field_is_quoted = 0; #if defined(SV_DEBUG) && SV_DEBUG > 1 if(fields) sv_dump_buffer(stderr, "(sv_parse_line): Parsing line", line, len); #endif status = sv_ensure_fields_buffer_size(t, len); if(status) return status; if(fields) { current_field = t->fields_buffer; p = current_field; if(!p) return SV_STATUS_OK; } for(column = 0; 1; column++) { int c = -1; int field_ended = 0; int expect_sep = 0; if(column == len) { field_ended = 1; goto do_last; } c = line[column]; if(t->flags & SV_FLAGS_QUOTED_FIELDS) { if(c == t->quote_char) { if(!field_width && !field_is_quoted) { field_is_quoted = 1; #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Field is quoted\n"); #endif continue; } else if(column < len && line[column+1] == t->quote_char) { #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Doubled quote %c absorbed\n", t->quote_char); #endif column++; /* skip repeated quote - so it just replaces ""... with " */ goto skip; } else if(column == len-1 || line[column+1] == t->field_sep) { #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Field ended on quote + sep\n"); #endif field_ended = 1; expect_sep = 1; goto do_last; } } } if(!field_is_quoted && c == t->field_sep) { #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Field ended on sep\n"); #endif field_ended = 1; } do_last: if(field_ended) { if(p) *p++ = '\0'; if(fields) { if(t->flags & SV_FLAGS_STRIP_WHITESPACE) { /* Remove whitespace around a field */ while(field_width > 0 && isspace(current_field[0])) { current_field++; field_width--; } while(field_width > 0 && isspace(current_field[field_width - 1])) field_width--; current_field[field_width] = '\0'; } if(expect_sep) column++; } #if defined(SV_DEBUG) && SV_DEBUG > 1 if(fields) { fprintf(stderr, " Field %d: %s (%d)\n", (int)field_offset, current_field, (int)field_width); } #endif if(fields) fields[field_offset] = current_field; if(fields_widths) fields_widths[field_offset] = field_width; /* end loop when out of columns */ if(column == len) break; /* otherwise got a tab so reset for next field */ field_width = 0; field_is_quoted = 0; field_offset++; current_field = p; continue; } skip: if(fields) *p++ = c; field_width++; } if(field_count_p) *field_count_p = field_offset + 1; return SV_STATUS_OK; } static sv_status_t sv_parse_chunk_line(sv* t, size_t line_len, int has_nl) { size_t move_len = line_len; sv_status_t status = SV_STATUS_OK; unsigned int fields_count = 0; if(!line_len) goto skip_line; if(t->line_callback) { char c = t->buffer[line_len]; t->buffer[line_len] = '\0'; status = t->line_callback(t, t->callback_user_data, t->buffer, line_len); t->buffer[line_len] = c; if(status != SV_STATUS_OK) return status; } if(!t->fields_count) { /* First line in the file - calculate number of fields */ status = sv_parse_line(t, t->buffer, line_len, &t->fields_count); if(status) return status; /* initialise arrays of size t->fields_count */ status = sv_init_fields(t); if(status) return status; } status = sv_parse_line(t, t->buffer, line_len, &fields_count); if(status) return status; if(fields_count != t->fields_count) { t->bad_records++; if(t->flags & SV_FLAGS_BAD_DATA_ERROR) { #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Error in line %d: saw %d fields expected %d\n", t->line, fields_count, t->fields_count); #endif status = SV_STATUS_LINE_FIELDS; return status; } #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Ignoring line %d: saw %d fields expected %d\n", t->line, fields_count, t->fields_count); #endif /* Otherwise skip the line */ goto skip_line; } if(t->line == 1 && (t->flags & SV_FLAGS_SAVE_HEADER)) { /* first line and header: turn fields into headers */ unsigned int i; for(i = 0; i < t->fields_count; i++) { char *s = (char*)malloc(t->fields_widths[i]+1); if(!s) { status = SV_STATUS_NO_MEMORY; break; } memcpy(s, t->fields[i], t->fields_widths[i]+1); t->headers[i] = s; t->headers_widths[i] = t->fields_widths[i]; } if(status == SV_STATUS_OK && t->header_callback) { /* got header fields - return them to user */ status = t->header_callback(t, t->callback_user_data, t->headers, t->headers_widths, t->fields_count); } } else { /* data */ if(t->data_callback) { /* got data fields - return them to user */ status = t->data_callback(t, t->callback_user_data, t->fields, t->fields_widths, t->fields_count); } } skip_line: if(has_nl) move_len++; /* adjust buffer - remove 'line_len+1' bytes from start of buffer */ t->len -= move_len; /* this is an overlapping move */ memmove(t->buffer, &t->buffer[move_len], t->len); /* This is not needed: guaranteed above */ /* t->buffer[t->len] = '\0' */ t->line++; return status; } /** * sv_parse_chunk: * @t: sv object * @buffer: buffer to parse (or NULL) * @len: length of @buffer (or 0) * * Parse a chunk of data * * Parsing ends if either @buffer is NULL or @len is 0 * * Return value: #SV_STATUS_OK on success */ sv_status_t sv_parse_chunk(sv *t, char *buffer, size_t len) { size_t offset = 0; sv_status_t status = SV_STATUS_OK; /* End of input if either of these is NULL */ int is_end = (!buffer || !len); if(!is_end) { /* add new data to existing buffer */ status = sv_ensure_line_buffer_size(t, len); if(status) return status; /* add new buffer */ memcpy(t->buffer + t->len, buffer, len); /* always ensure it is NUL terminated even if input chunk was not */ t->len += len; t->buffer[t->len] = '\0'; } /* look for an end of line to do some work */ for(offset = 0; offset < t->len; offset++) { char c = t->buffer[offset]; /* skip \n when just seen \r - i.e. \r\n or CR LF */ if(t->last_char == '\r' && c == '\n') { #if defined(SV_DEBUG) && SV_DEBUG > 1 fprintf(stderr, "Skipping a \\n after \\r\n"); #endif /* adjust buffer */ t->len -= 1; /* this is an overlapping move */ memmove(t->buffer, &t->buffer[1], t->len); t->last_char = '\0'; continue; } if(c != '\r' && c != '\n') continue; t->last_char = c; #if defined(SV_DEBUG) && SV_DEBUG > 1 sv_dump_buffer(stderr, "Starting buffer", t->buffer, t->len); #endif /* found a line */ status = sv_parse_chunk_line(t, offset, 1); if(status != SV_STATUS_OK) break; offset = -1; /* so for loop starts at 0 */ } if(is_end && status == SV_STATUS_OK) { /* If end of input and there is a non-empty buffer left, try to * parse it all as the last line. It will NOT contain newlines. */ if(t->len) status = sv_parse_chunk_line(t, t->len, 0); } return status; } static sv_status_t sv_set_option_vararg(sv* t, sv_option_t option, va_list arg) { sv_status_t status = SV_STATUS_OK; switch(option) { case SV_OPTION_SAVE_HEADER: t->flags &= ~SV_FLAGS_SAVE_HEADER; if(va_arg(arg, long)) t->flags |= SV_FLAGS_SAVE_HEADER; break; case SV_OPTION_BAD_DATA_ERROR: t->flags &= ~SV_FLAGS_BAD_DATA_ERROR; if(va_arg(arg, long)) t->flags |= SV_FLAGS_BAD_DATA_ERROR; break; case SV_OPTION_QUOTED_FIELDS: t->flags &= ~SV_FLAGS_QUOTED_FIELDS; if(va_arg(arg, long)) t->flags |= SV_FLAGS_QUOTED_FIELDS; break; case SV_OPTION_STRIP_WHITESPACE: t->flags &= ~SV_FLAGS_STRIP_WHITESPACE; if(va_arg(arg, long)) t->flags |= SV_FLAGS_STRIP_WHITESPACE; break; case SV_OPTION_QUOTE_CHAR: if(1) { int c = va_arg(arg, int); if(c != t->field_sep) t->quote_char = c; } break; case SV_OPTION_LINE_CALLBACK: if(1) { sv_line_callback cb = (sv_line_callback)va_arg(arg, void*); t->line_callback = cb; } default: case SV_OPTION_NONE: status = SV_STATUS_FAILED; break; } return status; } /** * sv_set_option: * @t: sv object * @option: option name * * Set an option value. The value varies in type dependent on the @option * * Return value: #SV_STATUS_FAILED if failed */ sv_status_t sv_set_option(sv *t, sv_option_t option, ...) { sv_status_t status; va_list arg; va_start(arg, option); status = sv_set_option_vararg(t, option, arg); va_end(arg); return status; } rasqal-0.9.33/libsv/Makefile.am0000644000175000017500000000411412271267126013173 00000000000000# -*- Mode: Makefile -*- # # Makefile for libsv convienience library # ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = libsv.la AM_CPPFLAGS = -DSV_CONFIG -I$(top_srcdir)/src libsv_la_SOURCES = \ sv.c \ sv.h EXTRA_DIST = \ test1.csv \ zero.tsv \ one.tsv \ test1.tsv TESTS=svtest$(EXEEXT) check_PROGRAMS=svtest$(EXEEXT) EXTRA_PROGRAMS=example$(EXEEXT) sv2c$(EXEEXT) CLEANFILES=$(EXTRA_PROGRAMS) \ *.plist svtest_SOURCES = svtest.c svtest_LDADD = $(builddir)/libsv.la example_SOURCES = example.c example_LDADD = $(builddir)/libsv.la sv2c_SOURCES = sv2c.c sv2c_LDADD = $(builddir)/libsv.la if MAINTAINER_MODE # Run Clang static analyzer over sources. analyze: $(SOURCES) @list='$(SOURCES)'; \ result=0; \ for file in $$list; do \ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ $(RECHO) "Analyzing $$file"; \ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ status=$$?; \ if test $$status != 0; then \ result=1; \ fi; \ fi; \ done; \ set -e; exit $$result endif # Some people need a little help ;-) test: check if MAINTAINER_MODE .PHONY: update-ChangeLog # Requires gitlog-to-changelog from # http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog update-ChangeLog: if test -d $(srcdir)/.git; then \ gitlog-to-changelog \ --format='* %s%n%b%n' \ --strip-tab --strip-cherry-pick \ -- $$(cat $(srcdir)/.last-cl-gen).. \ >ChangeLog.tmp \ && git rev-list -n 1 HEAD >.last-cl-gen.tmp \ && (echo; cat $(srcdir)/ChangeLog) >>ChangeLog.tmp \ && mv -f ChangeLog.tmp $(srcdir)/ChangeLog \ && mv -f .last-cl-gen.tmp $(srcdir)/.last-cl-gen \ && rm -f ChangeLog.tmp; \ fi endif EXTRA_DIST += .last-cl-gen rasqal-0.9.33/libsv/COPYING.LIB0000644000175000017500000006364412246733341012613 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! rasqal-0.9.33/libsv/Makefile.in0000644000175000017500000005747512434455632013230 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 for libsv convienience library # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = libsv DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING \ COPYING.LIB ChangeLog 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libsv_la_LIBADD = am_libsv_la_OBJECTS = sv.lo libsv_la_OBJECTS = $(am_libsv_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_example_OBJECTS = example.$(OBJEXT) example_OBJECTS = $(am_example_OBJECTS) example_DEPENDENCIES = $(builddir)/libsv.la am_sv2c_OBJECTS = sv2c.$(OBJEXT) sv2c_OBJECTS = $(am_sv2c_OBJECTS) sv2c_DEPENDENCIES = $(builddir)/libsv.la am_svtest_OBJECTS = svtest.$(OBJEXT) svtest_OBJECTS = $(am_svtest_OBJECTS) svtest_DEPENDENCIES = $(builddir)/libsv.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libsv_la_SOURCES) $(example_SOURCES) $(sv2c_SOURCES) \ $(svtest_SOURCES) DIST_SOURCES = $(libsv_la_SOURCES) $(example_SOURCES) $(sv2c_SOURCES) \ $(svtest_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = libsv.la AM_CPPFLAGS = -DSV_CONFIG -I$(top_srcdir)/src libsv_la_SOURCES = \ sv.c \ sv.h EXTRA_DIST = test1.csv zero.tsv one.tsv test1.tsv .last-cl-gen TESTS = svtest$(EXEEXT) check_PROGRAMS = svtest$(EXEEXT) EXTRA_PROGRAMS = example$(EXEEXT) sv2c$(EXEEXT) CLEANFILES = $(EXTRA_PROGRAMS) \ *.plist svtest_SOURCES = svtest.c svtest_LDADD = $(builddir)/libsv.la example_SOURCES = example.c example_LDADD = $(builddir)/libsv.la sv2c_SOURCES = sv2c.c sv2c_LDADD = $(builddir)/libsv.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 libsv/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libsv/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libsv.la: $(libsv_la_OBJECTS) $(libsv_la_DEPENDENCIES) $(EXTRA_libsv_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libsv_la_OBJECTS) $(libsv_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES) $(EXTRA_example_DEPENDENCIES) @rm -f example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_OBJECTS) $(example_LDADD) $(LIBS) sv2c$(EXEEXT): $(sv2c_OBJECTS) $(sv2c_DEPENDENCIES) $(EXTRA_sv2c_DEPENDENCIES) @rm -f sv2c$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sv2c_OBJECTS) $(sv2c_LDADD) $(LIBS) svtest$(EXEEXT): $(svtest_OBJECTS) $(svtest_DEPENDENCIES) $(EXTRA_svtest_DEPENDENCIES) @rm -f svtest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(svtest_OBJECTS) $(svtest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sv2c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/svtest.Po@am__quote@ .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 $< .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 `$(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 $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) 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-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags 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 uninstall uninstall-am # Run Clang static analyzer over sources. @MAINTAINER_MODE_TRUE@analyze: $(SOURCES) @MAINTAINER_MODE_TRUE@ @list='$(SOURCES)'; \ @MAINTAINER_MODE_TRUE@ result=0; \ @MAINTAINER_MODE_TRUE@ for file in $$list; do \ @MAINTAINER_MODE_TRUE@ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ @MAINTAINER_MODE_TRUE@ $(RECHO) "Analyzing $$file"; \ @MAINTAINER_MODE_TRUE@ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ @MAINTAINER_MODE_TRUE@ status=$$?; \ @MAINTAINER_MODE_TRUE@ if test $$status != 0; then \ @MAINTAINER_MODE_TRUE@ result=1; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ done; \ @MAINTAINER_MODE_TRUE@ set -e; exit $$result # Some people need a little help ;-) test: check @MAINTAINER_MODE_TRUE@.PHONY: update-ChangeLog # Requires gitlog-to-changelog from # http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog @MAINTAINER_MODE_TRUE@update-ChangeLog: @MAINTAINER_MODE_TRUE@ if test -d $(srcdir)/.git; then \ @MAINTAINER_MODE_TRUE@ gitlog-to-changelog \ @MAINTAINER_MODE_TRUE@ --format='* %s%n%b%n' \ @MAINTAINER_MODE_TRUE@ --strip-tab --strip-cherry-pick \ @MAINTAINER_MODE_TRUE@ -- $$(cat $(srcdir)/.last-cl-gen).. \ @MAINTAINER_MODE_TRUE@ >ChangeLog.tmp \ @MAINTAINER_MODE_TRUE@ && git rev-list -n 1 HEAD >.last-cl-gen.tmp \ @MAINTAINER_MODE_TRUE@ && (echo; cat $(srcdir)/ChangeLog) >>ChangeLog.tmp \ @MAINTAINER_MODE_TRUE@ && mv -f ChangeLog.tmp $(srcdir)/ChangeLog \ @MAINTAINER_MODE_TRUE@ && mv -f .last-cl-gen.tmp $(srcdir)/.last-cl-gen \ @MAINTAINER_MODE_TRUE@ && rm -f ChangeLog.tmp; \ @MAINTAINER_MODE_TRUE@ fi # 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: rasqal-0.9.33/libsv/svtest.c0000644000175000017500000002267412315200246012633 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * svtest.c - SV tests * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * This package is Free Software * * 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.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 SV_CONFIG #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include char* program; typedef struct { char sep; unsigned int option; const char* data; const char** const expected; int columns_count; int rows_count; } svtest_data_set; /* structure used for user data callback */ typedef struct { int test_index; /* expected results */ const svtest_data_set *expected; /* raw line */ char* line; size_t line_len; /* processed counts */ int columns_count; int rows_count; /* errors seen */ int header_errors; int data_errors; } svtest_context; #define N_TESTS 20 static const char* const expected_0[4] = {"a", "b", "1", "2" }; static const char* const expected_1[4] = {"c", "d", "3", "4" }; static const char* const expected_2[4] = {"e", "f", "5", "6" }; /* test.csv */ static const char* const expected_3[6] = {"a", "b", "c", "cat", "sat", "mat" }; static const char* const expected_4[6] = {"a", "b", "c", "", "sat", "mat" }; static const char* const expected_5[6] = {"a", "b", "c", "this is", "a", "test" }; static const char* const expected_6[6] = {"a", "b", "c", "this", "is a", "test" }; static const char* const expected_7[6] = {"a", "b", "c", "this", "is", "a test" }; static const char* const expected_8[6] = {"a", "b", "c", "this,is", "a", "test" }; static const char* const expected_9[6] = {"a", "b", "c", "this", "is,a", "test" }; static const char* const expected_10[6] = {"a", "b", "c", "this", "is", "a,test" }; static const char* const expected_11[6] = {"a", "b", "c", "\"", "\"", "\"" }; static const char* const expected_12[6] = {"a", "b", "c", "\"\"", "\"\"", "\"\"" }; static const char* const expected_13[6] = {"a", "b", "c", "\"\"\"", "\"\"\"", "\"\"\"" }; static const char* const expected_14[6] = {"a", "b", "c", "quoting", "can \"be\"", "fun" }; static const svtest_data_set svtest_data[N_TESTS + 1] = { { ',', 0, "a,b\n", (const char** const)expected_0, 2, 0 }, { '\t', 0, "a\tb", (const char** const)expected_0, 2, 0 }, { ',', 0, "a,b\n1,2\n", (const char** const)expected_0, 2, 1 }, { '\t', 0, "a\tb\n1\t2", (const char** const)expected_0, 2, 1 }, { '\t', 0, "c\td\n3\t4\n", (const char** const)expected_1, 2, 1 }, { ',', SV_OPTION_STRIP_WHITESPACE, " e\t , \tf \n 5\t , \t 6\n", (const char** const)expected_2, 2, 1 }, { '\t', 0, "c\td\n\n\n3\t4\n\n\n", (const char** const)expected_1, 2, 1 }, { ',', 0, "c,d\n3,4", (const char** const)expected_1, 2, 1 }, /* test.csv */ { ',', 0, "a,b,c\ncat,sat,mat\n", (const char** const)expected_3, 3, 1 }, { ',', 0, "a,b,c\n,sat,mat\n", (const char** const)expected_4, 3, 1 }, { ',', 0, "a,b,c\n\"this is\",a,test\n", (const char** const)expected_5, 3, 1 }, { ',', 0, "a,b,c\nthis,\"is a\",test\n", (const char** const)expected_6, 3, 1 }, { ',', 0, "a,b,c\nthis,is,\"a test\"\n", (const char** const)expected_7, 3, 1 }, { ',', 0, "a,b,c\n\"this,is\",a,test\n", (const char** const)expected_8, 3, 1 }, { ',', 0, "a,b,c\nthis,\"is,a\",test\n", (const char** const)expected_9, 3, 1 }, { ',', 0, "a,b,c\nthis,is,\"a,test\"\n", (const char** const)expected_10, 3, 1 }, { ',', 0, "a,b,c\n\"\"\"\",\"\"\"\",\"\"\"\"\n", (const char** const)expected_11, 3, 1 }, { ',', 0, "a,b,c\n\"\"\"\"\"\",\"\"\"\"\"\",\"\"\"\"\"\"\n", (const char** const)expected_12, 3, 1 }, { ',', 0, "a,b,c\n\"\"\"\"\"\"\"\",\"\"\"\"\"\"\"\",\"\"\"\"\"\"\"\"\n", (const char** const)expected_13, 3, 1 }, { ',', 0, "a,b,c\nquoting,\"can \"\"be\"\"\",fun\n\"\n", (const char** const)expected_14, 3, 1 }, { '\0', 0, NULL, NULL, 0, 0 } }; #define EXPECTED_HEADER_IX(col) (col) #define EXPECTED_DATA_IX(row, col) (((1+row) * c->expected->columns_count) + col) static sv_status_t svtest_line_callback(sv *t, void *user_data, const char* line, size_t length) { svtest_context *c = (svtest_context*)user_data; if(c->line) free(c->line); c->line = (char*)malloc(length + 1); if(c->line) memcpy(c->line, line, length + 1); /* This code always succeeds */ return SV_STATUS_OK; } static sv_status_t svtest_header_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { unsigned int column_i; svtest_context *c = (svtest_context*)user_data; c->columns_count = count; for(column_i = 0; column_i < count; column_i++) { const char* header = fields[column_i]; unsigned int ix = EXPECTED_HEADER_IX(column_i); const char* expected_header = c->expected->expected[ix]; if(strcmp(header, expected_header)) { fprintf(stderr, "%s: Test %d FAIL '%s' - got header '%s' expected '%s'\n", program, c->test_index, c->line, header, expected_header); c->header_errors++; } } return SV_STATUS_OK; } static sv_status_t svtest_fields_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { unsigned int column_i; svtest_context *c = (svtest_context*)user_data; for(column_i = 0; column_i < count; column_i++) { const char* data = fields[column_i]; unsigned int ix = EXPECTED_DATA_IX(c->rows_count, column_i); const char* expected_data = c->expected->expected[ix]; unsigned int header_ix = EXPECTED_HEADER_IX(column_i); const char* expected_header = c->expected->expected[header_ix]; if(strcmp(data, expected_data)) { fprintf(stderr, "%s: Test %d FAIL '%s' row %d got %s value >>>%s<<< expected >>>%s<<<\n", program, c->test_index, c->line, c->rows_count, expected_header, data, expected_data); c->data_errors++; } } c->rows_count++; /* This code always succeeds */ return SV_STATUS_OK; } static int svtest_run_test(unsigned int test_index) { svtest_context c; size_t data_len; sv *t = NULL; const svtest_data_set *test = &svtest_data[test_index]; sv_status_t status; int rc = 0; memset(&c, '\0', sizeof(c)); c.test_index = test_index; c.columns_count = 0; c.rows_count = 0; c.expected = test; c.line = NULL; data_len = strlen(test->data); t = sv_new(&c, svtest_header_callback, svtest_fields_callback, test->sep); if(!t) { fprintf(stderr, "%s: Failed to init SV library", program); rc = 1; return rc; } sv_set_option(t, SV_OPTION_LINE_CALLBACK, svtest_line_callback); if(test->option != 0) sv_set_option(t, (sv_option_t)test->option, 1L); status = sv_parse_chunk(t, (char*)test->data, data_len); if(status != SV_STATUS_OK) { fprintf(stderr, "%s: Test %d FAIL - sv_parse_chunk() returned %d\n", program, test_index, (int)status); rc = 1; goto end_test; } status = sv_parse_chunk(t, NULL, 0); if(status != SV_STATUS_OK) { fprintf(stderr, "%s: Test %d FAIL - final sv_parse_chunk() returned %d\n", program, test_index, (int)status); rc = 1; goto end_test; } if(c.header_errors) { fprintf(stderr, "%s: Test %d FAIL '%s' - header errors\n", program, test_index, test->data); rc = 1; } else if(c.data_errors) { fprintf(stderr, "%s: Test %d FAIL '%s' - data errors\n", program, test_index, test->data); rc = 1; } else if(test->rows_count != c.rows_count) { fprintf(stderr, "%s: Test %d FAIL '%s' - saw %d records - expected %d\n", program, test_index, test->data, c.rows_count, test->rows_count); rc = 1; } else { fprintf(stderr, "%s: Test %d OK\n", program, test_index); } end_test: if(c.line) free(c.line); sv_free(t); return rc; } #define MAX_TEST_INDEX (N_TESTS-1) int main(int argc, char *argv[]) { char *p; int rc = 0; unsigned int test_index; program = argv[0]; if((p = strrchr(program, '/'))) program = p + 1; else if((p = strrchr(program, '\\'))) program = p + 1; argv[0] = program; if(argc < 1 || argc > 2) { fprintf(stderr, "USAGE: %s [TEST-INDEX 1..%d]\n", program, MAX_TEST_INDEX); rc = 1; goto tidy; } if(argc == 2) { test_index = atoi(argv[1]); if(test_index < 1 || test_index > MAX_TEST_INDEX) { fprintf(stderr, "%s: Test arg '%s' not in range 1..%d\n", program, argv[1], MAX_TEST_INDEX); rc = 1; goto tidy; } rc = svtest_run_test(test_index); } else { /* run all tests */ for(test_index = 0; test_index < N_TESTS; test_index++) { int test_rc; test_rc = svtest_run_test(test_index); if(test_rc > 0) { /* error */ rc++; } else if (test_rc < 0) { /* failure; do not run any more tests */ rc = 1; break; } } } tidy: return rc; } rasqal-0.9.33/libsv/sv.h0000644000175000017500000000552712315200246011736 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sv.h - Header for libsv * * Copyright (C) 2009-2013, David Beckett http://www.dajobe.org/ * * This package is Free Software * * 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.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. * */ /** * sv_status_t: * @SV_STATUS_OK: OK * @SV_STATUS_FAILED: Failure * @SV_STATUS_NO_MEMORY: Out of memory * @SV_STATUS_LINE_FIELDS: Line had wrong number of fields * * Status / errors */ typedef enum { SV_STATUS_OK = 0, SV_STATUS_FAILED, SV_STATUS_NO_MEMORY, SV_STATUS_LINE_FIELDS } sv_status_t; typedef struct sv_s sv; /** * @sv_fields_callback: * @t: sv object * @user_data: user data * @fields: array of fields * @widths: array of field widths * @count: size of @fields and @widths * * Callback function for sv_new() header_callback and data_callback * * Return value: #SV_STATUS_OK or error code */ typedef sv_status_t (*sv_fields_callback)(sv *t, void *user_data, char** fields, size_t *widths, size_t count); /** * @sv_line_callback: * @t: sv object * @user_data: user data * @line: line buffer * @length: size of @line * * Callback function for lines set via sv_set_option() with #SV_OPTION_LINE_CALLBACK * * Return value: #SV_STATUS_OK or error code */ typedef sv_status_t (*sv_line_callback)(sv *t, void *user_data, const char* line, size_t length); /** * sv_option_t: * * @SV_OPTION_NONE: internal * @SV_OPTION_SAVE_HEADER: save header boolean; type long * @SV_OPTION_BAD_DATA_ERROR: bad dad is error boolean; type long * @SV_OPTION_QUOTED_FIELDS: fields are quoted boolean; type long * @SV_OPTION_STRIP_WHITESPACE: strip whitespace around fields boolean; type long * @SV_OPTION_QUOTE_CHAR: set field quote char; type int (char) * @SV_OPTION_LINE_CALLBACK: Set line callback of type #sv_line_callback * * Option type */ typedef enum { SV_OPTION_NONE = 0, SV_OPTION_SAVE_HEADER, SV_OPTION_BAD_DATA_ERROR, SV_OPTION_QUOTED_FIELDS, SV_OPTION_STRIP_WHITESPACE, SV_OPTION_QUOTE_CHAR, SV_OPTION_LINE_CALLBACK } sv_option_t; sv* sv_new(void *user_data, sv_fields_callback header_callback, sv_fields_callback data_callback, char field_sep); void sv_free(sv *t); sv_status_t sv_set_option(sv *t, sv_option_t option, ...); int sv_get_line(sv *t); const char* sv_get_header(sv *t, unsigned int i, size_t *width_p); sv_status_t sv_parse_chunk(sv *t, char *buffer, size_t len); rasqal-0.9.33/libsv/example.c0000644000175000017500000001027012315200246012723 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * example.c - SV example program * * Copyright (C) 2009-2013, David Beckett http://www.dajobe.org/ * * This package is Free Software * * 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.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 SV_CONFIG #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include /* structure used for user data callback */ typedef struct { const char* filename; int count; char* line; } myc; const char* program; static sv_status_t my_sv_line_callback(sv *t, void *user_data, const char* line, size_t length) { myc *c = (myc*)user_data; if(c->line) free(c->line); c->line = (char*)malloc(length + 1); if(c->line) memcpy(c->line, line, length + 1); fprintf(stdout, "%s:%d: Line >>>%s<<<\n", c->filename, sv_get_line(t), line); /* This code always succeeds */ return SV_STATUS_OK; } static sv_status_t my_sv_header_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { unsigned int i; myc *c=(myc*)user_data; fprintf(stdout, "%s:%d: Header with %d fields\n", c->filename, sv_get_line(t), (int)count); for(i = 0; i < count; i++) fprintf(stdout, "%3d: '%s' (width %d)\n", (int)i, fields[i], (int)widths[i]); /* This code always succeeds */ return SV_STATUS_OK; } static sv_status_t my_sv_fields_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { unsigned int i; myc *c=(myc*)user_data; c->count++; fprintf(stdout, "%s:%d: Record with %d fields\n", c->filename, sv_get_line(t), (int)count); for(i = 0; i < count; i++) fprintf(stdout, "%3d %-10s: '%s' (width %d)\n", (int)i, sv_get_header(t, i, NULL), fields[i], (int)widths[i]); /* This code always succeeds */ return SV_STATUS_OK; } int main(int argc, char *argv[]) { int rc = 0; const char* data_file = NULL; FILE *fh = NULL; sv *t = NULL; myc c; size_t data_file_len; char sep = '\t'; /* default is TSV */ program = "example"; if(argc != 2) { fprintf(stderr, "USAGE: %s [SV FILE]\n", program); rc = 1; goto tidy; } data_file = (const char*)argv[1]; if(access(data_file, R_OK)) { fprintf(stderr, "%s: Failed to find data file %s\n", program, data_file); rc = 1; goto tidy; } fh = fopen(data_file, "r"); if(!fh) { fprintf(stderr, "%s: Failed to read data file %s: %s\n", program, data_file, strerror(errno)); rc = 1; goto tidy; } memset(&c, '\0', sizeof(c)); c.filename = data_file; c.count = 0; c.line = NULL; data_file_len = strlen(data_file); if(data_file_len > 4) { if(!strcmp(data_file + data_file_len - 3, "csv")) sep = ','; else if(!strcmp(data_file + data_file_len - 3, "tsv")) sep = '\t'; } /* save first line as header not data */ t = sv_new(&c, my_sv_header_callback, my_sv_fields_callback, sep); if(!t) { fprintf(stderr, "%s: Failed to init SV library", program); rc = 1; goto tidy; } sv_set_option(t, SV_OPTION_LINE_CALLBACK, my_sv_line_callback); while(!feof(fh)) { char buffer[1024]; size_t len = fread(buffer, 1, sizeof(buffer), fh); if(sv_parse_chunk(t, buffer, len)) break; } fclose(fh); fh = NULL; /* Record EOF */ sv_parse_chunk(t, NULL, 0); fprintf(stderr, "%s: Saw %d records\n", program, c.count); tidy: if(c.line) free(c.line); if(t) sv_free(t); if(fh) { fclose(fh); fh = NULL; } return rc; } rasqal-0.9.33/libsv/test1.tsv0000644000175000017500000000063712246733341012742 00000000000000subject predicate object # simple # cat sat mat # quoting # "this is" a test this "is a" test this is "a test" # tabs in quotes # "this is" a test this "is a" test this is "a test" # illegal quotes # " " " "" "" "" """ """ """ # 1 double quote # """" """" """" # 2 double quotes # """""" """""" """""" # 3 double quotes # """""""" """""""" """""""" # more quoting # quoting "can ""be""" fun rasqal-0.9.33/libsv/sv2c.c0000644000175000017500000001122612315200246012147 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sv2c.c - Turn CSV/TSV into C data * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * This package is Free Software * * 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.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 SV_CONFIG #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include /* structure used for user data callback */ typedef struct { const char* filename; int sep; int count; char* line; size_t line_len; FILE* out; } sv2c_data; const char* program; static sv_status_t sv2c_line_callback(sv *t, void *user_data, const char* line, size_t length) { sv2c_data *c = (sv2c_data*)user_data; if(c->line) free(c->line); c->line = (char*)malloc(length + 1); if(c->line) memcpy(c->line, line, length + 1); /* This code always succeeds */ return SV_STATUS_OK; } static void sv2c_print_c_quoted_string(FILE* fh, const char* str, char quote) { int ch; fputc(quote, fh); while((ch = *str++)) { if(ch == '\t') fputs("\\t", fh); else if(ch == '\r') fputs("\\r", fh); else if(ch == '\n') fputs("\\n", fh); else if(ch == quote) { fputc('\\', fh); fputc(ch, fh); } else fputc(ch, fh); } fputc(quote, fh); } static sv_status_t sv2c_fields_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { unsigned int i; sv2c_data *c = (sv2c_data*)user_data; FILE* out = c->out; if(c->line[0] != '#' && strcmp(c->line, ",,\n") && strcmp(c->line, "\t\t\n")) { c->count++; fprintf(out, "\n\nstatic const char* const expected_%d[%ld] = {", c->count, 2 * count); for(i = 0; i < count; i++) { if(i > 0 && i < count) { fputc(c->sep, out); fputc(' ', out); } fputc('"', out); fputs(sv_get_header(t, i, NULL), out); fputc('"', out); } for(i = 0; i < count; i++) { if(i < count) { fputc(c->sep, out); fputc(' ', out); } sv2c_print_c_quoted_string(out, fields[i], '"'); } fprintf(out, " };\n\n { '%c', 0, \"", c->sep); for(i = 0; i < count; i++) { if(i > 0 && i < count) fputc(',', out); fputs(sv_get_header(t, i, NULL), out); } fputs("\\n\" ", out); sv2c_print_c_quoted_string(out, c->line, '"'); fprintf(out, ", (const char** const)expected_%d, %ld, %d },\n", c->count, count, 1); } /* This code always succeeds */ return SV_STATUS_OK; } int main(int argc, char *argv[]) { int rc = 0; const char* data_file = NULL; FILE *fh = NULL; sv *t = NULL; sv2c_data c; size_t data_file_len; char sep = '\t'; /* default is TSV */ program = "example"; if(argc != 2) { fprintf(stderr, "USAGE: %s [SV FILE]\n", program); rc = 1; goto tidy; } data_file = (const char*)argv[1]; if(access(data_file, R_OK)) { fprintf(stderr, "%s: Failed to find data file %s\n", program, data_file); rc = 1; goto tidy; } fh = fopen(data_file, "r"); if(!fh) { fprintf(stderr, "%s: Failed to read data file %s: %s\n", program, data_file, strerror(errno)); rc = 1; goto tidy; } memset(&c, '\0', sizeof(c)); c.filename = data_file; c.count = 0; c.line = NULL; c.out = stdout; data_file_len = strlen(data_file); if(data_file_len > 4) { if(!strcmp(data_file + data_file_len - 3, "csv")) sep = ','; else if(!strcmp(data_file + data_file_len - 3, "tsv")) sep = '\t'; } c.sep = sep; t = sv_new(&c, NULL, sv2c_fields_callback, sep); if(!t) { fprintf(stderr, "%s: Failed to init SV library", program); rc = 1; goto tidy; } sv_set_option(t, SV_OPTION_LINE_CALLBACK, sv2c_line_callback); while(!feof(fh)) { char buffer[1024]; size_t len = fread(buffer, 1, sizeof(buffer), fh); if(sv_parse_chunk(t, buffer, len)) break; } fclose(fh); fh = NULL; if(c.line) free(c.line); tidy: if(t) sv_free(t); if(fh) { fclose(fh); fh = NULL; } return rc; } rasqal-0.9.33/libsv/test1.csv0000644000175000017500000000064112246733341012714 00000000000000subject,predicate,object ,, #,simple,# cat,sat,mat ,, #,quoting,# "this is",a,test this,"is a",test this,is,"a test" ,, #,commas in quotes,# "this,is",a,test this,"is,a",test this,is,"a,test" ,, #,illegal quotes,# ","," "","","" """,""",""" ,, #,1 double quote,# """","""","""" ,, #,2 double quotes,# """""","""""","""""" ,, #,3 double quotes,# """""""","""""""","""""""" ,, #,more quoting,# quoting,"can ""be""",fun rasqal-0.9.33/libsv/zero.tsv0000644000175000017500000000001012246733341012642 00000000000000foo bar rasqal-0.9.33/libsv/COPYING0000644000175000017500000004312212246733341012173 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. rasqal-0.9.33/libsv/.last-cl-gen0000644000175000017500000000005112271267126013242 000000000000003f899e2b2f752670b9d4a6871ccfb69f30fa24fd rasqal-0.9.33/AUTHORS0000644000175000017500000000007311432560034011060 00000000000000Dave Beckett Lauri Aalto rasqal-0.9.33/LICENSE-2.0.txt0000644000175000017500000002613610362621550012142 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. rasqal-0.9.33/COPYING0000644000175000017500000004310310444336174011054 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. rasqal-0.9.33/ChangeLog.10000644000175000017500000001746610256266172011750 000000000000002003-10-14 Dave Beckett * rdql_parser.y: Add free handlers to all the rasqal_new_sequence calls. (main): use dynamic request/free for rasqal_query so the sequences get freed. * rasqal.h: rasqal_parse_query, rdql_parse gain length argument * rdql_parser.y (rdql_parse): Updated with length argument. Use the *scan_bytes method. (main): Update test code for rdql_parse taking query length * rasqal_query.c: Updates for rdql_parse taking query length * rdql_lexer.l (rdql_token_free): Free string (part of union) only when the token type indicates a string is present. (main): close fh, save memory. Use raw free for raptor-returned memory when debugging. * Makefile.am: Gave up and machine-edit rdql_lexer.c output to put an if() around a free with a NULL arg. * rdql_parser.y, rdql_lexer.l: (main) Use raptor to turn filename into a URI string * Makefile.am: Make librasqal depend on RASQAL_INTERNAL_LIBS Prune MEM lines Make tests use librasqal.la not LIBS * configure.ac: Split internal use of libraptor.la and external use of the output of raptor-config --libs Added RASQAL_EXTERNAL_LIBS, RASQAL_LIBTOOLLIBS * rasqal-config.in: Tidy exec_prefix. Make libs work right * rasqal-config.in: added --libtool-libs * configure.ac: Add --with-raptor=internal/system using raptor-config. Handle working inside redland source tree; not tested. * rdql_parser.y (rdql_parse): Add uri_string arg. Added fake yy_init_globals to stop compiler warning; rdql_lexer.h wrongly declares a prototype to a static function. (rdql_query_error, rdql_syntax_error, rdql_syntax_warning): Use uri_string, line fields from rdql_parser. (main): Update test code to match changes. * rdql_lexer.l: Remove global filename; use uri_string field of rdql_parser (main) Update test code to match. * rdql_common.h: rdql_parser_s gains uri_string, line, column. * rasqal_query.c: (rasqal_parse_query) Add uri_string arg for base URI and/or error reporting. * rasqal.h: rasqal_aprse_query and rdql_parse now take a uri_string for base URI and/or error reporting. * rdql_lexer.l: fix standalone error/warning reporting 2003-10-13 Dave Beckett * rdql_lexer.l, rdql_parser.y: Add stdarg.h * example_at_7.rdql: fix old rdql syntax * rdql_lexer.l: Add debugging rdql_syntax_warning * configure.ac: back to automake 1.6 * Makefile.am: Add rdql_common.h * configure.ac: Automake 1.7 * rasqal_internal.h: Add more rdql internal prototypes * rdql_parser.y, rdql_lexer.l: Now re-entrant / shared lexer and parsers * rdql_common.h: RDQL lexer/parser shared internals * rdql_parser.y: Added (regex) flags to lval. Removed bit operators. Removed gramamr rules for bit operators: InclusiveOrExpression, ExclusiveOrExpression, AndExpression no longer used. * rdql_lexer.l: Updates for pattern literal and identifier recognition from context. Kill all bit operators. Added regex abbreviations LANGUAGETOKEN, PREFIX, QNAME, QUOTEDURI (copy_regex_token): Added for handling regexes and flags. Not quite working yet. Removed like token. 2003-09-21 Dave Beckett * rdql_parser.y: Tidy up after lexing, delete buffers * rdql_parser.y: Add PATTERN_LITERAL Kill END (use EOF) * rdql_lexer.l: PATTERN_LITERAL now returned using lexer state Handle some \-escapes in the patterns - guessing * rdql_parser.y: Removed term, merged into expression - added pattern. Removed URI from expression, only use as literal uri. Use specific rasql_new_expression* functions. * rasqal_general.c: Removed term, merged into expression - added pattern. Remove the 1 use of URI from expression, only use as literal uri. (rasqal_new_1op_expression, rasqal_new_2op_expression, rasqal_new_string_op_expression, rasqal_new_literal_expression, rasqal_new_variable_expression): Added. * rasqal.h: Removed term, merged into expression * rasqal_general.c: Added start of expression evaluation; committing in order to redo it. * rdql_lexer.l: Update notes after those for n3_lexer.l in raptor 2003-08-22 Dave Beckett * rdql_lexer.l (skip_cpp_comment): Added * rdql_parser.y: Add optional COMMA in lists of vars, triples, inside triples. * Makefile.am: Tidy link flags * rasqal.h: Added rasqal_compare_strings and rasqal_sequence_sort More RASQAL_API * rasqal_sequence.c (rasqal_sequence_ensure): Set min size to 8. (rasqal_sequence_grow): Just double, ensure will make sure it's minimum size is sensible. (rasqal_sequence_set_at): idx+1 is new size. (rasqal_compare_strings): Helper for: (rasqal_sequence_sort): Sort sequences. (main): Add sorting to tests. * rasqal_query.c (rasqal_query_print): Update for rasqal_sequence_print calls without print_handler arg. * rasqal.h, rdql_parser.y: Update for rasqal_new_sequence calls with print_handler arg. * rasqal_sequence.c (rasqal_new_sequence): Lose capacity. Call now takes free and print handlers. (rasqal_sequence_print_string): Helper, added. (rasqal_sequence_print): Lose print_handler. * Makefile.am: Remove -o from $(LINK) lines * Makefile.am: Added memory debugging flags flex/yacc output now compile without warnings. * rdql_lexer.l: Added missing prototypes not generated by flex. * rdql_lexer.l: Tidy and document options. No more interactive. Fix boolean, null return values. * rdql_parser.y: Move C code to section at end of file * rdql_parser.y: Prototypes. * rasqal_internal.h: Add dmalloc * rasqal_query.c: Prototypes. If optional last arg is missing or '-', read from stdin * rasqal_query.c: note rdql uri * Makefile.am: clean stuff lex -oout * rdql_parser.y, rasqal_query.c, rasqal_internal.h, rasqal_general.c, rasqal.h, Makefile.am: Parse tree is now built for RDQL in terms of rasqal sequences, terms, expressions, variables and literals. * rasqal_sequence.c: Added rasqal_sequence_print taking a callback method to print the items. 2003-08-21 Dave Beckett * rasqal_sequence.c: Added test suite and corrected. Constructor gains a free_handler. 2003-08-14 Dave Beckett * rdql_parser.y, rdql_lexer.l, rasqal_internal.h, Makefile.am: Change to rely on flex features - AT&T lex is just too feature light, and the distribution will ship with the generated files anyway. Flex is pretty widespread. Change to use prefix setting for names inside the lexer and the generated filenames. Update the calling code to match. * rdql_parser.y: Note where shift/reduce conflicts are 2003-08-13 Dave Beckett * Makefile.am: Added example5.rdql * example5.rdql: Initial import * rdql_parser.y: +stdio * rasqal.h: Added outline rasqal query and sequence API prototypes. * Makefile.am: Added rasqal_query.c rasqal_sequence. * rasqal_query.c, rasqal_sequence.c: Initial import 2003-08-12 Dave Beckett * configure.ac: Bump version to 1.1 * Snapshotted rasqal_1_0 for 1.0 release * rdql_lexer.l: Add * rasqal.spec.in, Makefile.am: fixes for RPMs * rasqal_config.h.in: Not meant to be in CVS * fix-groff-xhtml: Import from raptor CVS * MPL.html, AUTHORS, INSTALL.html, LICENSE.html: Initial import * Makefile.am: Added README.html, NEWS.html, LICENSE.html, INSTALL.html and librasqal.html * NEWS.html, README.html, autogen.sh: Initial import * configure.ac: words * Makefile.am, configure.ac, example1.rdql, example2.rdql, example3.rdql, example4.rdql, example_at_1.rdql, example_at_2.rdql, example_at_3.rdql, example_at_4.rdql, example_at_5.rdql, example_at_6.rdql, example_at_7.rdql, librasqal.3, rasqal-config.1, rasqal-config.in, rasqal-src-config.in, rasqal.h, rasqal.pc.in, rasqal.spec.in, rasqal_config.h.in, rasqal_general.c, rasqal_internal.h, rdql_lexer.l, rdql_parser.y, win32_config.h: Initial import rasqal-0.9.33/src/0000755000175000017500000000000012443715251010665 500000000000000rasqal-0.9.33/src/rasqal_dataset.c0000644000175000017500000003436012346636375013762 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_dataset.c - Rasqal dataset (set of graphs) class * * Intended to provide data interface for SPARQL Query 1.1 querying * and SPARQL Update 1.1 RDF Graph Management operations. * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr struct rasqal_dataset_triple_s { struct rasqal_dataset_triple_s *next; rasqal_triple *triple; }; typedef struct rasqal_dataset_triple_s rasqal_dataset_triple; struct rasqal_dataset_s { rasqal_world* world; rasqal_literal* base_uri_literal; rasqal_dataset_triple *head; rasqal_dataset_triple *tail; }; struct rasqal_dataset_term_iterator_s { rasqal_dataset* dataset; /* triple to match */ rasqal_triple match; /* single triple part wanted returned */ rasqal_triple_parts want; /* parts to match on - XOR of @want */ unsigned int parts; /* current triple */ rasqal_dataset_triple *cursor; }; struct rasqal_dataset_triples_iterator_s { /* current triple */ rasqal_dataset_triple *cursor; }; /* * rasqal_new_dataset: * @world: rasqal world * * INTERNAL - Constructor - Create a new dataset * * Return value: new dataset or NULL on failure */ rasqal_dataset* rasqal_new_dataset(rasqal_world* world) { rasqal_dataset* ds; if(!world) return NULL; ds = RASQAL_CALLOC(rasqal_dataset*, 1, sizeof(*ds)); if(!ds) return NULL; ds->world = world; return ds; } /* * rasqal_free_dataset: * @ds: dataset * * INTERNAL - Destructor - destroy a dataset */ void rasqal_free_dataset(rasqal_dataset* ds) { rasqal_dataset_triple *cur; if(!ds) return; cur = ds->head; while(cur) { rasqal_dataset_triple *next = cur->next; /* free shared URI literal (if present) */ rasqal_triple_set_origin(cur->triple, NULL); rasqal_free_triple(cur->triple); RASQAL_FREE(rasqal_dataset_triple, cur); cur = next; } if(ds->base_uri_literal) rasqal_free_literal(ds->base_uri_literal); RASQAL_FREE(rasqal_dataset, ds); } static void rasqal_dataset_statement_handler(void *user_data, raptor_statement *statement) { rasqal_dataset* ds; rasqal_dataset_triple *triple; ds = (rasqal_dataset*)user_data; triple = RASQAL_MALLOC(rasqal_dataset_triple*, sizeof(*triple)); triple->next = NULL; triple->triple = raptor_statement_as_rasqal_triple(ds->world, statement); /* this origin URI literal is shared amongst the triples and * freed only in rasqal_free_dataset() */ if(ds->base_uri_literal) rasqal_triple_set_origin(triple->triple, ds->base_uri_literal); if(ds->tail) ds->tail->next = triple; else ds->head = triple; ds->tail = triple; } /* * rasqal_dataset_load_graph_iostream: * @ds: dataset * @name: rdf graph format name (or NULL to guess) * @iostr: iostream to rdf graph from * @base_uri: base URI for reading from stream (or NULL) * * INTERNAL - Load an rdf graph format from an iostream into a dataset * * Return value: non-0 on failure */ int rasqal_dataset_load_graph_iostream(rasqal_dataset* ds, const char* name, raptor_iostream* iostr, raptor_uri* base_uri) { raptor_parser* parser; if(!ds) return 1; if(base_uri) { if(ds->base_uri_literal) rasqal_free_literal(ds->base_uri_literal); ds->base_uri_literal = rasqal_new_uri_literal(ds->world, raptor_uri_copy(base_uri)); } if(name) { if(!raptor_world_is_parser_name(ds->world->raptor_world_ptr, name)) { rasqal_log_error_simple(ds->world, RAPTOR_LOG_LEVEL_ERROR, /* locator */ NULL, "Invalid rdf syntax name %s ignored", name); name = NULL; } } if(!name) name = "guess"; /* parse iostr with parser and base_uri */ parser = raptor_new_parser(ds->world->raptor_world_ptr, name); raptor_parser_set_statement_handler(parser, ds, rasqal_dataset_statement_handler); /* parse and store triples */ raptor_parser_parse_iostream(parser, iostr, base_uri); raptor_free_parser(parser); return 0; } /* * rasqal_dataset_load_graph_iostream: * @ds: dataset * @name: rdf graph format name (or NULL to guess) * @uri: URI to read rdf graph from * @base_uri: base URI for reading from stream (or NULL) * * INTERNAL - Load an rdf graph format from a URI into a dataset * * Return value: non-0 on failure */ int rasqal_dataset_load_graph_uri(rasqal_dataset* ds, const char* name, raptor_uri* uri, raptor_uri* base_uri) { raptor_parser* parser; if(!ds) return 1; if(base_uri) { if(ds->base_uri_literal) rasqal_free_literal(ds->base_uri_literal); ds->base_uri_literal = rasqal_new_uri_literal(ds->world, raptor_uri_copy(base_uri)); } if(name) { if(!raptor_world_is_parser_name(ds->world->raptor_world_ptr, name)) { rasqal_log_error_simple(ds->world, RAPTOR_LOG_LEVEL_ERROR, /* locator */ NULL, "Invalid rdf syntax name %s ignored", name); name = NULL; } } if(!name) name = "guess"; /* parse iostr with parser and base_uri */ parser = raptor_new_parser(ds->world->raptor_world_ptr, name); raptor_parser_set_statement_handler(parser, ds, rasqal_dataset_statement_handler); /* parse and store triples */ raptor_parser_parse_uri(parser, uri, base_uri); raptor_free_parser(parser); return 0; } static rasqal_dataset_term_iterator* rasqal_dataset_init_match_internal(rasqal_dataset* ds, rasqal_literal* subject, rasqal_literal* predicate, rasqal_literal* object) { rasqal_dataset_term_iterator* iter; if(!ds) return NULL; iter = RASQAL_CALLOC(rasqal_dataset_term_iterator*, 1, sizeof(*iter)); if(!iter) return NULL; iter->dataset = ds; iter->match.subject = subject; iter->match.predicate = predicate; iter->match.object = object; iter->cursor = NULL; if(!subject) iter->want = RASQAL_TRIPLE_SUBJECT; else if(!object) iter->want = RASQAL_TRIPLE_OBJECT; else if (!predicate) iter->want = RASQAL_TRIPLE_PREDICATE; else iter->want = RASQAL_GOOD_CAST(rasqal_triple_parts, 0); iter->parts = RASQAL_GOOD_CAST(unsigned int, RASQAL_TRIPLE_SPO) ^ iter->want; if(ds->base_uri_literal) iter->parts |= RASQAL_TRIPLE_ORIGIN; if(rasqal_dataset_term_iterator_next(iter)) { rasqal_free_dataset_term_iterator(iter); return NULL; } return iter; } /* * rasqal_free_dataset_term_iterator: * @iter: iterator * * INTERNAL - Destructor - destroy a dataset term iterator */ void rasqal_free_dataset_term_iterator(rasqal_dataset_term_iterator* iter) { if(!iter) return; RASQAL_FREE(rasqal_dataset_term_iterator, iter); } /* * rasqal_dataset_term_iterator_get: * @iter: rasqal dataset term iterator * * INTERNAL - Get the current literal term from the iterator * * Return value: literal or NULL on failure / iterator is exhausted */ rasqal_literal* rasqal_dataset_term_iterator_get(rasqal_dataset_term_iterator* iter) { if(!iter) return NULL; if(!iter->cursor) return NULL; if(iter->want == RASQAL_TRIPLE_SUBJECT) return iter->cursor->triple->subject; else if(iter->want == RASQAL_TRIPLE_PREDICATE) return iter->cursor->triple->predicate; else return iter->cursor->triple->object; } /* * rasqal_dataset_term_iterator_next: * @iter: rasqal dataset term iterator * * INTERNAL - Move the iterator to the next object * * Return value: non-0 on error or if the iterator is exhausted */ int rasqal_dataset_term_iterator_next(rasqal_dataset_term_iterator* iter) { if(!iter) return 1; while(1) { if(iter->cursor) iter->cursor = iter->cursor->next; else iter->cursor = iter->dataset->head; if(!iter->cursor) break; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1("Matching against triple: "); rasqal_triple_print(iter->cursor->triple, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(rasqal_raptor_triple_match(iter->dataset->world, iter->cursor->triple, &iter->match, iter->parts)) return 0; } return 1; } /* * rasqal_dataset_get_triples_iterator: * @ds: dataset * @predicate: literal predicate * @object: literal object * * INTERNAL - Create an iterator to return all triples * * Return value: iterator or NULL on error or failure */ rasqal_dataset_triples_iterator* rasqal_dataset_get_triples_iterator(rasqal_dataset* ds) { rasqal_dataset_triples_iterator* ti; ti = RASQAL_CALLOC(rasqal_dataset_triples_iterator*, 1, sizeof(*ti)); if(!ti) return NULL; ti->cursor = ds->head; return ti; } /* * rasqal_free_dataset_triples_iterator: * @ti: triples iterator * * INTERNAL - Destructor - destroy a dataset triples iterator */ void rasqal_free_dataset_triples_iterator(rasqal_dataset_triples_iterator* ti) { if(!ti) return; RASQAL_FREE(rasqal_dataset_triples_iterator, ti); } /* * rasqal_dataset_triples_iterator_get * @ti: dataset * * INTERNAL - Get current triple * * Return value: triple or NULL on end of list */ rasqal_triple* rasqal_dataset_triples_iterator_get(rasqal_dataset_triples_iterator* ti) { return ti->cursor ? ti->cursor->triple : NULL; } /* * rasqal_dataset_triples_iterator_next * @iter: dataset * * INTERNAL - Move to next current triple * * Return value: non-0 if done */ int rasqal_dataset_triples_iterator_next(rasqal_dataset_triples_iterator* ti) { ti->cursor = ti->cursor->next; return (ti->cursor == NULL); } /* * rasqal_dataset_get_sources_iterator: * @ds: dataset * @predicate: literal predicate * @object: literal object * * INTERNAL - Get the sources / subjects of all triples matching (?, @predicate, @object) * * Return value: iterator or NULL on error or failure */ rasqal_dataset_term_iterator* rasqal_dataset_get_sources_iterator(rasqal_dataset* ds, rasqal_literal* predicate, rasqal_literal* object) { if(!predicate || !object) return NULL; return rasqal_dataset_init_match_internal(ds, NULL, predicate, object); } /* * rasqal_dataset_get_targets_iterator: * @ds: dataset * @subject: literal subject * @object: literal object * * INTERNAL - Get the targets / objects of all triples matching (@subject, @predicate, ?) * * Return value: iterator or NULL on error or failure */ rasqal_dataset_term_iterator* rasqal_dataset_get_targets_iterator(rasqal_dataset* ds, rasqal_literal* subject, rasqal_literal* predicate) { if(!subject || !predicate) return NULL; return rasqal_dataset_init_match_internal(ds, subject, predicate, NULL); } /* * rasqal_dataset_get_source: * @ds: dataset * @predicate: literal predicate * @object: literal object * * INTERNAL - Get the first source / subject of the triple that matches (?, @predicate, @object) * * Return value: iterator or NULL on error or failure */ rasqal_literal* rasqal_dataset_get_source(rasqal_dataset* ds, rasqal_literal* predicate, rasqal_literal* object) { rasqal_literal *literal; rasqal_dataset_term_iterator* iter; iter = rasqal_dataset_get_sources_iterator(ds, predicate, object); if(!iter) return NULL; literal = rasqal_dataset_term_iterator_get(iter); rasqal_free_dataset_term_iterator(iter); return literal; } /* * rasqal_dataset_get_target: * @ds: dataset * @subject: literal subject * @object: literal object * * INTERNAL - Get the first target / object of the triple that matches (@subject, @predicate, ?) * * Return value: iterator or NULL on error or failure */ rasqal_literal* rasqal_dataset_get_target(rasqal_dataset* ds, rasqal_literal* subject, rasqal_literal* predicate) { rasqal_literal *literal; rasqal_dataset_term_iterator* iter; iter = rasqal_dataset_get_targets_iterator(ds, subject, predicate); if(!iter) return NULL; literal = rasqal_dataset_term_iterator_get(iter); rasqal_free_dataset_term_iterator(iter); return literal; } /* * rasqal_dataset_print: * @ds: #rasqal_dataset object. * @fh: The FILE* handle to print to. * * INTERNAL - Print a Rasqal dataset in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_dataset_print(rasqal_dataset* ds, FILE *fh) { rasqal_dataset_triples_iterator* ti; ti = rasqal_dataset_get_triples_iterator(ds); while(1) { rasqal_triple* triple; triple = rasqal_dataset_triples_iterator_get(ti); if(!triple) break; fputs("Triple ", fh); rasqal_triple_print(triple, fh); fputc('\n', fh); if(rasqal_dataset_triples_iterator_next(ti)) break; } rasqal_free_dataset_triples_iterator(ti); return 0; } rasqal-0.9.33/src/rasqal_projection.c0000644000175000017500000000707712434455625014511 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_projection.c - Rasqal (SELECT) projection class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /** * rasqal_new_projection: * @query: rasqal query * @variables: sequence of order condition expressions (or NULL). Takes ownership of this sequence if present. * @wildcard: non-0 if @variables was '*' * @distinct: 1 if distinct, 2 if reduced, otherwise neither * * INTERNAL - Create a new projection object. * * Return value: a new #rasqal_projection object or NULL on failure **/ rasqal_projection* rasqal_new_projection(rasqal_query* query, raptor_sequence* variables, int wildcard, int distinct) { rasqal_projection* projection; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); projection = RASQAL_CALLOC(rasqal_projection*, 1, sizeof(*projection)); if(!projection) return NULL; projection->query = query; projection->variables = variables; projection->wildcard = wildcard ? 1 : 0; projection->distinct = distinct; return projection; } /* * rasqal_free_projection: * @projection: #rasqal_projection object * * INTERNAL - Free a projection object. * **/ void rasqal_free_projection(rasqal_projection* projection) { if(!projection) return; if(projection->variables) raptor_free_sequence(projection->variables); RASQAL_FREE(rasqal_projection, projection); } /* * rasqal_projection_get_variables_sequence: * @projection: #rasqal_projection object * * INTERNAL - Get variables inside a projection * **/ raptor_sequence* rasqal_projection_get_variables_sequence(rasqal_projection* projection) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(projection, rasqal_projection, NULL); return projection->variables; } /* * rasqal_projection_add_variable: * @projection: #rasqal_projection object * @var: #rasqal_variable variable * * INTERNAL - add a binding variable to the projection. * * Return value: non-0 on failure **/ int rasqal_projection_add_variable(rasqal_projection* projection, rasqal_variable* var) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(projection, rasqal_projection, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(var, rasqal_variable, 1); if(!projection->variables) { projection->variables = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!projection->variables) return 1; } var = rasqal_new_variable_from_variable(var); return raptor_sequence_push(projection->variables, (void*)var); } rasqal-0.9.33/src/rasqal_rowsource_empty.c0000644000175000017500000001353412301305770015562 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_empty.c - Rasqal empty rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE typedef struct { int count; } rasqal_empty_rowsource_context; static int rasqal_empty_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_empty_rowsource_context* con; con = (rasqal_empty_rowsource_context*)user_data; RASQAL_FREE(rasqal_empty_rowsource_context, con); return 0; } static int rasqal_empty_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rowsource->size = 0; return 0; } static rasqal_row* rasqal_empty_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_empty_rowsource_context* con; rasqal_row* row = NULL; con = (rasqal_empty_rowsource_context*)user_data; if(!con->count++) row = rasqal_new_row(rowsource); return row; } static raptor_sequence* rasqal_empty_rowsource_read_all_rows(rasqal_rowsource* rowsource, void *user_data) { /* rasqal_empty_rowsource_context* con; con = (rasqal_empty_rowsource_context*)user_data; */ raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(seq) { rasqal_row* row = rasqal_new_row(rowsource); raptor_sequence_push(seq, row); } return seq; } static const rasqal_rowsource_handler rasqal_empty_rowsource_handler = { /* .version = */ 1, "empty", /* .init = */ NULL, /* .finish = */ rasqal_empty_rowsource_finish, /* .ensure_variables = */ rasqal_empty_rowsource_ensure_variables, /* .read_row = */ rasqal_empty_rowsource_read_row, /* .read_all_rows = */ rasqal_empty_rowsource_read_all_rows, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /** * rasqal_new_empty_rowsource: * @world: world object * @query: query object * * INTERNAL - create a new EMPTY rowsource that always returns zero rows * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_empty_rowsource(rasqal_world *world, rasqal_query* query) { rasqal_empty_rowsource_context* con; int flags = 0; if(!world || !query) return NULL; con = RASQAL_CALLOC(rasqal_empty_rowsource_context*, 1, sizeof(*con)); if(!con) return NULL; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_empty_rowsource_handler, query->vars_table, flags); } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; rasqal_row* row = NULL; int count; raptor_sequence* seq = NULL; int failures = 0; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } query = rasqal_new_query(world, "sparql", NULL); rowsource = rasqal_new_empty_rowsource(world, query); if(!rowsource) { fprintf(stderr, "%s: failed to create empty rowsource\n", program); failures++; goto tidy; } row = rasqal_rowsource_read_row(rowsource); if(!row) { fprintf(stderr, "%s: read_row failed to return a row for an empty rowsource\n", program); failures++; goto tidy; } if(row->size) { fprintf(stderr, "%s: read_row returned an non-empty row size %d for a empty stream\n", program, row->size); failures++; goto tidy; } count = rasqal_rowsource_get_rows_count(rowsource); if(count != 1) { fprintf(stderr, "%s: read_rows returned count %d for a empty stream\n", program, count); failures++; goto tidy; } rasqal_free_row(row); row = NULL; rasqal_free_rowsource(rowsource); /* re-init rowsource */ rowsource = rasqal_new_empty_rowsource(world, query); seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: read_rows returned a NULL seq for a empty stream\n", program); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != 1) { fprintf(stderr, "%s: read_rows returned size %d seq for a empty stream\n", program, count); failures++; goto tidy; } tidy: if(row) rasqal_free_row(row); if(seq) raptor_free_sequence(seq); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_format_table.c0000644000175000017500000002215412434455625014765 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_format_table.c - Format Results in a Table * * Copyright (C) 2009-2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #include static void rasqal_free_chararray(void* object) { char** values; int i; if(!object) return; values = RASQAL_GOOD_CAST(char**, object); for(i = 0; values[i] != RASQAL_GOOD_CAST(char*, -1); i++) { if(values[i]) free(values[i]); } free(values); } static int rasqal_iostream_write_counted_string_padded(raptor_iostream *iostr, const void *string, size_t len, const char pad, size_t width) { size_t w = width - len; if(len) raptor_iostream_counted_string_write(string, len, iostr); if(w > 0) { unsigned int i; for(i = 0; i < w; i++) raptor_iostream_write_byte(pad, iostr); } return 0; } static int rasqal_query_results_write_table_bindings(raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_world* world = rasqal_query_results_get_world(results); raptor_sequence *seq = NULL; size_t *widths = NULL; int bindings_count = -1; int rows_count = 0; int rc = 0; size_t total_width = 0; int i; size_t si; size_t sep_len; char *sep = NULL; bindings_count = rasqal_query_results_get_bindings_count(results); widths = RASQAL_CALLOC(size_t*, RASQAL_GOOD_CAST(size_t, bindings_count + 1), sizeof(size_t)); if(!widths) { rc = 1; goto tidy; } widths[bindings_count] = 0; for(i = 0; i < bindings_count; i++) { const unsigned char *name; size_t w; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; w = strlen(RASQAL_GOOD_CAST(const char*, name)); if(w > widths[i]) widths[i] = w; } seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_chararray, NULL); if(!seq) { rc = 1; goto tidy; } while(!rasqal_query_results_finished(results)) { char **values; values = RASQAL_CALLOC(char**, RASQAL_GOOD_CAST(size_t, bindings_count + 1), sizeof(char*)); if(!values) { rc = 1; goto tidy; } for(i = 0; i < bindings_count; i++) { rasqal_literal *l = rasqal_query_results_get_binding_value(results, i); raptor_iostream* str_iostr; size_t v_len; if(!l) continue; str_iostr = raptor_new_iostream_to_string(world->raptor_world_ptr, (void**)&values[i], &v_len, rasqal_alloc_memory); if(!str_iostr) { rc = 1; goto tidy; } rasqal_literal_write(l, str_iostr); raptor_free_iostream(str_iostr); if(v_len > widths[i]) widths[i] = v_len; } values[i] = RASQAL_GOOD_CAST(char*, -1); raptor_sequence_push(seq, values); rasqal_query_results_next(results); } rows_count = raptor_sequence_size(seq); total_width = 0; for(i = 0; i < bindings_count; i++) total_width += widths[i]; #define VSEP "|" #define VSEP_LEN 1 #define PAD " " #define PAD_LEN 1 sep_len = total_width + RASQAL_GOOD_CAST(size_t, ((PAD_LEN+PAD_LEN) * bindings_count) + VSEP_LEN * (bindings_count + 1)); sep = RASQAL_MALLOC(char*, sep_len + 1); if(!sep) { rc = 1; goto tidy; } for(si = 0 ; si < sep_len; si++) sep[si]='-'; sep[sep_len]='\0'; if(1) { char * p = sep; memcpy(p, VSEP, VSEP_LEN); p += VSEP_LEN; for(i = 0; i < bindings_count; i++) { p += PAD_LEN + widths[i] + PAD_LEN; memcpy(p, VSEP, VSEP_LEN); p += VSEP_LEN; } } /* Generate separator */ rasqal_iostream_write_counted_string_padded(iostr, NULL, 0, '-', sep_len); raptor_iostream_write_byte('\n', iostr); /* Generate variables header */ raptor_iostream_counted_string_write(VSEP, VSEP_LEN, iostr); for(i = 0; i < bindings_count; i++) { const unsigned char *name; size_t w; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; w = strlen(RASQAL_GOOD_CAST(const char*, name)); raptor_iostream_counted_string_write(PAD, PAD_LEN, iostr); rasqal_iostream_write_counted_string_padded(iostr, name, w, ' ', widths[i]); raptor_iostream_counted_string_write(PAD, PAD_LEN, iostr); raptor_iostream_counted_string_write(VSEP, VSEP_LEN, iostr); } raptor_iostream_write_byte('\n', iostr); /* Generate separator */ rasqal_iostream_write_counted_string_padded(iostr, NULL, 0, '=', sep_len); raptor_iostream_write_byte('\n', iostr); /* Write values */ if(rows_count) { int rowi; for(rowi = 0; rowi < rows_count; rowi++) { char **values = (char**)raptor_sequence_get_at(seq, rowi); raptor_iostream_counted_string_write(VSEP, VSEP_LEN, iostr); for(i = 0; i < bindings_count; i++) { char *value = values[i]; size_t w = value ? strlen(RASQAL_GOOD_CAST(const char*, value)) : 0; raptor_iostream_counted_string_write(PAD, PAD_LEN, iostr); rasqal_iostream_write_counted_string_padded(iostr, value, w, ' ', widths[i]); raptor_iostream_counted_string_write(PAD, PAD_LEN, iostr); raptor_iostream_counted_string_write(VSEP, VSEP_LEN, iostr); } raptor_iostream_write_byte('\n', iostr); } /* Generate end separator */ rasqal_iostream_write_counted_string_padded(iostr, NULL, 0, '-', sep_len); raptor_iostream_write_byte('\n', iostr); } tidy: if(sep) RASQAL_FREE(string, sep); if(widths) RASQAL_FREE(intarray, widths); if(seq) raptor_free_sequence(seq); return rc; } static int rasqal_query_results_write_table_boolean(raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { if (rasqal_query_results_get_boolean(results)) { raptor_iostream_counted_string_write("--------\n", 9, iostr); raptor_iostream_counted_string_write("| true |\n", 9, iostr); raptor_iostream_counted_string_write("--------\n", 9, iostr); } else { raptor_iostream_counted_string_write("---------\n", 10, iostr); raptor_iostream_counted_string_write("| false |\n", 10, iostr); raptor_iostream_counted_string_write("---------\n", 10, iostr); } return 0; } static int rasqal_query_results_write_table(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_query* query = rasqal_query_results_get_query(results); rasqal_query_results_type type; type = rasqal_query_results_get_type(results); if(type == RASQAL_QUERY_RESULTS_BINDINGS) { return rasqal_query_results_write_table_bindings(iostr, results, base_uri); } else if(type == RASQAL_QUERY_RESULTS_BOOLEAN) { return rasqal_query_results_write_table_boolean(iostr, results, base_uri); } else { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Cannot write table format for %s query result format", rasqal_query_results_type_label(type)); return 1; } } static const char* const table_names[] = { "table", NULL}; static const raptor_type_q table_types[] = { { "text/plain", 10, 10}, { NULL, 0, 0} }; static int rasqal_query_results_table_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = table_names; factory->desc.mime_types = table_types; factory->desc.label = "Table"; factory->desc.uri_strings = NULL; factory->desc.flags = 0; factory->write = rasqal_query_results_write_table; factory->get_rowsource = NULL; return rc; } int rasqal_init_result_format_table(rasqal_world* world) { return !rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_table_register_factory); } rasqal-0.9.33/src/rasqal_expr_datetimes.c0000644000175000017500000002136112327014627015334 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_expr_datetimes.c - Rasqal date and time expression functions * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr /* * rasqal_expression_evaluate_now: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_NOW, RASQAL_EXPR_DATETIME expressions. * * Return value: A #rasqal_literal value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_now(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; struct timeval *tv; rasqal_xsd_datetime* dt; tv = rasqal_world_get_now_timeval(world); if(!tv) goto failed; dt = rasqal_new_xsd_datetime_from_timeval(world, tv); if(!dt) goto failed; return rasqal_new_datetime_literal_from_datetime(world, dt); failed: if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_to_unixtime: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate LAQRS RASQAL_EXPR_TO_UNIXTIME (datetime) expression. * * Return value: A #rasqal_literal integer value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_to_unixtime(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l; time_t unixtime = 0; l = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l) goto failed; if(l->type != RASQAL_LITERAL_DATETIME) goto failed; unixtime = rasqal_xsd_datetime_get_as_unixtime(l->value.datetime); rasqal_free_literal(l); l = NULL; if(!unixtime) goto failed; return rasqal_new_numeric_literal_from_long(world, RASQAL_LITERAL_INTEGER, unixtime); failed: if(error_p) *error_p = 1; if(l) rasqal_free_literal(l); return NULL; } /* * rasqal_expression_evaluate_from_unixtime: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate LAQRS RASQAL_EXPR_FROM_UNIXTIME (integer expr) expression. * * Return value: A #rasqal_literal datetime value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_from_unixtime(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l; int unixtime = 0; rasqal_xsd_datetime* dt; l = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l) goto failed; unixtime = rasqal_literal_as_integer(l, error_p); rasqal_free_literal(l); l = NULL; if(error_p && *error_p) goto failed; dt = rasqal_new_xsd_datetime_from_unixtime(world, unixtime); if(!dt) goto failed; return rasqal_new_datetime_literal_from_datetime(world, dt); failed: if(error_p) *error_p = 1; if(l) rasqal_free_literal(l); return NULL; } /* * rasqal_expression_evaluate_datetime_part: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_YEAR, RASQAL_EXPR_MONTH, * RASQAL_EXPR_DAY, RASQAL_EXPR_HOURS, RASQAL_EXPR_MINUTES, * RASQAL_EXPR_SECONDS (datetime) expressions. * * Return value: A #rasqal_literal integer value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_datetime_part(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l; int i; l = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l) goto failed; if(l->type != RASQAL_LITERAL_DATETIME) goto failed; /* SECONDS accessor has decimal results and includes microseconds */ if(e->op == RASQAL_EXPR_SECONDS) { rasqal_xsd_decimal* dec; rasqal_literal* result = NULL; dec = rasqal_xsd_datetime_get_seconds_as_decimal(world, l->value.datetime); rasqal_free_literal(l); if(dec) { result = rasqal_new_decimal_literal_from_decimal(world, NULL, dec); if(!result) rasqal_free_xsd_decimal(dec); } if(!result) goto failed; return result; } /* The remaining accessors have xsd:integer results */ if(e->op == RASQAL_EXPR_YEAR) i = l->value.datetime->year; else if(e->op == RASQAL_EXPR_MONTH) i = l->value.datetime->month; else if(e->op == RASQAL_EXPR_DAY) i = l->value.datetime->day; else if(e->op == RASQAL_EXPR_HOURS) i = l->value.datetime->hour; else if(e->op == RASQAL_EXPR_MINUTES) i = l->value.datetime->minute; else if(e->op == RASQAL_EXPR_SECONDS) i = l->value.datetime->second; else i = 0; rasqal_free_literal(l); return rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, i); failed: if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_datetime_timezone: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_TIMEZONE (datetime) expression. * * Return value: A #rasqal_literal xsd:dayTimeDuration value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_datetime_timezone(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l; const unsigned char* s = NULL; raptor_uri* dt_uri; l = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l) goto failed; if(l->type != RASQAL_LITERAL_DATETIME) goto failed; s = RASQAL_GOOD_CAST(const unsigned char*, rasqal_xsd_datetime_get_timezone_as_counted_string(l->value.datetime, NULL)); if(!s) goto failed; dt_uri = raptor_new_uri_from_uri_local_name(world->raptor_world_ptr, world->xsd_namespace_uri, RASQAL_GOOD_CAST(unsigned char*, "dayTimeDuration")); if(!dt_uri) goto failed; rasqal_free_literal(l); /* after this s and dt_uri are owned by the result literal */ return rasqal_new_string_literal(world, s, NULL, dt_uri, NULL); failed: if(error_p) *error_p = 1; if(s) RASQAL_FREE(char*, s); if(l) rasqal_free_literal(l); return NULL; } /* * rasqal_expression_evaluate_datetime_tz: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_TZ (datetime) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_datetime_tz(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l; const unsigned char* s = NULL; l = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l) goto failed; if(l->type != RASQAL_LITERAL_DATETIME) goto failed; #define TIMEZONE_STRING_LEN 7 s = RASQAL_GOOD_CAST(const unsigned char*, rasqal_xsd_datetime_get_tz_as_counted_string(l->value.datetime, NULL)); if(!s) goto failed; rasqal_free_literal(l); /* after this s is owned by the result literal */ return rasqal_new_string_literal(world, s, NULL, NULL, NULL); failed: if(error_p) *error_p = 1; if(l) rasqal_free_literal(l); return NULL; } rasqal-0.9.33/src/rasqal_rowsource_triples.c0000644000175000017500000004201312435141254016103 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_triples.c - Rasqal triple pattern rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE typedef struct { /* source of triple pattern matches */ rasqal_triples_source* triples_source; /* sequence of triple SHARED with query */ raptor_sequence* triples; /* current column being iterated */ int column; /* first triple pattern in sequence to use */ int start_column; /* last triple pattern in sequence to use */ int end_column; /* number of triple patterns in the sequence ( = end_column - start_column + 1) */ int triples_count; /* An array of items, one per triple pattern in the sequence */ rasqal_triple_meta* triple_meta; /* offset into results for current row */ int offset; /* number of variables used in variables table */ int size; /* GRAPH origin to use */ rasqal_literal *origin; } rasqal_triples_rowsource_context; static int rasqal_triples_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_query *query = rowsource->query; rasqal_triples_rowsource_context *con; int column; int rc = 0; int size; int i; con = (rasqal_triples_rowsource_context*)user_data; size = rasqal_variables_table_get_total_variables_count(query->vars_table); /* Construct the ordered projection of the variables set by these triples */ con->size = 0; for(i = 0; i < size; i++) { rasqal_variable *v; v = rasqal_variables_table_get(rowsource->vars_table, i); for(column = con->start_column; column <= con->end_column; column++) { if(rasqal_query_variable_bound_in_triple(query, v, column)) { v = rasqal_new_variable_from_variable(v); if(raptor_sequence_push(rowsource->variables_sequence, v)) return -1; con->size++; break; /* end column search loop */ } } } con->column = con->start_column; for(column = con->start_column; column <= con->end_column; column++) { rasqal_triple_meta *m; rasqal_triple *t; rasqal_variable* v; m = &con->triple_meta[column - con->start_column]; m->parts = (rasqal_triple_parts)0; t = (rasqal_triple*)raptor_sequence_get_at(con->triples, column); if((v = rasqal_literal_as_variable(t->subject)) && rasqal_query_variable_bound_in_triple(query, v, column) & RASQAL_TRIPLE_SUBJECT) m->parts = (rasqal_triple_parts)(m->parts | RASQAL_TRIPLE_SUBJECT); if((v = rasqal_literal_as_variable(t->predicate)) && rasqal_query_variable_bound_in_triple(query, v, column) & RASQAL_TRIPLE_PREDICATE) m->parts = (rasqal_triple_parts)(m->parts | RASQAL_TRIPLE_PREDICATE); if((v = rasqal_literal_as_variable(t->object)) && rasqal_query_variable_bound_in_triple(query, v, column) & RASQAL_TRIPLE_OBJECT) m->parts = (rasqal_triple_parts)(m->parts | RASQAL_TRIPLE_OBJECT); RASQAL_DEBUG4("triple pattern column %d has parts %s (%u)\n", column, rasqal_engine_get_parts_string(m->parts), m->parts); } return rc; } static int rasqal_triples_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_triples_rowsource_context* con; con = (rasqal_triples_rowsource_context*)user_data; rowsource->size = con->size; return 0; } static int rasqal_triples_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_triples_rowsource_context *con; int i; con = (rasqal_triples_rowsource_context*)user_data; if(con->triple_meta) { for(i = con->start_column; i <= con->end_column; i++) { rasqal_triple_meta *m; m = &con->triple_meta[i - con->start_column]; rasqal_reset_triple_meta(m); } RASQAL_FREE(rasqal_triple_meta, con->triple_meta); } if(con->origin) rasqal_free_literal(con->origin); RASQAL_FREE(rasqal_triples_rowsource_context, con); return 0; } static rasqal_engine_error rasqal_triples_rowsource_get_next_row(rasqal_rowsource* rowsource, rasqal_triples_rowsource_context *con) { rasqal_query *query = rowsource->query; rasqal_engine_error error = RASQAL_ENGINE_OK; while(con->column >= con->start_column) { rasqal_triple_meta *m; rasqal_triple *t; m = &con->triple_meta[con->column - con->start_column]; t = (rasqal_triple*)raptor_sequence_get_at(con->triples, con->column); error = RASQAL_ENGINE_OK; if(!m->triples_match) { /* Column has no triples match so create a new query */ m->triples_match = rasqal_new_triples_match(query, con->triples_source, m, t); if(!m->triples_match) { /* triples matching setup failed - matching state is unknown */ RASQAL_DEBUG2("Failed to make a triple match for column %d\n", con->column); error = RASQAL_ENGINE_FAILED; break; } RASQAL_DEBUG2("made new triples match for column %d\n", con->column); } if(rasqal_triples_match_is_end(m->triples_match)) { RASQAL_DEBUG2("end of pattern triples match for column %d\n", con->column); /* reset this column and move to next match in previous column */ rasqal_reset_triple_meta(m); con->column--; if(con->column < con->start_column) { error = RASQAL_ENGINE_FINISHED; break; } continue; } if(m->parts) { rasqal_triple_parts parts; parts = rasqal_triples_match_bind_match(m->triples_match, m->bindings, m->parts); RASQAL_DEBUG4("bind_match for column %d returned parts %s (%u)\n", con->column, rasqal_engine_get_parts_string(parts), parts); if(!parts) { rasqal_triples_match_next_match(m->triples_match); continue; } } else { RASQAL_DEBUG2("Nothing to bind_match for column %d\n", con->column); } rasqal_triples_match_next_match(m->triples_match); if(con->column == con->end_column) /* finished matching all columns - return result */ break; /* continue matching in next column */ con->column++; } return error; } static rasqal_row* rasqal_triples_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_triples_rowsource_context *con; int i; rasqal_row* row = NULL; rasqal_engine_error error = RASQAL_ENGINE_OK; con = (rasqal_triples_rowsource_context*)user_data; error = rasqal_triples_rowsource_get_next_row(rowsource, con); RASQAL_DEBUG2("rasqal_triples_rowsource_get_next_row() returned error %s\n", rasqal_engine_error_as_string(error)); if(error != RASQAL_ENGINE_OK) goto done; #ifdef RASQAL_DEBUG if(1) { int values_returned = 0; /* Count actual bound values */ for(i = 0; i < con->size; i++) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(v->value) values_returned++; } RASQAL_DEBUG2("Solution binds %d values\n", values_returned); } #endif row = rasqal_new_row(rowsource); if(!row) { error = RASQAL_ENGINE_FAILED; goto done; } for(i = 0; i < row->size; i++) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(row->values[i]) rasqal_free_literal(row->values[i]); row->values[i] = rasqal_new_literal_from_literal(v->value); } row->offset = con->offset++; done: return row; } static raptor_sequence* rasqal_triples_rowsource_read_all_rows(rasqal_rowsource* rowsource, void *user_data) { raptor_sequence *seq = NULL; return seq; } static int rasqal_triples_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_triples_rowsource_context *con; int column; con = (rasqal_triples_rowsource_context*)user_data; con->column = con->start_column; for(column = con->start_column; column <= con->end_column; column++) { rasqal_triple_meta *m; m = &con->triple_meta[column - con->start_column]; rasqal_reset_triple_meta(m); } return 0; } static int rasqal_triples_rowsource_set_origin(rasqal_rowsource *rowsource, void *user_data, rasqal_literal *origin) { rasqal_triples_rowsource_context *con; int column; con = (rasqal_triples_rowsource_context*)user_data; if(con->origin) rasqal_free_literal(con->origin); con->origin = rasqal_new_literal_from_literal(origin); for(column = con->start_column; column <= con->end_column; column++) { rasqal_triple *t; t = (rasqal_triple*)raptor_sequence_get_at(con->triples, column); if(t->origin) rasqal_free_literal(t->origin); t->origin = rasqal_new_literal_from_literal(con->origin); } return 0; } static const rasqal_rowsource_handler rasqal_triples_rowsource_handler = { /* .version = */ 1, "triple pattern", /* .init = */ rasqal_triples_rowsource_init, /* .finish = */ rasqal_triples_rowsource_finish, /* .ensure_variables = */ rasqal_triples_rowsource_ensure_variables, /* .read_row = */ rasqal_triples_rowsource_read_row, /* .read_all_rows = */ rasqal_triples_rowsource_read_all_rows, /* .reset = */ rasqal_triples_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ rasqal_triples_rowsource_set_origin }; /** * rasqal_new_triples_rowsource: * @world: world object * @query: query object * @triples_source: shared triples source * @triples: shared triples sequence * @start_column: start column in triples sequence * @end_column: end column in triples sequence * @bound_in: array marking the triples that bind a variable * * INTERNAL - create a new triples rowsource * * Return value: new triples rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_triples_rowsource(rasqal_world *world, rasqal_query *query, rasqal_triples_source* triples_source, raptor_sequence* triples, int start_column, int end_column) { rasqal_triples_rowsource_context *con; int flags = 0; if(!world || !query || !triples_source) return NULL; if(!triples) return rasqal_new_empty_rowsource(world, query); con = RASQAL_CALLOC(rasqal_triples_rowsource_context*, 1, sizeof(*con)); if(!con) return NULL; con->triples_source = triples_source; con->triples = triples; con->start_column = start_column; con->end_column = end_column; con->column = -1; con->triples_count = con->end_column - con->start_column + 1; con->triple_meta = RASQAL_CALLOC(rasqal_triple_meta*, RASQAL_GOOD_CAST(size_t, con->triples_count), sizeof(rasqal_triple_meta)); if(!con->triple_meta) { rasqal_triples_rowsource_finish(NULL, con); return NULL; } return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_triples_rowsource_handler, query->vars_table, flags); } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); #define QUERY_LANGUAGE "sparql" #define QUERY_FORMAT "\ SELECT ?s ?p ?o \ FROM <%s> \ WHERE { ?s ?p ?o }\ " int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_world *world; rasqal_query *query; const char *query_language_name = QUERY_LANGUAGE; const char *query_format = QUERY_FORMAT; unsigned char *query_string; int failures = 0; int start_column; int end_column; int rc; raptor_sequence* triples; rasqal_triples_source* triples_source = NULL; raptor_uri *base_uri = NULL; unsigned char *data_string = NULL; unsigned char *uri_string = NULL; /* "object" . */ #define SUBJECT_URI_STRING RASQAL_GOOD_CAST(const unsigned char*, "http://example.org#subject") #define PREDICATE_URI_STRING RASQAL_GOOD_CAST(const unsigned char*, "http://example.org#predicate") #define OBJECT_STRING "object" raptor_uri* s_uri = NULL; raptor_uri* p_uri = NULL; const char *data_file; if((data_file = getenv("NT_DATA_FILE"))) { /* got data from environment */ } else { if(argc != 2) { fprintf(stderr, "USAGE: %s data-filename\n", program); return(1); } data_file = argv[1]; } world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } query = rasqal_new_query(world, "sparql", NULL); data_string = raptor_uri_filename_to_uri_string(data_file); query_string = RASQAL_MALLOC(unsigned char*, strlen(RASQAL_GOOD_CAST(const char*, data_string)) + strlen(query_format) + 1); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(RASQAL_GOOD_CAST(char*, query_string), query_format, data_string); #pragma GCC diagnostic pop raptor_free_memory(data_string); uri_string = raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); query = rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); failures++; goto tidy; } printf("%s: preparing %s query\n", program, query_language_name); rc = rasqal_query_prepare(query, query_string, base_uri); if(rc) { fprintf(stderr, "%s: failed to prepare query '%s'\n", program, query_string); failures++; goto tidy; } RASQAL_FREE(char*, query_string); query_string = NULL; triples = rasqal_query_get_triple_sequence(query); start_column = 0; end_column = 0; triples_source = rasqal_new_triples_source(query); rowsource = rasqal_new_triples_rowsource(world, query, triples_source, triples, start_column, end_column); if(!rowsource) { fprintf(stderr, "%s: failed to create triples rowsource\n", program); failures++; goto tidy; } while(1) { rasqal_row* row; rasqal_literal *s; rasqal_literal *p; rasqal_literal *o; row = rasqal_rowsource_read_row(rowsource); if(!row) break; #ifdef RASQAL_DEBUG RASQAL_DEBUG1("Result Row:\n "); rasqal_row_print(row, stderr); fputc('\n', stderr); #endif s_uri = raptor_new_uri(world->raptor_world_ptr, SUBJECT_URI_STRING); p_uri = raptor_new_uri(world->raptor_world_ptr, PREDICATE_URI_STRING); s = row->values[0]; if(!s || (s && s->type != RASQAL_LITERAL_URI) || !raptor_uri_equals(s->value.uri, s_uri)) { fprintf(stderr, "%s: 's' is bound to %s not URI %s\n", program, rasqal_literal_as_string(s), raptor_uri_as_string(s_uri)); failures++; } p = row->values[1]; if(!p || (p && p->type != RASQAL_LITERAL_URI) || !raptor_uri_equals(p->value.uri, p_uri)) { fprintf(stderr, "%s: 'p' is bound to %s not URI %s\n", program, rasqal_literal_as_string(p), raptor_uri_as_string(p_uri)); failures++; } o = row->values[2]; if(!o || (o && o->type != RASQAL_LITERAL_STRING) || strcmp(RASQAL_GOOD_CAST(const char*, o->string), OBJECT_STRING)) { fprintf(stderr, "%s: 'o' is bound to %s not string '%s'\n", program, rasqal_literal_as_string(o), OBJECT_STRING); failures++; } rasqal_free_row(row); if(failures) break; } tidy: raptor_free_uri(base_uri); if(s_uri) raptor_free_uri(s_uri); if(p_uri) raptor_free_uri(p_uri); if(triples_source) rasqal_free_triples_source(triples_source); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_general.c0000644000175000017500000007447512434455625013760 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_general.c - Rasqal library startup, shutdown and factories * * Copyright (C) 2004-2014, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef MAINTAINER_MODE #include #endif /* prototypes for helper functions */ static void rasqal_delete_query_language_factories(rasqal_world*); static void rasqal_free_query_language_factory(rasqal_query_language_factory *factory); /* statics */ const char * const rasqal_short_copyright_string = "Copyright 2003-2014 David Beckett. Copyright 2003-2005 University of Bristol"; const char * const rasqal_copyright_string = "Copyright (C) 2003-2014 David Beckett - http://www.dajobe.org/\nCopyright (C) 2003-2005 University of Bristol - http://www.bristol.ac.uk/"; const char * const rasqal_license_string = "LGPL 2.1 or newer, GPL 2 or newer, Apache 2.0 or newer.\nSee http://librdf.org/rasqal/LICENSE.html for full terms."; const char * const rasqal_home_url_string = "http://librdf.org/rasqal/"; /** * rasqal_version_string: * * Library full version as a string. * * See also #rasqal_version_decimal. */ const char * const rasqal_version_string = RASQAL_VERSION_STRING #ifdef GIT_VERSION " GIT " GIT_VERSION #endif ; /** * rasqal_version_major: * * Library major version number as a decimal integer. */ const unsigned int rasqal_version_major = RASQAL_VERSION_MAJOR; /** * rasqal_version_minor: * * Library minor version number as a decimal integer. */ const unsigned int rasqal_version_minor = RASQAL_VERSION_MINOR; /** * rasqal_version_release: * * Library release version number as a decimal integer. */ const unsigned int rasqal_version_release = RASQAL_VERSION_RELEASE; /** * rasqal_version_decimal: * * Library full version as a decimal integer. * * See also #rasqal_version_string. */ const unsigned int rasqal_version_decimal = RASQAL_VERSION; /** * rasqal_new_world: * * Allocate a new rasqal_world object. * * The rasqal_world is initialized with rasqal_world_open(). * Allocation and initialization are decoupled to allow * changing settings on the world object before init. * * Return value: rasqal_world object or NULL on failure **/ rasqal_world* rasqal_new_world(void) { rasqal_world* world; world = RASQAL_CALLOC(rasqal_world*, 1, sizeof(*world)); if(!world) return NULL; world->warning_level = RASQAL_WARNING_LEVEL_DEFAULT; world->genid_counter = 1; return world; } /** * rasqal_world_open: * @world: rasqal_world object * * Initialise the rasqal library. * * Initializes a #rasqal_world object created by rasqal_new_world(). * Allocation and initialization are decoupled to allow * changing settings on the world object before init. * These settings include e.g. the raptor library instance set with * rasqal_world_set_raptor(). * * The initialized world object is used with subsequent rasqal API calls. * * Return value: non-0 on failure **/ int rasqal_world_open(rasqal_world *world) { int rc; if(!world) return -1; if(world->opened++) return 0; /* not an error */ /* Create and init a raptor_world unless one is provided externally with rasqal_world_set_raptor() */ if(!world->raptor_world_ptr) { world->raptor_world_ptr = raptor_new_world(); if(!world->raptor_world_ptr) return -1; world->raptor_world_allocated_here = 1; rc = raptor_world_open(world->raptor_world_ptr); if(rc) return rc; } rc = rasqal_uri_init(world); if(rc) return rc; rc = rasqal_xsd_init(world); if(rc) return rc; world->query_languages = raptor_new_sequence((raptor_data_free_handler)rasqal_free_query_language_factory, NULL); if(!world->query_languages) return 1; /* first query language declared is the default */ #ifdef RASQAL_QUERY_SPARQL rc = rasqal_init_query_language_sparql(world); if(rc) return rc; rc = rasqal_init_query_language_sparql11(world); if(rc) return rc; #endif #ifdef RASQAL_QUERY_LAQRS rc = rasqal_init_query_language_laqrs(world); if(rc) return rc; #endif rc = rasqal_raptor_init(world); if(rc) return rc; rc = rasqal_init_query_results(); if(rc) return rc; rc = rasqal_init_result_formats(world); if(rc) return rc; return 0; } /** * rasqal_free_world: * @world: rasqal_world object * * Terminate the rasqal library. * * Destroys a rasqal_world object and all static information. * **/ void rasqal_free_world(rasqal_world* world) { if(!world) return; rasqal_finish_result_formats(world); rasqal_finish_query_results(); rasqal_delete_query_language_factories(world); #ifdef RAPTOR_TRIPLES_SOURCE_REDLAND rasqal_redland_finish(); #endif rasqal_xsd_finish(world); rasqal_uri_finish(world); if(world->raptor_world_ptr && world->raptor_world_allocated_here) raptor_free_world(world->raptor_world_ptr); RASQAL_FREE(rasqal_world, world); } /** * rasqal_world_set_raptor: * @world: rasqal_world object * @raptor_world_ptr: raptor_world object * * Set the #raptor_world instance to be used with this #rasqal_world. * * If no raptor_world instance is set with this function, * rasqal_world_open() creates a new instance. * * Ownership of the raptor_world is not taken. If the raptor library * instance is set with this function, rasqal_free_world() will not * free it. * **/ void rasqal_world_set_raptor(rasqal_world* world, raptor_world* raptor_world_ptr) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(world, rasqal_world); world->raptor_world_ptr = raptor_world_ptr; } /** * rasqal_world_get_raptor: * @world: rasqal_world object * * Get the #raptor_world instance used by this #rasqal_world. * * Return value: raptor_world object or NULL on failure (e.g. not initialized) **/ raptor_world* rasqal_world_get_raptor(rasqal_world* world) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); return world->raptor_world_ptr; } /** * rasqal_world_set_log_handler: * @world: rasqal_world object * @user_data: user data for log handler function * @handler: log handler function * * Set the log handler for this rasqal_world. * * Also sets the raptor log handler to the same @user_data and * @handler via raptor_world_set_log_handler(). (Rasqal 0.9.26+) **/ void rasqal_world_set_log_handler(rasqal_world* world, void *user_data, raptor_log_handler handler) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(world, rasqal_world); world->log_handler = handler; world->log_handler_user_data = user_data; raptor_world_set_log_handler(world->raptor_world_ptr, user_data, handler); } /* helper functions */ /* * rasqal_free_query_language_factory - delete a query language factory */ static void rasqal_free_query_language_factory(rasqal_query_language_factory *factory) { if(!factory) return; if(factory->finish_factory) factory->finish_factory(factory); RASQAL_FREE(rasqal_query_language_factory, factory); } /* * rasqal_delete_query_language_factories - helper function to delete all the registered query language factories */ static void rasqal_delete_query_language_factories(rasqal_world *world) { if(world->query_languages) { raptor_free_sequence(world->query_languages); world->query_languages = NULL; } } /* class methods */ /* * rasqal_query_language_register_factory: * @factory: pointer to function to call to register the factory * * INTERNAL - Register a query language syntax handled by a query factory * * Return value: new factory or NULL on failure **/ RASQAL_EXTERN_C rasqal_query_language_factory* rasqal_query_language_register_factory(rasqal_world *world, int (*factory) (rasqal_query_language_factory*)) { rasqal_query_language_factory *query = NULL; query = RASQAL_CALLOC(rasqal_query_language_factory*, 1, sizeof(*query)); if(!query) goto tidy; query->world = world; if(raptor_sequence_push(world->query_languages, query)) return NULL; /* on error, query is already freed by the sequence */ /* Call the query registration function on the new object */ if(factory(query)) return NULL; /* query is owned and freed by the query_languages sequence */ if(raptor_syntax_description_validate(&query->desc)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Query language format description failed to validate\n"); goto tidy; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Registered query language %s with context size %d\n", query->desc.names[0], query->context_length); #endif return query; /* Clean up on failure */ tidy: if(query) rasqal_free_query_language_factory(query); return NULL; } /** * rasqal_get_query_language_factory: * @name: the factory name or NULL for the default factory * @uri: the query syntax URI or NULL * * Get a query factory by name. * * Return value: the factory object or NULL if there is no such factory **/ rasqal_query_language_factory* rasqal_get_query_language_factory(rasqal_world *world, const char *name, const unsigned char *uri) { rasqal_query_language_factory *factory = NULL; /* return 1st query language if no particular one wanted - why? */ if(!name) { factory = (rasqal_query_language_factory*)raptor_sequence_get_at(world->query_languages, 0); if(!factory) { RASQAL_DEBUG1("No (default) query languages registered\n"); return NULL; } } else { int i; for(i = 0; (factory = (rasqal_query_language_factory*)raptor_sequence_get_at(world->query_languages, i)); i++) { int namei; const char* fname; for(namei = 0; (fname = factory->desc.names[namei]); namei++) { if(!strcmp(fname, name)) break; } if(fname) break; } } return factory; } /** * rasqal_world_get_query_language_description: * @world: world object * @counter: index into the list of query languages * * Get query language descriptive information * * Return value: description or NULL if counter is out of range **/ const raptor_syntax_description* rasqal_world_get_query_language_description(rasqal_world* world, unsigned int counter) { rasqal_query_language_factory *factory; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); rasqal_world_open(world); factory = (rasqal_query_language_factory *)raptor_sequence_get_at(world->query_languages, RASQAL_GOOD_CAST(int, counter)); if(!factory) return NULL; return &factory->desc; } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_languages_enumerate: * @world: rasqal_world object * @counter: index into the list of syntaxes * @name: pointer to store the name of the syntax (or NULL) * @label: pointer to store syntax readable label (or NULL) * @uri_string: pointer to store syntax URI string (or NULL) * * @deprecated: Use rasqal_world_get_query_language_description() instead. * * Get information on query languages. * * Return value: non 0 on failure of if counter is out of range **/ int rasqal_languages_enumerate(rasqal_world *world, unsigned int counter, const char **name, const char **label, const unsigned char **uri_string) { rasqal_query_language_factory *factory; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); if(!name && !label && !uri_string) return 1; /* for compatibility with old API that does not call this - FIXME Remove V2 */ rasqal_world_open(world); factory = (rasqal_query_language_factory*)raptor_sequence_get_at(world->query_languages, RASQAL_GOOD_CAST(int, counter)); if(!factory) return 1; if(name) *name = factory->desc.names[0]; if(label) *label = factory->desc.label; if(uri_string && factory->desc.uri_strings) *uri_string = RASQAL_GOOD_CAST(const unsigned char*, factory->desc.uri_strings[0]); return 0; } #endif /** * rasqal_language_name_check: * @world: rasqal_world object * @name: the query language name * * Check name of a query language. * * Return value: non 0 if name is a known query language */ int rasqal_language_name_check(rasqal_world* world, const char *name) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 0); return (rasqal_get_query_language_factory(world, name, NULL) != NULL); } static const char* const rasqal_log_level_labels[RAPTOR_LOG_LEVEL_LAST+1]={ "none", "trace", "debug", "info", "warn", "error", "fatal" }; /* internal */ void rasqal_log_error_simple(rasqal_world* world, raptor_log_level level, raptor_locator* locator, const char* message, ...) { va_list arguments; if(level == RAPTOR_LOG_LEVEL_NONE) return; va_start(arguments, message); rasqal_log_error_varargs(world, level, locator, message, arguments); va_end(arguments); } /* internal */ void rasqal_log_warning_simple(rasqal_world* world, rasqal_warning_level warn_level, raptor_locator* locator, const char* message, ...) { va_list arguments; if(warn_level > world->warning_level) return; va_start(arguments, message); rasqal_log_error_varargs(world, RAPTOR_LOG_LEVEL_WARN, locator, message, arguments); va_end(arguments); } void rasqal_log_error_varargs(rasqal_world* world, raptor_log_level level, raptor_locator* locator, const char* message, va_list arguments) { char *buffer; size_t length; raptor_log_message logmsg; raptor_log_handler handler = world->log_handler; void* handler_data = world->log_handler_user_data; if(level == RAPTOR_LOG_LEVEL_NONE) return; buffer = NULL; if(raptor_vasprintf(&buffer, message, arguments) < 0) buffer = NULL; if(!buffer) { if(locator) { raptor_locator_print(locator, stderr); fputc(' ', stderr); } fputs("rasqal ", stderr); fputs(rasqal_log_level_labels[level], stderr); fputs(" - ", stderr); vfprintf(stderr, message, arguments); fputc('\n', stderr); return; } length=strlen(buffer); if(buffer[length-1]=='\n') buffer[length-1]='\0'; if(handler) { /* This is the single place in rasqal that the user error handler * functions are called. */ /* raptor2 raptor_log_handler */ logmsg.code = -1; /* no information to put as code */ logmsg.level = level; logmsg.locator = locator; logmsg.text = buffer; handler(handler_data, &logmsg); } else { if(locator) { raptor_locator_print(locator, stderr); fputc(' ', stderr); } fputs("rasqal ", stderr); fputs(rasqal_log_level_labels[level], stderr); fputs(" - ", stderr); fputs(buffer, stderr); fputc('\n', stderr); } RASQAL_FREE(char*, buffer); } /* * rasqal_query_simple_error - Error from a query - Internal * * Matches the raptor_simple_message_handler API but same as * rasqal_query_error */ void rasqal_query_simple_error(void* user_data, const char *message, ...) { rasqal_query* query=(rasqal_query*)user_data; va_list arguments; va_start(arguments, message); query->failed=1; rasqal_log_error_varargs(query->world, RAPTOR_LOG_LEVEL_ERROR, NULL, message, arguments); va_end(arguments); } /* * rasqal_world_simple_error: * * INTERNAL - Handle a simple error * * Matches the raptor_simple_message_handler API but with a world object */ void rasqal_world_simple_error(void* user_data, const char *message, ...) { rasqal_world* world = (rasqal_world*)user_data; va_list arguments; va_start(arguments, message); rasqal_log_error_varargs(world, RAPTOR_LOG_LEVEL_ERROR, NULL, message, arguments); va_end(arguments); } /* wrapper */ const char* rasqal_basename(const char *name) { const char *p; if((p = strrchr(name, '/'))) name = p+1; else if((p = strrchr(name, '\\'))) name = p+1; return name; } const raptor_unichar rasqal_unicode_max_codepoint = 0x10FFFF; /** * rasqal_escaped_name_to_utf8_string: * @src: source name string * @len: length of source name string * @dest_lenp: pointer to store result string (or NULL) * @error_handler: error handling function * @error_data: data for error handle * * Get a UTF-8 and/or \u-escaped name as UTF-8. * * If dest_lenp is not NULL, the length of the resulting string is * stored at the pointed size_t. * * Return value: new UTF-8 string or NULL on failure. */ unsigned char* rasqal_escaped_name_to_utf8_string(const unsigned char *src, size_t len, size_t *dest_lenp, int (*error_handler)(rasqal_query *error_data, const char *message, ...), rasqal_query* error_data) { const unsigned char *p=src; size_t ulen=0; unsigned long unichar=0; unsigned char *result; unsigned char *dest; unsigned char *endp; int n; result = RASQAL_MALLOC(unsigned char*, len + 1); if(!result) return NULL; dest = result; endp = result + len; /* find end of string, fixing backslashed characters on the way */ while(len > 0) { unsigned char c=*p; if(c > 0x7f) { /* just copy the UTF-8 bytes through */ size_t unichar_len = RASQAL_GOOD_CAST(size_t, raptor_unicode_utf8_string_get_char(RASQAL_GOOD_CAST(const unsigned char*, p), len + 1, NULL)); if(unichar_len > len) { if(error_handler) error_handler(error_data, "UTF-8 encoding error at character %d (0x%02X) found.", c, c); /* UTF-8 encoding had an error or ended in the middle of a string */ RASQAL_FREE(char*, result); return NULL; } memcpy(dest, p, unichar_len); dest+= unichar_len; p += unichar_len; len -= unichar_len; continue; } p++; len--; if(c != '\\') { /* not an escape - store and move on */ *dest++=c; continue; } if(!len) { RASQAL_FREE(char*, result); return NULL; } c = *p++; len--; switch(c) { case '"': case '\\': *dest++=c; break; case 'u': case 'U': ulen=(c == 'u') ? 4 : 8; if(len < ulen) { if(error_handler) error_handler(error_data, "%c over end of line", c); RASQAL_FREE(char*, result); return 0; } n = sscanf(RASQAL_GOOD_CAST(const char*, p), ((ulen == 4) ? "%04lx" : "%08lx"), &unichar); if(n != 1) { if(error_handler) error_handler(error_data, "Bad %c escape", c); break; } p+=ulen; len-=ulen; if(unichar > 0x10ffff) { if(error_handler) error_handler(error_data, "Illegal Unicode character with code point #x%lX.", unichar); break; } dest += raptor_unicode_utf8_string_put_char(unichar, dest, RASQAL_GOOD_CAST(size_t, endp - dest)); break; default: if(error_handler) error_handler(error_data, "Illegal string escape \\%c in \"%s\"", c, src); RASQAL_FREE(char*, result); return 0; } } /* end while */ /* terminate dest, can be shorter than source */ *dest='\0'; if(dest_lenp) *dest_lenp = RASQAL_GOOD_CAST(size_t, dest - result); return result; } int rasqal_uri_init(rasqal_world* world) { world->rdf_namespace_uri = raptor_new_uri(world->raptor_world_ptr, raptor_rdf_namespace_uri); if(!world->rdf_namespace_uri) goto oom; world->rdf_first_uri = raptor_new_uri_from_uri_local_name(world->raptor_world_ptr, world->rdf_namespace_uri, RASQAL_GOOD_CAST(const unsigned char*, "first")); world->rdf_rest_uri = raptor_new_uri_from_uri_local_name(world->raptor_world_ptr, world->rdf_namespace_uri, RASQAL_GOOD_CAST(const unsigned char*, "rest")); world->rdf_nil_uri = raptor_new_uri_from_uri_local_name(world->raptor_world_ptr, world->rdf_namespace_uri, RASQAL_GOOD_CAST(const unsigned char*, "nil")); if(!world->rdf_first_uri || !world->rdf_rest_uri || !world->rdf_nil_uri) goto oom; return 0; oom: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_FATAL, NULL, "Out of memory in rasqal_uri_init()"); return 1; } void rasqal_uri_finish(rasqal_world* world) { if(world->rdf_first_uri) { raptor_free_uri(world->rdf_first_uri); world->rdf_first_uri=NULL; } if(world->rdf_rest_uri) { raptor_free_uri(world->rdf_rest_uri); world->rdf_rest_uri=NULL; } if(world->rdf_nil_uri) { raptor_free_uri(world->rdf_nil_uri); world->rdf_nil_uri=NULL; } if(world->rdf_namespace_uri) { raptor_free_uri(world->rdf_namespace_uri); world->rdf_namespace_uri=NULL; } } /** * rasqal_world_set_default_generate_bnodeid_parameters: * @world: #rasqal_world object * @prefix: prefix string * @base: integer base identifier * * Set default bnodeid generation parameters * * Sets the parameters for the default algorithm used to generate * blank node IDs. The default algorithm uses both @prefix and @base * to generate a new identifier. The exact identifier generated is * not guaranteed to be a strict concatenation of @prefix and @base * but will use both parts. * * For finer control of the generated identifiers, use * rasqal_world_set_generate_bnodeid_handler() * * If prefix is NULL, the default prefix is used (currently "bnodeid") * If base is less than 1, it is initialised to 1. * * Return value: non-0 on failure **/ int rasqal_world_set_default_generate_bnodeid_parameters(rasqal_world* world, char *prefix, int base) { char *prefix_copy = NULL; size_t length = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); if(--base < 0) base = 0; if(prefix) { length = strlen(prefix); prefix_copy = RASQAL_MALLOC(char*, length + 1); if(!prefix_copy) return 1; memcpy(prefix_copy, prefix, length + 1); } if(world->default_generate_bnodeid_handler_prefix) RASQAL_FREE(char*, world->default_generate_bnodeid_handler_prefix); world->default_generate_bnodeid_handler_prefix = prefix_copy; world->default_generate_bnodeid_handler_prefix_length = length; world->default_generate_bnodeid_handler_base = base; return 0; } /** * rasqal_world_set_generate_bnodeid_handler: * @world: #rasqal_world object * @user_data: user data pointer for callback * @handler: generate blank ID callback function * * Set the generate blank node ID handler function * * Sets the function to generate blank node IDs. * The handler is called with a pointer to the rasqal_world, the * @user_data pointer and a user_bnodeid which is the value of * a user-provided blank node identifier (may be NULL). * It can either be returned directly as the generated value when present or * modified. The passed in value must be free()d if it is not used. * * If handler is NULL, the default method is used * * Return value: non-0 on failure **/ int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); world->generate_bnodeid_handler_user_data = user_data; world->generate_bnodeid_handler = handler; return 0; } unsigned char* rasqal_world_default_generate_bnodeid_handler(void *user_data, unsigned char *user_bnodeid) { rasqal_world *world = (rasqal_world*)user_data; int id; unsigned char *buffer; size_t length; int tmpid; if(user_bnodeid) return user_bnodeid; id = ++world->default_generate_bnodeid_handler_base; tmpid = id; length = 2; /* min length 1 + \0 */ while(tmpid /= 10) length++; if(world->default_generate_bnodeid_handler_prefix) length += world->default_generate_bnodeid_handler_prefix_length; else length += 7; /* bnodeid */ buffer = RASQAL_MALLOC(unsigned char*, length); if(!buffer) return NULL; if(world->default_generate_bnodeid_handler_prefix) { memcpy(buffer, world->default_generate_bnodeid_handler_prefix, world->default_generate_bnodeid_handler_prefix_length); sprintf(RASQAL_GOOD_CAST(char*, buffer) + world->default_generate_bnodeid_handler_prefix_length, "%d", id); } else sprintf(RASQAL_GOOD_CAST(char*, buffer), "bnodeid%d", id); return buffer; } /* * rasqal_generate_bnodeid: * * Internal - Default generate ID */ unsigned char* rasqal_world_generate_bnodeid(rasqal_world* world, unsigned char *user_bnodeid) { if(world->generate_bnodeid_handler) return world->generate_bnodeid_handler(world, world->generate_bnodeid_handler_user_data, user_bnodeid); else return rasqal_world_default_generate_bnodeid_handler(world, user_bnodeid); } /** * rasqal_world_reset_now: * @world: world * * Internal - Mark current now value as invalid * * Intended to be run before starting a query so that the * value is recalculated. * * Return value: non-0 on failure */ int rasqal_world_reset_now(rasqal_world* world) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); world->now_set = 0; return 0; } #ifndef HAVE_GETTIMEOFDAY #define gettimeofday(x,y) rasqal_gettimeofday(x,y) #endif /** * rasqal_world_get_now_timeval: * @world: world * * Internal - Get current now timeval * * Return value: pointer to timeval or NULL on failure */ struct timeval* rasqal_world_get_now_timeval(rasqal_world* world) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); if(!world->now_set) { if(gettimeofday(&world->now, NULL)) return NULL; world->now_set = 1; } return &world->now; } /** * rasqal_world_set_warning_level: * @world: world * @warning_level: warning level 0..100 * * Set the rasqal warning reporting level * * The warning levels used are as follows: * * Level 10 is used for serious warnings that may be errors. * * Level 30 is used for moderate style warnings. * * Level 90 is used for strict conformance warnings. * * * * When this method is called to set a warning level, only warnings * of less than @warning_level are reported. The default warning * level is 50. * * Return value: non-0 on failure */ int rasqal_world_set_warning_level(rasqal_world* world, unsigned int warning_level) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); if(warning_level > RASQAL_WARNING_LEVEL_MAX) return 1; world->warning_level = (rasqal_warning_level)warning_level; return 0; } /** * rasqal_free_memory: * @ptr: memory pointer * * Free memory allocated inside rasqal. * * Some systems require memory allocated in a library to * be deallocated in that library. This function allows * memory allocated by rasqal to be freed. * **/ void rasqal_free_memory(void *ptr) { if(!ptr) return; RASQAL_FREE(void, ptr); } /** * rasqal_alloc_memory: * @size: size of memory to allocate * * Allocate memory inside rasqal. * * Some systems require memory allocated in a library to * be deallocated in that library. This function allows * memory to be allocated inside the rasqal shared library * that can be freed inside rasqal either internally or via * rasqal_free_memory(). * * Return value: the address of the allocated memory or NULL on failure * **/ void* rasqal_alloc_memory(size_t size) { return RASQAL_MALLOC(void*, size); } /** * rasqal_calloc_memory: * @nmemb: number of members * @size: size of item * * Allocate zeroed array of items inside rasqal. * * Some systems require memory allocated in a library to * be deallocated in that library. This function allows * memory to be allocated inside the rasqal shared library * that can be freed inside rasqal either internally or via * rasqal_free_memory(). * * Return value: the address of the allocated memory or NULL on failure * **/ void* rasqal_calloc_memory(size_t nmemb, size_t size) { return RASQAL_CALLOC(void*, nmemb, size); } #if defined (RASQAL_DEBUG) && defined(RASQAL_MEMORY_SIGN) void* rasqal_sign_malloc(size_t size) { int *p; size += sizeof(int); p=(int*)malloc(size); *p++ = RASQAL_SIGN_KEY; return p; } void* rasqal_sign_calloc(size_t nmemb, size_t size) { int *p; /* turn into bytes */ size = nmemb*size + sizeof(int); p=(int*)calloc(1, size); *p++ = RASQAL_SIGN_KEY; return p; } void* rasqal_sign_realloc(void *ptr, size_t size) { int *p; if(!ptr) return rasqal_sign_malloc(size); p=(int*)ptr; p--; if(*p != RASQAL_SIGN_KEY) RASQAL_FATAL3("memory signature %08X != %08X", *p, RASQAL_SIGN_KEY); size += sizeof(int); p=(int*)realloc(p, size); *p++= RASQAL_SIGN_KEY; return p; } void rasqal_sign_free(void *ptr) { int *p; if(!ptr) return; p=(int*)ptr; p--; if(*p != RASQAL_SIGN_KEY) RASQAL_FATAL3("memory signature %08X != %08X", *p, RASQAL_SIGN_KEY); free(p); } #endif rasqal-0.9.33/src/rasqal_sort.c0000644000175000017500000000410412434455625013310 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_sort.c - Sorting utility functions * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #include #include "ssort.h" /* * rasqal_sequence_as_sorted: * @seq: sequence to sort * @compare: comparison function (a, b, user_data) * @user_data: user_data for @compare * * INTERNAL - Sort the entries in a sequence and return the sort * order as an array of pointers (NULL terminated) * * Return value: array or NULL on failure (or sequence is empty) */ void** rasqal_sequence_as_sorted(raptor_sequence* seq, raptor_data_compare_arg_handler compare, void* user_data) { void** array; size_t size; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(seq, raptor_sequence, NULL); size = RASQAL_BAD_CAST(size_t, raptor_sequence_size(seq)); array = RASQAL_CALLOC(void**, size + 1, sizeof(void*)); if(!array) return NULL; if(size) { size_t i; for(i = 0; i < size; i++) array[i] = raptor_sequence_get_at(seq, RASQAL_GOOD_CAST(int, i)); rasqal_ssort_r(array, size, sizeof(void*), compare, user_data); } return array; } rasqal-0.9.33/src/rasqal_expr_strings.c0000644000175000017500000010175712434455625015064 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_expr_strings.c - Rasqal string expression functions * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr /* * rasqal_expression_evaluate_strlen: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STRLEN(expr) expression. * * Return value: A #rasqal_literal integer value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_strlen(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; rasqal_literal* result = NULL; const unsigned char *s; int len = 0; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; s = rasqal_literal_as_string_flags(l1, eval_context->flags, error_p); if(error_p && *error_p) goto failed; if(!s) len = 0; else len = raptor_unicode_utf8_strlen(s, strlen(RASQAL_GOOD_CAST(const char*, s))); result = rasqal_new_numeric_literal_from_long(world, RASQAL_LITERAL_INTEGER, len); rasqal_free_literal(l1); return result; failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_substr: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_SUBSTR(expr) expression. * * Return value: A #rasqal_literal integer value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_substr(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1 = NULL; rasqal_literal* l2 = NULL; rasqal_literal* l3 = NULL; const unsigned char *s; unsigned char* new_s = NULL; char* new_lang = NULL; raptor_uri* dt_uri = NULL; size_t len = 0; int startingLoc = 0; int length = -1; /* haystack string */ l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; /* integer startingLoc */ l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; startingLoc = rasqal_literal_as_integer(l2, error_p); if(error_p && *error_p) goto failed; /* optional integer length */ if(e->arg3) { l3 = rasqal_expression_evaluate2(e->arg3, eval_context, error_p); if(!l3) goto failed; length = rasqal_literal_as_integer(l3, error_p); if(error_p && *error_p) goto failed; } new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; /* adjust starting index to xsd fn:substring initial offset 1 */ if(!raptor_unicode_utf8_substr(new_s, /* dest_length_p */ NULL, s, len, startingLoc - 1, length)) goto failed; if(l1->language) { len = strlen(RASQAL_GOOD_CAST(const char*, l1->language)); new_lang = RASQAL_MALLOC(char*, len + 1); if(!new_lang) goto failed; memcpy(new_lang, l1->language, len + 1); } dt_uri = l1->datatype; if(dt_uri) dt_uri = raptor_uri_copy(dt_uri); rasqal_free_literal(l1); rasqal_free_literal(l2); if(l3) rasqal_free_literal(l3); /* after this new_s, new_lang and dt_uri become owned by result */ return rasqal_new_string_literal(world, new_s, new_lang, dt_uri, /* qname */ NULL); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); if(l3) rasqal_free_literal(l3); return NULL; } /* * rasqal_expression_evaluate_set_case: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_UCASE(expr) or * RASQAL_EXPR_LCASE(expr) expressions. * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_set_case(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; const unsigned char *s; unsigned char* new_s = NULL; char* new_lang = NULL; raptor_uri* dt_uri = NULL; size_t len = 0; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; new_s =RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; if(e->op == RASQAL_EXPR_UCASE) { unsigned int i; for(i = 0; i < len; i++) { unsigned char c = s[i]; if(islower(RASQAL_GOOD_CAST(int, c))) c = RASQAL_GOOD_CAST(unsigned char, toupper(RASQAL_GOOD_CAST(int, c))); new_s[i] = c; } } else { /* RASQAL_EXPR_LCASE */ unsigned int i; for(i = 0; i < len; i++) { unsigned char c = s[i]; if(isupper(RASQAL_GOOD_CAST(int, c))) c = RASQAL_GOOD_CAST(unsigned char, tolower(RASQAL_GOOD_CAST(int, c))); new_s[i] = c; } } new_s[len] = '\0'; if(l1->language) { len = strlen(RASQAL_GOOD_CAST(const char*, l1->language)); new_lang = RASQAL_MALLOC(char*, len + 1); if(!new_lang) goto failed; memcpy(new_lang, l1->language, len + 1); } dt_uri = l1->datatype; if(dt_uri) dt_uri = raptor_uri_copy(dt_uri); rasqal_free_literal(l1); /* after this new_s, new_lang and dt_uri become owned by result */ return rasqal_new_string_literal(world, new_s, new_lang, dt_uri, /* qname */ NULL); failed: if(error_p) *error_p = 1; if(new_s) RASQAL_FREE(char*, new_s); if(new_lang) RASQAL_FREE(char*, new_lang); if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_literals_sparql11_compatible: * @l1: first literal * @l2: second literal * * INTERNAL - Check if two literals are SPARQL 1.1 compatible such as usable for STRSTARTS() * * From STRSTARTS(), STRENDS() and CONTAINS() draft definition: * 1. pairs of simple literals, * 2. pairs of xsd:string typed literals * 3. pairs of plain literals with identical language tags * 4. pairs of an xsd:string typed literal (arg1 or arg2) and a simple literal (arg2 or arg1) * 5. pairs of a plain literal with language tag (arg1) and a simple literal (arg2) * 6. pairs of a plain literal with language tag (arg1) and an xsd:string typed literal (arg2) * * Return value: non-0 if literals are compatible */ static int rasqal_literals_sparql11_compatible(rasqal_literal *l1, rasqal_literal *l2) { raptor_uri* dt1; raptor_uri* dt2; const char *lang1; const char *lang2; raptor_uri* xsd_string_uri; xsd_string_uri = rasqal_xsd_datatype_type_to_uri(l1->world, RASQAL_LITERAL_XSD_STRING); /* Languages */ lang1 = l1->language; lang2 = l2->language; /* Turn xsd:string datatypes into plain literals for compatibility * purposes */ dt1 = l1->datatype; if(dt1 && raptor_uri_equals(dt1, xsd_string_uri)) dt1 = NULL; dt2 = l2->datatype; if(dt2 && raptor_uri_equals(dt2, xsd_string_uri)) dt2 = NULL; /* If there any datatypes left, the literals are not compatible */ if(dt1 || dt2) return 0; /* pairs of simple literals (or pairs of xsd:string or mixtures): #1, #2, #4 */ if(!lang1 && !lang2) return 1; /* pairs of plain literals with identical language tags #3 */ if(lang1 && lang2) return !strcmp(lang1, lang2); /* pairs of a plain literal with language tag (arg1) and a simple * literal or xsd:string typed literal [with no language tag] (arg2) #5, #6 */ return (lang1 && !lang2); } /* * rasqal_expression_evaluate_str_prefix_suffix: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STRSTARTS(lit, lit) and * RASQAL_EXPR_STRENDS(lit, lit) expressions. * * Return value: A #rasqal_literal integer value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_str_prefix_suffix(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal *l1 = NULL; rasqal_literal *l2 = NULL; int b; const unsigned char *s1; const unsigned char *s2; size_t len1 = 0; size_t len2 = 0; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; if(!rasqal_literals_sparql11_compatible(l1, l2)) goto failed; s1 = rasqal_literal_as_counted_string(l1, &len1, eval_context->flags, error_p); if(error_p && *error_p) goto failed; s2 = rasqal_literal_as_counted_string(l2, &len2, eval_context->flags, error_p); if(error_p && *error_p) goto failed; if(len1 < len2) { /* s1 is shorter than s2 so s2 can never be a prefix, suffix or * contain s1 */ b = 0; } else { if(e->op == RASQAL_EXPR_STRSTARTS) { b = !memcmp(s1, s2, len2); } else if(e->op == RASQAL_EXPR_STRENDS) { b = !memcmp(s1 + len1 - len2, s2, len2); } else { /* RASQAL_EXPR_CONTAINS */ /* b = (strnstr(RASQAL_GOOD_CAST(const char*, s1), RASQAL_GOOD_CAST(const char*, s2), len2) != NULL); */ b = (strstr(RASQAL_GOOD_CAST(const char*, s1), RASQAL_GOOD_CAST(const char*, s2)) != NULL); } } rasqal_free_literal(l1); rasqal_free_literal(l2); return rasqal_new_boolean_literal(world, b); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); return NULL; } /* * rasqal_expression_evaluate_encode_for_uri: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_ENCODE_FOR_URI(string) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_encode_for_uri(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; raptor_uri* xsd_string_uri; const unsigned char *s; unsigned char* new_s = NULL; raptor_uri* dt_uri = NULL; size_t len = 0; unsigned int i; unsigned char* p; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; xsd_string_uri = rasqal_xsd_datatype_type_to_uri(l1->world, RASQAL_LITERAL_XSD_STRING); dt_uri = l1->datatype; if(dt_uri && !raptor_uri_equals(dt_uri, xsd_string_uri)) /* datatype and not xsd:string */ goto failed; s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; /* pessimistically assume every UTF-8 byte is %XX 3 x len */ new_s = RASQAL_MALLOC(unsigned char*, (3 * len) + 1); if(!new_s) goto failed; p = new_s; for(i = 0; i < len; i++) { unsigned char c = s[i]; /* All characters are escaped except those identified as * "unreserved" by [RFC 3986], that is the upper- and lower-case * letters A-Z, the digits 0-9, HYPHEN-MINUS ("-"), LOW LINE * ("_"), FULL STOP ".", and TILDE "~". */ if((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~') { *p++ = c; } else { unsigned short hex; *p++ = '%'; hex = (c & 0xf0) >> 4; *p++ = RASQAL_GOOD_CAST(unsigned char, (hex < 10) ? ('0' + hex) : ('A' + hex - 10)); hex = (c & 0x0f); *p++ = RASQAL_GOOD_CAST(unsigned char, (hex < 10) ? ('0' + hex) : ('A' + hex - 10)); } } *p = '\0'; rasqal_free_literal(l1); /* after this new_s, new_lang and dt_uri become owned by result */ return rasqal_new_string_literal(world, new_s, NULL, NULL, /* qname */ NULL); failed: if(error_p) *error_p = 1; if(new_s) RASQAL_FREE(char*, new_s); if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_concat: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_CONCAT(expr list) expression. * * "If all input literals are typed literals of type xsd:string, * then the returned literal is also of type xsd:string, if all input * literals are plain literals with identical language tag, then the * returned literal is a plain literal with the same language tag, in * all other cases, the returned literal is a simple literal." * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_concat(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; raptor_stringbuffer* sb = NULL; int i; size_t len; unsigned char* result_str = NULL; char* lang_tag = NULL; int mode = -1; /* -1: undecided 0: xsd:string 1: simple+lang 2: simple */ raptor_uri* dt = NULL; raptor_uri* xsd_string_uri; rasqal_literal *result_l; xsd_string_uri = rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_XSD_STRING); sb = raptor_new_stringbuffer(); if(!sb) goto failed; for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression *arg_expr; rasqal_literal* arg_literal; const unsigned char* s = NULL; arg_expr = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(!arg_expr) break; arg_literal = rasqal_expression_evaluate2(arg_expr, eval_context, error_p); if(!arg_literal) { /* FIXME - check what to do with a NULL literal */ #if 0 if(error_p) *error_p = 1; goto failed; #endif continue; } if(arg_literal->type != RASQAL_LITERAL_STRING && arg_literal->type != RASQAL_LITERAL_XSD_STRING) { /* result is NULL literal; no error */ goto null_literal; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Concating literal "); rasqal_literal_print(arg_literal, stderr); fprintf(stderr, " with existing mode %d lang=%s\n", mode, lang_tag); #endif if(arg_literal->datatype) { /* Datatype */ if(raptor_uri_equals(arg_literal->datatype, xsd_string_uri)) { if(mode < 0) /* mode -1: expect all xsd:string */ mode = 0; else if(mode != 0) { /* mode 1, 2: different datatypes, so result is simple literal */ if(lang_tag) { RASQAL_FREE(char*, lang_tag); lang_tag = NULL; } mode = 2; } else { /* mode 0: not xsd:string so result is simple literal */ mode = 2; } } } else { /* No datatype; check language */ if(arg_literal->language) { if(mode < 0) { /* mode -1: First literal with language: save it and use it */ size_t lang_len = strlen(arg_literal->language); lang_tag = RASQAL_MALLOC(char*, lang_len + 1); if(!lang_tag) goto failed; memcpy(lang_tag, arg_literal->language, lang_len + 1); mode = 1; } else if (mode == 1) { /* mode 1: Already got a lang tag so check it */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("concat compare lang %s vs %s\n", arg_literal->language, lang_tag); #endif if(strcmp(arg_literal->language, lang_tag)) { /* different languages, so result is simple literal */ RASQAL_FREE(char*, lang_tag); lang_tag = NULL; mode = 2; } } else if (mode == 0) { /* mode 0: mixture of xsd:string and language literals, * so result is simple literal */ mode = 2; } /* otherwise mode 2: No change */ } else { if(lang_tag) { /* mode 1: language but this literal has none, so result is * simple literal */ RASQAL_FREE(char*, lang_tag); lang_tag = NULL; } mode = 2; } } /* FIXME - check that altering the flags this way to allow * concat of URIs is OK */ s = rasqal_literal_as_string_flags(arg_literal, (eval_context->flags & ~RASQAL_COMPARE_XQUERY), error_p); rasqal_free_literal(arg_literal); if((error_p && *error_p) || !s) goto failed; raptor_stringbuffer_append_string(sb, s, 1); } len = raptor_stringbuffer_length(sb); result_str = RASQAL_MALLOC(unsigned char*, len + 1); if(!result_str) goto failed; if(raptor_stringbuffer_copy_to_string(sb, result_str, len)) goto failed; raptor_free_stringbuffer(sb); if(mode == 0) dt = raptor_uri_copy(xsd_string_uri); /* result_str and lang and dt (if set) becomes owned by result */ result_l = rasqal_new_string_literal(world, result_str, lang_tag, dt, NULL); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Concat result literal: "); rasqal_literal_print(result_l, stderr); fprintf(stderr, " with mode %d\n", mode); #endif return result_l; failed: if(error_p) *error_p = 1; null_literal: if(dt) raptor_free_uri(dt); if(lang_tag) RASQAL_FREE(char*, lang_tag); if(result_str) RASQAL_FREE(char*, result_str); if(sb) raptor_free_stringbuffer(sb); return NULL; } /* * rasqal_expression_evaluate_langmatches: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_LANGMATCHES(lang tag, lang tag range) expression. * * Return value: A #rasqal_literal boolean value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_langmatches(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal *l1 = NULL; rasqal_literal *l2 = NULL; const unsigned char *tag; const unsigned char *range; int b; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; tag = rasqal_literal_as_string_flags(l1, eval_context->flags, error_p); if(error_p && *error_p) goto failed; range = rasqal_literal_as_string_flags(l2, eval_context->flags, error_p); if(error_p && *error_p) goto failed; b = rasqal_language_matches(tag, range); rasqal_free_literal(l1); rasqal_free_literal(l2); return rasqal_new_boolean_literal(world, b); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); return NULL; } /* * rasqal_expression_evaluate_strmatch: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STR_MATCH, RASQAL_EXPR_STR_NMATCH and * RASQAL_EXPR_REGEX expressions. * * Return value: A #rasqal_literal value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_strmatch(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; int b = 0; const unsigned char *l1_str; const char *match_string; const char *pattern; const char *regex_flags; rasqal_literal *l1, *l2, *l3; int rc = 0; size_t match_len; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l1_str = rasqal_literal_as_counted_string(l1, &match_len, eval_context->flags, error_p); match_string = RASQAL_GOOD_CAST(const char*, l1_str); if((error_p && *error_p) || !match_string) { rasqal_free_literal(l1); goto failed; } l3 = NULL; regex_flags = NULL; if(e->op == RASQAL_EXPR_REGEX) { l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } if(e->arg3) { l3 = rasqal_expression_evaluate2(e->arg3, eval_context, error_p); if((error_p && *error_p) || !l3) { rasqal_free_literal(l1); rasqal_free_literal(l2); goto failed; } regex_flags = RASQAL_GOOD_CAST(const char*, l3->string); } } else { l2 = e->literal; regex_flags = RASQAL_GOOD_CAST(const char*, l2->flags); } pattern = RASQAL_GOOD_CAST(const char*, l2->string); rc = rasqal_regex_match(world, eval_context->locator, pattern, regex_flags, match_string, match_len); #ifdef RASQAL_DEBUG if(rc >= 0) RASQAL_DEBUG5("regex match returned %s for '%s' against '%s' (flags=%s)\n", rc ? "true" : "false", match_string, pattern, l2->flags ? RASQAL_GOOD_CAST(char*, l2->flags) : ""); else RASQAL_DEBUG4("regex match returned failed for '%s' against '%s' (flags=%s)\n", match_string, pattern, l2->flags ? RASQAL_GOOD_CAST(char*, l2->flags) : ""); #endif rasqal_free_literal(l1); if(e->op == RASQAL_EXPR_REGEX) { rasqal_free_literal(l2); if(l3) rasqal_free_literal(l3); } if(rc < 0) goto failed; b = rc; if(e->op == RASQAL_EXPR_STR_NMATCH) b = 1 - b; return rasqal_new_boolean_literal(world, b); failed: if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_strbefore: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STRBEFORE(string, needle) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_strbefore(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1 = NULL; rasqal_literal* l2 = NULL; const unsigned char *haystack; const unsigned char *needle; size_t haystack_len; size_t needle_len; const char *ptr; unsigned char* result; size_t result_len; char* new_lang = NULL; /* haystack string */ l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; /* needle string */ l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; if(!rasqal_literal_is_string(l1) || !rasqal_literal_is_string(l2)) { /* not strings */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Cannot strbefore haystack "); rasqal_literal_print(l1, stderr); fputs( " to needle ", stderr); rasqal_literal_print(l2, stderr); fputs(" - both not string", stderr); #endif goto failed; } if(l2->language && rasqal_literal_string_languages_compare(l1, l2)) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Cannot strbefore haystack "); rasqal_literal_print(l1, stderr); fputs( " to language needle ", stderr); rasqal_literal_print(l2, stderr); fputs(" - languages mismatch", stderr); #endif goto failed; } haystack = rasqal_literal_as_counted_string(l1, &haystack_len, eval_context->flags, error_p); if((error_p && *error_p) || !haystack) goto failed; needle = rasqal_literal_as_counted_string(l2, &needle_len, eval_context->flags, error_p); if((error_p && *error_p) || !needle) goto failed; ptr = strstr(RASQAL_GOOD_CAST(const char*, haystack), RASQAL_GOOD_CAST(const char*, needle)); if(ptr) { result_len = RASQAL_GOOD_CAST(size_t, ptr - RASQAL_GOOD_CAST(const char*, haystack)); if(l1->language) { size_t len = strlen(RASQAL_GOOD_CAST(const char*, l1->language)); new_lang = RASQAL_MALLOC(char*, len + 1); if(!new_lang) goto failed; memcpy(new_lang, l1->language, len + 1); } } else { result_len = 0; haystack = RASQAL_GOOD_CAST(const unsigned char *, ""); } rasqal_free_literal(l1); l1 = NULL; rasqal_free_literal(l2); l2 = NULL; result = RASQAL_MALLOC(unsigned char*, result_len + 1); if(!result) goto failed; if(result_len) memcpy(result, haystack, result_len); result[result_len] = '\0'; return rasqal_new_string_literal(world, result, new_lang, /* datatype */ NULL, /* qname */ NULL); failed: if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_strafter: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STRAFTER(string, needle) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_strafter(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1 = NULL; rasqal_literal* l2 = NULL; const unsigned char *haystack; const unsigned char *needle; size_t haystack_len; size_t needle_len; const char *ptr; unsigned char* result; size_t result_len; char* new_lang = NULL; /* haystack string */ l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; /* needle string */ l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; if(!rasqal_literal_is_string(l1) || !rasqal_literal_is_string(l2)) { /* not strings */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Cannot strafter haystack "); rasqal_literal_print(l1, stderr); fputs( " to needle ", stderr); rasqal_literal_print(l2, stderr); fputs(" - both not string", stderr); #endif goto failed; } if(l2->language && rasqal_literal_string_languages_compare(l1, l2)) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Cannot strafter haystack "); rasqal_literal_print(l1, stderr); fputs( " to language needle ", stderr); rasqal_literal_print(l2, stderr); fputs(" - languages mismatch", stderr); #endif goto failed; } haystack = rasqal_literal_as_counted_string(l1, &haystack_len, eval_context->flags, error_p); if((error_p && *error_p) || !haystack) goto failed; needle = rasqal_literal_as_counted_string(l2, &needle_len, eval_context->flags, error_p); if((error_p && *error_p) || !needle) goto failed; ptr = strstr(RASQAL_GOOD_CAST(const char*, haystack), RASQAL_GOOD_CAST(const char*, needle)); if(ptr) { ptr += needle_len; result_len = haystack_len - RASQAL_GOOD_CAST(size_t, (ptr - RASQAL_GOOD_CAST(const char*, haystack))); if(l1->language) { size_t len = strlen(RASQAL_GOOD_CAST(const char*, l1->language)); new_lang = RASQAL_MALLOC(char*, len + 1); if(!new_lang) goto failed; memcpy(new_lang, l1->language, len + 1); } } else { ptr = (const char *)""; result_len = 0; } rasqal_free_literal(l1); l1 = NULL; rasqal_free_literal(l2); l2 = NULL; result = RASQAL_MALLOC(unsigned char*, result_len + 1); if(!result) goto failed; if(result_len) memcpy(result, ptr, result_len); result[result_len] = '\0'; return rasqal_new_string_literal(world, result, new_lang, /* datatype */ NULL, /* qname */ NULL); failed: if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_replace: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_REPLACE(input, pattern, replacement[, flags]) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_replace(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; const unsigned char *tmp_str; const char *match; const char *pattern; const char *replace; const char *regex_flags = NULL; size_t match_len; size_t replace_len; rasqal_literal* l1 = NULL; rasqal_literal* l2 = NULL; rasqal_literal* l3 = NULL; rasqal_literal* l4 = NULL; char* result_s = NULL; size_t result_len = 0; rasqal_literal* result = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; tmp_str = rasqal_literal_as_counted_string(l1, &match_len, eval_context->flags, error_p); match = RASQAL_GOOD_CAST(const char*, tmp_str); if((error_p && *error_p) || !match) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; pattern = RASQAL_GOOD_CAST(const char*, l2->string); l3 = rasqal_expression_evaluate2(e->arg3, eval_context, error_p); if((error_p && *error_p) || !l3) goto failed; if(l1->type != RASQAL_LITERAL_STRING && l1->type != RASQAL_LITERAL_XSD_STRING) /* Not a string so cannot do string operations */ goto failed; tmp_str = rasqal_literal_as_counted_string(l3, &replace_len, eval_context->flags, error_p); replace = RASQAL_GOOD_CAST(const char*, tmp_str); if((error_p && *error_p) || !replace) goto failed; if(e->arg4) { l4 = rasqal_expression_evaluate2(e->arg4, eval_context, error_p); if((error_p && *error_p) || !l4) goto failed; regex_flags = RASQAL_GOOD_CAST(const char*, l4->string); } result_s = rasqal_regex_replace(world, eval_context->locator, pattern, regex_flags, match, match_len, replace, replace_len, &result_len); RASQAL_DEBUG6("regex replace returned %s for '%s' from '%s' to '%s' (flags=%s)\n", result_s ? result_s : "NULL", match, pattern, replace, regex_flags ? RASQAL_GOOD_CAST(char*, regex_flags) : ""); if(!result_s) goto failed; result = rasqal_new_string_literal(world, RASQAL_GOOD_CAST(const unsigned char*, result_s), l1->language, l1->datatype, NULL); l1->language = NULL; l1->datatype = NULL; rasqal_free_literal(l1); rasqal_free_literal(l2); rasqal_free_literal(l3); if(l4) rasqal_free_literal(l4); return result; failed: if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); if(l3) rasqal_free_literal(l3); if(l4) rasqal_free_literal(l4); if(error_p) *error_p = 1; return NULL; } rasqal-0.9.33/src/rasqal_row.c0000644000175000017500000004137512434455625013143 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_row.c - Rasqal Query Result Row * * Copyright (C) 2003-2009, 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" static rasqal_row* rasqal_new_row_common(rasqal_world* world, int size, int order_size) { rasqal_row* row; row = RASQAL_CALLOC(rasqal_row*, 1, sizeof(*row)); if(!row) return NULL; row->usage = 1; row->size = size; row->order_size = order_size; if(row->size > 0) { row->values = RASQAL_CALLOC(rasqal_literal**, RASQAL_GOOD_CAST(size_t, row->size), sizeof(rasqal_literal*)); if(!row->values) { rasqal_free_row(row); return NULL; } } if(row->order_size > 0) { row->order_values = RASQAL_CALLOC(rasqal_literal**, RASQAL_GOOD_CAST(size_t, row->order_size), sizeof(rasqal_literal*)); if(!row->order_values) { rasqal_free_row(row); return NULL; } } row->group_id = -1; return row; } /** * rasqal_new_row: * @rowsource: rowsource * * INTERNAL - Create a new query result row at an offset into the result sequence. * * Return value: a new query result row or NULL on failure */ rasqal_row* rasqal_new_row(rasqal_rowsource* rowsource) { int size; int order_size = -1; rasqal_row* row; if(!rowsource) return NULL; rowsource = rasqal_new_rowsource_from_rowsource(rowsource); size = rasqal_rowsource_get_size(rowsource); row = rasqal_new_row_common(rowsource->world, size, order_size); if(row) row->rowsource = rowsource; return row; } /** * rasqal_new_row_for_size: * @world: rasqal_world * @size: width of row * * Constructor - Create a new query result row of a given size * * Return value: a new query result row or NULL on failure */ rasqal_row* rasqal_new_row_for_size(rasqal_world* world, int size) { int order_size = 0; return rasqal_new_row_common(world, size, order_size); } /** * rasqal_new_row_from_row: * @row: query result row * * INTERNAL - Copy a query result row. * * Return value: a copy of the query result row or NULL */ rasqal_row* rasqal_new_row_from_row(rasqal_row* row) { row->usage++; return row; } /** * rasqal_free_row: * @row: query result row * * Destructor - Free a query result row object. */ void rasqal_free_row(rasqal_row* row) { if(!row) return; if(--row->usage) return; if(row->values) { int i; for(i = 0; i < row->size; i++) { if(row->values[i]) rasqal_free_literal(row->values[i]); } RASQAL_FREE(array, row->values); } if(row->order_values) { int i; for(i = 0; i < row->order_size; i++) { if(row->order_values[i]) rasqal_free_literal(row->order_values[i]); } RASQAL_FREE(array, row->order_values); } if(row->rowsource) rasqal_free_rowsource(row->rowsource); RASQAL_FREE(rasqal_row, row); } /** * rasqal_row_print: * @row: query result row * @fp: FILE* handle * * INTERNAL - Print a query result row. */ int rasqal_row_print(rasqal_row* row, FILE* fh) { rasqal_rowsource* rowsource = row->rowsource; int i; fputs("row[", fh); for(i = 0; i < row->size; i++) { /* Do not use rasqal_query_results_get_binding_name(row->results, i); * as it does not work for a construct result */ const unsigned char *name = NULL; rasqal_literal *value; if(rowsource) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(v) name = v->name; } value = row->values[i]; if(i > 0) fputs(", ", fh); if(name) fprintf(fh, "%s=", name); rasqal_literal_print(value, fh); } if(row->order_size > 0) { fputs(" with ordering values [", fh); for(i = 0; i < row->order_size; i++) { rasqal_literal *value = row->order_values[i]; if(i > 0) fputs(", ", fh); rasqal_literal_print(value, fh); } fputs("]", fh); } if(row->group_id >= 0) fprintf(fh, " group %d", row->group_id); fprintf(fh, " offset %d]", row->offset); return 0; } /* * rasqal_row_write: * @row: query result row * @iostr: raptor iostream * * INTERNAL - Write a query result row to an iostream. * * Return value: non-0 on failure */ int rasqal_row_write(rasqal_row* row, raptor_iostream* iostr) { rasqal_rowsource* rowsource; int i; if(!row || !iostr) return 1; rowsource = row->rowsource; raptor_iostream_counted_string_write("row[", 4, iostr); for(i = 0; i < row->size; i++) { /* Do not use rasqal_query_results_get_binding_name(row->results, i); * as it does not work for a construct result */ const unsigned char *name = NULL; rasqal_literal *value; if(rowsource) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(v) name = v->name; } value = row->values[i]; if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); if(name) { raptor_iostream_string_write(name, iostr); raptor_iostream_counted_string_write("=", 1, iostr); } rasqal_literal_write(value, iostr); } if(row->order_size > 0) { raptor_iostream_counted_string_write(" with ordering values [", 23, iostr); for(i = 0; i < row->order_size; i++) { rasqal_literal *value = row->order_values[i]; if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_literal_write(value, iostr); } raptor_iostream_counted_string_write("]", 1, iostr); } if(row->group_id >= 0) { raptor_iostream_counted_string_write(" group ", 7, iostr); raptor_iostream_decimal_write(row->group_id, iostr); } raptor_iostream_counted_string_write(" offset ", 8, iostr); raptor_iostream_decimal_write(row->offset, iostr); raptor_iostream_counted_string_write("]", 1, iostr); return 0; } /** * rasqal_row_set_value_at: * @row: query result row * @offset: offset into row (column number) * @value: literal value to set * * Set the value of a variable in a query result row * * Any existing row value is freed and the literal @value passed in * is copied. * * Return value: non-0 on failure */ int rasqal_row_set_value_at(rasqal_row* row, int offset, rasqal_literal* value) { if(!row || !value) return 1; if(offset < 0 || offset >= row->size) return 1; if(row->values[offset]) rasqal_free_literal(row->values[offset]); row->values[offset] = rasqal_new_literal_from_literal(value); return 0; } /** * rasqal_new_row_sequence: * @world: world object ot use * @vt: variables table to use to declare variables * @row_data: row data * @vars_count: number of variables in row * @vars_seq_p: OUT parameter - pointer to place to store sequence of variables (or NULL) * * INTERNAL - Make a sequence of #rasqal_row* objects * with variables defined into the @vt table and values in the sequence * * The @row_data parameter is an array of strings forming a table of * width (vars_count * 2). * The first row is a list of variable names at offset 0. * The remaining rows are values where offset 0 is a literal and * offset 1 is a URI string. * * The last row is indicated by an entire row of NULLs. * * Return value: sequence of rows or NULL on failure */ raptor_sequence* rasqal_new_row_sequence(rasqal_world* world, rasqal_variables_table* vt, const char* const row_data[], int vars_count, raptor_sequence** vars_seq_p) { raptor_sequence *seq = NULL; raptor_sequence *vars_seq = NULL; int row_i; int column_i; int failed = 0; #define GET_CELL(row, column, offset) \ row_data[((((row)*vars_count)+(column))<<1)+(offset)] seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!seq) return NULL; if(vars_seq_p) { vars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!vars_seq) { raptor_free_sequence(seq); return NULL; } } /* row 0 is variables */ row_i = 0; for(column_i = 0; column_i < vars_count; column_i++) { const char * var_name = GET_CELL(row_i, column_i, 0); size_t var_name_len = strlen(var_name); rasqal_variable* v; v = rasqal_variables_table_add2(vt, RASQAL_VARIABLE_TYPE_NORMAL, RASQAL_GOOD_CAST(const unsigned char*, var_name), var_name_len, NULL); if(!v) { failed = 1; goto tidy; } if(vars_seq) { raptor_sequence_push(vars_seq, v); /* v is now owned by vars_seq */ } } for(row_i = 1; 1; row_i++) { rasqal_row* row; int data_values_seen = 0; /* Terminate on an entire row of NULLs */ for(column_i = 0; column_i < vars_count; column_i++) { if(GET_CELL(row_i, column_i, 0) || GET_CELL(row_i, column_i, 1)) { data_values_seen++; break; } } if(!data_values_seen) break; row = rasqal_new_row_for_size(world, vars_count); if(!row) { failed = 1; goto tidy; } for(column_i = 0; column_i < vars_count; column_i++) { rasqal_literal* l = NULL; if(GET_CELL(row_i, column_i, 0)) { /* string literal */ const char* str = GET_CELL(row_i, column_i, 0); size_t str_len = strlen(str); char *eptr = NULL; long number; number = strtol(RASQAL_GOOD_CAST(const char*, str), &eptr, 10); if(!*eptr) { /* is an integer */ l = rasqal_new_numeric_literal_from_long(world, RASQAL_LITERAL_INTEGER, number); } else { unsigned char *val; val = RASQAL_MALLOC(unsigned char*, str_len + 1); if(val) { memcpy(val, str, str_len + 1); l = rasqal_new_string_literal_node(world, val, NULL, NULL); } else failed = 1; } } else if(GET_CELL(row_i, column_i, 1)) { /* URI */ const unsigned char* str; raptor_uri* u; str = RASQAL_GOOD_CAST(const unsigned char*, GET_CELL(row_i, column_i, 1)); u = raptor_new_uri(world->raptor_world_ptr, str); if(u) l = rasqal_new_uri_literal(world, u); else failed = 1; } else { /* variable is not defined for this row */ continue; } if(!l) { rasqal_free_row(row); failed = 1; goto tidy; } rasqal_row_set_value_at(row, column_i, l); /* free our copy of literal, rasqal_row has a reference */ rasqal_free_literal(l); } raptor_sequence_push(seq, row); } tidy: if(failed) { if(seq) { raptor_free_sequence(seq); seq = NULL; } if(vars_seq) { raptor_free_sequence(vars_seq); vars_seq = NULL; } } else { if(vars_seq) *vars_seq_p = vars_seq; } return seq; } /** * rasqal_row_to_nodes: * @row: Result row * * INTERNAL - Turn the given result row literals into RDF strings, URIs or blank literals. * * Return value: non-0 on failure */ int rasqal_row_to_nodes(rasqal_row* row) { int i; if(!row) return 1; for(i = 0; i < row->size; i++) { if(row->values[i]) { rasqal_literal* new_l; new_l = rasqal_literal_as_node(row->values[i]); if(!new_l) return -1; rasqal_free_literal(row->values[i]); row->values[i] = new_l; } } return 0; } /** * rasqal_row_set_values_from_variables_table: * @row: Result row * @vars_table: Variables table * * INTERNAL - Set the values of all variables in the row from the given variables table * */ void rasqal_row_set_values_from_variables_table(rasqal_row* row, rasqal_variables_table* vars_table) { int i; for(i = 0; i < row->size; i++) { rasqal_literal *l; l = rasqal_variables_table_get_value(vars_table, i); if(row->values[i]) rasqal_free_literal(row->values[i]); row->values[i] = rasqal_new_literal_from_literal(l); } } /** * rasqal_row_set_order_size: * @row: Result row * @order_size: number of order conditions * * INTERNAL - Initialise the row with space to handle @order_size order conditions being evaluated * * Return value: non-0 on failure */ int rasqal_row_set_order_size(rasqal_row *row, int order_size) { row->order_size = order_size; if(row->order_size > 0) { row->order_values = RASQAL_CALLOC(rasqal_literal**, RASQAL_GOOD_CAST(size_t, row->order_size), sizeof(rasqal_literal*)); if(!row->order_values) { row->order_size = -1; return 1; } } return 0; } /** * rasqal_row_expand_size: * @row: Result row * @size: number of variables * * INTERNAL - Expand the row to be able to handle @size variables * * Return value: non-0 on failure */ int rasqal_row_expand_size(rasqal_row *row, int size) { rasqal_literal** nvalues; /* do not allow row size to contract & lose data */ if(row->size > size) return 1; nvalues = RASQAL_CALLOC(rasqal_literal**, RASQAL_GOOD_CAST(size_t, size), sizeof(rasqal_literal*)); if(!nvalues) return 1; memcpy(nvalues, row->values, RASQAL_GOOD_CAST(size_t, sizeof(rasqal_literal*) * RASQAL_GOOD_CAST(size_t, row->size))); RASQAL_FREE(array, row->values); row->values = nvalues; row->size = size; return 0; } /** * rasqal_row_bind_variables: * @row: Result row * @vars_table: Variables table * * INTERNAL - Bind the variable table vars with values in the row * * Return value: non-0 on failure */ int rasqal_row_bind_variables(rasqal_row* row, rasqal_variables_table* vars_table) { int i; for(i = 0; i < row->size; i++) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(row->rowsource, i); if(v) { rasqal_literal *value = row->values[i]; if(value) { value = rasqal_new_literal_from_literal(value); if(!value) return 1; } /* it is OK to bind to NULL */ rasqal_variable_set_value(v, value); } } return 0; } /** * rasqal_row_sequence_copy: * @row_sequence: sequence of #raptor_row * * INTERNAL - Deep copy a sequence of rows * * Return value: new sequence of all rows (may be size 0) or NULL on failure **/ raptor_sequence* rasqal_row_sequence_copy(raptor_sequence *seq) { raptor_sequence* new_seq; int i; rasqal_row* row; new_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!new_seq) return NULL; for(i = 0; (row = (rasqal_row*)raptor_sequence_get_at(seq, i)); i++) { row = rasqal_new_row_from_row(row); raptor_sequence_push(new_seq, row); } return new_seq; } void rasqal_row_set_rowsource(rasqal_row* row, rasqal_rowsource* rowsource) { if(!(row->flags & RASQAL_ROW_FLAG_WEAK_ROWSOURCE) && row->rowsource) rasqal_free_rowsource(row->rowsource); row->rowsource = rasqal_new_rowsource_from_rowsource(rowsource); row->flags = RASQAL_GOOD_CAST(unsigned int, RASQAL_GOOD_CAST(int, row->flags) & ~RASQAL_ROW_FLAG_WEAK_ROWSOURCE); } /* Set/reset a row's rowsource to a weak reference; one that should * NOT be freed. * * *DANGEROUS* : should only be used by the rasqal_rowsequence_rowsource class */ void rasqal_row_set_weak_rowsource(rasqal_row* row, rasqal_rowsource* rowsource) { row->rowsource = rowsource; row->flags |= RASQAL_ROW_FLAG_WEAK_ROWSOURCE; } rasqal_variable* rasqal_row_get_variable_by_offset(rasqal_row* row, int offset) { if(offset < 0) return NULL; return rasqal_rowsource_get_variable_by_offset(row->rowsource, offset); } rasqal-0.9.33/src/Makefile.am0000644000175000017500000002743612421006603012643 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal RDF query language library # # 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. # bin_SCRIPTS = rasqal-config lib_LTLIBRARIES = librasqal.la nodist_pkginclude_HEADERS = rasqal.h noinst_HEADERS = rasqal_internal.h win32_rasqal_config.h sv_config.h man_MANS = rasqal-config.1 TESTS_ENVIRONMENT= \ RDF_DATA_FILE=$(top_srcdir)/data/dc.rdf \ NT_DATA_FILE=$(top_srcdir)/data/one.nt \ SPARQL_QUERY_FILE=$(top_srcdir)/tests/sparql/examples/ex11_1.rq TESTS=rasqal_algebra_test$(EXEEXT) rasqal_expr_test$(EXEEXT) \ strcasecmp_test$(EXEEXT) \ rasqal_decimal_test$(EXEEXT) rasqal_datetime_test$(EXEEXT) \ rasqal_variable_test$(EXEEXT) rasqal_rowsource_empty_test$(EXEEXT) \ rasqal_rowsource_union_test$(EXEEXT) \ rasqal_rowsource_rowsequence_test$(EXEEXT) \ rasqal_rowsource_project_test$(EXEEXT) \ rasqal_rowsource_join_test$(EXEEXT) \ rasqal_query_test$(EXEEXT) \ rasqal_rowsource_triples_test$(EXEEXT) \ rasqal_row_compatible_test$(EXEEXT) \ rasqal_rowsource_groupby_test$(EXEEXT) \ rasqal_rowsource_aggregation_test$(EXEEXT) \ rasqal_literal_test$(EXEEXT) \ rasqal_regex_test$(EXEEXT) \ rasqal_random_test$(EXEEXT) \ rasqal_xsd_datatypes_test$(EXEEXT) \ rasqal_results_compare_test$(EXEEXT) \ rasqal_query_results_test$(EXEEXT) # These 2 test programs are compiled here and run here as 'smoke # tests' but mostly used in tests in $(srcdir)/../tests/sparql # to do detailed tests on the lext/parsers if RASQAL_QUERY_SPARQL TESTS += sparql_lexer_test$(EXEEXT) sparql_parser_test$(EXEEXT) endif BROKEN_TESTS=rasqal_rowsource_service_test$(EXEEXT) EXTRA_PROGRAMS=$(TESTS) $(BROKEN_TESTS) CLEANFILES=$(TESTS) \ *.plist \ git-version.h MAINTAINERCLEANFILES= \ sparql_lexer.c sparql_lexer.h \ sparql_parser.c sparql_parser.h sparql_parser.output MEM=@MEM@ MEM_LIBS=@MEM_LIBS@ AM_CFLAGS= @RASQAL_INTERNAL_CPPFLAGS@ @STANDARD_CFLAGS@ $(MEM) LIBS= @RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) librasqal_la_SOURCES = \ rasqal_algebra.c \ rasqal_expr.c rasqal_expr_evaluate.c \ rasqal_expr_datetimes.c rasqal_expr_numerics.c rasqal_expr_strings.c \ rasqal_general.c rasqal_query.c rasqal_query_results.c \ rasqal_engine.c rasqal_raptor.c rasqal_literal.c rasqal_formula.c \ rasqal_graph_pattern.c rasqal_map.c rasqal_feature.c \ rasqal_result_formats.c rasqal_xsd_datatypes.c rasqal_decimal.c \ rasqal_datetime.c rasqal_rowsource.c rasqal_format_sparql_xml.c \ rasqal_variable.c rasqal_rowsource_empty.c rasqal_rowsource_union.c \ rasqal_rowsource_rowsequence.c rasqal_query_transform.c rasqal_row.c \ rasqal_engine_algebra.c rasqal_triples_source.c \ rasqal_rowsource_triples.c rasqal_rowsource_filter.c \ rasqal_rowsource_sort.c rasqal_engine_sort.c \ rasqal_rowsource_project.c rasqal_rowsource_join.c \ rasqal_rowsource_graph.c rasqal_rowsource_distinct.c \ rasqal_rowsource_groupby.c rasqal_rowsource_aggregation.c \ rasqal_rowsource_having.c rasqal_rowsource_slice.c \ rasqal_rowsource_bindings.c rasqal_rowsource_service.c \ rasqal_row_compatible.c rasqal_format_table.c rasqal_query_write.c \ rasqal_format_json.c rasqal_format_sv.c rasqal_format_html.c \ rasqal_format_rdf.c \ rasqal_rowsource_assignment.c rasqal_update.c \ rasqal_triple.c rasqal_data_graph.c rasqal_prefix.c \ rasqal_solution_modifier.c rasqal_projection.c rasqal_bindings.c \ rasqal_service.c \ rasqal_dataset.c \ rasqal_random.c \ rasqal_digest.c \ rasqal_iostream.c \ rasqal_regex.c \ snprintf.c \ rasqal_double.c \ rasqal_ntriples.c \ rasqal_results_compare.c \ ssort.h if RASQAL_QUERY_SPARQL librasqal_la_SOURCES += sparql_lexer.c sparql_lexer.h \ sparql_parser.c sparql_parser.h sparql_common.h endif if STRCASECMP librasqal_la_SOURCES += strcasecmp.c endif if TIMEGM librasqal_la_SOURCES += timegm.c endif if GETTIMEOFDAY librasqal_la_SOURCES += gettimeofday.c endif if RASQAL_SORT librasqal_la_SOURCES += rasqal_sort.c endif if RASQAL_DIGEST_INTERNAL librasqal_la_SOURCES += rasqal_digest_md5.c rasqal_digest_sha1.c endif nodist_librasqal_la_SOURCES = if MAINTAINER_MODE nodist_librasqal_la_SOURCES += git-version.h # rasqal_algebra.c is the first source file so this ensures # git-version.h is created before it and before the actual file # dependencies are calculated as a side-effect of compilation rasqal_algebra.c: git-version.h endif librasqal_la_LDFLAGS = -version-info @RASQAL_LIBTOOL_VERSION@ librasqal_la_LIBADD = @LTLIBOBJS@ @RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) librasqal_la_DEPENDENCIES = @LTLIBOBJS@ @RASQAL_INTERNAL_LIBS@ AM_CFLAGS += -DSV_CONFIG -I$(top_srcdir)/libsv librasqal_la_LIBADD += $(top_builddir)/libsv/libsv.la librasqal_la_DEPENDENCIES += $(top_builddir)/libsv/libsv.la $(top_builddir)/libsv/libsv.la: cd $(top_builddir)/libsv && $(MAKE) libsv.la if RASQAL_MTWIST AM_CFLAGS += -DMTWIST_CONFIG -I$(top_srcdir)/libmtwist librasqal_la_LIBADD += $(top_builddir)/libmtwist/libmtwist.la librasqal_la_DEPENDENCIES += $(top_builddir)/libmtwist/libmtwist.la $(top_builddir)/libmtwist/libmtwist.la: cd $(top_builddir)/libmtwist && $(MAKE) libmtwist.la endif if GETOPT $(top_builddir)/libgetopt/libgetopt.la: cd $(top_builddir)/libgetopt && $(MAKE) libgetopt.la endif EXTRA_DIST= \ sparql_lexer.l sparql_parser.y \ rasqal-config.in \ $(man_MANS) \ rasqal_query_test.c \ mtwist_config.h LEX=@LEX@ YACC=@YACC@ # Create some text files from HTML sources LYNX=lynx HTML_TO_TEXT=TERM=vt100 $(LYNX) -dump -nolist SUFFIXES = .html .txt if MAINTAINER_MODE # Actually it needs sparql_parser.h but nevermind sparql_lexer.c: $(srcdir)/sparql_lexer.l sparql_parser.c $(srcdir)/../scripts/fix-flex.pl $(AM_V_GEN) \ $(LEX) -o$@ $(srcdir)/sparql_lexer.l; \ $(PERL) $(srcdir)/../scripts/fix-flex.pl $@ > sparql_lexer.t; \ mv sparql_lexer.t $@ sparql_parser.c: $(srcdir)/sparql_parser.y $(srcdir)/../scripts/fix-bison.pl $(AM_V_GEN) \ $(BISON) $(srcdir)/sparql_parser.y; \ $(PERL) $(srcdir)/../scripts/fix-bison.pl sparql_parser.tab.c > $@; \ mv sparql_parser.tab.h sparql_parser.h; \ rm -f sparql_parser.tab.c sparql_parser.h: sparql_parser.c ; @exit 0 endif sparql_lexer_test_SOURCES = sparql_lexer.c sparql_lexer_test_CPPFLAGS = -DSTANDALONE sparql_lexer_test_LDADD = librasqal.la sparql_parser_test_SOURCES = sparql_parser.c sparql_parser_test_CPPFLAGS = -DSTANDALONE sparql_parser_test_LDADD = librasqal.la if GETOPT sparql_parser_test_CPPFLAGS += -I$(top_srcdir)/getopt sparql_parser_test_LDADD += $(top_builddir)/getopt/libgetopt.la endif rasqal_expr_test_SOURCES = rasqal_expr.c rasqal_expr_test_CPPFLAGS = -DSTANDALONE rasqal_expr_test_LDADD = librasqal.la strcasecmp_test_SOURCES = strcasecmp.c strcasecmp_test_CPPFLAGS = -DSTANDALONE strcasecmp_test_LDADD = librasqal.la rasqal_query_test_SOURCES = rasqal_query_test.c rasqal_query_test_CPPFLAGS = -DSTANDALONE rasqal_query_test_LDADD = librasqal.la rasqal_decimal_test_SOURCES = rasqal_decimal.c rasqal_decimal_test_CPPFLAGS = -DSTANDALONE rasqal_decimal_test_LDADD = librasqal.la rasqal_datetime_test_SOURCES = rasqal_datetime.c rasqal_datetime_test_CPPFLAGS = -DSTANDALONE rasqal_datetime_test_LDADD = librasqal.la rasqal_algebra_test_SOURCES = rasqal_algebra.c rasqal_algebra_test_CPPFLAGS = -DSTANDALONE rasqal_algebra_test_LDADD = librasqal.la rasqal_variable_test_SOURCES = rasqal_variable.c rasqal_variable_test_CPPFLAGS = -DSTANDALONE rasqal_variable_test_LDADD = librasqal.la rasqal_rowsource_aggregation_test_SOURCES = rasqal_rowsource_aggregation.c rasqal_rowsource_aggregation_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_aggregation_test_LDADD = librasqal.la rasqal_rowsource_empty_test_SOURCES = rasqal_rowsource_empty.c rasqal_rowsource_empty_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_empty_test_LDADD = librasqal.la rasqal_rowsource_groupby_test_SOURCES = rasqal_rowsource_groupby.c rasqal_rowsource_groupby_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_groupby_test_LDADD = librasqal.la rasqal_rowsource_union_test_SOURCES = rasqal_rowsource_union.c rasqal_rowsource_union_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_union_test_LDADD = librasqal.la rasqal_rowsource_rowsequence_test_SOURCES = rasqal_rowsource_rowsequence.c rasqal_rowsource_rowsequence_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_rowsequence_test_LDADD = librasqal.la rasqal_rowsource_triples_test_SOURCES = rasqal_rowsource_triples.c rasqal_rowsource_triples_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_triples_test_LDADD = librasqal.la rasqal_rowsource_project_test_SOURCES = rasqal_rowsource_project.c rasqal_rowsource_project_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_project_test_LDADD = librasqal.la rasqal_rowsource_join_test_SOURCES = rasqal_rowsource_join.c rasqal_rowsource_join_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_join_test_LDADD = librasqal.la rasqal_rowsource_service_test_SOURCES = rasqal_rowsource_service.c rasqal_rowsource_service_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_service_test_LDADD = librasqal.la rasqal_row_compatible_test_SOURCES = rasqal_row_compatible.c rasqal_row_compatible_test_CPPFLAGS = -DSTANDALONE rasqal_row_compatible_test_LDADD = librasqal.la rasqal_literal_test_SOURCES = rasqal_literal.c rasqal_literal_test_CPPFLAGS = -DSTANDALONE rasqal_literal_test_LDADD = librasqal.la rasqal_regex_test_SOURCES = rasqal_regex.c rasqal_regex_test_CPPFLAGS = -DSTANDALONE rasqal_regex_test_LDADD = librasqal.la rasqal_random_test_SOURCES = rasqal_random.c rasqal_random_test_CPPFLAGS = -DSTANDALONE rasqal_random_test_LDADD = librasqal.la rasqal_xsd_datatypes_test_SOURCES = rasqal_xsd_datatypes.c rasqal_xsd_datatypes_test_CPPFLAGS = -DSTANDALONE rasqal_xsd_datatypes_test_LDADD = librasqal.la rasqal_results_compare_test_SOURCES = rasqal_results_compare.c rasqal_results_compare_test_CPPFLAGS = -DSTANDALONE rasqal_results_compare_test_LDADD = librasqal.la rasqal_query_results_test_SOURCES = rasqal_query_results.c rasqal_query_results_test_CPPFLAGS = -DSTANDALONE rasqal_query_results_test_LDADD = librasqal.la $(top_builddir)/../raptor/src/libraptor.la: cd $(top_builddir)/../raptor/src && $(MAKE) $(AM_MAKEFLAGS) libraptor.la if MAINTAINER_MODE git-version.h: check-version # Always run this in maintainer mode but do not always change git-version.h .PHONY: check-version check-version: @file="git-version.h" ; \ if test -d ../.git; then \ git_version=`cd .. && git rev-parse HEAD`; \ else \ git_version="unknown"; \ fi; \ $(RECHO) "GIT version $$git_version"; \ tmp="$$file$$$$.tmp"; \ $(RECHO) "#define GIT_VERSION \"$$git_version\"" > $$tmp; \ if test -f $$file; then \ if cmp $$file $$tmp >/dev/null 2>&1; then \ rm $$tmp; \ else \ mv $$tmp $$file; \ fi; \ else \ mv $$tmp $$file; \ fi # Run Clang static analyzer over sources. analyze: $(SOURCES) @list='$(SOURCES)'; \ result=0; \ for file in $$list; do \ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ $(RECHO) "Analyzing $$file"; \ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ status=$$?; \ if test $$status != 0; then \ result=1; \ fi; \ fi; \ done; \ set -e; exit $$result endif rasqal-0.9.33/src/Makefile.in0000644000175000017500000040146012434455632012663 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal RDF query language library # # 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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ # These 2 test programs are compiled here and run here as 'smoke # tests' but mostly used in tests in $(srcdir)/../tests/sparql # to do detailed tests on the lext/parsers @RASQAL_QUERY_SPARQL_TRUE@am__append_1 = sparql_lexer_test$(EXEEXT) sparql_parser_test$(EXEEXT) @RASQAL_QUERY_SPARQL_TRUE@am__append_2 = sparql_lexer.c sparql_lexer.h \ @RASQAL_QUERY_SPARQL_TRUE@sparql_parser.c sparql_parser.h sparql_common.h @STRCASECMP_TRUE@am__append_3 = strcasecmp.c @TIMEGM_TRUE@am__append_4 = timegm.c @GETTIMEOFDAY_TRUE@am__append_5 = gettimeofday.c @RASQAL_SORT_TRUE@am__append_6 = rasqal_sort.c @RASQAL_DIGEST_INTERNAL_TRUE@am__append_7 = rasqal_digest_md5.c rasqal_digest_sha1.c @MAINTAINER_MODE_TRUE@am__append_8 = git-version.h @RASQAL_MTWIST_TRUE@am__append_9 = -DMTWIST_CONFIG -I$(top_srcdir)/libmtwist @RASQAL_MTWIST_TRUE@am__append_10 = $(top_builddir)/libmtwist/libmtwist.la @RASQAL_MTWIST_TRUE@am__append_11 = $(top_builddir)/libmtwist/libmtwist.la @GETOPT_TRUE@am__append_12 = -I$(top_srcdir)/getopt @GETOPT_TRUE@am__append_13 = $(top_builddir)/getopt/libgetopt.la subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/rasqal-config.in \ $(srcdir)/rasqal.h.in $(srcdir)/rasqal_config.h.in \ $(srcdir)/win32_rasqal_config.h.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = rasqal_config.h CONFIG_CLEAN_FILES = rasqal.h win32_rasqal_config.h rasqal-config CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am__librasqal_la_SOURCES_DIST = rasqal_algebra.c rasqal_expr.c \ rasqal_expr_evaluate.c rasqal_expr_datetimes.c \ rasqal_expr_numerics.c rasqal_expr_strings.c rasqal_general.c \ rasqal_query.c rasqal_query_results.c rasqal_engine.c \ rasqal_raptor.c rasqal_literal.c rasqal_formula.c \ rasqal_graph_pattern.c rasqal_map.c rasqal_feature.c \ rasqal_result_formats.c rasqal_xsd_datatypes.c \ rasqal_decimal.c rasqal_datetime.c rasqal_rowsource.c \ rasqal_format_sparql_xml.c rasqal_variable.c \ rasqal_rowsource_empty.c rasqal_rowsource_union.c \ rasqal_rowsource_rowsequence.c rasqal_query_transform.c \ rasqal_row.c rasqal_engine_algebra.c rasqal_triples_source.c \ rasqal_rowsource_triples.c rasqal_rowsource_filter.c \ rasqal_rowsource_sort.c rasqal_engine_sort.c \ rasqal_rowsource_project.c rasqal_rowsource_join.c \ rasqal_rowsource_graph.c rasqal_rowsource_distinct.c \ rasqal_rowsource_groupby.c rasqal_rowsource_aggregation.c \ rasqal_rowsource_having.c rasqal_rowsource_slice.c \ rasqal_rowsource_bindings.c rasqal_rowsource_service.c \ rasqal_row_compatible.c rasqal_format_table.c \ rasqal_query_write.c rasqal_format_json.c rasqal_format_sv.c \ rasqal_format_html.c rasqal_format_rdf.c \ rasqal_rowsource_assignment.c rasqal_update.c rasqal_triple.c \ rasqal_data_graph.c rasqal_prefix.c rasqal_solution_modifier.c \ rasqal_projection.c rasqal_bindings.c rasqal_service.c \ rasqal_dataset.c rasqal_random.c rasqal_digest.c \ rasqal_iostream.c rasqal_regex.c snprintf.c rasqal_double.c \ rasqal_ntriples.c rasqal_results_compare.c ssort.h \ sparql_lexer.c sparql_lexer.h sparql_parser.c sparql_parser.h \ sparql_common.h strcasecmp.c timegm.c gettimeofday.c \ rasqal_sort.c rasqal_digest_md5.c rasqal_digest_sha1.c @RASQAL_QUERY_SPARQL_TRUE@am__objects_1 = sparql_lexer.lo \ @RASQAL_QUERY_SPARQL_TRUE@ sparql_parser.lo @STRCASECMP_TRUE@am__objects_2 = strcasecmp.lo @TIMEGM_TRUE@am__objects_3 = timegm.lo @GETTIMEOFDAY_TRUE@am__objects_4 = gettimeofday.lo @RASQAL_SORT_TRUE@am__objects_5 = rasqal_sort.lo @RASQAL_DIGEST_INTERNAL_TRUE@am__objects_6 = rasqal_digest_md5.lo \ @RASQAL_DIGEST_INTERNAL_TRUE@ rasqal_digest_sha1.lo am_librasqal_la_OBJECTS = rasqal_algebra.lo rasqal_expr.lo \ rasqal_expr_evaluate.lo rasqal_expr_datetimes.lo \ rasqal_expr_numerics.lo rasqal_expr_strings.lo \ rasqal_general.lo rasqal_query.lo rasqal_query_results.lo \ rasqal_engine.lo rasqal_raptor.lo rasqal_literal.lo \ rasqal_formula.lo rasqal_graph_pattern.lo rasqal_map.lo \ rasqal_feature.lo rasqal_result_formats.lo \ rasqal_xsd_datatypes.lo rasqal_decimal.lo rasqal_datetime.lo \ rasqal_rowsource.lo rasqal_format_sparql_xml.lo \ rasqal_variable.lo rasqal_rowsource_empty.lo \ rasqal_rowsource_union.lo rasqal_rowsource_rowsequence.lo \ rasqal_query_transform.lo rasqal_row.lo \ rasqal_engine_algebra.lo rasqal_triples_source.lo \ rasqal_rowsource_triples.lo rasqal_rowsource_filter.lo \ rasqal_rowsource_sort.lo rasqal_engine_sort.lo \ rasqal_rowsource_project.lo rasqal_rowsource_join.lo \ rasqal_rowsource_graph.lo rasqal_rowsource_distinct.lo \ rasqal_rowsource_groupby.lo rasqal_rowsource_aggregation.lo \ rasqal_rowsource_having.lo rasqal_rowsource_slice.lo \ rasqal_rowsource_bindings.lo rasqal_rowsource_service.lo \ rasqal_row_compatible.lo rasqal_format_table.lo \ rasqal_query_write.lo rasqal_format_json.lo \ rasqal_format_sv.lo rasqal_format_html.lo rasqal_format_rdf.lo \ rasqal_rowsource_assignment.lo rasqal_update.lo \ rasqal_triple.lo rasqal_data_graph.lo rasqal_prefix.lo \ rasqal_solution_modifier.lo rasqal_projection.lo \ rasqal_bindings.lo rasqal_service.lo rasqal_dataset.lo \ rasqal_random.lo rasqal_digest.lo rasqal_iostream.lo \ rasqal_regex.lo snprintf.lo rasqal_double.lo \ rasqal_ntriples.lo rasqal_results_compare.lo $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) $(am__objects_6) am__objects_7 = nodist_librasqal_la_OBJECTS = $(am__objects_7) librasqal_la_OBJECTS = $(am_librasqal_la_OBJECTS) \ $(nodist_librasqal_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent librasqal_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(librasqal_la_LDFLAGS) $(LDFLAGS) -o $@ am_rasqal_algebra_test_OBJECTS = \ rasqal_algebra_test-rasqal_algebra.$(OBJEXT) rasqal_algebra_test_OBJECTS = $(am_rasqal_algebra_test_OBJECTS) rasqal_algebra_test_DEPENDENCIES = librasqal.la am_rasqal_datetime_test_OBJECTS = \ rasqal_datetime_test-rasqal_datetime.$(OBJEXT) rasqal_datetime_test_OBJECTS = $(am_rasqal_datetime_test_OBJECTS) rasqal_datetime_test_DEPENDENCIES = librasqal.la am_rasqal_decimal_test_OBJECTS = \ rasqal_decimal_test-rasqal_decimal.$(OBJEXT) rasqal_decimal_test_OBJECTS = $(am_rasqal_decimal_test_OBJECTS) rasqal_decimal_test_DEPENDENCIES = librasqal.la am_rasqal_expr_test_OBJECTS = rasqal_expr_test-rasqal_expr.$(OBJEXT) rasqal_expr_test_OBJECTS = $(am_rasqal_expr_test_OBJECTS) rasqal_expr_test_DEPENDENCIES = librasqal.la am_rasqal_literal_test_OBJECTS = \ rasqal_literal_test-rasqal_literal.$(OBJEXT) rasqal_literal_test_OBJECTS = $(am_rasqal_literal_test_OBJECTS) rasqal_literal_test_DEPENDENCIES = librasqal.la am_rasqal_query_results_test_OBJECTS = \ rasqal_query_results_test-rasqal_query_results.$(OBJEXT) rasqal_query_results_test_OBJECTS = \ $(am_rasqal_query_results_test_OBJECTS) rasqal_query_results_test_DEPENDENCIES = librasqal.la am_rasqal_query_test_OBJECTS = \ rasqal_query_test-rasqal_query_test.$(OBJEXT) rasqal_query_test_OBJECTS = $(am_rasqal_query_test_OBJECTS) rasqal_query_test_DEPENDENCIES = librasqal.la am_rasqal_random_test_OBJECTS = \ rasqal_random_test-rasqal_random.$(OBJEXT) rasqal_random_test_OBJECTS = $(am_rasqal_random_test_OBJECTS) rasqal_random_test_DEPENDENCIES = librasqal.la am_rasqal_regex_test_OBJECTS = \ rasqal_regex_test-rasqal_regex.$(OBJEXT) rasqal_regex_test_OBJECTS = $(am_rasqal_regex_test_OBJECTS) rasqal_regex_test_DEPENDENCIES = librasqal.la am_rasqal_results_compare_test_OBJECTS = \ rasqal_results_compare_test-rasqal_results_compare.$(OBJEXT) rasqal_results_compare_test_OBJECTS = \ $(am_rasqal_results_compare_test_OBJECTS) rasqal_results_compare_test_DEPENDENCIES = librasqal.la am_rasqal_row_compatible_test_OBJECTS = \ rasqal_row_compatible_test-rasqal_row_compatible.$(OBJEXT) rasqal_row_compatible_test_OBJECTS = \ $(am_rasqal_row_compatible_test_OBJECTS) rasqal_row_compatible_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_aggregation_test_OBJECTS = rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.$(OBJEXT) rasqal_rowsource_aggregation_test_OBJECTS = \ $(am_rasqal_rowsource_aggregation_test_OBJECTS) rasqal_rowsource_aggregation_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_empty_test_OBJECTS = \ rasqal_rowsource_empty_test-rasqal_rowsource_empty.$(OBJEXT) rasqal_rowsource_empty_test_OBJECTS = \ $(am_rasqal_rowsource_empty_test_OBJECTS) rasqal_rowsource_empty_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_groupby_test_OBJECTS = rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.$(OBJEXT) rasqal_rowsource_groupby_test_OBJECTS = \ $(am_rasqal_rowsource_groupby_test_OBJECTS) rasqal_rowsource_groupby_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_join_test_OBJECTS = \ rasqal_rowsource_join_test-rasqal_rowsource_join.$(OBJEXT) rasqal_rowsource_join_test_OBJECTS = \ $(am_rasqal_rowsource_join_test_OBJECTS) rasqal_rowsource_join_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_project_test_OBJECTS = rasqal_rowsource_project_test-rasqal_rowsource_project.$(OBJEXT) rasqal_rowsource_project_test_OBJECTS = \ $(am_rasqal_rowsource_project_test_OBJECTS) rasqal_rowsource_project_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_rowsequence_test_OBJECTS = rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.$(OBJEXT) rasqal_rowsource_rowsequence_test_OBJECTS = \ $(am_rasqal_rowsource_rowsequence_test_OBJECTS) rasqal_rowsource_rowsequence_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_service_test_OBJECTS = rasqal_rowsource_service_test-rasqal_rowsource_service.$(OBJEXT) rasqal_rowsource_service_test_OBJECTS = \ $(am_rasqal_rowsource_service_test_OBJECTS) rasqal_rowsource_service_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_triples_test_OBJECTS = rasqal_rowsource_triples_test-rasqal_rowsource_triples.$(OBJEXT) rasqal_rowsource_triples_test_OBJECTS = \ $(am_rasqal_rowsource_triples_test_OBJECTS) rasqal_rowsource_triples_test_DEPENDENCIES = librasqal.la am_rasqal_rowsource_union_test_OBJECTS = \ rasqal_rowsource_union_test-rasqal_rowsource_union.$(OBJEXT) rasqal_rowsource_union_test_OBJECTS = \ $(am_rasqal_rowsource_union_test_OBJECTS) rasqal_rowsource_union_test_DEPENDENCIES = librasqal.la am_rasqal_variable_test_OBJECTS = \ rasqal_variable_test-rasqal_variable.$(OBJEXT) rasqal_variable_test_OBJECTS = $(am_rasqal_variable_test_OBJECTS) rasqal_variable_test_DEPENDENCIES = librasqal.la am_rasqal_xsd_datatypes_test_OBJECTS = \ rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.$(OBJEXT) rasqal_xsd_datatypes_test_OBJECTS = \ $(am_rasqal_xsd_datatypes_test_OBJECTS) rasqal_xsd_datatypes_test_DEPENDENCIES = librasqal.la am_sparql_lexer_test_OBJECTS = \ sparql_lexer_test-sparql_lexer.$(OBJEXT) sparql_lexer_test_OBJECTS = $(am_sparql_lexer_test_OBJECTS) sparql_lexer_test_DEPENDENCIES = librasqal.la am_sparql_parser_test_OBJECTS = \ sparql_parser_test-sparql_parser.$(OBJEXT) sparql_parser_test_OBJECTS = $(am_sparql_parser_test_OBJECTS) sparql_parser_test_DEPENDENCIES = librasqal.la $(am__append_13) am_strcasecmp_test_OBJECTS = strcasecmp_test-strcasecmp.$(OBJEXT) strcasecmp_test_OBJECTS = $(am_strcasecmp_test_OBJECTS) strcasecmp_test_DEPENDENCIES = librasqal.la SCRIPTS = $(bin_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(librasqal_la_SOURCES) $(nodist_librasqal_la_SOURCES) \ $(rasqal_algebra_test_SOURCES) $(rasqal_datetime_test_SOURCES) \ $(rasqal_decimal_test_SOURCES) $(rasqal_expr_test_SOURCES) \ $(rasqal_literal_test_SOURCES) \ $(rasqal_query_results_test_SOURCES) \ $(rasqal_query_test_SOURCES) $(rasqal_random_test_SOURCES) \ $(rasqal_regex_test_SOURCES) \ $(rasqal_results_compare_test_SOURCES) \ $(rasqal_row_compatible_test_SOURCES) \ $(rasqal_rowsource_aggregation_test_SOURCES) \ $(rasqal_rowsource_empty_test_SOURCES) \ $(rasqal_rowsource_groupby_test_SOURCES) \ $(rasqal_rowsource_join_test_SOURCES) \ $(rasqal_rowsource_project_test_SOURCES) \ $(rasqal_rowsource_rowsequence_test_SOURCES) \ $(rasqal_rowsource_service_test_SOURCES) \ $(rasqal_rowsource_triples_test_SOURCES) \ $(rasqal_rowsource_union_test_SOURCES) \ $(rasqal_variable_test_SOURCES) \ $(rasqal_xsd_datatypes_test_SOURCES) \ $(sparql_lexer_test_SOURCES) $(sparql_parser_test_SOURCES) \ $(strcasecmp_test_SOURCES) DIST_SOURCES = $(am__librasqal_la_SOURCES_DIST) \ $(rasqal_algebra_test_SOURCES) $(rasqal_datetime_test_SOURCES) \ $(rasqal_decimal_test_SOURCES) $(rasqal_expr_test_SOURCES) \ $(rasqal_literal_test_SOURCES) \ $(rasqal_query_results_test_SOURCES) \ $(rasqal_query_test_SOURCES) $(rasqal_random_test_SOURCES) \ $(rasqal_regex_test_SOURCES) \ $(rasqal_results_compare_test_SOURCES) \ $(rasqal_row_compatible_test_SOURCES) \ $(rasqal_rowsource_aggregation_test_SOURCES) \ $(rasqal_rowsource_empty_test_SOURCES) \ $(rasqal_rowsource_groupby_test_SOURCES) \ $(rasqal_rowsource_join_test_SOURCES) \ $(rasqal_rowsource_project_test_SOURCES) \ $(rasqal_rowsource_rowsequence_test_SOURCES) \ $(rasqal_rowsource_service_test_SOURCES) \ $(rasqal_rowsource_triples_test_SOURCES) \ $(rasqal_rowsource_union_test_SOURCES) \ $(rasqal_variable_test_SOURCES) \ $(rasqal_xsd_datatypes_test_SOURCES) \ $(sparql_lexer_test_SOURCES) $(sparql_parser_test_SOURCES) \ $(strcasecmp_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) HEADERS = $(nodist_pkginclude_HEADERS) $(noinst_HEADERS) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @RASQAL_INTERNAL_LIBS@ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ bin_SCRIPTS = rasqal-config lib_LTLIBRARIES = librasqal.la nodist_pkginclude_HEADERS = rasqal.h noinst_HEADERS = rasqal_internal.h win32_rasqal_config.h sv_config.h man_MANS = rasqal-config.1 TESTS_ENVIRONMENT = \ RDF_DATA_FILE=$(top_srcdir)/data/dc.rdf \ NT_DATA_FILE=$(top_srcdir)/data/one.nt \ SPARQL_QUERY_FILE=$(top_srcdir)/tests/sparql/examples/ex11_1.rq TESTS = rasqal_algebra_test$(EXEEXT) rasqal_expr_test$(EXEEXT) \ strcasecmp_test$(EXEEXT) rasqal_decimal_test$(EXEEXT) \ rasqal_datetime_test$(EXEEXT) rasqal_variable_test$(EXEEXT) \ rasqal_rowsource_empty_test$(EXEEXT) \ rasqal_rowsource_union_test$(EXEEXT) \ rasqal_rowsource_rowsequence_test$(EXEEXT) \ rasqal_rowsource_project_test$(EXEEXT) \ rasqal_rowsource_join_test$(EXEEXT) rasqal_query_test$(EXEEXT) \ rasqal_rowsource_triples_test$(EXEEXT) \ rasqal_row_compatible_test$(EXEEXT) \ rasqal_rowsource_groupby_test$(EXEEXT) \ rasqal_rowsource_aggregation_test$(EXEEXT) \ rasqal_literal_test$(EXEEXT) rasqal_regex_test$(EXEEXT) \ rasqal_random_test$(EXEEXT) rasqal_xsd_datatypes_test$(EXEEXT) \ rasqal_results_compare_test$(EXEEXT) \ rasqal_query_results_test$(EXEEXT) $(am__append_1) BROKEN_TESTS = rasqal_rowsource_service_test$(EXEEXT) EXTRA_PROGRAMS = $(TESTS) $(BROKEN_TESTS) CLEANFILES = $(TESTS) \ *.plist \ git-version.h MAINTAINERCLEANFILES = \ sparql_lexer.c sparql_lexer.h \ sparql_parser.c sparql_parser.h sparql_parser.output AM_CFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ @STANDARD_CFLAGS@ $(MEM) \ -DSV_CONFIG -I$(top_srcdir)/libsv $(am__append_9) ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) librasqal_la_SOURCES = rasqal_algebra.c rasqal_expr.c \ rasqal_expr_evaluate.c rasqal_expr_datetimes.c \ rasqal_expr_numerics.c rasqal_expr_strings.c rasqal_general.c \ rasqal_query.c rasqal_query_results.c rasqal_engine.c \ rasqal_raptor.c rasqal_literal.c rasqal_formula.c \ rasqal_graph_pattern.c rasqal_map.c rasqal_feature.c \ rasqal_result_formats.c rasqal_xsd_datatypes.c \ rasqal_decimal.c rasqal_datetime.c rasqal_rowsource.c \ rasqal_format_sparql_xml.c rasqal_variable.c \ rasqal_rowsource_empty.c rasqal_rowsource_union.c \ rasqal_rowsource_rowsequence.c rasqal_query_transform.c \ rasqal_row.c rasqal_engine_algebra.c rasqal_triples_source.c \ rasqal_rowsource_triples.c rasqal_rowsource_filter.c \ rasqal_rowsource_sort.c rasqal_engine_sort.c \ rasqal_rowsource_project.c rasqal_rowsource_join.c \ rasqal_rowsource_graph.c rasqal_rowsource_distinct.c \ rasqal_rowsource_groupby.c rasqal_rowsource_aggregation.c \ rasqal_rowsource_having.c rasqal_rowsource_slice.c \ rasqal_rowsource_bindings.c rasqal_rowsource_service.c \ rasqal_row_compatible.c rasqal_format_table.c \ rasqal_query_write.c rasqal_format_json.c rasqal_format_sv.c \ rasqal_format_html.c rasqal_format_rdf.c \ rasqal_rowsource_assignment.c rasqal_update.c rasqal_triple.c \ rasqal_data_graph.c rasqal_prefix.c rasqal_solution_modifier.c \ rasqal_projection.c rasqal_bindings.c rasqal_service.c \ rasqal_dataset.c rasqal_random.c rasqal_digest.c \ rasqal_iostream.c rasqal_regex.c snprintf.c rasqal_double.c \ rasqal_ntriples.c rasqal_results_compare.c ssort.h \ $(am__append_2) $(am__append_3) $(am__append_4) \ $(am__append_5) $(am__append_6) $(am__append_7) nodist_librasqal_la_SOURCES = $(am__append_8) librasqal_la_LDFLAGS = -version-info @RASQAL_LIBTOOL_VERSION@ librasqal_la_LIBADD = @LTLIBOBJS@ @RASQAL_INTERNAL_LIBS@ \ @RASQAL_EXTERNAL_LIBS@ $(MEM_LIBS) \ $(top_builddir)/libsv/libsv.la $(am__append_10) librasqal_la_DEPENDENCIES = @LTLIBOBJS@ @RASQAL_INTERNAL_LIBS@ \ $(top_builddir)/libsv/libsv.la $(am__append_11) EXTRA_DIST = \ sparql_lexer.l sparql_parser.y \ rasqal-config.in \ $(man_MANS) \ rasqal_query_test.c \ mtwist_config.h YACC = @YACC@ # Create some text files from HTML sources LYNX = lynx HTML_TO_TEXT = TERM=vt100 $(LYNX) -dump -nolist SUFFIXES = .html .txt sparql_lexer_test_SOURCES = sparql_lexer.c sparql_lexer_test_CPPFLAGS = -DSTANDALONE sparql_lexer_test_LDADD = librasqal.la sparql_parser_test_SOURCES = sparql_parser.c sparql_parser_test_CPPFLAGS = -DSTANDALONE $(am__append_12) sparql_parser_test_LDADD = librasqal.la $(am__append_13) rasqal_expr_test_SOURCES = rasqal_expr.c rasqal_expr_test_CPPFLAGS = -DSTANDALONE rasqal_expr_test_LDADD = librasqal.la strcasecmp_test_SOURCES = strcasecmp.c strcasecmp_test_CPPFLAGS = -DSTANDALONE strcasecmp_test_LDADD = librasqal.la rasqal_query_test_SOURCES = rasqal_query_test.c rasqal_query_test_CPPFLAGS = -DSTANDALONE rasqal_query_test_LDADD = librasqal.la rasqal_decimal_test_SOURCES = rasqal_decimal.c rasqal_decimal_test_CPPFLAGS = -DSTANDALONE rasqal_decimal_test_LDADD = librasqal.la rasqal_datetime_test_SOURCES = rasqal_datetime.c rasqal_datetime_test_CPPFLAGS = -DSTANDALONE rasqal_datetime_test_LDADD = librasqal.la rasqal_algebra_test_SOURCES = rasqal_algebra.c rasqal_algebra_test_CPPFLAGS = -DSTANDALONE rasqal_algebra_test_LDADD = librasqal.la rasqal_variable_test_SOURCES = rasqal_variable.c rasqal_variable_test_CPPFLAGS = -DSTANDALONE rasqal_variable_test_LDADD = librasqal.la rasqal_rowsource_aggregation_test_SOURCES = rasqal_rowsource_aggregation.c rasqal_rowsource_aggregation_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_aggregation_test_LDADD = librasqal.la rasqal_rowsource_empty_test_SOURCES = rasqal_rowsource_empty.c rasqal_rowsource_empty_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_empty_test_LDADD = librasqal.la rasqal_rowsource_groupby_test_SOURCES = rasqal_rowsource_groupby.c rasqal_rowsource_groupby_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_groupby_test_LDADD = librasqal.la rasqal_rowsource_union_test_SOURCES = rasqal_rowsource_union.c rasqal_rowsource_union_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_union_test_LDADD = librasqal.la rasqal_rowsource_rowsequence_test_SOURCES = rasqal_rowsource_rowsequence.c rasqal_rowsource_rowsequence_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_rowsequence_test_LDADD = librasqal.la rasqal_rowsource_triples_test_SOURCES = rasqal_rowsource_triples.c rasqal_rowsource_triples_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_triples_test_LDADD = librasqal.la rasqal_rowsource_project_test_SOURCES = rasqal_rowsource_project.c rasqal_rowsource_project_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_project_test_LDADD = librasqal.la rasqal_rowsource_join_test_SOURCES = rasqal_rowsource_join.c rasqal_rowsource_join_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_join_test_LDADD = librasqal.la rasqal_rowsource_service_test_SOURCES = rasqal_rowsource_service.c rasqal_rowsource_service_test_CPPFLAGS = -DSTANDALONE rasqal_rowsource_service_test_LDADD = librasqal.la rasqal_row_compatible_test_SOURCES = rasqal_row_compatible.c rasqal_row_compatible_test_CPPFLAGS = -DSTANDALONE rasqal_row_compatible_test_LDADD = librasqal.la rasqal_literal_test_SOURCES = rasqal_literal.c rasqal_literal_test_CPPFLAGS = -DSTANDALONE rasqal_literal_test_LDADD = librasqal.la rasqal_regex_test_SOURCES = rasqal_regex.c rasqal_regex_test_CPPFLAGS = -DSTANDALONE rasqal_regex_test_LDADD = librasqal.la rasqal_random_test_SOURCES = rasqal_random.c rasqal_random_test_CPPFLAGS = -DSTANDALONE rasqal_random_test_LDADD = librasqal.la rasqal_xsd_datatypes_test_SOURCES = rasqal_xsd_datatypes.c rasqal_xsd_datatypes_test_CPPFLAGS = -DSTANDALONE rasqal_xsd_datatypes_test_LDADD = librasqal.la rasqal_results_compare_test_SOURCES = rasqal_results_compare.c rasqal_results_compare_test_CPPFLAGS = -DSTANDALONE rasqal_results_compare_test_LDADD = librasqal.la rasqal_query_results_test_SOURCES = rasqal_query_results.c rasqal_query_results_test_CPPFLAGS = -DSTANDALONE rasqal_query_results_test_LDADD = librasqal.la all: rasqal_config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .html .txt .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 src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): rasqal_config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/rasqal_config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/rasqal_config.h $(srcdir)/rasqal_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f rasqal_config.h stamp-h1 rasqal.h: $(top_builddir)/config.status $(srcdir)/rasqal.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ win32_rasqal_config.h: $(top_builddir)/config.status $(srcdir)/win32_rasqal_config.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ rasqal-config: $(top_builddir)/config.status $(srcdir)/rasqal-config.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done librasqal.la: $(librasqal_la_OBJECTS) $(librasqal_la_DEPENDENCIES) $(EXTRA_librasqal_la_DEPENDENCIES) $(AM_V_CCLD)$(librasqal_la_LINK) -rpath $(libdir) $(librasqal_la_OBJECTS) $(librasqal_la_LIBADD) $(LIBS) rasqal_algebra_test$(EXEEXT): $(rasqal_algebra_test_OBJECTS) $(rasqal_algebra_test_DEPENDENCIES) $(EXTRA_rasqal_algebra_test_DEPENDENCIES) @rm -f rasqal_algebra_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_algebra_test_OBJECTS) $(rasqal_algebra_test_LDADD) $(LIBS) rasqal_datetime_test$(EXEEXT): $(rasqal_datetime_test_OBJECTS) $(rasqal_datetime_test_DEPENDENCIES) $(EXTRA_rasqal_datetime_test_DEPENDENCIES) @rm -f rasqal_datetime_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_datetime_test_OBJECTS) $(rasqal_datetime_test_LDADD) $(LIBS) rasqal_decimal_test$(EXEEXT): $(rasqal_decimal_test_OBJECTS) $(rasqal_decimal_test_DEPENDENCIES) $(EXTRA_rasqal_decimal_test_DEPENDENCIES) @rm -f rasqal_decimal_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_decimal_test_OBJECTS) $(rasqal_decimal_test_LDADD) $(LIBS) rasqal_expr_test$(EXEEXT): $(rasqal_expr_test_OBJECTS) $(rasqal_expr_test_DEPENDENCIES) $(EXTRA_rasqal_expr_test_DEPENDENCIES) @rm -f rasqal_expr_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_expr_test_OBJECTS) $(rasqal_expr_test_LDADD) $(LIBS) rasqal_literal_test$(EXEEXT): $(rasqal_literal_test_OBJECTS) $(rasqal_literal_test_DEPENDENCIES) $(EXTRA_rasqal_literal_test_DEPENDENCIES) @rm -f rasqal_literal_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_literal_test_OBJECTS) $(rasqal_literal_test_LDADD) $(LIBS) rasqal_query_results_test$(EXEEXT): $(rasqal_query_results_test_OBJECTS) $(rasqal_query_results_test_DEPENDENCIES) $(EXTRA_rasqal_query_results_test_DEPENDENCIES) @rm -f rasqal_query_results_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_query_results_test_OBJECTS) $(rasqal_query_results_test_LDADD) $(LIBS) rasqal_query_test$(EXEEXT): $(rasqal_query_test_OBJECTS) $(rasqal_query_test_DEPENDENCIES) $(EXTRA_rasqal_query_test_DEPENDENCIES) @rm -f rasqal_query_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_query_test_OBJECTS) $(rasqal_query_test_LDADD) $(LIBS) rasqal_random_test$(EXEEXT): $(rasqal_random_test_OBJECTS) $(rasqal_random_test_DEPENDENCIES) $(EXTRA_rasqal_random_test_DEPENDENCIES) @rm -f rasqal_random_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_random_test_OBJECTS) $(rasqal_random_test_LDADD) $(LIBS) rasqal_regex_test$(EXEEXT): $(rasqal_regex_test_OBJECTS) $(rasqal_regex_test_DEPENDENCIES) $(EXTRA_rasqal_regex_test_DEPENDENCIES) @rm -f rasqal_regex_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_regex_test_OBJECTS) $(rasqal_regex_test_LDADD) $(LIBS) rasqal_results_compare_test$(EXEEXT): $(rasqal_results_compare_test_OBJECTS) $(rasqal_results_compare_test_DEPENDENCIES) $(EXTRA_rasqal_results_compare_test_DEPENDENCIES) @rm -f rasqal_results_compare_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_results_compare_test_OBJECTS) $(rasqal_results_compare_test_LDADD) $(LIBS) rasqal_row_compatible_test$(EXEEXT): $(rasqal_row_compatible_test_OBJECTS) $(rasqal_row_compatible_test_DEPENDENCIES) $(EXTRA_rasqal_row_compatible_test_DEPENDENCIES) @rm -f rasqal_row_compatible_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_row_compatible_test_OBJECTS) $(rasqal_row_compatible_test_LDADD) $(LIBS) rasqal_rowsource_aggregation_test$(EXEEXT): $(rasqal_rowsource_aggregation_test_OBJECTS) $(rasqal_rowsource_aggregation_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_aggregation_test_DEPENDENCIES) @rm -f rasqal_rowsource_aggregation_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_aggregation_test_OBJECTS) $(rasqal_rowsource_aggregation_test_LDADD) $(LIBS) rasqal_rowsource_empty_test$(EXEEXT): $(rasqal_rowsource_empty_test_OBJECTS) $(rasqal_rowsource_empty_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_empty_test_DEPENDENCIES) @rm -f rasqal_rowsource_empty_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_empty_test_OBJECTS) $(rasqal_rowsource_empty_test_LDADD) $(LIBS) rasqal_rowsource_groupby_test$(EXEEXT): $(rasqal_rowsource_groupby_test_OBJECTS) $(rasqal_rowsource_groupby_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_groupby_test_DEPENDENCIES) @rm -f rasqal_rowsource_groupby_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_groupby_test_OBJECTS) $(rasqal_rowsource_groupby_test_LDADD) $(LIBS) rasqal_rowsource_join_test$(EXEEXT): $(rasqal_rowsource_join_test_OBJECTS) $(rasqal_rowsource_join_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_join_test_DEPENDENCIES) @rm -f rasqal_rowsource_join_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_join_test_OBJECTS) $(rasqal_rowsource_join_test_LDADD) $(LIBS) rasqal_rowsource_project_test$(EXEEXT): $(rasqal_rowsource_project_test_OBJECTS) $(rasqal_rowsource_project_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_project_test_DEPENDENCIES) @rm -f rasqal_rowsource_project_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_project_test_OBJECTS) $(rasqal_rowsource_project_test_LDADD) $(LIBS) rasqal_rowsource_rowsequence_test$(EXEEXT): $(rasqal_rowsource_rowsequence_test_OBJECTS) $(rasqal_rowsource_rowsequence_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_rowsequence_test_DEPENDENCIES) @rm -f rasqal_rowsource_rowsequence_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_rowsequence_test_OBJECTS) $(rasqal_rowsource_rowsequence_test_LDADD) $(LIBS) rasqal_rowsource_service_test$(EXEEXT): $(rasqal_rowsource_service_test_OBJECTS) $(rasqal_rowsource_service_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_service_test_DEPENDENCIES) @rm -f rasqal_rowsource_service_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_service_test_OBJECTS) $(rasqal_rowsource_service_test_LDADD) $(LIBS) rasqal_rowsource_triples_test$(EXEEXT): $(rasqal_rowsource_triples_test_OBJECTS) $(rasqal_rowsource_triples_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_triples_test_DEPENDENCIES) @rm -f rasqal_rowsource_triples_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_triples_test_OBJECTS) $(rasqal_rowsource_triples_test_LDADD) $(LIBS) rasqal_rowsource_union_test$(EXEEXT): $(rasqal_rowsource_union_test_OBJECTS) $(rasqal_rowsource_union_test_DEPENDENCIES) $(EXTRA_rasqal_rowsource_union_test_DEPENDENCIES) @rm -f rasqal_rowsource_union_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_rowsource_union_test_OBJECTS) $(rasqal_rowsource_union_test_LDADD) $(LIBS) rasqal_variable_test$(EXEEXT): $(rasqal_variable_test_OBJECTS) $(rasqal_variable_test_DEPENDENCIES) $(EXTRA_rasqal_variable_test_DEPENDENCIES) @rm -f rasqal_variable_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_variable_test_OBJECTS) $(rasqal_variable_test_LDADD) $(LIBS) rasqal_xsd_datatypes_test$(EXEEXT): $(rasqal_xsd_datatypes_test_OBJECTS) $(rasqal_xsd_datatypes_test_DEPENDENCIES) $(EXTRA_rasqal_xsd_datatypes_test_DEPENDENCIES) @rm -f rasqal_xsd_datatypes_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rasqal_xsd_datatypes_test_OBJECTS) $(rasqal_xsd_datatypes_test_LDADD) $(LIBS) sparql_lexer_test$(EXEEXT): $(sparql_lexer_test_OBJECTS) $(sparql_lexer_test_DEPENDENCIES) $(EXTRA_sparql_lexer_test_DEPENDENCIES) @rm -f sparql_lexer_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sparql_lexer_test_OBJECTS) $(sparql_lexer_test_LDADD) $(LIBS) sparql_parser_test$(EXEEXT): $(sparql_parser_test_OBJECTS) $(sparql_parser_test_DEPENDENCIES) $(EXTRA_sparql_parser_test_DEPENDENCIES) @rm -f sparql_parser_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sparql_parser_test_OBJECTS) $(sparql_parser_test_LDADD) $(LIBS) strcasecmp_test$(EXEEXT): $(strcasecmp_test_OBJECTS) $(strcasecmp_test_DEPENDENCIES) $(EXTRA_strcasecmp_test_DEPENDENCIES) @rm -f strcasecmp_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(strcasecmp_test_OBJECTS) $(strcasecmp_test_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) installcheck-binSCRIPTS: $(bin_SCRIPTS) bad=0; pid=$$$$; list="$(bin_SCRIPTS)"; for p in $$list; do \ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ esac; \ f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \ for opt in --help --version; do \ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ 2>c$${pid}_.err &2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_algebra.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_bindings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_data_graph.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_dataset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_datetime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_decimal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_digest_md5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_digest_sha1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_double.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_engine.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_engine_algebra.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_engine_sort.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_expr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_expr_datetimes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_expr_evaluate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_expr_numerics.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_expr_strings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_expr_test-rasqal_expr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_feature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_format_html.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_format_json.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_format_rdf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_format_sparql_xml.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_format_sv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_format_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_formula.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_general.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_graph_pattern.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_iostream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_literal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_literal_test-rasqal_literal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_map.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_ntriples.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_prefix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_projection.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_query.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_query_results.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_query_test-rasqal_query_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_query_transform.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_query_write.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_random.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_random_test-rasqal_random.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_raptor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_regex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_regex_test-rasqal_regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_result_formats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_results_compare.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_row.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_row_compatible.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_aggregation.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_assignment.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_bindings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_distinct.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_empty.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_filter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_graph.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_groupby.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_having.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_join.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_project.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_rowsequence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_service.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_slice.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_sort.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_triples.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_union.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_service.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_solution_modifier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_sort.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_triple.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_triples_source.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_update.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_variable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_variable_test-rasqal_variable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_xsd_datatypes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparql_lexer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparql_lexer_test-sparql_lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparql_parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparql_parser_test-sparql_parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp_test-strcasecmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timegm.Plo@am__quote@ .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 $< .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 `$(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 $@ $< rasqal_algebra_test-rasqal_algebra.o: rasqal_algebra.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_algebra_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_algebra_test-rasqal_algebra.o -MD -MP -MF $(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Tpo -c -o rasqal_algebra_test-rasqal_algebra.o `test -f 'rasqal_algebra.c' || echo '$(srcdir)/'`rasqal_algebra.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Tpo $(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_algebra.c' object='rasqal_algebra_test-rasqal_algebra.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) $(rasqal_algebra_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_algebra_test-rasqal_algebra.o `test -f 'rasqal_algebra.c' || echo '$(srcdir)/'`rasqal_algebra.c rasqal_algebra_test-rasqal_algebra.obj: rasqal_algebra.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_algebra_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_algebra_test-rasqal_algebra.obj -MD -MP -MF $(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Tpo -c -o rasqal_algebra_test-rasqal_algebra.obj `if test -f 'rasqal_algebra.c'; then $(CYGPATH_W) 'rasqal_algebra.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_algebra.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Tpo $(DEPDIR)/rasqal_algebra_test-rasqal_algebra.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_algebra.c' object='rasqal_algebra_test-rasqal_algebra.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) $(rasqal_algebra_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_algebra_test-rasqal_algebra.obj `if test -f 'rasqal_algebra.c'; then $(CYGPATH_W) 'rasqal_algebra.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_algebra.c'; fi` rasqal_datetime_test-rasqal_datetime.o: rasqal_datetime.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_datetime_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_datetime_test-rasqal_datetime.o -MD -MP -MF $(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Tpo -c -o rasqal_datetime_test-rasqal_datetime.o `test -f 'rasqal_datetime.c' || echo '$(srcdir)/'`rasqal_datetime.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Tpo $(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_datetime.c' object='rasqal_datetime_test-rasqal_datetime.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) $(rasqal_datetime_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_datetime_test-rasqal_datetime.o `test -f 'rasqal_datetime.c' || echo '$(srcdir)/'`rasqal_datetime.c rasqal_datetime_test-rasqal_datetime.obj: rasqal_datetime.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_datetime_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_datetime_test-rasqal_datetime.obj -MD -MP -MF $(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Tpo -c -o rasqal_datetime_test-rasqal_datetime.obj `if test -f 'rasqal_datetime.c'; then $(CYGPATH_W) 'rasqal_datetime.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_datetime.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Tpo $(DEPDIR)/rasqal_datetime_test-rasqal_datetime.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_datetime.c' object='rasqal_datetime_test-rasqal_datetime.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) $(rasqal_datetime_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_datetime_test-rasqal_datetime.obj `if test -f 'rasqal_datetime.c'; then $(CYGPATH_W) 'rasqal_datetime.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_datetime.c'; fi` rasqal_decimal_test-rasqal_decimal.o: rasqal_decimal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_decimal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_decimal_test-rasqal_decimal.o -MD -MP -MF $(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Tpo -c -o rasqal_decimal_test-rasqal_decimal.o `test -f 'rasqal_decimal.c' || echo '$(srcdir)/'`rasqal_decimal.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Tpo $(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_decimal.c' object='rasqal_decimal_test-rasqal_decimal.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) $(rasqal_decimal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_decimal_test-rasqal_decimal.o `test -f 'rasqal_decimal.c' || echo '$(srcdir)/'`rasqal_decimal.c rasqal_decimal_test-rasqal_decimal.obj: rasqal_decimal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_decimal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_decimal_test-rasqal_decimal.obj -MD -MP -MF $(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Tpo -c -o rasqal_decimal_test-rasqal_decimal.obj `if test -f 'rasqal_decimal.c'; then $(CYGPATH_W) 'rasqal_decimal.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_decimal.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Tpo $(DEPDIR)/rasqal_decimal_test-rasqal_decimal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_decimal.c' object='rasqal_decimal_test-rasqal_decimal.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) $(rasqal_decimal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_decimal_test-rasqal_decimal.obj `if test -f 'rasqal_decimal.c'; then $(CYGPATH_W) 'rasqal_decimal.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_decimal.c'; fi` rasqal_expr_test-rasqal_expr.o: rasqal_expr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_expr_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_expr_test-rasqal_expr.o -MD -MP -MF $(DEPDIR)/rasqal_expr_test-rasqal_expr.Tpo -c -o rasqal_expr_test-rasqal_expr.o `test -f 'rasqal_expr.c' || echo '$(srcdir)/'`rasqal_expr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_expr_test-rasqal_expr.Tpo $(DEPDIR)/rasqal_expr_test-rasqal_expr.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_expr.c' object='rasqal_expr_test-rasqal_expr.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) $(rasqal_expr_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_expr_test-rasqal_expr.o `test -f 'rasqal_expr.c' || echo '$(srcdir)/'`rasqal_expr.c rasqal_expr_test-rasqal_expr.obj: rasqal_expr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_expr_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_expr_test-rasqal_expr.obj -MD -MP -MF $(DEPDIR)/rasqal_expr_test-rasqal_expr.Tpo -c -o rasqal_expr_test-rasqal_expr.obj `if test -f 'rasqal_expr.c'; then $(CYGPATH_W) 'rasqal_expr.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_expr.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_expr_test-rasqal_expr.Tpo $(DEPDIR)/rasqal_expr_test-rasqal_expr.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_expr.c' object='rasqal_expr_test-rasqal_expr.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) $(rasqal_expr_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_expr_test-rasqal_expr.obj `if test -f 'rasqal_expr.c'; then $(CYGPATH_W) 'rasqal_expr.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_expr.c'; fi` rasqal_literal_test-rasqal_literal.o: rasqal_literal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_literal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_literal_test-rasqal_literal.o -MD -MP -MF $(DEPDIR)/rasqal_literal_test-rasqal_literal.Tpo -c -o rasqal_literal_test-rasqal_literal.o `test -f 'rasqal_literal.c' || echo '$(srcdir)/'`rasqal_literal.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_literal_test-rasqal_literal.Tpo $(DEPDIR)/rasqal_literal_test-rasqal_literal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_literal.c' object='rasqal_literal_test-rasqal_literal.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) $(rasqal_literal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_literal_test-rasqal_literal.o `test -f 'rasqal_literal.c' || echo '$(srcdir)/'`rasqal_literal.c rasqal_literal_test-rasqal_literal.obj: rasqal_literal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_literal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_literal_test-rasqal_literal.obj -MD -MP -MF $(DEPDIR)/rasqal_literal_test-rasqal_literal.Tpo -c -o rasqal_literal_test-rasqal_literal.obj `if test -f 'rasqal_literal.c'; then $(CYGPATH_W) 'rasqal_literal.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_literal.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_literal_test-rasqal_literal.Tpo $(DEPDIR)/rasqal_literal_test-rasqal_literal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_literal.c' object='rasqal_literal_test-rasqal_literal.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) $(rasqal_literal_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_literal_test-rasqal_literal.obj `if test -f 'rasqal_literal.c'; then $(CYGPATH_W) 'rasqal_literal.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_literal.c'; fi` rasqal_query_results_test-rasqal_query_results.o: rasqal_query_results.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_query_results_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_query_results_test-rasqal_query_results.o -MD -MP -MF $(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Tpo -c -o rasqal_query_results_test-rasqal_query_results.o `test -f 'rasqal_query_results.c' || echo '$(srcdir)/'`rasqal_query_results.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Tpo $(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_query_results.c' object='rasqal_query_results_test-rasqal_query_results.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) $(rasqal_query_results_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_query_results_test-rasqal_query_results.o `test -f 'rasqal_query_results.c' || echo '$(srcdir)/'`rasqal_query_results.c rasqal_query_results_test-rasqal_query_results.obj: rasqal_query_results.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_query_results_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_query_results_test-rasqal_query_results.obj -MD -MP -MF $(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Tpo -c -o rasqal_query_results_test-rasqal_query_results.obj `if test -f 'rasqal_query_results.c'; then $(CYGPATH_W) 'rasqal_query_results.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_query_results.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Tpo $(DEPDIR)/rasqal_query_results_test-rasqal_query_results.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_query_results.c' object='rasqal_query_results_test-rasqal_query_results.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) $(rasqal_query_results_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_query_results_test-rasqal_query_results.obj `if test -f 'rasqal_query_results.c'; then $(CYGPATH_W) 'rasqal_query_results.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_query_results.c'; fi` rasqal_query_test-rasqal_query_test.o: rasqal_query_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_query_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_query_test-rasqal_query_test.o -MD -MP -MF $(DEPDIR)/rasqal_query_test-rasqal_query_test.Tpo -c -o rasqal_query_test-rasqal_query_test.o `test -f 'rasqal_query_test.c' || echo '$(srcdir)/'`rasqal_query_test.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_query_test-rasqal_query_test.Tpo $(DEPDIR)/rasqal_query_test-rasqal_query_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_query_test.c' object='rasqal_query_test-rasqal_query_test.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) $(rasqal_query_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_query_test-rasqal_query_test.o `test -f 'rasqal_query_test.c' || echo '$(srcdir)/'`rasqal_query_test.c rasqal_query_test-rasqal_query_test.obj: rasqal_query_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_query_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_query_test-rasqal_query_test.obj -MD -MP -MF $(DEPDIR)/rasqal_query_test-rasqal_query_test.Tpo -c -o rasqal_query_test-rasqal_query_test.obj `if test -f 'rasqal_query_test.c'; then $(CYGPATH_W) 'rasqal_query_test.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_query_test.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_query_test-rasqal_query_test.Tpo $(DEPDIR)/rasqal_query_test-rasqal_query_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_query_test.c' object='rasqal_query_test-rasqal_query_test.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) $(rasqal_query_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_query_test-rasqal_query_test.obj `if test -f 'rasqal_query_test.c'; then $(CYGPATH_W) 'rasqal_query_test.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_query_test.c'; fi` rasqal_random_test-rasqal_random.o: rasqal_random.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_random_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_random_test-rasqal_random.o -MD -MP -MF $(DEPDIR)/rasqal_random_test-rasqal_random.Tpo -c -o rasqal_random_test-rasqal_random.o `test -f 'rasqal_random.c' || echo '$(srcdir)/'`rasqal_random.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_random_test-rasqal_random.Tpo $(DEPDIR)/rasqal_random_test-rasqal_random.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_random.c' object='rasqal_random_test-rasqal_random.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) $(rasqal_random_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_random_test-rasqal_random.o `test -f 'rasqal_random.c' || echo '$(srcdir)/'`rasqal_random.c rasqal_random_test-rasqal_random.obj: rasqal_random.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_random_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_random_test-rasqal_random.obj -MD -MP -MF $(DEPDIR)/rasqal_random_test-rasqal_random.Tpo -c -o rasqal_random_test-rasqal_random.obj `if test -f 'rasqal_random.c'; then $(CYGPATH_W) 'rasqal_random.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_random.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_random_test-rasqal_random.Tpo $(DEPDIR)/rasqal_random_test-rasqal_random.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_random.c' object='rasqal_random_test-rasqal_random.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) $(rasqal_random_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_random_test-rasqal_random.obj `if test -f 'rasqal_random.c'; then $(CYGPATH_W) 'rasqal_random.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_random.c'; fi` rasqal_regex_test-rasqal_regex.o: rasqal_regex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_regex_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_regex_test-rasqal_regex.o -MD -MP -MF $(DEPDIR)/rasqal_regex_test-rasqal_regex.Tpo -c -o rasqal_regex_test-rasqal_regex.o `test -f 'rasqal_regex.c' || echo '$(srcdir)/'`rasqal_regex.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_regex_test-rasqal_regex.Tpo $(DEPDIR)/rasqal_regex_test-rasqal_regex.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_regex.c' object='rasqal_regex_test-rasqal_regex.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) $(rasqal_regex_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_regex_test-rasqal_regex.o `test -f 'rasqal_regex.c' || echo '$(srcdir)/'`rasqal_regex.c rasqal_regex_test-rasqal_regex.obj: rasqal_regex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_regex_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_regex_test-rasqal_regex.obj -MD -MP -MF $(DEPDIR)/rasqal_regex_test-rasqal_regex.Tpo -c -o rasqal_regex_test-rasqal_regex.obj `if test -f 'rasqal_regex.c'; then $(CYGPATH_W) 'rasqal_regex.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_regex.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_regex_test-rasqal_regex.Tpo $(DEPDIR)/rasqal_regex_test-rasqal_regex.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_regex.c' object='rasqal_regex_test-rasqal_regex.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) $(rasqal_regex_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_regex_test-rasqal_regex.obj `if test -f 'rasqal_regex.c'; then $(CYGPATH_W) 'rasqal_regex.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_regex.c'; fi` rasqal_results_compare_test-rasqal_results_compare.o: rasqal_results_compare.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_results_compare_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_results_compare_test-rasqal_results_compare.o -MD -MP -MF $(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Tpo -c -o rasqal_results_compare_test-rasqal_results_compare.o `test -f 'rasqal_results_compare.c' || echo '$(srcdir)/'`rasqal_results_compare.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Tpo $(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_results_compare.c' object='rasqal_results_compare_test-rasqal_results_compare.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) $(rasqal_results_compare_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_results_compare_test-rasqal_results_compare.o `test -f 'rasqal_results_compare.c' || echo '$(srcdir)/'`rasqal_results_compare.c rasqal_results_compare_test-rasqal_results_compare.obj: rasqal_results_compare.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_results_compare_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_results_compare_test-rasqal_results_compare.obj -MD -MP -MF $(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Tpo -c -o rasqal_results_compare_test-rasqal_results_compare.obj `if test -f 'rasqal_results_compare.c'; then $(CYGPATH_W) 'rasqal_results_compare.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_results_compare.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Tpo $(DEPDIR)/rasqal_results_compare_test-rasqal_results_compare.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_results_compare.c' object='rasqal_results_compare_test-rasqal_results_compare.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) $(rasqal_results_compare_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_results_compare_test-rasqal_results_compare.obj `if test -f 'rasqal_results_compare.c'; then $(CYGPATH_W) 'rasqal_results_compare.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_results_compare.c'; fi` rasqal_row_compatible_test-rasqal_row_compatible.o: rasqal_row_compatible.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_row_compatible_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_row_compatible_test-rasqal_row_compatible.o -MD -MP -MF $(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Tpo -c -o rasqal_row_compatible_test-rasqal_row_compatible.o `test -f 'rasqal_row_compatible.c' || echo '$(srcdir)/'`rasqal_row_compatible.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Tpo $(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_row_compatible.c' object='rasqal_row_compatible_test-rasqal_row_compatible.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) $(rasqal_row_compatible_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_row_compatible_test-rasqal_row_compatible.o `test -f 'rasqal_row_compatible.c' || echo '$(srcdir)/'`rasqal_row_compatible.c rasqal_row_compatible_test-rasqal_row_compatible.obj: rasqal_row_compatible.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_row_compatible_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_row_compatible_test-rasqal_row_compatible.obj -MD -MP -MF $(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Tpo -c -o rasqal_row_compatible_test-rasqal_row_compatible.obj `if test -f 'rasqal_row_compatible.c'; then $(CYGPATH_W) 'rasqal_row_compatible.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_row_compatible.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Tpo $(DEPDIR)/rasqal_row_compatible_test-rasqal_row_compatible.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_row_compatible.c' object='rasqal_row_compatible_test-rasqal_row_compatible.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) $(rasqal_row_compatible_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_row_compatible_test-rasqal_row_compatible.obj `if test -f 'rasqal_row_compatible.c'; then $(CYGPATH_W) 'rasqal_row_compatible.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_row_compatible.c'; fi` rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.o: rasqal_rowsource_aggregation.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_aggregation_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Tpo -c -o rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.o `test -f 'rasqal_rowsource_aggregation.c' || echo '$(srcdir)/'`rasqal_rowsource_aggregation.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Tpo $(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_aggregation.c' object='rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.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) $(rasqal_rowsource_aggregation_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.o `test -f 'rasqal_rowsource_aggregation.c' || echo '$(srcdir)/'`rasqal_rowsource_aggregation.c rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.obj: rasqal_rowsource_aggregation.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_aggregation_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Tpo -c -o rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.obj `if test -f 'rasqal_rowsource_aggregation.c'; then $(CYGPATH_W) 'rasqal_rowsource_aggregation.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_aggregation.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Tpo $(DEPDIR)/rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_aggregation.c' object='rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.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) $(rasqal_rowsource_aggregation_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_aggregation_test-rasqal_rowsource_aggregation.obj `if test -f 'rasqal_rowsource_aggregation.c'; then $(CYGPATH_W) 'rasqal_rowsource_aggregation.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_aggregation.c'; fi` rasqal_rowsource_empty_test-rasqal_rowsource_empty.o: rasqal_rowsource_empty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_empty_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_empty_test-rasqal_rowsource_empty.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Tpo -c -o rasqal_rowsource_empty_test-rasqal_rowsource_empty.o `test -f 'rasqal_rowsource_empty.c' || echo '$(srcdir)/'`rasqal_rowsource_empty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Tpo $(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_empty.c' object='rasqal_rowsource_empty_test-rasqal_rowsource_empty.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) $(rasqal_rowsource_empty_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_empty_test-rasqal_rowsource_empty.o `test -f 'rasqal_rowsource_empty.c' || echo '$(srcdir)/'`rasqal_rowsource_empty.c rasqal_rowsource_empty_test-rasqal_rowsource_empty.obj: rasqal_rowsource_empty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_empty_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_empty_test-rasqal_rowsource_empty.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Tpo -c -o rasqal_rowsource_empty_test-rasqal_rowsource_empty.obj `if test -f 'rasqal_rowsource_empty.c'; then $(CYGPATH_W) 'rasqal_rowsource_empty.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_empty.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Tpo $(DEPDIR)/rasqal_rowsource_empty_test-rasqal_rowsource_empty.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_empty.c' object='rasqal_rowsource_empty_test-rasqal_rowsource_empty.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) $(rasqal_rowsource_empty_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_empty_test-rasqal_rowsource_empty.obj `if test -f 'rasqal_rowsource_empty.c'; then $(CYGPATH_W) 'rasqal_rowsource_empty.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_empty.c'; fi` rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.o: rasqal_rowsource_groupby.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_groupby_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Tpo -c -o rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.o `test -f 'rasqal_rowsource_groupby.c' || echo '$(srcdir)/'`rasqal_rowsource_groupby.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Tpo $(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_groupby.c' object='rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.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) $(rasqal_rowsource_groupby_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.o `test -f 'rasqal_rowsource_groupby.c' || echo '$(srcdir)/'`rasqal_rowsource_groupby.c rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.obj: rasqal_rowsource_groupby.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_groupby_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Tpo -c -o rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.obj `if test -f 'rasqal_rowsource_groupby.c'; then $(CYGPATH_W) 'rasqal_rowsource_groupby.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_groupby.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Tpo $(DEPDIR)/rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_groupby.c' object='rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.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) $(rasqal_rowsource_groupby_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_groupby_test-rasqal_rowsource_groupby.obj `if test -f 'rasqal_rowsource_groupby.c'; then $(CYGPATH_W) 'rasqal_rowsource_groupby.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_groupby.c'; fi` rasqal_rowsource_join_test-rasqal_rowsource_join.o: rasqal_rowsource_join.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_join_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_join_test-rasqal_rowsource_join.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Tpo -c -o rasqal_rowsource_join_test-rasqal_rowsource_join.o `test -f 'rasqal_rowsource_join.c' || echo '$(srcdir)/'`rasqal_rowsource_join.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Tpo $(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_join.c' object='rasqal_rowsource_join_test-rasqal_rowsource_join.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) $(rasqal_rowsource_join_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_join_test-rasqal_rowsource_join.o `test -f 'rasqal_rowsource_join.c' || echo '$(srcdir)/'`rasqal_rowsource_join.c rasqal_rowsource_join_test-rasqal_rowsource_join.obj: rasqal_rowsource_join.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_join_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_join_test-rasqal_rowsource_join.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Tpo -c -o rasqal_rowsource_join_test-rasqal_rowsource_join.obj `if test -f 'rasqal_rowsource_join.c'; then $(CYGPATH_W) 'rasqal_rowsource_join.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_join.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Tpo $(DEPDIR)/rasqal_rowsource_join_test-rasqal_rowsource_join.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_join.c' object='rasqal_rowsource_join_test-rasqal_rowsource_join.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) $(rasqal_rowsource_join_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_join_test-rasqal_rowsource_join.obj `if test -f 'rasqal_rowsource_join.c'; then $(CYGPATH_W) 'rasqal_rowsource_join.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_join.c'; fi` rasqal_rowsource_project_test-rasqal_rowsource_project.o: rasqal_rowsource_project.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_project_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_project_test-rasqal_rowsource_project.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Tpo -c -o rasqal_rowsource_project_test-rasqal_rowsource_project.o `test -f 'rasqal_rowsource_project.c' || echo '$(srcdir)/'`rasqal_rowsource_project.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Tpo $(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_project.c' object='rasqal_rowsource_project_test-rasqal_rowsource_project.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) $(rasqal_rowsource_project_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_project_test-rasqal_rowsource_project.o `test -f 'rasqal_rowsource_project.c' || echo '$(srcdir)/'`rasqal_rowsource_project.c rasqal_rowsource_project_test-rasqal_rowsource_project.obj: rasqal_rowsource_project.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_project_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_project_test-rasqal_rowsource_project.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Tpo -c -o rasqal_rowsource_project_test-rasqal_rowsource_project.obj `if test -f 'rasqal_rowsource_project.c'; then $(CYGPATH_W) 'rasqal_rowsource_project.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_project.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Tpo $(DEPDIR)/rasqal_rowsource_project_test-rasqal_rowsource_project.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_project.c' object='rasqal_rowsource_project_test-rasqal_rowsource_project.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) $(rasqal_rowsource_project_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_project_test-rasqal_rowsource_project.obj `if test -f 'rasqal_rowsource_project.c'; then $(CYGPATH_W) 'rasqal_rowsource_project.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_project.c'; fi` rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.o: rasqal_rowsource_rowsequence.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_rowsequence_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Tpo -c -o rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.o `test -f 'rasqal_rowsource_rowsequence.c' || echo '$(srcdir)/'`rasqal_rowsource_rowsequence.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Tpo $(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_rowsequence.c' object='rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.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) $(rasqal_rowsource_rowsequence_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.o `test -f 'rasqal_rowsource_rowsequence.c' || echo '$(srcdir)/'`rasqal_rowsource_rowsequence.c rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.obj: rasqal_rowsource_rowsequence.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_rowsequence_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Tpo -c -o rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.obj `if test -f 'rasqal_rowsource_rowsequence.c'; then $(CYGPATH_W) 'rasqal_rowsource_rowsequence.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_rowsequence.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Tpo $(DEPDIR)/rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_rowsequence.c' object='rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.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) $(rasqal_rowsource_rowsequence_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_rowsequence_test-rasqal_rowsource_rowsequence.obj `if test -f 'rasqal_rowsource_rowsequence.c'; then $(CYGPATH_W) 'rasqal_rowsource_rowsequence.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_rowsequence.c'; fi` rasqal_rowsource_service_test-rasqal_rowsource_service.o: rasqal_rowsource_service.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_service_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_service_test-rasqal_rowsource_service.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Tpo -c -o rasqal_rowsource_service_test-rasqal_rowsource_service.o `test -f 'rasqal_rowsource_service.c' || echo '$(srcdir)/'`rasqal_rowsource_service.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Tpo $(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_service.c' object='rasqal_rowsource_service_test-rasqal_rowsource_service.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) $(rasqal_rowsource_service_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_service_test-rasqal_rowsource_service.o `test -f 'rasqal_rowsource_service.c' || echo '$(srcdir)/'`rasqal_rowsource_service.c rasqal_rowsource_service_test-rasqal_rowsource_service.obj: rasqal_rowsource_service.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_service_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_service_test-rasqal_rowsource_service.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Tpo -c -o rasqal_rowsource_service_test-rasqal_rowsource_service.obj `if test -f 'rasqal_rowsource_service.c'; then $(CYGPATH_W) 'rasqal_rowsource_service.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_service.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Tpo $(DEPDIR)/rasqal_rowsource_service_test-rasqal_rowsource_service.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_service.c' object='rasqal_rowsource_service_test-rasqal_rowsource_service.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) $(rasqal_rowsource_service_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_service_test-rasqal_rowsource_service.obj `if test -f 'rasqal_rowsource_service.c'; then $(CYGPATH_W) 'rasqal_rowsource_service.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_service.c'; fi` rasqal_rowsource_triples_test-rasqal_rowsource_triples.o: rasqal_rowsource_triples.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_triples_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_triples_test-rasqal_rowsource_triples.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Tpo -c -o rasqal_rowsource_triples_test-rasqal_rowsource_triples.o `test -f 'rasqal_rowsource_triples.c' || echo '$(srcdir)/'`rasqal_rowsource_triples.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Tpo $(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_triples.c' object='rasqal_rowsource_triples_test-rasqal_rowsource_triples.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) $(rasqal_rowsource_triples_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_triples_test-rasqal_rowsource_triples.o `test -f 'rasqal_rowsource_triples.c' || echo '$(srcdir)/'`rasqal_rowsource_triples.c rasqal_rowsource_triples_test-rasqal_rowsource_triples.obj: rasqal_rowsource_triples.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_triples_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_triples_test-rasqal_rowsource_triples.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Tpo -c -o rasqal_rowsource_triples_test-rasqal_rowsource_triples.obj `if test -f 'rasqal_rowsource_triples.c'; then $(CYGPATH_W) 'rasqal_rowsource_triples.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_triples.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Tpo $(DEPDIR)/rasqal_rowsource_triples_test-rasqal_rowsource_triples.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_triples.c' object='rasqal_rowsource_triples_test-rasqal_rowsource_triples.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) $(rasqal_rowsource_triples_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_triples_test-rasqal_rowsource_triples.obj `if test -f 'rasqal_rowsource_triples.c'; then $(CYGPATH_W) 'rasqal_rowsource_triples.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_triples.c'; fi` rasqal_rowsource_union_test-rasqal_rowsource_union.o: rasqal_rowsource_union.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_union_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_union_test-rasqal_rowsource_union.o -MD -MP -MF $(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Tpo -c -o rasqal_rowsource_union_test-rasqal_rowsource_union.o `test -f 'rasqal_rowsource_union.c' || echo '$(srcdir)/'`rasqal_rowsource_union.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Tpo $(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_union.c' object='rasqal_rowsource_union_test-rasqal_rowsource_union.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) $(rasqal_rowsource_union_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_union_test-rasqal_rowsource_union.o `test -f 'rasqal_rowsource_union.c' || echo '$(srcdir)/'`rasqal_rowsource_union.c rasqal_rowsource_union_test-rasqal_rowsource_union.obj: rasqal_rowsource_union.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_rowsource_union_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_rowsource_union_test-rasqal_rowsource_union.obj -MD -MP -MF $(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Tpo -c -o rasqal_rowsource_union_test-rasqal_rowsource_union.obj `if test -f 'rasqal_rowsource_union.c'; then $(CYGPATH_W) 'rasqal_rowsource_union.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_union.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Tpo $(DEPDIR)/rasqal_rowsource_union_test-rasqal_rowsource_union.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_rowsource_union.c' object='rasqal_rowsource_union_test-rasqal_rowsource_union.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) $(rasqal_rowsource_union_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_rowsource_union_test-rasqal_rowsource_union.obj `if test -f 'rasqal_rowsource_union.c'; then $(CYGPATH_W) 'rasqal_rowsource_union.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_rowsource_union.c'; fi` rasqal_variable_test-rasqal_variable.o: rasqal_variable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_variable_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_variable_test-rasqal_variable.o -MD -MP -MF $(DEPDIR)/rasqal_variable_test-rasqal_variable.Tpo -c -o rasqal_variable_test-rasqal_variable.o `test -f 'rasqal_variable.c' || echo '$(srcdir)/'`rasqal_variable.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_variable_test-rasqal_variable.Tpo $(DEPDIR)/rasqal_variable_test-rasqal_variable.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_variable.c' object='rasqal_variable_test-rasqal_variable.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) $(rasqal_variable_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_variable_test-rasqal_variable.o `test -f 'rasqal_variable.c' || echo '$(srcdir)/'`rasqal_variable.c rasqal_variable_test-rasqal_variable.obj: rasqal_variable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_variable_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_variable_test-rasqal_variable.obj -MD -MP -MF $(DEPDIR)/rasqal_variable_test-rasqal_variable.Tpo -c -o rasqal_variable_test-rasqal_variable.obj `if test -f 'rasqal_variable.c'; then $(CYGPATH_W) 'rasqal_variable.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_variable.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_variable_test-rasqal_variable.Tpo $(DEPDIR)/rasqal_variable_test-rasqal_variable.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_variable.c' object='rasqal_variable_test-rasqal_variable.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) $(rasqal_variable_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_variable_test-rasqal_variable.obj `if test -f 'rasqal_variable.c'; then $(CYGPATH_W) 'rasqal_variable.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_variable.c'; fi` rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.o: rasqal_xsd_datatypes.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_xsd_datatypes_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.o -MD -MP -MF $(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Tpo -c -o rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.o `test -f 'rasqal_xsd_datatypes.c' || echo '$(srcdir)/'`rasqal_xsd_datatypes.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Tpo $(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_xsd_datatypes.c' object='rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.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) $(rasqal_xsd_datatypes_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.o `test -f 'rasqal_xsd_datatypes.c' || echo '$(srcdir)/'`rasqal_xsd_datatypes.c rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.obj: rasqal_xsd_datatypes.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rasqal_xsd_datatypes_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.obj -MD -MP -MF $(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Tpo -c -o rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.obj `if test -f 'rasqal_xsd_datatypes.c'; then $(CYGPATH_W) 'rasqal_xsd_datatypes.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_xsd_datatypes.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Tpo $(DEPDIR)/rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rasqal_xsd_datatypes.c' object='rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.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) $(rasqal_xsd_datatypes_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rasqal_xsd_datatypes_test-rasqal_xsd_datatypes.obj `if test -f 'rasqal_xsd_datatypes.c'; then $(CYGPATH_W) 'rasqal_xsd_datatypes.c'; else $(CYGPATH_W) '$(srcdir)/rasqal_xsd_datatypes.c'; fi` sparql_lexer_test-sparql_lexer.o: sparql_lexer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparql_lexer_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sparql_lexer_test-sparql_lexer.o -MD -MP -MF $(DEPDIR)/sparql_lexer_test-sparql_lexer.Tpo -c -o sparql_lexer_test-sparql_lexer.o `test -f 'sparql_lexer.c' || echo '$(srcdir)/'`sparql_lexer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sparql_lexer_test-sparql_lexer.Tpo $(DEPDIR)/sparql_lexer_test-sparql_lexer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparql_lexer.c' object='sparql_lexer_test-sparql_lexer.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) $(sparql_lexer_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sparql_lexer_test-sparql_lexer.o `test -f 'sparql_lexer.c' || echo '$(srcdir)/'`sparql_lexer.c sparql_lexer_test-sparql_lexer.obj: sparql_lexer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparql_lexer_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sparql_lexer_test-sparql_lexer.obj -MD -MP -MF $(DEPDIR)/sparql_lexer_test-sparql_lexer.Tpo -c -o sparql_lexer_test-sparql_lexer.obj `if test -f 'sparql_lexer.c'; then $(CYGPATH_W) 'sparql_lexer.c'; else $(CYGPATH_W) '$(srcdir)/sparql_lexer.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sparql_lexer_test-sparql_lexer.Tpo $(DEPDIR)/sparql_lexer_test-sparql_lexer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparql_lexer.c' object='sparql_lexer_test-sparql_lexer.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) $(sparql_lexer_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sparql_lexer_test-sparql_lexer.obj `if test -f 'sparql_lexer.c'; then $(CYGPATH_W) 'sparql_lexer.c'; else $(CYGPATH_W) '$(srcdir)/sparql_lexer.c'; fi` sparql_parser_test-sparql_parser.o: sparql_parser.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparql_parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sparql_parser_test-sparql_parser.o -MD -MP -MF $(DEPDIR)/sparql_parser_test-sparql_parser.Tpo -c -o sparql_parser_test-sparql_parser.o `test -f 'sparql_parser.c' || echo '$(srcdir)/'`sparql_parser.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sparql_parser_test-sparql_parser.Tpo $(DEPDIR)/sparql_parser_test-sparql_parser.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparql_parser.c' object='sparql_parser_test-sparql_parser.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) $(sparql_parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sparql_parser_test-sparql_parser.o `test -f 'sparql_parser.c' || echo '$(srcdir)/'`sparql_parser.c sparql_parser_test-sparql_parser.obj: sparql_parser.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparql_parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sparql_parser_test-sparql_parser.obj -MD -MP -MF $(DEPDIR)/sparql_parser_test-sparql_parser.Tpo -c -o sparql_parser_test-sparql_parser.obj `if test -f 'sparql_parser.c'; then $(CYGPATH_W) 'sparql_parser.c'; else $(CYGPATH_W) '$(srcdir)/sparql_parser.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sparql_parser_test-sparql_parser.Tpo $(DEPDIR)/sparql_parser_test-sparql_parser.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparql_parser.c' object='sparql_parser_test-sparql_parser.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) $(sparql_parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sparql_parser_test-sparql_parser.obj `if test -f 'sparql_parser.c'; then $(CYGPATH_W) 'sparql_parser.c'; else $(CYGPATH_W) '$(srcdir)/sparql_parser.c'; fi` strcasecmp_test-strcasecmp.o: strcasecmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strcasecmp_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp_test-strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp_test-strcasecmp.Tpo -c -o strcasecmp_test-strcasecmp.o `test -f 'strcasecmp.c' || echo '$(srcdir)/'`strcasecmp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strcasecmp_test-strcasecmp.Tpo $(DEPDIR)/strcasecmp_test-strcasecmp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strcasecmp.c' object='strcasecmp_test-strcasecmp.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) $(strcasecmp_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp_test-strcasecmp.o `test -f 'strcasecmp.c' || echo '$(srcdir)/'`strcasecmp.c strcasecmp_test-strcasecmp.obj: strcasecmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strcasecmp_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp_test-strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp_test-strcasecmp.Tpo -c -o strcasecmp_test-strcasecmp.obj `if test -f 'strcasecmp.c'; then $(CYGPATH_W) 'strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/strcasecmp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strcasecmp_test-strcasecmp.Tpo $(DEPDIR)/strcasecmp_test-strcasecmp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strcasecmp.c' object='strcasecmp_test-strcasecmp.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) $(strcasecmp_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp_test-strcasecmp.obj `if test -f 'strcasecmp.c'; then $(CYGPATH_W) 'strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/strcasecmp.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-nodist_pkgincludeHEADERS: $(nodist_pkginclude_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-nodist_pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) rasqal_config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) rasqal_config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) rasqal_config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) rasqal_config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(HEADERS) \ rasqal_config.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-nodist_pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: installcheck-binSCRIPTS maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binSCRIPTS uninstall-libLTLIBRARIES \ uninstall-man uninstall-nodist_pkgincludeHEADERS uninstall-man: uninstall-man1 .MAKE: all check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool ctags \ distclean distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binSCRIPTS \ 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-libLTLIBRARIES \ install-man install-man1 install-nodist_pkgincludeHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am \ installcheck-binSCRIPTS installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binSCRIPTS \ uninstall-libLTLIBRARIES uninstall-man uninstall-man1 \ uninstall-nodist_pkgincludeHEADERS # rasqal_algebra.c is the first source file so this ensures # git-version.h is created before it and before the actual file # dependencies are calculated as a side-effect of compilation @MAINTAINER_MODE_TRUE@rasqal_algebra.c: git-version.h $(top_builddir)/libsv/libsv.la: cd $(top_builddir)/libsv && $(MAKE) libsv.la @RASQAL_MTWIST_TRUE@$(top_builddir)/libmtwist/libmtwist.la: @RASQAL_MTWIST_TRUE@ cd $(top_builddir)/libmtwist && $(MAKE) libmtwist.la @GETOPT_TRUE@$(top_builddir)/libgetopt/libgetopt.la: @GETOPT_TRUE@ cd $(top_builddir)/libgetopt && $(MAKE) libgetopt.la # Actually it needs sparql_parser.h but nevermind @MAINTAINER_MODE_TRUE@sparql_lexer.c: $(srcdir)/sparql_lexer.l sparql_parser.c $(srcdir)/../scripts/fix-flex.pl @MAINTAINER_MODE_TRUE@ $(AM_V_GEN) \ @MAINTAINER_MODE_TRUE@ $(LEX) -o$@ $(srcdir)/sparql_lexer.l; \ @MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/../scripts/fix-flex.pl $@ > sparql_lexer.t; \ @MAINTAINER_MODE_TRUE@ mv sparql_lexer.t $@ @MAINTAINER_MODE_TRUE@sparql_parser.c: $(srcdir)/sparql_parser.y $(srcdir)/../scripts/fix-bison.pl @MAINTAINER_MODE_TRUE@ $(AM_V_GEN) \ @MAINTAINER_MODE_TRUE@ $(BISON) $(srcdir)/sparql_parser.y; \ @MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/../scripts/fix-bison.pl sparql_parser.tab.c > $@; \ @MAINTAINER_MODE_TRUE@ mv sparql_parser.tab.h sparql_parser.h; \ @MAINTAINER_MODE_TRUE@ rm -f sparql_parser.tab.c @MAINTAINER_MODE_TRUE@sparql_parser.h: sparql_parser.c ; @exit 0 $(top_builddir)/../raptor/src/libraptor.la: cd $(top_builddir)/../raptor/src && $(MAKE) $(AM_MAKEFLAGS) libraptor.la @MAINTAINER_MODE_TRUE@git-version.h: check-version # Always run this in maintainer mode but do not always change git-version.h @MAINTAINER_MODE_TRUE@.PHONY: check-version @MAINTAINER_MODE_TRUE@check-version: @MAINTAINER_MODE_TRUE@ @file="git-version.h" ; \ @MAINTAINER_MODE_TRUE@ if test -d ../.git; then \ @MAINTAINER_MODE_TRUE@ git_version=`cd .. && git rev-parse HEAD`; \ @MAINTAINER_MODE_TRUE@ else \ @MAINTAINER_MODE_TRUE@ git_version="unknown"; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ $(RECHO) "GIT version $$git_version"; \ @MAINTAINER_MODE_TRUE@ tmp="$$file$$$$.tmp"; \ @MAINTAINER_MODE_TRUE@ $(RECHO) "#define GIT_VERSION \"$$git_version\"" > $$tmp; \ @MAINTAINER_MODE_TRUE@ if test -f $$file; then \ @MAINTAINER_MODE_TRUE@ if cmp $$file $$tmp >/dev/null 2>&1; then \ @MAINTAINER_MODE_TRUE@ rm $$tmp; \ @MAINTAINER_MODE_TRUE@ else \ @MAINTAINER_MODE_TRUE@ mv $$tmp $$file; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ else \ @MAINTAINER_MODE_TRUE@ mv $$tmp $$file; \ @MAINTAINER_MODE_TRUE@ fi # Run Clang static analyzer over sources. @MAINTAINER_MODE_TRUE@analyze: $(SOURCES) @MAINTAINER_MODE_TRUE@ @list='$(SOURCES)'; \ @MAINTAINER_MODE_TRUE@ result=0; \ @MAINTAINER_MODE_TRUE@ for file in $$list; do \ @MAINTAINER_MODE_TRUE@ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ @MAINTAINER_MODE_TRUE@ $(RECHO) "Analyzing $$file"; \ @MAINTAINER_MODE_TRUE@ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ @MAINTAINER_MODE_TRUE@ status=$$?; \ @MAINTAINER_MODE_TRUE@ if test $$status != 0; then \ @MAINTAINER_MODE_TRUE@ result=1; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ done; \ @MAINTAINER_MODE_TRUE@ set -e; exit $$result # 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: rasqal-0.9.33/src/rasqal_rowsource.c0000644000175000017500000006243412435675630014364 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource.c - Rasqal query rowsource (row generator) class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE static void rasqal_rowsource_print_header(rasqal_rowsource* rowsource, FILE* fh); /** * rasqal_new_rowsource_from_handler: * @query: query object * @user_data: pointer to context information to pass in to calls * @handler: pointer to handler methods * @vars_table: variables table to use for rows (or NULL) * @flags: 0 (none defined so far) * * Create a new rowsource over a user-defined handler. * * Return value: new #rasqal_rowsource object or NULL on failure **/ rasqal_rowsource* rasqal_new_rowsource_from_handler(rasqal_world* world, rasqal_query* query, void *user_data, const rasqal_rowsource_handler *handler, rasqal_variables_table* vars_table, int flags) { rasqal_rowsource* rowsource; if(!world || !handler) return NULL; if(handler->version < 1 || handler->version > 1) return NULL; rowsource = RASQAL_CALLOC(rasqal_rowsource*, 1, sizeof(*rowsource)); if(!rowsource) { if(handler->finish) handler->finish(NULL, user_data); return NULL; } rowsource->usage = 1; rowsource->world = world; rowsource->query = query; rowsource->user_data = (void*)user_data; rowsource->handler = handler; rowsource->flags = flags; rowsource->size = 0; rowsource->generate_group = 0; if(vars_table) rowsource->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); else rowsource->vars_table = NULL; rowsource->variables_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!rowsource->variables_sequence) { rasqal_free_rowsource(rowsource); return NULL; } if(rowsource->handler->init && rowsource->handler->init(rowsource, rowsource->user_data)) { RASQAL_DEBUG2("rowsource %s init failed\n", rowsource->handler->name); rasqal_free_rowsource(rowsource); return NULL; } return rowsource; } /** * rasqal_new_rowsource_from_rowsource: * @row: query result row * * INTERNAL - Copy a rowsource. * * Return value: a copy of the rowsource or NULL */ rasqal_rowsource* rasqal_new_rowsource_from_rowsource(rasqal_rowsource* rowsource) { if(!rowsource) return NULL; rowsource->usage++; return rowsource; } /** * rasqal_free_rowsource: * @rowsource: rowsource object * * INTERNAL - Destructor - destroy an rowsource. **/ void rasqal_free_rowsource(rasqal_rowsource *rowsource) { if(!rowsource) return; if(--rowsource->usage) return; if(rowsource->handler->finish) rowsource->handler->finish(rowsource, rowsource->user_data); if(rowsource->vars_table) rasqal_free_variables_table(rowsource->vars_table); if(rowsource->variables_sequence) raptor_free_sequence(rowsource->variables_sequence); if(rowsource->rows_sequence) raptor_free_sequence(rowsource->rows_sequence); RASQAL_FREE(rasqal_rowsource, rowsource); } /** * rasqal_rowsource_add_variable: * @rowsource: rasqal rowsource * @v: variable * * Add a variable to the rowsource if the variable is not already present * * Return value: variable offset or < 0 on failure **/ int rasqal_rowsource_add_variable(rasqal_rowsource *rowsource, rasqal_variable* v) { int offset; if(!rowsource || !v) return -1; offset = rasqal_rowsource_get_variable_offset_by_name(rowsource, v->name); if(offset >= 0) return offset; v = rasqal_new_variable_from_variable(v); if(raptor_sequence_push(rowsource->variables_sequence, v)) return -1; offset = rowsource->size; rowsource->size++; return offset; } /** * rasqal_rowsource_ensure_variables: * @rowsource: rasqal rowsource * * INTERNAL - Ensure that the variables in the rowsource are defined * * Return value: non-0 on failure */ int rasqal_rowsource_ensure_variables(rasqal_rowsource *rowsource) { int rc = 0; if(rowsource->updated_variables) return 0; rowsource->updated_variables++; if(rowsource->handler->ensure_variables) rc = rowsource->handler->ensure_variables(rowsource, rowsource->user_data); #ifdef RASQAL_DEBUG if(!rc) { RASQAL_DEBUG3("%s rowsource %p header: ", rowsource->handler->name, rowsource); rasqal_rowsource_print_header(rowsource, stderr); } #endif return rc; } /** * rasqal_rowsource_read_row: * @rowsource: rasqal rowsource * * Read a query result row from the rowsource. * * If a row is returned, it is owned by the caller. * * Return value: row or NULL when no more rows are available **/ rasqal_row* rasqal_rowsource_read_row(rasqal_rowsource *rowsource) { rasqal_row* row = NULL; if(!rowsource || rowsource->finished) return NULL; if(rowsource->flags & RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS) { /* return row from saved rows sequence at offset */ row = (rasqal_row*)raptor_sequence_get_at(rowsource->rows_sequence, rowsource->offset++); #ifdef RASQAL_DEBUG RASQAL_DEBUG3("%s rowsource %p returned saved row: ", rowsource->handler->name, rowsource); if(row) rasqal_row_print(row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif if(row) row = rasqal_new_row_from_row(row); /* row is owned by us */ } else { if(rasqal_rowsource_ensure_variables(rowsource)) return NULL; if(rowsource->handler->read_row) { row = rowsource->handler->read_row(rowsource, rowsource->user_data); /* row is owned by us */ if(row && rowsource->flags & RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS) { if(!rowsource->rows_sequence) { rowsource->rows_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); rowsource->offset = 0; } /* copy to save it away */ row = rasqal_new_row_from_row(row); raptor_sequence_push(rowsource->rows_sequence, row); } } else { if(!rowsource->rows_sequence) { raptor_sequence* seq; seq = rasqal_rowsource_read_all_rows(rowsource); if(rowsource->rows_sequence) raptor_free_sequence(rowsource->rows_sequence); /* rows_sequence now owns all rows */ rowsource->rows_sequence = seq; rowsource->offset = 0; } if(rowsource->rows_sequence) { /* return row from sequence at offset */ row = (rasqal_row*)raptor_sequence_get_at(rowsource->rows_sequence, rowsource->offset++); if(row) row = rasqal_new_row_from_row(row); /* row is owned by us */ } } } if(!row) { rowsource->finished = 1; if(rowsource->flags & RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS) rowsource->flags |= RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS; } else { rowsource->count++; /* Generate a group around all rows if there are no groups returned */ if(rowsource->generate_group && row->group_id < 0) row->group_id = 0; } #ifdef RASQAL_DEBUG RASQAL_DEBUG3("%s rowsource %p returned row: ", rowsource->handler->name, rowsource); if(row) rasqal_row_print(row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif return row; } /** * rasqal_rowsource_get_row_count: * @rowsource: rasqal rowsource * * Get number of rows seen from a rowsource. * * Return value: row count or < 0 on failure **/ int rasqal_rowsource_get_rows_count(rasqal_rowsource *rowsource) { if(!rowsource) return -1; return rowsource->count; } /** * rasqal_rowsource_read_all_rows: * @rowsource: rasqal rowsource * * Read all rows from a rowsource * * After calling this, the rowsource will be empty of rows and finished * and if a sequence is returned, it is owned by the caller. * * Return value: new sequence of all rows (may be size 0) or NULL on failure **/ raptor_sequence* rasqal_rowsource_read_all_rows(rasqal_rowsource *rowsource) { raptor_sequence* seq; if(!rowsource) return NULL; if(rowsource->flags & RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS) { raptor_sequence* new_seq; /* Return a complete copy of all previously saved rows */ seq = rowsource->rows_sequence; new_seq = rasqal_row_sequence_copy(seq); RASQAL_DEBUG4("%s rowsource %p returning a sequence of %d saved rows\n", rowsource->handler->name, rowsource, raptor_sequence_size(new_seq)); return new_seq; } /* Execute */ if(rasqal_rowsource_ensure_variables(rowsource)) return NULL; if(rowsource->handler->read_all_rows) { seq = rowsource->handler->read_all_rows(rowsource, rowsource->user_data); if(!seq) { seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); } else if(rowsource->generate_group) { int i; rasqal_row* row; /* Set group for all rows if there are no groups returned */ for(i = 0; (row = (rasqal_row*)raptor_sequence_get_at(seq, i)); i++) { /* if first row has a group ID, end */ if(!i && row->group_id >= 0) break; row->group_id = 0; } } goto done; } seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!seq) return NULL; while(1) { rasqal_row* row = rasqal_rowsource_read_row(rowsource); if(!row) break; /* Generate a group around all rows if there are no groups returned */ if(rowsource->generate_group && row->group_id < 0) row->group_id = 0; raptor_sequence_push(seq, row); } done: if(seq && rowsource->flags & RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS) { raptor_sequence* new_seq; /* Save a complete copy of all rows */ new_seq = rasqal_row_sequence_copy(seq); RASQAL_DEBUG4("%s rowsource %p saving a sequence of %d rows\n", rowsource->handler->name, rowsource, raptor_sequence_size(new_seq)); rowsource->rows_sequence = new_seq; rowsource->flags |= RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS; } RASQAL_DEBUG4("%s rowsource %p returning a sequence of %d rows\n", rowsource->handler->name, rowsource, raptor_sequence_size(seq)); return seq; } /** * rasqal_rowsource_get_size: * @rowsource: rasqal rowsource * * Get rowsource row width or <0 on failure **/ int rasqal_rowsource_get_size(rasqal_rowsource *rowsource) { if(!rowsource) return -1; rasqal_rowsource_ensure_variables(rowsource); return rowsource->size; } /** * rasqal_rowsource_get_variable_by_offset: * @rowsource: rasqal rowsource * @offset: integer offset into array of variables * * Get the variable associated with the given offset * * Return value: pointer to shared #rasqal_variable or NULL if out of range **/ rasqal_variable* rasqal_rowsource_get_variable_by_offset(rasqal_rowsource *rowsource, int offset) { if(!rowsource) return NULL; rasqal_rowsource_ensure_variables(rowsource); if(!rowsource->variables_sequence) return NULL; return (rasqal_variable*)raptor_sequence_get_at(rowsource->variables_sequence, offset); } /** * rasqal_rowsource_get_variable_offset_by_name: * @rowsource: rasqal rowsource * @name: variable name * * Get the offset of a variable into the list of variables * * Return value: offset or <0 if not present or on failure **/ int rasqal_rowsource_get_variable_offset_by_name(rasqal_rowsource *rowsource, const unsigned char* name) { int offset= -1; int i; if(!rowsource) return -1; rasqal_rowsource_ensure_variables(rowsource); if(!rowsource->variables_sequence) return -1; for(i=0; i < raptor_sequence_size(rowsource->variables_sequence); i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(rowsource->variables_sequence, i); if(!strcmp(RASQAL_GOOD_CAST(const char*, v->name), RASQAL_GOOD_CAST(const char*, name))) { offset = i; break; } } return offset; } /** * rasqal_rowsource_copy_variables: * @dest_rowsource: destination rowsource to copy into * @src_rowsource: source rowsource to copy from * * INTERNAL - Copy a variables projection from one rowsource to another * * This adds new variables from @src_rowsource to the * @dest_rowsource, it does not add duplicates. * * Return value: 0 on success, non-0 on failure **/ int rasqal_rowsource_copy_variables(rasqal_rowsource *dest_rowsource, rasqal_rowsource *src_rowsource) { int i; for(i = 0; i < src_rowsource->size; i++) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(src_rowsource, i); if(!v) { RASQAL_DEBUG5("%s src rowsource %p failed to return variable at offset %d, size %d\n", src_rowsource->handler->name, src_rowsource, i, src_rowsource->size); return 1; } if(rasqal_rowsource_add_variable(dest_rowsource, v) < 0) return 1; } return 0; } static void rasqal_rowsource_print_header(rasqal_rowsource* rowsource, FILE* fh) { int i; fputs("variables: ", fh); for(i = 0; i < rowsource->size; i++) { rasqal_variable* v; const unsigned char *name = NULL; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(v) name = v->name; if(i > 0) fputs(", ", fh); if(name) fputs(RASQAL_GOOD_CAST(const char*, name), fh); else fputs("NULL", fh); } fputs("\n", fh); } /** * rasqal_rowsource_print_row_sequence: * @rowsource: rowsource associated with rows * @seq: query result sequence of #rasqal_row * @fp: FILE* handle to print to * * INTERNAL - Print a result set header with row values from a sequence */ void rasqal_rowsource_print_row_sequence(rasqal_rowsource* rowsource, raptor_sequence* seq, FILE* fh) { int size = raptor_sequence_size(seq); int i; rasqal_rowsource_print_header(rowsource, fh); for(i = 0; i < size; i++) { rasqal_row *row = (rasqal_row*)raptor_sequence_get_at(seq, i); rasqal_row_print(row, fh); fputs("\n", fh); } } /** * rasqal_rowsource_reset: * @rowsource: rasqal rowsource * * INTERNAL - Reset a rowsource to regenerate the same set of rows * * Return value: query or NULL **/ int rasqal_rowsource_reset(rasqal_rowsource* rowsource) { rowsource->finished = 0; rowsource->count = 0; if(rowsource->handler->reset) return rowsource->handler->reset(rowsource, rowsource->user_data); if(rowsource->flags & RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS) { RASQAL_DEBUG3("%s rowsource %p resetting to use saved rows\n", rowsource->handler->name, rowsource); rowsource->offset = 0; } else { RASQAL_DEBUG3("WARNING: %s rowsource %p has no reset and there are no saved rows\n", rowsource->handler->name, rowsource); } return 0; } rasqal_rowsource* rasqal_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, int offset) { if(rowsource->handler->get_inner_rowsource) return rowsource->handler->get_inner_rowsource(rowsource, rowsource->user_data, offset); return NULL; } /** * rasqal_rowsource_visit: * @node: #rasqal_rowsource row source * @fn: pointer to function to apply that takes user data and rowsource parameters * @user_data: user data for applied function * * Visit a user function over a #rasqal_rowsource * * If the user function @fn returns 0, the visit is truncated. * * Return value: non-0 if the visit was truncated or on failure. **/ int rasqal_rowsource_visit(rasqal_rowsource* rowsource, rasqal_rowsource_visit_fn fn, void *user_data) { int result; int offset; rasqal_rowsource* inner_rs; if(!rowsource || !fn) return 1; result = fn(rowsource, user_data); /* end if failed */ if(result < 0) return result; /* Do not recurse if handled */ if(result > 0) return 0; for(offset = 0; (inner_rs = rasqal_rowsource_get_inner_rowsource(rowsource, offset)); offset++) { result = rasqal_rowsource_visit(inner_rs, fn, user_data); /* end if failed */ if(result < 0) return result; } return 0; } static int rasqal_rowsource_visitor_set_origin(rasqal_rowsource* rowsource, void *user_data) { rasqal_literal *literal = (rasqal_literal*)user_data; if(rowsource->handler->set_origin) return rowsource->handler->set_origin(rowsource, rowsource->user_data, literal); return 0; } int rasqal_rowsource_set_origin(rasqal_rowsource* rowsource, rasqal_literal *literal) { rasqal_rowsource_visit(rowsource, rasqal_rowsource_visitor_set_origin, literal); return 0; } static int rasqal_rowsource_visitor_set_requirements(rasqal_rowsource* rowsource, void *user_data) { unsigned int flags = *(unsigned int*)user_data; if(rowsource->handler->set_requirements) return rowsource->handler->set_requirements(rowsource, rowsource->user_data, flags); if(flags & RASQAL_ROWSOURCE_REQUIRE_RESET) { if(!rowsource->handler->reset) { /* If there is no reset handler, it is handled by this module and it is needed * it is handled by this module */ RASQAL_DEBUG3("setting %s rowsource %p to save rows\n", rowsource->handler->name, rowsource); rowsource->flags |= RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS; return 1; } } return 0; } int rasqal_rowsource_set_requirements(rasqal_rowsource* rowsource, unsigned int flags) { return rasqal_rowsource_visit(rowsource, rasqal_rowsource_visitor_set_requirements, &flags); } int rasqal_rowsource_request_grouping(rasqal_rowsource* rowsource) { rowsource->generate_group = 1; return 0; } #define SPACES_LENGTH 80 static const char spaces[SPACES_LENGTH+1] = " "; static void rasqal_rowsource_write_indent(raptor_iostream *iostr, unsigned int indent) { while(indent > 0) { unsigned int sp = (indent > SPACES_LENGTH) ? SPACES_LENGTH : indent; raptor_iostream_write_bytes(spaces, sizeof(char), RASQAL_GOOD_CAST(size_t, sp), iostr); indent -= sp; } } static int rasqal_rowsource_write_internal(rasqal_rowsource *rowsource, raptor_iostream* iostr, unsigned int indent) { const char* rs_name = rowsource->handler->name; int arg_count = 0; unsigned int indent_delta; int offset; rasqal_rowsource* inner_rowsource; indent_delta = RASQAL_GOOD_CAST(unsigned int, strlen(rs_name)); raptor_iostream_counted_string_write(rs_name, indent_delta, iostr); raptor_iostream_counted_string_write("(\n", 2, iostr); indent_delta++; indent += indent_delta; rasqal_rowsource_write_indent(iostr, indent); for(offset = 0; (inner_rowsource = rasqal_rowsource_get_inner_rowsource(rowsource, offset)); offset++) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_rowsource_write_indent(iostr, indent); } rasqal_rowsource_write_internal(inner_rowsource, iostr, indent); arg_count++; } raptor_iostream_write_byte('\n', iostr); indent-= indent_delta; rasqal_rowsource_write_indent(iostr, indent); raptor_iostream_write_byte(')', iostr); return 0; } int rasqal_rowsource_write(rasqal_rowsource *rowsource, raptor_iostream *iostr) { return rasqal_rowsource_write_internal(rowsource, iostr, 0); } /** * rasqal_rowsource_print: * @rs: the #rasqal_rowsource object * @fh: the FILE* handle to print to * * Print a #rasqal_rowsource in a debug format. * * The print debug format may change in any release. * **/ void rasqal_rowsource_print(rasqal_rowsource *rowsource, FILE* fh) { raptor_iostream *iostr; if(!rowsource || !fh) return; iostr = raptor_new_iostream_to_file_handle(rowsource->world->raptor_world_ptr, fh); rasqal_rowsource_write(rowsource, iostr); raptor_free_iostream(iostr); } /* * rasqal_rowsource_remove_all_variables: * @rowsource: rasqal rowsource * * INTERNAL - Remove all variables from a rowsource */ void rasqal_rowsource_remove_all_variables(rasqal_rowsource *rowsource) { while(1) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_pop(rowsource->variables_sequence); if(!v) break; rasqal_free_variable(v); } rowsource->size = 0; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); #define IN_FILENAME "in.bin" #define OUT_BYTES_COUNT 14 int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); #define TEST_ITEMS_COUNT 9 int i; for(i = 0; i < 4; i++) { rasqal_rowsource *rowsource; int count; /* for _from_file */ FILE *handle = NULL; /* for _from_string */ void *string; size_t string_len; switch(i) { case 0: #ifdef RASQAL_DEBUG fprintf(stderr, "%s: Creating rowsource from a filename '%s'\n", program, OUT_FILENAME); #endif rowsource = rasqal_new_rowsource_from_filename(RASQAL_GOOD_CAST(const char*, IN_FILENAME)); if(!rowsource) { fprintf(stderr, "%s: Failed to create rowsource to filename '%s'\n", program, OUT_FILENAME); exit(1); } break; case 1: #ifdef RASQAL_DEBUG fprintf(stderr, "%s: Creating rowsource from file handle\n", program); #endif handle = fopen(RASQAL_GOOD_CAST(const char*, OUT_FILENAME), "wb"); rowsource = rasqal_new_rowsource_from_file_handle(handle); if(!rowsource) { fprintf(stderr, "%s: Failed to create rowsource from a file handle\n", program); exit(1); } break; case 2: #ifdef RASQAL_DEBUG fprintf(stderr, "%s: Creating rowsource from a string\n", program); #endif rowsource = rasqal_new_rowsource_from_string(&string, &string_len, NULL); if(!rowsource) { fprintf(stderr, "%s: Failed to create rowsource from a string\n", program); exit(1); } break; case 3: #ifdef RASQAL_DEBUG fprintf(stderr, "%s: Creating rowsource from a sink\n", program); #endif rowsource = rasqal_new_rowsource_from_sink(); if(!rowsource) { fprintf(stderr, "%s: Failed to create rowsource from a sink\n", program); exit(1); } break; default: fprintf(stderr, "%s: Unknown test case %d init\n", program, i); exit(1); } count = rasqal_rowsource_get_rows_count(rowsource); if(count != OUT_BYTES_COUNT) { fprintf(stderr, "%s: I/O stream wrote %d bytes, expected %d\n", program, count, RASQAL_GOOD_CAST(int, OUT_BYTES_COUNT)); return 1; } #ifdef RASQAL_DEBUG fprintf(stderr, "%s: Freeing rowsource\n", program); #endif rasqal_free_rowsource(rowsource); switch(i) { case 0: remove(OUT_FILENAME); break; case 1: fclose(handle); remove(OUT_FILENAME); break; case 2: if(!string) { fprintf(stderr, "%s: I/O stream failed to create a string\n", program); return 1; } if(string_len != count) { fprintf(stderr, "%s: I/O stream created a string length %d, expected %d\n", program, RASQAL_BAD_CAST(int, string_len), count); return 1; } rasqal_free_memory(string); break; case 3: break; default: fprintf(stderr, "%s: Unknown test case %d tidy\n", program, i); exit(1); } } /* keep gcc -Wall happy */ return(0); } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_rowsource_join.c0000644000175000017500000005274112434455625015402 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_join.c - Rasqal join rowsource class * * Copyright (C) 2008-2012, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE typedef enum { JS_START, JS_INIT_RIGHT, JS_READ_RIGHT, JS_FINISHED } rasqal_join_state; typedef struct { rasqal_rowsource* left; rasqal_rowsource* right; /* current left row */ rasqal_row *left_row; /* array to map right variables into output rows */ int* right_map; /* 0 = reading from left rs, 1 = reading from right rs, 2 = finished */ rasqal_join_state state; int failed; /* row offset for read_row() */ int offset; /* row join type */ rasqal_join_type join_type; /* join expression */ rasqal_expression *expr; /* map for checking compatibility of rows */ rasqal_row_compatible* rc_map; /* number of right rows joined per-left */ int right_rows_joined_count; /* join expression constant boolean value or < 0 if not valid */ int constant_join_condition; } rasqal_join_rowsource_context; static int rasqal_join_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_join_rowsource_context* con; rasqal_variables_table* vars_table; con = (rasqal_join_rowsource_context*)user_data; con->failed = 0; con->state = JS_START; con->constant_join_condition = -1; /* If join condition is a constant - optimize it away */ if(con->expr && rasqal_expression_is_constant(con->expr)) { rasqal_query *query = rowsource->query; rasqal_literal* result; int bresult; int error = 0; result = rasqal_expression_evaluate2(con->expr, query->eval_context, &error); #ifdef RASQAL_DEBUG RASQAL_DEBUG1("join expression condition is constant: "); if(error) fputs("type error", DEBUG_FH); else rasqal_literal_print(result, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(error) { bresult = 0; } else { error = 0; bresult = rasqal_literal_as_boolean(result, &error); #ifdef RASQAL_DEBUG if(error) RASQAL_DEBUG1("join boolean expression returned error\n"); else RASQAL_DEBUG2("join boolean expression result: %d\n", bresult); #endif rasqal_free_literal(result); } /* free expression always */ rasqal_free_expression(con->expr); con->expr = NULL; if(con->join_type == RASQAL_JOIN_TYPE_NATURAL) { if(!bresult) { /* Constraint is always false so row source is finished */ con->state = JS_FINISHED; } /* otherwise always true so no need to evaluate on each row * and deleting con->expr will handle that */ } con->constant_join_condition = bresult; } rasqal_rowsource_set_requirements(con->left, RASQAL_ROWSOURCE_REQUIRE_RESET); rasqal_rowsource_set_requirements(con->right, RASQAL_ROWSOURCE_REQUIRE_RESET); vars_table = con->left->vars_table; con->rc_map = rasqal_new_row_compatible(vars_table, con->left, con->right); if(!con->rc_map) return -1; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("rowsource %p ", rowsource); rasqal_print_row_compatible(stderr, con->rc_map); #endif return 0; } static int rasqal_join_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_join_rowsource_context* con; con = (rasqal_join_rowsource_context*)user_data; if(con->left_row) rasqal_free_row(con->left_row); if(con->left) rasqal_free_rowsource(con->left); if(con->right) rasqal_free_rowsource(con->right); if(con->right_map) RASQAL_FREE(int, con->right_map); if(con->expr) rasqal_free_expression(con->expr); if(con->rc_map) rasqal_free_row_compatible(con->rc_map); RASQAL_FREE(rasqal_join_rowsource_context, con); return 0; } static int rasqal_join_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_join_rowsource_context* con; int map_size; int i; con = (rasqal_join_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->left)) return 1; if(rasqal_rowsource_ensure_variables(con->right)) return 1; map_size = rasqal_rowsource_get_size(con->right); con->right_map = RASQAL_MALLOC(int*, RASQAL_GOOD_CAST(size_t, sizeof(int) * RASQAL_GOOD_CAST(size_t, map_size))); if(!con->right_map) return 1; rowsource->size = 0; /* copy in variables from left rowsource */ if(rasqal_rowsource_copy_variables(rowsource, con->left)) return 1; /* add any new variables not already seen from right rowsource */ for(i = 0; i < map_size; i++) { rasqal_variable* v; int offset; v = rasqal_rowsource_get_variable_by_offset(con->right, i); if(!v) break; offset = rasqal_rowsource_add_variable(rowsource, v); if(offset < 0) return 1; con->right_map[i] = offset; } return 0; } static rasqal_row* rasqal_join_rowsource_build_merged_row(rasqal_rowsource* rowsource, rasqal_join_rowsource_context* con, rasqal_row *right_row) { rasqal_row *row; int i; row = rasqal_new_row_for_size(rowsource->world, rowsource->size); if(!row) { if(right_row) rasqal_free_row(right_row); return NULL; } rasqal_row_set_rowsource(row, rowsource); row->offset = con->offset; #ifdef RASQAL_DEBUG RASQAL_DEBUG1("merge\n left row : "); rasqal_row_print(con->left_row, stderr); fputs("\n right row : ", stderr); if(right_row) rasqal_row_print(right_row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif for(i = 0; i < con->left_row->size; i++) { rasqal_literal *l = con->left_row->values[i]; row->values[i] = rasqal_new_literal_from_literal(l); } if(right_row) { for(i = 0; i < right_row->size; i++) { rasqal_literal *l = right_row->values[i]; int dest_i = con->right_map[i]; if(!row->values[dest_i]) row->values[dest_i] = rasqal_new_literal_from_literal(l); } rasqal_free_row(right_row); } #ifdef RASQAL_DEBUG fputs(" result row : ", stderr); if(row) rasqal_row_print(row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif return row; } static rasqal_row* rasqal_join_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_join_rowsource_context* con; rasqal_row* row = NULL; rasqal_query *query = rowsource->query; con = (rasqal_join_rowsource_context*)user_data; if(con->failed || con->state == JS_FINISHED) return NULL; while(1) { rasqal_row *right_row; int bresult = 1; int compatible = 1; if(con->state == JS_START) { /* start / re-start left */ if(con->left_row) rasqal_free_row(con->left_row); con->left_row = rasqal_rowsource_read_row(con->left); #ifdef RASQAL_DEBUG RASQAL_DEBUG2("rowsource %p read left row : ", rowsource); if(con->left_row) rasqal_row_print(con->left_row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif con->state = JS_INIT_RIGHT; } if(con->state == JS_INIT_RIGHT) { /* start right */ if(!con->left_row) { con->state = JS_FINISHED; return NULL; } con->right_rows_joined_count = 0; rasqal_rowsource_reset(con->right); } right_row = rasqal_rowsource_read_row(con->right); #ifdef RASQAL_DEBUG RASQAL_DEBUG2("rowsource %p read right row : ", rowsource); if(right_row) rasqal_row_print(right_row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif if(!right_row && con->state == JS_READ_RIGHT) { /* right has finished */ /* restart left */ con->state = JS_START; /* if all right table returned no bindings, return left row */ if(!con->right_rows_joined_count) { /* otherwise return LEFT or RIGHT row only */ if(con->join_type == RASQAL_JOIN_TYPE_LEFT) { /* LEFT JOIN - add left row if expr fails or not compatible */ if(con->left_row) { con->right_rows_joined_count++; row = rasqal_join_rowsource_build_merged_row(rowsource, con, NULL); break; } } } /* restart left by continuing the loop */ continue; } /* state is always JS_READ_RIGHT at this point */ con->state = JS_READ_RIGHT; /* now may have both left and right rows so compute compatibility */ if(right_row) { compatible = rasqal_row_compatible_check(con->rc_map, con->left_row, right_row); RASQAL_DEBUG2("join rows compatible: %s\n", compatible ? "YES" : "NO"); } if(con->constant_join_condition >= 0) { /* Get constant join expression value */ bresult = con->constant_join_condition; } else if(con->expr) { /* Check join expression if present */ rasqal_literal *result; int error = 0; result = rasqal_expression_evaluate2(con->expr, query->eval_context, &error); #ifdef RASQAL_DEBUG RASQAL_DEBUG1("join expression result: "); if(error) fputs("type error", DEBUG_FH); else rasqal_literal_print(result, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(error) { bresult = 0; } else { error = 0; bresult = rasqal_literal_as_boolean(result, &error); #ifdef RASQAL_DEBUG if(error) RASQAL_DEBUG1("filter boolean expression returned error\n"); else RASQAL_DEBUG2("filter boolean expression result: %d\n", bresult); #endif rasqal_free_literal(result); } } if(con->join_type == RASQAL_JOIN_TYPE_NATURAL) { /* found a row if compatible and constraint matches */ if(compatible && bresult && right_row) { con->right_rows_joined_count++; /* consumes right_row */ row = rasqal_join_rowsource_build_merged_row(rowsource, con, right_row); break; } } else if(con->join_type == RASQAL_JOIN_TYPE_LEFT) { /* * { merge(mu1, mu2) | mu1 in Omega1 and mu2 in Omega2, and mu1 * and mu2 are compatible and expr(merge(mu1, mu2)) is true } */ if(compatible && bresult) { con->right_rows_joined_count++; /* No constraint OR constraint & compatible so return merged row */ /* Compute row only now it is known to be needed (consumes right_row) */ row = rasqal_join_rowsource_build_merged_row(rowsource, con, right_row); break; } #if 0 /* * { mu1 | mu1 in Omega1 and mu2 in Omega2, and mu1 and mu2 are * not compatible } */ if(!compatible) { /* otherwise return LEFT or RIGHT row only */ if(con->join_type == RASQAL_JOIN_TYPE_LEFT) { /* LEFT JOIN - add left row if expr fails or not compatible */ if(con->left_row) { con->right_rows_joined_count++; row = rasqal_join_rowsource_build_merged_row(rowsource, con, NULL); if(right_row) rasqal_free_row(right_row); break; } } } #endif /* * { mu1 | mu1 in Omega1 and mu2 in Omega2, and mu1 and mu2 are * compatible and for all mu2, expr(merge(mu1, mu2)) is false } */ /* The above is handled using check for * !con->right_rows_joined_count earlier, to generate a row * once. */ } /* end if LEFT JOIN */ if(right_row) rasqal_free_row(right_row); } /* end while */ if(row) { rasqal_row_set_rowsource(row, rowsource); row->offset = con->offset++; rasqal_row_bind_variables(row, rowsource->query->vars_table); } return row; } static int rasqal_join_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_join_rowsource_context* con; int rc; con = (rasqal_join_rowsource_context*)user_data; con->state = JS_START; con->failed = 0; rc = rasqal_rowsource_reset(con->left); if(rc) return rc; return rasqal_rowsource_reset(con->right); } static rasqal_rowsource* rasqal_join_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_join_rowsource_context *con; con = (rasqal_join_rowsource_context*)user_data; if(offset == 0) return con->left; else if(offset == 1) return con->right; else return NULL; } static const rasqal_rowsource_handler rasqal_join_rowsource_handler = { /* .version = */ 1, "join", /* .init = */ rasqal_join_rowsource_init, /* .finish = */ rasqal_join_rowsource_finish, /* .ensure_variables = */ rasqal_join_rowsource_ensure_variables, /* .read_row = */ rasqal_join_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_join_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_join_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_join_rowsource: * @world: world object * @query: query object * @left: input left (first) rowsource * @right: input right (second) rowsource * @join_type: join type * @expr: join expression to filter result rows * * INTERNAL - create a new JOIN over two rowsources * * This uses the number of variables in @vt to set the rowsource size * (order size is always 0) and then checks that all the rows in the * sequence are the same. If not, construction fails and NULL is * returned. * * The @left and @right rowsources become owned by the rowsource. * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_join_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* left, rasqal_rowsource* right, rasqal_join_type join_type, rasqal_expression *expr) { rasqal_join_rowsource_context* con; int flags = 0; if(!world || !query || !left || !right) goto fail; /* only left outer join and cross join supported */ if(join_type != RASQAL_JOIN_TYPE_LEFT && join_type != RASQAL_JOIN_TYPE_NATURAL) goto fail; con = RASQAL_CALLOC(rasqal_join_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->left = left; con->right = right; con->join_type = join_type; con->expr = rasqal_new_expression_from_expression(expr); return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_join_rowsource_handler, query->vars_table, flags); fail: if(left) rasqal_free_rowsource(left); if(right) rasqal_free_rowsource(right); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); const char* const join_1_data_2x3_rows[] = { /* 2 variable names and 3 rows */ "a", NULL, "b", NULL, /* row 1 data */ "foo", NULL, "red", NULL, /* row 2 data */ "baz", NULL, "blue", NULL, /* row 3 data */ "bob", NULL, "green", NULL, /* end of data */ NULL, NULL, NULL, NULL }; /* join on b */ const char* const join_2_data_3x2_rows[] = { /* 3 variable names and 4 rows */ "b", NULL, "c", NULL, "d", NULL, /* row 1 data */ "red", NULL, "orange", NULL, "yellow", NULL, /* row 2 data */ "blue", NULL, "indigo", NULL, "violet", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL }; typedef struct { rasqal_join_type join_type; int expected; } join_test_config_type; #define JOIN_TESTS_COUNT 2 const join_test_config_type join_test_config[JOIN_TESTS_COUNT] = { { RASQAL_JOIN_TYPE_NATURAL, 2 }, { RASQAL_JOIN_TYPE_LEFT, 3 }, }; /* there is one variable 'b' that is joined on */ #define EXPECTED_COLUMNS_COUNT (2 + 3 - 1) const char* const join_result_vars[] = { "a" , "b" , "c", "d" }; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_rowsource *left_rs = NULL; rasqal_rowsource *right_rs = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; int count; raptor_sequence* seq = NULL; int failures = 0; rasqal_variables_table* vt; int size; int expected_size = EXPECTED_COLUMNS_COUNT; int i; raptor_sequence* vars_seq = NULL; int test_count; world = rasqal_new_world(); rasqal_world_open(world); query = rasqal_new_query(world, "sparql", NULL); vt = query->vars_table; for(test_count = 0; test_count < JOIN_TESTS_COUNT; test_count++) { rasqal_join_type join_type = join_test_config[test_count].join_type; int expected_count = join_test_config[test_count].expected; int vars_count; fprintf(stderr, "%s: test #%d join type %d\n", program, test_count, RASQAL_GOOD_CAST(int, join_type)); /* 2 variables and 3 rows */ vars_count = 2; seq = rasqal_new_row_sequence(world, vt, join_1_data_2x3_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create left sequence of %d vars\n", program, vars_count); failures++; goto tidy; } left_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!left_rs) { fprintf(stderr, "%s: failed to create left rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by left_rs */ vars_seq = seq = NULL; /* 3 variables and 2 rows */ vars_count = 3; seq = rasqal_new_row_sequence(world, vt, join_2_data_3x2_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create right sequence of %d rows\n", program, vars_count); failures++; goto tidy; } right_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!right_rs) { fprintf(stderr, "%s: failed to create right rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by right_rs */ vars_seq = seq = NULL; rowsource = rasqal_new_join_rowsource(world, query, left_rs, right_rs, join_type, NULL); if(!rowsource) { fprintf(stderr, "%s: failed to create join rowsource\n", program); failures++; goto tidy; } /* left_rs and right_rs are now owned by rowsource */ left_rs = right_rs = NULL; seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: read_rows returned a NULL seq for a join rowsource\n", program); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != expected_count) { fprintf(stderr, "%s: read_rows returned %d rows for a join rowsource, expected %d\n", program, count, expected_count); failures++; goto tidy; } size = rasqal_rowsource_get_size(rowsource); if(size != expected_size) { fprintf(stderr, "%s: read_rows returned %d columns (variables) for a join rowsource, expected %d\n", program, size, expected_size); failures++; goto tidy; } for(i = 0; i < expected_size; i++) { rasqal_variable* v; const char* name = NULL; const char *expected_name = join_result_vars[i]; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(!v) { fprintf(stderr, "%s: read_rows had NULL column (variable) #%d expected %s\n", program, i, expected_name); failures++; goto tidy; } name = RASQAL_GOOD_CAST(const char*, v->name); if(strcmp(name, expected_name)) { fprintf(stderr, "%s: read_rows returned column (variable) #%d %s but expected %s\n", program, i, name, expected_name); failures++; goto tidy; } } #ifdef RASQAL_DEBUG rasqal_rowsource_print_row_sequence(rowsource, seq, DEBUG_FH); #endif raptor_free_sequence(seq); seq = NULL; rasqal_free_rowsource(rowsource); rowsource = NULL; /* end test_count loop */ } tidy: if(seq) raptor_free_sequence(seq); if(left_rs) rasqal_free_rowsource(left_rs); if(right_rs) rasqal_free_rowsource(right_rs); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_results_compare.c0000644000175000017500000004411312435141254015523 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_results_compare.c - Rasqal Class for comparing Query Results * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE /** * rasqal_results_compare: * @vt: variables table * @defined_in_map: of size @variables_count * @first_count: number of variables in first query result * @second_count: number of variables in second query result * @variables_count: number of variables in @vt and @defined_in_map * @variables_in_both_count: number of shared variables in both query results * * Lookup data constructed for comparing two query results to enable * quick mapping between values. * */ struct rasqal_results_compare_s { rasqal_world* world; rasqal_query_results* first_qr; const char* first_qr_label; rasqal_query_results* second_qr; const char* second_qr_label; void* log_user_data; raptor_log_handler log_handler; raptor_log_message message; rasqal_variables_table* vt; int* defined_in_map; unsigned int first_count; unsigned int second_count; unsigned int variables_count; unsigned int variables_in_both_count; }; rasqal_results_compare* rasqal_new_results_compare(rasqal_world* world, rasqal_query_results *first_qr, const char* first_qr_label, rasqal_query_results *second_qr, const char* second_qr_label) { rasqal_results_compare* rrc = NULL; rasqal_variables_table* first_vt; rasqal_variables_table* second_vt; unsigned int i; unsigned int size; first_vt = rasqal_query_results_get_variables_table(first_qr); second_vt = rasqal_query_results_get_variables_table(second_qr); rrc = RASQAL_CALLOC(rasqal_results_compare*, 1, sizeof(*rrc)); if(!rrc) return NULL; rrc->world = world; rrc->first_qr = first_qr; rrc->first_qr_label = first_qr_label; rrc->second_qr = second_qr; rrc->second_qr_label = second_qr_label; rrc->message.code = -1; rrc->message.domain = RAPTOR_DOMAIN_NONE; rrc->message.level = RAPTOR_LOG_LEVEL_NONE; rrc->message.locator = NULL; rrc->message.text = NULL; rrc->first_count = RASQAL_GOOD_CAST(unsigned int, rasqal_variables_table_get_total_variables_count(first_vt)); rrc->second_count = RASQAL_GOOD_CAST(unsigned int, rasqal_variables_table_get_total_variables_count(second_vt)); rrc->variables_count = 0; size = (rrc->first_count + rrc->second_count) << 1; rrc->defined_in_map = RASQAL_CALLOC(int*, size, sizeof(int)); if(!rrc->defined_in_map) { RASQAL_FREE(rasqal_results_compare, rrc); return NULL; } for(i = 0; i < size; i++) rrc->defined_in_map[i] = -1; rrc->vt = rasqal_new_variables_table(world); if(!rrc->vt) { RASQAL_FREE(int*, rrc->defined_in_map); RASQAL_FREE(rasqal_results_compare, rrc); return NULL; } first_vt = rasqal_query_results_get_variables_table(first_qr); for(i = 0; i < rrc->first_count; i++) { rasqal_variable *v; rasqal_variable *v2; v = rasqal_variables_table_get(first_vt, RASQAL_GOOD_CAST(int, i)); v2 = rasqal_variables_table_add2(rrc->vt, v->type, v->name, 0, NULL); rrc->defined_in_map[(v2->offset)<<1] = RASQAL_GOOD_CAST(int, i); rasqal_free_variable(v2); } second_vt = rasqal_query_results_get_variables_table(second_qr); for(i = 0; i < rrc->second_count; i++) { rasqal_variable *v; rasqal_variable *v2; int free_v2 = 0; v = rasqal_variables_table_get(second_vt, RASQAL_GOOD_CAST(int, i)); v2 = rasqal_variables_table_get_by_name(rrc->vt, v->type, v->name); if(!v2) { free_v2 = 1; v2 = rasqal_variables_table_add2(rrc->vt, v->type, v->name, 0, NULL); } rrc->defined_in_map[1 + ((v2->offset)<<1)] = RASQAL_GOOD_CAST(int, i); if(free_v2) rasqal_free_variable(v2); } rrc->variables_count = RASQAL_GOOD_CAST(unsigned int, rasqal_variables_table_get_total_variables_count(rrc->vt)); for(i = 0; i < rrc->variables_count; i++) { if(rrc->defined_in_map[(i<<1)] >= 0 && rrc->defined_in_map[1 + (i<<1)] >= 0) rrc->variables_in_both_count++; } return rrc; } void rasqal_free_results_compare(rasqal_results_compare* rrc) { if(!rrc) return; if(rrc->defined_in_map) RASQAL_FREE(rasqal_variable**, rrc->defined_in_map); if(rrc->vt) rasqal_free_variables_table(rrc->vt); RASQAL_FREE(rasqal_results_compare, rrc); } /** * rasqal_results_compare_set_log_handler: * @rrc: results compare object * @log_user_data: log handler user data * @log_handler: log handler * * Set query results comparer log handler * */ void rasqal_results_compare_set_log_handler(rasqal_results_compare* rrc, void* log_user_data, raptor_log_handler log_handler) { rrc->log_user_data = log_user_data; rrc->log_handler = log_handler; } /** * rasqal_results_compare_variables_equal: * @rrc: results compare object * * Test if two results have the same sets of variables * * Return value: non-0 if the results have the same sets of variables */ int rasqal_results_compare_variables_equal(rasqal_results_compare* rrc) { unsigned int i; unsigned int count = rrc->variables_count; /* If no variables in common, not equal */ if(!rrc->variables_in_both_count) return 0; /* If variables count are different, not equal */ if(rrc->first_count != rrc->second_count) return 0; for(i = 0; i < count; i++) { /* If any variable is not in both, not equal */ if(rrc->defined_in_map[i<<1] < 0 || rrc->defined_in_map[1 + (i<<1)] < 0 ) return 0; } return 1; } /** * rasqal_results_compare_get_variable_by_offset: * @map: results comparible * @idx: variable index * * Get variable by index * * Return value: pointer to shared #rasqal_variable or NULL if out of range */ rasqal_variable* rasqal_results_compare_get_variable_by_offset(rasqal_results_compare* rrc, int idx) { return rasqal_variables_table_get(rrc->vt, idx); } /** * rasqal_results_compare_get_variable_offset_for_result: * @map: results comparible * @var_idx: variable index * @qr_index: results index 0 (first) or 1 (second) * * Get variable index in a query results by variable index * * Return value: index into query result list of variables or <0 if @var_idx or @qr_index is out of range */ int rasqal_results_compare_get_variable_offset_for_result(rasqal_results_compare* rrc, int var_idx, int qr_index) { if(qr_index < 0 || qr_index > 1) return -1; if(!rasqal_results_compare_get_variable_by_offset(rrc, var_idx)) return -1; return rrc->defined_in_map[qr_index + (var_idx << 1)]; } void rasqal_print_results_compare(FILE *handle, rasqal_results_compare* rrc) { unsigned int count = rrc->variables_count; rasqal_variables_table* vt = rrc->vt; unsigned int i; char first_qr[4]; char second_qr[4]; fprintf(handle, "Results variable compare map: total variables: %u shared variables: %u\n", count, rrc->variables_in_both_count); for(i = 0; i < count; i++) { rasqal_variable *v = rasqal_variables_table_get(vt, RASQAL_GOOD_CAST(int, i)); int offset1 = rrc->defined_in_map[i<<1]; int offset2 = rrc->defined_in_map[1 + (i<<1)]; if(offset1 < 0) *first_qr = '\0'; else sprintf(first_qr, "%2d", offset1); if(offset2 < 0) *second_qr = '\0'; else sprintf(second_qr, "%2d", offset2); fprintf(handle, " Variable %10s offsets first: %-3s second: %-3s %s\n", v->name, first_qr, second_qr, ((offset1 >= 0 && offset2 >= 0) ? "SHARED" : "")); } } /** * rasqal_results_compare_compare: * @cqr: query results object * * Run a query results comparison * * Return value: non-0 if equal */ int rasqal_results_compare_compare(rasqal_results_compare* rrc) { int differences = 0; int rowi; int size1; int size2; int row_differences_count = 0; size1 = rasqal_query_results_get_bindings_count(rrc->first_qr); size2 = rasqal_query_results_get_bindings_count(rrc->second_qr); if(size1 != size2) { rrc->message.level = RAPTOR_LOG_LEVEL_ERROR; rrc->message.text = "Results have different numbers of bindings"; if(rrc->log_handler) rrc->log_handler(rrc->log_user_data, &rrc->message); differences++; goto done; } if(size1 > 0) { /* If there are variables; check they match */ if(!rrc->variables_in_both_count) { rrc->message.level = RAPTOR_LOG_LEVEL_ERROR; rrc->message.text = "Results have no common variables"; if(rrc->log_handler) rrc->log_handler(rrc->log_user_data, &rrc->message); differences++; goto done; } if(!rasqal_results_compare_variables_equal(rrc)) { rrc->message.level = RAPTOR_LOG_LEVEL_ERROR; rrc->message.text = "Results have different sets of variables"; if(rrc->log_handler) rrc->log_handler(rrc->log_user_data, &rrc->message); differences++; goto done; } } /* set results to be stored? */ /* sort rows by something ? As long as the sort is the same it * probably does not matter what the method is. */ /* what to do about blank nodes? */ /* for each row */ for(rowi = 0; 1; rowi++) { unsigned int bindingi; rasqal_row* row1 = rasqal_query_results_get_row_by_offset(rrc->first_qr, rowi); rasqal_row* row2 = rasqal_query_results_get_row_by_offset(rrc->second_qr, rowi); int this_row_different = 0; if(!row1 && !row2) break; /* for each variable (already know they are the same set) */ for(bindingi = 0; bindingi < rrc->variables_count; bindingi++) { rasqal_variable* v; const unsigned char* name; int ix1; int ix2; rasqal_literal *value1; rasqal_literal *value2; int error = 0; v = rasqal_results_compare_get_variable_by_offset(rrc, RASQAL_GOOD_CAST(int, bindingi)); name = v->name; ix1 = rasqal_results_compare_get_variable_offset_for_result(rrc, RASQAL_GOOD_CAST(int, bindingi), 0); ix2 = rasqal_results_compare_get_variable_offset_for_result(rrc, RASQAL_GOOD_CAST(int, bindingi), 1); value1 = rasqal_query_results_get_binding_value(rrc->first_qr, ix1); value2 = rasqal_query_results_get_binding_value(rrc->second_qr, ix2); /* Blank nodes always match each other */ if(value1 && value1->type == RASQAL_LITERAL_BLANK && value2 && value2->type == RASQAL_LITERAL_BLANK) continue; /* should have compare as native flag? * RASQAL_COMPARE_XQUERY doesn't compare all values */ if(!rasqal_literal_equals_flags(value1, value2, RASQAL_COMPARE_XQUERY, &error)) { /* if different report it */ raptor_world* raptor_world_ptr; void *string; size_t length; raptor_iostream* string_iostr; raptor_world_ptr = rasqal_world_get_raptor(rrc->world); string_iostr = raptor_new_iostream_to_string(raptor_world_ptr, &string, &length, (raptor_data_malloc_handler)malloc); raptor_iostream_counted_string_write("Difference in row ", 18, string_iostr); raptor_iostream_decimal_write(rowi + 1, string_iostr); raptor_iostream_counted_string_write(" binding '", 10, string_iostr); raptor_iostream_string_write(name, string_iostr); raptor_iostream_counted_string_write("' ", 2, string_iostr); raptor_iostream_string_write(rrc->first_qr_label, string_iostr); raptor_iostream_counted_string_write(" value ", 7, string_iostr); rasqal_literal_write(value1, string_iostr); raptor_iostream_write_byte(' ', string_iostr); raptor_iostream_string_write(rrc->second_qr_label, string_iostr); raptor_iostream_counted_string_write(" value ", 7, string_iostr); rasqal_literal_write(value2, string_iostr); raptor_iostream_write_byte(' ', string_iostr); /* this allocates and copies result into 'string' */ raptor_free_iostream(string_iostr); rrc->message.level = RAPTOR_LOG_LEVEL_ERROR; rrc->message.text = (const char*)string; if(rrc->log_handler) rrc->log_handler(rrc->log_user_data, &rrc->message); free(string); differences++; this_row_different = 1; } } /* end for each var */ if(row1) rasqal_free_row(row1); if(row2) rasqal_free_row(row2); if(this_row_different) row_differences_count++; rasqal_query_results_next(rrc->first_qr); rasqal_query_results_next(rrc->second_qr); } /* end for each row */ if(row_differences_count) { rrc->message.level = RAPTOR_LOG_LEVEL_ERROR; rrc->message.text = "Results have different values"; if(rrc->log_handler) rrc->log_handler(rrc->log_user_data, &rrc->message); } done: return (differences == 0); } #endif /* not STANDALONE */ #ifdef STANDALONE /* some more prototypes */ int main(int argc, char *argv[]); #define NTESTS 2 const struct { const char* first_qr_string; const char* second_qr_string; int expected_vars_count; int expected_rows_count; int expected_equality; } expected_data[NTESTS] = { { "a\tb\tc\td\te\tf\n\"a\"\t\"b\"\t\"c\"\t\"d\"\t\"e\"\t\"f\"\n", "a\tb\tc\td\te\tf\n\"a\"\t\"b\"\t\"c\"\t\"d\"\t\"e\"\t\"f\"\n", 6, 1, 1 }, { "a\tb\tc\td\te\tf\n\"a\"\t\"b\"\t\"c\"\t\"d\"\t\"e\"\t\"f\"\n", "d\tf\tc\ta\te\tb\n\"d\"\t\"f\"\t\"c\"\t\"a\"\t\"e\"\t\"b\"\n", 6, 1, 1 } }; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 static void print_bindings_results_simple(rasqal_query_results *results, FILE* output) { while(!rasqal_query_results_finished(results)) { int i; fputs("row: [", output); for(i = 0; i < rasqal_query_results_get_bindings_count(results); i++) { const unsigned char *name; rasqal_literal *value; name = rasqal_query_results_get_binding_name(results, i); value = rasqal_query_results_get_binding_value(results, i); if(i > 0) fputs(", ", output); fprintf(output, "%s=", name); rasqal_literal_print(value, output); } fputs("]\n", output); rasqal_query_results_next(results); } } #endif int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_world* world = NULL; raptor_world* raptor_world_ptr; int failures = 0; int i; rasqal_query_results_type type = RASQAL_QUERY_RESULTS_BINDINGS; world = rasqal_new_world(); rasqal_world_open(world); raptor_world_ptr = rasqal_world_get_raptor(world); for(i = 0; i < NTESTS; i++) { raptor_uri* base_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://example.org/"); rasqal_query_results *first_qr; rasqal_query_results *second_qr = NULL; int expected_equality = expected_data[i].expected_equality; rasqal_results_compare* rrc; int equal; first_qr = rasqal_new_query_results_from_string(world, type, base_uri, expected_data[i].first_qr_string, 0); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("First query result from string"); print_bindings_results_simple(first_qr, stderr); rasqal_query_results_rewind(first_qr); #endif second_qr = rasqal_new_query_results_from_string(world, type, base_uri, expected_data[i].second_qr_string, 0); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Second query result from string"); print_bindings_results_simple(second_qr, stderr); rasqal_query_results_rewind(second_qr); #endif raptor_free_uri(base_uri); rrc = rasqal_new_results_compare(world, first_qr, "first", second_qr, "second"); if(!rrc) { fprintf(stderr, "%s: failed to create results compatible\n", program); failures++; } else { rasqal_print_results_compare(stderr, rrc); equal = rasqal_results_compare_variables_equal(rrc); RASQAL_DEBUG4("%s: equal results test %d returned %d\n", program, i, equal); if(equal != expected_equality) { fprintf(stderr, "%s: FAILED equal results test %d returned %d expected %d\n", program, i, equal, expected_equality); failures++; } } if(first_qr) rasqal_free_query_results(first_qr); if(second_qr) rasqal_free_query_results(second_qr); if(rrc) rasqal_free_results_compare(rrc); } if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_rowsource_sort.c0000644000175000017500000001617312327014627015423 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_source.c - Rasqal source rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { /* inner rowsource to sort */ rasqal_rowsource *rowsource; /* sequence of order conditions #rasqal_expression (SHARED with query) */ raptor_sequence* order_seq; /* number of order conditions in order_seq */ int order_size; /* distinct flag */ int distinct; /* map for sorting */ rasqal_map* map; /* sequence of rows (owned here) */ raptor_sequence* seq; } rasqal_sort_rowsource_context; static int rasqal_sort_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_query *query = rowsource->query; rasqal_sort_rowsource_context *con; con = (rasqal_sort_rowsource_context*)user_data; if(con->order_seq) con->order_size = raptor_sequence_size(con->order_seq); else { RASQAL_DEBUG1("No order conditions for sort rowsource - passing through"); con->order_size = -1; } con->map = NULL; if(con->order_size > 0 ) { /* make a row:NULL map in order to sort or do distinct * FIXME: should DISTINCT be separate? */ con->map = rasqal_engine_new_rowsort_map(con->distinct, query->compare_flags, con->order_seq); if(!con->map) return 1; } con->seq = NULL; return 0; } static int rasqal_sort_rowsource_process(rasqal_rowsource* rowsource, rasqal_sort_rowsource_context* con) { int offset = 0; /* already processed */ if(con->seq) return 0; con->seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!con->seq) return 1; while(1) { rasqal_row* row; row = rasqal_rowsource_read_row(con->rowsource); if(!row) break; if(rasqal_row_set_order_size(row, con->order_size)) { rasqal_free_row(row); return 1; } rasqal_engine_rowsort_calculate_order_values(rowsource->query, con->order_seq, row); row->offset = offset; /* after this, row is owned by map */ if(!rasqal_engine_rowsort_map_add_row(con->map, row)) offset++; } #ifdef RASQAL_DEBUG fputs("resulting ", DEBUG_FH); rasqal_map_print(con->map, DEBUG_FH); fputs("\n", DEBUG_FH); #endif /* do sort/distinct: walk map in order, adding rows to sequence */ rasqal_engine_rowsort_map_to_sequence(con->map, con->seq); rasqal_free_map(con->map); con->map = NULL; return 0; } static int rasqal_sort_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_sort_rowsource_context* con; con = (rasqal_sort_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; rasqal_rowsource_copy_variables(rowsource, con->rowsource); return 0; } static int rasqal_sort_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_sort_rowsource_context *con; con = (rasqal_sort_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->map) rasqal_free_map(con->map); if(con->seq) raptor_free_sequence(con->seq); RASQAL_FREE(rasqal_sort_rowsource_context, con); return 0; } static raptor_sequence* rasqal_sort_rowsource_read_all_rows(rasqal_rowsource* rowsource, void *user_data) { rasqal_sort_rowsource_context *con; raptor_sequence *seq = NULL; con = (rasqal_sort_rowsource_context*)user_data; /* if there were no ordering conditions, pass it all on to inner rowsource */ if(con->order_size <= 0) return rasqal_rowsource_read_all_rows(con->rowsource); /* need to sort */ if(rasqal_sort_rowsource_process(rowsource, con)) return NULL; if(con->seq) { /* pass ownership of seq back to caller */ seq = con->seq; con->seq = NULL; } return seq; } static rasqal_rowsource* rasqal_sort_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_sort_rowsource_context *con; con = (rasqal_sort_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_sort_rowsource_handler = { /* .version = */ 1, "sort", /* .init = */ rasqal_sort_rowsource_init, /* .finish = */ rasqal_sort_rowsource_finish, /* .ensure_variables = */ rasqal_sort_rowsource_ensure_variables, /* .read_row = */ NULL, /* .read_all_rows = */ rasqal_sort_rowsource_read_all_rows, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_sort_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_sort_rowsource: * @world: query world * @query: query results object * @rowsource: input rowsource * @order_seq: order sequence (shared, may be NULL) * @distinct: distinct flag * * INTERNAL - create a SORT over rows from input rowsource * * The @rowsource becomes owned by the new rowsource. * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_sort_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource *rowsource, raptor_sequence* order_seq, int distinct) { rasqal_sort_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource) goto fail; con = RASQAL_CALLOC(rasqal_sort_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; con->order_seq = order_seq; con->distinct = distinct; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_sort_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); return NULL; } rasqal-0.9.33/src/rasqal_map.c0000644000175000017500000002020112434455625013072 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_map.c - Rasqal simple Key:Value Map with duplicates allowed * * Copyright (C) 2005-2010, David Beckett http://www.dajobe.org/ * Copyright (C) 2005-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" struct rasqal_map_node_s { struct rasqal_map_s* map; struct rasqal_map_node_s* prev; struct rasqal_map_node_s* next; void* key; void* value; }; struct rasqal_map_s { struct rasqal_map_node_s* root; rasqal_compare_fn* compare; void *compare_user_data; raptor_data_free_handler free_compare_data; raptor_data_free_handler free_key; raptor_data_free_handler free_value; raptor_data_print_handler print_key; raptor_data_print_handler print_value; int allow_duplicates; }; typedef struct rasqal_map_node_s rasqal_map_node; static rasqal_map_node* rasqal_new_map_node(rasqal_map* map, void *key, void *value) { rasqal_map_node *node; node = RASQAL_CALLOC(rasqal_map_node*, 1, sizeof(*node)); if(!node) return NULL; node->map = map; node->key = key; node->value = value; return node; } static void rasqal_free_map_node(rasqal_map* map, rasqal_map_node *node) { if(!node) return; if(node->prev) rasqal_free_map_node(map, node->prev); if(node->next) rasqal_free_map_node(map, node->next); if(map->free_key) map->free_key(node->key); if(map->free_value) map->free_value(node->value); RASQAL_FREE(rasqal_map_node, node); } /** * rasqal_new_map: * @compare_fn: comparison function for keys * @compare_user_data: user data pointer for @compare_fn * @free_compare_data_fn: function to free @compare_user_data once done * @free_fn: free function for (key, value) pair * @print_key_fn: print a key function (or NULL) * @print_value_fn: print a value function (or NULL) * @flags: non-0 to allow duplicates * * Constructor - Create a (key:value) map. * * Return value: a new #rasqal_map or NULL on failure **/ rasqal_map* rasqal_new_map(rasqal_compare_fn* compare_fn, void *compare_user_data, raptor_data_free_handler free_compare_data_fn, raptor_data_free_handler free_key_fn, raptor_data_free_handler free_value_fn, raptor_data_print_handler print_key_fn, raptor_data_print_handler print_value_fn, int flags) { rasqal_map *map; map = RASQAL_CALLOC(rasqal_map*, 1, sizeof(*map)); if(!map) { if(free_compare_data_fn) free_compare_data_fn(compare_user_data); return NULL; } map->compare = compare_fn; map->compare_user_data = compare_user_data; map->free_compare_data = free_compare_data_fn; map->free_key = free_key_fn; map->free_value = free_value_fn; map->print_key = print_key_fn; map->print_value = print_value_fn; map->allow_duplicates = flags; return map; } /** * rasqal_free_map: * @map: the #rasqal_map to free * * Destructor - Destroy a (key:value) map. * **/ void rasqal_free_map(rasqal_map *map) { if(!map) return; if(map->root) rasqal_free_map_node(map, map->root); if(map->free_compare_data) map->free_compare_data(map->compare_user_data); RASQAL_FREE(rasqal_map, map); } static int rasqal_map_node_add_kv(rasqal_map_node* node, void *key, void *value) { rasqal_map *map = node->map; int result; result = map->compare(map->compare_user_data, key, node->key); if(result < 0) { if(node->prev) return rasqal_map_node_add_kv(node->prev, key, value); node->prev = rasqal_new_map_node(map, key, value); return node->prev ? 0 : -1; } else if(!result) { if(!node->map->allow_duplicates) { /* duplicate and not allowed */ return 1; } /* duplicate, fall through */ } /* result > 0 */ if(node->next) return rasqal_map_node_add_kv(node->next, key, value); node->next = rasqal_new_map_node(map, key, value); return node->next ? 0 : -1; } static rasqal_map_node* rasqal_map_search_internal(rasqal_map* map, rasqal_map_node* node, const void* key) { if(node) { int cmp = map->compare(map->compare_user_data, key, node->key); if(cmp > 0) return rasqal_map_search_internal(map, node->next, key); else if(cmp < 0) return rasqal_map_search_internal(map, node->prev, key); /* found */ return node; } /* otherwise not found */ return NULL; } void* rasqal_map_search(rasqal_map* map, const void* key) { rasqal_map_node* node; node = rasqal_map_search_internal(map, map->root, key); return node ? node->value : NULL; } /** * rasqal_map_add_kv: * @map: #rasqal_map adding to * @key: key data * @value: value data (or NULL) * * Add a (key, value) pair to the map. * * Return value: non-0 on failure including adding a duplicate. **/ int rasqal_map_add_kv(rasqal_map* map, void* key, void *value) { if(!map->root) { map->root = rasqal_new_map_node(map, key, value); return map->root ? 0 : -1; } return rasqal_map_node_add_kv(map->root, key, value); } #define SPACES_LENGTH 80 static const char rasqal_map_node_spaces[SPACES_LENGTH+1]=" "; static void rasqal_map_node_write_indent(FILE *fh, int indent) { while(indent > 0) { int sp = (indent > SPACES_LENGTH) ? SPACES_LENGTH : indent; (void)fwrite(rasqal_map_node_spaces, sizeof(char), RASQAL_GOOD_CAST(size_t, sp), fh); indent -= sp; } } static void rasqal_map_node_visit(rasqal_map_node* node, rasqal_map_visit_fn fn, void *user_data) { if(node->prev) rasqal_map_node_visit(node->prev, fn, user_data); fn(node->key, node->value, user_data); if(node->next) rasqal_map_node_visit(node->next, fn, user_data); } /** * rasqal_map_visit: * @map: the #rasqal_map to visit * @fn: user function to call with key, value and @user_data * @user_data: user data to pass to visit function * * Walk all entries in a (key:value) map. * **/ void rasqal_map_visit(rasqal_map* map, rasqal_map_visit_fn fn, void *user_data) { if(map->root) rasqal_map_node_visit(map->root, fn, user_data); } struct print_info { rasqal_map* map; FILE *fh; int indent; }; static void rasqal_map_node_print_visit(void *key, void *value, void *user_data) { struct print_info* pi=(struct print_info*)user_data; FILE* fh; int indent; fh = pi->fh; indent = pi->indent; rasqal_map_node_write_indent(fh, indent); fputs("{key: ", fh); if(!key) fputs("NULL", fh); else if(pi->map->print_key) pi->map->print_key(key, fh); else fprintf(fh, "%p", key); fputs(", value: ", fh); if(!value) fputs("NULL", fh); else if(pi->map->print_value) pi->map->print_value(value, fh); else fprintf(fh, "%p", value); fputs("}\n", fh); } /** * rasqal_map_print: * @map: #rasqal_map to print * @fh: FILE handle to write to. * * Print a (key:value) map in a debug format. * * Return value: non-0 on failure **/ int rasqal_map_print(rasqal_map* map, FILE* fh) { fprintf(fh, "map duplicates=%s {\n", map->allow_duplicates ? "yes" : "no"); if(map->root) { struct print_info pi; pi.map = map; pi.fh = fh; pi.indent = 2; rasqal_map_visit(map, rasqal_map_node_print_visit, &pi); } fputs("}\n", fh); return 0; } rasqal-0.9.33/src/rasqal_config.h.in0000644000175000017500000001574612434455646014221 00000000000000/* src/rasqal_config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Flex version as a decimal */ #undef FLEX_VERSION_DECIMAL /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_GCRYPT_H /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_GMP_H /* Have gmp_version constant */ #undef HAVE_GMP_VERSION /* Define to 1 if you have the `gmtime_r' function. */ #undef HAVE_GMTIME_R /* Define to 1 if you have the `initstate' function. */ #undef HAVE_INITSTATE /* Define to 1 if you have the `initstate_r' function. */ #undef HAVE_INITSTATE_R /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_SCHEMASINTERNALS_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_XMLSCHEMASTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_XMLSCHEMAS_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_MHASH_H /* Define to 1 if you have the header file. */ #undef HAVE_MPFR_H /* Define to 1 if you have the `rand' function. */ #undef HAVE_RAND /* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM /* Define to 1 if you have the `random_r' function. */ #undef HAVE_RANDOM_R /* Define to 1 if you have the `rand_r' function. */ #undef HAVE_RAND_R /* Define to 1 if you have the header file. */ #undef HAVE_REGEX_H /* have PCRE regex - Perl Compatible Regular Expressions */ #undef HAVE_REGEX_PCRE /* have POSIX regex library */ #undef HAVE_REGEX_POSIX /* Define to 1 if you have the `srand' function. */ #undef HAVE_SRAND /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `stricmp' function. */ #undef HAVE_STRICMP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the `timegm' function. */ #undef HAVE_TIMEGM /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* struct tm has tm_gmtoff field */ #undef HAVE_TM_GMTOFF /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_UUID_UUID_H /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Is __FUNCTION__ available */ #undef HAVE___FUNCTION__ /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* need 'extern int optind' declaration? */ #undef NEED_OPTIND_DECLARATION /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Use GMP gmp_randseed_ui() and mpz_urandomm() */ #undef RANDOM_ALGO_GMP_RAND /* Use internal Mersenne Twister */ #undef RANDOM_ALGO_MTWIST /* Use POSIX srand() and rand() */ #undef RANDOM_ALGO_RAND /* Use BSD initstate() and random() */ #undef RANDOM_ALGO_RANDOM /* Use glibc initstate_r() and random_r() */ #undef RANDOM_ALGO_RANDOM_R /* Use POSIX rand_r() */ #undef RANDOM_ALGO_RAND_R /* Decimal from GNU MP library */ #undef RASQAL_DECIMAL_GMP /* Decimal from MPFR library */ #undef RASQAL_DECIMAL_MPFR /* Decimal without a library */ #undef RASQAL_DECIMAL_NONE /* Use gcrypt library for message digests */ #undef RASQAL_DIGEST_GCRYPT /* Use internal routines for message digests */ #undef RASQAL_DIGEST_INTERNAL /* Use mhash library for message digests */ #undef RASQAL_DIGEST_MHASH /* Use no message digest library */ #undef RASQAL_DIGEST_NONE /* Building LAQRS query */ #undef RASQAL_QUERY_LAQRS /* Building SPARQL query */ #undef RASQAL_QUERY_SPARQL /* Use no regex library */ #undef RASQAL_REGEX_NONE /* Use PCRE regex library */ #undef RASQAL_REGEX_PCRE /* Use POSIX regex library */ #undef RASQAL_REGEX_POSIX /* Use internal routines for UUID */ #undef RASQAL_UUID_INTERNAL /* Use UUID in libc library for UUID */ #undef RASQAL_UUID_LIBC /* Use libuuid library for UUID */ #undef RASQAL_UUID_LIBUUID /* Use no UUID library */ #undef RASQAL_UUID_NONE /* Use OSSP library for UUID */ #undef RASQAL_UUID_OSSP /* Release version as a decimal */ #undef RASQAL_VERSION_DECIMAL /* Major version number */ #undef RASQAL_VERSION_MAJOR /* Minor version number */ #undef RASQAL_VERSION_MINOR /* Release version number */ #undef RASQAL_VERSION_RELEASE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define to empty if `const' does not conform to ANSI C. */ #undef const rasqal-0.9.33/src/rasqal_raptor.c0000644000175000017500000006227312434455625013643 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_raptor.c - Rasqal triple store implementation with raptor * * Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" struct rasqal_raptor_triple_s { struct rasqal_raptor_triple_s *next; rasqal_triple *triple; }; typedef struct rasqal_raptor_triple_s rasqal_raptor_triple; typedef struct { rasqal_world* world; rasqal_raptor_triple *head; rasqal_raptor_triple *tail; /* index used while reading triples into the two arrays below. * This is used to connect a triple to the URI literal of the source */ int source_index; /* size of the two arrays below */ int sources_count; /* shared pointers into query->data_graph uris */ raptor_uri* source_uri; /* array of URI literals (allocated here) */ rasqal_literal **source_literals; /* genid base for mapping user bnodes */ unsigned char* mapped_id_base; /* length of above string */ size_t mapped_id_base_len; } rasqal_raptor_triples_source_user_data; /* prototypes */ static int rasqal_raptor_init_triples_match(rasqal_triples_match* rtm, rasqal_triples_source *rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t); static int rasqal_raptor_triple_present(rasqal_triples_source *rts, void *user_data, rasqal_triple *t); static void rasqal_raptor_free_triples_source(void *user_data); rasqal_triple* raptor_statement_as_rasqal_triple(rasqal_world* world, const raptor_statement *statement) { rasqal_literal *s, *p, *o; s = rasqal_new_literal_from_term(world, statement->subject); p = rasqal_new_literal_from_term(world, statement->predicate); o = rasqal_new_literal_from_term(world, statement->object); return rasqal_new_triple(s, p, o); } static void rasqal_raptor_statement_handler(void *user_data, raptor_statement *statement) { rasqal_raptor_triples_source_user_data* rtsc; rasqal_raptor_triple *triple; rtsc = (rasqal_raptor_triples_source_user_data*)user_data; triple = RASQAL_MALLOC(rasqal_raptor_triple*, sizeof(rasqal_raptor_triple)); triple->next = NULL; triple->triple = raptor_statement_as_rasqal_triple(rtsc->world, statement); /* this origin URI literal is shared amongst the triples and * freed only in rasqal_raptor_free_triples_source */ rasqal_triple_set_origin(triple->triple, rtsc->source_literals[rtsc->source_index]); if(rtsc->tail) rtsc->tail->next = triple; else rtsc->head = triple; rtsc->tail = triple; } static unsigned char* rasqal_raptor_get_genid(rasqal_world* world, const unsigned char* base, int counter) { int tmpcounter; size_t length; unsigned char *buffer; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); /* This is read-only and thread safe */ if(counter < 0) counter= world->genid_counter++; length = strlen(RASQAL_GOOD_CAST(const char*, base)) + 2; /* base + (int) + "\0" */ tmpcounter = counter; while(tmpcounter /= 10) length++; buffer = RASQAL_MALLOC(unsigned char*, length); if(!buffer) return NULL; sprintf(RASQAL_GOOD_CAST(char*, buffer), "%s%d", base, counter); return buffer; } static unsigned char* rasqal_raptor_generate_id_handler(void *user_data, unsigned char *user_bnodeid) { rasqal_raptor_triples_source_user_data* rtsc; rtsc = (rasqal_raptor_triples_source_user_data*)user_data; if(user_bnodeid) { unsigned char *mapped_id; size_t user_bnodeid_len = strlen(RASQAL_GOOD_CAST(const char*, user_bnodeid)); mapped_id = RASQAL_MALLOC(unsigned char*, rtsc->mapped_id_base_len + 1 + user_bnodeid_len + 1); memcpy(mapped_id, rtsc->mapped_id_base, rtsc->mapped_id_base_len); mapped_id[rtsc->mapped_id_base_len] = '_'; memcpy(mapped_id + rtsc->mapped_id_base_len + 1, user_bnodeid, user_bnodeid_len + 1); raptor_free_memory(user_bnodeid); return mapped_id; } return rasqal_raptor_get_genid(rtsc->world, RASQAL_GOOD_CAST(const unsigned char*, "genid"), -1); } static int rasqal_raptor_support_feature(void *user_data, rasqal_triples_source_feature feature) { switch(feature) { case RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH: return 1; default: case RASQAL_TRIPLES_SOURCE_FEATURE_NONE: return 0; } } static int rasqal_raptor_init_triples_source_common(rasqal_world* world, raptor_sequence* data_graphs, rasqal_query* rdf_query, void *factory_user_data, void *user_data, rasqal_triples_source *rts, rasqal_triples_error_handler handler1, rasqal_triples_error_handler2 handler2, unsigned int flags) { rasqal_raptor_triples_source_user_data* rtsc; raptor_parser *parser; int i; int rc = 0; rtsc = (rasqal_raptor_triples_source_user_data*)user_data; /* Max API version this triples source generates */ rts->version = 2; rts->init_triples_match = rasqal_raptor_init_triples_match; rts->triple_present = rasqal_raptor_triple_present; rts->free_triples_source = rasqal_raptor_free_triples_source; rts->support_feature = rasqal_raptor_support_feature; rtsc->world = world; if(data_graphs) rtsc->sources_count = raptor_sequence_size(data_graphs); else /* No data graph - assume there is just a background graph */ rtsc->sources_count = 0; if(rtsc->sources_count) { rtsc->source_literals = RASQAL_CALLOC(rasqal_literal**, RASQAL_GOOD_CAST(size_t, rtsc->sources_count), sizeof(rasqal_literal*)); if(!rtsc->source_literals) return 1; } else { /* No sources so the work is done */ return 0; } for(i = 0; i < rtsc->sources_count; i++) { rasqal_data_graph *dg; raptor_uri* uri = NULL; raptor_uri* name_uri; int free_name_uri = 0; const char* parser_name; raptor_iostream* iostr = NULL; dg = (rasqal_data_graph*)raptor_sequence_get_at(data_graphs, i); uri = dg->uri; name_uri = dg->name_uri; iostr = dg->iostr; rtsc->source_index = i; if(uri) rtsc->source_uri = raptor_uri_copy(uri); if(name_uri) rtsc->source_literals[i] = rasqal_new_uri_literal(world, raptor_uri_copy(name_uri) ); else if(uri) { name_uri = raptor_uri_copy(uri); free_name_uri = 1; } rtsc->mapped_id_base = rasqal_raptor_get_genid(world, RASQAL_GOOD_CAST(const unsigned char*, "graphid"), i); rtsc->mapped_id_base_len = strlen(RASQAL_GOOD_CAST(const char*, rtsc->mapped_id_base)); parser_name = dg->format_name; if(parser_name) { if(!raptor_world_is_parser_name(world->raptor_world_ptr, parser_name)) { if(rdf_query) handler1(rdf_query, /* locator */ NULL, "Invalid data graph parser name ignored"); else handler2(world, /* locator */ NULL, "Invalid data graph parser name ignored"); parser_name = NULL; } } if(!parser_name) parser_name = "guess"; parser = raptor_new_parser(world->raptor_world_ptr, parser_name); raptor_parser_set_statement_handler(parser, rtsc, rasqal_raptor_statement_handler); raptor_world_set_generate_bnodeid_handler(world->raptor_world_ptr, rtsc, rasqal_raptor_generate_id_handler); #ifdef RAPTOR_FEATURE_NO_NET if(flags & 1) raptor_set_feature(parser, RAPTOR_FEATURE_NO_NET, rdf_query->features[RASQAL_FEATURE_NO_NET]); #endif if(iostr) { rc = raptor_parser_parse_iostream(parser, iostr, dg->base_uri); } else { rc = raptor_parser_parse_uri(parser, uri, name_uri); } raptor_free_parser(parser); raptor_free_uri(rtsc->source_uri); if(free_name_uri) raptor_free_uri(name_uri); /* Reset raptor genid handler to default */ /* FIXME: this should be per-parser not raptor-wide */ raptor_world_set_generate_bnodeid_handler(world->raptor_world_ptr, NULL, NULL); /* This is freed in rasqal_raptor_free_triples_source() */ /* rasqal_free_literal(rtsc->source_literal); */ RASQAL_FREE(char*, rtsc->mapped_id_base); if(rc) break; } return rc; } static int rasqal_raptor_init_triples_source2(rasqal_world* world, raptor_sequence* data_graphs, void *factory_user_data, void *user_data, rasqal_triples_source *rts, rasqal_triples_error_handler2 handler, unsigned int flags) { return rasqal_raptor_init_triples_source_common(world, data_graphs, NULL /* rdf_query */, factory_user_data, user_data, rts, NULL /* handler 1 */, handler, flags); } static int rasqal_raptor_init_triples_source(rasqal_query* rdf_query, void *factory_user_data, void *user_data, rasqal_triples_source *rts, rasqal_triples_error_handler handler) { unsigned int flags = 0; if(rdf_query->features[RASQAL_FEATURE_NO_NET]) flags |= 1; return rasqal_raptor_init_triples_source_common(rdf_query->world, rdf_query->data_graphs, rdf_query, factory_user_data, user_data, rts, handler, NULL /* handler 2 */, flags); } static int rasqal_raptor_new_triples_source(rasqal_query* rdf_query, void *factory_user_data, void *user_data, rasqal_triples_source *rts) { return rasqal_raptor_init_triples_source_common(rdf_query->world, rdf_query->data_graphs, NULL, factory_user_data, user_data, rts, NULL /* handler 1 */, rasqal_triples_source_error_handler2, 0); } /** * rasqal_raptor_triple_match: * @world: rasqal_world object * @triple: #rasqal_triple to match against * @match: #rasqal_triple with wildcards * @parts: parts of the triple to match - XOR of #rasqal_triple_parts bits * . * * Match a rasqal_triple against a rasqal_triple with NULL * signifying wildcard fields in the rasqal_triple. * * Return value: non-0 on match **/ int rasqal_raptor_triple_match(rasqal_world* world, rasqal_triple *triple, rasqal_triple *match, unsigned int parts) { int rc = 0; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("\ntriple "); rasqal_triple_print(triple, stderr); fputs("\nmatch ", stderr); rasqal_triple_print(match, stderr); fputs("\n", stderr); #endif if(match->subject && (parts & RASQAL_TRIPLE_SUBJECT)) { if(!rasqal_literal_equals_flags(triple->subject, match->subject, RASQAL_COMPARE_RDF, NULL)) goto done; } if(match->predicate && (parts & RASQAL_TRIPLE_PREDICATE)) { if(!rasqal_literal_equals_flags(triple->predicate, match->predicate, RASQAL_COMPARE_RDF, NULL)) goto done; } if(match->object && (parts & RASQAL_TRIPLE_OBJECT)) { if(!rasqal_literal_equals_flags(triple->object, match->object, RASQAL_COMPARE_RDF, NULL)) goto done; } if(parts & RASQAL_TRIPLE_ORIGIN) { /* Binding a graph */ /* If expecting a graph and triple has none then no match */ if(!triple->origin) goto done; if(match->origin) { if(match->origin->type == RASQAL_LITERAL_URI ) { raptor_uri* triple_uri = triple->origin->value.uri; raptor_uri* match_uri = match->origin->value.uri; if(!raptor_uri_equals(triple_uri, match_uri)) goto done; } } } else { /* Not binding a graph */ /* If triple has a GRAPH and there is none in the triple pattern, no match */ if(triple->origin) goto done; } rc = 1; done: #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("result: %s\n", (rc ? "match" : "no match")); #endif return rc; } /* non-0 if present */ static int rasqal_raptor_triple_present(rasqal_triples_source *rts, void *user_data, rasqal_triple *t) { rasqal_raptor_triples_source_user_data* rtsc; rasqal_raptor_triple *triple; unsigned int parts = RASQAL_TRIPLE_SPO; rtsc = (rasqal_raptor_triples_source_user_data*)user_data; if(t->origin) parts = (rasqal_triple_parts)(parts | RASQAL_TRIPLE_GRAPH); for(triple = rtsc->head; triple; triple = triple->next) { if(rasqal_raptor_triple_match(rtsc->world, triple->triple, t, parts)) return 1; } return 0; } static void rasqal_raptor_free_triples_source(void *user_data) { rasqal_raptor_triples_source_user_data* rtsc; rasqal_raptor_triple *cur; int i; rtsc = (rasqal_raptor_triples_source_user_data*)user_data; cur = rtsc->head; while(cur) { rasqal_raptor_triple *next = cur->next; rasqal_triple_set_origin(cur->triple, NULL); /* shared URI literal */ rasqal_free_triple(cur->triple); RASQAL_FREE(rasqal_raptor_triple, cur); cur = next; } for(i = 0; i < rtsc->sources_count; i++) { if(rtsc->source_literals[i]) rasqal_free_literal(rtsc->source_literals[i]); } if(rtsc->source_literals) RASQAL_FREE(raptor_literal_ptr, rtsc->source_literals); } static int rasqal_raptor_register_triples_source_factory(rasqal_triples_source_factory *factory) { factory->version = 3; factory->user_data_size = sizeof(rasqal_raptor_triples_source_user_data); /* V1 */ factory->new_triples_source = rasqal_raptor_new_triples_source; /* V2 */ factory->init_triples_source = rasqal_raptor_init_triples_source; /* V3 */ factory->init_triples_source2 = rasqal_raptor_init_triples_source2; return 0; } typedef struct { rasqal_raptor_triple *cur; rasqal_raptor_triples_source_user_data* source_context; rasqal_triple match; /* parts of the triple above to match: always (S,P,O) sometimes C */ rasqal_triple_parts parts; unsigned int bind_parts; } rasqal_raptor_triples_match_context; static rasqal_triple_parts rasqal_raptor_bind_match(struct rasqal_triples_match_s* rtm, void *user_data, rasqal_variable* bindings[4], rasqal_triple_parts parts) { rasqal_raptor_triples_match_context* rtmc; int error = 0; rasqal_triple_parts result = (rasqal_triple_parts)0; rtmc = (rasqal_raptor_triples_match_context*)rtm->user_data; #ifdef RASQAL_DEBUG if(rtmc->cur) { RASQAL_DEBUG1(" matched statement "); rasqal_triple_print(rtmc->cur->triple, stderr); fputc('\n', stderr); } else RASQAL_FATAL1(" matched NO statement - BUG\n"); #endif /* set variable values from the fields of statement */ if(bindings[0] && (parts & RASQAL_TRIPLE_SUBJECT)) { rasqal_literal *l = rtmc->cur->triple->subject; RASQAL_DEBUG1("binding subject to variable\n"); rasqal_variable_set_value(bindings[0], rasqal_new_literal_from_literal(l)); result = RASQAL_TRIPLE_SUBJECT; } if(bindings[1] && (parts & RASQAL_TRIPLE_PREDICATE)) { if(bindings[0] == bindings[1]) { if(!rasqal_literal_equals_flags(rtmc->cur->triple->subject, rtmc->cur->triple->predicate, RASQAL_COMPARE_RDF, &error)) return (rasqal_triple_parts)0; if(error) return (rasqal_triple_parts)0; RASQAL_DEBUG1("subject and predicate values match\n"); } else { rasqal_literal *l = rtmc->cur->triple->predicate; RASQAL_DEBUG1("binding predicate to variable\n"); rasqal_variable_set_value(bindings[1], rasqal_new_literal_from_literal(l)); result = (rasqal_triple_parts)(result | RASQAL_TRIPLE_PREDICATE); } } if(bindings[2] && (parts & RASQAL_TRIPLE_OBJECT)) { int bind = 1; if(bindings[0] == bindings[2]) { if(!rasqal_literal_equals_flags(rtmc->cur->triple->subject, rtmc->cur->triple->object, RASQAL_COMPARE_RDF, &error)) return (rasqal_triple_parts)0; if(error) return (rasqal_triple_parts)0; bind = 0; RASQAL_DEBUG1("subject and object values match\n"); } if(bindings[1] == bindings[2] && !(bindings[0] == bindings[1]) /* don't do this check if ?x ?x ?x */ ) { if(!rasqal_literal_equals_flags(rtmc->cur->triple->predicate, rtmc->cur->triple->object, RASQAL_COMPARE_RDF, &error)) return (rasqal_triple_parts)0; if(error) return (rasqal_triple_parts)0; bind = 0; RASQAL_DEBUG1("predicate and object values match\n"); } if(bind) { rasqal_literal *l = rtmc->cur->triple->object; RASQAL_DEBUG1("binding object to variable\n"); rasqal_variable_set_value(bindings[2], rasqal_new_literal_from_literal(l)); result = (rasqal_triple_parts)(result | RASQAL_TRIPLE_OBJECT); } } if(bindings[3] && (parts & RASQAL_TRIPLE_ORIGIN)) { rasqal_literal *l; l = rasqal_new_literal_from_literal(rtmc->cur->triple->origin); RASQAL_DEBUG1("binding origin to variable\n"); rasqal_variable_set_value(bindings[3], l); result = (rasqal_triple_parts)(result | RASQAL_TRIPLE_ORIGIN); } return result; } static void rasqal_raptor_next_match(struct rasqal_triples_match_s* rtm, void *user_data) { rasqal_raptor_triples_match_context* rtmc; rtmc = (rasqal_raptor_triples_match_context*)rtm->user_data; #if 0 if(rtmc->bind_parts & RASQAL_TRIPLE_SUBJECT) { rasqal_variable* v = rasqal_literal_as_variable(rtmc->cur->triple->subject); if(v) rasqal_variable_set_value(v, NULL); } if(rtmc->bind_parts & RASQAL_TRIPLE_PREDICATE) { rasqal_variable* v = rasqal_literal_as_variable(rtmc->cur->triple->predicate); if(v) rasqal_variable_set_value(v, NULL); } if(rtmc->bind_parts & RASQAL_TRIPLE_OBJECT) { rasqal_variable* v = rasqal_literal_as_variable(rtmc->cur->triple->object); if(v) rasqal_variable_set_value(v, NULL); } if(rtmc->bind_parts & RASQAL_TRIPLE_ORIGIN) { rasqal_variable* v = rasqal_literal_as_variable(rtmc->cur->triple->origin); if(v) rasqal_variable_set_value(v, NULL); } #endif while(rtmc->cur) { rtmc->cur = rtmc->cur->next; #ifdef RASQAL_DEBUG if(!rtmc->cur) { RASQAL_DEBUG1("triple match ended when matching "); rasqal_triple_print(&rtmc->match, stderr); fputc('\n', stderr); } #endif if(rtmc->cur && rasqal_raptor_triple_match(rtm->world, rtmc->cur->triple, &rtmc->match, rtmc->parts)) break; } } static int rasqal_raptor_is_end(struct rasqal_triples_match_s* rtm, void *user_data) { rasqal_raptor_triples_match_context* rtmc; rtmc = (rasqal_raptor_triples_match_context*)rtm->user_data; return !rtmc || rtmc->cur == NULL; } static void rasqal_raptor_finish_triples_match(struct rasqal_triples_match_s* rtm, void *user_data) { rasqal_raptor_triples_match_context* rtmc; rtmc = (rasqal_raptor_triples_match_context*)rtm->user_data; if(rtmc->match.subject) rasqal_free_literal(rtmc->match.subject); if(rtmc->match.predicate) rasqal_free_literal(rtmc->match.predicate); if(rtmc->match.object) rasqal_free_literal(rtmc->match.object); if(rtmc->match.origin) rasqal_free_literal(rtmc->match.origin); RASQAL_FREE(rasqal_raptor_triples_match_context, rtmc); } static int rasqal_raptor_init_triples_match(rasqal_triples_match* rtm, rasqal_triples_source *rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t) { rasqal_raptor_triples_source_user_data* rtsc; rasqal_raptor_triples_match_context* rtmc; rasqal_variable* var; rtsc = (rasqal_raptor_triples_source_user_data*)user_data; rtm->bind_match = rasqal_raptor_bind_match; rtm->next_match = rasqal_raptor_next_match; rtm->is_end = rasqal_raptor_is_end; rtm->finish = rasqal_raptor_finish_triples_match; rtmc = RASQAL_CALLOC(rasqal_raptor_triples_match_context*, 1, sizeof(*rtmc)); if(!rtmc) return -1; rtm->user_data = rtmc; rtmc->source_context = rtsc; rtmc->cur = rtsc->head; /* Parts we bind */ rtmc->bind_parts = m->parts; /* at least one of the triple terms is a variable and we need to * do a triplesMatching() over the list of stored raptor_statements */ if((var = rasqal_literal_as_variable(t->subject))) { if(rtmc->bind_parts & RASQAL_TRIPLE_SUBJECT) /* we bind it so reset it */ rasqal_variable_set_value(var, NULL); else if(var->value) rtmc->match.subject = rasqal_new_literal_from_literal(var->value); } else rtmc->match.subject = rasqal_new_literal_from_literal(t->subject); m->bindings[0] = var; if((var = rasqal_literal_as_variable(t->predicate))) { if(rtmc->bind_parts & RASQAL_TRIPLE_PREDICATE) /* we bind it so reset it */ rasqal_variable_set_value(var, NULL); else if(var->value) rtmc->match.predicate = rasqal_new_literal_from_literal(var->value); } else rtmc->match.predicate = rasqal_new_literal_from_literal(t->predicate); m->bindings[1] = var; if((var = rasqal_literal_as_variable(t->object))) { if(rtmc->bind_parts & RASQAL_TRIPLE_OBJECT) /* we bind it so reset it */ rasqal_variable_set_value(var, NULL); else if(var->value) rtmc->match.object = rasqal_new_literal_from_literal(var->value); } else rtmc->match.object = rasqal_new_literal_from_literal(t->object); m->bindings[2] = var; rtmc->parts = RASQAL_TRIPLE_SPO; if(t->origin) { if((var = rasqal_literal_as_variable(t->origin))) { if(rtmc->bind_parts & RASQAL_TRIPLE_ORIGIN) /* we bind it so reset it */ rasqal_variable_set_value(var, NULL); else if(var->value) rtmc->match.origin = rasqal_new_literal_from_literal(var->value); } else rtmc->match.origin = rasqal_new_literal_from_literal(t->origin); m->bindings[3] = var; rtmc->parts = (rasqal_triple_parts)(rtmc->parts | RASQAL_TRIPLE_GRAPH); } while(rtmc->cur) { if(rasqal_raptor_triple_match(rtm->world, rtmc->cur->triple, &rtmc->match, rtmc->parts)) break; rtmc->cur = rtmc->cur->next; } return 0; } int rasqal_raptor_init(rasqal_world* world) { rasqal_set_triples_source_factory(world, rasqal_raptor_register_triples_source_factory, (void*)NULL); return 0; } rasqal-0.9.33/src/sparql_lexer.l0000644000175000017500000014440512327014627013473 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sparql_lexer.l - Rasqal SPARQL lexer - making tokens for sparql grammar generator * * Copyright (C) 2004-2014, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * To generate the C files from this source, rather than use the * shipped sparql_lexer.c/.h needs a patched version of flex 2.5.31 such * as the one available in Debian GNU/Linux. Details below * near the %option descriptions. * * SPARQL defined in http://www.w3.org/TR/rdf-sparql-query/ * http://www.w3.org/TR/2005/WD-rdf-sparql-query-20050419/ * * Editor's draft of above http://www.w3.org/2001/sw/DataAccess/rq23/ */ /* recognise 8-bits */ %option 8bit %option warn nodefault /* all symbols prefixed by this */ %option prefix="sparql_lexer_" /* This is not needed, flex is invoked -osparql_lexer.c */ %option outfile="sparql_lexer.c" /* Emit a C header file for prototypes * Only available in flex 2.5.13 or newer. * It was renamed to header-file in flex 2.5.19 */ %option header-file="sparql_lexer.h" /* Do not emit #include * Only available in flex 2.5.7 or newer. * Broken in flex 2.5.31 without patches. */ %option nounistd /* Never interactive */ /* No isatty() check */ %option never-interactive /* Batch scanner */ %option batch /* Never use yyunput */ %option nounput /* Supply our own alloc/realloc/free functions */ %option noyyalloc noyyrealloc noyyfree /* Re-entrant scanner */ %option reentrant %option extra-type="rasqal_query*" /* Makes sparql_lexer_get_lval() sparql_lexer_set_lval() functions * and yylval macro appear */ %option bison-bridge /* Makes yyget_lloc() yyset_lloc() and yylloc appear */ /* %option bison-locations */ %x ID SPID PREF LITERAL LITERAL2 /* definitions */ %{ /* NOTE: These headers are NOT included here. They are inserted by fix-flex * since otherwise it appears far too late in the generated C */ /* #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif */ #include #include #include #include #ifdef HAVE_SETJMP_H #include #endif #include #include #include #include /* Set RASQAL_DEBUG to 2 for verbose lexing (when building this as * sparql_lexer_test) and 3 for super verbose */ #if 0 #undef RASQAL_DEBUG #define RASQAL_DEBUG 3 #endif static int sparql_skip_c_comment(rasqal_query *rq); /* * Extra checks beyond valid Namespaces in XML 1.1 name * * SPARQL_NAME_CHECK_VARNAME (token VARNAME) * No '.' allowed. * No '-' allowed. * * SPARQL_NAME_CHECK_PREFIX (token NCNAME_PREFIX) * No '_' allowed as the first character. * No '.' allowed as the last character. * * SPARQL_NAME_CHECK_NCNAME (token NCNAME) * [0-9] allowed as the first character * No '.' allowed as the first character. * No '.' allowed as the last character. * */ typedef enum { SPARQL_NAME_CHECK_NO_UL_FIRST = 1, SPARQL_NAME_CHECK_NO_DOT_LAST = 2, SPARQL_NAME_CHECK_NO_DOT_MINUS = 4, SPARQL_NAME_CHECK_ALLOW_09_FIRST = 8, SPARQL_NAME_CHECK_VARNAME = SPARQL_NAME_CHECK_NO_DOT_MINUS, SPARQL_NAME_CHECK_PREFIX = SPARQL_NAME_CHECK_NO_UL_FIRST | SPARQL_NAME_CHECK_NO_DOT_LAST, SPARQL_NAME_CHECK_NCNAME = SPARQL_NAME_CHECK_NO_DOT_LAST | SPARQL_NAME_CHECK_ALLOW_09_FIRST } sparql_name_check_flags; static int rasqal_sparql_name_check(unsigned char *string, size_t length, sparql_name_check_flags check_flags); static unsigned char *sparql_copy_name(rasqal_query *rq, const unsigned char *text, size_t len, sparql_name_check_flags check_flags); static raptor_uri* sparql_copy_qname(rasqal_query *rq, const unsigned char *text, size_t len); static unsigned char *sparql_copy_string_token(rasqal_query* rq, unsigned char *text, size_t len, int delim); static int sparql_stringbuffer_append_sparql_string(rasqal_query* rq, raptor_stringbuffer* stringbuffer, const unsigned char *text, size_t len, int delim); #ifdef RASQAL_DEBUG const char * sparql_token_print(rasqal_world* world, int token, YYSTYPE *lval); #endif #ifdef __cplusplus #define INPUT_FN yyinput #else #define INPUT_FN input #endif #if FLEX_VERSION_DECIMAL < 20536 /* debian flex 2.5.35-10.1 added these column header prototypes in * re-entrant mode. standard flex omits them */ void sparql_lexer_set_column(int column_no, yyscan_t yyscanner); int sparql_lexer_get_column(yyscan_t yyscanner); #endif static void sparql_lexer_cleanup(yyscan_t yyscanner); /* Remove the re-fill function since it should never be called */ #define YY_INPUT(buf,result,max_size) { return YY_NULL; } /* Log error handler wrapper */ static void sparql_lexer_log_error(yyconst char *msg, raptor_log_level level, yyscan_t yyscanner); /* fatal error handler declaration * If we have a setjmp / longjmp then report an ERROR and do not abort. * * Flex's use of this macro makes doing a return impossible since some * uses require a return NULL, some an int and some no value :( */ #ifdef HAVE_SETJMP static jmp_buf sparql_lexer_log_error_longjmp_env; #define YY_FATAL_ERROR(msg) do { \ sparql_lexer_log_error(msg, RAPTOR_LOG_LEVEL_ERROR, yyscanner); \ longjmp(sparql_lexer_log_error_longjmp_env, 1); \ } while(0) #else #define YY_FATAL_ERROR(msg) do { \ sparql_lexer_log_error(msg, RAPTOR_LOG_LEVEL_FATAL, yyscanner); \ abort(); \ } while(0) #endif /* Error handler that returns EOF instead of abort() / longjmp() * so that parser can clean up properly */ #define YY_REPORT_ERROR_EOF(msg) do { \ sparql_lexer_log_error(msg, RAPTOR_LOG_LEVEL_ERROR, yyscanner); \ yyterminate(); \ } while(0) %} LANGTAG "@"[A-Za-z][-A-Z_a-z0-9]* /* * rq23 is http://www.w3.org/2001/sw/DataAccess/rq23/ * CVS ID 1.420 2005/07/12 15:38:40 */ /* [85] NCCHAR1p ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | * [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | * [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | * [#x10000-#xEFFFF] * * This is an XML 1.1 NameStartChar * http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameStartChar * except * No '_' allowed. */ NCCHAR1p [A-Za-z\\\x80-\xff] /* [86] NCCHAR1 ::= NCCHAR1p | '_' * This is an XML 1.1 NameStartChar * http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameStartChar */ NCCHAR1 [A-Za-z\\\x80-\xff_] NCCHAR2 [A-Za-z\\\x80-\xff_0-9] /* [87] VARNAME ::= ( NCCHAR1 | _ ) * ( NCCHAR1 | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* * * This is an Namespaces in XML 1.1 Name except: * No '.' allowed. * No '-' allowed. */ VARNAME ({NCCHAR1}|[0-9])({NCCHAR1}|[0-9])* /* [88] NCCHAR ::= * NCCHAR1 | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] * * This is XML 1.1 NameChar * http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameChar * except: * No '.' allowed. */ NCCHAR {NCCHAR1}|"-"|[0-9] /* [89] NCNAME_PREFIX ::= NCCHAR1p ((NCCHAR|".")* NCCHAR)? * * This is an Namespaces in XML 1.1 Name except: * No '_' allowed as the first character. * No '.' allowed as the last character. */ NCNAME_PREFIX {NCCHAR1p}(({NCCHAR}|".")*{NCCHAR})? /* [90] NCNAME ::= NCCHAR1 ((NCCHAR|".")* NCCHAR)? * * This is an Namespaces in XML 1.1 Name except: * No '.' allowed as the last character. */ NCNAME {NCCHAR1}(({NCCHAR}|".")*{NCCHAR})? /* SPARQL allows [0-9] after a : in the * W3C Candidate Recommendation 14 June 2007 * as an at risk feature that may be removed. */ NCNAME2 {NCCHAR2}(({NCCHAR}|".")*{NCCHAR})? /* rq23 [67] QNAME_NS ::= NCNAME_PREFIX? ':' * Inlined into in rule {NCNAME_PREFIX}":" below */ /* rq23 [68] QNAME ::= NCNAME_PREFIX? ':' NCNAME? */ QNAME {NCNAME_PREFIX}?":"{NCNAME2}? /* rq23 [69] BNODE_LABEL (renamed to BNAME) ::= '_:' NCNAME */ BNAME "_:"{NCNAME2} /* a blank node name written inside a URI - this is an illegal * URI form and for convienence */ BNAME2 "<_:"{NCNAME2}">" /* The initial char conditions are to ensure this doesn't grab < or <= * as operators. starting with <_: is caught by BNAME2 above. **/ QUOTEDURI \<[^><= ][^>]*\>|"<>" INTEGER [0-9]+ DECIMAL [0-9]+"."[0-9]*|"."[0-9]+ DOUBLE [0-9]+"."[0-9]*{EXPONENT}|"."([0-9])+{EXPONENT}|([0-9])+{EXPONENT} EXPONENT [eE][+-]?[0-9]+ %% /* rules */ %{ int c; rasqal_query *rq; rasqal_sparql_query_language *rqe; rq = (rasqal_query*)yyextra; rqe = (rasqal_sparql_query_language*)rq->context; #ifdef HAVE_SETJMP if(setjmp(sparql_lexer_log_error_longjmp_env)) return 1; #endif %} "//"[^\r\n]*(\r\n|\r|\n) { /* C++ comment */ rqe->lineno++; } "/*" { int lines = sparql_skip_c_comment(rq); if(lines < 0) yyterminate(); rqe->lineno += lines; } \r\n|\r|\n { rqe->lineno++; } [\ \t\v]+ { /* eat up other whitespace */ ; } [Ss][Ee][Ll][Ee][Cc][Tt] { return SELECT; } [Ff][Rr][Oo][Mm] { return FROM; } [Ww][Hh][Ee][Rr][Ee] { return WHERE; } [Pp][Rr][Ee][Ff][Ii][Xx] { BEGIN(PREF); return PREFIX; } [Dd][Ee][Ss][Cc][Rr][Ii][Bb][Ee] { return DESCRIBE; } [Cc][Oo][Nn][Ss][Tt][Rr][Uu][Cc][Tt] { return CONSTRUCT; } [Aa][Ss][Kk] { return ASK; } [Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] { return DISTINCT; } [Rr][Ee][Dd][Uu][Cc][Ee][Dd] { return REDUCED; } [Ll][Ii][Mm][Ii][Tt] { return LIMIT; } [Uu][Nn][Ii][Oo][Nn] { return UNION; } [Oo][Pp][Tt][Ii][Oo][Nn][Aa][Ll] { return OPTIONAL; } [Bb][Aa][Ss][Ee] { return BASE; } [Bb][Oo][Uu][Nn][Dd] { return BOUND; } [Ss][Tt][Rr][Ll][Aa][Nn][Gg] { return STRLANG; } [Ss][Tt][Rr][Dd][Tt] { return STRDT; } [Ss][Tt][Rr] { return STR; } [Ll][Aa][Nn][Gg] { return LANG; } [Dd][Aa][Tt][Aa][Tt][Yy][Pp][Ee] { return DATATYPE; } [Ii][Ss][UuIi][Rr][Ii] { return ISURI; } /* isURI and isIRI */ [Ii][Ss][Bb][Ll][Aa][Nn][Kk] { return ISBLANK; } [Ii][Ss][Ll][Ii][Tt][Ee][Rr][Aa][Ll] { return ISLITERAL; } [Gg][Rr][Aa][Pp][Hh] { return GRAPH; } [Nn][Aa][Mm][Ee][Dd] { return NAMED; } [Ff][Ii][Ll][Tt][Ee][Rr] { return FILTER; } [Oo][Ff][Ff][Ss][Ee][Tt] { return OFFSET; } [Oo][Rr][Dd][Ee][Rr] { return ORDER; } [Bb][Yy] { return BY; } [Rr][Ee][Gg][Ee][Xx] { return REGEX; } [Aa][Ss][Cc] { return ASC; } [Dd][Ee][Ss][Cc] { return DESC; } [Ll][Aa][Nn][Gg][Mm][Aa][Tt][Cc][Hh][Ee][Ss] { return LANGMATCHES; } [Ee][Xx][Pp][Ll][Aa][Ii][Nn] { return EXPLAIN; } [Gg][Rr][Oo][Uu][Pp] { return GROUP; } [Hh][Aa][Vv][Ii][Nn][Gg] { return HAVING; } [Cc][Oo][Uu][Nn][Tt] { return COUNT; } [Ss][Uu][Mm] { return SUM; } [Aa][Vv][Gg] { return AVG; } [Mm][Ii][Nn] { return MIN; } [Mm][Aa][Xx] { return MAX; } [Aa][Ss] { BEGIN(SPID); return AS; } [Dd][Ee][Ll][Ee][Tt][Ee] { return DELETE; } [Ii][Nn][Ss][Ee][Rr][Tt] { return INSERT; } [Ss][Aa][Mm][Ee][Tt][Ee][Rr][Mm] { return SAMETERM; } [Ll][Ee][Tt] { return LET; } [Cc][Oo][Aa][Ll][Ee][Ss][Cc][Ee] { return COALESCE; } [Ww][Ii][Tt][Hh] { return WITH; } [Cc][Ll][Ee][Aa][Rr] { return CLEAR; } [Cc][Rr][Ee][Aa][Tt][Ee] { return CREATE; } [Ss][Ii][Ll][Ee][Nn][Tt] { return SILENT; } [Dd][Aa][Tt][Aa] { return DATA; } [Dd][Rr][Oo][Pp] { return DROP; } [Ll][Oo][Aa][Dd] { return LOAD; } [Ii][Nn][Tt][Oo] { return INTO; } [Ii][Ff] { return IF; } [Ii][Rr][Ii] { return IRI; } [Ur][Rr][Ii] { return URI; } [Bb][Nn][Oo][Dd][Ee] { return BNODE; } [Dd][Ee][Ff][Aa][Uu][Ll][Tt] { return DEFAULT; } [Nn][Oo][Tt] { return NOT; } [Ii][Nn] { return IN; } [Gg][Rr][Oo][Uu][Pp]_[Cc][Oo][Nn][Cc][Aa][Tt] { return GROUP_CONCAT; } [Ss][Ee][Pp][Aa][Rr][Aa][Tt][Oo][Rr] { return SEPARATOR; } [Bb][Ii][Nn][Dd] { return BIND; } [Bb][Ii][Nn][Dd][Ii][Nn][Gg][Ss] { return BINDINGS; } [Uu][Nn][Dd][Ee][Ff] { return UNDEF; } [Ss][Ee][Rr][Vv][Ii][Cc][Ee] { return SERVICE; } [Mm][Ii][Nn][Uu][Ss] { return MINUS; } [Ii][Ss][Nn][Uu][Mm][Ee][Rr][Ii][Cc] { return ISNUMERIC; } [Ss][Aa][Mm][Pp][Ll][Ee] { return SAMPLE; } [Yy][Ee][Aa][Rr] { return YEAR; } [Mm][Oo][Nn][Tt][Hh] { return MONTH; } [Dd][Aa][Yy] { return DAY; } [Hh][Oo][Uu][Rr][Ss] { return HOURS; } [Mm][Ii][Nn][Uu][Tt][Ee][Ss] { return MINUTES; } [Ss][Ee][Cc][Oo][Nn][Dd][Ss] { return SECONDS; } [Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee] { return TIMEZONE; } [Cc][Uu][Rr][Rr][Ee][Nn][Tt][__][Dd][Aa][Tt][Ee][Tt][Ii][Mm][Ee] { return CURRENT_DATETIME; } [Nn][Oo][Ww] { return NOW; } [Ff][Rr][Oo][Mm][__][Uu][Nn][Ii][Xx][Tt][Ii][Mm][Ee] { return FROM_UNIXTIME; } [Tt][Oo][__][Uu][Nn][Ii][Xx][Tt][Ii][Mm][Ee] { return TO_UNIXTIME; } [Cc][Oo][Nn][Cc][Aa][Tt] { return CONCAT; } [Ss][Tt][Rr][Ll][Ee][Nn] { return STRLEN; } [Ss][Uu][Bb][Ss][Tt][Rr] { return SUBSTR; } [Uu][Cc][Aa][Ss][Ee] { return UCASE; } [Ll][Cc][Aa][Ss][Ee] { return LCASE; } [Ss][Tt][Rr][Ss][Tt][Aa][Rr][Tt][Ss] { return STRSTARTS; } [Ss][Tt][Rr][Ee][Nn][Dd][Ss] { return STRENDS; } [Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss] { return CONTAINS; } [Ee][Nn][Cc][Oo][Dd][Ee][__][Ff][Oo][Rr][__][Uu][Rr][Ii] { return ENCODE_FOR_URI; } [Tt][Oo] { return TO; } [Aa][Dd][Dd] { return ADD; } [Mm][Oo][Vv][Ee] { return MOVE; } [Cc][Oo][Pp][Yy] { return COPY; } [Aa][Ll][Ll] { return ALL; } [Tt][Zz] { return TZ; } [Rr][Aa][Nn][Dd] { return RAND; } [Aa][Bb][Ss] { return ABS; } [Rr][Oo][Uu][Nn][Dd] { return ROUND; } [Cc][Ee][Ii][Ll] { return CEIL; } [Ff][Ll][Oo][Oo][Rr] { return FLOOR; } [Mm][Dd][55] { return MD5; } [Ss][Hh][Aa][11] { return SHA1; } [Ss][Hh][Aa][22][22][44] { return SHA224; } [Ss][Hh][Aa][22][55][66] { return SHA256; } [Ss][Hh][Aa][33][88][44] { return SHA384; } [Ss][Hh][Aa][55][11][22] { return SHA512; } [Ss][Tt][Rr][Bb][Ee][Ff][Oo][Rr][Ee] { return STRBEFORE; } [Ss][Tt][Rr][Aa][Ff][Tt][Ee][Rr] { return STRAFTER; } [Rr][Ee][Pp][Ll][Aa][Cc][Ee] { return REPLACE; } [Uu][Uu][Ii][Dd] { return UUID; } [Ss][Tt][Rr][Uu][Uu][Ii][Dd] { return STRUUID; } [Vv][Aa][Ll][Uu][Ee][Ss] { return VALUES; } "a" { return A; } "," { return ','; } "(" { return '('; } ")" { return ')'; } "[" { return '['; } "]" { return ']'; } "?" { BEGIN(ID); return '?'; } "$" { BEGIN(ID); return '$'; } "{" { return '{'; } "}" { return '}'; } "." { return '.'; } ";" { return ';'; } "||" { return SC_OR; } "&&" { return SC_AND; } "=" { return EQ; } "!=" { return NEQ; } "<"/[^A-Za-z=>] { return LT; } ">" { return GT; } "<=" { return LE; } ">=" { return GE; } "*" { return '*'; } "/" { return '/'; } "!" { return '!'; } ":=" { return ASSIGN; } {LANGTAG} { yylval->name = RASQAL_MALLOC(unsigned char*, yyleng); if(!yylval->name) YY_REPORT_ERROR_EOF("Out of memory"); memcpy(yylval->name, yytext + 1, yyleng - 1); yylval->name[yyleng - 1] = '\0'; return LANGTAG; } "^^" { return HATHAT; } [-+]?{INTEGER} { c = *yytext; yylval->literal = rasqal_new_typed_literal(rq->world, RASQAL_LITERAL_INTEGER, RASQAL_GOOD_CAST(const unsigned char*, yytext)); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_typed_literal failed"); return (c=='+' ? INTEGER_POSITIVE_LITERAL : (c == '-' ? INTEGER_NEGATIVE_LITERAL : INTEGER_LITERAL)); } [-+]?{DECIMAL} { c = *yytext; if(!rasqal_xsd_datatype_check(RASQAL_LITERAL_DECIMAL, RASQAL_GOOD_CAST(const unsigned char*, yytext), 0)) { sparql_syntax_error(rq, "SPARQL syntax error - Illegal decimal constant %s", yytext); yyterminate(); } yylval->literal = rasqal_new_decimal_literal(rq->world, RASQAL_GOOD_CAST(const unsigned char*, yytext)); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_decimal_literal failed"); return (c=='+' ? DECIMAL_POSITIVE_LITERAL : (c == '-' ? DECIMAL_NEGATIVE_LITERAL : DECIMAL_LITERAL)); } [-+]?{DOUBLE} { c = *yytext; if(!rasqal_xsd_datatype_check(RASQAL_LITERAL_DOUBLE, RASQAL_GOOD_CAST(const unsigned char*, yytext), 0)) { sparql_syntax_error(rq, "SPARQL syntax error - Illegal double constant %s", yytext); yyterminate(); } yylval->literal = rasqal_new_typed_literal(rq->world, RASQAL_LITERAL_DOUBLE, RASQAL_GOOD_CAST(const unsigned char*, yytext)); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_typed_literal failed"); return (c=='+' ? DOUBLE_POSITIVE_LITERAL : (c == '-' ? DOUBLE_NEGATIVE_LITERAL : DOUBLE_LITERAL)); } "+" { return '+'; } "-" { return '-'; } '([^'\\\n\r]|\\[^\n\r])*' { /*' */ yylval->name = sparql_copy_string_token(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 1, yyleng - 2, '\''); if(!yylval->name) YY_REPORT_ERROR_EOF("sparql_copy_string_token failed"); return STRING; } \"([^"\\\n\r]|\\[^\n\r])*\" { /* " */ yylval->name = sparql_copy_string_token(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 1, yyleng - 2, '"'); if(!yylval->name) YY_REPORT_ERROR_EOF("sparql_copy_string_token failed"); return STRING; } \"\"\" { BEGIN(LITERAL); rqe->sb = raptor_new_stringbuffer(); if(!rqe->sb) YY_REPORT_ERROR_EOF("raptor_new_stringbuffer failed"); } \"\"\" { size_t len; BEGIN(INITIAL); len = raptor_stringbuffer_length(rqe->sb); yylval->name = RASQAL_MALLOC(unsigned char*, len + 1); if(!yylval->name) YY_REPORT_ERROR_EOF("Out of memory"); raptor_stringbuffer_copy_to_string(rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yylval->name), len); yylval->name[len] = '\0'; raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return STRING; } \"|(\\.|[^\"\\]|\n)* { char *p; if(*yytext == EOF) { BEGIN(INITIAL); sparql_syntax_error(rq, "End of file in middle of literal"); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return EOF; } for(p = yytext; *p; p++) { if(*p == '\n') rqe->lineno++; } if(sparql_stringbuffer_append_sparql_string(rq, rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yytext), yyleng, '"')) { /* " */ BEGIN(INITIAL); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; YY_REPORT_ERROR_EOF("sparql_stringbuffer_append_sparql_string failed"); } } \\ { /* this should only happen if \ is at the end of the file so the Turtle doc is illegal anyway */ sparql_syntax_error(rq, "End of file in middle of literal"); } \'\'\' { BEGIN(LITERAL2); rqe->sb = raptor_new_stringbuffer(); if(!rqe->sb) { BEGIN(INITIAL); YY_REPORT_ERROR_EOF("raptor_new_stringbuffer failed"); } } \'\'\' { size_t len; BEGIN(INITIAL); len = raptor_stringbuffer_length(rqe->sb); yylval->name = RASQAL_MALLOC(unsigned char*, len + 1); if(!yylval->name) YY_REPORT_ERROR_EOF("Out of memory"); raptor_stringbuffer_copy_to_string(rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yylval->name), len); yylval->name[len] = '\0'; raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return STRING; } \'|(\\.|[^\'\\]|\n)* { char *p; if(*yytext == EOF) { BEGIN(INITIAL); sparql_syntax_error(rq, "End of file in middle of \"\"\" literal"); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return EOF; } for(p = yytext; *p; p++) { if(*p == '\n') rqe->lineno++; } if(sparql_stringbuffer_append_sparql_string(rq, rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yytext), yyleng, '\'')) { BEGIN(INITIAL); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; YY_REPORT_ERROR_EOF("sparql_stringbuffer_append_sparql_string failed"); } } \\ { /* this should only happen if \ is at the end of the file so the Turtle doc is illegal anyway */ sparql_syntax_error(rq, "End of file in middle of ''' literal"); } [Tt][Rr][Uu][Ee] { yylval->literal = rasqal_new_boolean_literal(rq->world, 1); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_boolean_literal failed"); return BOOLEAN_LITERAL; } [Ff][Aa][Ll][Ss][Ee] { yylval->literal = rasqal_new_boolean_literal(rq->world, 0); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_boolean_literal failed"); return BOOLEAN_LITERAL; } {VARNAME} { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng, SPARQL_NAME_CHECK_VARNAME); if(!yylval->name) yyterminate(); BEGIN(INITIAL); return IDENTIFIER; } (.|\n) { BEGIN(INITIAL); sparql_syntax_error(rq, "SPARQL syntax error - missing variable name after ?"); yyterminate(); } [\ \t\v]+ { /* eat up leading whitespace */ ; } \? { return '?'; } \$ { return '$'; } {VARNAME} { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng, SPARQL_NAME_CHECK_VARNAME); if(!yylval->name) yyterminate(); BEGIN(INITIAL); return IDENTIFIER; } (.|\n) { BEGIN(INITIAL); sparql_syntax_error(rq, "SPARQL syntax error - missing variable name after ?"); yyterminate(); } [\ \t\v]+ { /* eat up leading whitespace */ } {NCNAME_PREFIX}":" { BEGIN(INITIAL); yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng - 1, SPARQL_NAME_CHECK_PREFIX); if(!yylval->name) yyterminate(); return IDENTIFIER; } ":" { BEGIN(INITIAL); yylval->name = NULL; return IDENTIFIER; } (.|\n) { BEGIN(INITIAL); if(!*yytext) return EOF; sparql_syntax_error(rq, "SPARQL syntax error at '%c'", *yytext); yyterminate(); } {QNAME}\(? { int have_brace = (yytext[yyleng-1]=='('); if(have_brace) yyleng--; yylval->uri = sparql_copy_qname(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng); if(!yylval->uri) yyterminate(); return have_brace ? URI_LITERAL_BRACE : URI_LITERAL; } {BNAME} { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 2, yyleng - 2, SPARQL_NAME_CHECK_NCNAME); if(!yylval->name) yyterminate(); return BLANK_LITERAL; } {BNAME2} { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 3, yyleng - 4, SPARQL_NAME_CHECK_NCNAME); if(!yylval->name) yyterminate(); return BLANK_LITERAL; } {QUOTEDURI}\(? { int have_brace = (yytext[yyleng-1]=='('); if(have_brace) yyleng--; if(yyleng == 2) yylval->uri = raptor_uri_copy(rq->base_uri); else { unsigned char* uri_string; yytext[yyleng-1] = '\0'; uri_string = rasqal_escaped_name_to_utf8_string(RASQAL_GOOD_CAST(unsigned char*, yytext) + 1, yyleng-1, NULL, sparql_syntax_error, rq); if(!uri_string) YY_REPORT_ERROR_EOF("rasqal_escaped_name_to_utf8_string failed"); yylval->uri = raptor_new_uri_relative_to_base(rq->world->raptor_world_ptr, rq->base_uri, uri_string); RASQAL_FREE(char*, uri_string); if(!yylval->uri) YY_REPORT_ERROR_EOF("raptor_new_uri_relative_to_base failed"); } return have_brace ? URI_LITERAL_BRACE : URI_LITERAL; } \#[^\r\n]*(\r\n|\r|\n) { /* # comment */ rqe->lineno++; } . { if(!*yytext) return EOF; sparql_syntax_error(rq, "SPARQL syntax error at '%c'", *yytext); yyterminate(); } %% /* user code */ int yywrap (yyscan_t yyscanner) { return 1; } static int rasqal_sparql_name_check(unsigned char *string, size_t length, sparql_name_check_flags check_flags) { int rc = 0; int c = -1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1("Checking name '"); if(length) fwrite(string, length, sizeof(unsigned char), stderr); fprintf(stderr, "' (length %d), flags %d\n", RASQAL_BAD_CAST(int, length), RASQAL_GOOD_CAST(int, check_flags)); #endif if(!length) return 1; if((check_flags & SPARQL_NAME_CHECK_ALLOW_09_FIRST) && (*string >= '0' && *string <= '9')) { c = *string; *string = 'X'; } if(!raptor_xml_name_check(string, length, 11)) /* 11 = XML 1.1 */ goto done; if((check_flags & SPARQL_NAME_CHECK_NO_UL_FIRST) && *string == '_') goto done; if((check_flags & SPARQL_NAME_CHECK_NO_DOT_LAST) && string[length-1] == '.') goto done; if(check_flags & SPARQL_NAME_CHECK_NO_DOT_MINUS) { size_t i; for(i = 0; i < length; i++) if(string[i] == '.' || string[i] == '-') goto done; } rc = 1; done: if(c >= 0) *string = c; return rc; } static unsigned char * sparql_copy_name(rasqal_query *rq, const unsigned char *text, size_t len, sparql_name_check_flags check_flags) { size_t dest_len = 0; unsigned char *s; s = rasqal_escaped_name_to_utf8_string(RASQAL_GOOD_CAST(unsigned char*, text), len, &dest_len, sparql_syntax_error, rq); if(!s) { sparql_syntax_error(rq, "Failed to decode SPARQL string \"%s\"", text); return s; } if(!rasqal_sparql_name_check(s, dest_len, check_flags)) sparql_syntax_error(rq, "Invalid SPARQL name \"%s\"", s); return s; } static raptor_uri* sparql_copy_qname(rasqal_query *rq, const unsigned char *text, size_t len) { unsigned char *p; size_t dest_len = 0; unsigned char *s; raptor_uri* uri = NULL; s = rasqal_escaped_name_to_utf8_string(RASQAL_GOOD_CAST(unsigned char*, text), len, &dest_len, sparql_syntax_error, rq); if(!s) { sparql_syntax_error(rq, "Failed to decode SPARQL ID \"%s\"", text); return NULL; } p = RASQAL_GOOD_CAST(unsigned char*, strchr(RASQAL_GOOD_CAST(const char*, s), ':')); if(!rasqal_sparql_name_check(s, p-s, SPARQL_NAME_CHECK_PREFIX)) sparql_syntax_error(rq, "Invalid SPARQL prefix name \"%s\"", s); if(!rasqal_sparql_name_check(p+1, dest_len-((p+1)-s), SPARQL_NAME_CHECK_NCNAME)) sparql_syntax_error(rq, "Invalid SPARQL local name \"%s\"", p+1); #ifdef STANDALONE /* lexer test cannot declare namespaces - so just ignore expansion */ uri = raptor_new_uri_relative_to_base(rq->world->raptor_world_ptr, rq->base_uri, s); #else /* not */ if(!rq->namespaces) { sparql_syntax_error(rq, "SPARQL syntax error - no namespaces declared"); return NULL; } uri = raptor_qname_string_to_uri(rq->namespaces, s, dest_len); #endif /* STANDALONE */ RASQAL_FREE(char*, s); return uri; } static unsigned char* sparql_copy_string_token(rasqal_query* rq, unsigned char *string, size_t len, int delim) { raptor_stringbuffer* sb = NULL; int rc; if(len) { sb = raptor_new_stringbuffer(); if(!sb) return NULL; rc = sparql_stringbuffer_append_sparql_string(rq, sb, string, len, delim); if(rc) { raptor_free_stringbuffer(sb); return NULL; } len = raptor_stringbuffer_length(sb); } string = RASQAL_MALLOC(unsigned char*, len + 1); if(string) { if(sb) raptor_stringbuffer_copy_to_string(sb, string, len + 1); string[len]='\0'; } if(sb) raptor_free_stringbuffer(sb); return string; } static int sparql_skip_c_comment(rasqal_query *rq) { rasqal_sparql_query_language *rqe; yyscan_t yyscanner; int lines = 0; int lastc = -1; rqe = (rasqal_sparql_query_language*)rq->context; yyscanner = rqe->scanner; while(1) { int c = INPUT_FN(yyscanner); if(c == EOF) { /* EOF */ sparql_syntax_error(rq, "SPARQL syntax error - EOF in comment"); lines = -1; break; } if(c == '\r' || (c == '\n' && lastc != '\r')) lines++; if(lastc == '*' && c == '/') break; lastc = c; } return lines; } /** * sparql_stringbuffer_append_sparql_string: * @rq: rasqal query * @stringbuffer: String buffer to add to * @text: turtle string to decode * @len: length of string * @delim: terminating delimiter for string - only ', " or > are allowed * * INTERNAL - Append to a stringbuffer a SPARQL-escaped string. * * The passed in string is handled according to the SPARQL string * escape rules giving a UTF-8 encoded output of the Unicode codepoints. * * The SPARQL escapes are \n \r \f \b \t \\ * \uXXXX \UXXXXXXXX where X is [A-F0-9] * and \ followed by the @delim char * * Return value: non-0 on failure **/ static int sparql_stringbuffer_append_sparql_string(rasqal_query* rq, raptor_stringbuffer* stringbuffer, const unsigned char *text, size_t len, int delim) { size_t i; const unsigned char *s; unsigned char *d; unsigned char *string; string = RASQAL_MALLOC(unsigned char*, len + 1); if(!string) return -1; for(s = text, d = string, i = 0; i < len; s++, i++) { unsigned char c = *s; if(c == '\\' ) { s++; i++; c = *s; if(c == 'n') *d++ = '\n'; else if(c == 'r') *d++ = '\r'; else if(c == 'f') *d++ = '\f'; else if(c == 'b') *d++ = '\b'; else if(c == 't') *d++ = '\t'; else if(c == '\\' || c == delim) *d++ = c; else if(c == 'u' || c == 'U') { size_t ulen = (c == 'u') ? 4 : 8; unsigned long unichar = 0; int n; s++; i++; if(i + ulen > len) { sparql_syntax_error(rq, "SPARQL string \\%c over end of line", c); RASQAL_FREE(char*, string); return 1; } n = sscanf(RASQAL_GOOD_CAST(const char*, s), ((ulen == 4) ? "%04lx" : "%08lx"), &unichar); if(n != 1) { sparql_syntax_error(rq, "Bad SPARQL string Uncode escape '%c%s...'", c, s); RASQAL_FREE(char*, string); return 1; } s += ulen - 1; i += ulen - 1; if(unichar > rasqal_unicode_max_codepoint) { sparql_syntax_error(rq, "Bad SPARQL string Unicode character with code point #x%lX (max #x%lX).", unichar, rasqal_unicode_max_codepoint); RASQAL_FREE(char*, string); return 1; } d += raptor_unicode_utf8_string_put_char(unichar, d, len - (d - string)); } else { /* Ignore \x where x isn't the one of: \n \r \t \\ (delim) \u \U */ sparql_syntax_warning(rq, "Unknown SPARQL string escape \\%c in \"%s\"", c, text); *d++ = c; } } else *d++ = c; } *d='\0'; /* calculate output string size */ len = d-string; /* string gets owned by the stringbuffer after this */ return raptor_stringbuffer_append_counted_string(stringbuffer, string, len, 0); } /* * sparql_lexer_log_error: * @msg: message string * @level: log level * @yyscanner: scanner context * * INTERNAL - replacement for the generated error handler. * Uses rasqal_log_error_simple() when possible. */ static void sparql_lexer_log_error(yyconst char *msg, raptor_log_level level, yyscan_t yyscanner) { rasqal_query *rq = NULL; if(yyscanner) rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(rq) { /* avoid "format not a string literal and no format arguments" warning with %s */ rq->failed = 1; rasqal_log_error_simple(rq->world, level, &rq->locator, "%s", msg); } else { fputs(msg, stderr); fputc('\n', stderr); } } /* Define LEXER_ALLOC_TRACKING to enable allocated memory tracking * - fixes lexer memory leak when ensure_buffer_stack fails */ #ifdef LEXER_ALLOC_TRACKING typedef struct { /* Number of void* slots allocated */ int lexer_allocs_size; /* Allocted void* slots follow in memory after this header */ } lexer_alloc_tracker_header; /* Initial alloc tracker slot array size - 2 seems to be enough for almost all cases */ static const int initial_lexer_allocs_size = 2; #endif /* * sparql_lexer_cleanup: * @yyscanner: * * INTERNAL - Clean up unfreed lexer allocs if LEXER_ALLOC_TRACKING is enabled. */ static void sparql_lexer_cleanup(yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; if(!yyscanner) return; rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) return; tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) return; lexer_allocs = (void**)&tracker[1]; for(i = 0; ilexer_allocs_size; ++i) { if(lexer_allocs[i]) free(lexer_allocs[i]); lexer_allocs[i] = NULL; } free(rq->lexer_user_data); rq->lexer_user_data = NULL; #endif } /* * sparql_lexer_alloc: * @size * @yyscanner * * INTERNAL - alloc replacement. * Tracks allocated cells if LEXER_ALLOC_TRACKING is enabled. */ void *sparql_lexer_alloc(yy_size_t size, yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; void *ptr; /* yyscanner not initialized -> probably initializing yyscanner itself * -> just malloc without tracking */ if(!yyscanner) return malloc(size); rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) YY_FATAL_ERROR("lexer_alloc: yyscanner extra not initialized"); /* try to allocate tracker if it does not exist */ tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) { /* allocate tracker header + array of void* slots */ tracker = (lexer_alloc_tracker_header*)calloc(1, sizeof(lexer_alloc_tracker_header) + initial_lexer_allocs_size * sizeof(void*)); if(!tracker) YY_FATAL_ERROR("lexer_alloc: cannot allocate tracker"); tracker->lexer_allocs_size = initial_lexer_allocs_size; rq->lexer_user_data = (void *)tracker; } lexer_allocs = (void**)&tracker[1]; /* allocate memory */ ptr = malloc(size); /* find a free slot for ptr */ for(i = 0; ilexer_allocs_size; ++i) { if(!lexer_allocs[i]) { lexer_allocs[i] = ptr; break; } } /* no free slots -> grow tracker slot array */ if(i >= tracker->lexer_allocs_size) { int j; void **dest; tracker = (lexer_alloc_tracker_header*)calloc(1, sizeof(lexer_alloc_tracker_header) + i * 2 * sizeof(void*)); if(!tracker) { if(ptr) free(ptr); YY_FATAL_ERROR("lexer_alloc: cannot grow tracker"); } tracker->lexer_allocs_size = i*2; /* copy data from old tracker */ dest = (void**)&tracker[1]; for(j = 0; jlexer_user_data); rq->lexer_user_data = tracker; } return ptr; #else return malloc(size); #endif } /* * sparql_lexer_realloc: * * INTERNAL - realloc replacement * Tracks allocated cells if LEXER_ALLOC_TRACKING is enabled. */ void *sparql_lexer_realloc(void *ptr, yy_size_t size, yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; void *newptr; if(!yyscanner) YY_FATAL_ERROR("lexer_realloc: yyscanner not initialized"); rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) YY_FATAL_ERROR("lexer_realloc: yyscanner extra not initialized"); tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) YY_FATAL_ERROR("lexer_realloc: no alloc tracker"); lexer_allocs = (void**)&tracker[1]; /* find the old slot for ptr */ for(i = 0; i < tracker->lexer_allocs_size; ++i) { if(lexer_allocs[i] == ptr) break; } /* no old slot -> error */ if(i >= tracker->lexer_allocs_size) YY_FATAL_ERROR("lexer_realloc: cell not in tracker"); /* realloc */ newptr = realloc(RASQAL_GOOD_CAST(char*, ptr), size); /* replace entry in tracker */ lexer_allocs[i] = newptr; return newptr; #else return realloc(RASQAL_GOOD_CAST(char*, ptr), size); #endif } /* * sparql_lexer_free: * * INTERNAL - free replacement. * Checks for NULL pointer to be freed unlike the default lexer free function. * Tracks allocated cells if LEXER_ALLOC_TRACKING is enabled. */ void sparql_lexer_free(void *ptr, yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; /* do not free NULL */ if(!ptr) return; /* free ptr even if we would encounter an error */ free(ptr); /* yyscanner is allocated with sparql_lexer_alloc() but it's never stored in the tracker * - we need yyscanner to access the tracker */ if(!yyscanner || ptr==yyscanner) return; rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) return; tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) return; lexer_allocs = (void**)&tracker[1]; /* find the slot for ptr */ for(i = 0; ilexer_allocs_size; ++i) { if(lexer_allocs[i]==ptr) break; } /* no slot -> error */ if(i >= tracker->lexer_allocs_size) YY_FATAL_ERROR("lexer_free: cell not in tracker"); /* remove entry from tracker */ lexer_allocs[i] = NULL; #else if(ptr) free(ptr); #endif } #ifdef RASQAL_DEBUG const char * sparql_token_print(rasqal_world* world, int token, YYSTYPE *lval) { static char buffer[2048]; if(!token) return "<>"; switch(token) { case SELECT: return "SELECT"; case FROM: return "FROM"; case WHERE: return "WHERE"; case PREFIX: return "PREFIX"; case DESCRIBE: return "DESCRIBE"; case CONSTRUCT: return "CONSTRUCT"; case ASK: return "ASK"; case DISTINCT: return "DISTINCT"; case LIMIT: return "LIMIT"; case UNION: return "UNION"; case OPTIONAL: return "OPTIONAL"; case BASE: return "BASE"; case BOUND: return "BOUND"; case STRLANG: return "STRLANG"; case STRDT: return "STRDT"; case STR: return "STR"; case LANG: return "LANG"; case DATATYPE: return "DATATYPE"; case ISURI: return "ISURI"; case ISBLANK: return "ISBLANK"; case ISLITERAL: return "ISLITERAL"; case GRAPH: return "GRAPH"; case NAMED: return "NAMED"; case FILTER: return "FILTER"; case OFFSET: return "OFFSET"; case A: return "a"; case ORDER: return "ORDER"; case BY: return "BY"; case REGEX: return "REGEX"; case ASC: return "ASC["; case DESC: return "DESC["; case LANGMATCHES: return "LANGMATCHES"; case ',': return ","; case '(': return "("; case ')': return ")"; case '[': return "["; case ']': return "]"; case '{': return "{"; case '}': return "}"; case '.': return "."; case ';': return ";"; case '?': return "?"; case '$': return "$"; case SC_AND: return "SC_AND"; case SC_OR: return "SC_OR"; case GE: return "GE"; case LE: return "LE"; case GT: return "GT"; case LT: return "LT"; case NEQ: return "NEQ"; case EQ: return "EQ"; case '/': return "/"; case '*': return "*"; case '-': return "-"; case '+': return "+"; case '!': return "!"; case EXPLAIN: return "EXPLAIN"; case GROUP: return "GROUP"; case HAVING: return "HAVING"; case COUNT: return "COUNT"; case SUM: return "SUM"; case AVG: return "AVG"; case MIN: return "MIN"; case MAX: return "MAX"; case DELETE: return "DELETE"; case INSERT: return "INSERT"; case WITH: return "WITH"; case CLEAR: return "CLEAR"; case CREATE: return "CREATE"; case SILENT: return "SILENT"; case DATA: return "DATA"; case DROP: return "DROP"; case LOAD: return "LOAD"; case INTO: return "INTO"; case IF: return "IF"; case LET: return "LET"; case AS: return "AS"; case ASSIGN: return ":="; case COALESCE: return "COALESCE"; case IRI: return "IRI"; case URI: return "URI"; case BNODE: return "BNODE"; case SAMPLE: return "SAMPLE"; case DEFAULT: return "DEFAULT"; case NOT: return "NOT"; case IN: return "IN"; case GROUP_CONCAT: return "GROUP_CONCAT"; case SEPARATOR: return "SEPARATOR"; case BINDINGS: return "BINDINGS"; case UNDEF: return "UNDEF"; case SERVICE: return "SERVICE"; case MINUS: return "MINUS"; case ISNUMERIC: return "isNUMERIC"; case YEAR: return "YEAR"; case MONTH: return "MONTH"; case DAY: return "DAY"; case HOURS: return "HOURS"; case MINUTES: return "MINUTES"; case SECONDS: return "SECONDS"; case TIMEZONE: return "TIMEZONE"; case CURRENT_DATETIME: return "CURRENT_DATETIME"; case NOW: return "NOW"; case FROM_UNIXTIME: return "FROM_UNIXTIME"; case TO_UNIXTIME: return "TO_UNIXTIME"; case CONCAT: return "CONCAT"; case STRLEN: return "STRLEN"; case SUBSTR: return "SUBSTR"; case UCASE: return "UCASE"; case LCASE: return "LCASE"; case STRSTARTS: return "STRSTARTS"; case STRENDS: return "STRENDS"; case CONTAINS: return "CONTAINS"; case ENCODE_FOR_URI: return "ENCODE_FOR_URI"; case TO: return "TO"; case ADD: return "ADD"; case MOVE: return "MOVE"; case COPY: return "COPY"; case ALL: return "ALL"; case TZ: return "TZ"; case RAND: return "RAND"; case BIND: return "BIND"; case ABS: return "ABS"; case ROUND: return "ROUND"; case CEIL: return "CEIL"; case FLOOR: return "FLOOR"; case MD5: return "MD5"; case SHA1: return "SHA1"; case SHA224: return "SHA224"; case SHA256: return "SHA256"; case SHA384: return "SHA384"; case SHA512: return "SHA512"; case STRBEFORE: return "STRBEFORE"; case STRAFTER: return "STRAFTER"; case REPLACE: return "REPLACE"; case UUID: return "UUID"; case STRUUID: return "STRUUID"; case VALUES: return "VALUES"; case INTEGER_LITERAL: case INTEGER_POSITIVE_LITERAL: case INTEGER_NEGATIVE_LITERAL: sprintf(buffer, "INTEGER_LITERAL(%d)", lval->literal->value.integer); return buffer; case DOUBLE_LITERAL: case DOUBLE_POSITIVE_LITERAL: case DOUBLE_NEGATIVE_LITERAL: sprintf(buffer, "DOUBLE_LITERAL(%g)", lval->floating); return buffer; case STRING: sprintf(buffer, "STRING(\"%s\")", lval->name); return buffer; case BOOLEAN_LITERAL: return (lval->literal->value.integer ? "BOOLEAN_LITERAL(true)" : "BOOLEAN_LITERAL(false)"); case URI_LITERAL: sprintf(buffer, "URI_LITERAL(%s)", raptor_uri_as_string(lval->uri) ); return buffer; case QNAME_LITERAL: sprintf(buffer, "QNAME_LITERAL(%s)", lval->name); return buffer; case URI_LITERAL_BRACE: sprintf(buffer, "URI_LITERAL_BRACE(%s)", raptor_uri_as_string(lval->uri) ); return buffer; case QNAME_LITERAL_BRACE: sprintf(buffer, "QNAME_LITERAL_BRACE(%s)", lval->name); return buffer; case IDENTIFIER: sprintf(buffer, "IDENTIFIER(%s)", lval->name); return buffer; case BLANK_LITERAL: sprintf(buffer, "BLANK_LITERAL(%s)", lval->name); return buffer; case DECIMAL_LITERAL: case DECIMAL_POSITIVE_LITERAL: case DECIMAL_NEGATIVE_LITERAL: sprintf(buffer, "DECIMAL_LITERAL(%s)", lval->literal->string); return buffer; case LANGTAG: sprintf(buffer, "LANGTAG(%s)", lval->name); return buffer; case HATHAT: return "HATHAT"; default: RASQAL_DEBUG2("UNKNOWN token %d - add a new case\n", token); abort(); } } #endif #ifdef STANDALONE static void sparql_token_free(rasqal_world* world, int token, YYSTYPE *lval) { if(!token) return; switch(token) { case INTEGER_LITERAL: case INTEGER_POSITIVE_LITERAL: case INTEGER_NEGATIVE_LITERAL: case DOUBLE_LITERAL: case DOUBLE_POSITIVE_LITERAL: case DOUBLE_NEGATIVE_LITERAL: case DECIMAL_POSITIVE_LITERAL: case DECIMAL_NEGATIVE_LITERAL: case DECIMAL_LITERAL: case BOOLEAN_LITERAL: rasqal_free_literal(lval->literal); break; case URI_LITERAL: case URI_LITERAL_BRACE: raptor_free_uri(lval->uri); break; case STRING: case IDENTIFIER: case BLANK_LITERAL: case PREFIX: RASQAL_FREE(char*, lval->name); break; case QNAME_LITERAL: if(lval->name) RASQAL_FREE(char*, lval->name); break; default: break; } } #define FILE_READ_BUF_SIZE 4096 int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); char *query_string = NULL; rasqal_query rq; rasqal_sparql_query_language sparql; yyscan_t scanner; int token = EOF; YYSTYPE lval; const unsigned char *uri_string; const char *filename = NULL; char *buf = NULL; size_t len; rasqal_world *world; FILE *fh; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) exit(1); filename = getenv("SPARQL_QUERY_FILE"); if(!filename) { if(argc != 2) { fprintf(stderr, "%s: Too many arguments.\n", program); fprintf(stderr, "SPARQL lexer test for Rasqal %s\n", rasqal_version_string); fprintf(stderr, "USAGE: %s SPARQL-QUERY-FILE\n", program); exit(1); } filename = argv[1]; } query_string = RASQAL_CALLOC(char*, FILE_READ_BUF_SIZE, 1); fh = fopen(filename, "r"); if(fh) { fread(query_string, FILE_READ_BUF_SIZE, 1, fh); fclose(fh); } else { fprintf(stderr, "%s: Cannot open file %s - %s\n", program, filename, strerror(errno)); exit(1); } memset(&rq, 0, sizeof(rq)); rq.world = world; memset(&sparql, 0, sizeof(sparql)); yylex_init(&sparql.scanner); scanner = sparql.scanner; len = strlen(RASQAL_GOOD_CAST(const char*, query_string)); buf = RASQAL_MALLOC(char*, len + 3); memcpy(buf, query_string, len); buf[len] = ' '; buf[len+1] = buf[len+2] = '\0'; /* YY_END_OF_BUFFER_CHAR; */ (void)sparql_lexer__scan_buffer(buf, len+3, scanner); sparql_lexer_set_extra(&rq, scanner); /* Initialise enough of the rasqal_query and locator to get error messages */ rq.context = &sparql; sparql.lineno = 1; rq.locator.file = filename; rq.locator.column = -1; uri_string = raptor_uri_filename_to_uri_string(filename); rq.base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory((void*)uri_string); while(1) { memset(&lval, 0, sizeof(lval)); if(sparql_lexer_get_text(scanner) != NULL) printf("yyinput '%s'\n", sparql_lexer_get_text(scanner)); token = yylex(&lval, scanner); #ifdef RASQAL_DEBUG printf("token %s\n", sparql_token_print(world, token, &lval)); #else printf("token %d\n", token); #endif sparql_token_free(world, token, &lval); if(!token || token == EOF) break; } if(buf) RASQAL_FREE(char*, buf); yylex_destroy(scanner); raptor_free_uri(rq.base_uri); RASQAL_FREE(char*, query_string); rasqal_free_world(world); if(rq.failed) return 1; return 0; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_expr_evaluate.c0000644000175000017500000013021312435141254015155 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_expr_evaluate.c - Rasqal expression evaluation * * 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr /* Enable evaluation debugging by defining RASQAL_DEBUG_EVAL */ /* #define RASQAL_DEBUG_EVAL 1 */ /* * rasqal_language_matches: * @lang_tag: language tag such as "en" or "en-US" or "ab-cd-ef" * @lang_range: language range such as "*" (SPARQL) or "en" or "ab-cd" * * INTERNAL - Match a language tag against a language range * * Returns true if @lang_range matches @lang_tag per * Matching of Language Tags [RFC4647] section 2.1 * RFC4647 defines a case-insensitive, hierarchical matching * algorithm which operates on ISO-defined subtags for language and * country codes, and user defined subtags. * * (Note: RFC3066 section 2.5 matching is identical to * RFC4647 section 3.3.1 Basic Filtering ) * * In SPARQL, a language-range of "*" matches any non-empty @lang_tag string. * See http://www.w3.org/TR/2007/WD-rdf-sparql-query-20070326/#func-langMatches * * Return value: non-0 if true */ int rasqal_language_matches(const unsigned char* lang_tag, const unsigned char* lang_range) { int b= 0; if(!(lang_tag && lang_range && *lang_tag && *lang_range)) { /* One of the arguments is NULL or the empty string */ return 0; } /* Now have two non-empty arguments */ /* Simple range string "*" matches anything excluding NULL/empty * lang_tag (checked above) */ if(lang_range[0] == '*') { if(!lang_range[1]) b = 1; return b; } while (1) { char tag_c = RASQAL_GOOD_CAST(char, tolower(*lang_tag++)); char range_c = RASQAL_GOOD_CAST(char, tolower(*lang_range++)); if ((!tag_c && !range_c) || (!range_c && tag_c == '-')) { /* EITHER * The end of both strings (thus everything previous matched * such as e.g. tag "fr-CA" matching range "fr-ca") * OR * The end of the range and end of the tag prefix (e.g. tag * "en-US" matching range "en") * means a match */ b = 1; break; } if (range_c != tag_c) { /* If a difference was found - including one of the * strings being shorter than the other, it means no match * (b is set to 0 above) */ break; } } return b; } /* * rasqal_expression_evaluate_strdt: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STRDT(expr) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_strdt(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal *l1 = NULL; rasqal_literal *l2 = NULL; const unsigned char* s = NULL; unsigned char* new_s = NULL; size_t len; raptor_uri* dt_uri = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; if(l1->language || l1->datatype) { /* not a simple literal so return NULL success */ rasqal_free_literal(l1); return NULL; } s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; dt_uri = rasqal_literal_as_uri(l2); if(dt_uri) { dt_uri = raptor_uri_copy(dt_uri); } else { const unsigned char *uri_string; uri_string = rasqal_literal_as_string_flags(l2, eval_context->flags, error_p); if(error_p && *error_p) goto failed; dt_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); if(!dt_uri) goto failed; } new_s =RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; memcpy(new_s, s, len + 1); rasqal_free_literal(l1); rasqal_free_literal(l2); /* after this new_s and dt_uri become owned by result */ return rasqal_new_string_literal(world, new_s, /* language */ NULL, dt_uri, /* qname */ NULL); failed: if(error_p) *error_p = 1; if(new_s) RASQAL_FREE(char*, new_s); if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); return NULL; } /* * rasqal_expression_evaluate_strlang: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STRLANG(expr) expression. * * Return value: A #rasqal_literal string value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_strlang(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal *l1 = NULL; rasqal_literal *l2 = NULL; const unsigned char* s = NULL; const unsigned char* lang = NULL; unsigned char* new_s = NULL; unsigned char* new_lang = NULL; size_t len; size_t lang_len; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; if(l1->language || l1->datatype) { /* not a simple literal so return NULL success */ rasqal_free_literal(l1); return NULL; } s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; lang = rasqal_literal_as_counted_string(l2, &lang_len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; memcpy(new_s, s, len + 1); new_lang = RASQAL_MALLOC(unsigned char*, lang_len + 1); if(!new_lang) goto failed; memcpy(new_lang, lang, lang_len + 1); rasqal_free_literal(l1); rasqal_free_literal(l2); /* after this new_s and new_lang become owned by result */ return rasqal_new_string_literal(world, new_s, RASQAL_GOOD_CAST(const char*, new_lang), /*datatype */ NULL, /* qname */ NULL); failed: if(error_p) *error_p = 1; if(new_s) RASQAL_FREE(char*, new_s); if(l1) rasqal_free_literal(l1); if(l2) rasqal_free_literal(l2); return NULL; } /* * rasqal_expression_evaluate_istype: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_ISBLANK, RASQAL_EXPR_ISURI, * RASQAL_EXPR_ISLITERAL and RASQAL_EXPR_ISNUMERIC (expr) * expressions. * * Return value: A #rasqal_literal boolean value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_istype(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; int free_literal = 1; rasqal_variable *v; int b; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; v = rasqal_literal_as_variable(l1); if(v) { rasqal_free_literal(l1); l1 = v->value; /* don't need v after this */ free_literal = 0; if(!l1) goto failed; } if(e->op == RASQAL_EXPR_ISBLANK) b = (l1->type == RASQAL_LITERAL_BLANK); else if(e->op == RASQAL_EXPR_ISLITERAL) b = (rasqal_literal_get_rdf_term_type(l1) == RASQAL_LITERAL_STRING); else if(e->op == RASQAL_EXPR_ISURI) b =(l1->type == RASQAL_LITERAL_URI); else b = (rasqal_literal_is_numeric(l1)); if(free_literal) rasqal_free_literal(l1); return rasqal_new_boolean_literal(world, b); failed: if(error_p) *error_p = 1; if(free_literal && l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_bound: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_BOUND (variable) expressions. * * Return value: A #rasqal_literal boolean value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_bound(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; rasqal_variable* v; /* Do not use rasqal_expression_evaluate() here since * we need to check the argument is a variable, and * that function will flatten such thing to literals * as early as possible. See (FLATTEN_LITERAL) below */ if(!e->arg1 || e->arg1->op != RASQAL_EXPR_LITERAL) goto failed; l1 = e->arg1->literal; if(!l1 || l1->type != RASQAL_LITERAL_VARIABLE) goto failed; v = rasqal_literal_as_variable(l1); if(!v) goto failed; return rasqal_new_boolean_literal(world, (v->value != NULL)); failed: if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_if: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_IF (condition, true expr, false expr) expressions. * * Return value: A #rasqal_literal value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_if(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_literal* l1; int b; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; /* IF condition */ b = rasqal_literal_as_boolean(l1, error_p); rasqal_free_literal(l1); if(error_p && *error_p) goto failed; /* condition is true: evaluate arg2 or false: evaluate arg3 */ return rasqal_expression_evaluate2(b ? e->arg2 : e->arg3, eval_context, error_p); failed: if(error_p) *error_p = 1; return NULL; } /* * rasqal_expression_evaluate_sameterm: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_SAMETERM (expr1, expr2) expressions. * * Return value: A #rasqal_literal boolean value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_sameterm(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; rasqal_literal* l2; int b; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) goto failed; b = rasqal_literal_same_term(l1, l2); #ifdef RASQAL_DEBUG_EVAL RASQAL_DEBUG2("rasqal_literal_same_term() returned: %d\n", b); #endif rasqal_free_literal(l1); rasqal_free_literal(l2); return rasqal_new_boolean_literal(world, b); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_in_set: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_IN and RASQAL_EXPR_NOT_IN (expr, * expr list) expression. * * Return value: A #rasqal_literal boolean value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_in_set(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; int size = raptor_sequence_size(e->args); int i; rasqal_literal* l1; int found = 0; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; for(i = 0; i < size; i++) { rasqal_expression* arg_e; rasqal_literal* arg_literal; arg_e = (rasqal_expression*)raptor_sequence_get_at(e->args, i); arg_literal = rasqal_expression_evaluate2(arg_e, eval_context, error_p); if(!arg_literal) goto failed; found = (rasqal_literal_equals_flags(l1, arg_literal, eval_context->flags, error_p) != 0); #ifdef RASQAL_DEBUG_EVAL if(error_p && *error_p) RASQAL_DEBUG1("rasqal_literal_equals_flags() returned: FAILURE\n"); else RASQAL_DEBUG2("rasqal_literal_equals_flags() returned: %d\n", found); #endif rasqal_free_literal(arg_literal); if(error_p && *error_p) goto failed; if(found) /* found - terminate search */ break; } rasqal_free_literal(l1); if(e->op == RASQAL_EXPR_NOT_IN) found = !found; return rasqal_new_boolean_literal(world, found); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_coalesce: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_COALESCE (expr list) expressions. * * Return value: A #rasqal_literal value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_coalesce(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { int size = raptor_sequence_size(e->args); int i; for(i = 0; i < size; i++) { rasqal_expression* arg_e; arg_e = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(arg_e) { int my_error = 0; rasqal_literal* result; result = rasqal_expression_evaluate2(arg_e, eval_context, &my_error); if(!my_error && result) return result; } } /* No arguments evaluated to an RDF term, return an error (NULL) */ return NULL; } /* * rasqal_expression_evaluate_str: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_STR (literal expr) expression. * * Return value: A #rasqal_literal value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_str(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1 = NULL; rasqal_literal* result = NULL; const unsigned char *s; size_t len; unsigned char *new_s; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; /* Note: flags removes RASQAL_COMPARE_XQUERY as this is the * explicit stringify operation and we want URIs as strings. */ s = rasqal_literal_as_counted_string(l1, &len, (eval_context->flags & ~RASQAL_COMPARE_XQUERY), error_p); if((error_p && *error_p) || !s) goto failed; new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; memcpy(RASQAL_GOOD_CAST(char*, new_s), RASQAL_GOOD_CAST(const char*, s), len + 1); /* after this new_s is owned by result */ result = rasqal_new_string_literal(world, new_s, NULL, NULL, NULL); if(l1) rasqal_free_literal(l1); return result; failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_lang: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_LANG (literal expr) expression. * * Return value: A #rasqal_literal value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_lang(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; int free_literal = 1; rasqal_variable* v = NULL; unsigned char* new_s; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; v = rasqal_literal_as_variable(l1); if(v) { rasqal_free_literal(l1); l1 = v->value; /* don't need v after this */ free_literal = 0; if(!l1) goto failed; } if(rasqal_literal_get_rdf_term_type(l1) != RASQAL_LITERAL_STRING) goto failed; if(l1->language) { size_t len = strlen(l1->language); new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; memcpy(RASQAL_GOOD_CAST(char*, new_s), l1->language, len + 1); } else { new_s = RASQAL_MALLOC(unsigned char*, 1); if(!new_s) goto failed; *new_s = '\0'; } if(free_literal) rasqal_free_literal(l1); /* after this new_s is owned by result */ return rasqal_new_string_literal(world, new_s, NULL, NULL, NULL); failed: if(error_p) *error_p = 1; if(free_literal) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_datatype: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_DATATYPE (string literal) expression. * * Return value: A #rasqal_literal URI value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_datatype(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; int free_literal = 1; rasqal_variable* v = NULL; raptor_uri* dt_uri = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; v = rasqal_literal_as_variable(l1); if(v) { rasqal_free_literal(l1); l1 = v->value; /* don't need v after this */ free_literal = 0; if(!l1) goto failed; } if(rasqal_literal_get_rdf_term_type(l1) != RASQAL_LITERAL_STRING) goto failed; if(l1->language) goto failed; /* The datatype of a plain literal is xsd:string */ dt_uri = l1->datatype; if(!dt_uri && l1->type == RASQAL_LITERAL_STRING) dt_uri = rasqal_xsd_datatype_type_to_uri(l1->world, RASQAL_LITERAL_XSD_STRING); if(!dt_uri) goto failed; dt_uri = raptor_uri_copy(dt_uri); if(free_literal) rasqal_free_literal(l1); /* after this dt_uri is owned by result */ return rasqal_new_uri_literal(world, dt_uri); failed: if(error_p) *error_p = 1; if(free_literal) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_uri_constructor: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_URI and RASQAL_EXPR_IRI (string) * expressions. * * Return value: A #rasqal_literal URI value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_uri_constructor(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal* l1; raptor_uri* dt_uri; const unsigned char *s; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; s = rasqal_literal_as_string_flags(l1, eval_context->flags, error_p); if(error_p && *error_p) goto failed; dt_uri = raptor_new_uri_relative_to_base(world->raptor_world_ptr, eval_context->base_uri, s); rasqal_free_literal(l1); l1 = NULL; if(!dt_uri) goto failed; /* after this dt_uri is owned by the result literal */ return rasqal_new_uri_literal(world, dt_uri); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_bnode_constructor: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate RASQAL_EXPR_BNODE (string) expression. * * Return value: A #rasqal_literal blank node value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_bnode_constructor(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_literal *l1 = NULL; unsigned char *new_s = NULL; if(e->arg1) { const unsigned char *s; size_t len; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_s) goto failed; memcpy(RASQAL_GOOD_CAST(char*, new_s), s, len + 1); rasqal_free_literal(l1); } else { new_s = rasqal_world_generate_bnodeid(world, NULL); if(!new_s) goto failed; } /* after this new_s is owned by the result */ return rasqal_new_simple_literal(world, RASQAL_LITERAL_BLANK, new_s); failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /** * rasqal_expression_evaluate2: * @e: The expression to evaluate. * @eval_context: expression context * @error_p: pointer to error return flag * * Evaluate a #rasqal_expression tree in the context of a * #rasqal_evaluation_context to give a #rasqal_literal result or error. * * Return value: a #rasqal_literal value or NULL (a valid value). @error_p is set to non-0 on failure. **/ rasqal_literal* rasqal_expression_evaluate2(rasqal_expression* e, rasqal_evaluation_context* eval_context, int *error_p) { rasqal_world *world; int flags; rasqal_literal* result = NULL; rasqal_literal *l1; rasqal_literal *l2; /* pack vars from different switch cases in unions to save some stack space */ union { struct { int e1; int e2; } errs; struct { int dummy_do_not_mask_e; int free_literal; } flags; int e; } errs; union { struct { int b1; int b2; } bools; int b; int i; raptor_uri *dt_uri; const unsigned char *s; unsigned char *new_s; rasqal_variable *v; rasqal_expression *e; struct { void *dummy_do_not_mask; int found; } flags; rasqal_xsd_datetime* dt; struct timeval *tv; raptor_stringbuffer* sb; } vars; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(e, rasqal_expression, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(eval_context, rasqal_evaluation_context, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(error_p, intp, NULL); world = eval_context->world; flags = eval_context->flags; errs.e = 0; #ifdef RASQAL_DEBUG_EVAL RASQAL_DEBUG2("evaluating expression %p: ", e); rasqal_expression_print(e, stderr); fprintf(stderr, "\n"); #endif switch(e->op) { case RASQAL_EXPR_AND: errs.errs.e1 = 0; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, &errs.errs.e1); if(errs.errs.e1) { vars.bools.b1 = 0; } else { vars.bools.b1 = rasqal_literal_as_boolean(l1, &errs.errs.e1); rasqal_free_literal(l1); } errs.errs.e2 = 0; l1 = rasqal_expression_evaluate2(e->arg2, eval_context, &errs.errs.e2); if(errs.errs.e2) { vars.bools.b2 = 0; } else { vars.bools.b2 = rasqal_literal_as_boolean(l1, &errs.errs.e2); rasqal_free_literal(l1); } /* See http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/#truthTable */ if(!errs.errs.e1 && !errs.errs.e2) { /* No type error, answer is A && B */ vars.b = vars.bools.b1 && vars.bools.b2; /* don't need b1,b2 anymore */ } else { if((!vars.bools.b1 && errs.errs.e2) || (errs.errs.e1 && vars.bools.b2)) /* F && E => F. E && F => F. */ vars.b = 0; else /* Otherwise E */ goto failed; } result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_OR: errs.errs.e1 = 0; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, &errs.errs.e1); if(errs.errs.e1) { vars.bools.b1 = 0; } else { vars.bools.b1 = rasqal_literal_as_boolean(l1, &errs.errs.e1); rasqal_free_literal(l1); } errs.errs.e2 = 0; l1 = rasqal_expression_evaluate2(e->arg2, eval_context, &errs.errs.e2); if(errs.errs.e2) { vars.bools.b2 = 0; } else { vars.bools.b2 = rasqal_literal_as_boolean(l1, &errs.errs.e2); rasqal_free_literal(l1); } /* See http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/#truthTable */ if(!errs.errs.e1 && !errs.errs.e2) { /* No type error, answer is A || B */ vars.b = vars.bools.b1 || vars.bools.b2; /* don't need b1,b2 anymore */ } else { if((vars.bools.b1 && errs.errs.e2) || (errs.errs.e1 && vars.bools.b2)) /* T || E => T. E || T => T */ vars.b = 1; else /* Otherwise E */ goto failed; } result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_EQ: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } /* FIXME - this should probably be checked at literal creation * time */ if(!rasqal_xsd_datatype_check(l1->type, l1->string, flags) || !rasqal_xsd_datatype_check(l2->type, l2->string, flags)) { #ifdef RASQAL_DEBUG_EVAL RASQAL_DEBUG1("One of the literals was invalid\n"); #endif goto failed; } vars.b = (rasqal_literal_equals_flags(l1, l2, flags, &errs.e) != 0); #ifdef RASQAL_DEBUG_EVAL if(errs.e) RASQAL_DEBUG1("rasqal_literal_equals_flags returned: FAILURE\n"); else RASQAL_DEBUG2("rasqal_literal_equals_flags returned: %d\n", vars.b); #endif rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_NEQ: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_not_equals_flags(l1, l2, flags, &errs.e) != 0); #ifdef RASQAL_DEBUG_EVAL if(errs.e) RASQAL_DEBUG1("rasqal_literal_not_equals_flags returned: FAILURE\n"); else RASQAL_DEBUG2("rasqal_literal_not_equals_flags returned: %d\n", vars.b); #endif rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_LT: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_compare(l1, l2, flags, &errs.e) < 0); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_GT: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_compare(l1, l2, flags, &errs.e) > 0); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_LE: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_compare(l1, l2, flags, &errs.e) <= 0); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_GE: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_compare(l1, l2, flags, &errs.e) >= 0); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_UMINUS: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; result = rasqal_literal_negate(l1, &errs.e); rasqal_free_literal(l1); if(errs.e) goto failed; break; case RASQAL_EXPR_BOUND: result = rasqal_expression_evaluate_bound(e, eval_context, error_p); break; case RASQAL_EXPR_STR: result = rasqal_expression_evaluate_str(e, eval_context, error_p); break; case RASQAL_EXPR_LANG: result = rasqal_expression_evaluate_lang(e, eval_context, error_p); break; case RASQAL_EXPR_LANGMATCHES: result = rasqal_expression_evaluate_langmatches(e, eval_context, error_p); break; case RASQAL_EXPR_DATATYPE: result = rasqal_expression_evaluate_datatype(e, eval_context, error_p); break; case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ISNUMERIC: result = rasqal_expression_evaluate_istype(e, eval_context, error_p); break; case RASQAL_EXPR_PLUS: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } result = rasqal_literal_add(l1, l2, &errs.e); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; break; case RASQAL_EXPR_MINUS: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } result = rasqal_literal_subtract(l1, l2, &errs.e); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; break; case RASQAL_EXPR_STAR: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } result = rasqal_literal_multiply(l1, l2, &errs.e); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; break; case RASQAL_EXPR_SLASH: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } result = rasqal_literal_divide(l1, l2, &errs.e); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; break; case RASQAL_EXPR_REM: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.i = rasqal_literal_as_integer(l2, &errs.errs.e2); /* error if divisor is zero */ if(!vars.i) errs.errs.e2 = 1; else vars.i = rasqal_literal_as_integer(l1, &errs.errs.e1) % vars.i; rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.errs.e1 || errs.errs.e2) goto failed; result = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, vars.i); break; case RASQAL_EXPR_STR_EQ: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_compare(l1, l2, flags | RASQAL_COMPARE_NOCASE, &errs.e) == 0); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_STR_NEQ: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; l2 = rasqal_expression_evaluate2(e->arg2, eval_context, error_p); if((error_p && *error_p) || !l2) { rasqal_free_literal(l1); goto failed; } vars.b = (rasqal_literal_compare(l1, l2, flags | RASQAL_COMPARE_NOCASE, &errs.e) != 0); rasqal_free_literal(l1); rasqal_free_literal(l2); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_TILDE: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; vars.i= ~ rasqal_literal_as_integer(l1, &errs.e); rasqal_free_literal(l1); if(errs.e) goto failed; result = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, vars.i); break; case RASQAL_EXPR_BANG: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; vars.b = ! rasqal_literal_as_boolean(l1, &errs.e); rasqal_free_literal(l1); if(errs.e) goto failed; result = rasqal_new_boolean_literal(world, vars.b); break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: case RASQAL_EXPR_REGEX: result = rasqal_expression_evaluate_strmatch(e, eval_context, error_p); break; case RASQAL_EXPR_LITERAL: /* flatten any literal to a value as soon as possible - this * removes variables from expressions the first time they are seen. * (FLATTEN_LITERAL) */ result = rasqal_new_literal_from_literal(rasqal_literal_value(e->literal)); break; case RASQAL_EXPR_FUNCTION: rasqal_log_warning_simple(world, RASQAL_WARNING_LEVEL_NOT_IMPLEMENTED, eval_context->locator, "No function expressions support at present. Returning false."); result = rasqal_new_boolean_literal(world, 0); break; case RASQAL_EXPR_CAST: l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; result = rasqal_literal_cast(l1, e->name, flags, &errs.e); rasqal_free_literal(l1); if(errs.e) goto failed; break; case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: result = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); break; case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_GROUP_CONCAT: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, eval_context->locator, "Aggregate expressions cannot be evaluated in a general scalar expression."); errs.e = 1; goto failed; case RASQAL_EXPR_VARSTAR: /* constants */ break; case RASQAL_EXPR_SAMETERM: result = rasqal_expression_evaluate_sameterm(e, eval_context, error_p); break; case RASQAL_EXPR_CONCAT: result = rasqal_expression_evaluate_concat(e, eval_context, error_p); break; case RASQAL_EXPR_COALESCE: result = rasqal_expression_evaluate_coalesce(e, eval_context, error_p); break; case RASQAL_EXPR_IF: result = rasqal_expression_evaluate_if(e, eval_context, error_p); break; case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: result = rasqal_expression_evaluate_uri_constructor(e, eval_context, error_p); break; case RASQAL_EXPR_STRLANG: result = rasqal_expression_evaluate_strlang(e, eval_context, error_p); break; case RASQAL_EXPR_STRDT: result = rasqal_expression_evaluate_strdt(e, eval_context, error_p); break; case RASQAL_EXPR_BNODE: result = rasqal_expression_evaluate_bnode_constructor(e, eval_context, error_p); break; case RASQAL_EXPR_IN: result = rasqal_expression_evaluate_in_set(e, eval_context, error_p); break; case RASQAL_EXPR_NOT_IN: result = rasqal_expression_evaluate_in_set(e, eval_context, error_p); break; case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: result = rasqal_expression_evaluate_datetime_part(e, eval_context, error_p); break; case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: result = rasqal_expression_evaluate_now(e, eval_context, error_p); break; case RASQAL_EXPR_TO_UNIXTIME: result = rasqal_expression_evaluate_to_unixtime(e, eval_context, error_p); break; case RASQAL_EXPR_FROM_UNIXTIME: result = rasqal_expression_evaluate_from_unixtime(e, eval_context, error_p); break; case RASQAL_EXPR_RAND: result = rasqal_expression_evaluate_rand(e, eval_context, error_p); break; case RASQAL_EXPR_STRLEN: result = rasqal_expression_evaluate_strlen(e, eval_context, error_p); break; case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: result = rasqal_expression_evaluate_set_case(e, eval_context, error_p); break; case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: result = rasqal_expression_evaluate_str_prefix_suffix(e, eval_context, error_p); break; case RASQAL_EXPR_TIMEZONE: result = rasqal_expression_evaluate_datetime_timezone(e, eval_context, error_p); break; case RASQAL_EXPR_TZ: result = rasqal_expression_evaluate_datetime_tz(e, eval_context, error_p); break; case RASQAL_EXPR_ENCODE_FOR_URI: result = rasqal_expression_evaluate_encode_for_uri(e, eval_context, error_p); break; case RASQAL_EXPR_SUBSTR: result = rasqal_expression_evaluate_substr(e, eval_context, error_p); break; case RASQAL_EXPR_STRBEFORE: result = rasqal_expression_evaluate_strbefore(e, eval_context, error_p); break; case RASQAL_EXPR_STRAFTER: result = rasqal_expression_evaluate_strafter(e, eval_context, error_p); break; case RASQAL_EXPR_REPLACE: result = rasqal_expression_evaluate_replace(e, eval_context, error_p); break; case RASQAL_EXPR_ABS: result = rasqal_expression_evaluate_abs(e, eval_context, error_p); break; case RASQAL_EXPR_ROUND: result = rasqal_expression_evaluate_round(e, eval_context, error_p); break; case RASQAL_EXPR_CEIL: result = rasqal_expression_evaluate_ceil(e, eval_context, error_p); break; case RASQAL_EXPR_FLOOR: result = rasqal_expression_evaluate_floor(e, eval_context, error_p); break; case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: result = rasqal_expression_evaluate_digest(e, eval_context, error_p); break; case RASQAL_EXPR_UUID: result = rasqal_expression_evaluate_uriuuid(e, eval_context, error_p); break; case RASQAL_EXPR_STRUUID: result = rasqal_expression_evaluate_struuid(e, eval_context, error_p); break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL3("Unknown operation %s (%u)", rasqal_expression_op_label(e->op), e->op); } got_result: #ifdef RASQAL_DEBUG_EVAL RASQAL_DEBUG2("result of %p: ", e); rasqal_expression_print(e, stderr); fputs( ": ", stderr); if(error_p && *error_p) fputs("FAILURE",stderr); else rasqal_literal_print(result, stderr); fputc('\n', stderr); #endif return result; failed: *error_p = 1; if(result) { rasqal_free_literal(result); result = NULL; } goto got_result; } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_expression_evaluate: * @world: #rasqal_world * @locator: error locator (or NULL) * @e: The expression to evaluate. * @flags: Flags for rasqal_literal_compare() and RASQAL_COMPARE_NOCASE for string matches. * * Evaluate a #rasqal_expression tree to give a #rasqal_literal result * or error. * * @Deprecated: use rasqal_expression_evaluate2() using a #rasqal_evaluation_context * * Return value: a #rasqal_literal value or NULL on failure. **/ rasqal_literal* rasqal_expression_evaluate(rasqal_world *world, raptor_locator *locator, rasqal_expression* e, int flags) { rasqal_evaluation_context context; /* static */ int error = 0; rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(e, rasqal_expression, NULL); memset(&context, '\0', sizeof(context)); context.world = world; context.locator = locator; context.flags = flags; l = rasqal_expression_evaluate2(e, &context, &error); if(error) return NULL; return l; } #endif rasqal-0.9.33/src/rasqal_format_json.c0000644000175000017500000002346712435141254014646 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_format_json.c - Format results in SPARQL JSON * * Copyright (C) 2003-2009, 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" static void rasqal_iostream_write_json_boolean(raptor_iostream* iostr, const char* name, int json_bool) { raptor_iostream_write_byte('\"', iostr); raptor_iostream_string_write(name, iostr); raptor_iostream_counted_string_write("\" : ",4, iostr); if(json_bool) raptor_iostream_counted_string_write("true", 4, iostr); else raptor_iostream_counted_string_write("false", 5, iostr); } /* * rasqal_query_results_write_json1: * @iostr: #raptor_iostream to write the query to * @results: #rasqal_query_results query results format * @base_uri: #raptor_uri base URI of the output format * * Write a JSON version of the query results format to an * iostream in a format - INTERNAL. * * If the writing succeeds, the query results will be exhausted. * * Return value: non-0 on failure **/ static int rasqal_query_results_write_json1(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_world* world = rasqal_query_results_get_world(results); rasqal_query* query = rasqal_query_results_get_query(results); int i; int row_comma; int column_comma = 0; rasqal_query_results_type type; type = rasqal_query_results_get_type(results); if(type != RASQAL_QUERY_RESULTS_BINDINGS && type != RASQAL_QUERY_RESULTS_BOOLEAN) { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Cannot write JSON for %s query result format", rasqal_query_results_type_label(type)); return 1; } raptor_iostream_counted_string_write("{\n", 2, iostr); /* Header */ raptor_iostream_counted_string_write(" \"head\": {\n", 12, iostr); if(rasqal_query_results_is_bindings(results)) { raptor_iostream_counted_string_write(" \"vars\": [ ", 14, iostr); for(i = 0; 1; i++) { const unsigned char *name; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; /* 'x', */ if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); raptor_iostream_write_byte('\"', iostr); raptor_iostream_string_write(name, iostr); raptor_iostream_write_byte('\"', iostr); } raptor_iostream_counted_string_write(" ]\n", 3, iostr); } /* FIXME - could add link inside 'head': */ /* End Header */ raptor_iostream_counted_string_write(" },\n", 5, iostr); /* Boolean Results */ if(rasqal_query_results_is_boolean(results)) { raptor_iostream_counted_string_write(" ", 2, iostr); rasqal_iostream_write_json_boolean(iostr, "boolean", rasqal_query_results_get_boolean(results)); goto results3done; } /* Variable Binding Results */ raptor_iostream_counted_string_write(" \"results\": {\n", 15, iostr); if(query) { raptor_iostream_counted_string_write(" ", 4, iostr); rasqal_iostream_write_json_boolean(iostr, "ordered", (rasqal_query_get_order_condition(query, 0) != NULL)); raptor_iostream_counted_string_write(",\n", 2, iostr); raptor_iostream_counted_string_write(" ", 4, iostr); rasqal_iostream_write_json_boolean(iostr, "distinct", rasqal_query_get_distinct(query)); raptor_iostream_counted_string_write(",\n", 2, iostr); } raptor_iostream_counted_string_write(" \"bindings\" : [\n", 19, iostr); row_comma = 0; while(!rasqal_query_results_finished(results)) { if(row_comma) raptor_iostream_counted_string_write(",\n", 2, iostr); /* Result row */ raptor_iostream_counted_string_write(" {\n", 8, iostr); column_comma = 0; for(i = 0; i */ raptor_iostream_counted_string_write(" \"", 9, iostr); raptor_iostream_string_write(name, iostr); raptor_iostream_counted_string_write("\" : { ", 6, iostr); if(!l) { raptor_iostream_string_write("\"type\": \"unbound\", \"value\": null", iostr); } else { const unsigned char* str; size_t len; switch(l->type) { case RASQAL_LITERAL_URI: raptor_iostream_string_write("\"type\": \"uri\", \"value\": \"", iostr); str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->value.uri, &len)); raptor_string_ntriples_write(str, len, '"', iostr); raptor_iostream_write_byte('"', iostr); break; case RASQAL_LITERAL_BLANK: raptor_iostream_string_write("\"type\": \"bnode\", \"value\": \"", iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_write_byte('"', iostr); break; case RASQAL_LITERAL_STRING: raptor_iostream_string_write("\"type\": \"literal\", \"value\": \"", iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_write_byte('"', iostr); if(l->language) { raptor_iostream_string_write(",\n \"xml:lang\" : \"", iostr); raptor_iostream_string_write(RASQAL_GOOD_CAST(const unsigned char*, l->language), iostr); raptor_iostream_write_byte('"', iostr); } if(l->datatype) { raptor_iostream_string_write(",\n \"datatype\" : \"", iostr); str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->datatype, &len)); raptor_string_ntriples_write(str, len, '"', iostr); raptor_iostream_write_byte('"', iostr); } break; case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: case RASQAL_LITERAL_UNKNOWN: default: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot turn literal type %u into XML", l->type); } } /* End Binding */ raptor_iostream_counted_string_write(" }", 2, iostr); column_comma = 1; } /* End Result Row */ raptor_iostream_counted_string_write("\n }", 8, iostr); row_comma = 1; rasqal_query_results_next(results); } raptor_iostream_counted_string_write("\n ]\n }", 10, iostr); results3done: /* end sparql */ raptor_iostream_counted_string_write("\n}\n", 3, iostr); return 0; } static const char* const json_names[] = { "json", NULL}; static const char* const json_uri_strings[] = { "http://www.w3.org/ns/formats/SPARQL_Results_JSON", /* W3C Working Draft */ "http://www.w3.org/TR/sparql11-results-json/", /* W3C Working Group Note */ "http://www.w3.org/TR/rdf-sparql-json-res/", /* Released DAWG WG results in JSON */ "http://www.w3.org/TR/2007/NOTE-rdf-sparql-json-res-20070618/", /* URIs from 0.9.16 or earlier */ "http://www.w3.org/2001/sw/DataAccess/json-sparql/", "http://www.mindswap.org/%7Ekendall/sparql-results-json/", NULL }; static const raptor_type_q json_types[] = { { "application/sparql-results+json", 31, 10}, { "application/json", 16, 10}, { NULL, 0, 0} }; static int rasqal_query_results_json_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = json_names; factory->desc.mime_types = json_types; factory->desc.label = "SPARQL JSON Query Results"; factory->desc.uri_strings = json_uri_strings; factory->desc.flags = 0; factory->write = rasqal_query_results_write_json1; factory->get_rowsource = NULL; return rc; } int rasqal_init_result_format_json(rasqal_world* world) { return !rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_json_register_factory); } rasqal-0.9.33/src/rasqal_double.c0000644000175000017500000000453111772470727013603 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_double.c - Rasqal double utilities * * Copyright (C) 2012, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif /* for frexp(), fabs() and ldexp() - all C99 */ #ifdef HAVE_MATH_H #include #endif /* for double and float constants */ #ifdef HAVE_FLOAT_H #include #endif #include "rasqal.h" #include "rasqal_internal.h" /* * rasqal_double_approximately_compare: * @a: double * @b: double * * INTERNAL - Compare two doubles approximately * * Approach from Section 4.2.2 of Seminumerical Algorithms (3rd * edition) by D. E. Knuth * * Return values: <0 if a0 if a>b */ int rasqal_double_approximately_compare(double a, double b) { int exponent; double delta; double difference; /* Get larger exponent of a or b into exponent */ frexp(fabs(a) > fabs(b) ? a : b, &exponent); /* Multiply epsilon by 2^exponent to get delta */ delta = ldexp(RASQAL_DOUBLE_EPSILON, exponent); /* * Take the difference and evaluate like this: * * < delta | -delta .... delta | > delta * -------------------------------------- * LESS | <--- 'EQUAL' ---> | GREATER */ difference = (a - b); if(difference > delta) return 1; else if(difference < -delta) return -1; else return 0; } /* * rasqal_double_approximately_equal: * @a: double * @b: double * * INTERNAL - Compare two doubles for approximate equality * * Return values: non-0 if approximately equal */ int rasqal_double_approximately_equal(double a, double b) { return !rasqal_double_approximately_compare(a, b); } rasqal-0.9.33/src/rasqal_query_test.c0000644000175000017500000001375012434455625014534 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_query_test.c - Rasqal RDF Query Tests * * Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef RASQAL_QUERY_SPARQL #define QUERY_LANGUAGE "sparql" #define QUERY_FORMAT "PREFIX rdf: \ PREFIX foaf: \ SELECT $person \ FROM <%s> \ WHERE \ { $person $x foaf:Person }" #else #define NO_QUERY_LANGUAGE #endif #define EXPECTED_RESULTS_COUNT 1 #ifdef NO_QUERY_LANGUAGE int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); fprintf(stderr, "%s: No supported query language available, skipping test\n", program); return(0); } #else int main(int argc, char **argv) { const char *program=rasqal_basename(argv[0]); rasqal_query *query = NULL; rasqal_query_results *results = NULL; raptor_uri *base_uri; unsigned char *data_string; unsigned char *uri_string; const char *query_language_name=QUERY_LANGUAGE; const char *query_format=QUERY_FORMAT; unsigned char *query_string; int count; rasqal_world *world; const char *data_file; world=rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } if((data_file = getenv("RDF_DATA_FILE"))) { /* got data from environment */ } else { if(argc != 2) { fprintf(stderr, "USAGE: %s data-filename\n", program); return(1); } data_file = argv[1]; } data_string = raptor_uri_filename_to_uri_string(data_file); query_string = RASQAL_MALLOC(unsigned char*, strlen(RASQAL_GOOD_CAST(const char*, data_string)) + strlen(query_format) + 1); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(RASQAL_GOOD_CAST(char*, query_string), query_format, data_string); #pragma GCC diagnostic pop raptor_free_memory(data_string); uri_string=raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory(uri_string); query=rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); return(1); } printf("%s: preparing %s query\n", program, query_language_name); if(rasqal_query_prepare(query, query_string, base_uri)) { fprintf(stderr, "%s: %s query prepare FAILED\n", program, query_language_name); return(1); } RASQAL_FREE(char*, query_string); printf("%s: executing query #1\n", program); results=rasqal_query_execute(query); if(!results) { fprintf(stderr, "%s: query execution 1 FAILED\n", program); return(1); } count=0; while(results && !rasqal_query_results_finished(results)) { int i; for(i=0; i #endif #include #include #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif /* Rasqal includes */ #include "rasqal.h" #include "rasqal_internal.h" /* from raptor_uri.c */ #if RAPTOR_VERSION >= 20011 #else static int rasqal_uri_uri_string_is_absolute(const unsigned char* uri_string) { const unsigned char* s = uri_string; /* * scheme = alpha *( alpha | digit | "+" | "-" | "." ) * RFC 2396 section 3.1 Scheme Component */ if(*s && isalpha((int)*s)) { s++; while(*s && (isalnum((int)*s) || (*s == '+') || (*s == '-') || (*s == '.'))) s++; if(*s == ':') return 1; } return 0; } #define raptor_uri_uri_string_is_absolute rasqal_uri_uri_string_is_absolute #endif #if RAPTOR_VERSION >= 20012 #else /**********************************************************************/ /** Internals imported from raptor */ /* turtle_common.c */ static int rasqal_turtle_check_uri_string(unsigned char *string) { unsigned char c; if(!string) return 0; while((c = *string++)) { if(((c <= 0x20) || c == '<' || c == '>' || c == '"' || c == '{' || c == '}' || c == '|' || c == '^' || c == '`' || c == '\\')) return 0; } return 1; } /* raptor_general.c */ static int rasqal_check_ordinal(const unsigned char *name) { int ordinal= -1; unsigned char c; while((c=*name++)) { if(c < '0' || c > '9') return -1; if(ordinal <0) ordinal = 0; ordinal *= 10; ordinal += (c - '0'); } return ordinal; } /**********************************************************************/ /* raptor_ntriples.c converted to use above */ /* These are for 7-bit ASCII and not locale-specific */ #define IS_ASCII_ALPHA(c) (((c) > 0x40 && (c) < 0x5B) || ((c) > 0x60 && (c) < 0x7B)) #define IS_ASCII_UPPER(c) ((c) > 0x40 && (c) < 0x5B) #define IS_ASCII_DIGIT(c) ((c) > 0x2F && (c) < 0x3A) #define IS_ASCII_PRINT(c) ((c) > 0x1F && (c) < 0x7F) #define TO_ASCII_LOWER(c) ((c)+0x20) typedef enum { RASQAL_TERM_CLASS_URI, /* ends on > */ RASQAL_TERM_CLASS_BNODEID, /* ends on first non [A-Za-z][A-Za-z0-9]* */ RASQAL_TERM_CLASS_STRING, /* ends on non-escaped " */ RASQAL_TERM_CLASS_LANGUAGE /* ends on first non [a-z0-9]+ ('-' [a-z0-9]+ )? */ } rasqal_ntriples_term_class; static int rasqal_ntriples_term_valid(unsigned char c, int position, rasqal_ntriples_term_class term_class) { int result = 0; switch(term_class) { case RASQAL_TERM_CLASS_URI: /* ends on > */ result = (c != '>'); break; case RASQAL_TERM_CLASS_BNODEID: /* ends on first non [A-Za-z0-9_:][-.A-Za-z0-9]* */ result = IS_ASCII_ALPHA(c) || IS_ASCII_DIGIT(c) || c == '_' || c == ':'; if(position) /* FIXME * This isn't correct; '.' is allowed in positions 1..N-1 but * this calling convention of character-by-character cannot * check this. */ result = (result || c == '-' || c == '.'); break; case RASQAL_TERM_CLASS_STRING: /* ends on " */ result = (c != '"'); break; case RASQAL_TERM_CLASS_LANGUAGE: /* ends on first non [a-zA-Z]+ ('-' [a-zA-Z0-9]+ )? */ result = IS_ASCII_ALPHA(c); if(position) result = (result || IS_ASCII_DIGIT(c) || c == '-'); break; default: RASQAL_DEBUG2("Unknown N-Triples term class %d", term_class); } return result; } /* * rasqal_ntriples_parse_term_internal: * @world: rasqal world * @locator: locator object (in/out) (or NULL) * @start: pointer to starting character of string (in) * @dest: destination of string (in) * @lenp: pointer to length of string (in/out) * @dest_lenp: pointer to length of destination string (out) * @end_char: string ending character * @class: string class * * INTERNAL - Parse an N-Triples term with escapes. * * Relies that @dest is long enough; it need only be as large as the * input string @start since when UTF-8 encoding, the escapes are * removed and the result is always less than or equal to length of * input. * * N-Triples strings / URIs are written in ASCII at present; * characters outside the printable ASCII range are discarded with a * warning. See the grammar for full details of the allowed ranges. * * UTF-8 and the \u and \U esapes are both allowed. * * Return value: Non 0 on failure **/ static int rasqal_ntriples_parse_term_internal(rasqal_world* world, raptor_locator* locator, const unsigned char **start, unsigned char *dest, size_t *lenp, size_t *dest_lenp, char end_char, rasqal_ntriples_term_class term_class) { const unsigned char *p = *start; unsigned char c = '\0'; size_t ulen = 0; unsigned long unichar = 0; unsigned int position = 0; int end_char_seen = 0; /* find end of string, fixing backslashed characters on the way */ while(*lenp > 0) { int unichar_width; c = *p; p++; (*lenp)--; if(locator) { locator->column++; locator->byte++; } if(c > 0x7f) { /* just copy the UTF-8 bytes through */ int unichar_len; unichar_len = raptor_unicode_utf8_string_get_char(p - 1, 1 + *lenp, NULL); if(unichar_len < 0 || RASQAL_GOOD_CAST(size_t, unichar_len) > *lenp) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "UTF-8 encoding error at character %d (0x%02X) found.", c, c); /* UTF-8 encoding had an error or ended in the middle of a string */ return 1; } memmove(dest, p-1, unichar_len); dest += unichar_len; unichar_len--; /* p, *lenp were moved on by 1 earlier */ p += unichar_len; (*lenp) -= unichar_len; if(locator) { locator->column += unichar_len; locator->byte += unichar_len; } continue; } if(c != '\\') { /* finish at non-backslashed end_char */ if(end_char && c == end_char) { end_char_seen = 1; break; } if(!rasqal_ntriples_term_valid(c, position, term_class)) { if(end_char) { /* end char was expected, so finding an invalid thing is an error */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing terminating '%c' (found '%c')", end_char, c); return 0; } else { /* it's the end - so rewind 1 to save next char */ p--; (*lenp)++; if(locator) { locator->column--; locator->byte--; } if(term_class == RASQAL_TERM_CLASS_BNODEID && dest[-1] == '.') { /* If bnode id ended on '.' move back one */ dest--; p--; (*lenp)++; if(locator) { locator->column--; locator->byte--; } } break; } } /* otherwise store and move on */ *dest++ = c; position++; continue; } if(!*lenp) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "\\ at end of input."); return 0; } c = *p; p++; (*lenp)--; if(locator) { locator->column++; locator->byte++; } switch(c) { case '"': case '\\': *dest++ = c; break; case 'b': *dest++ = '\b'; break; case 'f': *dest++ = '\f'; break; case 'n': *dest++ = '\n'; break; case 'r': *dest++ = '\r'; break; case 't': *dest++ = '\t'; break; case '<': case '>': case '{': case '}': case '|': case '^': case '`': /* Turtle 2013 allows these in URIs (as well as \" and \\) */ *dest++ = c; break; case 'u': case 'U': ulen = (c == 'u') ? 4 : 8; if(*lenp < ulen) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "%c over end of input.", c); return 0; } if(1) { unsigned int ii; int n = 0; for(ii = 0; ii < ulen; ii++) { char cc = p[ii]; if(!isxdigit(RASQAL_GOOD_CAST(char, cc))) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "N-Triples string error - illegal hex digit %c in Unicode escape '%c%s...'", cc, c, p); n = 1; break; } } if(n) break; n = sscanf((const char*)p, ((ulen == 4) ? "%04lx" : "%08lx"), &unichar); if(n != 1) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal Uncode escape '%c%s...'", c, p); break; } } p += ulen; (*lenp) -= ulen; if(locator) { locator->column += RASQAL_GOOD_CAST(int, ulen); locator->byte += RASQAL_GOOD_CAST(int, ulen); } if(unichar > rasqal_unicode_max_codepoint) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal Unicode character with code point #x%lX (max #x%lX).", unichar, rasqal_unicode_max_codepoint); break; } unichar_width = raptor_unicode_utf8_string_put_char(unichar, dest, 4); if(unichar_width < 0) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal Unicode character with code point #x%lX.", unichar); break; } /* The destination length is set here to 4 since we know that in * all cases, the UTF-8 encoded output sequence is always shorter * than the input sequence, and the buffer is edited in place. * \uXXXX: 6 bytes input - UTF-8 max 3 bytes output * \uXXXXXXXX: 10 bytes input - UTF-8 max 4 bytes output */ dest += (int)unichar_width; break; default: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal string escape \\%c in \"%s\"", c, (char*)start); return 0; } position++; } /* end while */ if(end_char && !end_char_seen) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing terminating '%c' before end of input.", end_char); return 1; } /* terminate dest, can be shorter than source */ *dest = '\0'; if(dest_lenp) *dest_lenp = p - *start; *start = p; return 0; } static int rasqal_parse_turtle_term_internal(rasqal_world* world, raptor_locator* locator, const unsigned char **start, unsigned char *dest, size_t *len_p, size_t *dest_lenp, raptor_uri** datatype_uri_p) { const unsigned char *p = *start; unsigned int position = 0; /* 0 = xsd:integer; 1= xsd:decimal; 2= xsd:double */ short dtype = 0; int after_e = 0; while(*len_p > 0) { unsigned char c = *p; if(after_e) { if(!((c >= '0' && c <'9') || c == '+' || c == '-')) break; after_e = 0; } else if((position > 0 && (c == '+' || c == '-')) || !((c >= '0' && c <'9') || c == '.' || c == 'e' || c == 'E')) break; if(c == '.') dtype = 1; else if(c == 'e' || c == 'E') { dtype = 2; after_e = 1; } p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } *dest++ = c; position++; } *dest = '\0'; if(dest_lenp) *dest_lenp = p - *start; *start = p; if(dtype == 0) *datatype_uri_p = raptor_uri_copy(rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_INTEGER)); else if (dtype == 1) *datatype_uri_p = raptor_uri_copy(rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_DECIMAL)); else *datatype_uri_p = raptor_uri_copy(rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_DOUBLE)); return 0; } /* * rasqal_ntriples_parse_term: * @world: rasqal world * @locator: rasqal locator (in/out) (or NULL) * @string: string input (in) * @len_p: pointer to length of @string (in/out) * @term_p: pointer to store term (out) * @allow_turtle: non-0 to allow Turtle forms such as integers, boolean * * INTERNAL - Parse an N-Triples string into a #raptor_term * * The @len_p destination and @locator fields are modified as parsing * proceeds to be used in error messages. The final value is written * into the #raptor_term pointed at by @term_p * * Return value: number of bytes processed or 0 on failure */ static size_t rasqal_ntriples_parse_term(rasqal_world* world, raptor_locator* locator, unsigned char *string, size_t *len_p, raptor_term** term_p, int allow_turtle) { unsigned char *p = string; unsigned char *dest; size_t term_length = 0; switch(*p) { case '<': dest = p; p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, '>', RASQAL_TERM_CLASS_URI)) { goto fail; } if(!rasqal_turtle_check_uri_string(dest)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "URI '%s' contains bad character(s)", dest); goto fail; } if(1) { raptor_uri *uri; /* Check for bad ordinal predicate */ if(!strncmp((const char*)dest, "http://www.w3.org/1999/02/22-rdf-syntax-ns#_", 44)) { int ordinal = rasqal_check_ordinal(dest + 44); if(ordinal <= 0) rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal ordinal value %d in property '%s'.", ordinal, dest); } if(raptor_uri_uri_string_is_absolute(dest) <= 0) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "URI '%s' is not absolute.", dest); goto fail; } uri = raptor_new_uri(world->raptor_world_ptr, dest); if(!uri) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Could not create URI for '%s'", (const char *)dest); goto fail; } *term_p = raptor_new_term_from_uri(world->raptor_world_ptr, uri); raptor_free_uri(uri); } break; case '-': case '+': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if(allow_turtle) { raptor_uri* datatype_uri = NULL; dest = p; if(rasqal_parse_turtle_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, &datatype_uri)) { goto fail; } *term_p = raptor_new_term_from_literal(world->raptor_world_ptr, dest, datatype_uri, NULL /* language */); } else goto fail; break; case '"': dest = p; p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, '"', RASQAL_TERM_CLASS_STRING)) { goto fail; } if(1) { unsigned char *object_literal_language = NULL; unsigned char *object_literal_datatype = NULL; raptor_uri* datatype_uri = NULL; if(*len_p && *p == '@') { unsigned char *q; size_t lang_len; object_literal_language = p; /* Skip - */ p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(!*len_p) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing language after \"string\"-"); goto fail; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, object_literal_language, len_p, &lang_len, '\0', RASQAL_TERM_CLASS_LANGUAGE)) { goto fail; } if(!lang_len) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Invalid language tag at @%s", p); goto fail; } /* Normalize language to lowercase * http://www.w3.org/TR/rdf-concepts/#dfn-language-identifier */ for(q = object_literal_language; *q; q++) { if(IS_ASCII_UPPER(*q)) *q = TO_ASCII_LOWER(*q); } } if(*len_p > 1 && *p == '^' && p[1] == '^') { object_literal_datatype = p; /* Skip ^^ */ p += 2; *len_p -= 2; if(locator) { locator->column += 2; locator->byte += 2; } if(!*len_p || (*len_p && *p != '<')) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing datatype URI-ref in\"string\"^^ after ^^"); goto fail; } p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, object_literal_datatype, len_p, NULL, '>', RASQAL_TERM_CLASS_URI)) { goto fail; } if(raptor_uri_uri_string_is_absolute(object_literal_datatype) <= 0) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Datatype URI '%s' is not absolute.", object_literal_datatype); goto fail; } } if(object_literal_datatype && object_literal_language) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Typed literal used with a language - ignoring the language"); object_literal_language = NULL; } if(object_literal_datatype) { datatype_uri = raptor_new_uri(world->raptor_world_ptr, object_literal_datatype); if(!datatype_uri) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Could not create literal datatype uri '%s'", object_literal_datatype); goto fail; } object_literal_language = NULL; } *term_p = raptor_new_term_from_literal(world->raptor_world_ptr, dest, datatype_uri, object_literal_language); } break; case '_': /* store where _ was */ dest = p; p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(!*len_p || (*len_p > 0 && *p != ':')) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal bNodeID - _ not followed by :"); goto fail; } /* Found ':' - move on */ p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, '\0', RASQAL_TERM_CLASS_BNODEID)) { goto fail; } if(!term_length) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Bad or missing bNodeID after _:"); goto fail; } *term_p = raptor_new_term_from_blank(world->raptor_world_ptr, dest); break; default: RASQAL_DEBUG2("Unknown term type '%c'", *p); goto fail; } fail: return p - string; } /* * rasqal_new_term_from_counted_string: * @world: rasqal world * @string: N-Triples format string (UTF-8) * @length: length of @string (or 0) * * INTERNAL - create a new term from an N-Triples format string in UTF-8 * * Return value: new term or NULL on failure */ static raptor_term* rasqal_new_term_from_counted_string(rasqal_world* world, unsigned char* string, size_t length) { raptor_term* term = NULL; size_t bytes_read; raptor_locator locator; if(!string) return NULL; if(!length) length = strlen(RASQAL_GOOD_CAST(const char*, string)); memset(&locator, sizeof(locator), '\0'); locator.line = -1; bytes_read = rasqal_ntriples_parse_term(world, &locator, string, &length, &term, 1); if(!bytes_read || length != 0) { if(term) raptor_free_term(term); term = NULL; } return term; } #endif /* * rasqal_new_literal_from_ntriples_counted_string: * @world: rasqal world * @string: N-Triples format string (UTF-8) * @length: length of @string (or 0) * * INTERNAL - create a new literal from an N-Triples format string in UTF-8 * * Return value: new literal or NULL on failure */ rasqal_literal* rasqal_new_literal_from_ntriples_counted_string(rasqal_world* world, unsigned char* string, size_t length) { raptor_term* term; rasqal_literal* l; #if RAPTOR_VERSION >= 20012 term = raptor_new_term_from_counted_string(world->raptor_world_ptr, string, length); #else term = rasqal_new_term_from_counted_string(world, string, length); #endif if(!term) return NULL; l = rasqal_new_literal_from_term(world, term); raptor_free_term(term); return l; } rasqal-0.9.33/src/sparql_lexer.c0000644000175000017500000047005612434455661013474 00000000000000#ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #line 10 "sparql_lexer.c" #line 12 "sparql_lexer.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) are macros in the reentrant scanner. */ #define yyin yyg->yyin_r #define yyout yyg->yyout_r #define yyextra yyg->yyextra_r #define yyleng yyg->yyleng_r #define yytext yyg->yytext_r #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yyg->yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yyg->yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE sparql_lexer_restart(yyin ,yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = yyg->yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via sparql_lexer_restart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] void sparql_lexer_restart (FILE *input_file ,yyscan_t yyscanner ); void sparql_lexer__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); void sparql_lexer__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); void sparql_lexer__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); void sparql_lexer_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); void sparql_lexer_pop_buffer_state (yyscan_t yyscanner ); static void sparql_lexer_ensure_buffer_stack (yyscan_t yyscanner ); static void sparql_lexer__load_buffer_state (yyscan_t yyscanner ); static void sparql_lexer__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); #define YY_FLUSH_BUFFER sparql_lexer__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) YY_BUFFER_STATE sparql_lexer__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *sparql_lexer_alloc (yy_size_t ,yyscan_t yyscanner ); void *sparql_lexer_realloc (void *,yy_size_t ,yyscan_t yyscanner ); void sparql_lexer_free (void * ,yyscan_t yyscanner ); #define yy_new_buffer sparql_lexer__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ sparql_lexer_ensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ sparql_lexer__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ sparql_lexer_ensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ sparql_lexer__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; #define YY_NUM_RULES 178 #define YY_END_OF_BUFFER 179 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[626] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 153, 157, 157, 179, 177, 4, 3, 3, 140, 177, 177, 125, 177, 177, 120, 121, 138, 147, 119, 148, 128, 139, 144, 172, 129, 177, 132, 135, 124, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 122, 123, 177, 177, 118, 177, 177, 126, 177, 127, 162, 161, 167, 163, 165, 166, 164, 171, 168, 170, 171, 153, 153, 153, 154, 157, 157, 157, 158, 4, 3, 133, 0, 150, 0, 0, 176, 176, 131, 0, 149, 0, 0, 144, 145, 2, 0, 145, 0, 172, 172, 141, 134, 134, 136, 175, 0, 134, 137, 142, 0, 0, 172, 0, 0, 0, 45, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 143, 0, 130, 161, 163, 166, 168, 0, 0, 169, 153, 153, 0, 0, 157, 157, 0, 0, 150, 151, 149, 155, 0, 0, 1, 1, 145, 0, 0, 146, 172, 0, 0, 175, 0, 142, 102, 96, 99, 34, 11, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 49, 0, 0, 44, 106, 43, 0, 0, 0, 64, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 41, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 173, 152, 156, 0, 146, 0, 146, 0, 17, 68, 0, 0, 104, 0, 0, 0, 0, 0, 98, 0, 0, 0, 55, 0, 0, 35, 0, 56, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, 22, 0, 0, 57, 0, 0, 97, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, 0, 0, 0, 115, 0, 0, 51, 75, 173, 0, 0, 0, 174, 0, 62, 18, 52, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, 105, 0, 27, 38, 0, 78, 0, 0, 24, 0, 0, 0, 90, 14, 72, 0, 76, 28, 0, 0, 31, 0, 0, 33, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 89, 70, 15, 0, 7, 0, 0, 86, 0, 0, 53, 0, 0, 0, 46, 0, 0, 0, 0, 29, 0, 0, 39, 47, 0, 0, 0, 0, 0, 30, 0, 8, 0, 0, 0, 74, 0, 5, 0, 0, 108, 109, 110, 111, 54, 0, 0, 0, 0, 87, 0, 0, 88, 0, 0, 117, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 37, 0, 0, 25, 0, 0, 0, 79, 0, 13, 114, 0, 80, 0, 71, 0, 0, 92, 19, 0, 116, 0, 0, 69, 50, 0, 93, 0, 23, 9, 12, 0, 0, 0, 0, 0, 0, 16, 48, 0, 113, 0, 0, 81, 0, 10, 0, 0, 0, 0, 26, 73, 0, 67, 112, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 85, 0, 0, 0, 66, 0, 0, 84, 0, 94, 0, 82, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8, 9, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 20, 27, 20, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 44, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 65, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 44, 66, 52, 53, 67, 55, 56, 57, 58, 59, 68, 69, 70, 1, 1, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71 } ; static yyconst flex_int32_t yy_meta[72] = { 0, 1, 1, 2, 2, 1, 1, 3, 1, 1, 1, 4, 5, 1, 1, 1, 1, 6, 7, 1, 8, 8, 8, 8, 8, 8, 8, 8, 9, 1, 1, 10, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 1, 12, 1, 1, 8, 11, 11, 11, 1, 1, 1, 12 } ; static yyconst flex_int16_t yy_base[645] = { 0, 0, 0, 71, 0, 142, 0, 213, 0, 282, 283, 284, 285, 810, 2645, 289, 2645, 796, 766, 286, 294, 2645, 751, 281, 2645, 2645, 2645, 281, 2645, 291, 299, 313, 313, 298, 2645, 352, 2645, 728, 2645, 0, 406, 408, 421, 420, 417, 461, 450, 464, 466, 323, 502, 493, 475, 515, 472, 529, 534, 531, 561, 412, 528, 463, 2645, 2645, 695, 713, 567, 565, 589, 2645, 658, 2645, 2645, 0, 2645, 423, 2645, 0, 2645, 2645, 427, 2645, 409, 447, 461, 713, 473, 492, 502, 688, 430, 570, 2645, 2645, 541, 690, 0, 345, 2645, 693, 2645, 289, 683, 0, 624, 637, 645, 2645, 450, 665, 685, 2645, 497, 2645, 646, 2645, 2645, 661, 574, 522, 2645, 0, 507, 516, 579, 568, 614, 590, 685, 593, 665, 605, 696, 697, 607, 611, 698, 700, 701, 705, 716, 703, 714, 729, 735, 718, 734, 742, 755, 757, 758, 759, 761, 763, 764, 766, 783, 772, 777, 780, 785, 806, 807, 818, 812, 820, 826, 821, 827, 829, 834, 841, 833, 838, 835, 865, 867, 866, 868, 869, 872, 881, 887, 888, 893, 904, 906, 909, 918, 912, 920, 925, 929, 2645, 0, 2645, 0, 636, 0, 672, 932, 938, 2645, 621, 637, 672, 554, 677, 678, 581, 549, 2645, 2645, 2645, 2645, 950, 494, 2645, 516, 959, 980, 988, 996, 683, 784, 451, 2645, 1023, 0, 971, 1077, 1078, 1079, 1080, 1081, 1082, 1084, 1085, 1083, 1086, 1098, 1097, 1099, 1100, 1101, 1102, 1106, 1120, 1117, 1126, 1132, 1128, 1141, 1146, 1148, 1152, 1150, 1155, 1161, 1159, 1164, 1172, 1175, 1177, 1181, 1183, 1189, 1194, 1195, 1201, 1197, 1206, 1203, 1209, 1217, 1220, 1224, 1231, 1235, 1238, 1239, 1244, 1247, 1251, 1252, 1253, 1256, 1258, 1259, 1264, 1272, 1275, 1281, 1287, 1289, 1288, 1295, 1292, 1318, 1294, 1343, 1296, 1307, 1314, 1316, 1327, 1334, 1336, 1331, 1339, 1356, 1345, 1340, 1359, 1370, 451, 2645, 2645, 1393, 1402, 1417, 1425, 1452, 1372, 1506, 1507, 1509, 1374, 1508, 1511, 1510, 1512, 1513, 1375, 1514, 1515, 1533, 1526, 1534, 1538, 1542, 1553, 1535, 1559, 1555, 1564, 1566, 1558, 1567, 1571, 1582, 1586, 1584, 1588, 1589, 1593, 1597, 1609, 1601, 1605, 1617, 1623, 1625, 1629, 1631, 1632, 1637, 1646, 1643, 1649, 1650, 1651, 1652, 1666, 1668, 1669, 1673, 1670, 1677, 1681, 1684, 1686, 1692, 1699, 1704, 1716, 1710, 1712, 1718, 1721, 1723, 1725, 1727, 1738, 1741, 1744, 1745, 1747, 1749, 1758, 1761, 1750, 1763, 1767, 1769, 1782, 444, 428, 0, 399, 318, 1783, 1786, 1789, 1790, 1794, 1795, 1798, 1797, 1801, 1802, 1806, 1809, 1810, 1814, 1815, 1817, 1829, 1832, 1833, 1834, 1841, 1845, 1848, 1852, 1853, 1854, 1856, 1859, 1860, 1865, 1874, 1861, 1873, 1877, 1880, 1892, 1893, 1896, 1897, 1899, 1900, 1901, 1904, 1905, 1912, 1916, 1917, 1918, 1923, 1920, 1924, 1935, 1936, 1948, 1947, 1959, 1950, 1951, 1952, 1965, 1967, 1966, 1968, 1972, 1970, 1973, 1981, 1984, 1990, 1992, 1993, 1997, 2001, 2004, 2005, 2008, 2010, 2013, 2016, 2022, 2028, 2029, 2025, 2030, 2034, 2037, 2041, 2042, 2045, 2058, 2056, 2062, 2063, 2069, 2070, 2074, 2076, 2078, 2081, 2082, 2085, 2087, 2089, 2094, 2096, 2101, 2113, 2114, 2115, 2116, 2119, 2121, 2132, 2133, 2134, 2136, 2139, 2140, 2141, 2147, 2145, 2153, 2156, 2158, 2159, 2161, 2175, 2176, 2177, 2178, 2180, 2181, 2196, 2197, 2198, 2201, 2203, 2204, 2205, 2217, 2218, 2220, 2225, 2229, 2233, 2236, 2238, 2240, 2241, 2244, 2245, 2247, 2249, 2256, 2258, 2260, 2262, 2263, 2264, 2269, 2275, 2276, 2280, 2284, 2288, 2289, 2295, 2300, 2301, 2302, 2303, 2306, 2307, 2308, 2309, 2314, 2315, 2322, 2323, 2326, 2328, 2337, 2342, 2340, 2343, 2344, 2351, 2355, 2357, 2358, 2363, 2364, 2366, 2369, 2371, 2380, 2383, 2386, 2387, 2391, 2395, 2398, 2400, 2403, 2406, 2411, 2409, 2415, 2417, 2424, 2431, 2433, 2435, 2437, 2645, 2478, 2490, 2502, 2514, 2526, 2534, 317, 2541, 2546, 2551, 2558, 2570, 2582, 2594, 2602, 2614, 2621, 2625, 2632 } ; static yyconst flex_int16_t yy_def[645] = { 0, 625, 1, 625, 3, 625, 5, 625, 7, 626, 626, 627, 627, 625, 625, 625, 625, 625, 625, 628, 629, 625, 625, 630, 625, 625, 625, 625, 625, 625, 625, 625, 625, 631, 625, 625, 625, 625, 625, 632, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 625, 625, 625, 625, 633, 633, 633, 625, 625, 625, 625, 634, 625, 625, 625, 635, 625, 625, 625, 625, 636, 637, 637, 625, 637, 638, 638, 625, 638, 625, 625, 625, 628, 625, 628, 629, 625, 625, 625, 630, 625, 630, 625, 625, 625, 625, 639, 625, 625, 625, 640, 625, 641, 625, 625, 625, 641, 641, 625, 642, 633, 633, 631, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 625, 643, 625, 634, 625, 635, 625, 636, 636, 625, 637, 637, 637, 625, 638, 638, 638, 625, 625, 625, 625, 625, 625, 639, 625, 625, 625, 625, 625, 625, 640, 640, 641, 625, 625, 642, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 644, 625, 625, 625, 625, 625, 625, 625, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 644, 644, 322, 322, 625, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 0, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625 } ; static yyconst flex_int16_t yy_nxt[2717] = { 0, 14, 15, 16, 17, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 32, 32, 32, 32, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 49, 61, 49, 62, 49, 63, 64, 65, 66, 67, 68, 69, 70, 71, 49, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 72, 73, 72, 72, 73, 73, 73, 73, 72, 72, 72, 73, 74, 75, 74, 74, 75, 74, 74, 74, 76, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 77, 77, 77, 77, 77, 77, 77, 77, 74, 74, 74, 74, 74, 78, 74, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 74, 77, 74, 74, 77, 77, 77, 77, 74, 74, 74, 77, 79, 80, 79, 79, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 81, 79, 79, 79, 79, 79, 79, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 79, 82, 79, 79, 79, 82, 82, 82, 79, 79, 79, 82, 84, 84, 88, 88, 85, 85, 91, 102, 95, 91, 89, 89, 98, 99, 104, 213, 105, 105, 105, 105, 105, 105, 105, 105, 104, 111, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 107, 121, 113, 226, 109, 108, 105, 105, 105, 105, 105, 105, 105, 105, 123, 103, 86, 86, 90, 90, 96, 98, 99, 103, 124, 110, 114, 114, 114, 114, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 115, 116, 117, 114, 114, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 114, 114, 114, 114, 119, 118, 118, 118, 114, 114, 114, 114, 123, 197, 123, 201, 197, 199, 123, 117, 199, 625, 124, 123, 124, 202, 123, 123, 124, 207, 125, 130, 126, 124, 407, 189, 124, 124, 204, 131, 127, 217, 218, 140, 132, 133, 128, 141, 135, 129, 407, 142, 204, 144, 134, 136, 123, 407, 137, 143, 138, 130, 145, 139, 625, 189, 124, 123, 203, 123, 123, 117, 123, 140, 143, 138, 139, 124, 123, 124, 124, 123, 124, 208, 146, 217, 218, 151, 124, 150, 192, 124, 147, 208, 153, 148, 205, 111, 166, 123, 149, 152, 154, 224, 150, 155, 156, 217, 123, 124, 205, 171, 167, 123, 146, 149, 162, 151, 124, 163, 155, 123, 123, 124, 164, 157, 171, 158, 166, 159, 165, 124, 625, 160, 123, 123, 211, 123, 227, 161, 123, 209, 117, 168, 124, 124, 162, 124, 317, 316, 124, 209, 172, 169, 170, 157, 173, 175, 190, 191, 91, 176, 181, 91, 177, 178, 174, 123, 182, 170, 183, 123, 625, 123, 123, 179, 180, 124, 184, 111, 207, 124, 172, 124, 124, 183, 185, 175, 172, 180, 96, 125, 173, 126, 117, 123, 123, 186, 625, 123, 187, 127, 174, 188, 187, 124, 124, 128, 229, 124, 129, 123, 204, 123, 185, 187, 188, 123, 172, 187, 123, 124, 234, 124, 231, 186, 197, 124, 204, 197, 124, 188, 106, 106, 106, 106, 106, 106, 106, 106, 230, 236, 239, 109, 188, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 226, 199, 625, 110, 199, 117, 203, 208, 208, 205, 123, 215, 219, 219, 219, 219, 219, 219, 219, 219, 124, 214, 111, 98, 212, 205, 210, 221, 224, 221, 123, 220, 222, 222, 222, 222, 222, 222, 222, 222, 124, 123, 123, 123, 235, 123, 123, 206, 123, 232, 123, 124, 124, 124, 195, 124, 124, 233, 124, 123, 124, 123, 241, 123, 240, 209, 209, 245, 194, 124, 249, 124, 237, 124, 123, 242, 250, 243, 238, 123, 123, 244, 251, 246, 124, 193, 120, 123, 100, 124, 124, 238, 241, 252, 244, 255, 247, 124, 246, 254, 123, 248, 123, 123, 123, 253, 123, 256, 123, 123, 124, 123, 124, 124, 124, 257, 124, 123, 124, 124, 260, 124, 123, 625, 93, 123, 92, 124, 123, 224, 123, 258, 124, 259, 261, 124, 266, 625, 124, 272, 124, 262, 263, 264, 265, 625, 267, 271, 625, 625, 260, 123, 123, 268, 625, 263, 269, 123, 270, 274, 273, 124, 124, 123, 268, 123, 123, 124, 275, 272, 277, 123, 123, 124, 123, 124, 124, 268, 123, 123, 123, 124, 124, 123, 124, 625, 123, 278, 124, 124, 124, 276, 625, 124, 284, 279, 124, 625, 275, 286, 281, 282, 280, 289, 283, 625, 290, 287, 288, 285, 123, 123, 123, 123, 123, 291, 292, 123, 625, 625, 124, 124, 124, 124, 124, 625, 123, 124, 298, 292, 625, 294, 123, 123, 625, 301, 124, 625, 123, 293, 295, 299, 124, 124, 296, 297, 302, 300, 124, 123, 625, 123, 625, 625, 123, 303, 625, 123, 298, 124, 297, 124, 300, 123, 124, 123, 306, 124, 625, 305, 123, 307, 625, 124, 123, 124, 308, 201, 304, 309, 124, 625, 305, 201, 124, 311, 312, 202, 310, 625, 625, 314, 318, 625, 318, 625, 306, 319, 319, 319, 319, 319, 319, 319, 319, 313, 219, 219, 219, 219, 219, 219, 219, 219, 625, 625, 123, 625, 625, 625, 625, 314, 320, 625, 320, 220, 124, 321, 321, 321, 321, 321, 321, 321, 321, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 322, 322, 322, 322, 322, 322, 322, 322, 225, 225, 225, 225, 117, 225, 225, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 225, 322, 225, 225, 322, 322, 322, 322, 225, 225, 225, 322, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 323, 324, 325, 123, 124, 124, 124, 124, 124, 124, 326, 327, 328, 124, 123, 330, 335, 123, 625, 625, 625, 625, 329, 123, 124, 123, 625, 124, 334, 123, 331, 332, 625, 124, 337, 124, 336, 333, 123, 124, 338, 625, 328, 123, 340, 123, 335, 123, 124, 123, 339, 336, 123, 124, 625, 124, 123, 124, 123, 124, 625, 123, 124, 625, 337, 625, 124, 625, 124, 123, 338, 124, 123, 341, 123, 342, 343, 344, 123, 124, 123, 345, 124, 625, 124, 348, 123, 346, 124, 347, 124, 123, 123, 349, 123, 625, 124, 351, 123, 353, 123, 124, 124, 123, 124, 350, 123, 352, 124, 625, 124, 354, 625, 124, 123, 625, 124, 123, 350, 355, 625, 123, 352, 357, 124, 356, 359, 124, 123, 625, 358, 124, 123, 625, 360, 123, 123, 362, 124, 361, 356, 123, 124, 358, 123, 124, 124, 625, 123, 123, 123, 124, 625, 123, 124, 123, 123, 365, 124, 124, 124, 123, 366, 124, 625, 124, 124, 625, 363, 123, 364, 124, 123, 625, 369, 368, 371, 370, 123, 124, 625, 363, 124, 367, 123, 123, 123, 625, 124, 123, 373, 123, 123, 123, 124, 124, 124, 372, 625, 124, 374, 124, 124, 124, 123, 376, 379, 625, 375, 380, 372, 123, 386, 123, 124, 123, 377, 378, 382, 383, 384, 124, 385, 124, 123, 124, 381, 394, 123, 625, 625, 123, 395, 123, 124, 625, 123, 123, 124, 380, 123, 124, 123, 124, 625, 397, 124, 124, 625, 396, 124, 625, 124, 123, 399, 625, 123, 387, 388, 400, 389, 390, 396, 124, 625, 398, 124, 123, 391, 123, 403, 123, 123, 401, 392, 625, 393, 124, 402, 124, 404, 124, 124, 625, 625, 403, 625, 387, 625, 393, 625, 402, 319, 319, 319, 319, 319, 319, 319, 319, 405, 319, 319, 319, 319, 319, 319, 319, 319, 625, 625, 625, 625, 625, 625, 405, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 408, 409, 225, 408, 408, 408, 408, 408, 408, 408, 408, 225, 225, 225, 225, 410, 225, 225, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 225, 408, 225, 225, 408, 408, 408, 408, 225, 225, 225, 408, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 416, 412, 413, 418, 411, 415, 123, 123, 123, 124, 625, 123, 625, 625, 414, 123, 124, 124, 124, 625, 417, 124, 419, 420, 625, 124, 123, 421, 123, 414, 416, 123, 123, 418, 422, 625, 124, 123, 124, 123, 123, 124, 124, 423, 123, 428, 424, 124, 425, 124, 124, 426, 427, 625, 124, 123, 423, 123, 429, 123, 430, 123, 123, 425, 431, 124, 123, 124, 433, 124, 123, 124, 124, 625, 123, 428, 124, 625, 123, 431, 124, 625, 123, 438, 124, 625, 432, 434, 124, 435, 123, 436, 124, 625, 437, 439, 123, 625, 123, 625, 124, 625, 123, 441, 123, 123, 124, 442, 124, 437, 123, 443, 124, 438, 124, 124, 123, 440, 625, 123, 124, 625, 123, 123, 123, 123, 124, 625, 447, 124, 448, 444, 124, 124, 124, 124, 445, 446, 625, 123, 449, 123, 123, 123, 453, 625, 123, 450, 452, 124, 123, 124, 124, 124, 123, 451, 124, 123, 455, 123, 124, 625, 456, 625, 124, 123, 625, 124, 625, 124, 451, 458, 123, 460, 625, 124, 463, 123, 454, 464, 459, 457, 124, 123, 462, 123, 465, 124, 455, 123, 461, 123, 466, 124, 123, 124, 123, 625, 123, 124, 123, 124, 625, 625, 124, 461, 124, 468, 124, 625, 124, 123, 469, 467, 123, 472, 625, 123, 123, 473, 123, 124, 123, 123, 124, 625, 471, 124, 124, 470, 124, 123, 124, 124, 123, 474, 123, 625, 625, 625, 123, 124, 123, 479, 124, 472, 124, 475, 478, 476, 124, 625, 124, 480, 625, 123, 123, 482, 477, 123, 475, 483, 123, 123, 481, 124, 124, 123, 123, 124, 123, 123, 124, 124, 123, 123, 625, 124, 124, 123, 124, 124, 123, 123, 124, 124, 484, 123, 123, 124, 123, 625, 124, 124, 625, 488, 489, 124, 124, 625, 124, 485, 123, 486, 487, 123, 123, 123, 493, 490, 625, 492, 124, 494, 123, 124, 124, 124, 123, 487, 495, 123, 491, 496, 124, 123, 123, 123, 124, 123, 497, 124, 123, 123, 123, 124, 124, 124, 123, 124, 498, 625, 124, 124, 124, 625, 123, 123, 124, 501, 123, 506, 625, 123, 499, 498, 124, 124, 625, 504, 124, 625, 503, 124, 502, 123, 123, 499, 505, 123, 123, 500, 123, 123, 123, 124, 124, 123, 123, 124, 124, 506, 124, 124, 124, 123, 507, 124, 124, 123, 123, 123, 625, 123, 625, 124, 123, 123, 511, 124, 124, 124, 509, 124, 512, 508, 124, 124, 123, 123, 625, 513, 514, 510, 517, 519, 515, 625, 124, 124, 123, 123, 625, 123, 123, 123, 521, 518, 516, 520, 124, 124, 123, 124, 124, 124, 522, 625, 123, 123, 123, 123, 124, 123, 517, 123, 123, 525, 124, 124, 124, 124, 625, 124, 123, 124, 124, 123, 523, 524, 526, 625, 529, 123, 124, 123, 123, 124, 530, 527, 123, 528, 625, 124, 123, 124, 124, 123, 123, 531, 124, 123, 533, 123, 124, 532, 123, 124, 124, 123, 625, 124, 529, 124, 531, 123, 124, 536, 123, 124, 535, 123, 123, 123, 534, 124, 625, 123, 124, 625, 123, 124, 124, 124, 123, 123, 538, 124, 123, 537, 124, 542, 625, 625, 124, 124, 543, 625, 124, 123, 539, 123, 537, 540, 625, 123, 123, 541, 625, 124, 625, 124, 123, 123, 545, 124, 124, 123, 546, 123, 547, 123, 124, 124, 123, 123, 544, 124, 123, 124, 123, 124, 123, 548, 124, 124, 625, 123, 124, 123, 124, 553, 124, 625, 123, 549, 550, 124, 554, 124, 625, 555, 551, 552, 124, 625, 123, 123, 123, 123, 549, 550, 123, 625, 123, 556, 124, 124, 124, 124, 625, 553, 124, 557, 124, 123, 123, 123, 559, 123, 556, 625, 123, 123, 123, 124, 124, 124, 123, 124, 123, 558, 124, 124, 124, 625, 123, 560, 124, 123, 124, 123, 123, 625, 123, 563, 124, 625, 561, 124, 565, 124, 124, 562, 124, 625, 625, 564, 123, 123, 123, 123, 625, 123, 123, 569, 566, 625, 124, 124, 124, 124, 564, 124, 124, 625, 568, 570, 567, 123, 123, 123, 573, 625, 123, 574, 123, 123, 123, 124, 124, 124, 625, 571, 124, 625, 124, 124, 124, 625, 123, 123, 576, 123, 625, 579, 572, 625, 123, 577, 124, 124, 123, 124, 575, 625, 123, 578, 124, 123, 581, 123, 124, 123, 123, 580, 124, 123, 123, 124, 123, 124, 123, 124, 124, 579, 582, 124, 124, 123, 124, 123, 124, 123, 625, 123, 123, 123, 583, 124, 625, 124, 123, 124, 584, 124, 124, 124, 123, 123, 585, 586, 124, 123, 588, 625, 625, 123, 124, 124, 625, 123, 123, 124, 587, 585, 586, 124, 123, 591, 589, 124, 124, 123, 123, 123, 123, 590, 124, 123, 123, 123, 123, 124, 124, 124, 124, 123, 123, 124, 124, 124, 124, 592, 596, 123, 123, 124, 124, 123, 597, 123, 595, 594, 625, 124, 124, 593, 599, 124, 123, 124, 625, 123, 598, 123, 123, 123, 602, 625, 124, 601, 600, 124, 123, 124, 124, 124, 123, 598, 123, 123, 605, 625, 124, 625, 123, 123, 124, 123, 124, 124, 123, 603, 123, 606, 124, 124, 602, 124, 604, 625, 124, 123, 124, 625, 123, 625, 603, 123, 123, 611, 625, 124, 123, 607, 124, 610, 123, 124, 124, 123, 608, 123, 124, 625, 123, 613, 124, 123, 614, 124, 123, 124, 123, 609, 124, 612, 123, 124, 123, 611, 124, 616, 124, 625, 615, 123, 124, 625, 124, 625, 625, 617, 123, 620, 123, 124, 123, 615, 123, 618, 619, 621, 124, 622, 124, 625, 124, 625, 124, 625, 625, 625, 625, 625, 625, 619, 625, 624, 625, 625, 625, 623, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 94, 625, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 101, 625, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 112, 625, 625, 112, 625, 112, 112, 112, 122, 122, 122, 122, 625, 122, 122, 196, 625, 625, 196, 196, 198, 625, 625, 198, 198, 200, 200, 200, 200, 625, 200, 200, 203, 203, 625, 203, 203, 203, 203, 203, 203, 203, 203, 203, 207, 207, 207, 625, 207, 207, 207, 207, 207, 207, 207, 207, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 223, 223, 223, 223, 625, 625, 223, 223, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 228, 625, 228, 625, 625, 228, 315, 625, 625, 315, 315, 406, 406, 406, 625, 625, 406, 406, 13, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625 } ; static yyconst flex_int16_t yy_chk[2717] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 10, 11, 12, 9, 10, 15, 23, 19, 15, 11, 12, 20, 20, 27, 101, 27, 27, 27, 27, 27, 27, 27, 27, 29, 33, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 632, 33, 410, 32, 31, 32, 32, 32, 32, 32, 32, 32, 32, 49, 23, 9, 10, 11, 12, 19, 97, 97, 101, 49, 32, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 40, 75, 41, 82, 75, 80, 59, 409, 80, 90, 40, 44, 41, 82, 43, 42, 59, 90, 40, 41, 40, 44, 407, 59, 43, 42, 83, 41, 40, 108, 108, 43, 41, 41, 40, 43, 42, 40, 406, 43, 84, 44, 41, 42, 46, 315, 42, 43, 42, 41, 44, 42, 86, 59, 46, 45, 86, 61, 47, 225, 48, 43, 43, 42, 42, 45, 54, 61, 47, 52, 48, 87, 45, 216, 216, 47, 54, 46, 61, 52, 45, 88, 48, 45, 83, 112, 52, 51, 45, 47, 48, 112, 46, 48, 48, 218, 50, 51, 84, 54, 52, 122, 45, 45, 51, 47, 50, 51, 48, 53, 123, 122, 51, 50, 54, 50, 52, 50, 51, 53, 123, 50, 60, 55, 94, 57, 119, 50, 56, 87, 119, 53, 60, 55, 51, 57, 210, 206, 56, 88, 55, 53, 53, 50, 55, 56, 60, 60, 91, 56, 57, 91, 56, 56, 55, 58, 57, 53, 57, 67, 209, 66, 125, 56, 56, 58, 57, 124, 209, 67, 55, 66, 125, 57, 58, 56, 67, 56, 94, 66, 67, 66, 118, 68, 127, 58, 124, 129, 58, 66, 67, 58, 67, 68, 127, 66, 125, 129, 66, 131, 203, 134, 68, 58, 58, 135, 67, 67, 126, 131, 129, 134, 127, 68, 197, 135, 204, 197, 126, 68, 104, 104, 104, 104, 104, 104, 104, 104, 126, 131, 135, 105, 68, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 117, 199, 205, 105, 199, 114, 205, 207, 208, 203, 130, 106, 109, 109, 109, 109, 109, 109, 109, 109, 130, 102, 223, 99, 95, 204, 89, 110, 223, 110, 128, 109, 110, 110, 110, 110, 110, 110, 110, 110, 128, 132, 133, 136, 130, 137, 138, 85, 141, 128, 139, 132, 133, 136, 70, 137, 138, 128, 141, 142, 139, 140, 137, 145, 136, 207, 208, 138, 65, 142, 141, 140, 132, 145, 143, 137, 141, 137, 133, 146, 144, 137, 141, 139, 143, 64, 37, 147, 22, 146, 144, 133, 137, 142, 137, 145, 140, 147, 139, 144, 148, 140, 149, 150, 151, 143, 152, 146, 153, 154, 148, 155, 149, 150, 151, 147, 152, 157, 153, 154, 150, 155, 158, 224, 18, 159, 17, 157, 156, 224, 160, 148, 158, 149, 150, 159, 155, 13, 156, 158, 160, 151, 152, 154, 154, 0, 156, 157, 0, 0, 150, 161, 162, 156, 0, 152, 156, 164, 156, 160, 159, 161, 162, 163, 156, 165, 167, 164, 161, 158, 163, 166, 168, 163, 169, 165, 167, 156, 172, 170, 174, 166, 168, 173, 169, 0, 171, 164, 172, 170, 174, 162, 0, 173, 168, 165, 171, 0, 161, 170, 166, 167, 165, 173, 167, 0, 173, 171, 172, 169, 175, 177, 176, 178, 179, 173, 174, 180, 0, 0, 175, 177, 176, 178, 179, 0, 181, 180, 177, 174, 0, 176, 182, 183, 0, 180, 181, 0, 184, 175, 176, 178, 182, 183, 176, 176, 180, 179, 184, 185, 0, 186, 0, 0, 187, 181, 0, 189, 177, 185, 176, 186, 179, 188, 187, 190, 185, 189, 0, 183, 191, 186, 0, 188, 192, 190, 186, 200, 182, 187, 191, 0, 183, 201, 192, 189, 190, 200, 188, 0, 0, 192, 215, 201, 215, 0, 185, 215, 215, 215, 215, 215, 215, 215, 215, 191, 219, 219, 219, 219, 219, 219, 219, 219, 0, 0, 229, 0, 0, 0, 0, 192, 220, 0, 220, 219, 229, 220, 220, 220, 220, 220, 220, 220, 220, 221, 221, 221, 221, 221, 221, 221, 221, 222, 222, 222, 222, 222, 222, 222, 222, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 230, 231, 232, 233, 234, 235, 238, 236, 237, 239, 230, 231, 232, 233, 234, 235, 238, 236, 237, 239, 241, 240, 242, 243, 244, 245, 235, 236, 237, 246, 241, 240, 242, 243, 244, 245, 238, 239, 240, 246, 248, 242, 245, 247, 0, 0, 0, 0, 241, 249, 248, 251, 0, 247, 244, 250, 242, 242, 0, 249, 247, 251, 246, 243, 252, 250, 249, 0, 240, 253, 251, 254, 245, 256, 252, 255, 250, 246, 257, 253, 0, 254, 259, 256, 258, 255, 0, 260, 257, 0, 247, 0, 259, 0, 258, 261, 249, 260, 262, 252, 263, 253, 254, 255, 264, 261, 265, 256, 262, 0, 263, 259, 266, 257, 264, 258, 265, 267, 268, 260, 270, 0, 266, 262, 269, 264, 272, 267, 268, 271, 270, 261, 273, 263, 269, 0, 272, 265, 0, 271, 274, 0, 273, 275, 261, 267, 0, 276, 263, 269, 274, 268, 271, 275, 277, 0, 270, 276, 278, 0, 272, 279, 280, 275, 277, 274, 268, 281, 278, 270, 282, 279, 280, 0, 283, 284, 285, 281, 0, 286, 282, 287, 288, 280, 283, 284, 285, 289, 281, 286, 0, 287, 288, 0, 278, 290, 279, 289, 291, 0, 286, 285, 288, 287, 292, 290, 0, 278, 291, 284, 293, 295, 294, 0, 292, 297, 290, 299, 296, 301, 293, 295, 294, 289, 0, 297, 291, 299, 296, 301, 302, 293, 295, 0, 292, 296, 289, 303, 299, 304, 302, 298, 293, 294, 298, 298, 298, 303, 298, 304, 305, 298, 297, 301, 308, 0, 0, 306, 303, 307, 305, 0, 309, 312, 308, 296, 300, 306, 311, 307, 0, 305, 309, 312, 0, 304, 300, 0, 311, 310, 307, 0, 313, 300, 300, 308, 300, 300, 304, 310, 0, 306, 313, 314, 300, 323, 312, 327, 333, 310, 300, 0, 300, 314, 311, 323, 313, 327, 333, 0, 0, 312, 0, 300, 0, 300, 0, 311, 318, 318, 318, 318, 318, 318, 318, 318, 314, 319, 319, 319, 319, 319, 319, 319, 319, 0, 0, 0, 0, 0, 0, 314, 320, 320, 320, 320, 320, 320, 320, 320, 321, 321, 321, 321, 321, 321, 321, 321, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 324, 325, 328, 326, 330, 329, 331, 332, 334, 335, 324, 325, 328, 326, 330, 329, 331, 332, 334, 335, 337, 330, 325, 326, 332, 324, 329, 336, 338, 342, 337, 0, 339, 0, 0, 328, 340, 336, 338, 342, 0, 331, 339, 334, 335, 0, 340, 341, 336, 344, 328, 330, 347, 343, 332, 337, 0, 341, 345, 344, 346, 348, 347, 343, 338, 349, 344, 339, 345, 340, 346, 348, 341, 343, 0, 349, 350, 338, 352, 345, 351, 346, 353, 354, 340, 347, 350, 355, 352, 349, 351, 356, 353, 354, 0, 358, 344, 355, 0, 359, 347, 356, 0, 357, 355, 358, 0, 348, 350, 359, 351, 360, 352, 357, 0, 353, 356, 361, 0, 362, 0, 360, 0, 363, 358, 364, 365, 361, 359, 362, 353, 366, 360, 363, 355, 364, 365, 368, 357, 0, 367, 366, 0, 369, 370, 371, 372, 368, 0, 364, 367, 366, 361, 369, 370, 371, 372, 363, 363, 0, 373, 367, 374, 375, 377, 372, 0, 376, 368, 370, 373, 378, 374, 375, 377, 379, 369, 376, 380, 374, 381, 378, 0, 375, 0, 379, 382, 0, 380, 0, 381, 369, 377, 383, 379, 0, 382, 383, 384, 373, 383, 378, 376, 383, 386, 381, 387, 384, 384, 374, 385, 380, 388, 385, 386, 389, 387, 390, 0, 391, 385, 392, 388, 0, 0, 389, 380, 390, 387, 391, 0, 392, 393, 388, 386, 394, 391, 0, 395, 396, 391, 397, 393, 398, 401, 394, 0, 390, 395, 396, 389, 397, 399, 398, 401, 400, 392, 402, 0, 0, 0, 403, 399, 404, 398, 400, 391, 402, 393, 396, 394, 403, 0, 404, 399, 0, 405, 411, 402, 395, 412, 393, 403, 413, 414, 400, 405, 411, 415, 416, 412, 418, 417, 413, 414, 419, 420, 0, 415, 416, 421, 418, 417, 422, 423, 419, 420, 411, 424, 425, 421, 426, 0, 422, 423, 0, 418, 420, 424, 425, 0, 426, 415, 427, 416, 417, 428, 429, 430, 424, 421, 0, 423, 427, 425, 431, 428, 429, 430, 432, 417, 426, 433, 422, 427, 431, 434, 435, 436, 432, 437, 428, 433, 438, 439, 442, 434, 435, 436, 440, 437, 430, 0, 438, 439, 442, 0, 443, 441, 440, 435, 444, 442, 0, 445, 432, 430, 443, 441, 0, 440, 444, 0, 438, 445, 437, 446, 447, 432, 441, 448, 449, 434, 450, 451, 452, 446, 447, 453, 454, 448, 449, 442, 450, 451, 452, 455, 446, 453, 454, 456, 457, 458, 0, 460, 0, 455, 459, 461, 453, 456, 457, 458, 450, 460, 455, 449, 459, 461, 462, 463, 0, 457, 458, 452, 461, 463, 459, 0, 462, 463, 465, 464, 0, 467, 468, 469, 465, 462, 460, 464, 465, 464, 466, 467, 468, 469, 466, 0, 470, 472, 471, 473, 466, 475, 461, 474, 476, 469, 470, 472, 471, 473, 0, 475, 477, 474, 476, 478, 467, 468, 471, 0, 474, 479, 477, 480, 481, 478, 475, 472, 482, 473, 0, 479, 483, 480, 481, 484, 485, 476, 482, 486, 478, 487, 483, 477, 488, 484, 485, 489, 0, 486, 474, 487, 476, 490, 488, 485, 493, 489, 484, 491, 492, 494, 482, 490, 0, 495, 493, 0, 496, 491, 492, 494, 497, 498, 488, 495, 499, 487, 496, 494, 0, 0, 497, 498, 495, 0, 499, 501, 490, 500, 487, 491, 0, 502, 503, 492, 0, 501, 0, 500, 504, 505, 497, 502, 503, 506, 499, 507, 500, 508, 504, 505, 509, 510, 496, 506, 511, 507, 512, 508, 513, 503, 509, 510, 0, 514, 511, 515, 512, 509, 513, 0, 516, 504, 505, 514, 511, 515, 0, 512, 506, 507, 516, 0, 517, 518, 519, 520, 504, 505, 521, 0, 522, 513, 517, 518, 519, 520, 0, 509, 521, 515, 522, 523, 524, 525, 518, 526, 513, 0, 527, 528, 529, 523, 524, 525, 531, 526, 530, 517, 527, 528, 529, 0, 532, 524, 531, 533, 530, 534, 535, 0, 536, 527, 532, 0, 525, 533, 530, 534, 535, 526, 536, 0, 0, 529, 537, 538, 539, 540, 0, 541, 542, 536, 532, 0, 537, 538, 539, 540, 529, 541, 542, 0, 535, 537, 533, 543, 544, 545, 540, 0, 546, 542, 547, 548, 549, 543, 544, 545, 0, 538, 546, 0, 547, 548, 549, 0, 550, 551, 544, 552, 0, 549, 539, 0, 553, 546, 550, 551, 554, 552, 543, 0, 555, 547, 553, 556, 551, 557, 554, 558, 559, 550, 555, 560, 561, 556, 562, 557, 563, 558, 559, 549, 553, 560, 561, 564, 562, 565, 563, 566, 0, 567, 568, 569, 556, 564, 0, 565, 570, 566, 558, 567, 568, 569, 571, 572, 560, 561, 570, 573, 566, 0, 0, 574, 571, 572, 0, 575, 576, 573, 564, 560, 561, 574, 577, 572, 567, 575, 576, 578, 579, 580, 581, 570, 577, 582, 583, 584, 585, 578, 579, 580, 581, 586, 587, 582, 583, 584, 585, 576, 580, 588, 589, 586, 587, 590, 581, 591, 579, 578, 0, 588, 589, 577, 586, 590, 592, 591, 0, 594, 584, 593, 595, 596, 591, 0, 592, 589, 587, 594, 597, 593, 595, 596, 598, 584, 599, 600, 594, 0, 597, 0, 601, 602, 598, 603, 599, 600, 604, 592, 605, 597, 601, 602, 591, 603, 593, 0, 604, 606, 605, 0, 607, 0, 592, 608, 609, 605, 0, 606, 610, 601, 607, 604, 611, 608, 609, 612, 602, 613, 610, 0, 614, 607, 611, 615, 608, 612, 617, 613, 616, 603, 614, 606, 618, 615, 619, 605, 617, 610, 616, 0, 609, 620, 618, 0, 619, 0, 0, 611, 621, 616, 622, 620, 623, 609, 624, 614, 615, 618, 621, 619, 622, 0, 623, 0, 624, 0, 0, 0, 0, 0, 0, 615, 0, 623, 0, 0, 0, 621, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 627, 627, 627, 627, 627, 627, 627, 627, 627, 627, 627, 627, 628, 0, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 630, 0, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, 631, 0, 0, 631, 0, 631, 631, 631, 633, 633, 633, 633, 0, 633, 633, 634, 0, 0, 634, 634, 635, 0, 0, 635, 635, 636, 636, 636, 636, 0, 636, 636, 637, 637, 0, 637, 637, 637, 637, 637, 637, 637, 637, 637, 638, 638, 638, 0, 638, 638, 638, 638, 638, 638, 638, 638, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 640, 640, 640, 640, 0, 0, 640, 640, 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, 642, 0, 642, 0, 0, 642, 643, 0, 0, 643, 643, 644, 644, 644, 0, 0, 644, 644, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625 } ; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET #line 1 "./sparql_lexer.l" /* -*- Mode: c; c-basic-offset: 2 -*- * * sparql_lexer.l - Rasqal SPARQL lexer - making tokens for sparql grammar generator * * Copyright (C) 2004-2014, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * To generate the C files from this source, rather than use the * shipped sparql_lexer.c/.h needs a patched version of flex 2.5.31 such * as the one available in Debian GNU/Linux. Details below * near the %option descriptions. * * SPARQL defined in http://www.w3.org/TR/rdf-sparql-query/ * http://www.w3.org/TR/2005/WD-rdf-sparql-query-20050419/ * * Editor's draft of above http://www.w3.org/2001/sw/DataAccess/rq23/ */ /* recognise 8-bits */ /* all symbols prefixed by this */ /* This is not needed, flex is invoked -osparql_lexer.c */ /* Emit a C header file for prototypes * Only available in flex 2.5.13 or newer. * It was renamed to header-file in flex 2.5.19 */ /* Do not emit #include * Only available in flex 2.5.7 or newer. * Broken in flex 2.5.31 without patches. */ #define YY_NO_UNISTD_H 1 /* Never interactive */ /* No isatty() check */ /* Batch scanner */ /* Never use yyunput */ /* Supply our own alloc/realloc/free functions */ /* Re-entrant scanner */ /* Makes sparql_lexer_get_lval() sparql_lexer_set_lval() functions * and yylval macro appear */ /* Makes yyget_lloc() yyset_lloc() and yylloc appear */ /* %option bison-locations */ /* definitions */ #line 87 "./sparql_lexer.l" /* NOTE: These headers are NOT included here. They are inserted by fix-flex * since otherwise it appears far too late in the generated C */ /* #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif */ #include #include #include #include #ifdef HAVE_SETJMP_H #include #endif #include #include #include #include /* Set RASQAL_DEBUG to 2 for verbose lexing (when building this as * sparql_lexer_test) and 3 for super verbose */ #if 0 #undef RASQAL_DEBUG #define RASQAL_DEBUG 3 #endif static int sparql_skip_c_comment(rasqal_query *rq); /* * Extra checks beyond valid Namespaces in XML 1.1 name * * SPARQL_NAME_CHECK_VARNAME (token VARNAME) * No '.' allowed. * No '-' allowed. * * SPARQL_NAME_CHECK_PREFIX (token NCNAME_PREFIX) * No '_' allowed as the first character. * No '.' allowed as the last character. * * SPARQL_NAME_CHECK_NCNAME (token NCNAME) * [0-9] allowed as the first character * No '.' allowed as the first character. * No '.' allowed as the last character. * */ typedef enum { SPARQL_NAME_CHECK_NO_UL_FIRST = 1, SPARQL_NAME_CHECK_NO_DOT_LAST = 2, SPARQL_NAME_CHECK_NO_DOT_MINUS = 4, SPARQL_NAME_CHECK_ALLOW_09_FIRST = 8, SPARQL_NAME_CHECK_VARNAME = SPARQL_NAME_CHECK_NO_DOT_MINUS, SPARQL_NAME_CHECK_PREFIX = SPARQL_NAME_CHECK_NO_UL_FIRST | SPARQL_NAME_CHECK_NO_DOT_LAST, SPARQL_NAME_CHECK_NCNAME = SPARQL_NAME_CHECK_NO_DOT_LAST | SPARQL_NAME_CHECK_ALLOW_09_FIRST } sparql_name_check_flags; static int rasqal_sparql_name_check(unsigned char *string, size_t length, sparql_name_check_flags check_flags); static unsigned char *sparql_copy_name(rasqal_query *rq, const unsigned char *text, size_t len, sparql_name_check_flags check_flags); static raptor_uri* sparql_copy_qname(rasqal_query *rq, const unsigned char *text, size_t len); static unsigned char *sparql_copy_string_token(rasqal_query* rq, unsigned char *text, size_t len, int delim); static int sparql_stringbuffer_append_sparql_string(rasqal_query* rq, raptor_stringbuffer* stringbuffer, const unsigned char *text, size_t len, int delim); #ifdef RASQAL_DEBUG const char * sparql_token_print(rasqal_world* world, int token, YYSTYPE *lval); #endif #ifdef __cplusplus #define INPUT_FN yyinput #else #define INPUT_FN input #endif #if FLEX_VERSION_DECIMAL < 20536 /* debian flex 2.5.35-10.1 added these column header prototypes in * re-entrant mode. standard flex omits them */ void sparql_lexer_set_column(int column_no, yyscan_t yyscanner); int sparql_lexer_get_column(yyscan_t yyscanner); #endif static void sparql_lexer_cleanup(yyscan_t yyscanner); /* Remove the re-fill function since it should never be called */ #define YY_INPUT(buf,result,max_size) { return YY_NULL; } /* Log error handler wrapper */ static void sparql_lexer_log_error(yyconst char *msg, raptor_log_level level, yyscan_t yyscanner); /* fatal error handler declaration * If we have a setjmp / longjmp then report an ERROR and do not abort. * * Flex's use of this macro makes doing a return impossible since some * uses require a return NULL, some an int and some no value :( */ #ifdef HAVE_SETJMP static jmp_buf sparql_lexer_log_error_longjmp_env; #define YY_FATAL_ERROR(msg) do { \ sparql_lexer_log_error(msg, RAPTOR_LOG_LEVEL_ERROR, yyscanner); \ longjmp(sparql_lexer_log_error_longjmp_env, 1); \ } while(0) #else #define YY_FATAL_ERROR(msg) do { \ sparql_lexer_log_error(msg, RAPTOR_LOG_LEVEL_FATAL, yyscanner); \ abort(); \ } while(0) #endif /* Error handler that returns EOF instead of abort() / longjmp() * so that parser can clean up properly */ #define YY_REPORT_ERROR_EOF(msg) do { \ sparql_lexer_log_error(msg, RAPTOR_LOG_LEVEL_ERROR, yyscanner); \ yyterminate(); \ } while(0) /* * rq23 is http://www.w3.org/2001/sw/DataAccess/rq23/ * CVS ID 1.420 2005/07/12 15:38:40 */ /* [85] NCCHAR1p ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | * [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | * [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | * [#x10000-#xEFFFF] * * This is an XML 1.1 NameStartChar * http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameStartChar * except * No '_' allowed. */ /* [86] NCCHAR1 ::= NCCHAR1p | '_' * This is an XML 1.1 NameStartChar * http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameStartChar */ /* [87] VARNAME ::= ( NCCHAR1 | _ ) * ( NCCHAR1 | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* * * This is an Namespaces in XML 1.1 Name except: * No '.' allowed. * No '-' allowed. */ /* [88] NCCHAR ::= * NCCHAR1 | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] * * This is XML 1.1 NameChar * http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameChar * except: * No '.' allowed. */ /* [89] NCNAME_PREFIX ::= NCCHAR1p ((NCCHAR|".")* NCCHAR)? * * This is an Namespaces in XML 1.1 Name except: * No '_' allowed as the first character. * No '.' allowed as the last character. */ /* [90] NCNAME ::= NCCHAR1 ((NCCHAR|".")* NCCHAR)? * * This is an Namespaces in XML 1.1 Name except: * No '.' allowed as the last character. */ /* SPARQL allows [0-9] after a : in the * W3C Candidate Recommendation 14 June 2007 * as an at risk feature that may be removed. */ /* rq23 [67] QNAME_NS ::= NCNAME_PREFIX? ':' * Inlined into in rule {NCNAME_PREFIX}":" below */ /* rq23 [68] QNAME ::= NCNAME_PREFIX? ':' NCNAME? */ /* rq23 [69] BNODE_LABEL (renamed to BNAME) ::= '_:' NCNAME */ /* a blank node name written inside a URI - this is an illegal * URI form and for convienence */ /* The initial char conditions are to ensure this doesn't grab < or <= * as operators. starting with <_: is caught by BNAME2 above. **/ #line 1501 "sparql_lexer.c" #define INITIAL 0 #define ID 1 #define SPID 2 #define PREF 3 #define LITERAL 4 #define LITERAL2 5 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #ifndef YY_NO_UNISTD_H #include #endif #endif #define YY_EXTRA_TYPE rasqal_query* /* Holds the entire state of the reentrant scanner. */ struct yyguts_t { /* User-defined. Not touched by flex. */ YY_EXTRA_TYPE yyextra_r; /* The rest are the same as the globals declared in the non-reentrant scanner. */ FILE *yyin_r, *yyout_r; size_t yy_buffer_stack_top; /**< index of top of stack. */ size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; int yy_n_chars; int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; int yy_did_buffer_switch_on_eof; int yy_start_stack_ptr; int yy_start_stack_depth; int *yy_start_stack; yy_state_type yy_last_accepting_state; char* yy_last_accepting_cpos; int yylineno_r; int yy_flex_debug_r; char *yytext_r; int yy_more_flag; int yy_more_len; YYSTYPE * yylval_r; }; /* end struct yyguts_t */ static int yy_init_globals (yyscan_t yyscanner ); /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ # define yylval yyg->yylval_r int sparql_lexer_lex_init (yyscan_t* scanner); int sparql_lexer_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int sparql_lexer_lex_destroy (yyscan_t yyscanner ); int sparql_lexer_get_debug (yyscan_t yyscanner ); void sparql_lexer_set_debug (int debug_flag ,yyscan_t yyscanner ); YY_EXTRA_TYPE sparql_lexer_get_extra (yyscan_t yyscanner ); void sparql_lexer_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *sparql_lexer_get_in (yyscan_t yyscanner ); void sparql_lexer_set_in (FILE * in_str ,yyscan_t yyscanner ); FILE *sparql_lexer_get_out (yyscan_t yyscanner ); void sparql_lexer_set_out (FILE * out_str ,yyscan_t yyscanner ); int sparql_lexer_get_leng (yyscan_t yyscanner ); char *sparql_lexer_get_text (yyscan_t yyscanner ); int sparql_lexer_get_lineno (yyscan_t yyscanner ); void sparql_lexer_set_lineno (int line_number ,yyscan_t yyscanner ); int sparql_lexer_get_column (yyscan_t yyscanner ); void sparql_lexer_set_column (int column_no ,yyscan_t yyscanner ); YYSTYPE * sparql_lexer_get_lval (yyscan_t yyscanner ); void sparql_lexer_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int sparql_lexer_wrap (yyscan_t yyscanner ); #else extern int sparql_lexer_wrap (yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner ); #else static int input (yyscan_t yyscanner ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int sparql_lexer_lex \ (YYSTYPE * yylval_param ,yyscan_t yyscanner); #define YY_DECL int sparql_lexer_lex \ (YYSTYPE * yylval_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; #line 313 "./sparql_lexer.l" /* rules */ int c; rasqal_query *rq; rasqal_sparql_query_language *rqe; rq = (rasqal_query*)yyextra; rqe = (rasqal_sparql_query_language*)rq->context; #ifdef HAVE_SETJMP if(setjmp(sparql_lexer_log_error_longjmp_env)) return 1; #endif #line 1766 "sparql_lexer.c" yylval = yylval_param; if ( !yyg->yy_init ) { yyg->yy_init = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yyg->yy_start ) yyg->yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { sparql_lexer_ensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = sparql_lexer__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } sparql_lexer__load_buffer_state(yyscanner ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; /* Support of yytext. */ *yy_cp = yyg->yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yyg->yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 626 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_current_state != 625 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yyg->yy_hold_char; yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 332 "./sparql_lexer.l" { /* C++ comment */ rqe->lineno++; } YY_BREAK case 2: YY_RULE_SETUP #line 336 "./sparql_lexer.l" { int lines = sparql_skip_c_comment(rq); if(lines < 0) yyterminate(); rqe->lineno += lines; } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP #line 342 "./sparql_lexer.l" { rqe->lineno++; } YY_BREAK case 4: YY_RULE_SETUP #line 344 "./sparql_lexer.l" { /* eat up other whitespace */ ; } YY_BREAK case 5: YY_RULE_SETUP #line 348 "./sparql_lexer.l" { return SELECT; } YY_BREAK case 6: YY_RULE_SETUP #line 349 "./sparql_lexer.l" { return FROM; } YY_BREAK case 7: YY_RULE_SETUP #line 350 "./sparql_lexer.l" { return WHERE; } YY_BREAK case 8: YY_RULE_SETUP #line 351 "./sparql_lexer.l" { BEGIN(PREF); return PREFIX; } YY_BREAK case 9: YY_RULE_SETUP #line 353 "./sparql_lexer.l" { return DESCRIBE; } YY_BREAK case 10: YY_RULE_SETUP #line 354 "./sparql_lexer.l" { return CONSTRUCT; } YY_BREAK case 11: YY_RULE_SETUP #line 355 "./sparql_lexer.l" { return ASK; } YY_BREAK case 12: YY_RULE_SETUP #line 356 "./sparql_lexer.l" { return DISTINCT; } YY_BREAK case 13: YY_RULE_SETUP #line 357 "./sparql_lexer.l" { return REDUCED; } YY_BREAK case 14: YY_RULE_SETUP #line 358 "./sparql_lexer.l" { return LIMIT; } YY_BREAK case 15: YY_RULE_SETUP #line 359 "./sparql_lexer.l" { return UNION; } YY_BREAK case 16: YY_RULE_SETUP #line 360 "./sparql_lexer.l" { return OPTIONAL; } YY_BREAK case 17: YY_RULE_SETUP #line 361 "./sparql_lexer.l" { return BASE; } YY_BREAK case 18: YY_RULE_SETUP #line 362 "./sparql_lexer.l" { return BOUND; } YY_BREAK case 19: YY_RULE_SETUP #line 363 "./sparql_lexer.l" { return STRLANG; } YY_BREAK case 20: YY_RULE_SETUP #line 364 "./sparql_lexer.l" { return STRDT; } YY_BREAK case 21: YY_RULE_SETUP #line 365 "./sparql_lexer.l" { return STR; } YY_BREAK case 22: YY_RULE_SETUP #line 366 "./sparql_lexer.l" { return LANG; } YY_BREAK case 23: YY_RULE_SETUP #line 367 "./sparql_lexer.l" { return DATATYPE; } YY_BREAK case 24: YY_RULE_SETUP #line 368 "./sparql_lexer.l" { return ISURI; } /* isURI and isIRI */ YY_BREAK case 25: YY_RULE_SETUP #line 369 "./sparql_lexer.l" { return ISBLANK; } YY_BREAK case 26: YY_RULE_SETUP #line 370 "./sparql_lexer.l" { return ISLITERAL; } YY_BREAK case 27: YY_RULE_SETUP #line 371 "./sparql_lexer.l" { return GRAPH; } YY_BREAK case 28: YY_RULE_SETUP #line 372 "./sparql_lexer.l" { return NAMED; } YY_BREAK case 29: YY_RULE_SETUP #line 373 "./sparql_lexer.l" { return FILTER; } YY_BREAK case 30: YY_RULE_SETUP #line 374 "./sparql_lexer.l" { return OFFSET; } YY_BREAK case 31: YY_RULE_SETUP #line 375 "./sparql_lexer.l" { return ORDER; } YY_BREAK case 32: YY_RULE_SETUP #line 376 "./sparql_lexer.l" { return BY; } YY_BREAK case 33: YY_RULE_SETUP #line 377 "./sparql_lexer.l" { return REGEX; } YY_BREAK case 34: YY_RULE_SETUP #line 378 "./sparql_lexer.l" { return ASC; } YY_BREAK case 35: YY_RULE_SETUP #line 379 "./sparql_lexer.l" { return DESC; } YY_BREAK case 36: YY_RULE_SETUP #line 380 "./sparql_lexer.l" { return LANGMATCHES; } YY_BREAK case 37: YY_RULE_SETUP #line 381 "./sparql_lexer.l" { return EXPLAIN; } YY_BREAK case 38: YY_RULE_SETUP #line 382 "./sparql_lexer.l" { return GROUP; } YY_BREAK case 39: YY_RULE_SETUP #line 383 "./sparql_lexer.l" { return HAVING; } YY_BREAK case 40: YY_RULE_SETUP #line 384 "./sparql_lexer.l" { return COUNT; } YY_BREAK case 41: YY_RULE_SETUP #line 385 "./sparql_lexer.l" { return SUM; } YY_BREAK case 42: YY_RULE_SETUP #line 386 "./sparql_lexer.l" { return AVG; } YY_BREAK case 43: YY_RULE_SETUP #line 387 "./sparql_lexer.l" { return MIN; } YY_BREAK case 44: YY_RULE_SETUP #line 388 "./sparql_lexer.l" { return MAX; } YY_BREAK case 45: YY_RULE_SETUP #line 389 "./sparql_lexer.l" { BEGIN(SPID); return AS; } YY_BREAK case 46: YY_RULE_SETUP #line 390 "./sparql_lexer.l" { return DELETE; } YY_BREAK case 47: YY_RULE_SETUP #line 391 "./sparql_lexer.l" { return INSERT; } YY_BREAK case 48: YY_RULE_SETUP #line 392 "./sparql_lexer.l" { return SAMETERM; } YY_BREAK case 49: YY_RULE_SETUP #line 393 "./sparql_lexer.l" { return LET; } YY_BREAK case 50: YY_RULE_SETUP #line 394 "./sparql_lexer.l" { return COALESCE; } YY_BREAK case 51: YY_RULE_SETUP #line 395 "./sparql_lexer.l" { return WITH; } YY_BREAK case 52: YY_RULE_SETUP #line 396 "./sparql_lexer.l" { return CLEAR; } YY_BREAK case 53: YY_RULE_SETUP #line 397 "./sparql_lexer.l" { return CREATE; } YY_BREAK case 54: YY_RULE_SETUP #line 398 "./sparql_lexer.l" { return SILENT; } YY_BREAK case 55: YY_RULE_SETUP #line 399 "./sparql_lexer.l" { return DATA; } YY_BREAK case 56: YY_RULE_SETUP #line 400 "./sparql_lexer.l" { return DROP; } YY_BREAK case 57: YY_RULE_SETUP #line 401 "./sparql_lexer.l" { return LOAD; } YY_BREAK case 58: YY_RULE_SETUP #line 402 "./sparql_lexer.l" { return INTO; } YY_BREAK case 59: YY_RULE_SETUP #line 403 "./sparql_lexer.l" { return IF; } YY_BREAK case 60: YY_RULE_SETUP #line 404 "./sparql_lexer.l" { return IRI; } YY_BREAK case 61: YY_RULE_SETUP #line 405 "./sparql_lexer.l" { return URI; } YY_BREAK case 62: YY_RULE_SETUP #line 406 "./sparql_lexer.l" { return BNODE; } YY_BREAK case 63: YY_RULE_SETUP #line 407 "./sparql_lexer.l" { return DEFAULT; } YY_BREAK case 64: YY_RULE_SETUP #line 408 "./sparql_lexer.l" { return NOT; } YY_BREAK case 65: YY_RULE_SETUP #line 409 "./sparql_lexer.l" { return IN; } YY_BREAK case 66: YY_RULE_SETUP #line 410 "./sparql_lexer.l" { return GROUP_CONCAT; } YY_BREAK case 67: YY_RULE_SETUP #line 411 "./sparql_lexer.l" { return SEPARATOR; } YY_BREAK case 68: YY_RULE_SETUP #line 412 "./sparql_lexer.l" { return BIND; } YY_BREAK case 69: YY_RULE_SETUP #line 413 "./sparql_lexer.l" { return BINDINGS; } YY_BREAK case 70: YY_RULE_SETUP #line 414 "./sparql_lexer.l" { return UNDEF; } YY_BREAK case 71: YY_RULE_SETUP #line 415 "./sparql_lexer.l" { return SERVICE; } YY_BREAK case 72: YY_RULE_SETUP #line 416 "./sparql_lexer.l" { return MINUS; } YY_BREAK case 73: YY_RULE_SETUP #line 417 "./sparql_lexer.l" { return ISNUMERIC; } YY_BREAK case 74: YY_RULE_SETUP #line 418 "./sparql_lexer.l" { return SAMPLE; } YY_BREAK case 75: YY_RULE_SETUP #line 419 "./sparql_lexer.l" { return YEAR; } YY_BREAK case 76: YY_RULE_SETUP #line 420 "./sparql_lexer.l" { return MONTH; } YY_BREAK case 77: YY_RULE_SETUP #line 421 "./sparql_lexer.l" { return DAY; } YY_BREAK case 78: YY_RULE_SETUP #line 422 "./sparql_lexer.l" { return HOURS; } YY_BREAK case 79: YY_RULE_SETUP #line 423 "./sparql_lexer.l" { return MINUTES; } YY_BREAK case 80: YY_RULE_SETUP #line 424 "./sparql_lexer.l" { return SECONDS; } YY_BREAK case 81: YY_RULE_SETUP #line 425 "./sparql_lexer.l" { return TIMEZONE; } YY_BREAK case 82: YY_RULE_SETUP #line 426 "./sparql_lexer.l" { return CURRENT_DATETIME; } YY_BREAK case 83: YY_RULE_SETUP #line 427 "./sparql_lexer.l" { return NOW; } YY_BREAK case 84: YY_RULE_SETUP #line 428 "./sparql_lexer.l" { return FROM_UNIXTIME; } YY_BREAK case 85: YY_RULE_SETUP #line 429 "./sparql_lexer.l" { return TO_UNIXTIME; } YY_BREAK case 86: YY_RULE_SETUP #line 430 "./sparql_lexer.l" { return CONCAT; } YY_BREAK case 87: YY_RULE_SETUP #line 431 "./sparql_lexer.l" { return STRLEN; } YY_BREAK case 88: YY_RULE_SETUP #line 432 "./sparql_lexer.l" { return SUBSTR; } YY_BREAK case 89: YY_RULE_SETUP #line 433 "./sparql_lexer.l" { return UCASE; } YY_BREAK case 90: YY_RULE_SETUP #line 434 "./sparql_lexer.l" { return LCASE; } YY_BREAK case 91: YY_RULE_SETUP #line 435 "./sparql_lexer.l" { return STRSTARTS; } YY_BREAK case 92: YY_RULE_SETUP #line 436 "./sparql_lexer.l" { return STRENDS; } YY_BREAK case 93: YY_RULE_SETUP #line 437 "./sparql_lexer.l" { return CONTAINS; } YY_BREAK case 94: YY_RULE_SETUP #line 438 "./sparql_lexer.l" { return ENCODE_FOR_URI; } YY_BREAK case 95: YY_RULE_SETUP #line 439 "./sparql_lexer.l" { return TO; } YY_BREAK case 96: YY_RULE_SETUP #line 440 "./sparql_lexer.l" { return ADD; } YY_BREAK case 97: YY_RULE_SETUP #line 441 "./sparql_lexer.l" { return MOVE; } YY_BREAK case 98: YY_RULE_SETUP #line 442 "./sparql_lexer.l" { return COPY; } YY_BREAK case 99: YY_RULE_SETUP #line 443 "./sparql_lexer.l" { return ALL; } YY_BREAK case 100: YY_RULE_SETUP #line 444 "./sparql_lexer.l" { return TZ; } YY_BREAK case 101: YY_RULE_SETUP #line 445 "./sparql_lexer.l" { return RAND; } YY_BREAK case 102: YY_RULE_SETUP #line 446 "./sparql_lexer.l" { return ABS; } YY_BREAK case 103: YY_RULE_SETUP #line 447 "./sparql_lexer.l" { return ROUND; } YY_BREAK case 104: YY_RULE_SETUP #line 448 "./sparql_lexer.l" { return CEIL; } YY_BREAK case 105: YY_RULE_SETUP #line 449 "./sparql_lexer.l" { return FLOOR; } YY_BREAK case 106: YY_RULE_SETUP #line 450 "./sparql_lexer.l" { return MD5; } YY_BREAK case 107: YY_RULE_SETUP #line 451 "./sparql_lexer.l" { return SHA1; } YY_BREAK case 108: YY_RULE_SETUP #line 452 "./sparql_lexer.l" { return SHA224; } YY_BREAK case 109: YY_RULE_SETUP #line 453 "./sparql_lexer.l" { return SHA256; } YY_BREAK case 110: YY_RULE_SETUP #line 454 "./sparql_lexer.l" { return SHA384; } YY_BREAK case 111: YY_RULE_SETUP #line 455 "./sparql_lexer.l" { return SHA512; } YY_BREAK case 112: YY_RULE_SETUP #line 456 "./sparql_lexer.l" { return STRBEFORE; } YY_BREAK case 113: YY_RULE_SETUP #line 457 "./sparql_lexer.l" { return STRAFTER; } YY_BREAK case 114: YY_RULE_SETUP #line 458 "./sparql_lexer.l" { return REPLACE; } YY_BREAK case 115: YY_RULE_SETUP #line 459 "./sparql_lexer.l" { return UUID; } YY_BREAK case 116: YY_RULE_SETUP #line 460 "./sparql_lexer.l" { return STRUUID; } YY_BREAK case 117: YY_RULE_SETUP #line 461 "./sparql_lexer.l" { return VALUES; } YY_BREAK case 118: YY_RULE_SETUP #line 463 "./sparql_lexer.l" { return A; } YY_BREAK case 119: YY_RULE_SETUP #line 465 "./sparql_lexer.l" { return ','; } YY_BREAK case 120: YY_RULE_SETUP #line 466 "./sparql_lexer.l" { return '('; } YY_BREAK case 121: YY_RULE_SETUP #line 467 "./sparql_lexer.l" { return ')'; } YY_BREAK case 122: YY_RULE_SETUP #line 468 "./sparql_lexer.l" { return '['; } YY_BREAK case 123: YY_RULE_SETUP #line 469 "./sparql_lexer.l" { return ']'; } YY_BREAK case 124: YY_RULE_SETUP #line 470 "./sparql_lexer.l" { BEGIN(ID); return '?'; } YY_BREAK case 125: YY_RULE_SETUP #line 471 "./sparql_lexer.l" { BEGIN(ID); return '$'; } YY_BREAK case 126: YY_RULE_SETUP #line 472 "./sparql_lexer.l" { return '{'; } YY_BREAK case 127: YY_RULE_SETUP #line 473 "./sparql_lexer.l" { return '}'; } YY_BREAK case 128: YY_RULE_SETUP #line 474 "./sparql_lexer.l" { return '.'; } YY_BREAK case 129: YY_RULE_SETUP #line 475 "./sparql_lexer.l" { return ';'; } YY_BREAK case 130: YY_RULE_SETUP #line 477 "./sparql_lexer.l" { return SC_OR; } YY_BREAK case 131: YY_RULE_SETUP #line 478 "./sparql_lexer.l" { return SC_AND; } YY_BREAK case 132: YY_RULE_SETUP #line 480 "./sparql_lexer.l" { return EQ; } YY_BREAK case 133: YY_RULE_SETUP #line 481 "./sparql_lexer.l" { return NEQ; } YY_BREAK case 134: /* rule 134 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 482 "./sparql_lexer.l" { return LT; } YY_BREAK case 135: YY_RULE_SETUP #line 483 "./sparql_lexer.l" { return GT; } YY_BREAK case 136: YY_RULE_SETUP #line 484 "./sparql_lexer.l" { return LE; } YY_BREAK case 137: YY_RULE_SETUP #line 485 "./sparql_lexer.l" { return GE; } YY_BREAK case 138: YY_RULE_SETUP #line 487 "./sparql_lexer.l" { return '*'; } YY_BREAK case 139: YY_RULE_SETUP #line 488 "./sparql_lexer.l" { return '/'; } YY_BREAK case 140: YY_RULE_SETUP #line 489 "./sparql_lexer.l" { return '!'; } YY_BREAK case 141: YY_RULE_SETUP #line 491 "./sparql_lexer.l" { return ASSIGN; } YY_BREAK case 142: YY_RULE_SETUP #line 493 "./sparql_lexer.l" { yylval->name = RASQAL_MALLOC(unsigned char*, yyleng); if(!yylval->name) YY_REPORT_ERROR_EOF("Out of memory"); memcpy(yylval->name, yytext + 1, yyleng - 1); yylval->name[yyleng - 1] = '\0'; return LANGTAG; } YY_BREAK case 143: YY_RULE_SETUP #line 503 "./sparql_lexer.l" { return HATHAT; } YY_BREAK case 144: YY_RULE_SETUP #line 506 "./sparql_lexer.l" { c = *yytext; yylval->literal = rasqal_new_typed_literal(rq->world, RASQAL_LITERAL_INTEGER, RASQAL_GOOD_CAST(const unsigned char*, yytext)); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_typed_literal failed"); return (c=='+' ? INTEGER_POSITIVE_LITERAL : (c == '-' ? INTEGER_NEGATIVE_LITERAL : INTEGER_LITERAL)); } YY_BREAK case 145: YY_RULE_SETUP #line 513 "./sparql_lexer.l" { c = *yytext; if(!rasqal_xsd_datatype_check(RASQAL_LITERAL_DECIMAL, RASQAL_GOOD_CAST(const unsigned char*, yytext), 0)) { sparql_syntax_error(rq, "SPARQL syntax error - Illegal decimal constant %s", yytext); yyterminate(); } yylval->literal = rasqal_new_decimal_literal(rq->world, RASQAL_GOOD_CAST(const unsigned char*, yytext)); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_decimal_literal failed"); return (c=='+' ? DECIMAL_POSITIVE_LITERAL : (c == '-' ? DECIMAL_NEGATIVE_LITERAL : DECIMAL_LITERAL)); } YY_BREAK case 146: YY_RULE_SETUP #line 526 "./sparql_lexer.l" { c = *yytext; if(!rasqal_xsd_datatype_check(RASQAL_LITERAL_DOUBLE, RASQAL_GOOD_CAST(const unsigned char*, yytext), 0)) { sparql_syntax_error(rq, "SPARQL syntax error - Illegal double constant %s", yytext); yyterminate(); } yylval->literal = rasqal_new_typed_literal(rq->world, RASQAL_LITERAL_DOUBLE, RASQAL_GOOD_CAST(const unsigned char*, yytext)); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_typed_literal failed"); return (c=='+' ? DOUBLE_POSITIVE_LITERAL : (c == '-' ? DOUBLE_NEGATIVE_LITERAL : DOUBLE_LITERAL)); } YY_BREAK case 147: YY_RULE_SETUP #line 538 "./sparql_lexer.l" { return '+'; } YY_BREAK case 148: YY_RULE_SETUP #line 539 "./sparql_lexer.l" { return '-'; } YY_BREAK case 149: YY_RULE_SETUP #line 541 "./sparql_lexer.l" { /*' */ yylval->name = sparql_copy_string_token(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 1, yyleng - 2, '\''); if(!yylval->name) YY_REPORT_ERROR_EOF("sparql_copy_string_token failed"); return STRING; } YY_BREAK case 150: YY_RULE_SETUP #line 547 "./sparql_lexer.l" { /* " */ yylval->name = sparql_copy_string_token(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 1, yyleng - 2, '"'); if(!yylval->name) YY_REPORT_ERROR_EOF("sparql_copy_string_token failed"); return STRING; } YY_BREAK case 151: YY_RULE_SETUP #line 553 "./sparql_lexer.l" { BEGIN(LITERAL); rqe->sb = raptor_new_stringbuffer(); if(!rqe->sb) YY_REPORT_ERROR_EOF("raptor_new_stringbuffer failed"); } YY_BREAK case 152: YY_RULE_SETUP #line 559 "./sparql_lexer.l" { size_t len; BEGIN(INITIAL); len = raptor_stringbuffer_length(rqe->sb); yylval->name = RASQAL_MALLOC(unsigned char*, len + 1); if(!yylval->name) YY_REPORT_ERROR_EOF("Out of memory"); raptor_stringbuffer_copy_to_string(rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yylval->name), len); yylval->name[len] = '\0'; raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return STRING; } YY_BREAK case 153: /* rule 153 can match eol */ YY_RULE_SETUP #line 576 "./sparql_lexer.l" { char *p; if(*yytext == EOF) { BEGIN(INITIAL); sparql_syntax_error(rq, "End of file in middle of literal"); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return EOF; } for(p = yytext; *p; p++) { if(*p == '\n') rqe->lineno++; } if(sparql_stringbuffer_append_sparql_string(rq, rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yytext), yyleng, '"')) { /* " */ BEGIN(INITIAL); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; YY_REPORT_ERROR_EOF("sparql_stringbuffer_append_sparql_string failed"); } } YY_BREAK case 154: YY_RULE_SETUP #line 601 "./sparql_lexer.l" { /* this should only happen if \ is at the end of the file so the Turtle doc is illegal anyway */ sparql_syntax_error(rq, "End of file in middle of literal"); } YY_BREAK case 155: YY_RULE_SETUP #line 606 "./sparql_lexer.l" { BEGIN(LITERAL2); rqe->sb = raptor_new_stringbuffer(); if(!rqe->sb) { BEGIN(INITIAL); YY_REPORT_ERROR_EOF("raptor_new_stringbuffer failed"); } } YY_BREAK case 156: YY_RULE_SETUP #line 614 "./sparql_lexer.l" { size_t len; BEGIN(INITIAL); len = raptor_stringbuffer_length(rqe->sb); yylval->name = RASQAL_MALLOC(unsigned char*, len + 1); if(!yylval->name) YY_REPORT_ERROR_EOF("Out of memory"); raptor_stringbuffer_copy_to_string(rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yylval->name), len); yylval->name[len] = '\0'; raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return STRING; } YY_BREAK case 157: /* rule 157 can match eol */ YY_RULE_SETUP #line 630 "./sparql_lexer.l" { char *p; if(*yytext == EOF) { BEGIN(INITIAL); sparql_syntax_error(rq, "End of file in middle of \"\"\" literal"); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; return EOF; } for(p = yytext; *p; p++) { if(*p == '\n') rqe->lineno++; } if(sparql_stringbuffer_append_sparql_string(rq, rqe->sb, RASQAL_GOOD_CAST(unsigned char*, yytext), yyleng, '\'')) { BEGIN(INITIAL); raptor_free_stringbuffer(rqe->sb); rqe->sb = NULL; YY_REPORT_ERROR_EOF("sparql_stringbuffer_append_sparql_string failed"); } } YY_BREAK case 158: YY_RULE_SETUP #line 655 "./sparql_lexer.l" { /* this should only happen if \ is at the end of the file so the Turtle doc is illegal anyway */ sparql_syntax_error(rq, "End of file in middle of ''' literal"); } YY_BREAK case 159: YY_RULE_SETUP #line 662 "./sparql_lexer.l" { yylval->literal = rasqal_new_boolean_literal(rq->world, 1); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_boolean_literal failed"); return BOOLEAN_LITERAL; } YY_BREAK case 160: YY_RULE_SETUP #line 667 "./sparql_lexer.l" { yylval->literal = rasqal_new_boolean_literal(rq->world, 0); if(!yylval->literal) YY_REPORT_ERROR_EOF("rasqal_new_boolean_literal failed"); return BOOLEAN_LITERAL; } YY_BREAK case 161: YY_RULE_SETUP #line 672 "./sparql_lexer.l" { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng, SPARQL_NAME_CHECK_VARNAME); if(!yylval->name) yyterminate(); BEGIN(INITIAL); return IDENTIFIER; } YY_BREAK case 162: /* rule 162 can match eol */ YY_RULE_SETUP #line 678 "./sparql_lexer.l" { BEGIN(INITIAL); sparql_syntax_error(rq, "SPARQL syntax error - missing variable name after ?"); yyterminate(); } YY_BREAK case 163: YY_RULE_SETUP #line 683 "./sparql_lexer.l" { /* eat up leading whitespace */ ; } YY_BREAK case 164: YY_RULE_SETUP #line 687 "./sparql_lexer.l" { return '?'; } YY_BREAK case 165: YY_RULE_SETUP #line 691 "./sparql_lexer.l" { return '$'; } YY_BREAK case 166: YY_RULE_SETUP #line 695 "./sparql_lexer.l" { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng, SPARQL_NAME_CHECK_VARNAME); if(!yylval->name) yyterminate(); BEGIN(INITIAL); return IDENTIFIER; } YY_BREAK case 167: /* rule 167 can match eol */ YY_RULE_SETUP #line 702 "./sparql_lexer.l" { BEGIN(INITIAL); sparql_syntax_error(rq, "SPARQL syntax error - missing variable name after ?"); yyterminate(); } YY_BREAK case 168: YY_RULE_SETUP #line 707 "./sparql_lexer.l" { /* eat up leading whitespace */ } YY_BREAK case 169: YY_RULE_SETUP #line 708 "./sparql_lexer.l" { BEGIN(INITIAL); yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng - 1, SPARQL_NAME_CHECK_PREFIX); if(!yylval->name) yyterminate(); return IDENTIFIER; } YY_BREAK case 170: YY_RULE_SETUP #line 714 "./sparql_lexer.l" { BEGIN(INITIAL); yylval->name = NULL; return IDENTIFIER; } YY_BREAK case 171: /* rule 171 can match eol */ YY_RULE_SETUP #line 718 "./sparql_lexer.l" { BEGIN(INITIAL); if(!*yytext) return EOF; sparql_syntax_error(rq, "SPARQL syntax error at '%c'", *yytext); yyterminate(); } YY_BREAK case 172: YY_RULE_SETUP #line 726 "./sparql_lexer.l" { int have_brace = (yytext[yyleng-1]=='('); if(have_brace) yyleng--; yylval->uri = sparql_copy_qname(rq, RASQAL_GOOD_CAST(const unsigned char*, yytext), yyleng); if(!yylval->uri) yyterminate(); return have_brace ? URI_LITERAL_BRACE : URI_LITERAL; } YY_BREAK case 173: YY_RULE_SETUP #line 737 "./sparql_lexer.l" { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 2, yyleng - 2, SPARQL_NAME_CHECK_NCNAME); if(!yylval->name) yyterminate(); return BLANK_LITERAL; } YY_BREAK case 174: YY_RULE_SETUP #line 744 "./sparql_lexer.l" { yylval->name = sparql_copy_name(rq, RASQAL_GOOD_CAST(unsigned char*, yytext) + 3, yyleng - 4, SPARQL_NAME_CHECK_NCNAME); if(!yylval->name) yyterminate(); return BLANK_LITERAL; } YY_BREAK case 175: /* rule 175 can match eol */ YY_RULE_SETUP #line 751 "./sparql_lexer.l" { int have_brace = (yytext[yyleng-1]=='('); if(have_brace) yyleng--; if(yyleng == 2) yylval->uri = raptor_uri_copy(rq->base_uri); else { unsigned char* uri_string; yytext[yyleng-1] = '\0'; uri_string = rasqal_escaped_name_to_utf8_string(RASQAL_GOOD_CAST(unsigned char*, yytext) + 1, yyleng-1, NULL, sparql_syntax_error, rq); if(!uri_string) YY_REPORT_ERROR_EOF("rasqal_escaped_name_to_utf8_string failed"); yylval->uri = raptor_new_uri_relative_to_base(rq->world->raptor_world_ptr, rq->base_uri, uri_string); RASQAL_FREE(char*, uri_string); if(!yylval->uri) YY_REPORT_ERROR_EOF("raptor_new_uri_relative_to_base failed"); } return have_brace ? URI_LITERAL_BRACE : URI_LITERAL; } YY_BREAK case 176: /* rule 176 can match eol */ YY_RULE_SETUP #line 775 "./sparql_lexer.l" { /* # comment */ rqe->lineno++; } YY_BREAK case 177: YY_RULE_SETUP #line 779 "./sparql_lexer.l" { if(!*yytext) return EOF; sparql_syntax_error(rq, "SPARQL syntax error at '%c'", *yytext); yyterminate(); } YY_BREAK case 178: YY_RULE_SETUP #line 786 "./sparql_lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 2981 "sparql_lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(ID): case YY_STATE_EOF(SPID): case YY_STATE_EOF(PREF): case YY_STATE_EOF(LITERAL): case YY_STATE_EOF(LITERAL2): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yyg->yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * sparql_lexer_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( yyscanner ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yyg->yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; } } else switch ( yy_get_next_buffer( yyscanner ) ) { case EOB_ACT_END_OF_FILE: { yyg->yy_did_buffer_switch_on_eof = 0; if ( sparql_lexer_wrap(yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( yyscanner ); yy_cp = yyg->yy_c_buf_p; yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yyg->yy_c_buf_p = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; yy_current_state = yy_get_previous_state( yyscanner ); yy_cp = yyg->yy_c_buf_p; yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of sparql_lexer_lex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = yyg->yytext_ptr; register int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ sparql_lexer_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), yyg->yy_n_chars, num_to_read ); } if ( yyg->yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; sparql_lexer_restart(yyin ,yyscanner); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) sparql_lexer_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { register yy_state_type yy_current_state; register char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 626 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { register int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ register char *yy_cp = yyg->yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 626 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 625); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) #else static int input (yyscan_t yyscanner) #endif { int c; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; *yyg->yy_c_buf_p = yyg->yy_hold_char; if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) /* This was really a NUL. */ *yyg->yy_c_buf_p = '\0'; else { /* need more input */ int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ sparql_lexer_restart(yyin ,yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( sparql_lexer_wrap(yyscanner ) ) return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(yyscanner); #else return input(yyscanner); #endif } case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + offset; break; } } } c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ yyg->yy_hold_char = *++yyg->yy_c_buf_p; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ void sparql_lexer_restart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! yyg->yy_buffer_stack ){ sparql_lexer_ensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = sparql_lexer__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } sparql_lexer__init_buffer(YY_CURRENT_BUFFER_LVALUE,input_file ,yyscanner); sparql_lexer__load_buffer_state(yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ void sparql_lexer__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with * sparql_lexer_pop_buffer_state(); * sparql_lexer_push_buffer_state(new_buffer); */ sparql_lexer_ensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER_LVALUE == new_buffer ) return; if ( YY_CURRENT_BUFFER_LVALUE ) { /* Flush out information for old buffer. */ *yyg->yy_c_buf_p = yyg->yy_hold_char; YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } YY_CURRENT_BUFFER_LVALUE = new_buffer; sparql_lexer__load_buffer_state(yyscanner ); /* We don't actually know whether we did this switch during * EOF (sparql_lexer_wrap()) processing, but the only time this flag * is looked at is after sparql_lexer_wrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } static void sparql_lexer__load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; yyg->yy_hold_char = *yyg->yy_c_buf_p; } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * @param yyscanner The scanner object. * @return the allocated buffer state. */ YY_BUFFER_STATE sparql_lexer__create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) sparql_lexer_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in sparql_lexer__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) sparql_lexer_alloc(b->yy_buf_size + 2 ,yyscanner ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in sparql_lexer__create_buffer()" ); b->yy_is_our_buffer = 1; sparql_lexer__init_buffer(b,file ,yyscanner); return b; } /** Destroy the buffer. * @param b a buffer created with sparql_lexer__create_buffer() * @param yyscanner The scanner object. */ void sparql_lexer__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) sparql_lexer_free((void *) b->yy_ch_buf ,yyscanner ); sparql_lexer_free((void *) b ,yyscanner ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a sparql_lexer_restart() or at EOF. */ static void sparql_lexer__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; sparql_lexer__flush_buffer(b ,yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then sparql_lexer__init_buffer was _probably_ * called from sparql_lexer_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ void sparql_lexer__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) sparql_lexer__load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * @param yyscanner The scanner object. */ void sparql_lexer_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; sparql_lexer_ensure_buffer_stack(yyscanner); /* This block is copied from sparql_lexer__switch_to_buffer. */ if ( YY_CURRENT_BUFFER_LVALUE ) { /* Flush out information for old buffer. */ *yyg->yy_c_buf_p = yyg->yy_hold_char; YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER_LVALUE) yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from sparql_lexer__switch_to_buffer. */ sparql_lexer__load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * @param yyscanner The scanner object. */ void sparql_lexer_pop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; sparql_lexer__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER_LVALUE) { sparql_lexer__load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void sparql_lexer_ensure_buffer_stack (yyscan_t yyscanner) { int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; yyg->yy_buffer_stack = (struct yy_buffer_state**)sparql_lexer_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in sparql_lexer_ensure_buffer_stack()" ); memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; } if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)sparql_lexer_realloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in sparql_lexer_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ YY_BUFFER_STATE sparql_lexer__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) sparql_lexer_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in sparql_lexer__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; sparql_lexer__switch_to_buffer(b ,yyscanner ); return b; } /** Setup the input buffer state to scan a string. The next call to sparql_lexer_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * sparql_lexer__scan_bytes() instead. */ YY_BUFFER_STATE sparql_lexer__scan_string (yyconst char * yystr , yyscan_t yyscanner) { return sparql_lexer__scan_bytes(yystr,strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to sparql_lexer_lex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ YY_BUFFER_STATE sparql_lexer__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) sparql_lexer_alloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in sparql_lexer__scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = sparql_lexer__scan_buffer(buf,n ,yyscanner); if ( ! b ) YY_FATAL_ERROR( "bad buffer in sparql_lexer__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = yyg->yy_hold_char; \ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ yyg->yy_hold_char = *yyg->yy_c_buf_p; \ *yyg->yy_c_buf_p = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ YY_EXTRA_TYPE sparql_lexer_get_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; } /** Get the current line number. * @param yyscanner The scanner object. */ int sparql_lexer_get_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (! YY_CURRENT_BUFFER) return 0; return yylineno; } /** Get the current column number. * @param yyscanner The scanner object. */ int sparql_lexer_get_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (! YY_CURRENT_BUFFER) return 0; return yycolumn; } /** Get the input stream. * @param yyscanner The scanner object. */ FILE *sparql_lexer_get_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; } /** Get the output stream. * @param yyscanner The scanner object. */ FILE *sparql_lexer_get_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; } /** Get the length of the current token. * @param yyscanner The scanner object. */ int sparql_lexer_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; } /** Get the current token. * @param yyscanner The scanner object. */ char *sparql_lexer_get_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; } /** Set the user-defined data. This data is never touched by the scanner. * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ void sparql_lexer_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; } /** Set the current line number. * @param line_number * @param yyscanner The scanner object. */ void sparql_lexer_set_lineno (int line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR("sparql_lexer_set_lineno called with no buffer"); yylineno = line_number; } /** Set the current column. * @param line_number * @param yyscanner The scanner object. */ void sparql_lexer_set_column (int column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR("sparql_lexer_set_column called with no buffer"); yycolumn = column_no; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * @param yyscanner The scanner object. * @see sparql_lexer__switch_to_buffer */ void sparql_lexer_set_in (FILE * in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyin = in_str ; } void sparql_lexer_set_out (FILE * out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyout = out_str ; } int sparql_lexer_get_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } void sparql_lexer_set_debug (int bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flex_debug = bdebug ; } /* Accessor methods for yylval and yylloc */ YYSTYPE * sparql_lexer_get_lval (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylval; } void sparql_lexer_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; } /* User-visible API */ /* sparql_lexer_lex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ int sparql_lexer_lex_init(yyscan_t* ptr_yy_globals) { if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } *ptr_yy_globals = (yyscan_t) sparql_lexer_alloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); return yy_init_globals ( *ptr_yy_globals ); } /* sparql_lexer_lex_init_extra has the same functionality as sparql_lexer_lex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). * The user defined value in the first argument will be available to sparql_lexer_alloc in * the yyextra field. */ int sparql_lexer_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; sparql_lexer_set_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } *ptr_yy_globals = (yyscan_t) sparql_lexer_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); sparql_lexer_set_extra (yy_user_defined, *ptr_yy_globals); return yy_init_globals ( *ptr_yy_globals ); } static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. * This function is called from sparql_lexer_lex_destroy(), so don't allocate here. */ yyg->yy_buffer_stack = 0; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; yyg->yy_c_buf_p = (char *) 0; yyg->yy_init = 0; yyg->yy_start = 0; yyg->yy_start_stack_ptr = 0; yyg->yy_start_stack_depth = 0; yyg->yy_start_stack = NULL; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * sparql_lexer_lex_init() */ return 0; } /* sparql_lexer_lex_destroy is for both reentrant and non-reentrant scanners. */ int sparql_lexer_lex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ sparql_lexer__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; sparql_lexer_pop_buffer_state(yyscanner); } /* Destroy the stack itself. */ sparql_lexer_free(yyg->yy_buffer_stack ,yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ sparql_lexer_free(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * sparql_lexer_lex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ /* clean up leaks if any before freeing yyscanner */ sparql_lexer_cleanup(yyscanner); sparql_lexer_free ( yyscanner , yyscanner ); yyscanner = NULL; return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #define YYTABLES_NAME "yytables" #line 786 "./sparql_lexer.l" /* user code */ int sparql_lexer_wrap (yyscan_t yyscanner) { return 1; } static int rasqal_sparql_name_check(unsigned char *string, size_t length, sparql_name_check_flags check_flags) { int rc = 0; int c = -1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1("Checking name '"); if(length) fwrite(string, length, sizeof(unsigned char), stderr); fprintf(stderr, "' (length %d), flags %d\n", RASQAL_BAD_CAST(int, length), RASQAL_GOOD_CAST(int, check_flags)); #endif if(!length) return 1; if((check_flags & SPARQL_NAME_CHECK_ALLOW_09_FIRST) && (*string >= '0' && *string <= '9')) { c = *string; *string = 'X'; } if(!raptor_xml_name_check(string, length, 11)) /* 11 = XML 1.1 */ goto done; if((check_flags & SPARQL_NAME_CHECK_NO_UL_FIRST) && *string == '_') goto done; if((check_flags & SPARQL_NAME_CHECK_NO_DOT_LAST) && string[length-1] == '.') goto done; if(check_flags & SPARQL_NAME_CHECK_NO_DOT_MINUS) { size_t i; for(i = 0; i < length; i++) if(string[i] == '.' || string[i] == '-') goto done; } rc = 1; done: if(c >= 0) *string = c; return rc; } static unsigned char * sparql_copy_name(rasqal_query *rq, const unsigned char *text, size_t len, sparql_name_check_flags check_flags) { size_t dest_len = 0; unsigned char *s; s = rasqal_escaped_name_to_utf8_string(RASQAL_GOOD_CAST(unsigned char*, text), len, &dest_len, sparql_syntax_error, rq); if(!s) { sparql_syntax_error(rq, "Failed to decode SPARQL string \"%s\"", text); return s; } if(!rasqal_sparql_name_check(s, dest_len, check_flags)) sparql_syntax_error(rq, "Invalid SPARQL name \"%s\"", s); return s; } static raptor_uri* sparql_copy_qname(rasqal_query *rq, const unsigned char *text, size_t len) { unsigned char *p; size_t dest_len = 0; unsigned char *s; raptor_uri* uri = NULL; s = rasqal_escaped_name_to_utf8_string(RASQAL_GOOD_CAST(unsigned char*, text), len, &dest_len, sparql_syntax_error, rq); if(!s) { sparql_syntax_error(rq, "Failed to decode SPARQL ID \"%s\"", text); return NULL; } p = RASQAL_GOOD_CAST(unsigned char*, strchr(RASQAL_GOOD_CAST(const char*, s), ':')); if(!rasqal_sparql_name_check(s, p-s, SPARQL_NAME_CHECK_PREFIX)) sparql_syntax_error(rq, "Invalid SPARQL prefix name \"%s\"", s); if(!rasqal_sparql_name_check(p+1, dest_len-((p+1)-s), SPARQL_NAME_CHECK_NCNAME)) sparql_syntax_error(rq, "Invalid SPARQL local name \"%s\"", p+1); #ifdef STANDALONE /* lexer test cannot declare namespaces - so just ignore expansion */ uri = raptor_new_uri_relative_to_base(rq->world->raptor_world_ptr, rq->base_uri, s); #else /* not */ if(!rq->namespaces) { sparql_syntax_error(rq, "SPARQL syntax error - no namespaces declared"); return NULL; } uri = raptor_qname_string_to_uri(rq->namespaces, s, dest_len); #endif /* STANDALONE */ RASQAL_FREE(char*, s); return uri; } static unsigned char* sparql_copy_string_token(rasqal_query* rq, unsigned char *string, size_t len, int delim) { raptor_stringbuffer* sb = NULL; int rc; if(len) { sb = raptor_new_stringbuffer(); if(!sb) return NULL; rc = sparql_stringbuffer_append_sparql_string(rq, sb, string, len, delim); if(rc) { raptor_free_stringbuffer(sb); return NULL; } len = raptor_stringbuffer_length(sb); } string = RASQAL_MALLOC(unsigned char*, len + 1); if(string) { if(sb) raptor_stringbuffer_copy_to_string(sb, string, len + 1); string[len]='\0'; } if(sb) raptor_free_stringbuffer(sb); return string; } static int sparql_skip_c_comment(rasqal_query *rq) { rasqal_sparql_query_language *rqe; yyscan_t yyscanner; int lines = 0; int lastc = -1; rqe = (rasqal_sparql_query_language*)rq->context; yyscanner = rqe->scanner; while(1) { int c = INPUT_FN(yyscanner); if(c == EOF) { /* EOF */ sparql_syntax_error(rq, "SPARQL syntax error - EOF in comment"); lines = -1; break; } if(c == '\r' || (c == '\n' && lastc != '\r')) lines++; if(lastc == '*' && c == '/') break; lastc = c; } return lines; } /** * sparql_stringbuffer_append_sparql_string: * @rq: rasqal query * @stringbuffer: String buffer to add to * @text: turtle string to decode * @len: length of string * @delim: terminating delimiter for string - only ', " or > are allowed * * INTERNAL - Append to a stringbuffer a SPARQL-escaped string. * * The passed in string is handled according to the SPARQL string * escape rules giving a UTF-8 encoded output of the Unicode codepoints. * * The SPARQL escapes are \n \r \f \b \t \\ * \uXXXX \UXXXXXXXX where X is [A-F0-9] * and \ followed by the @delim char * * Return value: non-0 on failure **/ static int sparql_stringbuffer_append_sparql_string(rasqal_query* rq, raptor_stringbuffer* stringbuffer, const unsigned char *text, size_t len, int delim) { size_t i; const unsigned char *s; unsigned char *d; unsigned char *string; string = RASQAL_MALLOC(unsigned char*, len + 1); if(!string) return -1; for(s = text, d = string, i = 0; i < len; s++, i++) { unsigned char c = *s; if(c == '\\' ) { s++; i++; c = *s; if(c == 'n') *d++ = '\n'; else if(c == 'r') *d++ = '\r'; else if(c == 'f') *d++ = '\f'; else if(c == 'b') *d++ = '\b'; else if(c == 't') *d++ = '\t'; else if(c == '\\' || c == delim) *d++ = c; else if(c == 'u' || c == 'U') { size_t ulen = (c == 'u') ? 4 : 8; unsigned long unichar = 0; int n; s++; i++; if(i + ulen > len) { sparql_syntax_error(rq, "SPARQL string \\%c over end of line", c); RASQAL_FREE(char*, string); return 1; } n = sscanf(RASQAL_GOOD_CAST(const char*, s), ((ulen == 4) ? "%04lx" : "%08lx"), &unichar); if(n != 1) { sparql_syntax_error(rq, "Bad SPARQL string Uncode escape '%c%s...'", c, s); RASQAL_FREE(char*, string); return 1; } s += ulen - 1; i += ulen - 1; if(unichar > rasqal_unicode_max_codepoint) { sparql_syntax_error(rq, "Bad SPARQL string Unicode character with code point #x%lX (max #x%lX).", unichar, rasqal_unicode_max_codepoint); RASQAL_FREE(char*, string); return 1; } d += raptor_unicode_utf8_string_put_char(unichar, d, len - (d - string)); } else { /* Ignore \x where x isn't the one of: \n \r \t \\ (delim) \u \U */ sparql_syntax_warning(rq, "Unknown SPARQL string escape \\%c in \"%s\"", c, text); *d++ = c; } } else *d++ = c; } *d='\0'; /* calculate output string size */ len = d-string; /* string gets owned by the stringbuffer after this */ return raptor_stringbuffer_append_counted_string(stringbuffer, string, len, 0); } /* * sparql_lexer_log_error: * @msg: message string * @level: log level * @yyscanner: scanner context * * INTERNAL - replacement for the generated error handler. * Uses rasqal_log_error_simple() when possible. */ static void sparql_lexer_log_error(yyconst char *msg, raptor_log_level level, yyscan_t yyscanner) { rasqal_query *rq = NULL; if(yyscanner) rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(rq) { /* avoid "format not a string literal and no format arguments" warning with %s */ rq->failed = 1; rasqal_log_error_simple(rq->world, level, &rq->locator, "%s", msg); } else { fputs(msg, stderr); fputc('\n', stderr); } } /* Define LEXER_ALLOC_TRACKING to enable allocated memory tracking * - fixes lexer memory leak when ensure_buffer_stack fails */ #ifdef LEXER_ALLOC_TRACKING typedef struct { /* Number of void* slots allocated */ int lexer_allocs_size; /* Allocted void* slots follow in memory after this header */ } lexer_alloc_tracker_header; /* Initial alloc tracker slot array size - 2 seems to be enough for almost all cases */ static const int initial_lexer_allocs_size = 2; #endif /* * sparql_lexer_cleanup: * @yyscanner: * * INTERNAL - Clean up unfreed lexer allocs if LEXER_ALLOC_TRACKING is enabled. */ static void sparql_lexer_cleanup(yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; if(!yyscanner) return; rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) return; tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) return; lexer_allocs = (void**)&tracker[1]; for(i = 0; ilexer_allocs_size; ++i) { if(lexer_allocs[i]) free(lexer_allocs[i]); lexer_allocs[i] = NULL; } free(rq->lexer_user_data); rq->lexer_user_data = NULL; #endif } /* * sparql_lexer_alloc: * @size * @yyscanner * * INTERNAL - alloc replacement. * Tracks allocated cells if LEXER_ALLOC_TRACKING is enabled. */ void *sparql_lexer_alloc(yy_size_t size, yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; void *ptr; /* yyscanner not initialized -> probably initializing yyscanner itself * -> just malloc without tracking */ if(!yyscanner) return malloc(size); rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) YY_FATAL_ERROR("lexer_alloc: yyscanner extra not initialized"); /* try to allocate tracker if it does not exist */ tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) { /* allocate tracker header + array of void* slots */ tracker = (lexer_alloc_tracker_header*)calloc(1, sizeof(lexer_alloc_tracker_header) + initial_lexer_allocs_size * sizeof(void*)); if(!tracker) YY_FATAL_ERROR("lexer_alloc: cannot allocate tracker"); tracker->lexer_allocs_size = initial_lexer_allocs_size; rq->lexer_user_data = (void *)tracker; } lexer_allocs = (void**)&tracker[1]; /* allocate memory */ ptr = malloc(size); /* find a free slot for ptr */ for(i = 0; ilexer_allocs_size; ++i) { if(!lexer_allocs[i]) { lexer_allocs[i] = ptr; break; } } /* no free slots -> grow tracker slot array */ if(i >= tracker->lexer_allocs_size) { int j; void **dest; tracker = (lexer_alloc_tracker_header*)calloc(1, sizeof(lexer_alloc_tracker_header) + i * 2 * sizeof(void*)); if(!tracker) { if(ptr) free(ptr); YY_FATAL_ERROR("lexer_alloc: cannot grow tracker"); } tracker->lexer_allocs_size = i*2; /* copy data from old tracker */ dest = (void**)&tracker[1]; for(j = 0; jlexer_user_data); rq->lexer_user_data = tracker; } return ptr; #else return malloc(size); #endif } /* * sparql_lexer_realloc: * * INTERNAL - realloc replacement * Tracks allocated cells if LEXER_ALLOC_TRACKING is enabled. */ void *sparql_lexer_realloc(void *ptr, yy_size_t size, yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; void *newptr; if(!yyscanner) YY_FATAL_ERROR("lexer_realloc: yyscanner not initialized"); rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) YY_FATAL_ERROR("lexer_realloc: yyscanner extra not initialized"); tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) YY_FATAL_ERROR("lexer_realloc: no alloc tracker"); lexer_allocs = (void**)&tracker[1]; /* find the old slot for ptr */ for(i = 0; i < tracker->lexer_allocs_size; ++i) { if(lexer_allocs[i] == ptr) break; } /* no old slot -> error */ if(i >= tracker->lexer_allocs_size) YY_FATAL_ERROR("lexer_realloc: cell not in tracker"); /* realloc */ newptr = realloc(RASQAL_GOOD_CAST(char*, ptr), size); /* replace entry in tracker */ lexer_allocs[i] = newptr; return newptr; #else return realloc(RASQAL_GOOD_CAST(char*, ptr), size); #endif } /* * sparql_lexer_free: * * INTERNAL - free replacement. * Checks for NULL pointer to be freed unlike the default lexer free function. * Tracks allocated cells if LEXER_ALLOC_TRACKING is enabled. */ void sparql_lexer_free(void *ptr, yyscan_t yyscanner) { #ifdef LEXER_ALLOC_TRACKING rasqal_query *rq; lexer_alloc_tracker_header *tracker; void **lexer_allocs; int i; /* do not free NULL */ if(!ptr) return; /* free ptr even if we would encounter an error */ free(ptr); /* yyscanner is allocated with sparql_lexer_alloc() but it's never stored in the tracker * - we need yyscanner to access the tracker */ if(!yyscanner || ptr==yyscanner) return; rq = (rasqal_query *)sparql_lexer_get_extra(yyscanner); if(!rq) return; tracker = (lexer_alloc_tracker_header *)rq->lexer_user_data; if(!tracker) return; lexer_allocs = (void**)&tracker[1]; /* find the slot for ptr */ for(i = 0; ilexer_allocs_size; ++i) { if(lexer_allocs[i]==ptr) break; } /* no slot -> error */ if(i >= tracker->lexer_allocs_size) YY_FATAL_ERROR("lexer_free: cell not in tracker"); /* remove entry from tracker */ lexer_allocs[i] = NULL; #else if(ptr) free(ptr); #endif } #ifdef RASQAL_DEBUG const char * sparql_token_print(rasqal_world* world, int token, YYSTYPE *lval) { static char buffer[2048]; if(!token) return "<>"; switch(token) { case SELECT: return "SELECT"; case FROM: return "FROM"; case WHERE: return "WHERE"; case PREFIX: return "PREFIX"; case DESCRIBE: return "DESCRIBE"; case CONSTRUCT: return "CONSTRUCT"; case ASK: return "ASK"; case DISTINCT: return "DISTINCT"; case LIMIT: return "LIMIT"; case UNION: return "UNION"; case OPTIONAL: return "OPTIONAL"; case BASE: return "BASE"; case BOUND: return "BOUND"; case STRLANG: return "STRLANG"; case STRDT: return "STRDT"; case STR: return "STR"; case LANG: return "LANG"; case DATATYPE: return "DATATYPE"; case ISURI: return "ISURI"; case ISBLANK: return "ISBLANK"; case ISLITERAL: return "ISLITERAL"; case GRAPH: return "GRAPH"; case NAMED: return "NAMED"; case FILTER: return "FILTER"; case OFFSET: return "OFFSET"; case A: return "a"; case ORDER: return "ORDER"; case BY: return "BY"; case REGEX: return "REGEX"; case ASC: return "ASC["; case DESC: return "DESC["; case LANGMATCHES: return "LANGMATCHES"; case ',': return ","; case '(': return "("; case ')': return ")"; case '[': return "["; case ']': return "]"; case '{': return "{"; case '}': return "}"; case '.': return "."; case ';': return ";"; case '?': return "?"; case '$': return "$"; case SC_AND: return "SC_AND"; case SC_OR: return "SC_OR"; case GE: return "GE"; case LE: return "LE"; case GT: return "GT"; case LT: return "LT"; case NEQ: return "NEQ"; case EQ: return "EQ"; case '/': return "/"; case '*': return "*"; case '-': return "-"; case '+': return "+"; case '!': return "!"; case EXPLAIN: return "EXPLAIN"; case GROUP: return "GROUP"; case HAVING: return "HAVING"; case COUNT: return "COUNT"; case SUM: return "SUM"; case AVG: return "AVG"; case MIN: return "MIN"; case MAX: return "MAX"; case DELETE: return "DELETE"; case INSERT: return "INSERT"; case WITH: return "WITH"; case CLEAR: return "CLEAR"; case CREATE: return "CREATE"; case SILENT: return "SILENT"; case DATA: return "DATA"; case DROP: return "DROP"; case LOAD: return "LOAD"; case INTO: return "INTO"; case IF: return "IF"; case LET: return "LET"; case AS: return "AS"; case ASSIGN: return ":="; case COALESCE: return "COALESCE"; case IRI: return "IRI"; case URI: return "URI"; case BNODE: return "BNODE"; case SAMPLE: return "SAMPLE"; case DEFAULT: return "DEFAULT"; case NOT: return "NOT"; case IN: return "IN"; case GROUP_CONCAT: return "GROUP_CONCAT"; case SEPARATOR: return "SEPARATOR"; case BINDINGS: return "BINDINGS"; case UNDEF: return "UNDEF"; case SERVICE: return "SERVICE"; case MINUS: return "MINUS"; case ISNUMERIC: return "isNUMERIC"; case YEAR: return "YEAR"; case MONTH: return "MONTH"; case DAY: return "DAY"; case HOURS: return "HOURS"; case MINUTES: return "MINUTES"; case SECONDS: return "SECONDS"; case TIMEZONE: return "TIMEZONE"; case CURRENT_DATETIME: return "CURRENT_DATETIME"; case NOW: return "NOW"; case FROM_UNIXTIME: return "FROM_UNIXTIME"; case TO_UNIXTIME: return "TO_UNIXTIME"; case CONCAT: return "CONCAT"; case STRLEN: return "STRLEN"; case SUBSTR: return "SUBSTR"; case UCASE: return "UCASE"; case LCASE: return "LCASE"; case STRSTARTS: return "STRSTARTS"; case STRENDS: return "STRENDS"; case CONTAINS: return "CONTAINS"; case ENCODE_FOR_URI: return "ENCODE_FOR_URI"; case TO: return "TO"; case ADD: return "ADD"; case MOVE: return "MOVE"; case COPY: return "COPY"; case ALL: return "ALL"; case TZ: return "TZ"; case RAND: return "RAND"; case BIND: return "BIND"; case ABS: return "ABS"; case ROUND: return "ROUND"; case CEIL: return "CEIL"; case FLOOR: return "FLOOR"; case MD5: return "MD5"; case SHA1: return "SHA1"; case SHA224: return "SHA224"; case SHA256: return "SHA256"; case SHA384: return "SHA384"; case SHA512: return "SHA512"; case STRBEFORE: return "STRBEFORE"; case STRAFTER: return "STRAFTER"; case REPLACE: return "REPLACE"; case UUID: return "UUID"; case STRUUID: return "STRUUID"; case VALUES: return "VALUES"; case INTEGER_LITERAL: case INTEGER_POSITIVE_LITERAL: case INTEGER_NEGATIVE_LITERAL: sprintf(buffer, "INTEGER_LITERAL(%d)", lval->literal->value.integer); return buffer; case DOUBLE_LITERAL: case DOUBLE_POSITIVE_LITERAL: case DOUBLE_NEGATIVE_LITERAL: sprintf(buffer, "DOUBLE_LITERAL(%g)", lval->floating); return buffer; case STRING: sprintf(buffer, "STRING(\"%s\")", lval->name); return buffer; case BOOLEAN_LITERAL: return (lval->literal->value.integer ? "BOOLEAN_LITERAL(true)" : "BOOLEAN_LITERAL(false)"); case URI_LITERAL: sprintf(buffer, "URI_LITERAL(%s)", raptor_uri_as_string(lval->uri) ); return buffer; case QNAME_LITERAL: sprintf(buffer, "QNAME_LITERAL(%s)", lval->name); return buffer; case URI_LITERAL_BRACE: sprintf(buffer, "URI_LITERAL_BRACE(%s)", raptor_uri_as_string(lval->uri) ); return buffer; case QNAME_LITERAL_BRACE: sprintf(buffer, "QNAME_LITERAL_BRACE(%s)", lval->name); return buffer; case IDENTIFIER: sprintf(buffer, "IDENTIFIER(%s)", lval->name); return buffer; case BLANK_LITERAL: sprintf(buffer, "BLANK_LITERAL(%s)", lval->name); return buffer; case DECIMAL_LITERAL: case DECIMAL_POSITIVE_LITERAL: case DECIMAL_NEGATIVE_LITERAL: sprintf(buffer, "DECIMAL_LITERAL(%s)", lval->literal->string); return buffer; case LANGTAG: sprintf(buffer, "LANGTAG(%s)", lval->name); return buffer; case HATHAT: return "HATHAT"; default: RASQAL_DEBUG2("UNKNOWN token %d - add a new case\n", token); abort(); } } #endif #ifdef STANDALONE static void sparql_token_free(rasqal_world* world, int token, YYSTYPE *lval) { if(!token) return; switch(token) { case INTEGER_LITERAL: case INTEGER_POSITIVE_LITERAL: case INTEGER_NEGATIVE_LITERAL: case DOUBLE_LITERAL: case DOUBLE_POSITIVE_LITERAL: case DOUBLE_NEGATIVE_LITERAL: case DECIMAL_POSITIVE_LITERAL: case DECIMAL_NEGATIVE_LITERAL: case DECIMAL_LITERAL: case BOOLEAN_LITERAL: rasqal_free_literal(lval->literal); break; case URI_LITERAL: case URI_LITERAL_BRACE: raptor_free_uri(lval->uri); break; case STRING: case IDENTIFIER: case BLANK_LITERAL: case PREFIX: RASQAL_FREE(char*, lval->name); break; case QNAME_LITERAL: if(lval->name) RASQAL_FREE(char*, lval->name); break; default: break; } } #define FILE_READ_BUF_SIZE 4096 int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); char *query_string = NULL; rasqal_query rq; rasqal_sparql_query_language sparql; yyscan_t scanner; int token = EOF; YYSTYPE lval; const unsigned char *uri_string; const char *filename = NULL; char *buf = NULL; size_t len; rasqal_world *world; FILE *fh; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) exit(1); filename = getenv("SPARQL_QUERY_FILE"); if(!filename) { if(argc != 2) { fprintf(stderr, "%s: Too many arguments.\n", program); fprintf(stderr, "SPARQL lexer test for Rasqal %s\n", rasqal_version_string); fprintf(stderr, "USAGE: %s SPARQL-QUERY-FILE\n", program); exit(1); } filename = argv[1]; } query_string = RASQAL_CALLOC(char*, FILE_READ_BUF_SIZE, 1); fh = fopen(filename, "r"); if(fh) { fread(query_string, FILE_READ_BUF_SIZE, 1, fh); fclose(fh); } else { fprintf(stderr, "%s: Cannot open file %s - %s\n", program, filename, strerror(errno)); exit(1); } memset(&rq, 0, sizeof(rq)); rq.world = world; memset(&sparql, 0, sizeof(sparql)); sparql_lexer_lex_init(&sparql.scanner); scanner = sparql.scanner; len = strlen(RASQAL_GOOD_CAST(const char*, query_string)); buf = RASQAL_MALLOC(char*, len + 3); memcpy(buf, query_string, len); buf[len] = ' '; buf[len+1] = buf[len+2] = '\0'; /* YY_END_OF_BUFFER_CHAR; */ (void)sparql_lexer__scan_buffer(buf, len+3, scanner); sparql_lexer_set_extra(&rq, scanner); /* Initialise enough of the rasqal_query and locator to get error messages */ rq.context = &sparql; sparql.lineno = 1; rq.locator.file = filename; rq.locator.column = -1; uri_string = raptor_uri_filename_to_uri_string(filename); rq.base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); raptor_free_memory((void*)uri_string); while(1) { memset(&lval, 0, sizeof(lval)); if(sparql_lexer_get_text(scanner) != NULL) printf("yyinput '%s'\n", sparql_lexer_get_text(scanner)); token = sparql_lexer_lex(&lval,scanner); #ifdef RASQAL_DEBUG printf("token %s\n", sparql_token_print(world, token, &lval)); #else printf("token %d\n", token); #endif sparql_token_free(world, token, &lval); if(!token || token == EOF) break; } if(buf) RASQAL_FREE(char*, buf); sparql_lexer_lex_destroy(scanner); raptor_free_uri(rq.base_uri); RASQAL_FREE(char*, query_string); rasqal_free_world(world); if(rq.failed) return 1; return 0; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_expr.c0000644000175000017500000020253712435141254013300 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_expr.c - Rasqal general expression support * * 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE /** * rasqal_new_0op_expression: * @world: rasqal_world object * @op: Expression operator * * Constructor - create a new 0-operand (constant) expression. * * The operators are: * @RASQAL_EXPR_VARSTAR * * The only operator here is the '*' in COUNT(*) as used by LAQRS. * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_0op_expression(rasqal_world* world, rasqal_op op) { rasqal_expression* e; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; } return e; } /** * rasqal_new_1op_expression: * @world: rasqal_world object * @op: Expression operator * @arg: Operand 1 * * Constructor - create a new 1-operand expression. * Takes ownership of the operand expression. * * The operators are: * @RASQAL_EXPR_TILDE @RASQAL_EXPR_BANG @RASQAL_EXPR_UMINUS * @RASQAL_EXPR_BOUND @RASQAL_EXPR_STR @RASQAL_EXPR_LANG * @RASQAL_EXPR_LANGMATCHES * @RASQAL_EXPR_DATATYPE @RASQAL_EXPR_ISURI @RASQAL_EXPR_ISBLANK * @RASQAL_EXPR_ISLITERAL @RASQAL_EXPR_ORDER_COND_ASC * @RASQAL_EXPR_ORDER_COND_DESC @RASQAL_EXPR_COUNT @RASQAL_EXPR_SUM * @RASQAL_EXPR_AVG @RASQAL_EXPR_MIN @RASQAL_EXPR_MAX * * The operator @RASQAL_EXPR_TILDE is not used by SPARQL (formerly RDQL). * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_1op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg) { rasqal_expression* e = NULL; if(op == RASQAL_EXPR_BNODE) { if(!world) goto tidy; } else { if(!world || !arg) goto tidy; } e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->arg1 = arg; arg = NULL; } tidy: if(arg) rasqal_free_expression(arg); return e; } /** * rasqal_new_2op_expression: * @world: rasqal_world object * @op: Expression operator * @arg1: Operand 1 * @arg2: Operand 2 * * Constructor - create a new 2-operand expression. * Takes ownership of the operand expressions. * * The operators are: * @RASQAL_EXPR_AND @RASQAL_EXPR_OR @RASQAL_EXPR_EQ * @RASQAL_EXPR_NEQ @RASQAL_EXPR_LT @RASQAL_EXPR_GT @RASQAL_EXPR_LE * @RASQAL_EXPR_GE @RASQAL_EXPR_PLUS @RASQAL_EXPR_MINUS * @RASQAL_EXPR_STAR @RASQAL_EXPR_SLASH @RASQAL_EXPR_REM * @RASQAL_EXPR_STR_EQ @RASQAL_EXPR_STR_NEQ * * @RASQAL_EXPR_REM @RASQAL_EXPR_STR_EQ, @RASQAL_EXPR_STR_NEQ and * @RASQAL_EXPR_REM are unused (formerly RDQL). * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_2op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2) { rasqal_expression* e = NULL; if(!world || !arg1 || !arg2) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->arg1 = arg1; arg1 = NULL; e->arg2 = arg2; arg2 = NULL; } tidy: if(arg1) rasqal_free_expression(arg1); if(arg2) rasqal_free_expression(arg2); return e; } /** * rasqal_new_3op_expression: * @world: rasqal_world object * @op: Expression operator * @arg1: Operand 1 * @arg2: Operand 2 * @arg3: Operand 3 (may be NULL) * * Constructor - create a new 3-operand expression. * Takes ownership of the operands. * * The operators are: * #RASQAL_EXPR_REGEX #RASQAL_EXPR_IF #RASQAL_EXPR_SUBSTR * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_3op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3) { rasqal_expression* e = NULL; if(!world || !arg1 || !arg2) /* arg3 may be NULL */ goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->arg1 = arg1; arg1 = NULL; e->arg2 = arg2; arg2 = NULL; e->arg3 = arg3; arg3 = NULL; } tidy: if(arg1) rasqal_free_expression(arg1); if(arg2) rasqal_free_expression(arg2); if(arg3) rasqal_free_expression(arg3); return e; } /** * rasqal_new_4op_expression: * @world: rasqal_world object * @op: Expression operator * @arg1: Operand 1 * @arg2: Operand 2 * @arg3: Operand 3 * @arg4: Operand 4 (may be NULL) * * Constructor - create a new 4-operand expression. * Takes ownership of the operands. * * The operators are: * #RASQAL_EXPR_REPLACE * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_4op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3, rasqal_expression* arg4) { rasqal_expression* e = NULL; if(!world || !arg1 || !arg2 || !arg3) /* arg4 may be NULL */ goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->arg1 = arg1; arg1 = NULL; e->arg2 = arg2; arg2 = NULL; e->arg3 = arg3; arg3 = NULL; e->arg4 = arg4; arg4 = NULL; } tidy: if(arg1) rasqal_free_expression(arg1); if(arg2) rasqal_free_expression(arg2); if(arg3) rasqal_free_expression(arg3); if(arg4) rasqal_free_expression(arg4); return e; } /** * rasqal_new_string_op_expression: * @world: rasqal_world object * @op: Expression operator * @arg1: Operand 1 * @literal: Literal operand 2 * * Constructor - create a new expression with one expression and one string operand. * Takes ownership of the operands. * * The operators are: * @RASQAL_EXPR_STR_MATCH and * @RASQAL_EXPR_STR_NMATCH (unused: formerly for RDQL) * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_string_op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal) { rasqal_expression* e = NULL; if(!world || !arg1 || !literal) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->arg1 = arg1; arg1 = NULL; e->literal = literal; literal = NULL; } tidy: if(arg1) rasqal_free_expression(arg1); if(literal) rasqal_free_literal(literal); return e; } /** * rasqal_new_literal_expression: * @world: rasqal_world object * @literal: Literal operand 1 * * Constructor - create a new expression for a #rasqal_literal * Takes ownership of the operand literal. * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_literal_expression(rasqal_world* world, rasqal_literal *literal) { rasqal_expression* e; if(!world || !literal) return NULL; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = RASQAL_EXPR_LITERAL; e->literal = literal; } else { rasqal_free_literal(literal); } return e; } static rasqal_expression* rasqal_new_function_expression_common(rasqal_world* world, rasqal_op op, raptor_uri* name, rasqal_expression* arg1, raptor_sequence* args, raptor_sequence* params, unsigned int flags) { rasqal_expression* e = NULL; if(!world || (arg1 && args) || (name && !args)|| (!name && args)) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->name = name; name = NULL; e->arg1 = arg1; arg1 = NULL; e->args = args; args = NULL; e->params = params; params = NULL; e->flags = flags; } tidy: if(name) raptor_free_uri(name); if(args) raptor_free_sequence(args); if(params) raptor_free_sequence(params); return e; } /** * rasqal_new_function_expression: * @world: rasqal_world object * @name: function name * @args: sequence of #rasqal_expression function arguments * @params: sequence of #rasqal_expression function parameters (or NULL) * @flags: extension function bitflags * * Constructor - create a new expression for a URI-named function with arguments and optional parameters. * * Takes ownership of the @name, @args and @params arguments. * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_function_expression(rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags) { return rasqal_new_function_expression_common(world, RASQAL_EXPR_FUNCTION, name, NULL /* expr */, args, params, flags); } /** * rasqal_new_aggregate_function_expression: * @world: rasqal_world object * @op: built-in aggregate function expression operator * @arg1: #rasqal_expression argument to aggregate function * @params: sequence of #rasqal_expression function parameters (or NULL) * @flags: extension function bitflags * * Constructor - create a new 1-arg aggregate function expression for a builtin aggregate function * * Takes ownership of the @args and @params * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_aggregate_function_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, raptor_sequence* params, unsigned int flags) { return rasqal_new_function_expression_common(world, op, NULL /* name */, arg1, NULL /* args */, params, flags | RASQAL_EXPR_FLAG_AGGREGATE); } /** * rasqal_new_cast_expression: * @world: rasqal_world object * @name: cast datatype URI * @value: expression value to cast to @datatype type * * Constructor - create a new expression for casting and expression to a datatype. * Takes ownership of the datatype uri and expression value. * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_cast_expression(rasqal_world* world, raptor_uri* name, rasqal_expression *value) { rasqal_expression* e = NULL; if(!world || !name || !value) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = RASQAL_EXPR_CAST; e->name = name; name = NULL; e->arg1 = value; value = NULL; } tidy: if(name) raptor_free_uri(name); if(value) rasqal_free_expression(value); return e; } /** * rasqal_new_expr_seq_expression: * @world: rasqal_world object * @op: expression operation * @args: sequence of #rasqal_expression arguments * * Constructor - create a new expression with a sequence of expression arguments. * * Takes ownership of the @args * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_expr_seq_expression(rasqal_world* world, rasqal_op op, raptor_sequence* args) { rasqal_expression* e = NULL; if(!world || !args) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->args = args; args = NULL; } tidy: if(args) raptor_free_sequence(args); return e; } /** * rasqal_new_set_expression: * @world: rasqal_world object * @op: list operation * @arg1: expression to look for in list * @args: sequence of #rasqal_expression list arguments * * Constructor - create a new set IN/NOT IN operation with expression arguments. * * Takes ownership of the @arg1 and @args * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_set_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, raptor_sequence* args) { rasqal_expression* e = NULL; if(!world || !arg1 || !args) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; e->op = op; e->arg1 = arg1; arg1 = NULL; e->args = args; args = NULL; } tidy: if(arg1) rasqal_free_expression(arg1); if(args) raptor_free_sequence(args); return e; } /** * rasqal_new_group_concat_expression: * @world: rasqal_world object * @flags: bitset of flags. Only #RASQAL_EXPR_FLAG_DISTINCT is defined * @args: sequence of #rasqal_expression list arguments * @separator: SEPARATOR string literal or NULL * * Constructor - create a new SPARQL group concat expression * * Takes an optional distinct flag, a list of expressions and an optional separator string. * * Takes ownership of the @args and @separator * * Return value: a new #rasqal_expression object or NULL on failure **/ rasqal_expression* rasqal_new_group_concat_expression(rasqal_world* world, unsigned int flags, raptor_sequence* args, rasqal_literal* separator) { rasqal_expression* e = NULL; if(!world || !args) goto tidy; e = RASQAL_CALLOC(rasqal_expression*, 1, sizeof(*e)); if(e) { e->usage = 1; e->world = world; /* Discard any flags except RASQAL_EXPR_FLAG_DISTINCT */ e->flags = (flags & RASQAL_EXPR_FLAG_DISTINCT) | RASQAL_EXPR_FLAG_AGGREGATE; e->op = RASQAL_EXPR_GROUP_CONCAT; e->args = args; args = NULL; e->literal = separator; separator = NULL; } tidy: if(args) raptor_free_sequence(args); if(separator) rasqal_free_literal(separator); return e; } /** * rasqal_expression_clear: * @e: expression * * Empty an expression of contained content. * * Intended to be used to deallocate resources from a statically * declared #rasqal_expression such as on a stack. **/ void rasqal_expression_clear(rasqal_expression* e) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(e, rasqal_expression); switch(e->op) { case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: case RASQAL_EXPR_RAND: break; case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: rasqal_free_expression(e->arg1); rasqal_free_expression(e->arg2); break; case RASQAL_EXPR_REGEX: case RASQAL_EXPR_IF: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_SUBSTR: case RASQAL_EXPR_REPLACE: rasqal_free_expression(e->arg1); rasqal_free_expression(e->arg2); if(e->arg3) rasqal_free_expression(e->arg3); if(e->arg4) rasqal_free_expression(e->arg4); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: /* arg1 is optional for RASQAL_EXPR_BNODE */ if(e->arg1) rasqal_free_expression(e->arg1); break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: rasqal_free_expression(e->arg1); rasqal_free_literal(e->literal); break; case RASQAL_EXPR_LITERAL: rasqal_free_literal(e->literal); break; case RASQAL_EXPR_FUNCTION: case RASQAL_EXPR_GROUP_CONCAT: /* FUNCTION name */ if(e->name) raptor_free_uri(e->name); raptor_free_sequence(e->args); if(e->literal) /* GROUP_CONCAT() SEPARATOR */ rasqal_free_literal(e->literal); break; case RASQAL_EXPR_CAST: raptor_free_uri(e->name); rasqal_free_expression(e->arg1); break; case RASQAL_EXPR_VARSTAR: /* constants */ break; case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_CONCAT: raptor_free_sequence(e->args); break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: rasqal_free_expression(e->arg1); raptor_free_sequence(e->args); break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL2("Unknown operation %u", e->op); } } /** * rasqal_new_expression_from_expression: * @e: #rasqal_expression object to copy or NULL * * Copy Constructor - create a new #rasqal_expression object from an existing rasqal_expression object. * * Return value: a new #rasqal_expression object or NULL if @e is NULL **/ rasqal_expression* rasqal_new_expression_from_expression(rasqal_expression* e) { if(!e) return NULL; e->usage++; return e; } /** * rasqal_free_expression: * @e: #rasqal_expression object * * Destructor - destroy a #rasqal_expression object. * **/ void rasqal_free_expression(rasqal_expression* e) { if(!e) return; if(--e->usage) return; rasqal_expression_clear(e); RASQAL_FREE(rasqal_expression, e); } /** * rasqal_expression_visit: * @e: #rasqal_expression to visit * @fn: visit function * @user_data: user data to pass to visit function * * Visit a user function over a #rasqal_expression * * If the user function @fn returns non-0, the visit is truncated * and the value is returned. * * Return value: non-0 if the visit was truncated. **/ int rasqal_expression_visit(rasqal_expression* e, rasqal_expression_visit_fn fn, void *user_data) { int i; int result = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(e, rasqal_expression, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fn, rasqal_expression_visit_fn, 1); /* This ordering allows fn to potentially edit 'e' in-place */ result = fn(user_data, e); if(result) return result; switch(e->op) { case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: case RASQAL_EXPR_RAND: break; case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: result = rasqal_expression_visit(e->arg1, fn, user_data) || rasqal_expression_visit(e->arg2, fn, user_data); break; case RASQAL_EXPR_REGEX: case RASQAL_EXPR_IF: case RASQAL_EXPR_SUBSTR: result = rasqal_expression_visit(e->arg1, fn, user_data) || rasqal_expression_visit(e->arg2, fn, user_data) || (e->arg3 && rasqal_expression_visit(e->arg3, fn, user_data)); break; case RASQAL_EXPR_REPLACE: result = rasqal_expression_visit(e->arg1, fn, user_data) || rasqal_expression_visit(e->arg2, fn, user_data) || rasqal_expression_visit(e->arg3, fn, user_data) || (e->arg4 && rasqal_expression_visit(e->arg4, fn, user_data)); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_CAST: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: /* arg1 is optional for RASQAL_EXPR_BNODE */ result = (e->arg1) ? rasqal_expression_visit(e->arg1, fn, user_data) : 0; break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: result = fn(user_data, e->arg1); break; case RASQAL_EXPR_LITERAL: break; case RASQAL_EXPR_FUNCTION: case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_GROUP_CONCAT: case RASQAL_EXPR_CONCAT: for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); result = rasqal_expression_visit(e2, fn, user_data); if(result) break; } break; case RASQAL_EXPR_VARSTAR: /* constants */ break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: result = rasqal_expression_visit(e->arg1, fn, user_data); if(!result) { for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); result = rasqal_expression_visit(e2, fn, user_data); if(result) break; } } break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL2("Unknown operation %u", e->op); result= -1; /* keep some compilers happy */ break; } return result; } static const char* const rasqal_op_labels[RASQAL_EXPR_LAST+1]={ "UNKNOWN", "and", "or", "eq", "neq", "lt", "gt", "le", "ge", "uminus", "plus", "minus", "star", "slash", "rem", "str_eq", "str_ne", "str_match", "str_nmatch", "tilde", "bang", "literal", "function", "bound", "str", "lang", "datatype", "isUri", "isBlank", "isLiteral", "cast", "order asc", "order desc", "langMatches", "regex", "group asc", "group desc", "count", "varstar", "sameTerm", "sum", "avg", "min", "max", "coalesce", "if", "uri", "iri", "strlang", "strdt", "bnode", "group_concat", "sample", "in", "not in", "isnumeric", "year", "month", "day", "hours", "minutes", "seconds", "timezone", "current_datetime", "now", "from_unixtime", "to_unixtime", "concat", "strlen", "substr", "ucase", "lcase", "strstarts", "strends", "contains", "encode_for_uri", "tz", "rand", "abs", "round", "ceil", "floor", "md5", "sha1", "sha224", "sha256", "sha384", "sha512", "strbefore", "strafter", "replace", "uuid", "struuid" }; /** * rasqal_expression_op_label: * @op: the #rasqal_expression_op object * * Get a label for the rasqal expression operator * * Return value: the label (shared string) or NULL if op is out of range or unknown **/ const char* rasqal_expression_op_label(rasqal_op op) { if(op > RASQAL_EXPR_LAST) op = RASQAL_EXPR_UNKNOWN; return rasqal_op_labels[RASQAL_GOOD_CAST(int, op)]; } /** * rasqal_expression_write_op: * @e: the #rasqal_expression object * @iostr: the #raptor_iostream to write to * * INTERNAL - Write a rasqal expression operator to an iostream in a debug format. * * The print debug format may change in any release. **/ void rasqal_expression_write_op(rasqal_expression* e, raptor_iostream* iostr) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(e, rasqal_expression); raptor_iostream_string_write(rasqal_expression_op_label(e->op), iostr); } /** * rasqal_expression_print_op: * @e: the #rasqal_expression object * @fh: the FILE* handle to print to * * Print a rasqal expression operator in a debug format. * * The print debug format may change in any release. **/ void rasqal_expression_print_op(rasqal_expression* e, FILE* fh) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(e, rasqal_expression); RASQAL_ASSERT_OBJECT_POINTER_RETURN(fh, FILE*); fputs(rasqal_expression_op_label(e->op), fh); } /** * rasqal_expression_write: * @e: #rasqal_expression object. * @iostr: The #raptor_iostream to write to. * * Write a Rasqal expression to an iostream in a debug format. * * The print debug format may change in any release. **/ void rasqal_expression_write(rasqal_expression* e, raptor_iostream* iostr) { int i; RASQAL_ASSERT_OBJECT_POINTER_RETURN(e, rasqal_expression); RASQAL_ASSERT_OBJECT_POINTER_RETURN(iostr, raptor_iostr); raptor_iostream_counted_string_write("expr(", 5, iostr); switch(e->op) { case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: case RASQAL_EXPR_RAND: raptor_iostream_counted_string_write("op ", 3, iostr); rasqal_expression_write_op(e, iostr); raptor_iostream_counted_string_write("()", 2, iostr); break; case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_REGEX: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_IF: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_SUBSTR: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: case RASQAL_EXPR_REPLACE: raptor_iostream_counted_string_write("op ", 3, iostr); rasqal_expression_write_op(e, iostr); raptor_iostream_write_byte('(', iostr); rasqal_expression_write(e->arg1, iostr); raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_expression_write(e->arg2, iostr); /* There are four 3+ arg expressions - all handled here */ if((e->op == RASQAL_EXPR_REGEX || e->op == RASQAL_EXPR_IF || e->op == RASQAL_EXPR_SUBSTR || e->op == RASQAL_EXPR_REPLACE) && e->arg3) { raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_expression_write(e->arg3, iostr); } /* One 3 or 4 arg expression */ if((e->op == RASQAL_EXPR_REPLACE) && e->arg4) { raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_expression_write(e->arg4, iostr); } raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: raptor_iostream_counted_string_write("op ", 3, iostr); rasqal_expression_write_op(e, iostr); raptor_iostream_write_byte('(', iostr); rasqal_expression_write(e->arg1, iostr); raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_literal_write(e->literal, iostr); raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: raptor_iostream_counted_string_write("op ", 3, iostr); rasqal_expression_write_op(e, iostr); raptor_iostream_write_byte('(', iostr); /* arg1 is optional for RASQAL_EXPR_BNODE */ if(e->arg1) rasqal_expression_write(e->arg1, iostr); raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_LITERAL: rasqal_literal_write(e->literal, iostr); break; case RASQAL_EXPR_FUNCTION: raptor_iostream_counted_string_write("function(uri=", 13, iostr); raptor_uri_write(e->name, iostr); raptor_iostream_counted_string_write(", args=", 7, iostr); for(i=0; iargs); i++) { rasqal_expression* e2; if(i>0) raptor_iostream_counted_string_write(", ", 2, iostr); e2=(rasqal_expression*)raptor_sequence_get_at(e->args, i); rasqal_expression_write(e2, iostr); } raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_CAST: raptor_iostream_counted_string_write("cast(type=", 10, iostr); raptor_uri_write(e->name, iostr); raptor_iostream_counted_string_write(", value=", 8, iostr); rasqal_expression_write(e->arg1, iostr); raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_VARSTAR: raptor_iostream_counted_string_write("varstar", 7, iostr); break; case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_CONCAT: rasqal_expression_write_op(e, iostr); raptor_iostream_write_byte('(', iostr); for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); rasqal_expression_write(e2, iostr); } raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_GROUP_CONCAT: raptor_iostream_counted_string_write("group_concat(", 13, iostr); if(e->flags & RASQAL_EXPR_FLAG_DISTINCT) raptor_iostream_counted_string_write("distinct,", 9, iostr); raptor_iostream_counted_string_write("args=", 5, iostr); for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); rasqal_expression_write(e2, iostr); } if(e->literal) { raptor_iostream_counted_string_write(",separator=", 11, iostr); rasqal_literal_write(e->literal, iostr); } raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: raptor_iostream_counted_string_write("op ", 3, iostr); rasqal_expression_write_op(e, iostr); raptor_iostream_counted_string_write("(expr=", 6, iostr); rasqal_expression_write(e->arg1, iostr); raptor_iostream_counted_string_write(", args=", 7, iostr); for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); rasqal_expression_write(e2, iostr); } raptor_iostream_write_byte(')', iostr); break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL2("Unknown operation %u", e->op); } raptor_iostream_write_byte(')', iostr); } /** * rasqal_expression_print: * @e: #rasqal_expression object. * @fh: The FILE* handle to print to. * * Print a Rasqal expression in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_expression_print(rasqal_expression* e, FILE* fh) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(e, rasqal_expression, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); fputs("expr(", fh); switch(e->op) { case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_REGEX: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_IF: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_SUBSTR: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: case RASQAL_EXPR_REPLACE: fputs("op ", fh); rasqal_expression_print_op(e, fh); fputc('(', fh); rasqal_expression_print(e->arg1, fh); fputs(", ", fh); rasqal_expression_print(e->arg2, fh); /* There are four 3+ arg expressions - all handled here */ if((e->op == RASQAL_EXPR_REGEX || e->op == RASQAL_EXPR_IF || e->op == RASQAL_EXPR_SUBSTR || e->op == RASQAL_EXPR_REPLACE) && e->arg3) { fputs(", ", fh); rasqal_expression_print(e->arg3, fh); } /* One 3 or 4 arg expression */ if((e->op == RASQAL_EXPR_REPLACE) && e->arg4) { fputs(", ", fh); rasqal_expression_print(e->arg4, fh); } fputc(')', fh); break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: fputs("op ", fh); rasqal_expression_print_op(e, fh); fputc('(', fh); rasqal_expression_print(e->arg1, fh); fputs(", ", fh); rasqal_literal_print(e->literal, fh); fputc(')', fh); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_RAND: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: fputs("op ", fh); rasqal_expression_print_op(e, fh); fputc('(', fh); /* arg1 is optional for RASQAL_EXPR_BNODE */ if(e->arg1) rasqal_expression_print(e->arg1, fh); fputc(')', fh); break; case RASQAL_EXPR_LITERAL: rasqal_literal_print(e->literal, fh); break; case RASQAL_EXPR_FUNCTION: fputs("function(uri=", fh); raptor_uri_print(e->name, fh); fputs(", args=", fh); raptor_sequence_print(e->args, fh); fputc(')', fh); break; case RASQAL_EXPR_CAST: fputs("cast(type=", fh); raptor_uri_print(e->name, fh); fputs(", value=", fh); rasqal_expression_print(e->arg1, fh); fputc(')', fh); break; case RASQAL_EXPR_VARSTAR: fputs("varstar", fh); break; case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_CONCAT: rasqal_expression_print_op(e, fh); fputc('(', fh); raptor_sequence_print(e->args, fh); fputc(')', fh); break; case RASQAL_EXPR_GROUP_CONCAT: fputs("group_concat(", fh); if(e->flags & RASQAL_EXPR_FLAG_DISTINCT) fputs("distinct,", fh); fputs("args=", fh); raptor_sequence_print(e->args, fh); if(e->literal) { fputs(",separator=", fh); rasqal_literal_print(e->literal, fh); } fputc(')', fh); break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: fputs("op ", fh); rasqal_expression_print_op(e, fh); fputs("(expr=", fh); rasqal_expression_print(e->arg1, fh); fputs(", args=", fh); raptor_sequence_print(e->args, fh); fputc(')', fh); break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL2("Unknown operation %u", e->op); } fputc(')', fh); return 0; } /* for use with rasqal_expression_visit and user_data=rasqal_query */ int rasqal_expression_has_qname(void *user_data, rasqal_expression *e) { if(e->op == RASQAL_EXPR_LITERAL) return rasqal_literal_has_qname(e->literal); return 0; } /* for use with rasqal_expression_visit and user_data=rasqal_query */ int rasqal_expression_expand_qname(void *user_data, rasqal_expression *e) { if(e->op == RASQAL_EXPR_LITERAL) return rasqal_literal_expand_qname(user_data, e->literal); return 0; } int rasqal_expression_is_constant(rasqal_expression* e) { int i; int result = 0; switch(e->op) { case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: /* Constant - set once at the first execution of the expression in * a query execution after rasqal_world_reset_now() removes any * existing value. */ result = 1; break; case RASQAL_EXPR_RAND: /* Never a constant */ result = 0; break; case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: result = rasqal_expression_is_constant(e->arg1) && rasqal_expression_is_constant(e->arg2); break; case RASQAL_EXPR_REGEX: case RASQAL_EXPR_IF: case RASQAL_EXPR_SUBSTR: result = rasqal_expression_is_constant(e->arg1) && rasqal_expression_is_constant(e->arg2) && (e->arg3 && rasqal_expression_is_constant(e->arg3)); break; case RASQAL_EXPR_REPLACE: result = rasqal_expression_is_constant(e->arg1) && rasqal_expression_is_constant(e->arg2) && rasqal_expression_is_constant(e->arg3) && (e->arg4 && rasqal_expression_is_constant(e->arg4)); break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: result = rasqal_expression_is_constant(e->arg1) && rasqal_literal_is_constant(e->literal); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: /* arg1 is optional for RASQAL_EXPR_BNODE and result is always constant */ result = (e->arg1) ? rasqal_expression_is_constant(e->arg1) : 1; break; case RASQAL_EXPR_LITERAL: result=rasqal_literal_is_constant(e->literal); break; case RASQAL_EXPR_FUNCTION: case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_GROUP_CONCAT: case RASQAL_EXPR_CONCAT: result = 1; for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(!rasqal_expression_is_constant(e2)) { result = 0; break; } } /* e->literal is always a string constant - do not need to check */ break; case RASQAL_EXPR_CAST: result=rasqal_expression_is_constant(e->arg1); break; case RASQAL_EXPR_VARSTAR: result=0; break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: result = rasqal_expression_is_constant(e->arg1); if(!result) break; result = 1; for(i = 0; i < raptor_sequence_size(e->args); i++) { rasqal_expression* e2; e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(!rasqal_expression_is_constant(e2)) { result = 0; break; } } break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL2("Unknown operation %u", e->op); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("expression %p: ", e); rasqal_expression_print(e, DEBUG_FH); fprintf(DEBUG_FH, " %s constant\n", (result ? "is" : "is not")); #endif return result; } void rasqal_expression_convert_to_literal(rasqal_expression* e, rasqal_literal* l) { int usage=e->usage; /* update expression 'e' in place */ rasqal_expression_clear(e); memset(e, 0, sizeof(rasqal_expression)); e->usage=usage; e->op=RASQAL_EXPR_LITERAL; e->literal=l; } /* for use with rasqal_expression_visit and user_data=rasqal_query */ static int rasqal_expression_has_variable(void *user_data, rasqal_expression *e) { rasqal_variable* v; const unsigned char* name=((rasqal_variable*)user_data)->name; if(e->op != RASQAL_EXPR_LITERAL) return 0; v=rasqal_literal_as_variable(e->literal); if(!v) return 0; if(!strcmp(RASQAL_GOOD_CAST(const char*, v->name), RASQAL_GOOD_CAST(const char*, name))) return 1; return 0; } int rasqal_expression_mentions_variable(rasqal_expression* e, rasqal_variable* v) { return rasqal_expression_visit(e, rasqal_expression_has_variable, v); } /* * Deep copy a sequence of rasqal_expression to a new one. */ raptor_sequence* rasqal_expression_copy_expression_sequence(raptor_sequence* exprs_seq) { raptor_sequence* nexprs_seq = NULL; int size; int i; if(!exprs_seq) return NULL; nexprs_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!nexprs_seq) return NULL; size = raptor_sequence_size(exprs_seq); for(i = 0; i < size; i++) { rasqal_expression* e; e = (rasqal_expression*)raptor_sequence_get_at(exprs_seq, i); if(e) { e = rasqal_new_expression_from_expression(e); if(e) raptor_sequence_set_at(nexprs_seq, i, e); } } return nexprs_seq; } /** * rasqal_expression_sequence_evaluate: * @query: query * @exprs_seq: sequence of #rasqal_expression to evaluate * @ignore_errors: non-0 to ignore errors in evaluation * @error_p: OUT: pointer to error flag (or NULL) * * INTERNAL - evaluate a sequence of expressions into a sequence of literals * * Intended to implement SPARQL 1.1 Algebra ListEval defined: * ListEval(ExprList, mu) returns a list E, where Ei = mu(ExprListi). * * The result is a new sequence with #rasqal_literal values evaluated * from the sequence of expressions @exprs_seq. If @ignore_errors is * non-0, errors returned by a expressions are ignored (this * corresponds to SPARQL 1.1 Algebra ListEvalE ) * * Return value: sequence of literals or NULL on failure */ raptor_sequence* rasqal_expression_sequence_evaluate(rasqal_query* query, raptor_sequence* exprs_seq, int ignore_errors, int* error_p) { int size; int i; raptor_sequence* literal_seq = NULL; if(!query || !exprs_seq) { if(error_p) *error_p = 1; return NULL; } size = raptor_sequence_size(exprs_seq); if(!size) { if(error_p) *error_p = 1; return NULL; } literal_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); for(i = 0; i < size; i++) { rasqal_expression* e; rasqal_literal *l; int error = 0; e = (rasqal_expression*)raptor_sequence_get_at(exprs_seq, i); l = rasqal_expression_evaluate2(e, query->eval_context, &error); if(error) { if(ignore_errors) continue; if(error_p) *error_p = error; return NULL; } /* l becomes owned by the sequence after this */ raptor_sequence_set_at(literal_seq, i, l); } return literal_seq; } /** * rasqal_expression_compare: * @e1: #rasqal_expression first expression * @e2: #rasqal_expression second expression * @flags: comparison flags: see rasqal_literal_compare() * @error_p: pointer to error * * Compare two expressions * * The two literals are compared. The comparison returned is as for * strcmp, first before second returns <0. equal returns 0, and * first after second returns >0. For URIs, the string value is used * for the comparsion. * * See rasqal_literal_compare() for comparison flags. * * If @error is not NULL, *error is set to non-0 on error * * Return value: <0, 0, or >0 as described above. **/ int rasqal_expression_compare(rasqal_expression* e1, rasqal_expression* e2, int flags, int* error_p) { int rc = 0; int i; int diff; if(error_p) *error_p = 0; /* sort NULLs earlier */ if(!e1 || !e2) { if(!e1 && !e2) return 0; if(!e1) return -1; else return 1; } if(e1->op != e2->op) { if(e1->op == RASQAL_EXPR_UNKNOWN || e2->op == RASQAL_EXPR_UNKNOWN) return 1; return RASQAL_GOOD_CAST(int, e2->op) - RASQAL_GOOD_CAST(int, e1->op); } switch(e1->op) { case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_REGEX: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_IF: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_SUBSTR: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: rc = rasqal_expression_compare(e1->arg1, e2->arg1, flags, error_p); if(rc) return rc; rc = rasqal_expression_compare(e1->arg2, e2->arg2, flags, error_p); if(rc) return rc; /* There are three 3-op expressions - both handled here */ if(e1->op == RASQAL_EXPR_REGEX || e1->op == RASQAL_EXPR_IF || e1->op == RASQAL_EXPR_SUBSTR) rc = rasqal_expression_compare(e1->arg3, e2->arg3, flags, error_p); break; case RASQAL_EXPR_REPLACE: /* 3 or 4 args */ rc = rasqal_expression_compare(e1->arg1, e2->arg1, flags, error_p); if(rc) return rc; rc = rasqal_expression_compare(e1->arg2, e2->arg2, flags, error_p); if(rc) return rc; rc = rasqal_expression_compare(e1->arg3, e2->arg3, flags, error_p); if(rc) return rc; rc = rasqal_expression_compare(e1->arg4, e2->arg4, flags, error_p); break; case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: rc = rasqal_expression_compare(e1->arg1, e2->arg1, flags, error_p); if(rc) return rc; rc = rasqal_literal_compare(e1->literal, e2->literal, flags, error_p); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: /* arg1 is optional for RASQAL_EXPR_BNODE */ rc = rasqal_expression_compare(e1->arg1, e2->arg1, flags, error_p); break; case RASQAL_EXPR_LITERAL: rc = rasqal_literal_compare(e1->literal, e2->literal, flags, error_p); break; case RASQAL_EXPR_FUNCTION: case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_CONCAT: diff = raptor_sequence_size(e2->args) - raptor_sequence_size(e1->args); if(diff) return diff; for(i = 0; i < raptor_sequence_size(e1->args); i++) { rasqal_expression* e1_f; rasqal_expression* e2_f; e1_f = (rasqal_expression*)raptor_sequence_get_at(e1->args, i); e2_f = (rasqal_expression*)raptor_sequence_get_at(e2->args, i); rc = rasqal_expression_compare(e1_f, e2_f, flags, error_p); if(rc) break; } break; case RASQAL_EXPR_CAST: rc = raptor_uri_compare(e1->name, e2->name); if(rc) break; rc = rasqal_expression_compare(e1->arg1, e2->arg1, flags, error_p); break; case RASQAL_EXPR_VARSTAR: case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: /* 0-args: always equal */ rc = 0; break; case RASQAL_EXPR_RAND: /* 0-args: always different */ rc = 1; break; case RASQAL_EXPR_GROUP_CONCAT: rc = (RASQAL_GOOD_CAST(int, e2->flags) - RASQAL_GOOD_CAST(int, e1->flags)); if(rc) break; diff = raptor_sequence_size(e2->args) - raptor_sequence_size(e1->args); if(diff) return diff; for(i = 0; i < raptor_sequence_size(e1->args); i++) { rasqal_expression* e1_f; rasqal_expression* e2_f; e1_f = (rasqal_expression*)raptor_sequence_get_at(e1->args, i); e2_f = (rasqal_expression*)raptor_sequence_get_at(e2->args, i); rc = rasqal_expression_compare(e1_f, e2_f, flags, error_p); if(rc) break; } if(rc) break; rc = rasqal_literal_compare(e1->literal, e2->literal, flags, error_p); break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: rc = rasqal_expression_compare(e1->arg1, e2->arg1, flags, error_p); if(rc) return rc; diff = raptor_sequence_size(e2->args) - raptor_sequence_size(e1->args); if(diff) return diff; for(i = 0; i < raptor_sequence_size(e1->args); i++) { rasqal_expression* e1_f; rasqal_expression* e2_f; e1_f = (rasqal_expression*)raptor_sequence_get_at(e1->args, i); e2_f = (rasqal_expression*)raptor_sequence_get_at(e2->args, i); rc = rasqal_expression_compare(e1_f, e2_f, flags, error_p); if(rc) break; } break; case RASQAL_EXPR_UNKNOWN: default: RASQAL_FATAL2("Unknown operation %u", e1->op); } return rc; } /** * rasqal_expression_is_aggregate: * @e: expression * * INTERNAL - determine if expression is an aggregate expression (at the top; not recursively) * * Return value: non-0 if is aggreate */ int rasqal_expression_is_aggregate(rasqal_expression* e) { if(e->op == RASQAL_EXPR_COUNT || e->op == RASQAL_EXPR_SUM || e->op == RASQAL_EXPR_AVG || e->op == RASQAL_EXPR_MIN || e->op == RASQAL_EXPR_MAX || e->op == RASQAL_EXPR_SAMPLE || e->op == RASQAL_EXPR_GROUP_CONCAT) return 1; if(e->op != RASQAL_EXPR_FUNCTION) return 0; return (e->flags & RASQAL_EXPR_FLAG_AGGREGATE) != 0; } static int rasqal_expression_mentions_aggregate_visitor(void *user_data, rasqal_expression *e) { return rasqal_expression_is_aggregate(e); } /* * Return non-0 if the expression tree mentions an aggregate expression */ int rasqal_expression_mentions_aggregate(rasqal_expression* e) { return rasqal_expression_visit(e, rasqal_expression_mentions_aggregate_visitor, NULL); } /* * rasqal_expression_convert_aggregate_to_variable: * @e_in: Input aggregate expression * @v: Input variable * @e_out: Output expression (or NULL) * * INTERNAL - Turn aggregate expression @e_in into a * #RASQAL_EXPR_LITERAL type one pointing at #rasqal_variable @v. If * field @e_out is not NULL, it returns in that variable a new * aggregate expression with the old expression fields. * * Takes ownership of @v * * Return value: non-0 on failure */ int rasqal_expression_convert_aggregate_to_variable(rasqal_expression* e_in, rasqal_variable* v, rasqal_expression** e_out) { rasqal_world *world; rasqal_literal* l; if(!e_in || !v) goto tidy; world = e_in->world; if(e_out) { *e_out = RASQAL_MALLOC(rasqal_expression*, sizeof(**e_out)); if(!*e_out) goto tidy; } l = rasqal_new_variable_literal(world, v); if(!l) goto tidy; if(e_out) { /* if e_out is not NULL, copy entire contents to new expression */ memcpy(*e_out, e_in, sizeof(**e_out)); /* ... and zero out old expression */ memset(e_in, 0, sizeof(*e_in)); } else { /* Otherwise just destroy the old aggregate fields */ rasqal_expression_clear(e_in); } e_in->usage = 1; e_in->world = world; e_in->op = RASQAL_EXPR_LITERAL; e_in->literal = l; return 0; tidy: if(e_out) { RASQAL_FREE(rasqal_expression*, *e_out); *e_out = NULL; } return 1; } /** * rasqal_new_evaluation_context: * @world: rasqal world * @locator: locator or NULL * @flags: expression comparison flags * * Constructor - create a #rasqal_evaluation_context for use with * rasqal_expression_evaluate2() * * Return value: non-0 on failure */ rasqal_evaluation_context* rasqal_new_evaluation_context(rasqal_world* world, raptor_locator* locator, int flags) { rasqal_evaluation_context* eval_context; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); eval_context = RASQAL_CALLOC(rasqal_evaluation_context*, 1, sizeof(*eval_context)); if(!eval_context) return NULL; eval_context->world = world; eval_context->locator = locator; eval_context->flags = flags; eval_context->random = rasqal_new_random(world); if(!eval_context->random) { RASQAL_FREE(rasqal_evaluation_context*, eval_context); eval_context = NULL; } return eval_context; } /** * rasqal_free_evaluation_context: * @eval_context: #rasqal_evaluation_context object * * Destructor - destroy a #rasqal_evaluation_context object. * **/ void rasqal_free_evaluation_context(rasqal_evaluation_context* eval_context) { if(!eval_context) return; if(eval_context->base_uri) raptor_free_uri(eval_context->base_uri); if(eval_context->random) rasqal_free_random(eval_context->random); RASQAL_FREE(rasqal_evaluation_context*, eval_context); } /** * rasqal_evaluation_context_set_base_uri: * @eval_context: #rasqal_evaluation_context object * @base_uri: base URI * * Set the URI for a #rasqal_evaluation_context * * Return value: non-0 on failure */ int rasqal_evaluation_context_set_base_uri(rasqal_evaluation_context* eval_context, raptor_uri *base_uri) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(eval_context, rasqal_evaluation_context, 1); if(eval_context->base_uri) raptor_free_uri(eval_context->base_uri); eval_context->base_uri = raptor_uri_copy(base_uri); return 0; } /** * rasqal_evaluation_context_set_rand_seed: * @eval_context: #rasqal_evaluation_context object * @seed: random seed * * Set the random seed for a #rasqal_evaluation_context * * Return value: non-0 on failure */ int rasqal_evaluation_context_set_rand_seed(rasqal_evaluation_context* eval_context, unsigned int seed) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(eval_context, rasqal_evaluation_context, 1); return rasqal_random_seed(eval_context->random, seed); } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); #define assert_match(function, result, string) do { if(strcmp(result, string)) { fprintf(stderr, #function " failed - returned %s, expected %s\n", result, string); exit(1); } } while(0) int main(int argc, char *argv[]) { const char *program=rasqal_basename(argv[0]); rasqal_literal *lit1, *lit2; rasqal_expression *expr1, *expr2; rasqal_expression* expr; rasqal_literal* result; int error=0; rasqal_world *world; rasqal_evaluation_context *eval_context = NULL; raptor_world* raptor_world_ptr; raptor_world_ptr = raptor_new_world(); if(!raptor_world_ptr || raptor_world_open(raptor_world_ptr)) exit(1); world = rasqal_new_world(); rasqal_world_set_raptor(world, raptor_world_ptr); /* no rasqal_world_open() */ rasqal_uri_init(world); rasqal_xsd_init(world); eval_context = rasqal_new_evaluation_context(world, NULL /* locator */, 0); lit1=rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 1); expr1=rasqal_new_literal_expression(world, lit1); lit2=rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 1); expr2=rasqal_new_literal_expression(world, lit2); expr=rasqal_new_2op_expression(world, RASQAL_EXPR_PLUS, expr1, expr2); fprintf(stderr, "%s: expression: ", program); rasqal_expression_print(expr, stderr); fputc('\n', stderr); result = rasqal_expression_evaluate2(expr, eval_context, &error); if(error) { fprintf(stderr, "%s: expression evaluation FAILED with error\n", program); } else { int bresult; fprintf(stderr, "%s: expression result: \n", program); rasqal_literal_print(result, stderr); fputc('\n', stderr); bresult=rasqal_literal_as_boolean(result, &error); if(error) { fprintf(stderr, "%s: boolean expression FAILED\n", program); } else fprintf(stderr, "%s: boolean expression result: %d\n", program, bresult); } rasqal_free_expression(expr); if(result) rasqal_free_literal(result); rasqal_xsd_finish(world); rasqal_uri_finish(world); rasqal_free_evaluation_context(eval_context); RASQAL_FREE(rasqal_world, world); raptor_free_world(raptor_world_ptr); return error; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_query_write.c0000644000175000017500000011621412441120534014670 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_query_write.c - Write query data structure as a syntax * * Copyright (C) 2004-2010, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" typedef struct { rasqal_world* world; raptor_uri* type_uri; raptor_uri* base_uri; raptor_namespace_stack *nstack; } sparql_writer_context; static void rasqal_query_write_sparql_expression(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_expression* e); static void rasqal_query_write_sparql_variable(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_variable* v) { if(v->expression) { raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, v->expression); raptor_iostream_counted_string_write(" AS ", 4, iostr); } if(v->type == RASQAL_VARIABLE_TYPE_ANONYMOUS) raptor_iostream_counted_string_write("_:", 2, iostr); else if(!v->expression) raptor_iostream_write_byte('?', iostr); raptor_iostream_string_write(v->name, iostr); if(v->expression) raptor_iostream_counted_string_write(" )", 2, iostr); } static void rasqal_query_write_sparql_uri(sparql_writer_context *wc, raptor_iostream* iostr, raptor_uri* uri) { size_t len; unsigned char* string; raptor_qname* qname; qname = raptor_new_qname_from_namespace_uri(wc->nstack, uri, 10); if(qname) { const raptor_namespace* nspace = raptor_qname_get_namespace(qname); if(!raptor_namespace_get_prefix(nspace)) raptor_iostream_write_byte(':', iostr); raptor_qname_write(qname, iostr); raptor_free_qname(qname); return; } if(wc->base_uri) string = raptor_uri_to_relative_counted_uri_string(wc->base_uri, uri, &len); else string = raptor_uri_as_counted_string(uri, &len); raptor_iostream_write_byte('<', iostr); raptor_string_ntriples_write(string, len, '>', iostr); raptor_iostream_write_byte('>', iostr); if(wc->base_uri) raptor_free_memory(string); } static void rasqal_query_write_sparql_literal(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_literal* l) { if(!l) { raptor_iostream_counted_string_write("null", 4, iostr); return; } switch(l->type) { case RASQAL_LITERAL_URI: rasqal_query_write_sparql_uri(wc, iostr, l->value.uri); break; case RASQAL_LITERAL_BLANK: raptor_iostream_counted_string_write("_:", 2, iostr); raptor_iostream_string_write(l->string, iostr); break; case RASQAL_LITERAL_STRING: raptor_iostream_write_byte('"', iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_write_byte('"', iostr); if(l->language) { raptor_iostream_write_byte('@', iostr); raptor_iostream_string_write(l->language, iostr); } if(l->datatype) { raptor_iostream_counted_string_write("^^", 2, iostr); rasqal_query_write_sparql_uri(wc, iostr, l->datatype); } break; case RASQAL_LITERAL_QNAME: raptor_iostream_counted_string_write("QNAME(", 6, iostr); raptor_iostream_counted_string_write(l->string, l->string_len, iostr); raptor_iostream_write_byte(')', iostr); break; case RASQAL_LITERAL_INTEGER: raptor_iostream_decimal_write(l->value.integer, iostr); break; case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DECIMAL: raptor_iostream_counted_string_write(l->string, l->string_len, iostr); break; case RASQAL_LITERAL_VARIABLE: rasqal_query_write_sparql_variable(wc, iostr, l->value.variable); break; case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: if(1) { raptor_uri* dt_uri; raptor_iostream_write_byte('"', iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_counted_string_write("\"^^", 3, iostr); if(l->type <= RASQAL_LITERAL_LAST_XSD) dt_uri = rasqal_xsd_datatype_type_to_uri(l->world, l->type); else dt_uri = l->datatype; rasqal_query_write_sparql_uri(wc, iostr, dt_uri); } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_PATTERN: default: RASQAL_FATAL2("Literal type %u cannot be written as a SPARQL literal", l->type); } } static void rasqal_query_write_sparql_triple(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_triple* triple) { rasqal_query_write_sparql_literal(wc, iostr, triple->subject); raptor_iostream_write_byte(' ', iostr); if(triple->predicate->type == RASQAL_LITERAL_URI && raptor_uri_equals(triple->predicate->value.uri, wc->type_uri)) raptor_iostream_write_byte('a', iostr); else rasqal_query_write_sparql_literal(wc, iostr, triple->predicate); raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_literal(wc, iostr, triple->object); raptor_iostream_counted_string_write(" .", 2, iostr); } #define SPACES_LENGTH 80 static const char spaces[SPACES_LENGTH+1] = " "; static void rasqal_query_write_indent(raptor_iostream* iostr, unsigned int indent) { while(indent > 0) { unsigned int sp = (indent > SPACES_LENGTH) ? SPACES_LENGTH : indent; raptor_iostream_write_bytes(spaces, sizeof(char), RASQAL_GOOD_CAST(size_t, sp), iostr); indent -= sp; } } static const char* const rasqal_sparql_op_labels[RASQAL_EXPR_LAST+1] = { NULL, /* UNKNOWN */ "&&", "||", "=", "!=", "<", ">", "<=", ">=", "-", "+", "-", "*", "/", NULL, /* REM */ NULL, /* STR EQ */ NULL, /* STR NEQ */ NULL, /* STR_MATCH */ NULL, /* STR_NMATCH */ NULL, /* TILDE */ "!", NULL, /* LITERAL */ NULL, /* FUNCTION */ "BOUND", "STR", "LANG", "DATATYPE", "isIRI", "isBLANK", "isLITERAL", NULL, /* CAST */ "ASC", /* ORDER BY ASC */ "DESC", /* ORDER BY DESC */ "LANGMATCHES", "REGEX", "ASC", /* GROUP BY ASC */ "DESC", /* GROUP BY DESC */ "COUNT", NULL, /* VARSTAR */ "sameTerm", "SUM", "AVG", "MIN", "MAX", "COALESCE", "IF", "URI", "IRI", "STRLANG", "STRDT", "BNODE", "GROUP_CONCAT", "SAMPLE", "IN", "NOT IN", "isNUMERIC", "YEAR", "MONTH", "DAY", "HOURS", "MINUTES", "SECONDS", "TIMEZONE", "CURRENT_DATETIME", "NOW", "FROM_UNIXTIME", "TO_UNIXTIME", "CONCAT", "STRLEN", "SUBSTR", "UCASE", "LCASE", "STRSTARTS", "STRENDS", "CONTAINS", "ENCODE_FOR_URI", "TZ", "RAND", "ABS", "ROUND", "CEIL", "FLOOR", "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "STRBEFORE", "STRAFTER", "REPLACE", "UUID", "STRUUID" }; static void rasqal_query_write_sparql_expression_op(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_expression* e) { rasqal_op op = e->op; const char* string; if(op > RASQAL_EXPR_LAST) op = RASQAL_EXPR_UNKNOWN; string = rasqal_sparql_op_labels[RASQAL_GOOD_CAST(int, op)]; if(string) raptor_iostream_string_write(string, iostr); else raptor_iostream_string_write("NONE", iostr); } static void rasqal_query_write_sparql_expression(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_expression* e) { int i; int size; switch(e->op) { case RASQAL_EXPR_CURRENT_DATETIME: case RASQAL_EXPR_NOW: case RASQAL_EXPR_RAND: rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_counted_string_write("()", 2, iostr); break; case RASQAL_EXPR_AND: case RASQAL_EXPR_OR: case RASQAL_EXPR_EQ: case RASQAL_EXPR_NEQ: case RASQAL_EXPR_LT: case RASQAL_EXPR_GT: case RASQAL_EXPR_LE: case RASQAL_EXPR_GE: case RASQAL_EXPR_PLUS: case RASQAL_EXPR_MINUS: case RASQAL_EXPR_STAR: case RASQAL_EXPR_SLASH: case RASQAL_EXPR_REM: case RASQAL_EXPR_STR_EQ: case RASQAL_EXPR_STR_NEQ: case RASQAL_EXPR_STRLANG: case RASQAL_EXPR_STRDT: case RASQAL_EXPR_STRSTARTS: case RASQAL_EXPR_STRENDS: case RASQAL_EXPR_CONTAINS: case RASQAL_EXPR_STRBEFORE: case RASQAL_EXPR_STRAFTER: raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg1); raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg2); raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_BOUND: case RASQAL_EXPR_STR: case RASQAL_EXPR_LANG: case RASQAL_EXPR_DATATYPE: case RASQAL_EXPR_ISURI: case RASQAL_EXPR_ISBLANK: case RASQAL_EXPR_ISLITERAL: case RASQAL_EXPR_ORDER_COND_ASC: case RASQAL_EXPR_ORDER_COND_DESC: case RASQAL_EXPR_GROUP_COND_ASC: case RASQAL_EXPR_GROUP_COND_DESC: case RASQAL_EXPR_COUNT: case RASQAL_EXPR_SAMETERM: case RASQAL_EXPR_SUM: case RASQAL_EXPR_AVG: case RASQAL_EXPR_MIN: case RASQAL_EXPR_MAX: case RASQAL_EXPR_URI: case RASQAL_EXPR_IRI: case RASQAL_EXPR_BNODE: case RASQAL_EXPR_SAMPLE: case RASQAL_EXPR_ISNUMERIC: case RASQAL_EXPR_YEAR: case RASQAL_EXPR_MONTH: case RASQAL_EXPR_DAY: case RASQAL_EXPR_HOURS: case RASQAL_EXPR_MINUTES: case RASQAL_EXPR_SECONDS: case RASQAL_EXPR_TIMEZONE: case RASQAL_EXPR_FROM_UNIXTIME: case RASQAL_EXPR_TO_UNIXTIME: case RASQAL_EXPR_STRLEN: case RASQAL_EXPR_UCASE: case RASQAL_EXPR_LCASE: case RASQAL_EXPR_ENCODE_FOR_URI: case RASQAL_EXPR_TZ: case RASQAL_EXPR_ABS: case RASQAL_EXPR_ROUND: case RASQAL_EXPR_CEIL: case RASQAL_EXPR_FLOOR: case RASQAL_EXPR_MD5: case RASQAL_EXPR_SHA1: case RASQAL_EXPR_SHA224: case RASQAL_EXPR_SHA256: case RASQAL_EXPR_SHA384: case RASQAL_EXPR_SHA512: case RASQAL_EXPR_UUID: case RASQAL_EXPR_STRUUID: rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg1); raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_LANGMATCHES: case RASQAL_EXPR_REGEX: case RASQAL_EXPR_IF: case RASQAL_EXPR_SUBSTR: case RASQAL_EXPR_REPLACE: rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg1); raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg2); if((e->op == RASQAL_EXPR_REGEX || e->op == RASQAL_EXPR_IF || e->op == RASQAL_EXPR_SUBSTR) && e->arg3) { raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg3); } raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_TILDE: case RASQAL_EXPR_BANG: case RASQAL_EXPR_UMINUS: rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg1); raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_LITERAL: rasqal_query_write_sparql_literal(wc, iostr, e->literal); break; case RASQAL_EXPR_FUNCTION: raptor_uri_write(e->name, iostr); raptor_iostream_counted_string_write("( ", 2, iostr); if(e->flags & RASQAL_EXPR_FLAG_DISTINCT) raptor_iostream_counted_string_write(" DISTINCT ", 10, iostr); size = raptor_sequence_size(e->args); for(i = 0; i < size ; i++) { rasqal_expression* arg; arg = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, arg); } raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_CAST: raptor_uri_write(e->name, iostr); raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e->arg1); raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_VARSTAR: raptor_iostream_write_byte('*', iostr); break; case RASQAL_EXPR_COALESCE: case RASQAL_EXPR_CONCAT: rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_counted_string_write("( ", 2, iostr); size = raptor_sequence_size(e->args); for(i = 0; i < size ; i++) { rasqal_expression* e2; e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e2); } raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_GROUP_CONCAT: raptor_iostream_counted_string_write("GROUP_CONCAT( ", 14, iostr); if(e->flags & RASQAL_EXPR_FLAG_DISTINCT) raptor_iostream_counted_string_write("DISTINCT ", 9, iostr); size = raptor_sequence_size(e->args); for(i = 0; i < size ; i++) { rasqal_expression* arg; arg = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, arg); } if(e->literal) { raptor_iostream_counted_string_write(" ; SEPARATOR = ", 15, iostr); rasqal_query_write_sparql_literal(wc, iostr, e->literal); } raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_IN: case RASQAL_EXPR_NOT_IN: rasqal_query_write_sparql_expression(wc, iostr, e->arg1); raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_expression_op(wc, iostr, e); raptor_iostream_counted_string_write(" (", 2, iostr); size = raptor_sequence_size(e->args); for(i = 0; i < size ; i++) { rasqal_expression* e2; e2 = (rasqal_expression*)raptor_sequence_get_at(e->args, i); if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_query_write_sparql_expression(wc, iostr, e2); } raptor_iostream_counted_string_write(" )", 2, iostr); break; case RASQAL_EXPR_UNKNOWN: case RASQAL_EXPR_STR_MATCH: case RASQAL_EXPR_STR_NMATCH: default: RASQAL_FATAL2("Expression op %u cannot be written as a SPARQL expresson", e->op); } } static void rasqal_query_write_sparql_triple_data(sparql_writer_context *wc, raptor_iostream* iostr, raptor_sequence *triples, unsigned int indent) { int triple_index = 0; raptor_iostream_counted_string_write("{\n", 2, iostr); indent += 2; /* look for triples */ while(1) { rasqal_triple* t = (rasqal_triple*)raptor_sequence_get_at(triples, triple_index); if(!t) break; rasqal_query_write_indent(iostr, indent); if(t->origin) { raptor_iostream_counted_string_write("GRAPH ", 6, iostr); rasqal_query_write_sparql_literal(wc, iostr, t->origin); raptor_iostream_counted_string_write(" { ", 3, iostr); } rasqal_query_write_sparql_triple(wc, iostr, t); if(t->origin) raptor_iostream_counted_string_write(" }", 2, iostr); raptor_iostream_write_byte('\n', iostr); triple_index++; } indent -= 2; rasqal_query_write_indent(iostr, indent); raptor_iostream_write_byte('}', iostr); } static int rasqal_query_write_sparql_variables_sequence(sparql_writer_context *wc, raptor_iostream *iostr, raptor_sequence* seq) { int size = raptor_sequence_size(seq); int i; if(!seq) return 0; for(i = 0; i < size; i++) { rasqal_variable* v = (rasqal_variable*)raptor_sequence_get_at(seq, i); if(i > 0) raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_variable(wc, iostr, v); } return 0; } static int rasqal_query_write_sparql_expression_sequence(sparql_writer_context *wc, raptor_iostream* iostr, raptor_sequence* seq) { int size = raptor_sequence_size(seq); int i; if(!seq) return 0; for(i = 0; i < size; i++) { rasqal_expression* e = (rasqal_expression*)raptor_sequence_get_at(seq, i); if(i > 0) raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_expression(wc, iostr, e); } return 0; } static int rasqal_query_write_sparql_modifiers(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_solution_modifier* modifier) { raptor_sequence* seq; int limit, offset; seq = modifier->group_conditions; if(seq && raptor_sequence_size(seq) > 0) { raptor_iostream_counted_string_write("GROUP BY ", 9, iostr); rasqal_query_write_sparql_expression_sequence(wc, iostr, seq); raptor_iostream_write_byte('\n', iostr); } seq = modifier->having_conditions; if(seq && raptor_sequence_size(seq) > 0) { raptor_iostream_counted_string_write("HAVING ", 7, iostr); rasqal_query_write_sparql_expression_sequence(wc, iostr, seq); raptor_iostream_write_byte('\n', iostr); } seq = modifier->order_conditions; if(seq && raptor_sequence_size(seq) > 0) { raptor_iostream_counted_string_write("ORDER BY ", 9, iostr); rasqal_query_write_sparql_expression_sequence(wc, iostr, seq); raptor_iostream_write_byte('\n', iostr); } limit = modifier->limit; offset = modifier->offset; if(limit >= 0 || offset >= 0) { if(limit >= 0) { raptor_iostream_counted_string_write("LIMIT ", 6, iostr); raptor_iostream_decimal_write(RASQAL_GOOD_CAST(int, limit), iostr); } if(offset >= 0) { if(limit) raptor_iostream_write_byte(' ', iostr); raptor_iostream_counted_string_write("OFFSET ", 7, iostr); raptor_iostream_decimal_write(RASQAL_GOOD_CAST(int, offset), iostr); } raptor_iostream_write_byte('\n', iostr); } return 0; } static int rasqal_query_write_sparql_row(sparql_writer_context* wc, raptor_iostream* iostr, rasqal_row* row, int write_braces) { int i; if(write_braces) raptor_iostream_counted_string_write("( ", 2, iostr); for(i = 0; i < row->size; i++) { rasqal_literal* value = row->values[i]; if(i > 0) raptor_iostream_write_byte(' ', iostr); if(value) rasqal_query_write_sparql_literal(wc, iostr, value); else raptor_iostream_counted_string_write("UNDEF", 5, iostr); } if(write_braces) raptor_iostream_counted_string_write(" )", 2, iostr); return 0; } static int rasqal_query_write_sparql_values(sparql_writer_context* wc, raptor_iostream* iostr, rasqal_bindings* bindings, unsigned int indent) { int vars_size = -1; int rows_size = -1; if(!bindings) return 0; if(bindings->variables) vars_size = raptor_sequence_size(bindings->variables); raptor_iostream_counted_string_write("VALUES ", 7, iostr); if(vars_size > 1) raptor_iostream_counted_string_write("( ", 2, iostr); rasqal_query_write_sparql_variables_sequence(wc, iostr, bindings->variables); raptor_iostream_write_byte(' ', iostr); if(vars_size > 1) raptor_iostream_counted_string_write(") ", 2, iostr); raptor_iostream_counted_string_write("{ ", 2, iostr); if(bindings->rows) rows_size = raptor_sequence_size(bindings->rows); if(rows_size > 0) { int i; if(vars_size > 1) raptor_iostream_write_byte('\n', iostr); indent += 2; for(i = 0; i < rows_size; i++) { rasqal_row* row; row = (rasqal_row*)raptor_sequence_get_at(bindings->rows, i); if(vars_size > 1) { rasqal_query_write_indent(iostr, indent); rasqal_query_write_sparql_row(wc, iostr, row, 1); raptor_iostream_write_byte('\n', iostr); } else { rasqal_query_write_sparql_row(wc, iostr, row, 0); } } indent -= 2; } if(vars_size > 1) rasqal_query_write_indent(iostr, indent); else raptor_iostream_write_byte(' ', iostr); raptor_iostream_counted_string_write("}\n", 2, iostr); return 0; } static void rasqal_query_write_sparql_graph_pattern(sparql_writer_context *wc, raptor_iostream* iostr, rasqal_graph_pattern *gp, int gp_index, unsigned int indent) { int triple_index = 0; rasqal_graph_pattern_operator op; raptor_sequence *seq; int filters_count = 0; int want_braces = 1; int size = -1; op = rasqal_graph_pattern_get_operator(gp); if(op == RASQAL_GRAPH_PATTERN_OPERATOR_SELECT) { raptor_sequence* vars_seq; rasqal_graph_pattern* where_gp; raptor_iostream_counted_string_write("SELECT ", 7, iostr); vars_seq = rasqal_projection_get_variables_sequence(gp->projection); rasqal_query_write_sparql_variables_sequence(wc, iostr, vars_seq); raptor_iostream_write_byte('\n', iostr); rasqal_query_write_indent(iostr, indent); raptor_iostream_counted_string_write("WHERE ", 6, iostr); where_gp = rasqal_graph_pattern_get_sub_graph_pattern(gp, 0); rasqal_query_write_sparql_graph_pattern(wc, iostr, where_gp, 0, indent); rasqal_query_write_sparql_modifiers(wc, iostr, gp->modifier); if(gp->bindings) { rasqal_query_write_indent(iostr, indent); rasqal_query_write_sparql_values(wc, iostr, gp->bindings, indent); } return; } if(op == RASQAL_GRAPH_PATTERN_OPERATOR_LET) { /* LAQRS */ raptor_iostream_counted_string_write("LET (", 5, iostr); rasqal_query_write_sparql_variable(wc, iostr, gp->var); raptor_iostream_counted_string_write(" := ", 4, iostr); rasqal_query_write_sparql_expression(wc, iostr, gp->filter_expression); raptor_iostream_counted_string_write(") .", 3, iostr); return; } if(op == RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE) { rasqal_graph_pattern* service_gp; /* LAQRS */ raptor_iostream_counted_string_write("SERVICE ", 8, iostr); if(gp->silent) raptor_iostream_counted_string_write("SILENT ", 7, iostr); rasqal_query_write_sparql_literal(wc, iostr, gp->origin); raptor_iostream_counted_string_write(" ", 1, iostr); service_gp = rasqal_graph_pattern_get_sub_graph_pattern(gp, 0); rasqal_query_write_sparql_graph_pattern(wc, iostr, service_gp, 0, indent); return; } if(op == RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL || op == RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH) { /* prefix verbs */ if(op == RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL) raptor_iostream_counted_string_write("OPTIONAL ", 9, iostr); else { raptor_iostream_counted_string_write("GRAPH ", 6, iostr); rasqal_query_write_sparql_literal(wc, iostr, gp->origin); raptor_iostream_write_byte(' ', iostr); } } if(op == RASQAL_GRAPH_PATTERN_OPERATOR_FILTER) want_braces = 0; if(op == RASQAL_GRAPH_PATTERN_OPERATOR_VALUES) { rasqal_query_write_sparql_values(wc, iostr, gp->bindings, indent); want_braces = 0; } if(want_braces) { raptor_iostream_counted_string_write("{\n", 2, iostr); indent += 2; } /* look for triples */ while(1) { rasqal_triple* t = rasqal_graph_pattern_get_triple(gp, triple_index); if(!t) break; rasqal_query_write_indent(iostr, indent); rasqal_query_write_sparql_triple(wc, iostr, t); raptor_iostream_write_byte('\n', iostr); triple_index++; } /* look for sub-graph patterns */ seq = rasqal_graph_pattern_get_sub_graph_pattern_sequence(gp); if(seq) size = raptor_sequence_size(seq); if(size > 0) { for(gp_index = 0; gp_index < size; gp_index++) { rasqal_graph_pattern* sgp; sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, gp_index); if(!sgp) break; if(sgp->op == RASQAL_GRAPH_PATTERN_OPERATOR_FILTER) { filters_count++; continue; } if(!gp_index) rasqal_query_write_indent(iostr, indent); else { if(op == RASQAL_GRAPH_PATTERN_OPERATOR_UNION) /* infix verb */ raptor_iostream_counted_string_write(" UNION ", 7, iostr); else { /* must be prefix verb */ raptor_iostream_write_byte('\n', iostr); rasqal_query_write_indent(iostr, indent); } } rasqal_query_write_sparql_graph_pattern(wc, iostr, sgp, gp_index, indent); } if(gp_index < size) raptor_iostream_write_byte('\n', iostr); } /* look for constraints */ if(filters_count > 0) { for(gp_index = 0; 1; gp_index++) { rasqal_graph_pattern* sgp; rasqal_expression* expr; sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, gp_index); if(!sgp) break; if(sgp->op != RASQAL_GRAPH_PATTERN_OPERATOR_FILTER) continue; expr = rasqal_graph_pattern_get_filter_expression(sgp); rasqal_query_write_indent(iostr, indent); raptor_iostream_counted_string_write("FILTER( ", 8, iostr); rasqal_query_write_sparql_expression(wc, iostr, expr); raptor_iostream_counted_string_write(" )\n", 3, iostr); } } if(want_braces) { indent -= 2; rasqal_query_write_indent(iostr, indent); raptor_iostream_counted_string_write("}\n", 2, iostr); } } static void rasqal_query_write_data_format_comment(sparql_writer_context* wc, raptor_iostream *iostr, rasqal_data_graph* dg) { if(dg->format_type || dg->format_name || dg->format_uri) { raptor_iostream_counted_string_write("# format ", 9, iostr); if(dg->format_type) { raptor_iostream_counted_string_write("type ", 5, iostr); raptor_iostream_string_write(dg->format_type, iostr); } if(dg->format_name) { raptor_iostream_counted_string_write("name ", 5, iostr); raptor_iostream_string_write(dg->format_name, iostr); } if(dg->format_type) { raptor_iostream_counted_string_write("uri ", 4, iostr); rasqal_query_write_sparql_uri(wc, iostr, dg->format_uri); } } } static int rasqal_query_write_graphref(sparql_writer_context* wc, raptor_iostream *iostr, raptor_uri* uri, rasqal_update_graph_applies applies) { switch(applies) { case RASQAL_UPDATE_GRAPH_ONE: if(uri) { raptor_iostream_counted_string_write(" GRAPH ", 7, iostr); rasqal_query_write_sparql_uri(wc, iostr, uri); break; } /* FALLTHROUGH */ case RASQAL_UPDATE_GRAPH_DEFAULT: raptor_iostream_counted_string_write(" DEFAULT", 8, iostr); break; case RASQAL_UPDATE_GRAPH_NAMED: raptor_iostream_counted_string_write(" NAMED", 6, iostr); break; case RASQAL_UPDATE_GRAPH_ALL: raptor_iostream_counted_string_write(" ALL", 4, iostr); break; /* default: case not necessary */ } return 0; } static int rasqal_query_write_sparql_projection(sparql_writer_context *wc, raptor_iostream *iostr, rasqal_projection* projection) { if(!projection) return 1; if(projection->distinct) { if(projection->distinct == 1) raptor_iostream_counted_string_write(" DISTINCT", 9, iostr); else raptor_iostream_counted_string_write(" REDUCED", 8, iostr); } if(projection->wildcard) { raptor_iostream_counted_string_write(" *", 2, iostr); return 0; } raptor_iostream_write_byte(' ', iostr); return rasqal_query_write_sparql_variables_sequence(wc, iostr, projection->variables); } int rasqal_query_write_sparql_20060406_graph_pattern(rasqal_graph_pattern* gp, raptor_iostream *iostr, raptor_uri* base_uri) { rasqal_world* world = gp->query->world; sparql_writer_context wc; memset(&wc, '\0', sizeof(wc)); wc.world = world; wc.base_uri = NULL; wc.type_uri = raptor_new_uri_for_rdf_concept(world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, "type")); wc.nstack = raptor_new_namespaces(world->raptor_world_ptr, 1); if(base_uri) /* from now on all URIs are relative to this */ wc.base_uri = raptor_uri_copy(base_uri); raptor_iostream_counted_string_write("SELECT *\nWHERE ", 15, iostr); rasqal_query_write_sparql_graph_pattern(&wc, iostr, gp, /* gp_index */ -1, /* indent */ 0); raptor_free_uri(wc.type_uri); if(wc.base_uri) raptor_free_uri(wc.base_uri); raptor_free_namespaces(wc.nstack); return 0; } int rasqal_query_write_sparql_20060406(raptor_iostream *iostr, rasqal_query* query, raptor_uri *base_uri) { int i; sparql_writer_context wc; rasqal_query_verb verb; rasqal_projection* projection; memset(&wc, '\0', sizeof(wc)); wc.world = query->world; wc.base_uri = NULL; wc.type_uri = raptor_new_uri_for_rdf_concept(query->world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, "type")); wc.nstack = raptor_new_namespaces(query->world->raptor_world_ptr, 1); if(base_uri) { raptor_iostream_counted_string_write("BASE ", 5, iostr); rasqal_query_write_sparql_uri(&wc, iostr, base_uri); raptor_iostream_write_byte('\n', iostr); /* from now on all URIs are relative to this */ wc.base_uri = raptor_uri_copy(base_uri); } for(i = 0; 1 ; i++) { raptor_namespace *nspace; rasqal_prefix* p = rasqal_query_get_prefix(query, i); if(!p) break; raptor_iostream_counted_string_write("PREFIX ", 7, iostr); if(p->prefix) raptor_iostream_string_write(p->prefix, iostr); raptor_iostream_counted_string_write(": ", 2, iostr); rasqal_query_write_sparql_uri(&wc, iostr, p->uri); raptor_iostream_write_byte('\n', iostr); /* Use this constructor so we copy a URI directly */ nspace = raptor_new_namespace_from_uri(wc.nstack, p->prefix, p->uri, i); raptor_namespaces_start_namespace(wc.nstack, nspace); } if(query->explain) raptor_iostream_counted_string_write("EXPLAIN ", 8, iostr); verb = query->verb; /* These terms are deprecated */ if(query->verb == RASQAL_QUERY_VERB_INSERT || query->verb == RASQAL_QUERY_VERB_DELETE) { verb = RASQAL_QUERY_VERB_UPDATE; } /* Write SPARQL 1.1 (Draft) Update forms */ if(verb == RASQAL_QUERY_VERB_UPDATE) { rasqal_update_operation* update; /* Write SPARQL Update */ for(i = 0; (update = rasqal_query_get_update_operation(query, i)); i++) { int is_always_2_args = (update->type >= RASQAL_UPDATE_TYPE_ADD && update->type <= RASQAL_UPDATE_TYPE_COPY); if(update->type == RASQAL_UPDATE_TYPE_UPDATE) { /* update operations: * WITH ... INSERT { template } DELETE { template } WHERE { template } * INSERT/DELETE { template } WHERE { template } * INSERT/DELETE DATA { triples } */ if(update->graph_uri) { raptor_iostream_counted_string_write("WITH ", 5, iostr); rasqal_query_write_sparql_uri(&wc, iostr, update->graph_uri); raptor_iostream_write_byte('\n', iostr); } if(update->delete_templates) { raptor_iostream_counted_string_write("DELETE ", 7, iostr); if(update->flags & RASQAL_UPDATE_FLAGS_DATA) raptor_iostream_counted_string_write("DATA ", 5, iostr); rasqal_query_write_sparql_triple_data(&wc, iostr, update->delete_templates, 0); raptor_iostream_write_byte('\n', iostr); } if(update->insert_templates) { raptor_iostream_counted_string_write("INSERT ", 7, iostr); if(update->flags & RASQAL_UPDATE_FLAGS_DATA) raptor_iostream_counted_string_write("DATA ", 5, iostr); rasqal_query_write_sparql_triple_data(&wc, iostr, update->insert_templates, 0); raptor_iostream_write_byte('\n', iostr); } if(update->where) { raptor_iostream_counted_string_write("WHERE ", 6, iostr); rasqal_query_write_sparql_graph_pattern(&wc, iostr, update->where, -1, 0); raptor_iostream_write_byte('\n', iostr); } } else { /* admin operations: * CLEAR GRAPH graph-uri | DEFAULT | NAMED | ALL * CREATE (SILENT) GRAPH graph-uri | DEFAULT | NAMED | ALL * DROP (SILENT) GRAPH graph-uri * LOAD (SILENT) doc-uri / LOAD (SILENT) doc-uri INTO GRAPH graph-uri * ADD (SILENT) GraphOrDefault TO GraphOrDefault * MOVE (SILENT) GraphOrDefault TO GraphOrDefault * COPY (SILENT) GraphOrDefault TO GraphOrDefault */ raptor_iostream_string_write(rasqal_update_type_label(update->type), iostr); if(update->flags & RASQAL_UPDATE_FLAGS_SILENT) raptor_iostream_counted_string_write(" SILENT", 7, iostr); if(is_always_2_args) { /* ADD, MOVE, COPY are always 2-arg admin operations */ rasqal_query_write_graphref(&wc, iostr, update->graph_uri, RASQAL_UPDATE_GRAPH_ONE); raptor_iostream_counted_string_write(" TO", 3, iostr); rasqal_query_write_graphref(&wc, iostr, update->document_uri, RASQAL_UPDATE_GRAPH_ONE); } else if(update->type == RASQAL_UPDATE_TYPE_LOAD) { /* LOAD is 1 or 2 URIs and first one never has a GRAPH prefix */ raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_uri(&wc, iostr, update->document_uri); if(update->graph_uri) { raptor_iostream_counted_string_write(" INTO", 5, iostr); rasqal_query_write_graphref(&wc, iostr, update->graph_uri, RASQAL_UPDATE_GRAPH_ONE); } } else { /* everything else is defined by update->applies; only * CLEAR and DROP may apply to >1 graph */ rasqal_query_write_graphref(&wc, iostr, update->graph_uri, update->applies); } raptor_iostream_write_byte('\n', iostr); } } goto tidy; } if(verb != RASQAL_QUERY_VERB_CONSTRUCT) raptor_iostream_string_write(rasqal_query_verb_as_string(query->verb), iostr); projection = rasqal_query_get_projection(query); if(projection) rasqal_query_write_sparql_projection(&wc, iostr, projection); if(verb == RASQAL_QUERY_VERB_DESCRIBE) { raptor_sequence *lit_seq = query->describes; int size = raptor_sequence_size(lit_seq); for(i = 0; i < size; i++) { rasqal_literal* l = (rasqal_literal*)raptor_sequence_get_at(lit_seq, i); raptor_iostream_write_byte(' ', iostr); rasqal_query_write_sparql_literal(&wc, iostr, l); } } raptor_iostream_write_byte('\n', iostr); if(query->data_graphs) { for(i = 0; 1; i++) { rasqal_data_graph* dg = rasqal_query_get_data_graph(query, i); if(!dg) break; if(dg->flags & RASQAL_DATA_GRAPH_NAMED) continue; rasqal_query_write_data_format_comment(&wc, iostr, dg); raptor_iostream_counted_string_write("FROM ", 5, iostr); rasqal_query_write_sparql_uri(&wc, iostr, dg->uri); raptor_iostream_counted_string_write("\n", 1, iostr); } for(i = 0; 1; i++) { rasqal_data_graph* dg = rasqal_query_get_data_graph(query, i); if(!dg) break; if(!(dg->flags & RASQAL_DATA_GRAPH_NAMED)) continue; rasqal_query_write_data_format_comment(&wc, iostr, dg); raptor_iostream_counted_string_write("FROM NAMED ", 11, iostr); rasqal_query_write_sparql_uri(&wc, iostr, dg->name_uri); raptor_iostream_write_byte('\n', iostr); } } if(query->constructs) { raptor_iostream_string_write("CONSTRUCT {\n", iostr); for(i = 0; 1; i++) { rasqal_triple* t = rasqal_query_get_construct_triple(query, i); if(!t) break; raptor_iostream_counted_string_write(" ", 2, iostr); rasqal_query_write_sparql_triple(&wc, iostr, t); raptor_iostream_write_byte('\n', iostr); } raptor_iostream_counted_string_write("}\n", 2, iostr); } if(query->query_graph_pattern) { unsigned int indent = 2; raptor_iostream_counted_string_write("WHERE {\n", 8, iostr); rasqal_query_write_indent(iostr, indent); rasqal_query_write_sparql_graph_pattern(&wc, iostr, query->query_graph_pattern, -1, indent); raptor_iostream_counted_string_write("}\n", 2, iostr); } rasqal_query_write_sparql_modifiers(&wc, iostr, query->modifier); rasqal_query_write_sparql_values(&wc, iostr, query->bindings, 0); tidy: raptor_free_uri(wc.type_uri); if(wc.base_uri) raptor_free_uri(wc.base_uri); raptor_free_namespaces(wc.nstack); return 0; } rasqal-0.9.33/src/rasqal_rowsource_groupby.c0000644000175000017500000006331412301305770016114 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_groupby.c - Rasqal GROUP BY and HAVING rowsource class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE /** * rasqal_groupby_rowsource_context: * * INTERNAL - GROUP BY rowsource context * * Structure for handing grouping an input rowsource by a sequence of * #rasqal_expression - in SPARQL, the GROUP BY exprList. * */ typedef struct { /* inner rowsource to filter */ rasqal_rowsource *rowsource; /* group expression list */ raptor_sequence* exprs_seq; /* size of above list: can be 0 if @exprs_seq is NULL too */ int exprs_seq_size; /* last group ID assigned */ int group_id; /* non-0 if input has been processed */ int processed; /* avltree for grouping. * the tree nodes are #rasqal_groupby_tree_node objects */ raptor_avltree* tree; /* rasqal_literal_compare() flags */ int compare_flags; /* iterator into tree above */ raptor_avltree_iterator* group_iterator; /* index into sequence of rows at current avltree node */ int group_row_index; /* output row offset */ int offset; } rasqal_groupby_rowsource_context; /** * rasqal_groupby_tree_node: * * INTERNAL - Node structure for grouping rows by a sequence of literals * * Each node contains the data for one group * [lit, lit, ...] -> [ row, row, row, ... ] * * key: raptor_sequence* of rasqal_literal* * value: raptor_sequence* of rasqal_row* * * Plus an integer group ID identifier. * */ typedef struct { rasqal_groupby_rowsource_context* con; /* Integer ID of this group */ int group_id; /* Key of this group (seq of literals) */ raptor_sequence* literals; /* Value of this group (seq of rows) */ raptor_sequence* rows; } rasqal_groupby_tree_node; static void rasqal_free_groupby_tree_node(rasqal_groupby_tree_node* node) { if(!node) return; if(node->literals) raptor_free_sequence(node->literals); if(node->rows) raptor_free_sequence(node->rows); RASQAL_FREE(rasqal_groupby_tree_node, node); } static int rasqal_rowsource_groupby_tree_print_node(void *object, FILE *fh) { rasqal_groupby_tree_node* node = (rasqal_groupby_tree_node*)object; fputs("Group\n Key Sequence of literals: ", fh); if(node->literals) /* sequence of literals */ raptor_sequence_print(node->literals, fh); else fputs("None", fh); fputs("\n Value Sequence of rows:\n", fh); if(node->rows) { int i; int size = raptor_sequence_size(node->rows); /* sequence of rows */ for(i = 0; i < size; i++) { rasqal_row* row = (rasqal_row*)raptor_sequence_get_at(node->rows, i); fprintf(fh, " Row %d: ", i); rasqal_row_print(row, fh); fputc('\n', fh); } } else fputs("None\n", fh); return 0; } static int rasqal_rowsource_groupby_literal_sequence_compare(const void *a, const void *b) { rasqal_groupby_rowsource_context* con; rasqal_groupby_tree_node* node_a = (rasqal_groupby_tree_node*)a; rasqal_groupby_tree_node* node_b = (rasqal_groupby_tree_node*)b; con = node_a->con; return rasqal_literal_sequence_compare(con->compare_flags, node_a->literals, node_b->literals); } static int rasqal_groupby_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_groupby_rowsource_context* con; con = (rasqal_groupby_rowsource_context*)user_data; con->group_id = -1; con->compare_flags = RASQAL_COMPARE_URI; con->offset = 0; return 0; } static int rasqal_groupby_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_groupby_rowsource_context* con; con = (rasqal_groupby_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->exprs_seq) raptor_free_sequence(con->exprs_seq); if(con->tree) raptor_free_avltree(con->tree); if(con->group_iterator) raptor_free_avltree_iterator(con->group_iterator); RASQAL_FREE(rasqal_groupby_rowsource_context, con); return 0; } static int rasqal_groupby_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_groupby_rowsource_context* con; con = (rasqal_groupby_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; if(rasqal_rowsource_copy_variables(rowsource, con->rowsource)) return 1; return 0; } static int rasqal_groupby_rowsource_process(rasqal_rowsource* rowsource, rasqal_groupby_rowsource_context* con) { /* already processed */ if(con->processed) return 0; con->processed = 1; /* Empty expression list - no need to read rows */ if(!con->exprs_seq || !con->exprs_seq_size) { con->group_id++; return 0; } con->tree = raptor_new_avltree(rasqal_rowsource_groupby_literal_sequence_compare, (raptor_data_free_handler)rasqal_free_groupby_tree_node, /* flags */ 0); if(!con->tree) return 1; raptor_avltree_set_print_handler(con->tree, rasqal_rowsource_groupby_tree_print_node); while(1) { rasqal_row* row; row = rasqal_rowsource_read_row(con->rowsource); if(!row) break; rasqal_row_bind_variables(row, rowsource->query->vars_table); if(con->exprs_seq) { raptor_sequence* literal_seq; rasqal_groupby_tree_node key; rasqal_groupby_tree_node* node; literal_seq = rasqal_expression_sequence_evaluate(rowsource->query, con->exprs_seq, /* ignore_errors */ 0, /* error_p */ NULL); if(!literal_seq) { /* FIXME - what to do on errors? */ continue; } memset(&key, '\0', sizeof(key)); key.con = con; key.literals = literal_seq; node = (rasqal_groupby_tree_node*)raptor_avltree_search(con->tree, &key); if(!node) { /* New Group */ node = RASQAL_CALLOC(rasqal_groupby_tree_node*, 1, sizeof(*node)); if(!node) { raptor_free_sequence(literal_seq); return 1; } node->con = con; node->group_id = ++con->group_id; /* node now owns literal_seq */ node->literals = literal_seq; node->rows = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!node->rows) { rasqal_free_groupby_tree_node(node); return 1; } /* after this, node is owned by con->tree */ raptor_avltree_add(con->tree, node); } else raptor_free_sequence(literal_seq); row->group_id = node->group_id; /* after this, node owns the row */ raptor_sequence_push(node->rows, row); } } #ifdef RASQAL_DEBUG fputs("Grouping ", DEBUG_FH); raptor_avltree_print(con->tree, DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(raptor_avltree_size(con->tree)) con->group_iterator = raptor_new_avltree_iterator(con->tree, NULL, NULL, 1); con->group_row_index = 0; con->offset = 0; return 0; } static rasqal_row* rasqal_groupby_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_groupby_rowsource_context* con; rasqal_row *row = NULL; con = (rasqal_groupby_rowsource_context*)user_data; /* ensure we have stored grouped rows */ if(rasqal_groupby_rowsource_process(rowsource, con)) return NULL; if(con->tree && con->group_iterator) { rasqal_groupby_tree_node* node = NULL; /* Rows were grouped so iterate through grouped rows */ while(1) { node = (rasqal_groupby_tree_node*)raptor_avltree_iterator_get(con->group_iterator); if(!node) { /* No more nodes. finished last group and last row */ raptor_free_avltree_iterator(con->group_iterator); con->group_iterator = NULL; raptor_free_avltree(con->tree); con->tree = NULL; /* row = NULL is already set */ break; } /* removes row from sequence and this code now owns the reference */ row = (rasqal_row*)raptor_sequence_delete_at(node->rows, con->group_row_index++); if(row) { /* Bind the values in the input row to the variables in the table */ rasqal_row_bind_variables(row, rowsource->query->vars_table); break; } /* End of sequence so reset row sequence index and advance iterator */ con->group_row_index = 0; if(raptor_avltree_iterator_next(con->group_iterator)) break; } if(node && row) row->group_id = node->group_id; } else if(con->tree && !con->group_iterator) { /* we found inner rowsource with no rows - generate 1 row */ if(!con->offset) { row = rasqal_new_row(rowsource); if(row) row->group_id = 0; } } else { /* no grouping: just pass rows through all in one group */ row = rasqal_rowsource_read_row(con->rowsource); if(row) row->group_id = con->group_id; } if(row) row->offset = con->offset++; return row; } static int rasqal_groupby_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { return 0; } static rasqal_rowsource* rasqal_groupby_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_groupby_rowsource_context *con; con = (rasqal_groupby_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_groupby_rowsource_handler = { /* .version = */ 1, "groupby", /* .init = */ rasqal_groupby_rowsource_init, /* .finish = */ rasqal_groupby_rowsource_finish, /* .ensure_variables = */ rasqal_groupby_rowsource_ensure_variables, /* .read_row = */ rasqal_groupby_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_groupby_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_groupby_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_groupby_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * @exprs_seq: sequence of group by expressions * * INTERNAL - create a new group by rowsource * * the @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_groupby_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* rowsource, raptor_sequence* exprs_seq) { rasqal_groupby_rowsource_context* con; int flags = 0; if(!world || !query) return NULL; con = RASQAL_CALLOC(rasqal_groupby_rowsource_context*, 1, sizeof(*con)); if(!con) return NULL; con->rowsource = rowsource; con->exprs_seq_size = 0; if(exprs_seq) { con->exprs_seq = rasqal_expression_copy_expression_sequence(exprs_seq); if(!con->exprs_seq) goto fail; con->exprs_seq_size = raptor_sequence_size(exprs_seq); } return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_groupby_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); if(exprs_seq) raptor_free_sequence(exprs_seq); if(con) RASQAL_FREE(rasqal_groupby_rowsource_context*, con); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); /* * Test 0 and Test 1 test the following example from SPARQL 1.1 Query Draft " For example, given a solution sequence S, ( {?x→2, ?y→3}, {?x→2, ?y→5}, {?x→6, ?y→7} ), Group((?x), S) = { (2) → ( {?x→2, ?y→3}, {?x→2, ?y→5} ), (6) → ( {?x→6, ?y→7} ) } " */ #define GROUP_TESTS_COUNT 4 #define MAX_TEST_GROUPS 100 #define MAX_TEST_VARS 5 /* Test 0 */ static const char* const data_xy_no_rows[] = { /* 2 variable names and 0 rows */ "x", NULL, "y", NULL, NULL, NULL, NULL, NULL, }; /* Test 1 and Test 2 */ static const char* const data_xy_3_rows[] = { /* 2 variable names and 3 rows */ "x", NULL, "y", NULL, /* row 1 data */ "2", NULL, "3", NULL, /* row 2 data */ "2", NULL, "5", NULL, /* row 3 data */ "6", NULL, "7", NULL, /* end of data */ NULL, NULL, NULL, NULL, }; /* Test 3 */ static const char* const data_us_senators_100_rows[] = { /* 3 variable names and 50 rows */ "name", NULL, "state", NULL, "year", NULL, /* row 1 data */ "Al", NULL, "Minnesota", NULL, "1951", NULL, "Amy", NULL, "Minnesota", NULL, "1960", NULL, "Arlen", NULL, "Pennsylvania", NULL, "1930", NULL, "Barbara", NULL, "California", NULL, "1940", NULL, "Barbara", NULL, "Maryland", NULL, "1936", NULL, "Ben", NULL, "Maryland", NULL, "1943", NULL, "Ben", NULL, "Nebraska", NULL, "1941", NULL, "Bernie", NULL, "Vermont", NULL, "1941", NULL, "Bill", NULL, "Florida", NULL, "1942", NULL, "Blanche", NULL, "Arkansas", NULL, "1960", NULL, "Bob", NULL, "Utah", NULL, "1933", NULL, "Bob", NULL, "Pennsylvania", NULL, "1960", NULL, "Bob", NULL, "Tennessee", NULL, "1952", NULL, "Bob", NULL, "New Jersey", NULL, "1954", NULL, "Byron", NULL, "North Dakota", NULL, "1942", NULL, "Carl", NULL, "Michigan", NULL, "1934", NULL, "Carte", NULL, "West Virginia", NULL, "1974", NULL, "Christopher", NULL, "Connecticut", NULL, "1944", NULL, "Chuck", NULL, "Iowa", NULL, "1933", NULL, "Chuck", NULL, "New York", NULL, "1950", NULL, "Claire", NULL, "Missouri", NULL, "1953", NULL, "Daniel", NULL, "Hawaii", NULL, "1924", NULL, "Daniel", NULL, "Hawaii", NULL, "1924", NULL, "David", NULL, "Louisiana", NULL, "1961", NULL, "Debbie", NULL, "Michigan", NULL, "1950", NULL, "Dianne", NULL, "California", NULL, "1933", NULL, "Dick", NULL, "Illinois", NULL, "1944", NULL, "Evan", NULL, "Indiana", NULL, "1955", NULL, "Frank", NULL, "New Jersey", NULL, "1924", NULL, "George", NULL, "Florida", NULL, "1969", NULL, "George", NULL, "Ohio", NULL, "1936", NULL, "Harry", NULL, "Nevada", NULL, "1939", NULL, "Herb", NULL, "Wisconsin", NULL, "1935", NULL, "Jack", NULL, "Rhode Island", NULL, "1949", NULL, "Jay", NULL, "West Virginia", NULL, "1937", NULL, "Jeanne", NULL, "New Hampshire", NULL, "1947", NULL, "Jeff", NULL, "New Mexico", NULL, "1943", NULL, "Jeff", NULL, "Oregon", NULL, "1956", NULL, "Jeff", NULL, "Alabama", NULL, "1946", NULL, "Jim", NULL, "Kentucky", NULL, "1931", NULL, "Jim", NULL, "South Carolina", NULL, "1951", NULL, "Jim", NULL, "Oklahoma", NULL, "1934", NULL, "Jim", NULL, "Idaho", NULL, "1943", NULL, "Jim", NULL, "Virginia", NULL, "1946", NULL, "Joe", NULL, "Connecticut", NULL, "1942", NULL, "John", NULL, "Wyoming", NULL, "1952", NULL, "John", NULL, "Texas", NULL, "1952", NULL, "John", NULL, "Nevada", NULL, "1958", NULL, "John", NULL, "Massachusetts", NULL, "1943", NULL, "John", NULL, "Arizona", NULL, "1936", NULL, "John", NULL, "South Dakota", NULL, "1961", NULL, "Johnny", NULL, "Georgia", NULL, "1944", NULL, "Jon", NULL, "Arizona", NULL, "1942", NULL, "Jon", NULL, "Montana", NULL, "1956", NULL, "Judd", NULL, "New Hampshire", NULL, "1947", NULL, "Kay", NULL, "Texas", NULL, "1943", NULL, "Kay", NULL, "North Carolina", NULL, "1953", NULL, "Kent", NULL, "North Dakota", NULL, "1948", NULL, "Kirsten", NULL, "New York", NULL, "1966", NULL, "Kit", NULL, "Missouri", NULL, "1939", NULL, "Lamar", NULL, "Tennessee", NULL, "1940", NULL, "Lindsey", NULL, "South Carolina", NULL, "1955", NULL, "Lisa", NULL, "Alaska", NULL, "1957", NULL, "Maria", NULL, "Washington", NULL, "1958", NULL, "Mark", NULL, "Alaska", NULL, "1962", NULL, "Mark", NULL, "Arkansas", NULL, "1963", NULL, "Mark", NULL, "Colorado", NULL, "1950", NULL, "Mark", NULL, "Virginia", NULL, "1954", NULL, "Mary", NULL, "Louisiana", NULL, "1955", NULL, "Max", NULL, "Montana", NULL, "1941", NULL, "Michael", NULL, "Colorado", NULL, "1964", NULL, "Mike", NULL, "Idaho", NULL, "1951", NULL, "Mike", NULL, "Wyoming", NULL, "1944", NULL, "Mike", NULL, "Nebraska", NULL, "1950", NULL, "Mitch", NULL, "Kentucky", NULL, "1942", NULL, "Olympia", NULL, "Maine", NULL, "1947", NULL, "Orrin", NULL, "Utah", NULL, "1934", NULL, "Pat", NULL, "Kansas", NULL, "1936", NULL, "Patrick", NULL, "Vermont", NULL, "1940", NULL, "Patty", NULL, "Washington", NULL, "1950", NULL, "Richard", NULL, "North Carolina", NULL, "1955", NULL, "Richard", NULL, "Indiana", NULL, "1932", NULL, "Richard", NULL, "Alabama", NULL, "1934", NULL, "Roger", NULL, "Mississippi", NULL, "1951", NULL, "Roland", NULL, "Illinois", NULL, "1937", NULL, "Ron", NULL, "Oregon", NULL, "1949", NULL, "Russ", NULL, "Wisconsin", NULL, "1953", NULL, "Sam", NULL, "Kansas", NULL, "1956", NULL, "Saxby", NULL, "Georgia", NULL, "1943", NULL, "Scott", NULL, "Massachusetts", NULL, "1959", NULL, "Sheldon", NULL, "Rhode Island", NULL, "1955", NULL, "Sherrod", NULL, "Ohio", NULL, "1952", NULL, "Susan", NULL, "Maine", NULL, "1952", NULL, "Ted", NULL, "Delaware", NULL, "1939", NULL, "Thad", NULL, "Mississippi", NULL, "1937", NULL, "Tim", NULL, "South Dakota", NULL, "1946", NULL, "Tom", NULL, "Delaware", NULL, "1947", NULL, "Tom", NULL, "Oklahoma", NULL, "1948", NULL, "Tom", NULL, "Iowa", NULL, "1939", NULL, "Tom", NULL, "New Mexico", NULL, "1948", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, }; /* Group IDs expected */ /* Test 0 */ static const int test0_groupids[] = { 0 }; /* Test 1 */ static const int test1_groupids[] = { 0, 0, 0 }; /* Test 2 */ static const int test2_groupids[] = { 0, 0, 1 }; /* Raptor AVL Tree - Enumerated by order in AVL Tree which is sorted by expression list */ static const int results_us_senators_97_groups[] = { 21, 21, 27, 2, 38, 79, 10, 18, 24, 15, 40, 74, 80, 31, 4, 29, 47, 75, 33, 82, 92, 30, 57, 91, 96, 3, 58, 76, 6, 7, 67, 8, 14, 43, 50, 72, 5, 35, 41, 46, 53, 86, 17, 25, 49, 70, 37, 42, 93, 34, 52, 73, 94, 55, 95, 95, 32, 83, 19, 23, 64, 71, 77, 0, 39, 69, 81, 12, 44, 44, 89, 90, 20, 54, 84, 13, 65, 26, 59, 66, 78, 88, 36, 51, 85, 60, 45, 61, 87, 1, 9, 11, 22, 48, 62, 63, 68, 56, 28, 16 }; static const struct { int vars; int rows; int ngroups; const char* const *data; const int *group_ids; const char* const expr_vars[MAX_TEST_VARS]; } test_data[GROUP_TESTS_COUNT] = { /* Test 0: No GROUP BY : 1 group expected with NULL values */ {2, 1, 1, data_xy_no_rows, test0_groupids, { "x", NULL } }, /* Test 1: No GROUP BY : 1 group expected */ {2, 3, 1, data_xy_3_rows, test1_groupids, { NULL } }, /* Test 2: GROUP BY ?x : 2 groups expected */ {2, 3, 2, data_xy_3_rows, test2_groupids, { "x", NULL } }, /* Test 3: GROUP BY ?year, ?name : 97 groups expected */ {3, 100, 97, data_us_senators_100_rows, results_us_senators_97_groups, { "year", "name", NULL } }, }; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; raptor_sequence* row_seq = NULL; raptor_sequence* exprs_seq = NULL; int failures = 0; rasqal_variables_table* vt; rasqal_rowsource *input_rs = NULL; int vars_count; raptor_sequence* vars_seq = NULL; int test_id; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } query = rasqal_new_query(world, "sparql", NULL); vt = query->vars_table; for(test_id = 0; test_id < GROUP_TESTS_COUNT; test_id++) { int expected_rows_count = test_data[test_id].rows; int expected_vars_count = test_data[test_id].vars; const int* expected_group_ids = test_data[test_id].group_ids; int expected_ngroups = test_data[test_id].ngroups; raptor_sequence* seq = NULL; int count; int size; int i; int groups_counted; int last_group_id; vars_count = expected_vars_count; row_seq = rasqal_new_row_sequence(world, vt, test_data[test_id].data, vars_count, &vars_seq); if(row_seq) { input_rs = rasqal_new_rowsequence_rowsource(world, query, vt, row_seq, vars_seq); /* vars_seq and row_seq are now owned by input_rs */ vars_seq = row_seq = NULL; } if(!input_rs) { fprintf(stderr, "%s: failed to create rowsequence rowsource\n", program); failures++; goto tidy; } exprs_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(test_data[test_id].expr_vars[0] != NULL) { int vindex; const unsigned char* var_name; for(vindex = 0; (var_name = RASQAL_GOOD_CAST(const unsigned char*, test_data[test_id].expr_vars[vindex] )); vindex++) { rasqal_variable* v; rasqal_literal *l = NULL; rasqal_expression* e = NULL; v = rasqal_variables_table_get_by_name(vt, RASQAL_VARIABLE_TYPE_NORMAL, var_name); /* returns SHARED pointer to variable */ if(v) { v = rasqal_new_variable_from_variable(v); l = rasqal_new_variable_literal(world, v); } if(l) e = rasqal_new_literal_expression(world, l); if(e) raptor_sequence_push(exprs_seq, e); else { fprintf(stderr, "%s: failed to create variable %s\n", program, RASQAL_GOOD_CAST(const char*, var_name)); failures++; goto tidy; } } } rowsource = rasqal_new_groupby_rowsource(world, query, input_rs, exprs_seq); /* input_rs is now owned by rowsource */ input_rs = NULL; if(!rowsource) { fprintf(stderr, "%s: failed to create groupby rowsource\n", program); failures++; goto tidy; } seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: test %d rasqal_rowsource_read_all_rows() returned a NULL seq for a groupby rowsource\n", program, test_id); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != expected_rows_count) { fprintf(stderr, "%s: test %d rasqal_rowsource_read_all_rows() returned %d rows for a groupby rowsource, expected %d\n", program, test_id, count, expected_rows_count); failures++; goto tidy; } size = rasqal_rowsource_get_size(rowsource); if(size != expected_vars_count) { fprintf(stderr, "%s: test %d rasqal_rowsource_get_size() returned %d columns (variables) for a groupby rowsource, expected %d\n", program, test_id, size, expected_vars_count); failures++; goto tidy; } groups_counted = 0; last_group_id = -1; for(i = 0; i < count; i++) { rasqal_row* row = (rasqal_row*)raptor_sequence_get_at(seq, i); if(row->group_id != last_group_id) { groups_counted++; last_group_id = row->group_id; } if(row->group_id != expected_group_ids[i]) { fprintf(stderr, "%s: test %d row #%d has group_id %d, expected %d\n", program, test_id, i, row->group_id, expected_group_ids[i]); failures++; goto tidy; } } if(groups_counted != expected_ngroups) { fprintf(stderr, "%s: test %d returnd %d groups, expected %d\n", program, test_id, groups_counted, expected_ngroups); failures++; goto tidy; } #ifdef RASQAL_DEBUG rasqal_rowsource_print_row_sequence(rowsource, seq, stderr); #endif raptor_free_sequence(seq); seq = NULL; rasqal_free_rowsource(rowsource); rowsource = NULL; if(exprs_seq) raptor_free_sequence(exprs_seq); exprs_seq = NULL; } tidy: if(exprs_seq) raptor_free_sequence(exprs_seq); if(rowsource) rasqal_free_rowsource(rowsource); if(input_rs) rasqal_free_rowsource(input_rs); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_random.c0000644000175000017500000002155012434455625013605 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_random.c - Rasqal RDF Query random functions * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_TIME_H #include #endif #ifdef RANDOM_ALGO_GMP_RAND #ifdef HAVE_GMP_H #include #endif #define RANDOM_ALGO_BITS 32 #endif #ifdef RANDOM_ALGO_MTWIST #include #include #endif #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE /* * rasqal_random_get_system_seed * @random_object: evaluation context * * INTERNAL - get a 32 bit unsigned integer random seed based on system sources * * Return value: seed with only lower 32 bits valid */ unsigned int rasqal_random_get_system_seed(rasqal_world *world) { /* SOURCE 1: processor clock ticks since process started */ uint32_t a = (uint32_t)clock(); /* SOURCE 2: unix time in seconds since epoch */ uint32_t b = (uint32_t)time(NULL); uint32_t c; #ifdef HAVE_UNISTD_H /* SOURCE 3: process ID (on unix) */ c = RASQAL_GOOD_CAST(uint32_t, getpid()); #else c = 0; #endif /* Mix seed sources using public domain code from * http://www.burtleburtle.net/bob/c/lookup3.c */ #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) /* inlined mix(a, b, c) macro */ a -= c; a ^= rot(c, 4); c += b; b -= a; b ^= rot(a, 6); a += c; c -= b; c ^= rot(b, 8); b += a; a -= c; a ^= rot(c,16); c += b; b -= a; b ^= rot(a,19); /* a += c; */ /* CLANG: not needed because of below */ c -= b; c ^= rot(b, 4); /* b += a; */ /* CLANG: last calculation not needed */ /* Good as long as sizeof(unsigned int) >= sizeof(uint32_t) */ return RASQAL_GOOD_CAST(unsigned int, c); } /* * rasqal_new_random: * @world: world object * * INTERNAL - Constructor - create a new random number generator * * Return value: new rasqal_random or NULL on failure */ rasqal_random* rasqal_new_random(rasqal_world* world) { rasqal_random* r; r = RASQAL_CALLOC(rasqal_random*, 1, sizeof(*r)); if(!r) return NULL; r->world = world; #ifdef RANDOM_ALGO_RANDOM_R r->data = RASQAL_CALLOC(struct random_data*, 1, sizeof(struct random_data)); if(!r->data) { RASQAL_FREE(rasqal_random*, r); return NULL; } #endif #ifdef RANDOM_ALGO_GMP_RAND r->data = RASQAL_CALLOC(gmp_randstate_t*, 1, sizeof(gmp_randstate_t)); gmp_randinit_default(*(gmp_randstate_t*)r->data); #endif #ifdef RANDOM_ALGO_MTWIST r->data = mtwist_new(); #endif if(r) rasqal_random_seed(r, rasqal_random_get_system_seed(r->world)); return r; } /* * rasqal_free_random: * @random_object: evaluation context * * INTERNAL - Destructor - Destroy a random number generator */ void rasqal_free_random(rasqal_random *random_object) { #ifdef RANDOM_ALGO_RANDOM_R if(random_object->data) RASQAL_FREE(struct random_data*, random_object->data); #endif #ifdef RANDOM_ALGO_RANDOM if(random_object->data) setstate(RASQAL_GOOD_CAST(char*, random_object->data)); #endif #ifdef RANDOM_ALGO_GMP_RAND if(random_object->data) RASQAL_FREE(gmp_randstate_t*, random_object->data); #endif #ifdef RANDOM_ALGO_MTWIST mtwist_free((mtwist*)random_object->data); #endif RASQAL_FREE(rasqsal_random*, random_object); } /* * rasqal_random_seed: * @random_object: evaluation context * @seed: 32 bits of seed * * INTERNAL - Initialize the random number generator with a seed * * Return value: non-0 on failure */ int rasqal_random_seed(rasqal_random *random_object, unsigned int seed) { int rc = 0; #ifdef RANDOM_ALGO_RANDOM_R rc = initstate_r(seed, random_object->state, RASQAL_RANDOM_STATE_SIZE, (struct random_data*)random_object->data); #endif #ifdef RANDOM_ALGO_RANDOM random_object->data = (void*)initstate(seed, random_object->state, RASQAL_RANDOM_STATE_SIZE); #endif #ifdef RANDOM_ALGO_RAND_R random_object->seed = seed; #endif #ifdef RANDOM_ALGO_RAND srand(seed); #endif #ifdef RANDOM_ALGO_GMP_RAND gmp_randseed_ui(*(gmp_randstate_t*)random_object->data, (unsigned long)seed); #endif #ifdef RANDOM_ALGO_MTWIST mtwist_init((mtwist*)random_object->data, (unsigned long)seed); #endif return rc; } /* * rasqal_random_irand: * @random_object: evaluation context * * INTERNAL - Get a random int from the random number generator * * Return value: random integer in the range 0 to RAND_MAX inclusive; [0, RAND_MAX] */ int rasqal_random_irand(rasqal_random *random_object) { int r; #ifdef RANDOM_ALGO_RANDOM_R int32_t result; #endif #ifdef RANDOM_ALGO_RANDOM char *old_state; #endif #ifdef RANDOM_ALGO_GMP_RAND mpz_t rand_max_gmp; mpz_t iresult; #endif /* results of all these functions is an integer or long in the * range 0...RAND_MAX inclusive */ #ifdef RANDOM_ALGO_RANDOM_R result = 0; random_r((struct random_data*)random_object->data, &result); /* Good if int is 32 bits or larger */ r = RASQAL_GOOD_CAST(int, result); #endif #ifdef RANDOM_ALGO_RANDOM old_state = setstate(random_object->state); r = RASQAL_GOOD_CAST(int, random()); setstate(old_state); #endif #ifdef RANDOM_ALGO_RAND_R r = rand_r(&random_object->seed); #endif #ifdef RANDOM_ALGO_RAND r = rand(); #endif #ifdef RANDOM_ALGO_GMP_RAND /* This could be init/cleared once in random state */ mpz_init_set_ui(rand_max_gmp, 1 + (unsigned long)RAND_MAX); mpz_init(iresult); mpz_urandomm(iresult, *(gmp_randstate_t*)random_object->data, rand_max_gmp); /* cast from unsigned long to unsigned int; we know above that the max * size is RAND_MAX so it will fit */ r = RASQAL_GOOD_CAST(unsigned int, mpz_get_ui(iresult)); mpz_clear(iresult); mpz_clear(rand_max_gmp); #endif #ifdef RANDOM_ALGO_MTWIST /* cast from unsigned long to int but max size is RAND_MAX * so it will fit */ r = RASQAL_GOOD_CAST(int, mtwist_u32rand((mtwist*)random_object->data)); #endif return r; } /* * rasqal_random_drand: * @random_object: evaluation context * * INTERNAL - Get a random double from the random number generator * * Return value: random double in the range 0.0 inclusive to 1.0 exclusive; [0.0, 1.0) */ double rasqal_random_drand(rasqal_random *random_object) { #ifdef RANDOM_ALGO_GMP_RAND mpf_t fresult; #else #ifdef RANDOM_ALGO_MTWIST #else int r; #endif #endif double d; #ifdef RANDOM_ALGO_GMP_RAND mpf_init(fresult); mpf_urandomb(fresult, *(gmp_randstate_t*)random_object->data, RANDOM_ALGO_BITS); d = mpf_get_d(fresult); mpf_clear(fresult); #else #ifdef RANDOM_ALGO_MTWIST d = mtwist_drand((mtwist*)random_object->data); #else r = rasqal_random_irand(random_object); d = r / (double)(RAND_MAX + 1.0); #endif #endif return d; } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); #define NTESTS 20 int main(int argc, char *argv[]) { rasqal_world* world; const char *program = rasqal_basename(argv[0]); int failures = 0; rasqal_random* r = NULL; int test; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); failures++; goto tidy; } r = rasqal_new_random(world); if(!r) { fprintf(stderr, "%s: rasqal_new_random() failed\n", program); failures++; goto tidy; } rasqal_random_seed(r, 54321); for(test = 0; test < NTESTS; test++) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 int v; v = rasqal_random_irand(r); fprintf(stderr, "%s: Test %3d value: %10d\n", program, test, v); #else (void)rasqal_random_irand(r); #endif } for(test = 0; test < NTESTS; test++) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 double d; d = rasqal_random_drand(r); fprintf(stderr, "%s: Test %3d value: %10f\n", program, test, d); #else (void)rasqal_random_drand(r); #endif } tidy: if(r) rasqal_free_random(r); rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_literal.c0000644000175000017500000041477612441120534013763 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_literal.c - Rasqal literals * * 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif /* for strtof() and round() prototypes */ #define _ISOC99_SOURCE 1 #include #include #ifdef HAVE_STRINGS_H #include #endif #include #ifdef HAVE_STDLIB_H #include #endif /* for ptrdiff_t */ #ifdef HAVE_STDDEF_H #include #endif #include /* for isnan() */ #ifdef HAVE_MATH_H #include #endif /* for INT_MIN and INT_MAX */ #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_FLOAT_H #include #endif #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE /* prototypes */ static rasqal_literal_type rasqal_literal_promote_numerics(rasqal_literal* l1, rasqal_literal* l2, int flags); static int rasqal_literal_set_typed_value(rasqal_literal* l, rasqal_literal_type type, const unsigned char* string, int canonicalize); const unsigned char* rasqal_xsd_boolean_true = (const unsigned char*)"true"; const unsigned char* rasqal_xsd_boolean_false = (const unsigned char*)"false"; /** * rasqal_new_integer_literal: * @world: rasqal world object * @type: Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN * @integer: int value * * Constructor - Create a new Rasqal integer literal. * * The integer decimal number is turned into a rasqal integer literal * and given a datatype of xsd:integer * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_integer_literal(rasqal_world* world, rasqal_literal_type type, int integer) { raptor_uri* dt_uri; rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { l->valid = 1; l->usage = 1; l->world = world; l->type = type; l->value.integer = integer; if(type == RASQAL_LITERAL_BOOLEAN) { /* static l->string for boolean, does not need freeing */ l->string = integer ? rasqal_xsd_boolean_true : rasqal_xsd_boolean_false; l->string_len = integer ? RASQAL_XSD_BOOLEAN_TRUE_LEN : RASQAL_XSD_BOOLEAN_FALSE_LEN; } else { size_t slen = 0; l->string = rasqal_xsd_format_integer(integer, &slen); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) { rasqal_free_literal(l); return NULL; } } dt_uri = rasqal_xsd_datatype_type_to_uri(world, l->type); if(!dt_uri) { rasqal_free_literal(l); return NULL; } l->datatype = raptor_uri_copy(dt_uri); l->parent_type = rasqal_xsd_datatype_parent_type(type); } return l; } /** * rasqal_new_numeric_literal_from_long: * @world: rasqal world object * @type: Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN * @value: long value * * Constructor - Create a new Rasqal numeric literal from a long. * * The value is turned into a rasqal integer or decimal literal and * given a datatype of xsd:integer * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_numeric_literal_from_long(rasqal_world* world, rasqal_literal_type type, long value) { rasqal_xsd_decimal* d; unsigned char *string; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); /* boolean values should always be in range */ if(type == RASQAL_LITERAL_BOOLEAN) { int ivalue = value ? 1 : 0; return rasqal_new_integer_literal(world, type, ivalue); } /* For other types, if in int range, make an integer literal */ if(value >= INT_MIN && value <= INT_MAX) { return rasqal_new_integer_literal(world, type, RASQAL_GOOD_CAST(int, value)); } /* Otherwise turn it into a decimal */ d = rasqal_new_xsd_decimal(world); rasqal_xsd_decimal_set_long(d, value); string = RASQAL_GOOD_CAST(unsigned char*, rasqal_xsd_decimal_as_counted_string(d, NULL)); return rasqal_new_decimal_literal_from_decimal(world, string, d); } /** * rasqal_new_typed_literal: * @world: rasqal world object * @type: Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN * @string: lexical form - ownership not taken * * Constructor - Create a new Rasqal integer literal from a string * * The integer decimal number is turned into a rasqal integer literal * and given a datatype of xsd:integer * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_typed_literal(rasqal_world* world, rasqal_literal_type type, const unsigned char* string) { rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(!l) return NULL; l->valid = 1; l->usage = 1; l->world = world; l->type = type; if(!rasqal_xsd_datatype_check(type, string, 0)) { rasqal_free_literal(l); return NULL; } if(rasqal_literal_set_typed_value(l, type, string, 0)) { rasqal_free_literal(l); l = NULL; } return l; } /** * rasqal_new_floating_literal: * @world: rasqal world object * @type: type - #RASQAL_LITERAL_FLOAT or #RASQAL_LITERAL_DOUBLE * @d: floating literal (double) * * Constructor - Create a new Rasqal float literal from a double. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_floating_literal(rasqal_world *world, rasqal_literal_type type, double d) { raptor_uri* dt_uri; rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); if(type != RASQAL_LITERAL_FLOAT && type != RASQAL_LITERAL_DOUBLE) return NULL; l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { size_t slen = 0; l->valid = 1; l->usage = 1; l->world = world; l->type = type; l->value.floating = d; l->string = rasqal_xsd_format_double(d, &slen); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) { rasqal_free_literal(l); return NULL; } dt_uri = rasqal_xsd_datatype_type_to_uri(world, l->type); if(!dt_uri) { rasqal_free_literal(l); return NULL; } l->datatype = raptor_uri_copy(dt_uri); } return l; } /** * rasqal_new_double_literal: * @world: rasqal world object * @d: double literal * * Constructor - Create a new Rasqal double literal. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_double_literal(rasqal_world* world, double d) { return rasqal_new_floating_literal(world, RASQAL_LITERAL_DOUBLE, d); } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_new_float_literal: * @world: rasqal world object * @f: float literal * * Constructor - Create a new Rasqal float literal. * * @Deprecated: Use rasqal_new_floating_literal() with type * #RASQAL_LITERAL_FLOAT and double value. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_float_literal(rasqal_world *world, float f) { return rasqal_new_floating_literal(world, RASQAL_LITERAL_FLOAT, (double)f); } #endif /** * rasqal_new_uri_literal: * @world: rasqal world object * @uri: #raptor_uri uri * * Constructor - Create a new Rasqal URI literal from a raptor URI. * * The uri is an input parameter and is stored in the literal, not copied. * The uri is freed also on failure. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_uri_literal(rasqal_world* world, raptor_uri *uri) { rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { l->valid = 1; l->usage = 1; l->world = world; l->type = RASQAL_LITERAL_URI; l->value.uri = uri; } else { raptor_free_uri(uri); } return l; } /** * rasqal_new_pattern_literal: * @world: rasqal world object * @pattern: regex pattern * @flags: regex flags * * Constructor - Create a new Rasqal pattern literal. * * The pattern and flags are input parameters and are stored in the * literal, not copied. They are freed also on failure. * The set of flags recognised depends on the regex library and the query * language. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_pattern_literal(rasqal_world* world, const unsigned char *pattern, const char *flags) { rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(pattern, char*, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { l->valid = 1; l->usage = 1; l->world = world; l->type = RASQAL_LITERAL_PATTERN; l->string = pattern; l->string_len = RASQAL_BAD_CAST(unsigned int, strlen(RASQAL_GOOD_CAST(const char*, pattern))); l->flags = RASQAL_GOOD_CAST(const unsigned char*, flags); } else { if(flags) RASQAL_FREE(char*, flags); RASQAL_FREE(char*, pattern); } return l; } /** * rasqal_new_decimal_literal: * @world: rasqal world object * @string: decimal literal * * Constructor - Create a new Rasqal decimal literal. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_decimal_literal(rasqal_world* world, const unsigned char *string) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, NULL); return rasqal_new_decimal_literal_from_decimal(world, string, NULL); } /** * rasqal_new_decimal_literal_from_decimal: * @world: rasqal world object * @string: decimal literal string * @decimal: rasqal XSD Decimal * * Constructor - Create a new Rasqal decimal literal. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_decimal_literal_from_decimal(rasqal_world* world, const unsigned char *string, rasqal_xsd_decimal* decimal) { rasqal_literal* l; raptor_uri *dt_uri; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); /* string and decimal NULLness are checked below */ l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(!l) return NULL; l->valid = 1; l->usage = 1; l->world = world; l->type = RASQAL_LITERAL_DECIMAL; if(string) { if(!rasqal_xsd_datatype_check(l->type, string, 0)) { rasqal_free_literal(l); return NULL; } if(rasqal_literal_set_typed_value(l, l->type, string, 0)) { rasqal_free_literal(l); l = NULL; } } else if(decimal) { dt_uri = rasqal_xsd_datatype_type_to_uri(world, l->type); if(!dt_uri) { rasqal_free_literal(l); l = NULL; } else { size_t slen = 0; l->datatype = raptor_uri_copy(dt_uri); l->value.decimal = decimal; /* string is owned by l->value.decimal */ l->string = RASQAL_GOOD_CAST(unsigned char*, rasqal_xsd_decimal_as_counted_string(l->value.decimal, &slen)); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) { rasqal_free_literal(l); l = NULL; } } } else { /* no string or decimal was given */ rasqal_free_literal(l); l = NULL; } return l; } /* * rasqal_new_numeric_literal: * @world: rasqal world object * @type: datatype * @double: double * * INTERNAL - Make a numeric datatype from a double * * Return value: new literal or NULL on failure **/ rasqal_literal* rasqal_new_numeric_literal(rasqal_world* world, rasqal_literal_type type, double d) { char buffer[30]; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); switch(type) { case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: return rasqal_new_floating_literal(world, type, d); case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: if(d >= (double)INT_MIN && d <= (double)INT_MAX) return rasqal_new_integer_literal(world, type, RASQAL_GOOD_CAST(int, d)); /* otherwise FALLTHROUGH and make it a decimal */ case RASQAL_LITERAL_DECIMAL: sprintf(buffer, "%g", d); return rasqal_new_decimal_literal(world, RASQAL_GOOD_CAST(unsigned char*, buffer)); case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: RASQAL_FATAL2("Unexpected numeric type %u", type); } return NULL; } /** * rasqal_new_datetime_literal_from_datetime: * @world: rasqal world object * @dt: rasqal XSD Datetime * * Constructor - Create a new Rasqal datetime literal from an existing datetime. * * Takes ownership of @dt * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_datetime_literal_from_datetime(rasqal_world* world, rasqal_xsd_datetime* dt) { rasqal_literal* l; raptor_uri *dt_uri; size_t slen = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(dt, rasqal_xsd_datetime, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(!l) goto failed; l->valid = 1; l->usage = 1; l->world = world; l->type = RASQAL_LITERAL_DATETIME; dt_uri = rasqal_xsd_datatype_type_to_uri(world, l->type); if(!dt_uri) goto failed; l->datatype = raptor_uri_copy(dt_uri); l->value.datetime = dt; l->string = RASQAL_GOOD_CAST(unsigned char*, rasqal_xsd_datetime_to_counted_string(l->value.datetime, &slen)); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) goto failed; return l; failed: if(l) rasqal_free_literal(l); if(dt) rasqal_free_xsd_datetime(dt); return NULL; } /* * rasqal_literal_set_typed_value: * @l: literal * @type: type * @string: string or NULL to use existing literal string * @canonicalize: non-0 to canonicalize the existing string * * INTERNAL - Set a literal typed value * * Return value: non-0 on failure **/ static int rasqal_literal_set_typed_value(rasqal_literal* l, rasqal_literal_type type, const unsigned char* string, int canonicalize) { char *eptr; raptor_uri* dt_uri; int i; double d; rasqal_literal_type original_type = l->type; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 1); retype: l->valid = rasqal_xsd_datatype_check(type, string ? string : l->string, 0 /* no flags set */); if(!l->valid) { RASQAL_DEBUG3("Invalid type %s string '%s' - setting to type UDT\n", rasqal_xsd_datatype_label(type), string ? string : l->string); type = RASQAL_LITERAL_UDT; } if(l->language) { RASQAL_FREE(char*, l->language); l->language = NULL; } l->type = type; if(string && l->type != RASQAL_LITERAL_DECIMAL) { if(l->string) RASQAL_FREE(char*, l->string); l->string_len = RASQAL_BAD_CAST(unsigned int, strlen(RASQAL_GOOD_CAST(const char*, string))); l->string = RASQAL_MALLOC(unsigned char*, l->string_len + 1); if(!l->string) return 1; memcpy((void*)l->string, string, l->string_len + 1); } if(l->type <= RASQAL_LITERAL_LAST_XSD) { dt_uri = rasqal_xsd_datatype_type_to_uri(l->world, l->type); if(!dt_uri) return 1; if(l->datatype) raptor_free_uri(l->datatype); l->datatype = raptor_uri_copy(dt_uri); l->parent_type = rasqal_xsd_datatype_parent_type(type); } switch(type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: if(1) { long long_i; eptr = NULL; errno = 0; long_i = strtol(RASQAL_GOOD_CAST(const char*, l->string), &eptr, 10); if(*eptr) return 1; if(errno == ERANGE) { /* under or overflow of strtol() so fallthrough to DECIMAL */ } else if(long_i >= INT_MIN && long_i <= INT_MAX) { l->value.integer = RASQAL_GOOD_CAST(int, long_i); break; } } /* Will not fit in an int so turn it into a decimal */ type = RASQAL_LITERAL_DECIMAL; goto retype; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: if(1) { size_t slen = 0; d = 0.0; (void)sscanf(RASQAL_GOOD_CAST(char*, l->string), "%lf", &d); l->value.floating = d; if(canonicalize) { RASQAL_FREE(char*, l->string); l->string = rasqal_xsd_format_double(d, &slen); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); } } break; case RASQAL_LITERAL_DECIMAL: if(1) { size_t slen = 0; rasqal_xsd_decimal* new_d; new_d = rasqal_new_xsd_decimal(l->world); if(!new_d) return 1; if(!string) /* use existing literal decimal object (SHARED) string */ string = l->string; if(rasqal_xsd_decimal_set_string(new_d, RASQAL_GOOD_CAST(const char*, string))) { rasqal_free_xsd_decimal(new_d); return 1; } if(l->value.decimal) { rasqal_free_xsd_decimal(l->value.decimal); } l->value.decimal = new_d; /* old l->string is now invalid and MAY need to be freed */ if(l->string && original_type != RASQAL_LITERAL_DECIMAL) RASQAL_FREE(char*, l->string); /* new l->string is owned by l->value.decimal and will be * freed on literal destruction */ l->string = RASQAL_GOOD_CAST(unsigned char*, rasqal_xsd_decimal_as_counted_string(l->value.decimal, &slen)); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) return 1; } break; case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_UDT: /* No change - kept as same type - xsd:string or user defined */ break; case RASQAL_LITERAL_BOOLEAN: i = rasqal_xsd_boolean_value_from_string(l->string); /* Free passed in string if it is not our static objects */ if(l->string != rasqal_xsd_boolean_true && l->string != rasqal_xsd_boolean_false) RASQAL_FREE(char*, l->string); /* and replace with a static string */ l->string = i ? rasqal_xsd_boolean_true : rasqal_xsd_boolean_false; l->string_len = i ? RASQAL_XSD_BOOLEAN_TRUE_LEN : RASQAL_XSD_BOOLEAN_FALSE_LEN; l->value.integer = i; break; case RASQAL_LITERAL_STRING: /* No change - kept as a string */ break; case RASQAL_LITERAL_DATE: if(1) { size_t slen = 0; if(l->value.date) rasqal_free_xsd_date(l->value.date); l->value.date = rasqal_new_xsd_date(l->world, RASQAL_GOOD_CAST(const char*, l->string)); if(!l->value.date) { RASQAL_FREE(char*, l->string); return 1; } RASQAL_FREE(char*, l->string); l->string = RASQAL_GOOD_CAST(unsigned char*, rasqal_xsd_date_to_counted_string(l->value.date, &slen)); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) return 1; } break; case RASQAL_LITERAL_DATETIME: if(1) { size_t slen = 0; if(l->value.datetime) rasqal_free_xsd_datetime(l->value.datetime); l->value.datetime = rasqal_new_xsd_datetime(l->world, RASQAL_GOOD_CAST(const char*, l->string)); if(!l->value.datetime) { RASQAL_FREE(char*, l->string); return 1; } RASQAL_FREE(char*, l->string); l->string = RASQAL_GOOD_CAST(unsigned char*, rasqal_xsd_datetime_to_counted_string(l->value.datetime, &slen)); l->string_len = RASQAL_BAD_CAST(unsigned int, slen); if(!l->string) return 1; } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: RASQAL_FATAL2("Unexpected native type %u", type); break; default: RASQAL_FATAL2("Unknown native type %u", type); } return 0; } /* * rasqal_literal_string_to_native: * @l: #rasqal_literal to operate on inline * @flags: flags for literal checking. 1 to canonicalize string * * INTERNAL - Upgrade a datatyped literal string to an internal typed literal * * At present this promotes datatyped literals * xsd:integer to RASQAL_LITERAL_INTEGER * xsd:double to RASQAL_LITERAL_DOUBLE * xsd:float to RASQAL_LITERAL_FLOAT * xsd:boolean to RASQAL_LITERAL_BOOLEAN * xsd:decimal to RASQAL_LITERAL_DECIMAL * xsd:dateTime to RASQAL_LITERAL_DATETIME * xsd:date to RASQAL_LITERAL_DATE * * Return value: non-0 on failure **/ int rasqal_literal_string_to_native(rasqal_literal *l, int flags) { rasqal_literal_type native_type = RASQAL_LITERAL_UNKNOWN; int rc = 0; int canonicalize = (flags & 1 ); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 1); /* RDF literal with no datatype (plain literal) */ if(!l->datatype) return 0; native_type = rasqal_xsd_datatype_uri_to_type(l->world, l->datatype); /* plain literal - nothing to do */ if(native_type == RASQAL_LITERAL_STRING) return 0; /* xsd:string - mark and return */ if(native_type == RASQAL_LITERAL_XSD_STRING) { l->type = native_type; return 0; } /* If a user defined type - update the literal */ if(native_type == RASQAL_LITERAL_UNKNOWN) { l->type = RASQAL_LITERAL_UDT; return 0; } rc = rasqal_literal_set_typed_value(l, native_type, NULL /* existing string */, canonicalize); if(!rasqal_xsd_datatype_check(native_type, l->string, 1)) return 0; return rc; } /* * rasqal_new_string_literal_common: * @world: rasqal world object * @string: UTF-8 string lexical form * @language: RDF language (xml:lang) (or NULL) * @datatype: datatype URI (or NULL for plain literal) * @datatype_qname: datatype qname string (or NULL for plain literal) * @flags: bitflags - 1 to do native type promotion; 2 to canonicalize string * * INTERNAL Constructor - Create a new Rasqal string literal. * * All parameters are input parameters and if present are stored in * the literal, not copied. They are freed also on failure. * * The datatype and datatype_qname parameters are alternatives; the * qname is a datatype that cannot be resolved till later since the * prefixes have not yet been declared or checked. * * If the string literal is datatyped and of certain types recognised * it may be converted to a different literal type by * rasqal_literal_string_to_native() only if @flags has bit 1 set. * If bit 2 is set AS WELL, literals will have their string converted * to the canonical format. * * Return value: New #rasqal_literal or NULL on failure **/ static rasqal_literal* rasqal_new_string_literal_common(rasqal_world* world, const unsigned char *string, const char *language, raptor_uri *datatype, const unsigned char *datatype_qname, int flags) { rasqal_literal* l; int native_type_promotion = (flags & 1); int canonicalize = (flags & 2) >> 1; l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { rasqal_literal_type datatype_type = RASQAL_LITERAL_STRING; l->valid = 1; l->usage = 1; l->world = world; if(datatype && language) { /* RDF typed literal but this is not allowed so delete language */ RASQAL_FREE(char*, language); language = NULL; } l->type = RASQAL_LITERAL_STRING; l->string = string; l->string_len = RASQAL_BAD_CAST(unsigned int, strlen(RASQAL_GOOD_CAST(const char*, string))); if(language) { /* Normalize language to lowercase on construction */ size_t lang_len = strlen(language); unsigned int i; l->language = RASQAL_MALLOC(char*, lang_len + 1); for(i = 0; i < lang_len; i++) { char c = language[i]; if(isupper(RASQAL_GOOD_CAST(int, c))) c = RASQAL_GOOD_CAST(char, tolower(RASQAL_GOOD_CAST(int, c))); l->language[i] = c; } l->language[i] = '\0'; RASQAL_FREE(char*, language); } l->datatype = datatype; l->flags = datatype_qname; if(datatype) datatype_type = rasqal_xsd_datatype_uri_to_type(world, datatype); l->parent_type = rasqal_xsd_datatype_parent_type(datatype_type); if(native_type_promotion && rasqal_literal_string_to_native(l, canonicalize)) { rasqal_free_literal(l); l = NULL; } } else { if(language) RASQAL_FREE(char*, language); if(datatype) raptor_free_uri(datatype); if(datatype_qname) RASQAL_FREE(char*, datatype_qname); RASQAL_FREE(char*, string); } return l; } /** * rasqal_new_string_literal: * @world: rasqal world object * @string: UTF-8 string lexical form * @language: RDF language (xml:lang) (or NULL) * @datatype: datatype URI (or NULL for plain literal) * @datatype_qname: datatype qname string (or NULL for plain literal) * * Constructor - Create a new Rasqal string literal. * * All parameters are input parameters and if present are stored in * the literal, not copied. They are freed also on failure. * * The datatype and datatype_qname parameters are alternatives; the * qname is a datatype that cannot be resolved till later since the * prefixes have not yet been declared or checked. * * If the string literal is datatyped and of certain types recognised * it may be converted to a different literal type. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_string_literal(rasqal_world* world, const unsigned char *string, const char *language, raptor_uri *datatype, const unsigned char *datatype_qname) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, NULL); return rasqal_new_string_literal_common(world, string, language, datatype, datatype_qname, 1); } /* * rasqal_new_string_literal_node: * @world: rasqal world object * @string: UTF-8 string lexical form * @language: RDF language (xml:lang) (or NULL) * @datatype: datatype URI (or NULL for plain literal) * * INTERNAL Constructor - Create a new Rasqal literal with promotion and canonicalization * * All parameters are input parameters and if present are stored in * the literal, not copied. They are freed also on failure. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_string_literal_node(rasqal_world* world, const unsigned char *string, const char *language, raptor_uri *datatype) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, NULL); return rasqal_new_string_literal_common(world, string, language, datatype, NULL, 1 | 2); } /** * rasqal_new_simple_literal: * @world: rasqal world object * @type: RASQAL_LITERAL_BLANK or RASQAL_LITERAL_BLANK_QNAME * @string: the UTF-8 string value to store * * Constructor - Create a new Rasqal simple literal. * * The string is an input parameter and is stored in the * literal, not copied. It is freed also on failure. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_simple_literal(rasqal_world* world, rasqal_literal_type type, const unsigned char *string) { rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { l->valid = 1; l->usage = 1; l->world = world; l->type = type; l->string = string; l->string_len = RASQAL_BAD_CAST(unsigned int, strlen(RASQAL_GOOD_CAST(const char*, string))); } else { RASQAL_FREE(char*, string); } return l; } /** * rasqal_new_boolean_literal: * @world: rasqal world object * @value: non-0 for true, 0 for false * * Constructor - Create a new Rasqal boolean literal. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_boolean_literal(rasqal_world* world, int value) { raptor_uri* dt_uri; rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { l->valid = 1; l->usage = 1; l->world = world; l->type = RASQAL_LITERAL_BOOLEAN; l->value.integer = value; l->string = value ? rasqal_xsd_boolean_true : rasqal_xsd_boolean_false; l->string_len = value ? RASQAL_XSD_BOOLEAN_TRUE_LEN : RASQAL_XSD_BOOLEAN_FALSE_LEN; dt_uri = rasqal_xsd_datatype_type_to_uri(world, l->type); if(!dt_uri) { rasqal_free_literal(l); return NULL; } l->datatype = raptor_uri_copy(dt_uri); } return l; } /** * rasqal_new_variable_literal: * @world: rasqal_world object * @variable: #rasqal_variable to use * * Constructor - Create a new Rasqal variable literal. * * variable is an input parameter and stored in the literal, not copied. * * Return value: New #rasqal_literal or NULL on failure **/ rasqal_literal* rasqal_new_variable_literal(rasqal_world* world, rasqal_variable *variable) { rasqal_literal* l; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(variable, rasqal_variable, NULL); l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*l)); if(l) { l->valid = 1; l->usage = 1; l->world = world; l->type = RASQAL_LITERAL_VARIABLE; l->value.variable = variable; } else rasqal_free_variable(variable); return l; } /** * rasqal_new_literal_from_literal: * @l: #rasqal_literal object to copy or NULL * * Copy Constructor - create a new rasqal_literal object from an existing rasqal_literal object. * * Return value: a new #rasqal_literal object or NULL if @l was NULL. **/ rasqal_literal* rasqal_new_literal_from_literal(rasqal_literal* l) { if(!l) return NULL; l->usage++; return l; } /** * rasqal_free_literal: * @l: #rasqal_literal object * * Destructor - destroy an rasqal_literal object. * **/ void rasqal_free_literal(rasqal_literal* l) { if(!l) return; if(--l->usage) return; switch(l->type) { case RASQAL_LITERAL_URI: if(l->value.uri) raptor_free_uri(l->value.uri); break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: if(l->string) RASQAL_FREE(char*, l->string); if(l->language) RASQAL_FREE(char*, l->language); if(l->datatype) raptor_free_uri(l->datatype); if(l->type == RASQAL_LITERAL_STRING || l->type == RASQAL_LITERAL_PATTERN) { if(l->flags) RASQAL_FREE(char*, l->flags); } break; case RASQAL_LITERAL_DATE: if(l->string) RASQAL_FREE(char*, l->string); if(l->datatype) raptor_free_uri(l->datatype); if(l->value.date) rasqal_free_xsd_date(l->value.date); break; case RASQAL_LITERAL_DATETIME: if(l->string) RASQAL_FREE(char*, l->string); if(l->datatype) raptor_free_uri(l->datatype); if(l->value.datetime) rasqal_free_xsd_datetime(l->value.datetime); break; case RASQAL_LITERAL_DECIMAL: /* l->string is owned by l->value.decimal - do not free it */ if(l->datatype) raptor_free_uri(l->datatype); if(l->value.decimal) rasqal_free_xsd_decimal(l->value.decimal); break; case RASQAL_LITERAL_BOOLEAN: /* static l->string for boolean, does not need freeing */ if(l->datatype) raptor_free_uri(l->datatype); break; case RASQAL_LITERAL_VARIABLE: if(l->value.variable) rasqal_free_variable(l->value.variable); break; case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", l->type); } RASQAL_FREE(rasqal_literal, l); } /* * The order here must match that of rasqal_literal_type * in rasqal.h and is significant as rasqal_literal_compare * uses it for type comparisons with the RASQAL_COMPARE_XQUERY * flag. */ static const char* const rasqal_literal_type_labels[RASQAL_LITERAL_LAST + 1]={ "UNKNOWN", "blank", "uri", "string", "xsdstring", "boolean", "integer", "float", "double", "decimal", "datetime", "udt", "pattern", "qname", "variable", "", "date" }; /** * rasqal_literal_type_label: * @type: the #rasqal_literal_type object * * Get a label for the rasqal literal type * * Return value: the label (shared string) or NULL if type is out of * range or unknown **/ const char* rasqal_literal_type_label(rasqal_literal_type type) { if(type > RASQAL_LITERAL_LAST) type = RASQAL_LITERAL_UNKNOWN; return rasqal_literal_type_labels[RASQAL_GOOD_CAST(int, type)]; } /** * rasqal_literal_write_type: * @l: the #rasqal_literal object * @iostr: the #raptor_iostream handle to print to * * Write a string form for a rasqal literal type to an iostream * **/ void rasqal_literal_write_type(rasqal_literal* l, raptor_iostream* iostr) { if(!l) { raptor_iostream_counted_string_write("null", 4, iostr); return; } raptor_iostream_string_write(rasqal_literal_type_label(l->type), iostr); } /** * rasqal_literal_print_type: * @l: the #rasqal_literal object * @fh: the FILE* handle to print to * * Print a string form for a rasqal literal type. * **/ void rasqal_literal_print_type(rasqal_literal* l, FILE* fh) { raptor_iostream *iostr; if(!l) { fputs("null", fh); return; } iostr = raptor_new_iostream_to_file_handle(l->world->raptor_world_ptr, fh); if(!iostr) return; rasqal_literal_write_type(l, iostr); raptor_free_iostream(iostr); } /** * rasqal_literal_write: * @l: the #rasqal_literal object * @iostr: the #raptor_iostream handle to write to * * Write a Rasqal literal to an iostream in a debug format. * * The print debug format may change in any release. **/ void rasqal_literal_write(rasqal_literal* l, raptor_iostream* iostr) { const unsigned char*str; size_t len; if(!l) { raptor_iostream_counted_string_write("null", 4, iostr); return; } if(!l->valid) raptor_iostream_counted_string_write("INV:", 4, iostr); if(l->type != RASQAL_LITERAL_VARIABLE) rasqal_literal_write_type(l, iostr); switch(l->type) { case RASQAL_LITERAL_URI: raptor_iostream_write_byte('<', iostr); str = raptor_uri_as_counted_string(l->value.uri, &len); raptor_string_ntriples_write(str, len, '>', iostr); raptor_iostream_write_byte('>', iostr); break; case RASQAL_LITERAL_BLANK: raptor_iostream_write_byte(' ', iostr); raptor_iostream_counted_string_write(l->string, l->string_len, iostr); break; case RASQAL_LITERAL_PATTERN: raptor_iostream_write_byte('/', iostr); raptor_iostream_counted_string_write(l->string, l->string_len, iostr); raptor_iostream_write_byte('/', iostr); if(l->flags) raptor_iostream_string_write(l->flags, iostr); break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_UDT: raptor_iostream_counted_string_write("(\"", 2, iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_write_byte('"', iostr); if(l->language) { raptor_iostream_write_byte('@', iostr); raptor_iostream_string_write(l->language, iostr); } if(l->datatype) { raptor_iostream_counted_string_write("^^<", 3, iostr); str = raptor_uri_as_counted_string(l->datatype, &len); raptor_string_ntriples_write(str, len, '>', iostr); raptor_iostream_write_byte('>', iostr); } raptor_iostream_write_byte(')', iostr); break; case RASQAL_LITERAL_VARIABLE: rasqal_variable_write(l->value.variable, iostr); break; case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_INTEGER_SUBTYPE: raptor_iostream_write_byte('(', iostr); raptor_iostream_counted_string_write(l->string, l->string_len, iostr); raptor_iostream_write_byte(')', iostr); break; case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", l->type); } } /** * rasqal_literal_print: * @l: the #rasqal_literal object * @fh: the FILE handle to print to * * Print a Rasqal literal in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_literal_print(rasqal_literal* l, FILE* fh) { raptor_iostream *iostr; if(!l) { fputs("NULL", fh); return 0; } iostr = raptor_new_iostream_to_file_handle(l->world->raptor_world_ptr, fh); rasqal_literal_write(l, iostr); raptor_free_iostream(iostr); return 0; } /* * rasqal_literal_as_boolean: * @l: #rasqal_literal object * @error_p: pointer to error flag * * INTERNAL - Return a literal as a boolean value * * SPARQL Effective Boolean Value (EBV) rules: * - If the argument is a typed literal with a datatype of xsd:boolean, the * EBV is the value of that argument. * - If the argument is a plain literal or a typed literal with a datatype of * xsd:string, the EBV is false if the operand value has zero length; * otherwise the EBV is true. * - If the argument is a numeric type or a typed literal with a datatype * derived from a numeric type, the EBV is false if the operand value is NaN * or is numerically equal to zero; otherwise the EBV is true. * - All other arguments, including unbound arguments, produce a type error. * * Return value: non-0 if true **/ int rasqal_literal_as_boolean(rasqal_literal* l, int *error_p) { if(!l) { /* type error */ if(error_p) *error_p = 1; return 0; } switch(l->type) { case RASQAL_LITERAL_STRING: if(l->datatype) { if(raptor_uri_equals(l->datatype, rasqal_xsd_datatype_type_to_uri(l->world, RASQAL_LITERAL_STRING))) { /* typed literal with xsd:string datatype -> true if non-empty */ return l->string && *l->string; } /* typed literal with other datatype -> type error */ if(error_p) *error_p = 1; return 0; } /* plain literal -> true if non-empty */ return l->string && *l->string; case RASQAL_LITERAL_XSD_STRING: /* xsd:string -> true if non-empty */ return l->string && *l->string; case RASQAL_LITERAL_URI: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: if(error_p) *error_p = 1; return 0; case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER_SUBTYPE: return l->value.integer != 0; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: if(isnan(l->value.floating)) return 0; return fabs(l->value.floating) > RASQAL_DOUBLE_EPSILON; case RASQAL_LITERAL_VARIABLE: return rasqal_literal_as_boolean(l->value.variable->value, error_p); case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", l->type); return 0; /* keep some compilers happy */ } } /* * rasqal_literal_as_integer * @l: #rasqal_literal object * @error_p: pointer to error flag * * INTERNAL - Return a literal as an integer value * * Integers, booleans, double and float literals natural are turned into * integers. If string values are the lexical form of an integer, that is * returned. Otherwise the error flag is set. * * Return value: integer value **/ int rasqal_literal_as_integer(rasqal_literal* l, int *error_p) { if(!l) { /* type error */ if(error_p) *error_p = 1; return 0; } switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: return l->value.integer; case RASQAL_LITERAL_BOOLEAN: return l->value.integer != 0; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: return RASQAL_FLOATING_AS_INT(l->value.floating); case RASQAL_LITERAL_DECIMAL: { int error = 0; long lvalue = rasqal_xsd_decimal_get_long(l->value.decimal, &error); if(lvalue < INT_MIN || lvalue > INT_MAX) error = 1; if(error) { if(error_p) *error_p = 1; return 0; } return RASQAL_GOOD_CAST(int, lvalue); } case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: { char *eptr; double d; long long_i; eptr = NULL; errno = 0; long_i = strtol(RASQAL_GOOD_CAST(const char*, l->string), &eptr, 10); /* If formatted correctly and no under or overflow */ if(RASQAL_GOOD_CAST(unsigned char*, eptr) != l->string && *eptr=='\0' && errno != ERANGE) /* FIXME may lose precision or be out of range from long to int */ return RASQAL_BAD_CAST(int, long_i); eptr = NULL; d = strtod(RASQAL_GOOD_CAST(const char*, l->string), &eptr); if(RASQAL_GOOD_CAST(unsigned char*, eptr) != l->string && *eptr=='\0') return RASQAL_FLOATING_AS_INT(d); } if(error_p) *error_p = 1; return 0; case RASQAL_LITERAL_VARIABLE: return rasqal_literal_as_integer(l->value.variable->value, error_p); case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: if(error_p) *error_p = 1; return 0; case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", l->type); return 0; /* keep some compilers happy */ } } /* * rasqal_literal_as_double: * @l: #rasqal_literal object * @error_p: pointer to error flag * * INTERNAL - Return a literal as a double precision floating value * * Integers, booleans, double and float literals natural are turned into * integers. If string values are the lexical form of an floating, that is * returned. Otherwise the error flag is set. * * Return value: double precision floating value **/ double rasqal_literal_as_double(rasqal_literal* l, int *error_p) { if(!l) { /* type error */ *error_p = 1; return 0.0; } switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER_SUBTYPE: return (double)l->value.integer; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: return l->value.floating; case RASQAL_LITERAL_DECIMAL: return rasqal_xsd_decimal_get_double(l->value.decimal); case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: { char *eptr = NULL; double d = strtod(RASQAL_GOOD_CAST(const char*, l->string), &eptr); if(RASQAL_GOOD_CAST(unsigned char*, eptr) != l->string && *eptr == '\0') return d; } if(error_p) *error_p = 1; return 0.0; case RASQAL_LITERAL_VARIABLE: return rasqal_literal_as_double(l->value.variable->value, error_p); case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: if(error_p) *error_p = 1; return 0.0; case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", l->type); return 0.0; /* keep some compilers happy */ } } /* * rasqal_literal_as_uri: * @l: #rasqal_literal object * * INTERNAL - Return a literal as a raptor_uri* * * Return value: shared raptor_uri* value or NULL on failure **/ raptor_uri* rasqal_literal_as_uri(rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); if(l->type == RASQAL_LITERAL_URI) return l->value.uri; if(l->type == RASQAL_LITERAL_VARIABLE && l->value.variable->value) return rasqal_literal_as_uri(l->value.variable->value); return NULL; } /** * rasqal_literal_as_counted_string: * @l: #rasqal_literal object * @len_p: pointer to store length of string (or NULL) * @flags: comparison flags * @error_p: pointer to error * * Return a counted string format of a literal according to flags. * * flag bits affects conversion: * RASQAL_COMPARE_XQUERY: use XQuery conversion rules * * If @error is not NULL, *error is set to non-0 on error * * Return value: pointer to a shared string format of the literal. **/ const unsigned char* rasqal_literal_as_counted_string(rasqal_literal* l, size_t *len_p, int flags, int *error_p) { if(!l) { /* type error */ if(error_p) *error_p = 1; return NULL; } switch(l->type) { case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: if(len_p) *len_p = l->string_len; return l->string; case RASQAL_LITERAL_URI: if(flags & RASQAL_COMPARE_XQUERY) { if(error_p) *error_p = 1; return NULL; } return raptor_uri_as_counted_string(l->value.uri, len_p); case RASQAL_LITERAL_VARIABLE: return rasqal_literal_as_counted_string(l->value.variable->value, len_p, flags, error_p); case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", l->type); } return NULL; } /** * rasqal_literal_as_string_flags: * @l: #rasqal_literal object * @flags: comparison flags * @error_p: pointer to error * * Return the string format of a literal according to flags. * * flag bits affects conversion: * RASQAL_COMPARE_XQUERY: use XQuery conversion rules * * If @error is not NULL, *error is set to non-0 on error * * Return value: pointer to a shared string format of the literal. **/ const unsigned char* rasqal_literal_as_string_flags(rasqal_literal* l, int flags, int *error_p) { if(!l) { /* type error */ *error_p = 1; return NULL; } return rasqal_literal_as_counted_string(l, NULL, flags, error_p); } /** * rasqal_literal_as_string: * @l: #rasqal_literal object * * Return the string format of a literal. * * Return value: pointer to a shared string format of the literal. **/ const unsigned char* rasqal_literal_as_string(rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); return rasqal_literal_as_string_flags(l, 0, NULL); } /** * rasqal_literal_as_variable: * @l: #rasqal_literal object * * Get the variable inside a literal. * * Return value: the #rasqal_variable or NULL if the literal is not a variable **/ rasqal_variable* rasqal_literal_as_variable(rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); return (l->type == RASQAL_LITERAL_VARIABLE) ? l->value.variable : NULL; } /* * rasqal_literal_promote_numerics: * @l1: first literal * @l2: second literal * @flags: promotion flags * * INTERNAL - Calculate the type to promote a pair of literals to * * Numeric type promotion * http://www.w3.org/TR/xpath20/#dt-type-promotion * * [[xs:decimal (or any type derived by restriction from xs:decimal, * including xs:integer) can be promoted to either of the types * xs:float or xs:double.]] * * For here that means xs:integer to xs:double and xs:decimal to xs:double * * Return value: promote type or RASQAL_LITERAL_UNKNOWN */ static rasqal_literal_type rasqal_literal_promote_numerics(rasqal_literal* l1, rasqal_literal* l2, int flags) { rasqal_literal_type type1 = l1->type; rasqal_literal_type type2 = l2->type; rasqal_literal_type promotion_type; rasqal_literal_type result_type = RASQAL_LITERAL_UNKNOWN; /* B1 1.b http://www.w3.org/TR/xpath20/#dt-type-promotion */ if(type1 == RASQAL_LITERAL_DECIMAL && (type2 == RASQAL_LITERAL_FLOAT || type2 == RASQAL_LITERAL_DOUBLE)) { result_type = type2; goto done; } else if(type2 == RASQAL_LITERAL_DECIMAL && (type1 == RASQAL_LITERAL_FLOAT || type1 == RASQAL_LITERAL_DOUBLE)) { result_type = type1; goto done; } for(promotion_type = RASQAL_LITERAL_FIRST_XSD; promotion_type <= RASQAL_LITERAL_LAST_XSD; promotion_type = (rasqal_literal_type)(RASQAL_GOOD_CAST(unsigned int, promotion_type) + 1)) { rasqal_literal_type parent_type1 = rasqal_xsd_datatype_parent_type(type1); rasqal_literal_type parent_type2 = rasqal_xsd_datatype_parent_type(type2); /* Finished */ if(type1 == type2) { result_type = type1; break; } if(parent_type1 == type2) { result_type = type2; break; } if(parent_type2 == type1) { result_type = type1; break; } if(parent_type1 == promotion_type) type1 = promotion_type; if(parent_type2 == promotion_type) type2 = promotion_type; } done: RASQAL_DEBUG4("literal 1: type %s literal 2: type %s promoting to %s\n", rasqal_literal_type_label(type1), rasqal_literal_type_label(type2), rasqal_literal_type_label(result_type)); return result_type; } /** * rasqal_literal_get_rdf_term_type: * @l: literal * * Get the RDF term type of a literal * * An RDF term can be one of three choices: * 1. URI: RASQAL_LITERAL_URI * 2. literal: RASQAL_LITERAL_STRING * 3. blank node: RASQAL_LITERAL_BLANK * * Other non RDF-term cases include: NULL pointer, invalid literal, * unknown type, a variable or other special cases (such as XML QName * or Regex pattern) which all turn into RASQAL_LITERAL_UNKNOWN * * Return value: type or RASQAL_LITERAL_UNKNOWN if cannot be an RDF term */ rasqal_literal_type rasqal_literal_get_rdf_term_type(rasqal_literal* l) { rasqal_literal_type type; if(!l) return RASQAL_LITERAL_UNKNOWN; type = l->type; /* squash literal datatypes into one type: RDF Literal */ if((type >= RASQAL_LITERAL_FIRST_XSD && type <= RASQAL_LITERAL_LAST_XSD) || type == RASQAL_LITERAL_DATE || type == RASQAL_LITERAL_INTEGER_SUBTYPE) type = RASQAL_LITERAL_STRING; if(type == RASQAL_LITERAL_UDT) type = RASQAL_LITERAL_STRING; if(type != RASQAL_LITERAL_URI && type != RASQAL_LITERAL_STRING && type != RASQAL_LITERAL_BLANK) type = RASQAL_LITERAL_UNKNOWN; return type; } /** * rasqal_literal_get_type: * @l: literal * * Get the type of a literal * * Return value: the rasqal literal type or RASQAL_LITERAL_UNKNOWN if l is NULL */ rasqal_literal_type rasqal_literal_get_type(rasqal_literal* l) { rasqal_literal_type type; if(!l) return RASQAL_LITERAL_UNKNOWN; type = l->type; return type; } /** * rasqal_literal_get_language: * @l: literal * * Get the language of a literal (if set) * * Return value: the literal language or NULL */ char* rasqal_literal_get_language(rasqal_literal* l) { if(!l) return NULL; return l->language; } /* * rasqal_new_literal_from_promotion: * @lit: existing literal * @type: type to promote to * @flags: 0 (flag #RASQAL_COMPARE_URI is unused: was RDQL) * * INTERNAL - Make a new literal from a type promotion * * New literal or NULL on failure */ static rasqal_literal* rasqal_new_literal_from_promotion(rasqal_literal* lit, rasqal_literal_type type, int flags) { rasqal_literal* new_lit = NULL; int errori = 0; double d; int i; unsigned char *new_s = NULL; unsigned char* s; size_t len = 0; rasqal_xsd_decimal* dec = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(lit, rasqal_literal, NULL); if(lit->type == type) return rasqal_new_literal_from_literal(lit); RASQAL_DEBUG3("promoting literal type %s to type %s\n", rasqal_literal_type_label(lit->type), rasqal_literal_type_label(type)); if(lit->type == RASQAL_LITERAL_DATE && type == RASQAL_LITERAL_DATETIME) { rasqal_xsd_datetime* dt; dt = rasqal_new_xsd_datetime_from_xsd_date(lit->world, lit->value.date); /* Promotion for comparison ensures a timezone is present. * * " If either operand to a comparison function on date or time * values does not have an (explicit) timezone then, for the * purpose of the operation, an implicit timezone, provided by the * dynamic context Section C.2 Dynamic Context ComponentsXP, is * assumed to be present as part of the value." * -- XQuery & XPath F&O * Section 10.4 Comparison Operators on Duration, Date and Time Values * http://www.w3.org/TR/xpath-functions/#comp.duration.datetime */ if(dt->have_tz == 'N') { dt->have_tz = 'Z'; dt->timezone_minutes = 0; } return rasqal_new_datetime_literal_from_datetime(lit->world, dt); } /* May not promote to non-numerics */ if(!rasqal_xsd_datatype_is_numeric(type)) { RASQAL_DEBUG2("NOT promoting to non-numeric type %s\n", rasqal_literal_type_label(lit->type)); if(type == RASQAL_LITERAL_STRING || type == RASQAL_LITERAL_UDT) { s = RASQAL_GOOD_CAST(unsigned char*, rasqal_literal_as_counted_string(lit, &len, 0, NULL)); new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(new_s) { raptor_uri* dt_uri = NULL; memcpy(new_s, s, len + 1); if(lit->datatype) { dt_uri = raptor_uri_copy(lit->datatype); } return rasqal_new_string_literal_node(lit->world, new_s, NULL, dt_uri); } else return NULL; } return NULL; } switch(type) { case RASQAL_LITERAL_DECIMAL: dec = rasqal_new_xsd_decimal(lit->world); if(dec) { d = rasqal_literal_as_double(lit, &errori); if(errori) { rasqal_free_xsd_decimal(dec); new_lit = NULL; } else { rasqal_xsd_decimal_set_double(dec, d); new_lit = rasqal_new_decimal_literal_from_decimal(lit->world, NULL, dec); } } break; case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(lit, &errori); if(errori) new_lit = NULL; else new_lit = rasqal_new_double_literal(lit->world, d); break; case RASQAL_LITERAL_FLOAT: d = rasqal_literal_as_double(lit, &errori); if(errori) new_lit = NULL; else if(d < FLT_MIN || d > FLT_MAX) /* Cannot be stored in a float - fail */ new_lit = NULL; else new_lit = rasqal_new_floating_literal(lit->world, RASQAL_LITERAL_FLOAT, d); break; case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: i = rasqal_literal_as_integer(lit, &errori); /* failure always means no match */ if(errori) new_lit = NULL; else new_lit = rasqal_new_integer_literal(lit->world, type, i); break; case RASQAL_LITERAL_BOOLEAN: if(flags & RASQAL_COMPARE_URI) i = rasqal_xsd_boolean_value_from_string(lit->string); else i = rasqal_literal_as_boolean(lit, &errori); /* failure always means no match */ if(errori) new_lit = NULL; else new_lit = rasqal_new_integer_literal(lit->world, type, i); break; case RASQAL_LITERAL_STRING: s = RASQAL_GOOD_CAST(unsigned char*, rasqal_literal_as_counted_string(lit, &len, 0, NULL)); new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(new_s) { memcpy(new_s, s, len + 1); new_lit = rasqal_new_string_literal(lit->world, new_s, NULL, NULL, NULL); } break; case RASQAL_LITERAL_XSD_STRING: s = RASQAL_GOOD_CAST(unsigned char*, rasqal_literal_as_counted_string(lit, &len, 0, NULL)); new_s = RASQAL_MALLOC(unsigned char*, len + 1); if(new_s) { raptor_uri* dt_uri; memcpy(new_s, s, len + 1); dt_uri = rasqal_xsd_datatype_type_to_uri(lit->world, lit->type); dt_uri = raptor_uri_copy(dt_uri); new_lit = rasqal_new_string_literal(lit->world, new_s, NULL, dt_uri, NULL); } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: errori = 1; new_lit = NULL; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 if(new_lit) RASQAL_DEBUG4("promoted literal type %s to type %s, with value '%s'\n", rasqal_literal_type_label(lit->type), rasqal_literal_type_label(new_lit->type), rasqal_literal_as_string(new_lit)); else RASQAL_DEBUG3("failed to promote literal type %s to type %s\n", rasqal_literal_type_label(lit->type), rasqal_literal_type_label(type)); #endif return new_lit; } /* * rasqal_literal_string_languages_compare * @l1: #rasqal_literal first literal * @l2: #rasqal_literal second literal * * INTERNAL - Compare two string literals languages * * Return value: non-0 if equal */ int rasqal_literal_string_languages_compare(rasqal_literal* l1, rasqal_literal* l2) { int rc = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, 0); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, 0); if(l1->language && l2->language) /* both have a language */ rc = rasqal_strcasecmp(RASQAL_GOOD_CAST(const char*, l1->language), RASQAL_GOOD_CAST(const char*, l2->language)); else if(l1->language || l2->language) /* only one has a language; the language-less one is earlier */ rc = (!l1->language ? -1 : 1); return rc; } /* * rasqal_literal_string_datatypes_compare: * @l1: first string literal * @l2: first string literal * * INTERNAL - Compare the datatypes of two string RDF literals * * Return value: <1, 0, >0 */ int rasqal_literal_string_datatypes_compare(rasqal_literal* l1, rasqal_literal* l2) { int rc = 0; if(l1->datatype && l2->datatype) { /* both have a datatype */ rc = raptor_uri_compare(l1->datatype, l2->datatype); } else if(l1->datatype || l2->datatype) /* only one has a datatype; the datatype-less one is earlier */ rc = (!l1->datatype ? -1 : 1); return rc; } /* * rasqal_literal_string_compare: * @l1: first string literal * @l2: first string literal * @flags: string compare flags (flag #RASQAL_COMPARE_NOCASE is unused; was RDQL) * * INTERNAL - Compare two string RDF literals. Bother are the same * type and either #RASQAL_LITERAL_STRING or #RASQAL_LITERAL_UDT * however their datatype URIs are the non-promoted types and may differ. * * Uses raptor_term_compare() logic for the #RAPTOR_TERM_TYPE_LITERAL * case, except adding case independent compare for RDQL. * * Return value: <1, 0, >0 */ static int rasqal_literal_string_compare(rasqal_literal* l1, rasqal_literal* l2, int flags) { int rc; if(flags & RASQAL_COMPARE_NOCASE) rc = rasqal_strcasecmp(RASQAL_GOOD_CAST(const char*, l1->string), RASQAL_GOOD_CAST(const char*, l2->string)); else rc = strcmp(RASQAL_GOOD_CAST(const char*, l1->string), RASQAL_GOOD_CAST(const char*, l2->string)); if(rc) return rc; rc = rasqal_literal_string_languages_compare(l1, l2); if(rc) return rc; return rasqal_literal_string_datatypes_compare(l1, l2); } /* * rasqal_literal_rdql_promote_calculate: * @l1: first literal * @l2: second literal * * INTERNAL - Handle RDQL type promotion rules * * Return value: type to promote to or RASQAL_LITERAL_UNKNOWN if not possible. */ static rasqal_literal_type rasqal_literal_rdql_promote_calculate(rasqal_literal* l1, rasqal_literal* l2) { int seen_string = 0; int seen_int = 0; int seen_double = 0; int seen_boolean = 0; int i; rasqal_literal *lits[2]; rasqal_literal_type type = RASQAL_LITERAL_UNKNOWN; lits[0] = l1; lits[1] = l2; for(i = 0; i < 2; i++) { switch(lits[i]->type) { case RASQAL_LITERAL_URI: case RASQAL_LITERAL_DECIMAL: break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: seen_string++; break; case RASQAL_LITERAL_BOOLEAN: seen_boolean = 1; break; case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: seen_int++; break; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: seen_double++; break; case RASQAL_LITERAL_VARIABLE: /* this case was dealt with elsewhere */ case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Unknown literal type %u", lits[i]->type); } } if(lits[0]->type != lits[1]->type) { type = seen_string ? RASQAL_LITERAL_STRING : RASQAL_LITERAL_INTEGER; if((seen_int & seen_double) || (seen_int & seen_string)) type = RASQAL_LITERAL_DOUBLE; if(seen_boolean & seen_string) type = RASQAL_LITERAL_BOOLEAN; } else type = lits[0]->type; return type; } /** * rasqal_literal_compare: * @l1: #rasqal_literal first literal * @l2: #rasqal_literal second literal * @flags: comparison flags * @error_p: pointer to error * * Compare two literals with type promotion. * * The two literals are compared across their range. If the types * are not the same, they are promoted. If one is a double or float, the * other is promoted to double, otherwise for integers, otherwise * to strings (all literals have a string value). * * The comparison returned is as for strcmp, first before second * returns <0. equal returns 0, and first after second returns >0. * For URIs, the string value is used for the comparsion. * * flag bits affects comparisons: * RASQAL_COMPARE_NOCASE: use case independent string comparisons * RASQAL_COMPARE_XQUERY: use XQuery comparison and type promotion rules * RASQAL_COMPARE_RDF: use RDF term comparison * RASQAL_COMPARE_URI: allow comparison of URIs (typically for SPARQL ORDER) * * If @error is not NULL, *error is set to non-0 on error * * Return value: <0, 0, or >0 as described above. **/ int rasqal_literal_compare(rasqal_literal* l1, rasqal_literal* l2, int flags, int *error_p) { rasqal_literal *lits[2]; rasqal_literal* new_lits[2]; /* after promotions */ rasqal_literal_type type; /* target promotion type */ int i; int result = 0; double d = 0; int promotion = 0; if(error_p) *error_p = 0; if(!l1 || !l2) { if(error_p) *error_p = 1; return 0; } lits[0] = rasqal_literal_value(l1); lits[1] = rasqal_literal_value(l2); /* null literals */ if(!lits[0] || !lits[1]) { /* if either is not NULL, the comparison fails */ if(lits[0] || lits[1]) { if(error_p) *error_p = 1; } return 0; } new_lits[0] = NULL; new_lits[1] = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("literal 0 type %s. literal 1 type %s\n", rasqal_literal_type_label(lits[0]->type), rasqal_literal_type_label(lits[1]->type)); #endif if(flags & RASQAL_COMPARE_RDF) { /* no promotion but compare as RDF terms; like rasqal_literal_as_node() */ rasqal_literal_type type0 = rasqal_literal_get_rdf_term_type(lits[0]); rasqal_literal_type type1 = rasqal_literal_get_rdf_term_type(lits[1]); int type_diff; if(type0 == RASQAL_LITERAL_UNKNOWN || type1 == RASQAL_LITERAL_UNKNOWN) return 1; type_diff = RASQAL_GOOD_CAST(int, type0) - RASQAL_GOOD_CAST(int, type1); if(type_diff != 0) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("RDF term literal returning type difference %d\n", type_diff); #endif return type_diff; } type = type1; } else if(flags & RASQAL_COMPARE_XQUERY) { /* SPARQL / XQuery promotion rules */ rasqal_literal_type type0 = lits[0]->type; rasqal_literal_type type1 = lits[1]->type; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("xquery literal compare types %s vs %s\n", rasqal_literal_type_label(type0), rasqal_literal_type_label(type1)); #endif /* cannot compare UDTs */ if(type0 == RASQAL_LITERAL_UDT || type1 == RASQAL_LITERAL_UDT) { if(error_p) *error_p = 1; return 0; } type = rasqal_literal_promote_numerics(lits[0], lits[1], flags); if(type == RASQAL_LITERAL_UNKNOWN) { int type_diff; /* no promotion but compare as RDF terms; like rasqal_literal_as_node() */ type0 = rasqal_literal_get_rdf_term_type(lits[0]); type1 = rasqal_literal_get_rdf_term_type(lits[1]); if(type0 == RASQAL_LITERAL_UNKNOWN || type1 == RASQAL_LITERAL_UNKNOWN) return 1; type_diff = RASQAL_GOOD_CAST(int, type0) - RASQAL_GOOD_CAST(int, type1); if(type_diff != 0) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("RDF term literal returning type difference %d\n", type_diff); #endif return type_diff; } if(error_p) *error_p = 1; return 0; } promotion = 1; } else { /* RDQL promotion rules */ type = rasqal_literal_rdql_promote_calculate(lits[0], lits[1]); promotion = 1; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 if(promotion) RASQAL_DEBUG2("promoting to type %s\n", rasqal_literal_type_label(type)); #endif /* do promotions */ for(i = 0; i < 2; i++) { if(promotion) { new_lits[i] = rasqal_new_literal_from_promotion(lits[i], type, flags); if(!new_lits[i]) { if(error_p) *error_p = 1; goto done; } } else { new_lits[i] = lits[i]; } } switch(type) { case RASQAL_LITERAL_URI: if(flags & RASQAL_COMPARE_URI) result = raptor_uri_compare(new_lits[0]->value.uri, new_lits[1]->value.uri); else { if(error_p) *error_p = 1; result = 0; goto done; } break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_UDT: result = rasqal_literal_string_compare(new_lits[0], new_lits[1], flags); break; case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_XSD_STRING: if(flags & RASQAL_COMPARE_NOCASE) result = rasqal_strcasecmp(RASQAL_GOOD_CAST(const char*, new_lits[0]->string), RASQAL_GOOD_CAST(const char*, new_lits[1]->string)); else result = strcmp(RASQAL_GOOD_CAST(const char*, new_lits[0]->string), RASQAL_GOOD_CAST(const char*, new_lits[1]->string)); break; case RASQAL_LITERAL_DATE: result = rasqal_xsd_date_compare(new_lits[0]->value.date, new_lits[1]->value.date, error_p); break; case RASQAL_LITERAL_DATETIME: result = rasqal_xsd_datetime_compare2(new_lits[0]->value.datetime, new_lits[1]->value.datetime, error_p); break; case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER_SUBTYPE: result = new_lits[0]->value.integer - new_lits[1]->value.integer; break; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: d = new_lits[0]->value.floating - new_lits[1]->value.floating; result = (d > 0.0) ? 1: (d < 0.0) ? -1 : 0; break; case RASQAL_LITERAL_DECIMAL: result = rasqal_xsd_decimal_compare(new_lits[0]->value.decimal, new_lits[1]->value.decimal); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_VARIABLE: default: RASQAL_FATAL2("Literal type %u cannot be compared", type); result = 0; /* keep some compilers happy */ } done: if(promotion) { for(i = 0; i < 2; i++) { if(new_lits[i]) rasqal_free_literal(new_lits[i]); } } return result; } /* * rasqal_literal_is_string: * @l1: #rasqal_literal first literal * * INTERNAL - check literal is a string literal * * Return value: non-0 if literal is a string */ int rasqal_literal_is_string(rasqal_literal* l1) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, 1); return (l1->type == RASQAL_LITERAL_STRING || l1->type == RASQAL_LITERAL_XSD_STRING); } /* * rasqal_literal_string_equals_flags: * @l1: #rasqal_literal first literal * @l2: #rasqal_literal second literal * @flags: comparison flags * @error_p: pointer to error * * INTERNAL - Compare two typed literals * * flag bits affects equality: * RASQAL_COMPARE_XQUERY: use value equality * RASQAL_COMPARE_RDF: use RDF term equality * * Return value: non-0 if equal */ static int rasqal_literal_string_equals_flags(rasqal_literal* l1, rasqal_literal* l2, int flags, int* error_p) { int result = 1; raptor_uri* dt1; int free_dt1 = 0; raptor_uri* dt2; int free_dt2 = 0; raptor_uri* xsd_string_uri; if(error_p) *error_p = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, 0); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, 0); dt1 = l1->datatype; dt2 = l2->datatype; xsd_string_uri = rasqal_xsd_datatype_type_to_uri(l1->world, RASQAL_LITERAL_XSD_STRING); if(rasqal_literal_string_languages_compare(l1, l2)) return 0; /* For a value comparison (or RDQL), promote plain literal to typed * literal "xx"^^xsd:string if the other literal is typed */ if(flags & RASQAL_COMPARE_XQUERY || flags & RASQAL_COMPARE_URI) { if(l1->type == RASQAL_LITERAL_STRING && l2->type == RASQAL_LITERAL_XSD_STRING) { dt1 = raptor_uri_copy(xsd_string_uri); free_dt1 = 1; } else if(l1->type == RASQAL_LITERAL_XSD_STRING && l2->type == RASQAL_LITERAL_STRING) { dt2 = raptor_uri_copy(xsd_string_uri); free_dt2 = 1; } } if(dt1 || dt2) { /* if either is NULL - type error */ if(!dt1 || !dt2) { if(error_p) *error_p = 1; result = 0; goto done; } /* if different - type error */ if(!raptor_uri_equals(dt1, dt2)) { if(error_p) *error_p = 1; result = 0; goto done; } /* at this point the datatypes (URIs) are the same */ } /* Finally check the lexical forms */ /* not-equal if lengths are different - cheaper to try this first */ if(l1->string_len != l2->string_len) { result = 0; goto done; } result = !strcmp(RASQAL_GOOD_CAST(const char*, l1->string), RASQAL_GOOD_CAST(const char*, l2->string)); /* If result is equality but literals were both typed literals with * user-defined types then cause a type error; equality is unknown. */ if(!result && (l1->type == RASQAL_LITERAL_UDT && l2->type == RASQAL_LITERAL_UDT)) { if(error_p) *error_p = 1; } done: if(dt1 && free_dt1) raptor_free_uri(dt1); if(dt2 && free_dt2) raptor_free_uri(dt2); return result; } static int rasqal_literal_uri_equals(rasqal_literal* l1, rasqal_literal* l2) { return raptor_uri_equals(l1->value.uri, l2->value.uri); } static int rasqal_literal_blank_equals(rasqal_literal* l1, rasqal_literal* l2) { /* not-equal if lengths are different - cheap to compare this first */ if(l1->string_len != l2->string_len) return 0; return !strcmp(RASQAL_GOOD_CAST(const char*, l1->string), RASQAL_GOOD_CAST(const char*, l2->string)); } /** * rasqal_literal_not_equals_flags: * @l1: #rasqal_literal literal * @l2: #rasqal_literal data literal * * Check if two literals are not equal with optional type promotion. * * Return value: non-0 if not-equal **/ int rasqal_literal_not_equals_flags(rasqal_literal* l1, rasqal_literal* l2, int flags, int* error_p) { /* rasqal_literal_equals_flags() checks for NULLs */ return !rasqal_literal_equals_flags(l1, l2, flags, error_p); } /** * rasqal_literal_equals: * @l1: #rasqal_literal literal * @l2: #rasqal_literal data literal * * Compare two literals with no type promotion. * * If the l2 data literal value is a boolean, it will match * the string "true" or "false" in the first literal l1. * * Return value: non-0 if equal **/ int rasqal_literal_equals(rasqal_literal* l1, rasqal_literal* l2) { /* rasqal_literal_equals_flags() checks for NULLs */ return rasqal_literal_equals_flags(l1, l2, 0, NULL); } /* * rasqal_literal_equals_flags: * @l1: #rasqal_literal literal * @l2: #rasqal_literal data literal * @flags: comparison flags * @error_p: type error * * INTERNAL - Compare two literals with optional type promotion. * * flag bits affects equality: * RASQAL_COMPARE_XQUERY: use XQuery comparison and type promotion rules * RASQAL_COMPARE_RDF: use RDF term equality * * Return value: non-0 if equal **/ int rasqal_literal_equals_flags(rasqal_literal* l1, rasqal_literal* l2, int flags, int* error_p) { rasqal_literal_type type; rasqal_literal* l1_p = NULL; rasqal_literal* l2_p = NULL; int result = 0; int promotion = 0; /* NULL literals */ if(!l1 || !l2) { /* if either is not null, the comparison fails */ return !(l1 || l2); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1(" "); rasqal_literal_print(l1, stderr); fputs( " to ", stderr); rasqal_literal_print(l2, stderr); fprintf(stderr, " with flags %d\n", flags); #endif if(flags & RASQAL_COMPARE_RDF) { /* no promotion but compare as RDF terms; like rasqal_literal_as_node() */ rasqal_literal_type type1 = rasqal_literal_get_rdf_term_type(l1); rasqal_literal_type type2 = rasqal_literal_get_rdf_term_type(l2); if(type1 == RASQAL_LITERAL_UNKNOWN || type2 == RASQAL_LITERAL_UNKNOWN || type1 != type2) goto tidy; type = type1; } else if(flags & RASQAL_COMPARE_XQUERY) { /* SPARQL / XSD promotion rules */ /* Ensure the values are native */ rasqal_literal_string_to_native(l1, 0); rasqal_literal_string_to_native(l2, 0); if((l1->type == RASQAL_LITERAL_DATE && l2->type == RASQAL_LITERAL_DATETIME) || (l1->type == RASQAL_LITERAL_DATETIME && l2->type == RASQAL_LITERAL_DATE)) { type = RASQAL_LITERAL_DATETIME; promotion = 1; } else if(l1->type != l2->type) { type = rasqal_literal_promote_numerics(l1, l2, flags); if(type == RASQAL_LITERAL_UNKNOWN) { /* Cannot numeric promote - try RDF equality */ rasqal_literal_type type1 = rasqal_literal_get_rdf_term_type(l1); rasqal_literal_type type2 = rasqal_literal_get_rdf_term_type(l2); if(type1 == RASQAL_LITERAL_UNKNOWN || type2 == RASQAL_LITERAL_UNKNOWN || type1 != type2) goto tidy; type = type1; } else promotion = 1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG4("xquery promoted literals types (%s, %s) to type %s\n", rasqal_literal_type_label(l1->type), rasqal_literal_type_label(l2->type), rasqal_literal_type_label(type)); #endif } else type = l1->type; } else { /* RDQL rules: compare as values with no promotion */ if(l1->type != l2->type) { /* booleans can be compared to strings */ if(l2->type == RASQAL_LITERAL_BOOLEAN && l1->type == RASQAL_LITERAL_STRING) result = !strcmp(RASQAL_GOOD_CAST(const char*, l1->string), RASQAL_GOOD_CAST(const char*, l2->string)); goto tidy; } type = l1->type; } if(promotion) { l1_p = rasqal_new_literal_from_promotion(l1, type, flags); if(l1_p) l2_p = rasqal_new_literal_from_promotion(l2, type, flags); if(!l1_p || !l2_p) { result = 1; goto tidy; } } else { l1_p = l1; l2_p = l2; } switch(type) { case RASQAL_LITERAL_URI: result = rasqal_literal_uri_equals(l1_p, l2_p); break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_UDT: result = rasqal_literal_string_equals_flags(l1_p, l2_p, flags, error_p); break; case RASQAL_LITERAL_BLANK: result = rasqal_literal_blank_equals(l1_p, l2_p); break; case RASQAL_LITERAL_DATE: result = rasqal_xsd_date_equals(l1_p->value.date, l2_p->value.date, error_p); break; case RASQAL_LITERAL_DATETIME: result = rasqal_xsd_datetime_equals2(l1_p->value.datetime, l2_p->value.datetime, error_p); break; case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER_SUBTYPE: result = l1_p->value.integer == l2_p->value.integer; break; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: result = rasqal_double_approximately_equal(l1_p->value.floating, l2_p->value.floating); break; case RASQAL_LITERAL_DECIMAL: result = rasqal_xsd_decimal_equals(l1_p->value.decimal, l2_p->value.decimal); break; case RASQAL_LITERAL_VARIABLE: /* both are variables */ result = rasqal_literal_equals(l1_p->value.variable->value, l2_p->value.variable->value); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: default: if(error_p) *error_p = 1; result = 0; /* keep some compilers happy */ } tidy: if(promotion) { if(l1_p) rasqal_free_literal(l1_p); if(l2_p) rasqal_free_literal(l2_p); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("equals result %d\n", result); #endif return result; } /* * rasqal_literal_expand_qname: * @user_data: #rasqal_query cast as void for use with raptor_sequence_foreach * @l: #rasqal_literal literal * * INTERNAL - Expand any qname in a literal into a URI * * Expands any QName inside the literal using prefixes that are * declared in the query that may not have been present when the * literal was first declared. Intended to be used standalone * as well as with raptor_sequence_foreach which takes a function * signature that this function matches. * * Return value: non-0 on failure **/ int rasqal_literal_expand_qname(void *user_data, rasqal_literal *l) { rasqal_query *rq = (rasqal_query *)user_data; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 1); if(l->type == RASQAL_LITERAL_QNAME) { raptor_uri *uri; /* expand a literal qname */ uri = raptor_qname_string_to_uri(rq->namespaces, l->string, l->string_len); if(!uri) return 1; RASQAL_FREE(char*, l->string); l->string = NULL; l->type = RASQAL_LITERAL_URI; l->value.uri = uri; } else if (l->type == RASQAL_LITERAL_STRING) { raptor_uri *uri; if(l->flags) { /* expand a literal string datatype qname */ uri = raptor_qname_string_to_uri(rq->namespaces, l->flags, strlen(RASQAL_GOOD_CAST(const char*, l->flags))); if(!uri) return 1; l->datatype = uri; RASQAL_FREE(char*, l->flags); l->flags = NULL; if(l->language && uri) { RASQAL_FREE(char*, l->language); l->language = NULL; } if(rasqal_literal_string_to_native(l, 0)) { rasqal_free_literal(l); return 1; } } } return 0; } /* * rasqal_literal_has_qname * @l: #rasqal_literal literal * * INTERNAL - Check if literal has a qname part * * Checks if any part ofthe literal has an unexpanded QName. * * Return value: non-0 if a QName is present **/ int rasqal_literal_has_qname(rasqal_literal *l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 0); return (l->type == RASQAL_LITERAL_QNAME) || (l->type == RASQAL_LITERAL_STRING && (l->flags)); } /** * rasqal_literal_as_node: * @l: #rasqal_literal object * * Turn a literal into a new RDF string, URI or blank literal. * * Return value: the new #rasqal_literal or NULL on failure or if the literal was an unbound variable. **/ rasqal_literal* rasqal_literal_as_node(rasqal_literal* l) { raptor_uri* dt_uri; rasqal_literal* new_l = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); reswitch: switch(l->type) { case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_BLANK: new_l = rasqal_new_literal_from_literal(l); break; case RASQAL_LITERAL_VARIABLE: l = l->value.variable->value; if(!l) return NULL; goto reswitch; case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: new_l = RASQAL_CALLOC(rasqal_literal*, 1, sizeof(*new_l)); if(new_l) { new_l->valid = 1; new_l->usage = 1; new_l->world = l->world; new_l->type = RASQAL_LITERAL_STRING; new_l->string_len = l->string_len; new_l->string = RASQAL_MALLOC(unsigned char*, l->string_len + 1); if(!new_l->string) { rasqal_free_literal(new_l); return NULL; } memcpy((void*)new_l->string, l->string, l->string_len + 1); if(l->type <= RASQAL_LITERAL_LAST_XSD) { dt_uri = rasqal_xsd_datatype_type_to_uri(l->world, l->type); if(!dt_uri) { rasqal_free_literal(new_l); return NULL; } } else { /* from the case: above this is UDT and INTEGER_SUBTYPE */ dt_uri = l->datatype; } new_l->datatype = raptor_uri_copy(dt_uri); new_l->flags = NULL; } break; case RASQAL_LITERAL_QNAME: /* QNames should be gone by the time expression eval happens */ case RASQAL_LITERAL_PATTERN: /* FALLTHROUGH */ case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Literal type %u has no node value", l->type); } return new_l; } /* * rasqal_literal_ebv: * @l: #rasqal_literal literal * * INTERNAL - Get the rasqal_literal effective boolean value * * Return value: non-0 if EBV is true, else false **/ int rasqal_literal_ebv(rasqal_literal* l) { rasqal_variable* v; /* Result is true unless... */ int b = 1; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 0); v = rasqal_literal_as_variable(l); if(v) { if(v->value == NULL) { /* ... The operand is unbound */ b = 0; goto done; } l = v->value; } if(l->type == RASQAL_LITERAL_BOOLEAN && !l->value.integer) { /* ... The operand is an xs:boolean with a FALSE value. */ b = 0; } else if(l->type == RASQAL_LITERAL_STRING && !l->datatype && !l->string_len) { /* ... The operand is a 0-length untyped RDF literal or xs:string. */ b = 0; } else if(((l->type == RASQAL_LITERAL_INTEGER || l->type == RASQAL_LITERAL_INTEGER_SUBTYPE) && !l->value.integer) || ((l->type == RASQAL_LITERAL_DOUBLE || l->type == RASQAL_LITERAL_FLOAT) && !RASQAL_FLOATING_AS_INT(l->value.floating)) ) { /* ... The operand is any numeric type with a value of 0. */ b = 0; } else if(l->type == RASQAL_LITERAL_DECIMAL && rasqal_xsd_decimal_is_zero(l->value.decimal)) { /* ... The operand is any numeric type with a value of 0 (decimal) */ b = 0; } else if((l->type == RASQAL_LITERAL_DOUBLE || l->type == RASQAL_LITERAL_FLOAT) && isnan(l->value.floating) ) { /* ... The operand is an xs:double or xs:float with a value of NaN */ b = 0; } done: return b; } /* * rasqal_literal_is_constant: * @l: #rasqal_literal literal * * INTERNAL - Check if a literal is a constant * * Return value: non-0 if literal is a constant **/ int rasqal_literal_is_constant(rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 0); switch(l->type) { case RASQAL_LITERAL_URI: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: return 1; case RASQAL_LITERAL_VARIABLE: return 0; case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Literal type %u cannot be checked for constant", l->type); return 0; /* keep some compilers happy */ } } /** * rasqal_literal_datatype: * @l: #rasqal_literal object * * Get the datatype URI of a literal * * Return value: shared pointer to #raptor_uri of datatype or NULL on failure or no value */ raptor_uri* rasqal_literal_datatype(rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); if(l->type != RASQAL_LITERAL_VARIABLE) return l->datatype; return rasqal_literal_datatype(l->value.variable->value); } rasqal_literal* rasqal_literal_cast(rasqal_literal* l, raptor_uri* to_datatype, int flags, int* error_p) { #ifdef RASQAL_DEBUG raptor_uri* from_datatype = NULL; #endif const unsigned char *string = NULL; unsigned char *new_string; rasqal_literal* result = NULL; rasqal_literal_type from_native_type; rasqal_literal_type to_native_type; size_t len; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); l = rasqal_literal_value(l); if(!l) return NULL; #ifdef RASQAL_DEBUG from_datatype = l->datatype; #endif from_native_type = l->type; to_native_type = rasqal_xsd_datatype_uri_to_type(l->world, to_datatype); if(from_native_type == to_native_type) { /* cast to same type is always allowed */ return rasqal_new_literal_from_literal(l); } else { int failed = 0; /* switch on FROM type to check YES/NO conversions and get the string */ switch(from_native_type) { /* string */ case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_UDT: string = l->string; len = l->string_len; break; /* XSD datatypes: RASQAL_LITERAL_FIRST_XSD to RASQAL_LITERAL_LAST_XSD */ case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_INTEGER_SUBTYPE: /* XSD (boolean, integer, decimal, double, float) may NOT be * cast to dateTime or date */ if(to_native_type == RASQAL_LITERAL_DATE || to_native_type == RASQAL_LITERAL_DATETIME) { failed = 1; if(error_p) *error_p = 1; break; } string = l->string; len = l->string_len; break; case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: string = l->string; len = l->string_len; break; /* SPARQL casts - FIXME */ case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: string = l->string; len = l->string_len; break; case RASQAL_LITERAL_URI: /* URI (IRI) May ONLY be cast to an xsd:string */ if(to_native_type != RASQAL_LITERAL_XSD_STRING) { failed = 1; if(error_p) *error_p = 1; break; } string = raptor_uri_as_counted_string(l->value.uri, &len); if(!string) { failed = 1; if(error_p) *error_p = 1; } break; case RASQAL_LITERAL_VARIABLE: /* fallthrough since rasqal_literal_value() handled this above */ case RASQAL_LITERAL_UNKNOWN: default: RASQAL_FATAL2("Literal type %u cannot be cast", l->type); failed = 1; return NULL; /* keep some compilers happy */ } if(to_native_type == RASQAL_LITERAL_DATE || to_native_type == RASQAL_LITERAL_DATETIME) { /* XSD date and dateTime may ONLY be cast from string (cast * from dateTime is checked above) */ if(from_native_type != RASQAL_LITERAL_STRING) { failed = 1; if(error_p) *error_p = 1; } } if(failed) return NULL; } /* switch on the TO type to check MAYBE conversions */ RASQAL_DEBUG4("CAST from \"%s\" type %s to type %s\n", string, from_datatype ? RASQAL_GOOD_CAST(const char*, raptor_uri_as_string(from_datatype)) : "(NONE)", raptor_uri_as_string(to_datatype)); if(!rasqal_xsd_datatype_check(to_native_type, string, flags)) { if(error_p) *error_p = 1; RASQAL_DEBUG3("Illegal cast to type %s string '%s'", rasqal_xsd_datatype_label(to_native_type), string); return NULL; } new_string = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_string) { if(error_p) *error_p = 1; return NULL; } memcpy(new_string, string, len + 1); to_datatype = raptor_uri_copy(to_datatype); result = rasqal_new_string_literal(l->world, new_string, NULL, to_datatype, NULL); if(!result) { if(error_p) *error_p = 1; } return result; } /** * rasqal_literal_value: * @l: #rasqal_literal object * * Get the literal value looking up any variables needed * * Return value: literal value or NULL if has no value */ rasqal_literal* rasqal_literal_value(rasqal_literal* l) { if(!l) return NULL; while(l && l->type == RASQAL_LITERAL_VARIABLE) { l = l->value.variable->value; } return l; } int rasqal_literal_is_numeric(rasqal_literal* literal) { rasqal_literal_type parent_type; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(literal, rasqal_literal, 0); parent_type = rasqal_xsd_datatype_parent_type(literal->type); return (rasqal_xsd_datatype_is_numeric(literal->type) || rasqal_xsd_datatype_is_numeric(parent_type)); } rasqal_literal* rasqal_literal_add(rasqal_literal* l1, rasqal_literal* l2, int *error_p) { int i; double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal_type type; rasqal_literal* l1_p = NULL; rasqal_literal* l2_p = NULL; int flags = 0; rasqal_literal* result = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, NULL); type = rasqal_literal_promote_numerics(l1, l2, flags); switch(type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: i = rasqal_literal_as_integer(l1, &error); if(error) break; i = i + rasqal_literal_as_integer(l2, &error); if(error) break; result = rasqal_new_integer_literal(l1->world, RASQAL_LITERAL_INTEGER, i); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l1, &error); if(error) break; d = d + rasqal_literal_as_double(l2, &error); if(error) break; result = rasqal_new_numeric_literal(l1->world, type, d); break; case RASQAL_LITERAL_DECIMAL: l1_p = rasqal_new_literal_from_promotion(l1, type, flags); if(l1_p) l2_p = rasqal_new_literal_from_promotion(l2, type, flags); if(l1_p && l2_p) { dec = rasqal_new_xsd_decimal(l1->world); if(rasqal_xsd_decimal_add(dec, l1_p->value.decimal, l2_p->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l1->world, NULL, dec); } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } if(l1_p) rasqal_free_literal(l1_p); if(l2_p) rasqal_free_literal(l2_p); return result; } rasqal_literal* rasqal_literal_subtract(rasqal_literal* l1, rasqal_literal* l2, int *error_p) { int i; double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal_type type; rasqal_literal* l1_p = NULL; rasqal_literal* l2_p = NULL; int flags = 0; rasqal_literal* result = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, NULL); type = rasqal_literal_promote_numerics(l1, l2, flags); switch(type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: i = rasqal_literal_as_integer(l1, &error); if(error) break; i = i - rasqal_literal_as_integer(l2, &error); if(error) break; result = rasqal_new_integer_literal(l1->world, RASQAL_LITERAL_INTEGER, i); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l1, &error); if(error) break; d = d - rasqal_literal_as_double(l2, &error); if(error) break; result = rasqal_new_numeric_literal(l1->world, type, d); break; case RASQAL_LITERAL_DECIMAL: l1_p = rasqal_new_literal_from_promotion(l1, type, flags); if(l1_p) l2_p = rasqal_new_literal_from_promotion(l2, type, flags); if(l1_p && l2_p) { dec = rasqal_new_xsd_decimal(l1->world); if(rasqal_xsd_decimal_subtract(dec, l1_p->value.decimal, l2_p->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l1->world, NULL, dec); } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } if(l1_p) rasqal_free_literal(l1_p); if(l2_p) rasqal_free_literal(l2_p); return result; } rasqal_literal* rasqal_literal_multiply(rasqal_literal* l1, rasqal_literal* l2, int *error_p) { int i; double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal_type type; rasqal_literal* l1_p = NULL; rasqal_literal* l2_p = NULL; int flags = 0; rasqal_literal* result = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, NULL); type = rasqal_literal_promote_numerics(l1, l2, flags); switch(type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: i = rasqal_literal_as_integer(l1, &error); if(error) break; i = i * rasqal_literal_as_integer(l2, &error); if(error) break; result = rasqal_new_integer_literal(l1->world, RASQAL_LITERAL_INTEGER, i); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l1, &error); if(error) break; d = d * rasqal_literal_as_double(l2, &error); if(error) break; result = rasqal_new_numeric_literal(l1->world, type, d); break; case RASQAL_LITERAL_DECIMAL: l1_p = rasqal_new_literal_from_promotion(l1, type, flags); if(l1_p) l2_p = rasqal_new_literal_from_promotion(l2, type, flags); if(l1_p && l2_p) { dec = rasqal_new_xsd_decimal(l1->world); if(rasqal_xsd_decimal_multiply(dec, l1_p->value.decimal, l2_p->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l1->world, NULL, dec); } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } if(l1_p) rasqal_free_literal(l1_p); if(l2_p) rasqal_free_literal(l2_p); return result; } rasqal_literal* rasqal_literal_divide(rasqal_literal* l1, rasqal_literal* l2, int *error_p) { double d1, d2; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal_type type; rasqal_literal* l1_p = NULL; rasqal_literal* l2_p = NULL; int flags = 0; rasqal_literal* result = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, NULL); type = rasqal_literal_promote_numerics(l1, l2, flags); switch(type) { case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d2 = rasqal_literal_as_double(l2, &error); if(!RASQAL_FLOATING_AS_INT(d2)) /* division by zero error */ error = 1; if(error) break; d1 = rasqal_literal_as_double(l1, &error); if(error) break; d1 = d1 / d2; result = rasqal_new_numeric_literal(l1->world, type, d1); break; case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: /* "As a special case, if the types of both $arg1 and $arg2 are * xs:integer, then the return type is xs:decimal." - F&O */ type = RASQAL_LITERAL_DECIMAL; /* fallthrough */ case RASQAL_LITERAL_DECIMAL: l1_p = rasqal_new_literal_from_promotion(l1, type, flags); if(l1_p) l2_p = rasqal_new_literal_from_promotion(l2, type, flags); if(l1_p && l2_p) { dec = rasqal_new_xsd_decimal(l1->world); if(rasqal_xsd_decimal_divide(dec, l1_p->value.decimal, l2_p->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l1->world, NULL, dec); } break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } if(l1_p) rasqal_free_literal(l1_p); if(l2_p) rasqal_free_literal(l2_p); return result; } rasqal_literal* rasqal_literal_negate(rasqal_literal* l, int *error_p) { int i; double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal* result = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: i = rasqal_literal_as_integer(l, &error); if(error) break; i = -i; result = rasqal_new_integer_literal(l->world, RASQAL_LITERAL_INTEGER, i); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l, &error); if(!RASQAL_FLOATING_AS_INT(d)) error = 1; d = -d; result = rasqal_new_numeric_literal(l->world, l->type, d); break; case RASQAL_LITERAL_DECIMAL: dec = rasqal_new_xsd_decimal(l->world); if(rasqal_xsd_decimal_negate(dec, l->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l->world, NULL, dec); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } return result; } rasqal_literal* rasqal_literal_abs(rasqal_literal* l, int *error_p) { int i; double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal* result = NULL; if(!rasqal_literal_is_numeric(l)) return NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: i = rasqal_literal_as_integer(l, &error); if(error) break; i = abs(i); result = rasqal_new_integer_literal(l->world, RASQAL_LITERAL_INTEGER, i); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l, &error); if(!RASQAL_FLOATING_AS_INT(d)) error = 1; d = fabs(d); result = rasqal_new_numeric_literal(l->world, l->type, d); break; case RASQAL_LITERAL_DECIMAL: dec = rasqal_new_xsd_decimal(l->world); if(rasqal_xsd_decimal_abs(dec, l->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l->world, NULL, dec); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } return result; } rasqal_literal* rasqal_literal_round(rasqal_literal* l, int *error_p) { double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal* result = NULL; if(!rasqal_literal_is_numeric(l)) return NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: /* Result is same as input for integral types */ result = rasqal_new_literal_from_literal(l); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l, &error); if(!RASQAL_FLOATING_AS_INT(d)) error = 1; d = round(d); result = rasqal_new_numeric_literal(l->world, l->type, d); break; case RASQAL_LITERAL_DECIMAL: dec = rasqal_new_xsd_decimal(l->world); if(rasqal_xsd_decimal_round(dec, l->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l->world, NULL, dec); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } return result; } rasqal_literal* rasqal_literal_ceil(rasqal_literal* l, int *error_p) { double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal* result = NULL; if(!rasqal_literal_is_numeric(l)) return NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: /* Result is same as input for integral types */ result = rasqal_new_literal_from_literal(l); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l, &error); if(!RASQAL_FLOATING_AS_INT(d)) error = 1; d = ceil(d); result = rasqal_new_numeric_literal(l->world, l->type, d); break; case RASQAL_LITERAL_DECIMAL: dec = rasqal_new_xsd_decimal(l->world); if(rasqal_xsd_decimal_ceil(dec, l->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l->world, NULL, dec); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } return result; } rasqal_literal* rasqal_literal_floor(rasqal_literal* l, int *error_p) { double d; rasqal_xsd_decimal* dec; int error = 0; rasqal_literal* result = NULL; if(!rasqal_literal_is_numeric(l)) return NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, NULL); switch(l->type) { case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_INTEGER_SUBTYPE: /* Result is same as input for integral types */ result = rasqal_new_literal_from_literal(l); break; case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DOUBLE: d = rasqal_literal_as_double(l, &error); if(!RASQAL_FLOATING_AS_INT(d)) error = 1; d = floor(d); result = rasqal_new_numeric_literal(l->world, l->type, d); break; case RASQAL_LITERAL_DECIMAL: dec = rasqal_new_xsd_decimal(l->world); if(rasqal_xsd_decimal_floor(dec, l->value.decimal)) { error = 1; rasqal_free_xsd_decimal(dec); } else result = rasqal_new_decimal_literal_from_decimal(l->world, NULL, dec); break; case RASQAL_LITERAL_UNKNOWN: case RASQAL_LITERAL_BLANK: case RASQAL_LITERAL_URI: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_UDT: default: error = 1; break; } if(error) { if(error_p) *error_p = 1; } return result; } /** * rasqal_literal_same_term: * @l1: #rasqal_literal literal * @l2: #rasqal_literal data literal * * Check if literals are same term (URI, literal, blank) * * Return value: non-0 if same **/ int rasqal_literal_same_term(rasqal_literal* l1, rasqal_literal* l2) { rasqal_literal_type type1; rasqal_literal_type type2; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l1, rasqal_literal, 0); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l2, rasqal_literal, 0); type1 = rasqal_literal_get_rdf_term_type(l1); type2 = rasqal_literal_get_rdf_term_type(l2); if(type1 != type2) return 0; if(type1 == RASQAL_LITERAL_UNKNOWN) return 0; if(type1 == RASQAL_LITERAL_URI) return rasqal_literal_uri_equals(l1, l2); if(type1 == RASQAL_LITERAL_STRING) /* value compare */ return rasqal_literal_string_equals_flags(l1, l2, RASQAL_COMPARE_XQUERY, NULL); if(type1 == RASQAL_LITERAL_BLANK) return rasqal_literal_blank_equals(l1, l2); return 0; } /** * rasqal_literal_is_rdf_literal: * @l: #rasqal_literal literal * * Check if a literal is any RDF term literal - plain or typed literal * * Return value: non-0 if the value is an RDF term literal **/ int rasqal_literal_is_rdf_literal(rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(l, rasqal_literal, 0); return (rasqal_literal_get_rdf_term_type(l) == RASQAL_LITERAL_STRING); } /** * rasqal_literal_sequence_compare: * @compare_flags: comparison flags for rasqal_literal_compare() * @values_a: first sequence of literals * @values_b: second sequence of literals * * INTERNAL - compare two sequences of literals * * Return value: <0, 0 or >1 comparison */ int rasqal_literal_sequence_compare(int compare_flags, raptor_sequence* values_a, raptor_sequence* values_b) { int result = 0; int i; int size_a = 0; int size_b = 0; /* Turn 0-length sequences into NULL */ if(values_a) { size_a = raptor_sequence_size(values_a); if(!size_a) values_a = NULL; } if(values_b) { size_b = raptor_sequence_size(values_b); if(!size_b) values_b = NULL; } /* Handle empty sequences: equal if both empty, otherwise empty is earlier */ if(!size_a && !size_b) return 0; else if(!size_a) return -1; else if(!size_b) return 1; /* Now know they are not 0 length */ /* Walk maximum length of the values */ if(size_b > size_a) size_a = size_b; for(i = 0; i < size_a; i++) { rasqal_literal* literal_a = (rasqal_literal*)raptor_sequence_get_at(values_a, i); rasqal_literal* literal_b = (rasqal_literal*)raptor_sequence_get_at(values_b, i); int error = 0; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Comparing "); rasqal_literal_print(literal_a, DEBUG_FH); fputs(" to ", DEBUG_FH); rasqal_literal_print(literal_b, DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(!literal_a || !literal_b) { if(!literal_a && !literal_b) { result = 0; } else { result = literal_a ? 1 : -1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Got one NULL literal comparison, returning %d\n", result); #endif } break; } result = rasqal_literal_compare(literal_a, literal_b, compare_flags, &error); if(error) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Got literal comparison error at literal %d, returning 0\n", i); #endif result = 0; break; } if(!result) continue; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Returning comparison result %d at literal %d\n", result, i); #endif break; } return result; } int rasqal_literal_write_turtle(rasqal_literal* l, raptor_iostream* iostr) { const unsigned char* str; size_t len; int rc = 0; if(!l) return rc; switch(l->type) { case RASQAL_LITERAL_URI: str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->value.uri, &len)); raptor_iostream_write_byte('<', iostr); if(str) raptor_string_ntriples_write(str, len, '>', iostr); raptor_iostream_write_byte('>', iostr); break; case RASQAL_LITERAL_BLANK: raptor_iostream_counted_string_write("_:", 2, iostr); raptor_iostream_counted_string_write(l->string, l->string_len, iostr); break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_UDT: raptor_iostream_write_byte('"', iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_write_byte('"', iostr); if(l->language) { raptor_iostream_write_byte('@', iostr); raptor_iostream_string_write(l->language, iostr); } if(l->datatype) { str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->datatype, &len)); raptor_iostream_counted_string_write("^^<", 3, iostr); raptor_string_ntriples_write(str, len, '>', iostr); raptor_iostream_write_byte('>', iostr); } break; case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_INTEGER_SUBTYPE: case RASQAL_LITERAL_UNKNOWN: default: rasqal_log_error_simple(l->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot turn literal type %u into Turtle", l->type); rc = 1; } return rc; } /* * rasqal_literal_array_compare: * @values_a: first array of literals * @values_b: second array of literals * @exprs_seq: array of expressions (or NULL) * @size: size of arrays * @compare_flags: comparison flags for rasqal_literal_compare() * * INTERNAL - compare two arrays of literals evaluated in an optional array of expressions * * Return value: <0, 0 or >0 comparison */ int rasqal_literal_array_compare(rasqal_literal** values_a, rasqal_literal** values_b, raptor_sequence* exprs_seq, int size, int compare_flags) { int result = 0; int i; for(i = 0; i < size; i++) { rasqal_expression* e = NULL; int error = 0; rasqal_literal* literal_a = values_a[i]; rasqal_literal* literal_b = values_b[i]; if(exprs_seq) e = (rasqal_expression*)raptor_sequence_get_at(exprs_seq, i); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Comparing "); rasqal_literal_print(literal_a, DEBUG_FH); fputs(" to ", DEBUG_FH); rasqal_literal_print(literal_b, DEBUG_FH); fputs("\n", DEBUG_FH); #endif /* NULLs order first */ if(!literal_a || !literal_b) { if(!literal_a && !literal_b) { result = 0; } else { result = (!literal_a) ? -1 : 1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Got one NULL literal comparison, returning %d\n", result); #endif } break; } result = rasqal_literal_compare(literal_a, literal_b, compare_flags | RASQAL_COMPARE_URI, &error); if(error) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Got literal comparison error at expression %d, returning 0\n", i); #endif result = 0; break; } if(!result) continue; if(e && e->op == RASQAL_EXPR_ORDER_COND_DESC) result = -result; /* else Order condition is RASQAL_EXPR_ORDER_COND_ASC so nothing to do */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Returning comparison result %d at expression %d\n", result, i); #endif break; } return result; } /* * rasqal_literal_array_compare_by_order: * @values_a: first array of literals * @values_b: second array of literals * @order: array of order offsets * @size: size of arrays * @compare_flags: comparison flags for rasqal_literal_compare() * * INTERNAL - compare two arrays of literals evaluated in a given order * * Return value: <0, 0 or >0 comparison */ int rasqal_literal_array_compare_by_order(rasqal_literal** values_a, rasqal_literal** values_b, int* order, int size, int compare_flags) { int result = 0; int i; for(i = 0; i < size; i++) { int error = 0; int order_i = order[i]; rasqal_literal* literal_a = values_a[order_i]; rasqal_literal* literal_b = values_b[order_i]; /* NULLs order first */ if(!literal_a || !literal_b) { if(!literal_a && !literal_b) { result = 0; } else { result = (!literal_a) ? -1 : 1; } break; } result = rasqal_literal_compare(literal_a, literal_b, compare_flags | RASQAL_COMPARE_URI, &error); if(error) { result = 0; break; } if(!result) continue; break; } return result; } /** * rasqal_literal_array_equals: * @values_a: first array of literals * @values_b: second array of literals * @size: size of arrays * * INTERNAL - compare two arrays of literals for equality * * Return value: non-0 if equal */ int rasqal_literal_array_equals(rasqal_literal** values_a, rasqal_literal** values_b, int size) { int result = 1; /* equal */ int i; int error = 0; for(i = 0; i < size; i++) { rasqal_literal* literal_a = values_a[i]; rasqal_literal* literal_b = values_b[i]; result = rasqal_literal_equals_flags(literal_a, literal_b, RASQAL_COMPARE_RDF, &error); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Comparing "); rasqal_literal_print(literal_a, DEBUG_FH); fputs(" to ", DEBUG_FH); rasqal_literal_print(literal_b, DEBUG_FH); fprintf(DEBUG_FH, " gave %s\n", (result ? "equality" : "not equal")); #endif if(error) result = 0; /* if different, end */ if(!result) break; } return result; } /** * rasqal_literal_sequence_equals: * @values_a: first sequence of literals * @values_b: second sequence of literals * * INTERNAL - compare two arrays of literals for equality * * Return value: non-0 if equal */ int rasqal_literal_sequence_equals(raptor_sequence* values_a, raptor_sequence* values_b) { int result = 1; /* equal */ int i; int error = 0; int size = raptor_sequence_size(values_a); for(i = 0; i < size; i++) { rasqal_literal* literal_a = (rasqal_literal*)raptor_sequence_get_at(values_a, i); rasqal_literal* literal_b = (rasqal_literal*)raptor_sequence_get_at(values_b, i); result = rasqal_literal_equals_flags(literal_a, literal_b, RASQAL_COMPARE_RDF, &error); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Comparing "); rasqal_literal_print(literal_a, DEBUG_FH); fputs(" to ", DEBUG_FH); rasqal_literal_print(literal_b, DEBUG_FH); fprintf(DEBUG_FH, " gave %s\n", (result ? "equality" : "not equal")); #endif if(error) result = 0; /* if different, end */ if(!result) break; } return result; } typedef struct { int is_distinct; int compare_flags; } literal_sequence_sort_compare_data; /** * rasqal_literal_sequence_sort_map_compare: * @user_data: comparison user data pointer * @a: pointer to address of first array * @b: pointer to address of second array * * INTERNAL - compare two pointers to array of iterals objects * * Suitable for use as a compare function in qsort_r() or similar. * * Return value: <0, 0 or >1 comparison */ static int rasqal_literal_sequence_sort_map_compare(void* user_data, const void *a, const void *b) { raptor_sequence* literal_seq_a; raptor_sequence* literal_seq_b; literal_sequence_sort_compare_data* lsscd; int result = 0; lsscd = (literal_sequence_sort_compare_data*)user_data; literal_seq_a = (raptor_sequence*)a; literal_seq_b = (raptor_sequence*)b; if(lsscd->is_distinct) { result = !rasqal_literal_sequence_equals(literal_seq_a, literal_seq_b); if(!result) /* duplicate, so return that */ return 0; } /* now order it */ result = rasqal_literal_sequence_compare(lsscd->compare_flags, literal_seq_a, literal_seq_b); /* still equal? make sort stable by using the pointers */ if(!result) { ptrdiff_t d; /* Have to cast raptor_sequence* to something with a known type * (not void*, not raptor_sequence* whose size is private to * raptor) so we can do pointer arithmetic. We only care about * the relative pointer difference. */ d = RASQAL_GOOD_CAST(char*, literal_seq_a) - RASQAL_GOOD_CAST(char*, literal_seq_b); /* copy the sign of the (unknown size) signed integer 'd' into an * int result */ result = (d > 0) - (d < 0); RASQAL_DEBUG2("Got equality result so using pointers, returning %d\n", result); } return result; } static int rasqal_literal_sequence_sort_map_print_literal_sequence(void *object, FILE *fh) { if(object) raptor_sequence_print((raptor_sequence*)object, fh); else fputs("NULL", fh); return 0; } /** * rasqal_new_literal_sequence_sort_map: * @compare_flags: flags for rasqal_literal_compare() * * INTERNAL - create a new map for sorting arrays of literals * */ rasqal_map* rasqal_new_literal_sequence_sort_map(int is_distinct, int compare_flags) { literal_sequence_sort_compare_data* lsscd; lsscd = RASQAL_MALLOC(literal_sequence_sort_compare_data*, sizeof(*lsscd)); if(!lsscd) return NULL; lsscd->is_distinct = is_distinct; lsscd->compare_flags = compare_flags; return rasqal_new_map(rasqal_literal_sequence_sort_map_compare, lsscd, (raptor_data_free_handler)rasqal_free_memory, (raptor_data_free_handler)raptor_free_sequence, NULL, /* free_value_fn */ rasqal_literal_sequence_sort_map_print_literal_sequence, NULL, 0 /* do not allow duplicates */); } /** * rasqal_literal_sequence_sort_map_add_literal_sequence: * @map: literal sort map * @literals_seq: Sequence of #rasqal_literal to add * * INTERNAL - Add a row to an literal sequence sort map for sorting * * The literals array @literals_sequence becomes owned by the map. * * return value: non-0 if the array of literals was a duplicate (and not added) */ int rasqal_literal_sequence_sort_map_add_literal_sequence(rasqal_map* map, raptor_sequence *literals_seq) { if(!rasqal_map_add_kv(map, literals_seq, NULL)) return 0; /* duplicate, and not added so delete it */ #ifdef RASQAL_DEBUG RASQAL_DEBUG1("Got duplicate array of literals "); raptor_sequence_print(literals_seq, DEBUG_FH); fputc('\n', DEBUG_FH); #endif raptor_free_sequence(literals_seq); return 1; } /** * rasqal_new_literal_sequence_of_sequence_from_data: * @world: world object ot use * @row_data: row data * * INTERNAL - Make a sequence of sequence of #rasqal_literal* literals * * The @row_data parameter is an array of strings forming a table of * width (literals_count * 2). * The rows are values where offset 0 is a string literal and * offset 1 is a URI string literal. If a string literal looks like * a number (strtol passes), an integer literal is formed. * * The end of data is indicated by an entire row of NULLs. * * Return value: sequence of rows or NULL on failure */ raptor_sequence* rasqal_new_literal_sequence_of_sequence_from_data(rasqal_world* world, const char* const row_data[], int width) { raptor_sequence *seq = NULL; int row_i; int column_i; int failed = 0; #define GET_CELL(row, column, offset) \ row_data[((((row) * width) + (column))<<1) + (offset)] seq = raptor_new_sequence((raptor_data_free_handler)raptor_free_sequence, (raptor_data_print_handler)raptor_sequence_print); if(!seq) return NULL; for(row_i = 0; 1; row_i++) { raptor_sequence* row; int data_values_seen = 0; /* Terminate on an entire row of NULLs */ for(column_i = 0; column_i < width; column_i++) { if(GET_CELL(row_i, column_i, 0) || GET_CELL(row_i, column_i, 1)) { data_values_seen++; break; } } if(!data_values_seen) break; row = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); if(!row) { raptor_free_sequence(seq); seq = NULL; goto tidy; } for(column_i = 0; column_i < width; column_i++) { rasqal_literal* l = NULL; if(GET_CELL(row_i, column_i, 0)) { /* string literal */ const char* str = GET_CELL(row_i, column_i, 0); size_t str_len = strlen(str); char *eptr = NULL; long number; number = strtol(RASQAL_GOOD_CAST(const char*, str), &eptr, 10); if(!*eptr) { /* is numeric */ l = rasqal_new_numeric_literal_from_long(world, RASQAL_LITERAL_INTEGER, number); } else { unsigned char *val; val = RASQAL_MALLOC(unsigned char*, str_len + 1); if(val) { memcpy(val, str, str_len + 1); l = rasqal_new_string_literal_node(world, val, NULL, NULL); } else failed = 1; } } else if(GET_CELL(row_i, column_i, 1)) { /* URI */ const unsigned char* str; raptor_uri* u; str = RASQAL_GOOD_CAST(const unsigned char*, GET_CELL(row_i, column_i, 1)); u = raptor_new_uri(world->raptor_world_ptr, str); if(u) l = rasqal_new_uri_literal(world, u); else failed = 1; } else { /* variable is not defined for this row */ continue; } if(!l) { raptor_free_sequence(row); failed = 1; goto tidy; } raptor_sequence_set_at(row, column_i, l); } raptor_sequence_push(seq, row); } tidy: if(failed) { if(seq) { raptor_free_sequence(seq); seq = NULL; } } return seq; } /* * rasqal_new_literal_from_term: * @world: rasqal world * @term: term object * * INTERNAL - create a new literal from a #raptor_term * * Return value: new literal or NULL on failure */ rasqal_literal* rasqal_new_literal_from_term(rasqal_world* world, raptor_term* term) { rasqal_literal* l = NULL; size_t len; unsigned char* new_str = NULL; if(!term) return NULL; if(term->type == RAPTOR_TERM_TYPE_LITERAL) { char *language = NULL; raptor_uri* uri = NULL; len = term->value.literal.string_len; new_str = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_str) goto fail; memcpy(new_str, term->value.literal.string, len + 1); if(term->value.literal.language) { len = term->value.literal.language_len; language = RASQAL_MALLOC(char*, len + 1); if(!language) goto fail; memcpy(language, term->value.literal.language, len + 1); } if(term->value.literal.datatype) uri = raptor_uri_copy(term->value.literal.datatype); l = rasqal_new_string_literal(world, new_str, language, uri, NULL); } else if(term->type == RAPTOR_TERM_TYPE_BLANK) { len = term->value.blank.string_len; new_str = RASQAL_MALLOC(unsigned char*, len + 1); if(!new_str) goto fail; memcpy(new_str, term->value.blank.string, len + 1); l = rasqal_new_simple_literal(world, RASQAL_LITERAL_BLANK, new_str); } else if(term->type == RAPTOR_TERM_TYPE_URI) { raptor_uri* uri; uri = raptor_uri_copy((raptor_uri*)term->value.uri); l = rasqal_new_uri_literal(world, uri); } else goto fail; return l; fail: if(new_str) RASQAL_FREE(unsigned char*, new_str); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); /* Test 0 */ static const char* const data_3x3_unique_rows[] = { /* 3 literals in 3 rows - all distinct */ /* row 1 data */ "0", NULL, "1", NULL, "2", NULL, /* row 2 data */ "3", NULL, "4", NULL, "5", NULL, /* row 3 data */ "6", NULL, "7", NULL, "8", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, }; static const char* const data_3x4_1_duplicate_rows[] = { /* 3 literals in 4 rows - with one duplicate */ /* row 1 data */ "0", NULL, "1", NULL, "2", NULL, /* row 2 data */ "3", NULL, "4", NULL, "5", NULL, /* row 3 data */ "0", NULL, "1", NULL, "2", NULL, /* row 4 data */ "6", NULL, "7", NULL, "8", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, }; static const char* const data_3x6_2_duplicate_rows[] = { /* 3 literals in 6 rows - with one duplicate */ /* row 1 data */ "0", NULL, "1", NULL, "2", NULL, /* row 2 data */ "3", NULL, "4", NULL, "5", NULL, /* row 3 data */ "0", NULL, "1", NULL, "2", NULL, /* row 4 data */ "3", NULL, "4", NULL, "5", NULL, /* row 5 data */ "6", NULL, "7", NULL, "8", NULL, /* row 6 data */ "8", NULL, "9", NULL, "0", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, }; #define TESTS_COUNT 3 static const struct { int width; int expected_rows; const char* const *data; } test_data[TESTS_COUNT] = { /* Test 0: 3 literals, 3 rows (no duplicates) */ {3, 3, data_3x3_unique_rows }, /* Test 1: 3 literals, 4 rows (1 duplicate) */ {3, 3, data_3x4_1_duplicate_rows }, /* Test 2: 3 literals, 6 rows (2 duplicate2) */ {3, 4, data_3x6_2_duplicate_rows } }; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); int failures = 0; rasqal_world *world; int test_id; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } /* test */ fprintf(stderr, "%s: Testing literals\n", program); for(test_id = 0; test_id < TESTS_COUNT; test_id++) { int expected_rows = test_data[test_id].expected_rows; int width = test_data[test_id].width; raptor_sequence* seq; int duplicates; int count; int i; raptor_sequence* seq2; rasqal_map* map; seq = rasqal_new_literal_sequence_of_sequence_from_data(world, test_data[test_id].data, width); if(!seq) { fprintf(stderr, "%s: failed to create seq of literal seq\n", program); failures++; goto tidy; } fprintf(DEBUG_FH, "%s: Test %d data (seq of seq of literals) is: ", program, test_id); raptor_sequence_print(seq, DEBUG_FH); fputc('\n', DEBUG_FH); map = rasqal_new_literal_sequence_sort_map(1 /* is_distinct */, 0 /* compare_flags */); if(!map) { fprintf(DEBUG_FH, "%s: Test %d failed to create map\n", program, test_id); failures++; raptor_free_sequence(seq); continue; } duplicates = 0; count = 0; for(i = 0; (seq2 = (raptor_sequence*)raptor_sequence_delete_at(seq, i)); i++) { int rc; rc = rasqal_literal_sequence_sort_map_add_literal_sequence(map, seq2); if(rc) { fprintf(DEBUG_FH, "%s: Test %d literal seq %d is a duplicate\n", program, test_id, i); duplicates++; } else count++; } rasqal_free_map(map); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "%s: Test %d had %d duplicates\n", program, test_id, duplicates); #endif raptor_free_sequence(seq); if(count != expected_rows) { fprintf(DEBUG_FH, "%s: Test %d returned %d rows expected %d\n", program, test_id, count, expected_rows); failures++; } } tidy: rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_solution_modifier.c0000644000175000017500000000557311615331730016054 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_solution_modifier.c - Rasqal solution modifier class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /** * rasqal_new_solution_modifier: * @query: rasqal query * @order_conditions: sequence of order condition expressions (or NULL) * @group_conditions: sequence of group by condition expressions (or NULL) * @having_conditions: sequence of (group by ...) having condition expressions (or NULL) * @limit: result limit LIMIT (>=0) or <0 if not given * @offset: result offset OFFSET (>=0) or <0 if not given * * INTERNAL - Create a new solution modifier object. * * Return value: a new #rasqal_solution_modifier object or NULL on failure **/ rasqal_solution_modifier* rasqal_new_solution_modifier(rasqal_query* query, raptor_sequence* order_conditions, raptor_sequence* group_conditions, raptor_sequence* having_conditions, int limit, int offset) { rasqal_solution_modifier* sm; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); sm = RASQAL_CALLOC(rasqal_solution_modifier*, 1, sizeof(*sm)); if(!sm) return NULL; sm->query = query; sm->order_conditions = order_conditions; sm->group_conditions = group_conditions; sm->having_conditions = having_conditions; sm->limit = limit; sm->offset = offset; return sm; } /* * rasqal_free_solution_modifier: * @sm: #rasqal_solution_modifier object * * INTERNAL - Free a solution modifier object. * **/ void rasqal_free_solution_modifier(rasqal_solution_modifier* sm) { if(!sm) return; if(sm->order_conditions) raptor_free_sequence(sm->order_conditions); if(sm->group_conditions) raptor_free_sequence(sm->group_conditions); if(sm->having_conditions) raptor_free_sequence(sm->having_conditions); RASQAL_FREE(rasqal_solution_modifier, sm); } rasqal-0.9.33/src/rasqal_rowsource_filter.c0000644000175000017500000001426311623522417015716 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_filter.c - Rasqal filter rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { /* inner rowsource to filter */ rasqal_rowsource *rowsource; /* FILTER expression */ rasqal_expression* expr; /* offset into results for current row */ int offset; } rasqal_filter_rowsource_context; static int rasqal_filter_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { return 0; } static int rasqal_filter_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_filter_rowsource_context* con; con = (rasqal_filter_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; if(rasqal_rowsource_copy_variables(rowsource, con->rowsource)) return 1; return 0; } static int rasqal_filter_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_filter_rowsource_context *con; con = (rasqal_filter_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->expr) rasqal_free_expression(con->expr); RASQAL_FREE(rasqal_filter_rowsource_context, con); return 0; } static rasqal_row* rasqal_filter_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_query *query = rowsource->query; rasqal_filter_rowsource_context *con; rasqal_row *row = NULL; con = (rasqal_filter_rowsource_context*)user_data; while(1) { rasqal_literal* result; int bresult = 1; int error = 0; row = rasqal_rowsource_read_row(con->rowsource); if(!row) break; result = rasqal_expression_evaluate2(con->expr, query->eval_context, &error); #ifdef RASQAL_DEBUG RASQAL_DEBUG1("filter expression result: "); if(error) fputs("type error", DEBUG_FH); else rasqal_literal_print(result, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(error) { bresult = 0; } else { error = 0; bresult = rasqal_literal_as_boolean(result, &error); #ifdef RASQAL_DEBUG if(error) RASQAL_DEBUG1("filter boolean expression returned error\n"); else RASQAL_DEBUG2("filter boolean expression result: %d\n", bresult); #endif rasqal_free_literal(result); } if(bresult) /* Constraint succeeded so end */ break; rasqal_free_row(row); row = NULL; } if(row) { int i; for(i = 0; i < row->size; i++) { rasqal_variable* v; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(row->values[i]) rasqal_free_literal(row->values[i]); row->values[i] = rasqal_new_literal_from_literal(v->value); } row->offset = con->offset++; } return row; } static int rasqal_filter_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_filter_rowsource_context *con; con = (rasqal_filter_rowsource_context*)user_data; return rasqal_rowsource_reset(con->rowsource); } static rasqal_rowsource* rasqal_filter_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_filter_rowsource_context *con; con = (rasqal_filter_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_filter_rowsource_handler = { /* .version = */ 1, "filter", /* .init = */ rasqal_filter_rowsource_init, /* .finish = */ rasqal_filter_rowsource_finish, /* .ensure_variables = */ rasqal_filter_rowsource_ensure_variables, /* .read_row = */ rasqal_filter_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_filter_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_filter_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_filter_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * @expr: filter expression * * INTERNAL - create a new FILTER rowsource * * The @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_filter_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, rasqal_expression* expr) { rasqal_filter_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource || !expr) goto fail; con = RASQAL_CALLOC(rasqal_filter_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; con->expr = rasqal_new_expression_from_expression(expr); return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_filter_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); if(expr) rasqal_free_expression(expr); return NULL; } rasqal-0.9.33/src/win32_rasqal_config.h.in0000644000175000017500000000723612127603460015222 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * win32_config.h - Rasqal WIN32 hard-coded config * * Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * */ #ifndef WIN32_CONFIG_H #define WIN32_CONFIG_H #ifdef __cplusplus extern "C" { #endif #define WIN32_LEAN_AND_MEAN 1 #include /* getopt is not in standard win32 C library - define if we have it */ /* #define HAVE_GETOPT_H 1 */ #define HAVE_STDLIB_H 1 #define HAVE_ERRNO_H 1 #define HAVE_STRICMP 1 /* MS names for these functions */ // next line breaks build on wntmsci12 //#define vsnprintf _vsnprintf #define snprintf _snprintf #define access _access #define stricmp _stricmp #define strnicmp _strnicmp /* definition from winsock2.h */ #ifndef _TIMEVAL_DEFINED #define _TIMEVAL_DEFINED typedef struct timeval { long tv_sec; long tv_usec; } timeval; #endif struct timezone { int tz_minuteswest; /* minutes West of Greenwich */ int tz_dsttime; /* type of dst correction */ }; int rasqal_gettimeofday(struct timeval *tv, struct timezone *tz); #undef HAVE_GETTIMEOFDAY #include #define isnan(n) _isnan(n) /* no round function available */ #define round(x) floor(x+0.5) /* These are SPARQL token definitions */ #ifdef OPTIONAL #undef OPTIONAL #endif #ifdef DELETE #undef DELETE #endif #ifdef IN #undef IN #endif #ifdef GROUP #undef GROUP #endif #define HAVE_C99_VSNPRINTF 1 /* for access() which is POSIX but doesn't seem to have the defines in VC */ #ifndef R_OK #define R_OK 4 #endif /* __func__ doesn't exist in Visual Studio 6 */ #define __func__ "" /* * Defines that come from config.h */ #include #include /* Release version as a decimal */ #define RASQAL_VERSION @RASQAL_VERSION_DECIMAL@ /* Version number of package */ #define RASQAL_VERSION_STRING "@VERSION@" /* Major version number */ #define RASQAL_VERSION_MAJOR @RASQAL_VERSION_MAJOR@ /* Minor version number */ #define RASQAL_VERSION_MINOR @RASQAL_VERSION_MINOR@ /* Release version number */ #define RASQAL_VERSION_RELEASE @RASQAL_VERSION_RELEASE@ /* This is a SPARQL token define */ #ifdef OPTIONAL #undef OPTIONAL #endif /* bison: output uses ERROR in an enum which breaks if this is defined */ #ifdef ERROR #undef ERROR #endif /* flex: const is available */ #define YY_USE_CONST /* looks like the .c files define this anyway */ /* #define YY_NO_UNISTD_H */ #undef RASQAL_INLINE #define RASQAL_INLINE __inline /* Building SPARQL query */ #define RASQAL_QUERY_SPARQL 1 /* Use raptor to provide triples */ #define RAPTOR_TRIPLES_SOURCE_RAPTOR 1 /* Use redland to provide triples */ /* #define RAPTOR_TRIPLES_SOURCE_REDLAND 1 */ /* Use PCRE regex library */ //#define RASQAL_REGEX_PCRE 1 #define HAVE_LIBXML_SCHEMASINTERNALS_H 1 #define HAVE_LIBXML_XMLSCHEMASTYPES_H 1 #define HAVE_LIBXML_XMLSCHEMAS_H 1 #define RASQAL_DECIMAL_NONE 1 #define RASQAL_UUID_INTERNAL 1 #define RASQAL_DIGEST_INTERNAL 1 #ifdef _DEBUG #define RASQAL_DEBUG 1 #endif #ifdef __cplusplus } #endif #endif rasqal-0.9.33/src/rasqal_xsd_datatypes.c0000644000175000017500000005134112434455625015202 00000000000000/* * rasqal_xsd_datatypes.c - Rasqal XML Schema Datatypes support * * Copyright (C) 2005-2010, David Beckett http://www.dajobe.org/ * Copyright (C) 2005-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include "rasqal.h" #include "rasqal_internal.h" /* local prototypes */ int rasqal_xsd_check_double_format(const unsigned char* string, int flags); #ifndef STANDALONE /* * * References * * XPath Functions and Operators * http://www.w3.org/TR/xpath-functions/ * * Datatypes hierarchy * http://www.w3.org/TR/xpath-functions/#datatypes * * Casting * http://www.w3.org/TR/xpath-functions/#casting-from-primitive-to-primitive * */ int rasqal_xsd_boolean_value_from_string(const unsigned char* string) { int integer = 0; /* FIXME * Strictly only {true, false, 1, 0} are allowed according to * http://www.w3.org/TR/xmlschema-2/#boolean */ if(!strcmp(RASQAL_GOOD_CAST(const char*, string), "true") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "TRUE") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "1")) integer = 1; return integer; } static int rasqal_xsd_check_boolean_format(const unsigned char* string, int flags) { /* FIXME * Strictly only {true, false, 1, 0} are allowed according to * http://www.w3.org/TR/xmlschema-2/#boolean */ if(!strcmp(RASQAL_GOOD_CAST(const char*, string), "true") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "TRUE") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "1") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "false") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "FALSE") || !strcmp(RASQAL_GOOD_CAST(const char*, string), "0")) return 1; return 0; } #define ADVANCE_OR_DIE(p) if(!*(++p)) return 0; /** * rasqal_xsd_check_date_format: * @string: lexical form string * flags: flags * * INTERNAL - Check an XSD date lexical form * * Return value: non-0 if the string is valid */ static int rasqal_xsd_check_date_format(const unsigned char* string, int flags) { /* This should be correct according to * http://www.w3.org/TR/xmlschema-2/#date */ return rasqal_xsd_date_check(RASQAL_GOOD_CAST(const char*, string)); } /** * rasqal_xsd_check_dateTime_format: * @string: lexical form string * flags: flags * * INTERNAL - Check an XSD dateTime lexical form * * Return value: non-0 if the string is valid */ static int rasqal_xsd_check_dateTime_format(const unsigned char* string, int flags) { /* This should be correct according to * http://www.w3.org/TR/xmlschema-2/#dateTime */ return rasqal_xsd_datetime_check(RASQAL_GOOD_CAST(const char*, string)); } /** * rasqal_xsd_check_decimal_format: * @string: lexical form string * flags: flags * * INTERNAL - Check an XSD decimal lexical form * * Return value: non-0 if the string is valid */ static int rasqal_xsd_check_decimal_format(const unsigned char* string, int flags) { const char* p; /* This should be correct according to * http://www.w3.org/TR/xmlschema-2/#decimal */ p = RASQAL_GOOD_CAST(const char*, string); if(*p == '+' || *p == '-') { ADVANCE_OR_DIE(p); } while(*p && isdigit(RASQAL_GOOD_CAST(int, *p))) p++; if(!*p) return 1; /* Fail if first non-digit is not '.' */ if(*p != '.') return 0; p++; while(*p && isdigit(RASQAL_GOOD_CAST(int, *p))) p++; /* Fail if anything other than a digit seen before NUL */ if(*p) return 0; return 1; } /* Legal special double values */ #define XSD_DOUBLE_SPECIALS_LEN 3 static const char * const xsd_double_specials[XSD_DOUBLE_SPECIALS_LEN] = { "-INF", "INF", "NaN" }; /** * rasqal_xsd_check_double_format: * @string: lexical form string * flags: flags * * INTERNAL - Check an XSD double lexical form * * Return value: non-0 if the string is valid */ int rasqal_xsd_check_double_format(const unsigned char* string, int flags) { const char *p = RASQAL_GOOD_CAST(const char*, string); const char *saved_p; int i; if(!*p) return 0; /* Validating http://www.w3.org/TR/xmlschema-2/#double */ /* check for specials */ for(i = 0; i < XSD_DOUBLE_SPECIALS_LEN; i++) { if(!strcmp(xsd_double_specials[i], p)) return 1; } /* mantissa: follows http://www.w3.org/TR/xmlschema-2/#decimal */ if(*p == '-' || *p == '+') p++; if(!*p) return 0; saved_p = p; while(isdigit(*p)) p++; /* no digits is a failure */ if(p == saved_p) return 0; /* ending now is ok - whole number (-1, +2, 3) */ if(!*p) return 1; /* .DIGITS is optional */ if(*p == '.') { p++; /* ending after . is not ok */ if(!*p) return 0; while(isdigit(*p)) p++; /* ending with digits now is ok (-1.2, +2.3, 2.3) */ if(!*p) return 1; } /* must be an exponent letter here (-1E... +2e... , -1.3E..., * +2.4e..., 2E..., -4e...) */ if(*p != 'e' && *p != 'E') return 0; p++; /* exponent: follows http://www.w3.org/TR/xmlschema-2/#integer */ if(*p == '-' || *p == '+') p++; saved_p = p; while(isdigit(*p)) p++; if(p == saved_p) return 0; if(*p) return 0; return 1; } /** * rasqal_xsd_check_float_format: * @string: lexical form string * flags: flags * * INTERNAL - Check an XSD float lexical form * * Return value: non-0 if the string is valid */ static int rasqal_xsd_check_float_format(const unsigned char* string, int flags) { /* http://www.w3.org/TR/xmlschema-2/#float is the same as double */ return rasqal_xsd_check_double_format(string, flags); } /** * rasqal_xsd_check_integer_format: * @string: lexical form string * flags: flags * * INTERNAL - Check an XSD integer lexical form * * Return value: non-0 if the string is valid */ static int rasqal_xsd_check_integer_format(const unsigned char* string, int flags) { /* This should be correct according to * http://www.w3.org/TR/xmlschema-2/#integer */ /* Forbid empty string */ if(!*string) return 0; if(*string == '+' || *string == '-') { string++; /* Forbid "+" and "-" */ if(!*string) return 0; } /* Digits */ for(;*string; string++) { if(*string < '0' || *string > '9') return 0; } return 1; } /** * rasqal_xsd_format_integer: * @i: integer * @len_p: pointer to length of result or NULL * * INTERNAL - Format a C integer as a string in XSD decimal integer format. * * This is suitable for multiple XSD decimal integer types that are * xsd:integer or sub-types such as xsd:short, xsd:int, xsd:long, * * See http://www.w3.org/TR/xmlschema-2/#built-in-datatypes for the full list. * * Return value: new string or NULL on failure */ unsigned char* rasqal_xsd_format_integer(int i, size_t *len_p) { unsigned char* string; /* Buffer sizes need to format: * 4: 8 bit decimal integers (xsd:byte) "-128" to "127" * 6: 16 bit decimal integers (xsd:short) "-32768" to "32767" * 11: 32 bit decimal integers (xsd:int) "-2147483648" to "2147483647" * 20: 64 bit decimal integers (xsd:long) "-9223372036854775808" to "9223372036854775807" * (the lexical form may have leading 0s in non-canonical representations) */ #define INTEGER_BUFFER_SIZE 20 string = RASQAL_MALLOC(unsigned char*, INTEGER_BUFFER_SIZE + 1); if(!string) return NULL; /* snprintf() takes as length the buffer size including NUL */ snprintf(RASQAL_GOOD_CAST(char*, string), INTEGER_BUFFER_SIZE + 1, "%d", i); if(len_p) *len_p = strlen(RASQAL_GOOD_CAST(const char*, string)); return string; } /** * rasqal_xsd_format_float: * @i: float * @len_p: pointer to length of result or NULL * * INTERNAL - Format a new an xsd:float correctly * * Return value: new string or NULL on failure */ unsigned char* rasqal_xsd_format_float(float f, size_t *len_p) { unsigned char* string; /* FIXME: This is big enough for C float formatted in decimal as %1g */ #define FLOAT_BUFFER_SIZE 30 string = RASQAL_MALLOC(unsigned char*, FLOAT_BUFFER_SIZE + 1); if(!string) return NULL; /* snprintf() takes as length the buffer size including NUL */ /* FIXME: %1g may not be the nearest to XSD xsd:float canonical format */ snprintf(RASQAL_GOOD_CAST(char*, string), FLOAT_BUFFER_SIZE + 1, "%1g", (double)f); if(len_p) *len_p = strlen(RASQAL_GOOD_CAST(const char*, string)); return string; } /** * rasqal_xsd_format_double: * @d: double * @len_p: pointer to length of result or NULL * * INTERNAL - Format a new an xsd:double correctly * * Return value: new string or NULL on failure */ unsigned char* rasqal_xsd_format_double(double d, size_t *len_p) { unsigned int e_index = 0; char have_trailing_zero = 0; size_t trailing_zero_start = 0; unsigned int exponent_start; size_t len = 0; unsigned char* buf = NULL; len = 20; buf = RASQAL_MALLOC(unsigned char*, len + 1); if(!buf) return NULL; /* snprintf needs the length + 1 because it writes a \0 too */ snprintf(RASQAL_GOOD_CAST(char*, buf), len + 1, "%1.14E", d); /* find the 'e' and start of mantissa trailing zeros */ for( ; buf[e_index]; ++e_index) { if(e_index > 0 && buf[e_index] == '0' && buf[e_index - 1] != '0') { trailing_zero_start = e_index; have_trailing_zero = 1; } else if(buf[e_index] == 'E') break; } if(have_trailing_zero) { if(buf[trailing_zero_start - 1] == '.') ++trailing_zero_start; /* write an 'E' where the trailing zeros started */ buf[trailing_zero_start] = 'E'; if(buf[e_index + 1] == '-') { buf[trailing_zero_start + 1] = '-'; ++trailing_zero_start; } } else { buf[e_index] = 'E'; trailing_zero_start = e_index + 1; have_trailing_zero = 1; } exponent_start = e_index + 2; while(buf[exponent_start] == '0') ++exponent_start; if(have_trailing_zero) { len = strlen(RASQAL_GOOD_CAST(const char*, buf)); if(exponent_start == len) { len = trailing_zero_start + 2; buf[len - 1] = '0'; buf[len] = '\0'; } else { /* copy the exponent (minus leading zeros) after the new E */ memmove(buf + trailing_zero_start + 1, buf + exponent_start, len - exponent_start + 1); len = strlen(RASQAL_GOOD_CAST(const char*, buf)); } } if(len_p) *len_p = len; return buf; } typedef rasqal_literal* (*rasqal_extension_fn)(raptor_uri* name, raptor_sequence *args, char **error_p); typedef struct { const unsigned char *name; int min_nargs; int max_nargs; rasqal_extension_fn fn; raptor_uri* uri; } rasqal_xsd_datatype_fn_info; #define XSD_INTEGER_DERIVED_COUNT 12 #define XSD_INTEGER_DERIVED_FIRST (RASQAL_LITERAL_LAST_XSD + 1) #define XSD_INTEGER_DERIVED_LAST (RASQAL_LITERAL_LAST_XSD + XSD_INTEGER_DERIVED_COUNT - 1) #define XSD_DATE_OFFSET (XSD_INTEGER_DERIVED_LAST + 2) /* atomic XSD literals + 12 types derived from xsd:integer plus DATE plus a NULL */ #define SPARQL_XSD_NAMES_COUNT (RASQAL_LITERAL_LAST_XSD + 1 + XSD_INTEGER_DERIVED_COUNT + 1) static const char* const sparql_xsd_names[SPARQL_XSD_NAMES_COUNT + 1] = { NULL, /* RASQAL_LITERAL_UNKNOWN */ NULL, /* ...BLANK */ NULL, /* ...URI */ NULL, /* ...LITERAL */ "string", "boolean", "integer", /* may type-promote all the way to xsd:decimal */ "float", "double", "decimal", "dateTime", /* all of the following always type-promote to xsd:integer */ "nonPositiveInteger", "negativeInteger", "long", "int", "short", "byte", "nonNegativeInteger", "unsignedLong", "postiveInteger", "unsignedInt", "unsignedShort", "unsignedByte", /* RASQAL_LITERAL_DATE onwards (NOT next to dateTime) */ "date", NULL }; #define CHECKFNS_COUNT (RASQAL_LITERAL_LAST_XSD - RASQAL_LITERAL_FIRST_XSD + 2) static int (*const sparql_xsd_checkfns[CHECKFNS_COUNT])(const unsigned char* string, int flags) = { NULL, /* RASQAL_LITERAL_XSD_STRING */ rasqal_xsd_check_boolean_format, /* RASQAL_LITERAL_BOOLEAN */ rasqal_xsd_check_integer_format, /* RASQAL_LITERAL_INTEGER */ rasqal_xsd_check_float_format, /* RASQAL_LITERAL_FLOAT */ rasqal_xsd_check_double_format, /* RASQAL_LITERAL_DOUBLE */ rasqal_xsd_check_decimal_format, /* RASQAL_LITERAL_DECIMAL */ rasqal_xsd_check_dateTime_format, /* RASQAL_LITERAL_DATETIME */ /* GAP */ rasqal_xsd_check_date_format /* RASQAL_LITERAL_DATE */ }; #define CHECKFN_DATE_OFFSET (RASQAL_LITERAL_DATETIME - RASQAL_LITERAL_FIRST_XSD + 1) int rasqal_xsd_init(rasqal_world* world) { int i; world->xsd_namespace_uri = raptor_new_uri(world->raptor_world_ptr, raptor_xmlschema_datatypes_namespace_uri); if(!world->xsd_namespace_uri) return 1; world->xsd_datatype_uris = RASQAL_CALLOC(raptor_uri**, SPARQL_XSD_NAMES_COUNT + 1, sizeof(raptor_uri*)); if(!world->xsd_datatype_uris) return 1; for(i = RASQAL_LITERAL_FIRST_XSD; i < SPARQL_XSD_NAMES_COUNT; i++) { const unsigned char* name = RASQAL_GOOD_CAST(const unsigned char*, sparql_xsd_names[i]); world->xsd_datatype_uris[i] = raptor_new_uri_from_uri_local_name(world->raptor_world_ptr, world->xsd_namespace_uri, name); if(!world->xsd_datatype_uris[i]) return 1; } return 0; } void rasqal_xsd_finish(rasqal_world* world) { if(world->xsd_datatype_uris) { int i; for(i = RASQAL_LITERAL_FIRST_XSD; i < SPARQL_XSD_NAMES_COUNT; i++) { if(world->xsd_datatype_uris[i]) raptor_free_uri(world->xsd_datatype_uris[i]); } RASQAL_FREE(table, world->xsd_datatype_uris); world->xsd_datatype_uris = NULL; } if(world->xsd_namespace_uri) { raptor_free_uri(world->xsd_namespace_uri); world->xsd_namespace_uri = NULL; } } rasqal_literal_type rasqal_xsd_datatype_uri_to_type(rasqal_world* world, raptor_uri* uri) { int i; rasqal_literal_type native_type = RASQAL_LITERAL_UNKNOWN; if(!uri || !world->xsd_datatype_uris) return native_type; for(i = RASQAL_GOOD_CAST(int, RASQAL_LITERAL_FIRST_XSD); i <= RASQAL_GOOD_CAST(int, XSD_INTEGER_DERIVED_LAST); i++) { if(raptor_uri_equals(uri, world->xsd_datatype_uris[i])) { if(i >= XSD_INTEGER_DERIVED_FIRST) native_type = RASQAL_LITERAL_INTEGER_SUBTYPE; else native_type = (rasqal_literal_type)i; break; } } if(native_type == RASQAL_LITERAL_UNKNOWN) { /* DATE is not in the range FIRST_XSD .. INTEGER_DERIVED_LAST */ i = RASQAL_GOOD_CAST(int, XSD_DATE_OFFSET); if(raptor_uri_equals(uri, world->xsd_datatype_uris[i])) native_type = RASQAL_LITERAL_DATE; } return native_type; } raptor_uri* rasqal_xsd_datatype_type_to_uri(rasqal_world* world, rasqal_literal_type type) { if(world->xsd_datatype_uris && ((type >= RASQAL_LITERAL_FIRST_XSD && type <= RASQAL_LITERAL_LAST_XSD) || type == RASQAL_LITERAL_DATE)) return world->xsd_datatype_uris[RASQAL_GOOD_CAST(int, type)]; return NULL; } /** * rasqal_xsd_datatype_check: * @native_type: rasqal XSD type * @string: string * @flags: check flags * * INTERNAL - check a string as a valid lexical form of an XSD datatype * * Return value: non-0 if the string is valid */ int rasqal_xsd_datatype_check(rasqal_literal_type native_type, const unsigned char* string, int flags) { /* calculate check function index in sparql_xsd_checkfns table */ int checkidx = -1; if(native_type >= RASQAL_GOOD_CAST(int, RASQAL_LITERAL_FIRST_XSD) && native_type <= RASQAL_GOOD_CAST(int, RASQAL_LITERAL_LAST_XSD)) checkidx = RASQAL_GOOD_CAST(int, native_type - RASQAL_LITERAL_FIRST_XSD); else if(native_type == RASQAL_LITERAL_DATE) checkidx = CHECKFN_DATE_OFFSET; /* test for index out of bounds and check function not defined */ if(checkidx < 0 || !sparql_xsd_checkfns[checkidx]) return 1; return sparql_xsd_checkfns[checkidx](string, flags); } const char* rasqal_xsd_datatype_label(rasqal_literal_type native_type) { return sparql_xsd_names[native_type]; } int rasqal_xsd_is_datatype_uri(rasqal_world* world, raptor_uri* uri) { return (rasqal_xsd_datatype_uri_to_type(world, uri) != RASQAL_LITERAL_UNKNOWN); } int rasqal_xsd_datatype_is_numeric(rasqal_literal_type type) { return ((type >= RASQAL_LITERAL_BOOLEAN && type <= RASQAL_LITERAL_DECIMAL) || (type == RASQAL_LITERAL_INTEGER_SUBTYPE)); } static const rasqal_literal_type parent_xsd_type[RASQAL_LITERAL_LAST + 1] = { /* RASQAL_LITERAL_UNKNOWN */ RASQAL_LITERAL_UNKNOWN, /* RDF Blank / RDF Term: Blank */ /* RASQAL_LITERAL_BLANK */ RASQAL_LITERAL_UNKNOWN, /* RDF URI / RDF Term: URI */ /* RASQAL_LITERAL_URI */ RASQAL_LITERAL_UNKNOWN, /* RDF Plain Literal / RDF Term: Literal */ /* RASQAL_LITERAL_STRING */ RASQAL_LITERAL_UNKNOWN, /* XSD types / RDF Term Literal */ /* RASQAL_LITERAL_XSD_STRING */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_BOOLEAN */ RASQAL_LITERAL_INTEGER, /* RASQAL_LITERAL_INTEGER */ RASQAL_LITERAL_FLOAT, /* RASQAL_LITERAL_FLOAT */ RASQAL_LITERAL_DOUBLE, /* RASQAL_LITERAL_DOUBLE */ RASQAL_LITERAL_DECIMAL, /* RASQAL_LITERAL_DECIMAL */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_DATETIME */ RASQAL_LITERAL_UNKNOWN, /* not datatypes */ /* RASQAL_LITERAL_UDT */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_PATTERN */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_QNAME */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_VARIABLE */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_INTEGER_SUBTYPE */ RASQAL_LITERAL_UNKNOWN, /* RASQAL_LITERAL_DATE */ RASQAL_LITERAL_UNKNOWN }; rasqal_literal_type rasqal_xsd_datatype_parent_type(rasqal_literal_type type) { if(type == RASQAL_LITERAL_INTEGER_SUBTYPE) return RASQAL_LITERAL_INTEGER; if((type >= RASQAL_LITERAL_FIRST_XSD && type <= RASQAL_LITERAL_LAST_XSD) || type == RASQAL_LITERAL_DATE) return parent_xsd_type[type]; return RASQAL_LITERAL_UNKNOWN; } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); #define N_VALID_TESTS 27 const char *double_valid_tests[N_VALID_TESTS+1] = { "-INF", "INF", "NaN", "-0", "+0", "0", "-12", "+12", "12", "-12.34", "+12.34", "12.34", "-1E4", "+1E4", "1267.43233E12", "-1267.43233E12", "12.78E-2", "-1e4", "+1e4", "1267.43233e12", "-1267.43233e12", "12.78e-2", "-1e0", "1e0", "1267.43233e0", "-1267.43233e0", "12.78e-0", NULL }; #define N_INVALID_TESTS 27 const char *double_invalid_tests[N_INVALID_TESTS+1] = { "-inf", "inf", "+inf", "+INF", "NAN", "nan", "-0.", "+0.", "0.", "-12.", "+12.", "12.", "-E4", "E4", "+E4", "-e4", "e4", "+e4", "-1E", "+1E", "1E", "-1e", "+1e", "1e", "-1.E", "+1.E", "1.E", NULL }; int main(int argc, char *argv[]) { rasqal_world* world; const char *program = rasqal_basename(argv[0]); int failures = 0; int test = 0; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); failures++; goto tidy; } for(test = 0; test < N_VALID_TESTS; test++) { const unsigned char *str; str = RASQAL_GOOD_CAST(const unsigned char*, double_valid_tests[test]); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "%s: Valid Test %3d value: %s\n", program, test, str); #endif if(!rasqal_xsd_check_double_format(str, 0 /* flags */)) { fprintf(stderr, "%s: Valid Test %3d value: %s FAILED\n", program, test, str); failures++; } } for(test = 0; test < N_INVALID_TESTS; test++) { const unsigned char *str; str = RASQAL_GOOD_CAST(const unsigned char*, double_invalid_tests[test]); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "%s: Invalid Test %3d value: %s\n", program, test, str); #endif if(rasqal_xsd_check_double_format(str, 0 /* flags */)) { fprintf(stderr, "%s: Invalid Test %3d value: %s PASSED (expected failure)\n", program, test, str); failures++; } } tidy: rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/gettimeofday.c0000644000175000017500000000237611624544070013441 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- /* * gettimeofday.c - gettimeofday compatibility (Windows) * * This file is in the public domain. * */ #ifdef WIN32 #include #include #include /* Windows time epoch is 100ns units since 1 Jan 1601 * Unix time epoch is second units since 1 Jan 1970 */ #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif int rasqal_gettimeofday(struct timeval *tv, struct timezone *tz) { FILETIME ft; unsigned __int64 tmpres = 0; static int tzflag = 0; if(tv) { /* Abailable from Win95+ */ GetSystemTimeAsFileTime(&ft); tmpres |= ft.dwHighDateTime; tmpres <<= 32; tmpres |= ft.dwLowDateTime; /* convert file time epoch to unix epoch */ tmpres -= DELTA_EPOCH_IN_MICROSECS; /* convert from 100ns units (0.1 microseconds) into microseconds */ tmpres /= 10; tv->tv_sec = (long)(tmpres / 1000000UL); tv->tv_usec = (long)(tmpres % 1000000UL); } if(tz) { if(!tzflag) { _tzset(); tzflag++; } tz->tz_minuteswest = _timezone / 60; tz->tz_dsttime = _daylight; } return 0; } #endif rasqal-0.9.33/src/rasqal_row_compatible.c0000644000175000017500000002532712434455625015341 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_row_compatible.c - Rasqal Class for checking if two Query Result Rows are compatible * * Copyright (C) 2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE rasqal_row_compatible* rasqal_new_row_compatible(rasqal_variables_table* vt, rasqal_rowsource *first_rowsource, rasqal_rowsource *second_rowsource) { rasqal_row_compatible* map = NULL; int count = rasqal_variables_table_get_total_variables_count(vt); int i; map = RASQAL_CALLOC(rasqal_row_compatible*, 1, sizeof(*map)); if(!map) return NULL; map->variables_table = vt; map->first_rowsource = first_rowsource; map->second_rowsource = second_rowsource; map->variables_count = count; map->defined_in_map = RASQAL_CALLOC(int*, RASQAL_GOOD_CAST(size_t, 2 * count), sizeof(int)); if(!map->defined_in_map) { RASQAL_FREE(rasqal_row_compatible, map); return NULL; } for(i = 0; i < count; i++) { rasqal_variable *v; int offset1; int offset2; v = rasqal_variables_table_get(vt, i); offset1 = rasqal_rowsource_get_variable_offset_by_name(first_rowsource, v->name); offset2 = rasqal_rowsource_get_variable_offset_by_name(second_rowsource, v->name); map->defined_in_map[i<<1] = offset1; map->defined_in_map[1 + (i<<1)] = offset2; if(offset1 >= 0 && offset2 >= 0) map->variables_in_both_rows_count++; } return map; } void rasqal_free_row_compatible(rasqal_row_compatible* map) { if(!map) return; RASQAL_FREE(intarray, map->defined_in_map); RASQAL_FREE(rasqal_row_compatible, map); } /** * rasqal_row_compatible_check: * @map: row compatible map object * @first_row: first row * @second_row: second row * * Test if two rows have SPARQL Algebra "Compatible Mappings" * * "Two solution mappings μ1 and μ2 are compatible if, for every * variable v in dom(μ1) and in dom(μ2), μ1(v) = μ2(v)." * -- SPARQL Query Language 20080115, 12.3 Basic Graph Patterns * * interpretation: * for all variables in both rows * the values for both rows must either * a) be the same defined value * b) both be undefined */ int rasqal_row_compatible_check(rasqal_row_compatible* map, rasqal_row *first_row, rasqal_row *second_row) { int i; int count = map->variables_count; int compatible = 1; /* If no variables in common, always compatible */ if(!map->variables_in_both_rows_count) return 1; for(i = 0; i < count; i++) { #ifdef RASQAL_DEBUG rasqal_variable *v = rasqal_variables_table_get(map->variables_table, i); const unsigned char *name = v->name; #endif rasqal_literal *first_value = NULL; rasqal_literal *second_value = NULL; int offset1 = map->defined_in_map[i<<1]; int offset2 = map->defined_in_map[1 + (i<<1)]; if(offset1 >= 0) first_value = first_row->values[offset1]; if(offset2 >= 0) second_value = second_row->values[offset2]; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG5("row variable #%d - %s has first row offset #%d second row offset #%d\n", i, name, offset1, offset2); #endif /* do not test if both are NULL */ if(!first_value && !second_value) continue; if(!first_value || !second_value) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("row variable #%d - %s has (one NULL, one value)\n", i, name); #endif /* compatible if one is NULL and the other is not */ continue; } if(!rasqal_literal_equals(first_value, second_value)) { RASQAL_DEBUG3("row variable #%d - %s has different values\n", i, name); /* incompatible if not equal values */ compatible = 0; break; } else { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("row variable #%d - %s has same values\n", i, name); #endif } } return compatible; } void rasqal_print_row_compatible(FILE *handle, rasqal_row_compatible* map) { int count = map->variables_count; rasqal_variables_table* vt = map->variables_table; int i; char left_rs[4]; char right_rs[4]; fprintf(handle, "Row compatible map: total variables: %d shared variables: %d\n", count, map->variables_in_both_rows_count); for(i = 0; i < count; i++) { rasqal_variable *v = rasqal_variables_table_get(vt, i); int offset1 = map->defined_in_map[i<<1]; int offset2 = map->defined_in_map[1 + (i<<1)]; if(offset1 < 0) *left_rs='\0'; else sprintf(left_rs, "%2d", offset1); if(offset2 < 0) *right_rs='\0'; else sprintf(right_rs, "%2d", offset2); fprintf(handle, " Variable %10s offsets left RS: %-3s right RS: %-3s %s\n", v->name, left_rs, right_rs, ((offset1 >=0 && offset2 >= 0) ? "SHARED" : "")); } } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); #define EXPECTED_ROWS_COUNT 4 const char* const compatible_data_abc_rows[] = { /* 3 variable names and 4 rows */ "a", NULL, "b", NULL, "c", NULL, /* row 1 data - match on b, c : COMPATIBLE */ "purple", NULL, "blue", NULL, "red", NULL, /* row 2 data - match on b, not c: INCOMPATIBLE */ "purple", NULL, "blue", NULL, "red", NULL, /* row 3 data - match on b, NULL c: COMPATIBLE */ "purple", NULL, "red", NULL, NULL, NULL, /* row 4 data - NULL b, NULL c: COMPATIBLE */ "purple", NULL, NULL, NULL, NULL, NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, }; const char* const compatible_data_abcd_rows[] = { /* 3 variable names and 4 rows */ "b", NULL, "c", NULL, "d", NULL, /* row 1 data - match on b,c: COMPATIBLE */ "blue", NULL, "red", NULL, "yellow", NULL, /* row 2 data - match on b, not on c: INCOMPATIBLE */ "red", NULL, "green", NULL, "yellow", NULL, /* row 3 data - match on b, NULL c: COMPATIBLE */ "red", NULL, NULL, NULL, "yellow", NULL, /* row 4 data - NULL b, NULL c: COMPATIBLE */ NULL, NULL, NULL, NULL, "yellow", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL }; const int expected_compatible_results[EXPECTED_ROWS_COUNT]= { 1, 0, 1, 1 }; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_rowsource *left_rs = NULL; rasqal_rowsource *right_rs = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; raptor_sequence* seq = NULL; int failures = 0; int vars_count; rasqal_variables_table* vt; raptor_sequence* vars_seq = NULL; rasqal_row_compatible* rc_map = NULL; int i; world = rasqal_new_world(); rasqal_world_open(world); query = rasqal_new_query(world, "sparql", NULL); vt = query->vars_table; /* 3 variables and 4 rows */ vars_count = 3; seq = rasqal_new_row_sequence(world, vt, compatible_data_abc_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create left sequence of %d vars\n", program, vars_count); failures++; goto tidy; } left_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!left_rs) { fprintf(stderr, "%s: failed to create left rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by left_rs */ vars_seq = seq = NULL; /* 3 variables and 4 rows */ vars_count = 3; seq = rasqal_new_row_sequence(world, vt, compatible_data_abcd_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create right sequence of %d rows\n", program, vars_count); failures++; goto tidy; } right_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!right_rs) { fprintf(stderr, "%s: failed to create right rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by right_rs */ vars_seq = seq = NULL; rc_map = rasqal_new_row_compatible(vt, left_rs, right_rs); if(!rc_map) { fprintf(stderr, "%s: failed to create row compatible\n", program); failures++; goto tidy; } rasqal_print_row_compatible(stderr, rc_map); #ifdef RASQAL_DEBUG fputs("\n", stderr); #endif for(i = 0; i < EXPECTED_ROWS_COUNT; i++) { rasqal_row *left_row = rasqal_rowsource_read_row(left_rs); rasqal_row *right_row = rasqal_rowsource_read_row(right_rs); int expected = expected_compatible_results[i]; int compatible; if(!left_row) { fprintf(stderr, "%s: FAILED left rowsource ended early at row #%d\n", program, i); failures++; goto tidy; } if(!right_row) { fprintf(stderr, "%s: FAILED right rowsource ended early at row #%d\n", program, i); failures++; goto tidy; } compatible = rasqal_row_compatible_check(rc_map, left_row, right_row); RASQAL_DEBUG4("%s: compatible check for row #%d returned %d\n", program, i, compatible); if(compatible != expected) { fprintf(stderr, "%s: FAILED compatible check for row #%d returned %d expected %d\n", program, i, compatible, expected); failures++; } #ifdef RASQAL_DEBUG fputs("\n", stderr); #endif if(left_row) rasqal_free_row(left_row); if(right_row) rasqal_free_row(right_row); } tidy: if(rc_map) rasqal_free_row_compatible(rc_map); if(seq) raptor_free_sequence(seq); if(left_rs) rasqal_free_rowsource(left_rs); if(right_rs) rasqal_free_rowsource(right_rs); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/win32_rasqal_config.h0000644000175000017500000000710612443715244014616 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * win32_config.h - Rasqal WIN32 hard-coded config * * Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * */ #ifndef WIN32_CONFIG_H #define WIN32_CONFIG_H #ifdef __cplusplus extern "C" { #endif #define WIN32_LEAN_AND_MEAN 1 #include /* getopt is not in standard win32 C library - define if we have it */ /* #define HAVE_GETOPT_H 1 */ #define HAVE_STDLIB_H 1 #define HAVE_ERRNO_H 1 #define HAVE_STRICMP 1 /* MS names for these functions */ // next line breaks build on wntmsci12 //#define vsnprintf _vsnprintf #define snprintf _snprintf #define access _access #define stricmp _stricmp #define strnicmp _strnicmp /* definition from winsock2.h */ #ifndef _TIMEVAL_DEFINED #define _TIMEVAL_DEFINED typedef struct timeval { long tv_sec; long tv_usec; } timeval; #endif struct timezone { int tz_minuteswest; /* minutes West of Greenwich */ int tz_dsttime; /* type of dst correction */ }; int rasqal_gettimeofday(struct timeval *tv, struct timezone *tz); #undef HAVE_GETTIMEOFDAY #include #define isnan(n) _isnan(n) /* no round function available */ #define round(x) floor(x+0.5) /* These are SPARQL token definitions */ #ifdef OPTIONAL #undef OPTIONAL #endif #ifdef DELETE #undef DELETE #endif #ifdef IN #undef IN #endif #ifdef GROUP #undef GROUP #endif #define HAVE_C99_VSNPRINTF 1 /* for access() which is POSIX but doesn't seem to have the defines in VC */ #ifndef R_OK #define R_OK 4 #endif /* __func__ doesn't exist in Visual Studio 6 */ #define __func__ "" /* * Defines that come from config.h */ #include #include /* Release version as a decimal */ #define RASQAL_VERSION 933 /* Version number of package */ #define RASQAL_VERSION_STRING "0.9.33" /* Major version number */ #define RASQAL_VERSION_MAJOR 0 /* Minor version number */ #define RASQAL_VERSION_MINOR 9 /* Release version number */ #define RASQAL_VERSION_RELEASE 33 /* This is a SPARQL token define */ #ifdef OPTIONAL #undef OPTIONAL #endif /* bison: output uses ERROR in an enum which breaks if this is defined */ #ifdef ERROR #undef ERROR #endif /* flex: const is available */ #define YY_USE_CONST /* looks like the .c files define this anyway */ /* #define YY_NO_UNISTD_H */ #undef RASQAL_INLINE #define RASQAL_INLINE __inline /* Building SPARQL query */ #define RASQAL_QUERY_SPARQL 1 /* Use raptor to provide triples */ #define RAPTOR_TRIPLES_SOURCE_RAPTOR 1 /* Use redland to provide triples */ /* #define RAPTOR_TRIPLES_SOURCE_REDLAND 1 */ /* Use PCRE regex library */ //#define RASQAL_REGEX_PCRE 1 #define HAVE_LIBXML_SCHEMASINTERNALS_H 1 #define HAVE_LIBXML_XMLSCHEMASTYPES_H 1 #define HAVE_LIBXML_XMLSCHEMAS_H 1 #define RASQAL_DECIMAL_NONE 1 #define RASQAL_UUID_INTERNAL 1 #define RASQAL_DIGEST_INTERNAL 1 #ifdef _DEBUG #define RASQAL_DEBUG 1 #endif #ifdef __cplusplus } #endif #endif rasqal-0.9.33/src/rasqal_algebra.c0000644000175000017500000022255412435141254013720 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_algebra.c - Rasqal algebra class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE static rasqal_algebra_node* rasqal_algebra_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp); /* * rasqal_new_algebra_node: * @query: #rasqal_algebra_node query object * @op: enum #rasqal_algebra_operator operator * * INTERNAL - Create a new algebra object. * * Return value: a new #rasqal_algebra object or NULL on failure **/ static rasqal_algebra_node* rasqal_new_algebra_node(rasqal_query* query, rasqal_algebra_node_operator op) { rasqal_algebra_node* node; if(!query) return NULL; node = RASQAL_CALLOC(rasqal_algebra_node*, 1, sizeof(*node)); if(!node) return NULL; node->op = op; node->query = query; return node; } /* * rasqal_new_filter_algebra_node: * @query: #rasqal_query query object * @expr: FILTER expression * @node: algebra node being filtered (or NULL) * * INTERNAL - Create a new algebra node for an expression over a node * * expr and node become owned by the new node. The @node may be NULL * which means that the logical input/output is a row with no bindings. * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_filter_algebra_node(rasqal_query* query, rasqal_expression* expr, rasqal_algebra_node* node) { rasqal_algebra_node* new_node; if(!query || !expr) goto fail; new_node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_FILTER); if(new_node) { new_node->expr = expr; new_node->node1 = node; return new_node; } fail: if(expr) rasqal_free_expression(expr); if(node) rasqal_free_algebra_node(node); return NULL; } /* * rasqal_new_triples_algebra_node: * @query: #rasqal_query query object * @triples: triples sequence (SHARED) (or NULL for empty BGP) * @start_column: first triple * @end_column: last triple * * INTERNAL - Create a new algebra node for Basic Graph Pattern * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_triples_algebra_node(rasqal_query* query, raptor_sequence* triples, int start_column, int end_column) { rasqal_algebra_node* node; if(!query) return NULL; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_BGP); if(!node) return NULL; node->triples = triples; if(!triples) { start_column= -1; end_column= -1; } node->start_column = start_column; node->end_column = end_column; return node; } /* * rasqal_new_empty_algebra_node: * @query: #rasqal_query query object * * INTERNAL - Create a new empty algebra node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_empty_algebra_node(rasqal_query* query) { rasqal_algebra_node* node; if(!query) return NULL; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_BGP); if(!node) return NULL; node->triples = NULL; node->start_column= -1; node->end_column= -1; return node; } /* * rasqal_new_2op_algebra_node: * @query: #rasqal_query query object * @op: operator * @node1: 1st algebra node * @node2: 2nd algebra node (pr NULL for #RASQAL_ALGEBRA_OPERATOR_TOLIST only) * * INTERNAL - Create a new algebra node for 1 or 2 graph patterns * * node1 and node2 become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_2op_algebra_node(rasqal_query* query, rasqal_algebra_node_operator op, rasqal_algebra_node* node1, rasqal_algebra_node* node2) { rasqal_algebra_node* node; if(!query || !node1) goto fail; if(op != RASQAL_ALGEBRA_OPERATOR_TOLIST && !node2) goto fail; node = rasqal_new_algebra_node(query, op); if(node) { node->node1 = node1; node->node2 = node2; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(node2) rasqal_free_algebra_node(node2); return NULL; } /* * rasqal_new_leftjoin_algebra_node: * @query: #rasqal_query query object * @node1: 1st algebra node * @node2: 2nd algebra node * @expr: expression * * INTERNAL - Create a new LEFTJOIN algebra node for 2 graph patterns * * node1, node2 and expr become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_leftjoin_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, rasqal_algebra_node* node2, rasqal_expression* expr) { rasqal_algebra_node* node; if(!query || !node1 || !node2 || !expr) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_LEFTJOIN); if(node) { node->node1 = node1; node->node2 = node2; node->expr = expr; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(node2) rasqal_free_algebra_node(node2); if(expr) rasqal_free_expression(expr); return NULL; } /* * rasqal_new_orderby_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @seq: sequence of order condition #rasqal_expression * @distinct: distinct flag * * INTERNAL - Create a new ORDERBY algebra node for a sequence of order conditions (with optional DISTINCTness) * * #node and #seq become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_orderby_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* seq, int distinct) { rasqal_algebra_node* node; if(!query || !node1 || !seq || !raptor_sequence_size(seq)) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_ORDERBY); if(node) { node->node1 = node1; node->seq = seq; node->distinct = distinct; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(seq) raptor_free_sequence(seq); return NULL; } /* * rasqal_new_slice_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @limit: max rows limit (or <0 for no limit) * @offset: start row offset (or <0 for no offset) * * INTERNAL - Create a new SLICE algebra node for selecting a range of rows * * #node and #seq become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_slice_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, int limit, int offset) { rasqal_algebra_node* node; if(!query || !node1) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_SLICE); if(node) { node->node1 = node1; node->limit = limit; node->offset = offset; return node; } fail: if(node1) rasqal_free_algebra_node(node1); return NULL; } /* * rasqal_new_project_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @vars_seq: sequence of variables * * INTERNAL - Create a new PROJECT algebra node for a sequence of variables over an inner node * * The inputs @node and @seq become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_project_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* vars_seq) { rasqal_algebra_node* node; if(!query || !node1 || !vars_seq) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_PROJECT); if(node) { node->node1 = node1; node->vars_seq = vars_seq; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(vars_seq) raptor_free_sequence(vars_seq); return NULL; } /* * rasqal_new_distinct_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * * INTERNAL - Create a new DISTINCT algebra node for an inner node * * The input @node becomes owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_distinct_algebra_node(rasqal_query* query, rasqal_algebra_node* node1) { rasqal_algebra_node* node; if(!query || !node1) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_DISTINCT); if(node) { node->node1 = node1; return node; } fail: if(node1) rasqal_free_algebra_node(node1); return NULL; } /* * rasqal_new_graph_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @graph: graph literal * * INTERNAL - Create a new GRAPH algebra node over an inner node * * The inputs @node1 and @graph become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_graph_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, rasqal_literal *graph) { rasqal_algebra_node* node; if(!query || !node1 || !graph) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_GRAPH); if(node) { node->node1 = node1; node->graph = graph; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(graph) rasqal_free_literal(graph); return NULL; } /* * rasqal_new_assignment_algebra_node: * @query: #rasqal_query query object * @var: variable * @expr: expression * * INTERNAL - Create a new LET algebra node over a variable and expression * * The input @expr becomes owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_assignment_algebra_node(rasqal_query* query, rasqal_variable *var, rasqal_expression *expr) { rasqal_algebra_node* node; if(!query || !var || !expr) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_ASSIGN); if(node) { node->var = var; node->expr = expr; return node; } fail: if(expr) rasqal_free_expression(expr); return NULL; } /* * rasqal_new_groupby_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @seq: sequence of order condition #rasqal_expression * * INTERNAL - Create a new GROUP algebra node for a sequence of GROUP BY conditions * * #node and #seq become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_groupby_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* seq) { rasqal_algebra_node* node; if(!query || !node1 || !seq || !raptor_sequence_size(seq)) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_GROUP); if(node) { node->node1 = node1; node->seq = seq; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(seq) raptor_free_sequence(seq); return NULL; } /* * rasqal_new_aggregation_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @exprs_seq: sequence of #rasqal_expression * @vars_seq: sequence of #rasqal_sequence * * INTERNAL - Create a new AGGREGATION algebra node for a query over a sequence of expressions to variables * * On construction @node1, @exprs_seq and @vars_seq become owned by * the new node. * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_aggregation_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* exprs_seq, raptor_sequence* vars_seq) { rasqal_algebra_node* node; if(!query || !node1 || !exprs_seq || !vars_seq) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_AGGREGATION); if(node) { node->node1 = node1; node->seq = exprs_seq; node->vars_seq = vars_seq; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(exprs_seq) raptor_free_sequence(exprs_seq); if(vars_seq) raptor_free_sequence(vars_seq); return NULL; } /* * rasqal_new_having_algebra_node: * @query: #rasqal_query query object * @node1: inner algebra node * @exprs_seq: sequence of variables * * INTERNAL - Create a new HAVING algebra node for a sequence of expressions over an inner node * * The inputs @node and @exprs_seq become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_having_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* exprs_seq) { rasqal_algebra_node* node; if(!query || !node1 || !exprs_seq) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_HAVING); if(node) { node->node1 = node1; node->seq = exprs_seq; return node; } fail: if(node1) rasqal_free_algebra_node(node1); if(exprs_seq) raptor_free_sequence(exprs_seq); return NULL; } /* * rasqal_new_values_algebra_node: * @query: #rasqal_query query object * @bindings: variable bindings * * INTERNAL - Create a new VALUES algebra node for a binidngs * * The input @bindings become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_values_algebra_node(rasqal_query* query, rasqal_bindings* bindings) { rasqal_algebra_node* node; if(!query || !bindings) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_VALUES); if(node) { node->bindings = bindings; return node; } fail: if(bindings) rasqal_free_bindings(bindings); return NULL; } /* * rasqal_new_service_algebra_node: * @query: #rasqal_query query object * @service_uri: service URI * @query_string: query string to send to the service * @data_graphs: sequence of #rasqal_data_graph (or NULL) * @silent: silent flag * * INTERNAL - Create a new SERVICE algebra node for a sequence of expressions over an inner node * * The inputs @service_uri, @query_string, and @data_graphs become owned by the new node * * Return value: a new #rasqal_algebra_node object or NULL on failure **/ rasqal_algebra_node* rasqal_new_service_algebra_node(rasqal_query* query, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs, int silent) { rasqal_algebra_node* node; if(!query || !service_uri || !query_string) goto fail; node = rasqal_new_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_SERVICE); if(node) { node->service_uri = service_uri; node->query_string = query_string; node->data_graphs = data_graphs; node->flags = (silent ? RASQAL_ENGINE_BITFLAG_SILENT : 0); return node; } fail: if(service_uri) raptor_free_uri(service_uri); if(query_string) RASQAL_FREE(cstring, query_string); if(data_graphs) raptor_free_sequence(data_graphs); return NULL; } /* * rasqal_free_algebra_node: * @gp: #rasqal_algebra_node object * * INTERNAL - Free an algebra node object. * **/ void rasqal_free_algebra_node(rasqal_algebra_node* node) { if(!node) return; /* node->triples is SHARED with the query - not freed here */ if(node->node1) rasqal_free_algebra_node(node->node1); if(node->node2) rasqal_free_algebra_node(node->node2); if(node->expr) rasqal_free_expression(node->expr); if(node->seq) raptor_free_sequence(node->seq); if(node->vars_seq) raptor_free_sequence(node->vars_seq); if(node->graph) rasqal_free_literal(node->graph); if(node->var) rasqal_free_variable(node->var); if(node->bindings) rasqal_free_bindings(node->bindings); if(node->service_uri) raptor_free_uri(node->service_uri); if(node->query_string) RASQAL_FREE(cstring, node->query_string); if(node->data_graphs) raptor_free_sequence(node->data_graphs); RASQAL_FREE(rasqal_algebra, node); } /** * rasqal_algebra_node_get_operator: * @algebra_node: #rasqal_algebra_node algebra node object * * Get the algebra node operator . * * The operator for the given algebra node. See also * rasqal_algebra_node_operator_as_counted_string(). * * Return value: algebra node operator **/ rasqal_algebra_node_operator rasqal_algebra_node_get_operator(rasqal_algebra_node* node) { return node->op; } static struct { const char* const label; size_t length; } rasqal_algebra_node_operator_labels[RASQAL_ALGEBRA_OPERATOR_LAST + 1] = { { "UNKNOWN", 7 }, { "BGP" , 3 }, { "Filter", 6 }, { "Join", 4 }, { "Diff", 4 }, { "LeftJoin", 8 }, { "Union", 5 }, { "ToList", 6 }, { "OrderBy", 7 }, { "Project", 7 }, { "Distinct", 8 }, { "Reduced", 7 }, { "Slice", 5 }, { "Graph", 5 }, { "Assignment", 10 }, { "Group", 5 }, { "Aggregate", 9 }, { "Having", 6 }, { "Values", 6 }, { "Service", 7 } }; /** * rasqal_algebra_node_operator_as_counted_string: * @op: the #rasqal_algebra_node_operator verb of the query * @length_p: pointer to store the length (or NULL) * * INTERNAL - Get a counted string for the query verb. * * Return value: pointer to a shared string label for the query verb **/ const char* rasqal_algebra_node_operator_as_counted_string(rasqal_algebra_node_operator op, size_t* length_p) { if(op <= RASQAL_ALGEBRA_OPERATOR_UNKNOWN || op > RASQAL_ALGEBRA_OPERATOR_LAST) op = RASQAL_ALGEBRA_OPERATOR_UNKNOWN; if(length_p) *length_p = rasqal_algebra_node_operator_labels[RASQAL_GOOD_CAST(int, op)].length; return rasqal_algebra_node_operator_labels[RASQAL_GOOD_CAST(int, op)].label; } #define SPACES_LENGTH 80 static const char spaces[SPACES_LENGTH+1] = " "; static void rasqal_algebra_write_indent(raptor_iostream *iostr, unsigned int indent) { while(indent) { unsigned int sp = (indent > SPACES_LENGTH) ? SPACES_LENGTH : indent; raptor_iostream_write_bytes(spaces, sizeof(char), sp, iostr); indent -= sp; } } static int rasqal_algebra_algebra_node_write_internal(rasqal_algebra_node *node, raptor_iostream* iostr, unsigned int indent) { const char* op_string; size_t op_length; int arg_count = 0; unsigned int indent_delta; op_string = rasqal_algebra_node_operator_as_counted_string(node->op, &op_length); if(node->op == RASQAL_ALGEBRA_OPERATOR_BGP && !node->triples) { raptor_iostream_write_byte('Z', iostr); return 0; } raptor_iostream_counted_string_write(op_string, op_length, iostr); raptor_iostream_counted_string_write("(\n", 2, iostr); indent_delta = RASQAL_GOOD_CAST(unsigned int, op_length) + 1; indent += indent_delta; rasqal_algebra_write_indent(iostr, indent); if(node->op == RASQAL_ALGEBRA_OPERATOR_BGP) { int i; for(i = node->start_column; i <= node->end_column; i++) { rasqal_triple *t; t = (rasqal_triple*)raptor_sequence_get_at(node->triples, i); if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } rasqal_triple_write(t, iostr); arg_count++; } } if(node->node1) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } rasqal_algebra_algebra_node_write_internal(node->node1, iostr, indent); arg_count++; if(node->node2) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } rasqal_algebra_algebra_node_write_internal(node->node2, iostr, indent); arg_count++; } } /* look for assignment var */ if(node->var) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } rasqal_variable_write(node->var, iostr); arg_count++; } /* look for FILTER expression */ if(node->expr) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } rasqal_expression_write(node->expr, iostr); arg_count++; } if(node->seq && node->op == RASQAL_ALGEBRA_OPERATOR_ORDERBY) { int order_size = raptor_sequence_size(node->seq); if(order_size) { int i; if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } raptor_iostream_counted_string_write("Conditions([ ", 13, iostr); for(i = 0; i < order_size; i++) { rasqal_expression* e; e = (rasqal_expression*)raptor_sequence_get_at(node->seq, i); if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_expression_write(e, iostr); arg_count++; } raptor_iostream_counted_string_write(" ])", 3, iostr); } } if(node->vars_seq && node->op == RASQAL_ALGEBRA_OPERATOR_PROJECT) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } raptor_iostream_counted_string_write("Variables([ ", 12, iostr); rasqal_variables_write(node->vars_seq, iostr); arg_count += raptor_sequence_size(node->vars_seq); raptor_iostream_counted_string_write(" ])", 3, iostr); } if(node->op == RASQAL_ALGEBRA_OPERATOR_SLICE) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } raptor_iostream_string_write("slice limit ", iostr); raptor_iostream_decimal_write(RASQAL_GOOD_CAST(int, node->limit), iostr); raptor_iostream_string_write(" offset ", iostr); raptor_iostream_decimal_write(RASQAL_GOOD_CAST(int, node->offset), iostr); raptor_iostream_write_byte('\n', iostr); arg_count++; } if(node->op == RASQAL_ALGEBRA_OPERATOR_GRAPH) { if(arg_count) { raptor_iostream_counted_string_write(" ,\n", 3, iostr); rasqal_algebra_write_indent(iostr, indent); } raptor_iostream_string_write("origin ", iostr); rasqal_literal_write(node->graph, iostr); raptor_iostream_write_byte('\n', iostr); } raptor_iostream_write_byte('\n', iostr); indent-= indent_delta; rasqal_algebra_write_indent(iostr, indent); raptor_iostream_write_byte(')', iostr); return 0; } int rasqal_algebra_algebra_node_write(rasqal_algebra_node *node, raptor_iostream* iostr) { return rasqal_algebra_algebra_node_write_internal(node, iostr, 0); } /** * rasqal_algebra_node_print: * @gp: the #rasqal_algebra_node object * @fh: the FILE* handle to print to * * Print a #rasqal_algebra_node in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_algebra_node_print(rasqal_algebra_node* node, FILE* fh) { raptor_iostream* iostr; iostr = raptor_new_iostream_to_file_handle(node->query->world->raptor_world_ptr, fh); rasqal_algebra_algebra_node_write(node, iostr); raptor_free_iostream(iostr); return 0; } /** * rasqal_algebra_node_visit: * @query: #rasqal_query to operate on * @node: #rasqal_algebra_node graph pattern * @fn: pointer to function to apply that takes user data and graph pattern parameters * @user_data: user data for applied function * * Visit a user function over a #rasqal_algebra_node * * If the user function @fn returns 0, the visit is truncated. * * Return value: 0 if the visit was truncated. **/ int rasqal_algebra_node_visit(rasqal_query *query, rasqal_algebra_node* node, rasqal_algebra_node_visit_fn fn, void *user_data) { int result; result = fn(query, node, user_data); if(result) return result; if(node->node1) { result = rasqal_algebra_node_visit(query, node->node1, fn, user_data); if(result) return result; } if(node->node2) { result = rasqal_algebra_node_visit(query, node->node2, fn, user_data); if(result) return result; } return 0; } static rasqal_algebra_node* rasqal_algebra_basic_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_algebra_node* node = NULL; rasqal_expression* fs = NULL; node = rasqal_new_triples_algebra_node(query, rasqal_query_get_triple_sequence(query), gp->start_column, gp->end_column); if(!node) goto fail; if(gp->filter_expression) { fs = rasqal_new_expression_from_expression(gp->filter_expression); if(!fs) { RASQAL_DEBUG1("rasqal_new_expression_from_expression() failed\n"); goto fail; } node = rasqal_new_filter_algebra_node(query, fs, node); fs = NULL; /* now owned by node */ if(!node) { RASQAL_DEBUG1("rasqal_new_filter_algebra_node() failed\n"); goto fail; } } return node; fail: if(node) rasqal_free_algebra_node(node); return NULL; } static rasqal_algebra_node* rasqal_algebra_filter_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_algebra_node* node = NULL; rasqal_expression* e; e = rasqal_new_expression_from_expression(gp->filter_expression); if(!e) { RASQAL_DEBUG1("rasqal_new_expression_from_expression() failed\n"); return NULL; } node = rasqal_new_filter_algebra_node(query, e, NULL); e = NULL; /* now owned by node */ if(!node) { RASQAL_DEBUG1("rasqal_new_filter_algebra_node() failed\n"); } return node; } static rasqal_algebra_node* rasqal_algebra_union_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { int idx = 0; rasqal_algebra_node* node = NULL; while(1) { rasqal_graph_pattern* sgp; rasqal_algebra_node* gnode; sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, idx); if(!sgp) break; gnode = rasqal_algebra_graph_pattern_to_algebra(query, sgp); if(!gnode) { RASQAL_DEBUG1("rasqal_algebra_graph_pattern_to_algebra() failed\n"); goto fail; } if(!node) node = gnode; else { node = rasqal_new_2op_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_UNION, node, gnode); if(!node) { RASQAL_DEBUG1("rasqal_new_2op_algebra_node() failed\n"); goto fail; } } idx++; } return node; fail: if(node) rasqal_free_algebra_node(node); return NULL; } /* * Takes a reference to @bindings */ static rasqal_algebra_node* rasqal_algebra_bindings_to_algebra(rasqal_query* query, rasqal_bindings* bindings) { rasqal_algebra_node* node; bindings = rasqal_new_bindings_from_bindings(bindings); node = rasqal_new_values_algebra_node(query, bindings); return node; } static rasqal_algebra_node* rasqal_algebra_values_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_algebra_node* node; node = rasqal_algebra_bindings_to_algebra(query, gp->bindings); return node; } /* * rasqal_algebra_new_boolean_constant_expr: * @query: query object * @value: boolean constant * * INTERNAL - Create a new expression for a boolean constant (true/false) * * Return value: new expression or NULL on failure */ static rasqal_expression* rasqal_algebra_new_boolean_constant_expr(rasqal_query* query, int value) { rasqal_literal *true_lit; true_lit = rasqal_new_boolean_literal(query->world, value); if(!true_lit) { RASQAL_DEBUG1("rasqal_new_boolean_literal() failed\n"); return NULL; } return rasqal_new_literal_expression(query->world, true_lit); } static rasqal_algebra_node* rasqal_algebra_group_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { int idx = 0; /* Let FS := the empty set */ rasqal_expression* fs = NULL; /* Let G := the empty pattern, Z, a basic graph pattern which * is the empty set. */ rasqal_algebra_node* gnode = NULL; gnode = rasqal_new_empty_algebra_node(query); if(!gnode) { RASQAL_DEBUG1("rasqal_new_empty_algebra_node() failed\n"); goto fail; } for(idx = 0; 1; idx++) { rasqal_graph_pattern* egp; egp = rasqal_graph_pattern_get_sub_graph_pattern(gp, idx); if(!egp) break; if(egp->op == RASQAL_GRAPH_PATTERN_OPERATOR_FILTER && egp->filter_expression) { /* If E is of the form FILTER(expr) FS := FS set-union {expr} */ rasqal_expression* e; /* add all gp->conditions_sequence to FS */ e = rasqal_new_expression_from_expression(egp->filter_expression); if(!e) { RASQAL_DEBUG1("rasqal_new_expression_from_expression() failed\n"); goto fail; } fs = fs ? rasqal_new_2op_expression(query->world, RASQAL_EXPR_AND, fs, e) : e; if(egp->op == RASQAL_GRAPH_PATTERN_OPERATOR_FILTER) continue; } if(egp->op == RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL) { /* If E is of the form OPTIONAL{P} */ int sgp_idx = 0; int sgp_size = raptor_sequence_size(egp->graph_patterns); /* walk through all optionals */ for(sgp_idx = 0; sgp_idx < sgp_size; sgp_idx++) { rasqal_graph_pattern* sgp; rasqal_algebra_node* anode; sgp = rasqal_graph_pattern_get_sub_graph_pattern(egp, sgp_idx); /* Let A := Transform(P) */ anode = rasqal_algebra_graph_pattern_to_algebra(query, sgp); if(!anode) { RASQAL_DEBUG1("rasqal_algebra_graph_pattern_to_algebra() failed\n"); goto fail; } if(anode->op == RASQAL_ALGEBRA_OPERATOR_FILTER) { rasqal_expression* f_expr = anode->expr; rasqal_algebra_node *a2node = anode->node1; /* If A is of the form Filter(F, A2) G := LeftJoin(G, A2, F) */ gnode = rasqal_new_leftjoin_algebra_node(query, gnode, a2node, f_expr); anode->expr = NULL; anode->node1 = NULL; rasqal_free_algebra_node(anode); if(!gnode) { RASQAL_DEBUG1("rasqal_new_leftjoin_algebra_node() failed\n"); goto fail; } } else { rasqal_expression *true_expr = NULL; true_expr = rasqal_algebra_new_boolean_constant_expr(query, 1); if(!true_expr) { rasqal_free_algebra_node(anode); goto fail; } /* G := LeftJoin(G, A, true) */ gnode = rasqal_new_leftjoin_algebra_node(query, gnode, anode, true_expr); if(!gnode) { RASQAL_DEBUG1("rasqal_new_leftjoin_algebra_node() failed\n"); goto fail; } true_expr = NULL; /* now owned by gnode */ } } /* end for all optional */ } else { /* If E is any other form:*/ rasqal_algebra_node* anode; /* Let A := Transform(E) */ anode = rasqal_algebra_graph_pattern_to_algebra(query, egp); if(!anode) { RASQAL_DEBUG1("rasqal_algebra_graph_pattern_to_algebra() failed\n"); goto fail; } /* G := Join(G, A) */ gnode = rasqal_new_2op_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_JOIN, gnode, anode); if(!gnode) { RASQAL_DEBUG1("rasqal_new_2op_algebra_node() failed\n"); goto fail; } } } /* If FS is not empty: Let X := Conjunction of expressions in FS G := Filter(X, G) The result is G. */ if(fs) { gnode = rasqal_new_filter_algebra_node(query, fs, gnode); fs = NULL; /* now owned by gnode */ if(!gnode) { RASQAL_DEBUG1("rasqal_new_filter_algebra_node() failed\n"); goto fail; } } if(gnode) return gnode; fail: if(gnode) rasqal_free_algebra_node(gnode); if(fs) rasqal_free_expression(fs); return NULL; } static rasqal_algebra_node* rasqal_algebra_graph_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_literal *graph = NULL; rasqal_graph_pattern* sgp; rasqal_algebra_node* gnode; if(gp->origin) graph = rasqal_new_literal_from_literal(gp->origin); sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, 0); if(!sgp) goto fail; gnode = rasqal_algebra_graph_pattern_to_algebra(query, sgp); if(!gnode) { RASQAL_DEBUG1("rasqal_algebra_graph_graph_pattern_to_algebra() failed\n"); goto fail; } return rasqal_new_graph_algebra_node(query, gnode, graph); fail: if(graph) rasqal_free_literal(graph); return NULL; } static rasqal_algebra_node* rasqal_algebra_let_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_expression *expr; expr = rasqal_new_expression_from_expression(gp->filter_expression); if(expr) return rasqal_new_assignment_algebra_node(query, gp->var, expr); return NULL; } static rasqal_algebra_node* rasqal_algebra_select_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_projection* projection; rasqal_solution_modifier* modifier; rasqal_graph_pattern* where_gp; rasqal_algebra_node* where_node; rasqal_algebra_node* node; rasqal_algebra_aggregate* ae; rasqal_bindings* bindings; where_gp = rasqal_graph_pattern_get_sub_graph_pattern(gp, 0); projection = gp->projection; modifier = gp->modifier; bindings = gp->bindings; where_node = rasqal_algebra_graph_pattern_to_algebra(query, where_gp); if(!where_node) goto fail; node = rasqal_algebra_query_add_group_by(query, where_node, modifier); where_node = NULL; /* now owned by node */ if(!node) goto fail; ae = rasqal_algebra_query_prepare_aggregates(query, node, projection, modifier); if(!ae) goto fail; if(ae) { node = rasqal_algebra_query_add_aggregation(query, ae, node); ae = NULL; if(!node) goto fail; } node = rasqal_algebra_query_add_having(query, node, modifier); if(!node) goto fail; node = rasqal_algebra_query_add_projection(query, node, projection); if(!node) goto fail; node = rasqal_algebra_query_add_orderby(query, node, projection, modifier); if(!node) goto fail; node = rasqal_algebra_query_add_distinct(query, node, projection); if(!node) goto fail; node = rasqal_algebra_query_add_slice(query, node, modifier); if(!node) goto fail; if(bindings) { rasqal_algebra_node* bindings_node; bindings_node = rasqal_algebra_bindings_to_algebra(query, bindings); if(!bindings_node) { rasqal_free_algebra_node(node); goto fail; } node = rasqal_new_2op_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_JOIN, node, bindings_node); } return node; fail: return NULL; } static rasqal_algebra_node* rasqal_algebra_service_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_algebra_node* node = NULL; raptor_uri* service_uri = NULL; raptor_sequence* data_graphs = NULL; rasqal_graph_pattern* inner_gp; char* string = NULL; raptor_iostream *iostr = NULL; service_uri = rasqal_literal_as_uri(gp->origin); if(!service_uri) goto fail; inner_gp = rasqal_graph_pattern_get_sub_graph_pattern(gp, 0); if(!inner_gp) goto fail; iostr = raptor_new_iostream_to_string(query->world->raptor_world_ptr, (void**)&string, NULL, rasqal_alloc_memory); if(!iostr) goto fail; rasqal_query_write_sparql_20060406_graph_pattern(inner_gp, iostr, query->base_uri); raptor_free_iostream(iostr); iostr = NULL; RASQAL_DEBUG2("Formatted query string is '%s'", string); node = rasqal_new_service_algebra_node(query, raptor_uri_copy(service_uri), (const unsigned char*)string, data_graphs, gp->silent); string = NULL; if(!node) { RASQAL_DEBUG1("rasqal_new_service_algebra_node() failed\n"); goto fail; } return node; fail: if(string) RASQAL_FREE(char*, string); return node; } static rasqal_algebra_node* rasqal_algebra_graph_pattern_to_algebra(rasqal_query* query, rasqal_graph_pattern* gp) { rasqal_algebra_node* node = NULL; switch(gp->op) { case RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: node = rasqal_algebra_basic_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_UNION: node = rasqal_algebra_union_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: case RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: node = rasqal_algebra_group_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: node = rasqal_algebra_graph_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_LET: node = rasqal_algebra_let_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_SELECT: node = rasqal_algebra_select_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_FILTER: node = rasqal_algebra_filter_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_VALUES: node = rasqal_algebra_values_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE: node = rasqal_algebra_service_graph_pattern_to_algebra(query, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_MINUS: case RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: default: RASQAL_DEBUG3("Unsupported graph pattern operator %s (%u)\n", rasqal_graph_pattern_operator_as_string(gp->op), gp->op); break; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 if(gp) { RASQAL_DEBUG1("Input gp:\n"); rasqal_graph_pattern_print(gp, stderr); fputc('\n', stderr); } if(node) { RASQAL_DEBUG1("Resulting node:\n"); rasqal_algebra_node_print(node, stderr); fputc('\n', stderr); } #endif /* not STANDALONE */ return node; } /* * rasqal_algebra_node_is_empty: * @node: #rasqal_algebra_node node * * INTERNAL - Check if a an algebra node is empty * * Return value: non-0 if empty **/ int rasqal_algebra_node_is_empty(rasqal_algebra_node* node) { return (node->op == RASQAL_ALGEBRA_OPERATOR_BGP && !node->triples); } static int rasqal_algebra_remove_znodes(rasqal_query* query, rasqal_algebra_node* node, void* data) { int* modified = (int*)data; int is_z1; int is_z2; rasqal_algebra_node *anode; if(!node) return 1; /* Look for join operations with no variable join conditions and see if they * can be merged, when one of node1 or node2 is an empty graph pattern. */ if(node->op != RASQAL_ALGEBRA_OPERATOR_JOIN && node->op != RASQAL_ALGEBRA_OPERATOR_LEFTJOIN) return 0; /* Evaluate if the join condition expression is constant TRUE */ if(node->expr) { rasqal_literal* result; int bresult; int error = 0; if(!rasqal_expression_is_constant(node->expr)) return 0; result = rasqal_expression_evaluate2(node->expr, query->eval_context, &error); if(error) return 0; bresult = rasqal_literal_as_boolean(result, &error); rasqal_free_literal(result); if(error) return 0; if(!bresult) { /* join condition is always FALSE - can never merge - this join * is useless and should be replaced with an empty graph * pattern - FIXME */ return 0; } /* conclusion: join condition is always TRUE - so can merge nodes */ rasqal_free_expression(node->expr); node->expr = NULL; } if(!node->node1 || !node->node2) return 0; /* Look for empty graph patterns */ is_z1 = rasqal_algebra_node_is_empty(node->node1); is_z2 = rasqal_algebra_node_is_empty(node->node2); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Checking node\n"); rasqal_algebra_node_print(node, stderr); fprintf(stderr, "\nNode 1 (%s): %s\n", is_z1 ? "empty" : "not empty", rasqal_algebra_node_operator_as_counted_string(node->node1->op, NULL)); fprintf(stderr, "Node 2 (%s): %s\n", is_z2 ? "empty" : "not empty", rasqal_algebra_node_operator_as_counted_string(node->node2->op, NULL)); #endif if(is_z1 && !is_z2) { /* Replace join(Z, A) by A */ anode = node->node2; /* an empty node has no extra things to free */ RASQAL_FREE(rasqal_algebra_node, node->node1); memcpy(node, anode, sizeof(rasqal_algebra_node)); /* free the node struct memory - contained pointers now owned by node */ RASQAL_FREE(rasqal_algebra_node, anode); *modified = 1; } else if(!is_z1 && is_z2) { /* Replace join(A, Z) by A */ anode = node->node1; /* ditto */ RASQAL_FREE(rasqal_algebra_node, node->node2); memcpy(node, anode, sizeof(rasqal_algebra_node)); RASQAL_FREE(rasqal_algebra_node, anode); *modified = 1; } return 0; } static raptor_sequence* rasqal_algebra_get_variables_mentioned_in(rasqal_query* query, int row_index) { raptor_sequence* seq; /* sequence of rasqal_variable* */ int width; unsigned short *row; int i; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!seq) return NULL; width = rasqal_variables_table_get_total_variables_count(query->vars_table); row = &query->variables_use_map[row_index * width]; for(i = 0; i < width; i++) { rasqal_variable* v; if(!(row[i] & RASQAL_VAR_USE_MENTIONED_HERE)) continue; v = rasqal_variables_table_get(query->vars_table, i); raptor_sequence_push(seq, rasqal_new_variable_from_variable(v)); } return seq; } /** * rasqal_agg_expr_var_compare: * @user_data: comparison user data pointer * @a: pointer to address of first #rasqal_expression * @b: pointer to address of second #rasqal_expression * * INTERNAL - compare two void pointers to #rasqal_expression objects with signature suitable for for #rasqal_map comparison. * * Return value: <0, 0 or >1 comparison */ static int rasqal_agg_expr_var_compare(void* user_data, const void *a, const void *b) { rasqal_algebra_aggregate* ae = (rasqal_algebra_aggregate*)user_data; rasqal_expression* expr_a = (rasqal_expression*)a; rasqal_expression* expr_b = (rasqal_expression*)b; int result = 0; result = rasqal_expression_compare(expr_a, expr_b, ae->flags, &ae->error); return result; } /* * SPEC: * at each node: * if expression contains an aggregate function * is expression is in map? * Yes: * get value => use existing internal variable for it * No: * create a new internal variable for it $$internal{id} * inc id * add it to the map * rewrite expression to use internal variable * */ static int rasqal_algebra_extract_aggregate_expression_visit(void *user_data, rasqal_expression *e) { rasqal_algebra_aggregate* ae = (rasqal_algebra_aggregate*)user_data; rasqal_variable* v; ae->error = 0; /* If not an aggregate expression, ignore it */ if(!rasqal_expression_is_aggregate(e)) return 0; /* is expression is in map? */ v = (rasqal_variable*)rasqal_map_search(ae->agg_vars, e); if(v) { /* Yes: get value => use existing internal variable for it */ RASQAL_DEBUG2("Found variable %s for existing expression\n", v->name); /* add a new reference to v */ v = rasqal_new_variable_from_variable(v); /* convert expression in-situ to use existing internal variable * After this e holds a v reference */ if(rasqal_expression_convert_aggregate_to_variable(e, v, NULL)) { ae->error = 1; return 1; } } else { /* No */ char var_name[20]; rasqal_expression* new_e = NULL; /* Check if a new variable is allowed to be added */ if(ae->adding_new_vars_is_error) { rasqal_log_error_simple(ae->query->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Found new aggregate expression in %s", ae->error_part); ae->error = 1; return 1; } /* If not an error, create a new internal variable name for it * $$agg{id}$$ and add it to the map. */ sprintf(var_name, "$$agg$$%d", ae->counter++); v = rasqal_variables_table_add2(ae->query->vars_table, RASQAL_VARIABLE_TYPE_ANONYMOUS, RASQAL_GOOD_CAST(const unsigned char*, var_name), 0, NULL); if(!v) { ae->error = 1; return 1; } /* convert expression in-situ to use new internal variable * and create a new expression in new_e from the old fields. * * After this one v reference is held by new_e. */ if(rasqal_expression_convert_aggregate_to_variable(e, v, &new_e)) { ae->error = 1; return 1; } v = rasqal_new_variable_from_variable(v); /* new_e is a new reference * after this new_e and 1 v reference are owned by the map */ if(rasqal_map_add_kv(ae->agg_vars, new_e, v)) { ae->error = 1; return 1; } #ifdef RASQAL_DEBUG RASQAL_DEBUG1("after adding new variable, resulting aggregate vars "); rasqal_map_print(ae->agg_vars, stderr); fputc('\n', stderr); #endif new_e = rasqal_new_expression_from_expression(new_e); if(raptor_sequence_push(ae->agg_exprs, new_e)) { ae->error = 1; return 1; } /* add one more v reference for the variables sequence too */ v = rasqal_new_variable_from_variable(v); if(raptor_sequence_push(ae->agg_vars_seq, v)) { ae->error = 1; return 1; } } return 0; } static int rasqal_algebra_extract_aggregate_expressions(rasqal_query* query, rasqal_algebra_node* node, rasqal_algebra_aggregate* ae, rasqal_projection* projection) { raptor_sequence* seq; int i; int rc = 0; rasqal_variable* v; if(!projection) return 0; ae->query = query; /* Initialisation of map (key: rasqal_expression, value: rasqal_variable ) */ ae->agg_vars = rasqal_new_map(/* compare key function */ rasqal_agg_expr_var_compare, /* compare data */ ae, /* free compare data */ NULL, (raptor_data_free_handler)rasqal_free_expression, (raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_expression_print, (raptor_data_print_handler)rasqal_variable_print, /* flags */ 0); /* Sequence to hold list of aggregate expressions */ seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); ae->agg_exprs = seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); ae->agg_vars_seq = seq; /* init internal variable counter */ ae->counter = 0; ae->flags = 0; ae->error = 0; /* * walk each select/project expression recursively and pull out aggregate * expressions into the ae->agg_vars map, replacing them with * internal variable names. */ if ((seq = projection->variables)) { for(i = 0; (v = (rasqal_variable*)raptor_sequence_get_at(seq, i)); i++) { rasqal_expression* expr = v->expression; if(!expr) continue; if(rasqal_expression_visit(expr, rasqal_algebra_extract_aggregate_expression_visit, ae)) { rc = 1; goto tidy; } } } tidy: if(ae->error) rc = 1; return rc; } /** * rasqal_algebra_query_to_algebra: * @query: #rasqal_query to operate on * * Turn a graph pattern into query algebra structure * * Return value: algebra expression or NULL on failure */ rasqal_algebra_node* rasqal_algebra_query_to_algebra(rasqal_query* query) { rasqal_graph_pattern* query_gp; rasqal_algebra_node* node; int modified = 0; query_gp = rasqal_query_get_query_graph_pattern(query); if(!query_gp) return NULL; node = rasqal_algebra_graph_pattern_to_algebra(query, query_gp); if(!node) return NULL; /* FIXME - this does not seem right to be here */ if(query->bindings) { rasqal_algebra_node* bindings_node; bindings_node = rasqal_algebra_bindings_to_algebra(query, query->bindings); if(!bindings_node) { rasqal_free_algebra_node(node); return NULL; } node = rasqal_new_2op_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_JOIN, node, bindings_node); } rasqal_algebra_node_visit(query, node, rasqal_algebra_remove_znodes, &modified); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after remove zones, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif return node; } void rasqal_free_algebra_aggregate(rasqal_algebra_aggregate* ae) { if(!ae) return; if(ae->agg_exprs) raptor_free_sequence(ae->agg_exprs); if(ae->agg_vars) rasqal_free_map(ae->agg_vars); if(ae->agg_vars_seq) raptor_free_sequence(ae->agg_vars_seq); RASQAL_FREE(rasqal_algebra_aggregate, ae); } static int rasqal_algebra_replace_aggregate_expressions(rasqal_query* query, raptor_sequence* exprs_seq, rasqal_algebra_aggregate* ae) { int i; rasqal_expression* expr; /* It is now a mistake to find a new aggregate expressions not * previously found in SELECT */ ae->adding_new_vars_is_error = 1; ae->error_part = "HAVING"; for(i = 0; (expr = (rasqal_expression*)raptor_sequence_get_at(exprs_seq, i)); i++) { if(rasqal_expression_visit(expr, rasqal_algebra_extract_aggregate_expression_visit, ae)) { return 1; } } return 0; } /** * rasqal_algebra_query_prepare_aggregates: * @query: #rasqal_query to read from * @node: algebra node to prepare * @projection: variable projection to use * @modifier: solution modifier to use * * INTERNAL - prepare query aggregates * * Return value: aggregate expression data or NULL on failure */ rasqal_algebra_aggregate* rasqal_algebra_query_prepare_aggregates(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection, rasqal_solution_modifier* modifier) { rasqal_algebra_aggregate* ae; ae = RASQAL_CALLOC(rasqal_algebra_aggregate*, 1, sizeof(*ae)); if(!ae) return NULL; if(rasqal_algebra_extract_aggregate_expressions(query, node, ae, projection)) { RASQAL_DEBUG1("rasqal_algebra_extract_aggregate_expressions() failed\n"); rasqal_free_algebra_aggregate(ae); rasqal_free_algebra_node(node); return NULL; } /* Update variable use structures since agg variables were created */ if(ae->counter) rasqal_query_build_variables_use(query, projection); #ifdef RASQAL_DEBUG if(ae->counter) { raptor_sequence* seq = projection->variables; if(seq) { RASQAL_DEBUG1("after aggregate expressions extracted:\n"); raptor_sequence_print(seq, stderr); fputs("\n", stderr); RASQAL_DEBUG1("aggregate expressions:\n"); raptor_sequence_print(ae->agg_exprs, stderr); fputs("\n", stderr); } } else { RASQAL_DEBUG1("found no aggregate expressions in select\n"); } #endif /* if agg expressions were found, need to walk HAVING list and do a * similar replacement substituion in the expressions */ if(ae->counter && modifier && modifier->having_conditions) { if(rasqal_algebra_replace_aggregate_expressions(query, modifier->having_conditions, ae)) { RASQAL_DEBUG1("rasqal_algebra_replace_aggregate_expressions() failed\n"); rasqal_free_algebra_aggregate(ae); rasqal_free_algebra_node(node); return NULL; } } return ae; } /** * rasqal_algebra_query_add_group_by: * @query: #rasqal_query to read from * @node: node to apply modifiers to * @modifier: solution modifier to use * * Apply any needed GROUP BY to query algebra structure * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_group_by(rasqal_query* query, rasqal_algebra_node* node, rasqal_solution_modifier* modifier) { raptor_sequence* modifier_seq; if(!modifier) return node; /* GROUP BY */ modifier_seq = modifier->group_conditions; if(modifier_seq) { raptor_sequence* seq; /* Make a deep copy of the query group conditions sequence for * the GROUP algebra node */ seq = rasqal_expression_copy_expression_sequence(modifier_seq); if(!seq) { rasqal_free_algebra_node(node); return NULL; } node = rasqal_new_groupby_algebra_node(query, node, seq); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding group node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif } return node; } /** * rasqal_algebra_query_add_orderby: * @query: #rasqal_query to read from * @node: node to apply modifiers to * @projection: variable projection to use * @modifier: solution modifier to use * * Apply any needed modifiers to query algebra structure * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_orderby(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection, rasqal_solution_modifier* modifier) { raptor_sequence* modifier_seq; int distinct = 0; if(!modifier) return node; /* ORDER BY */ modifier_seq = modifier->order_conditions; if(modifier_seq) { raptor_sequence* seq; /* Make a deep copy of the query order conditions sequence for * the ORDERBY algebra node */ seq = rasqal_expression_copy_expression_sequence(modifier_seq); if(!seq) { rasqal_free_algebra_node(node); return NULL; } if(projection) distinct = projection->distinct; node = rasqal_new_orderby_algebra_node(query, node, seq, distinct); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding orderby node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif } return node; } /** * rasqal_algebra_query_add_slice: * @query: #rasqal_query to read from * @node: node to apply modifiers to * @modifier: solution modifier to use * * Apply any needed slice (LIMIT, OFFSET) modifiers to query algebra structure * * This is separate from rasqal_algebra_query_add_orderby() since currently * the query results module implements that for the outer result rows. * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_slice(rasqal_query* query, rasqal_algebra_node* node, rasqal_solution_modifier* modifier) { if(!modifier) return node; /* LIMIT and OFFSET */ if(modifier->limit > 0 || modifier->offset > 0) { node = rasqal_new_slice_algebra_node(query, node, modifier->limit, modifier->offset); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding slice node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif } return node; } /** * rasqal_algebra_query_add_aggregation: * @query: #rasqal_query to read from * @ae: aggregation structure * @node: node to apply aggregation to * * Apply any aggregation step needed to query algebra structure * * Becomes the owner of @ae * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_aggregation(rasqal_query* query, rasqal_algebra_aggregate* ae, rasqal_algebra_node* node) { raptor_sequence* exprs_seq; raptor_sequence* vars_seq; if(!query || !ae || !node) goto tidy; if(!ae->counter) { rasqal_free_algebra_aggregate(ae); return node; } /* Move ownership of sequences inside ae to here */ exprs_seq = ae->agg_exprs; ae->agg_exprs = NULL; vars_seq = ae->agg_vars_seq; ae->agg_vars_seq = NULL; rasqal_free_algebra_aggregate(ae); ae = NULL; node = rasqal_new_aggregation_algebra_node(query, node, exprs_seq, vars_seq); exprs_seq = NULL; vars_seq = NULL; if(!node) { RASQAL_DEBUG1("rasqal_new_aggregation_algebra_node() failed\n"); goto tidy; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding aggregation node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif return node; tidy: if(ae) rasqal_free_algebra_aggregate(ae); if(node) rasqal_free_algebra_node(node); return NULL; } /** * rasqal_algebra_query_add_projection: * @query: #rasqal_query to read from * @node: node to apply projection to * @projection: variable projection to use * * Add a projection to the query algebra structure * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_projection(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection) { int vars_size = 0; raptor_sequence* seq = NULL; /* sequence of rasqal_variable* */ raptor_sequence* vars_seq; int i; if(!projection) return NULL; /* FIXME Optimization: do not always need a PROJECT node when the * variables at the top level node are the same as the projection * list. */ /* project all projection variables (may be an empty sequence) */ seq = projection->variables; if(seq) vars_size = raptor_sequence_size(seq); vars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!vars_seq) { rasqal_free_algebra_node(node); return NULL; } for(i = 0; i < vars_size; i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(seq, i); v = rasqal_new_variable_from_variable(v); raptor_sequence_push(vars_seq, v); } node = rasqal_new_project_algebra_node(query, node, vars_seq); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding project node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif return node; } /** * rasqal_algebra_query_add_construct_projection: * @query: #rasqal_query to read from * @node: node to apply projection to * * Add a query projection for a CONSTRUCT to the query algebra structure * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_construct_projection(rasqal_query* query, rasqal_algebra_node* node) { int vars_size = 0; raptor_sequence* seq = NULL; /* sequence of rasqal_variable* */ raptor_sequence* vars_seq; int i; /* project all variables mentioned in CONSTRUCT */ seq = rasqal_algebra_get_variables_mentioned_in(query, RASQAL_VAR_USE_MAP_OFFSET_VERBS); if(!seq) { rasqal_free_algebra_node(node); return NULL; } vars_size = raptor_sequence_size(seq); vars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!vars_seq) { rasqal_free_algebra_node(node); return NULL; } for(i = 0; i < vars_size; i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(seq, i); v = rasqal_new_variable_from_variable(v); raptor_sequence_push(vars_seq, v); } node = rasqal_new_project_algebra_node(query, node, vars_seq); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding construct project node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif raptor_free_sequence(seq); return node; } /** * rasqal_algebra_query_add_distinct: * @query: #rasqal_query to read from * @node: node to apply distinct to * @projection: variable projection to use * * Apply distinctness to query algebra structure * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_distinct(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection) { if(!projection) return node; if(projection->distinct) { node = rasqal_new_distinct_algebra_node(query, node); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding distinct node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif } return node; } /** * rasqal_algebra_query_add_having: * @query: #rasqal_query to read from * @node: node to apply having to * @modifier: solution modifier to use * * Apply any needed HAVING expressions to query algebra structure * * Return value: non-0 on failure */ rasqal_algebra_node* rasqal_algebra_query_add_having(rasqal_query* query, rasqal_algebra_node* node, rasqal_solution_modifier* modifier) { raptor_sequence* modifier_seq; if(!modifier) return node; /* HAVING */ modifier_seq = modifier->having_conditions; if(modifier_seq) { raptor_sequence* exprs_seq; /* Make a deep copy of the query order conditions sequence for * the ORDERBY algebra node */ exprs_seq = rasqal_expression_copy_expression_sequence(modifier_seq); if(!exprs_seq) { rasqal_free_algebra_node(node); return NULL; } node = rasqal_new_having_algebra_node(query, node, exprs_seq); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("modified after adding having node, algebra node now:\n "); rasqal_algebra_node_print(node, stderr); fputs("\n", stderr); #endif } return node; } #endif #ifdef STANDALONE #include #define QUERY_LANGUAGE "sparql" #define QUERY_FORMAT "\ PREFIX ex: \ SELECT $subject \ FROM \ WHERE \ { $subject ex:predicate $value . \ FILTER (($value + 1) < 10) \ }" int main(int argc, char *argv[]); int main(int argc, char *argv[]) { char const *program = rasqal_basename(*argv); const char *query_language_name = QUERY_LANGUAGE; const unsigned char *query_format = (const unsigned char *)QUERY_FORMAT; int failures = 0; #define FAIL do { failures++; goto tidy; } while(0) rasqal_world *world; rasqal_query* query = NULL; rasqal_literal *lit1 = NULL, *lit2 = NULL; rasqal_expression *expr1 = NULL, *expr2 = NULL; rasqal_expression* expr = NULL; rasqal_expression* expr3 = NULL; rasqal_expression* expr4 = NULL; rasqal_algebra_node* node0 = NULL; rasqal_algebra_node* node1 = NULL; rasqal_algebra_node* node2 = NULL; rasqal_algebra_node* node3 = NULL; rasqal_algebra_node* node4 = NULL; rasqal_algebra_node* node5 = NULL; rasqal_algebra_node* node6 = NULL; rasqal_algebra_node* node7 = NULL; rasqal_algebra_node* node8 = NULL; rasqal_algebra_node* node9 = NULL; raptor_uri *base_uri = NULL; unsigned char *uri_string; rasqal_graph_pattern* query_gp; rasqal_graph_pattern* sgp; raptor_sequence* triples; raptor_sequence* conditions = NULL; rasqal_literal* lit3 = NULL; rasqal_literal* lit4 = NULL; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) FAIL; uri_string = raptor_uri_filename_to_uri_string(""); if(!uri_string) FAIL; base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); if(!base_uri) FAIL; raptor_free_memory(uri_string); query = rasqal_new_query(world, query_language_name, NULL); if(!query) { fprintf(stderr, "%s: creating query in language %s FAILED\n", program, query_language_name); FAIL; } if(rasqal_query_prepare(query, query_format, base_uri)) { fprintf(stderr, "%s: %s query prepare FAILED\n", program, query_language_name); FAIL; } lit1 = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 1); if(!lit1) FAIL; expr1 = rasqal_new_literal_expression(world, lit1); if(!expr1) FAIL; lit1 = NULL; /* now owned by expr1 */ lit2 = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 1); if(!lit2) FAIL; expr2 = rasqal_new_literal_expression(world, lit2); if(!expr2) FAIL; lit2 = NULL; /* now owned by expr2 */ expr = rasqal_new_2op_expression(world, RASQAL_EXPR_PLUS, expr1, expr2); if(!expr) FAIL; expr1 = NULL; expr2 = NULL; /* now owned by expr */ node0 = rasqal_new_empty_algebra_node(query); if(!node0) FAIL; node1 = rasqal_new_filter_algebra_node(query, expr, node0); if(!node1) { fprintf(stderr, "%s: rasqal_new_filter_algebra_node() failed\n", program); FAIL; } node0 = NULL; expr = NULL; /* now owned by node1 */ fprintf(stderr, "%s: node result: \n", program); rasqal_algebra_node_print(node1, stderr); fputc('\n', stderr); rasqal_free_algebra_node(node1); /* construct abstract nodes from query structures */ query_gp = rasqal_query_get_query_graph_pattern(query); #ifdef RASQAL_DEBUG fprintf(stderr, "%s: query graph pattern: \n", program); rasqal_graph_pattern_print(query_gp, stderr); fputc('\n', stderr); #endif /* make a filter node around 2nd GP - a FILTER gp */ sgp = rasqal_graph_pattern_get_sub_graph_pattern(query_gp, 1); expr = rasqal_graph_pattern_get_filter_expression(sgp); if(!expr) { fprintf(stderr, "%s: rasqal_graph_pattern_get_filter_expression() failed\n", program); FAIL; } expr = rasqal_new_expression_from_expression(expr); if(!expr) { fprintf(stderr, "%s: rasqal_new_expression_from_expression() failed\n", program); FAIL; } node8 = rasqal_new_empty_algebra_node(query); if(!node8) FAIL; node1 = rasqal_new_filter_algebra_node(query, expr, node8); if(!node1) { fprintf(stderr, "%s: rasqal_new_filter_algebra_node() failed\n", program); FAIL; } /* these are now owned by node1 */ node8 = NULL; expr = NULL; fprintf(stderr, "%s: node1 result: \n", program); rasqal_algebra_node_print(node1, stderr); fputc('\n', stderr); /* make an triples node around first (and only) triple pattern */ triples = rasqal_query_get_triple_sequence(query); node2 = rasqal_new_triples_algebra_node(query, triples, 0, 0); if(!node2) FAIL; fprintf(stderr, "%s: node2 result: \n", program); rasqal_algebra_node_print(node2, stderr); fputc('\n', stderr); node3 = rasqal_new_2op_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_JOIN, node1, node2); if(!node3) FAIL; /* these become owned by node3 */ node1 = node2 = NULL; fprintf(stderr, "%s: node3 result: \n", program); rasqal_algebra_node_print(node3, stderr); fputc('\n', stderr); node4 = rasqal_new_empty_algebra_node(query); if(!node4) FAIL; fprintf(stderr, "%s: node4 result: \n", program); rasqal_algebra_node_print(node4, stderr); fputc('\n', stderr); node5 = rasqal_new_2op_algebra_node(query, RASQAL_ALGEBRA_OPERATOR_UNION, node3, node4); if(!node5) FAIL; /* these become owned by node5 */ node3 = node4 = NULL; fprintf(stderr, "%s: node5 result: \n", program); rasqal_algebra_node_print(node5, stderr); fputc('\n', stderr); lit1 = rasqal_new_boolean_literal(world, 1); if(!lit1) FAIL; expr1 = rasqal_new_literal_expression(world, lit1); if(!expr1) FAIL; lit1 = NULL; /* now owned by expr1 */ node6 = rasqal_new_empty_algebra_node(query); if(!node6) FAIL; node7 = rasqal_new_leftjoin_algebra_node(query, node5, node6, expr1); if(!node7) FAIL; /* these become owned by node7 */ node5 = node6 = NULL; expr1 = NULL; fprintf(stderr, "%s: node7 result: \n", program); rasqal_algebra_node_print(node7, stderr); fputc('\n', stderr); /* This is an artificial order conditions sequence equivalent to * ORDER BY 1, 2 which would probably never appear in a query. */ conditions = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!conditions) FAIL; lit3 = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 1); if(!lit3) FAIL; expr3 = rasqal_new_literal_expression(world, lit3); if(!expr3) FAIL; lit3 = NULL; /* now owned by expr3 */ raptor_sequence_push(conditions, expr3); expr3 = NULL; /* now owned by conditions */ lit4 = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 2); if(!lit4) FAIL; expr4 = rasqal_new_literal_expression(world, lit4); if(!expr4) FAIL; lit4 = NULL; /* now owned by expr4 */ raptor_sequence_push(conditions, expr4); expr4 = NULL; /* now owned by conditions */ node9 = rasqal_new_orderby_algebra_node(query, node7, conditions, 0); if(!node9) FAIL; /* these become owned by node9 */ node7 = NULL; conditions = NULL; fprintf(stderr, "%s: node9 result: \n", program); rasqal_algebra_node_print(node9, stderr); fputc('\n', stderr); tidy: if(lit1) rasqal_free_literal(lit1); if(lit2) rasqal_free_literal(lit2); if(lit3) rasqal_free_literal(lit3); if(expr1) rasqal_free_expression(expr1); if(expr2) rasqal_free_expression(expr2); if(expr3) rasqal_free_expression(expr3); if(node9) rasqal_free_algebra_node(node9); if(node8) rasqal_free_algebra_node(node8); if(node7) rasqal_free_algebra_node(node7); if(node6) rasqal_free_algebra_node(node6); if(node5) rasqal_free_algebra_node(node5); if(node4) rasqal_free_algebra_node(node4); if(node3) rasqal_free_algebra_node(node3); if(node2) rasqal_free_algebra_node(node2); if(node1) rasqal_free_algebra_node(node1); if(node0) rasqal_free_algebra_node(node0); if(query) rasqal_free_query(query); if(base_uri) raptor_free_uri(base_uri); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal-config.in0000644000175000017500000000532611311067373013667 00000000000000#!/bin/sh # # Rasqal configuration program - wrapper around 'pkg-config rasqal' # # Copyright (C) 2003-2009, 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. # # # PACKAGE=@PACKAGE@ PKGCONFIG=pkg-config usage() { cat<&2 fi if $PKGCONFIG $PACKAGE --exists; then : # exists else echo "$0: $PKGCONFIG does not know about package $PACKAGE" exit 1 fi args="" while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in # GNU standards require this --help|--usage) usage 0 ;; # Ignored options --libtool-libs|--prefix=*) echo "$0: $1 option ignored" 1>&2 ;; # Altered options --prefix) args="$args --variable=prefix"; ;; --version) args="$args --modversion"; ;; --private-libs) args="$args --static --libs"; ;; # Computed here --version-decimal) version=`$PKGCONFIG $PACKAGE --modversion` version_dec=0 for multiplier in 10000 100 1; do version_part=`echo $version | sed -e 's/\..*$//'` version_dec=`expr $multiplier \* $version_part + $version_dec` if [ $version = $version_part ]; then version=0 else version=`echo $version | sed -e 's/^[^.]*\.//'` fi done echo $version_dec exit 0 ;; # Other options are passed through *) args="$args $1" ;; esac shift done $PKGCONFIG $PACKAGE $args rasqal-0.9.33/src/rasqal_query_results.c0000644000175000017500000015647312443445700015261 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_query_results.c - Rasqal RDF Query Results * * Copyright (C) 2003-2009, 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE /* * * Query Results Class Internals * * This class provides the abstraction for query results in different * forms. The forms can be either a sequence of variable bindings, * set of RDF triples, boolean value or a syntax. * * Query results can be created as a result of a #rasqal_query * execution using rasqal_query_execute() or as an independent result * set constructed from a query results syntax such as the SPARQL XML * results format via the #rasqal_query_results_formatter class. * * The query results constructor rasqal_new_query_results() takes * a world to use, an optional query, the type of result as well * as a variable table to operate on. If the query is given, then * that is used to handle limit, offset and triple construction, * otherwise the result set is standalone and not associated with * a query. * * The variables table is used for the variables that will appear in * the result rows in the result set. The query results module does * not own any variable information, all API calls are delegated to * the variables table. * * If the rasqal_new_query_results_from_query_execution() is used to * make a query results from a query structure via executing the * query, it initialises a execution engine via the * #rasqal_query_execution_factory 'execute_init' factory method. * This method also determines whether the entire results need to be * (or a requested to be) obtained in one go, and if so, they are * done during construction. * * The user API to getting query results is primarily to get variable * bindings - a sequence of variable:value (also called #rasqal_row * internally), RDF triples, a boolean value or a syntax. * * The variable bindings are generated from the execution engine by * retrieving #rasqal_row either one-by-one using the get_row method * or getting the entire result at once with the get_all_rows method. * * In the case of getting the entire result the rows are stored as a * sqeuence inside the #rasqal_query_results and returned one-by-one * from there, respecting any limit and offset. * * The RDF triples and boolean value results are generated from the * variable bindings (#rasqal_row) inside this class. The underlying * execution engine only knows about rows. * * The class also handles several other results-specific methods such * as getting variable binding names, values by name, counts of * number of results, writing a query results as a syntax (in a * simple fashion), read a query results from a syntax. */ static int rasqal_query_results_execute_and_store_results(rasqal_query_results* query_results); static void rasqal_query_results_update_query_bindings(rasqal_query_results* query_results, rasqal_query *query); /* * A query result for some query */ struct rasqal_query_results_s { rasqal_world* world; /* type of query result (bindings, boolean, graph or syntax) */ rasqal_query_results_type type; /* non-0 if have read all (variable binding) results */ int finished; /* non-0 if query has been executed */ int executed; /* non 0 if query had fatal error and cannot return results */ int failed; /* query that this was executed over */ rasqal_query* query; /* how many (variable bindings) results found so far */ int result_count; /* execution data for execution engine. owned by this object */ void* execution_data; /* current row of results */ rasqal_row* row; /* boolean ASK result >0 true, 0 false or -1 uninitialised */ int ask_result; /* boolean: non-0 to store query results rather than lazy eval */ int store_results; /* current triple in the sequence of triples 'constructs' or -1 */ int current_triple_result; /* constructed triple result - shared and updated for each triple */ raptor_statement result_triple; /* sequence of stored results */ raptor_sequence* results_sequence; /* size of result row fields: * row->results, row->values */ int size; /* Execution engine used here */ const rasqal_query_execution_factory* execution_factory; /* Variables table for variables in result rows */ rasqal_variables_table* vars_table; /* non-0 if @vars_table has been initialized from first row */ int vars_table_init; }; int rasqal_init_query_results(void) { return 0; } void rasqal_finish_query_results(void) { } /** * rasqal_new_query_results2: * @world: rasqal world object * @query: query object (or NULL) * @type: query results (expected) type * * Constructor - create a new query results set * * The @query may be NULL for result set objects that are standalone * and not attached to any particular query * * Return value: a new query result object or NULL on failure **/ rasqal_query_results* rasqal_new_query_results2(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type) { rasqal_query_results* query_results; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); query_results = RASQAL_CALLOC(rasqal_query_results*, 1, sizeof(*query_results)); if(!query_results) return NULL; query_results->vars_table = rasqal_new_variables_table(world); if(!query_results->vars_table) { RASQAL_FREE(rasqal_query_results, query_results); return NULL; } query_results->world = world; query_results->type = type; query_results->finished = 0; query_results->executed = 0; query_results->failed = 0; query_results->query = query; query_results->result_count = 0; query_results->execution_data = NULL; query_results->row = NULL; query_results->ask_result = -1; query_results->store_results = 0; query_results->current_triple_result = -1; /* initialize static query_results->result_triple */ raptor_statement_init(&query_results->result_triple, world->raptor_world_ptr); query_results->results_sequence = NULL; query_results->size = 0; return query_results; } /** * rasqal_new_query_results: * @world: rasqal world object * @query: query object (or NULL) * @type: query results (expected) type * @vars_table: This parameter is *IGNORED* * * Constructor - create a new query results set * * @Deprecated for rasqal_new_query_results2() that loses the unused argument. * * The @query may be NULL for result set objects that are standalone * and not attached to any particular query * * Return value: a new query result object or NULL on failure **/ rasqal_query_results* rasqal_new_query_results(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type, rasqal_variables_table* vars_table) { return rasqal_new_query_results2(world, query, type); } /** * rasqal_new_query_results_from_string: * @world: rasqal world object * @type: query results (expected) type; typically #RASQAL_QUERY_RESULTS_BINDINGS * @base_uri: base URI of query results format (or NULL) * @string: query results string * @string_len: length of @string (or 0 to calculate it here) * * Constructor - create a new query results set from a results format string * * Return value: a new query result object or NULL on failure **/ rasqal_query_results* rasqal_new_query_results_from_string(rasqal_world* world, rasqal_query_results_type type, raptor_uri* base_uri, const char* string, size_t string_len) { int rc; raptor_iostream* iostr = NULL; rasqal_query_results_formatter* formatter = NULL; rasqal_query_results* results = NULL; raptor_world *raptor_world_ptr; const char* formatter_name; const unsigned char* id = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, const char*, NULL); if(!string_len) string_len = strlen(string); raptor_world_ptr = rasqal_world_get_raptor(world); results = rasqal_new_query_results2(world, NULL, type); if(!results) goto failed; iostr = raptor_new_iostream_from_string(raptor_world_ptr, RASQAL_GOOD_CAST(void*, string), string_len); if(!iostr) goto failed; if(base_uri) id = raptor_uri_as_string(base_uri); formatter_name = rasqal_world_guess_query_results_format_name(world, base_uri, NULL /* mime_type */, RASQAL_GOOD_CAST(const unsigned char*, string), string_len, id); formatter = rasqal_new_query_results_formatter(world, formatter_name, NULL /* mime type */, NULL /* uri */); if(!formatter) goto failed; rc = rasqal_query_results_formatter_read(world, iostr, formatter, results, base_uri); if(rc) goto failed; /* success */ goto tidy; failed: if(results) { rasqal_free_query_results(results); results = NULL; } tidy: if(formatter) rasqal_free_query_results_formatter(formatter); if(iostr) raptor_free_iostream(iostr); return results; } /** * rasqal_query_results_execute_with_engine: * @query_results: the #rasqal_query_results object * @engine: execution factory * @store_results: non-0 to store query results * * INTERNAL - Create a new query results set executing a prepared query with the given execution engine * * return value: non-0 on failure **/ int rasqal_query_results_execute_with_engine(rasqal_query_results* query_results, const rasqal_query_execution_factory* engine, int store_results) { int rc = 0; size_t ex_data_size; rasqal_query* query; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); query = query_results->query; if(query->failed) return 1; query_results->execution_factory = engine; /* set executed flag early to enable cleanup on error */ query_results->executed = 1; /* ensure stored results are present if ordering or distincting are being done */ query_results->store_results = (store_results || rasqal_query_get_order_conditions_sequence(query) || rasqal_query_get_distinct(query)); ex_data_size = query_results->execution_factory->execution_data_size; if(ex_data_size > 0) { query_results->execution_data = RASQAL_CALLOC(void*, 1, ex_data_size); if(!query_results->execution_data) return 1; } else query_results->execution_data = NULL; /* Update the current datetime once per query execution */ rasqal_world_reset_now(query->world); if(query_results->execution_factory->execute_init) { rasqal_engine_error execution_error = RASQAL_ENGINE_OK; int execution_flags = 0; if(query_results->store_results) execution_flags |= 1; rc = query_results->execution_factory->execute_init(query_results->execution_data, query, query_results, execution_flags, &execution_error); if(rc || execution_error != RASQAL_ENGINE_OK) { query_results->failed = 1; return 1; } } #ifdef RASQAL_DEBUG RASQAL_DEBUG1("After execute_init, query is now:\n"); rasqal_query_print(query, stderr); #endif /* Choose either to execute all now and store OR do it on demand (lazy) */ if(query_results->store_results) rc = rasqal_query_results_execute_and_store_results(query_results); return rc; } /** * rasqal_free_query_results: * @query_results: #rasqal_query_results object * * Destructor - destroy a rasqal_query_results. * **/ void rasqal_free_query_results(rasqal_query_results* query_results) { rasqal_query* query; if(!query_results) return; query = query_results->query; if(query_results->executed) { if(query_results->execution_factory->execute_finish) { rasqal_engine_error execution_error = RASQAL_ENGINE_OK; query_results->execution_factory->execute_finish(query_results->execution_data, &execution_error); /* ignoring failure of execute_finish */ } } if(query_results->execution_data) RASQAL_FREE(rasqal_engine_execution_data, query_results->execution_data); if(query_results->row) rasqal_free_row(query_results->row); if(query_results->results_sequence) raptor_free_sequence(query_results->results_sequence); /* free terms owned by static query_results->result_triple */ raptor_free_statement(&query_results->result_triple); if(query_results->vars_table) rasqal_free_variables_table(query_results->vars_table); if(query) rasqal_query_remove_query_result(query, query_results); RASQAL_FREE(rasqal_query_results, query_results); } /** * rasqal_query_results_get_query: * @query_results: #rasqal_query_results object * * Get thq query associated with this query result * * Return value: shared pointer to query object **/ rasqal_query* rasqal_query_results_get_query(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); return query_results->query; } /** * rasqal_query_results_get_type: * @query_results: #rasqal_query_results object * * Get query results type * * Return value: non-0 if true **/ rasqal_query_results_type rasqal_query_results_get_type(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, (rasqal_query_results_type)0); return query_results->type; } static const char* const rasqal_query_results_type_labels[RASQAL_QUERY_RESULTS_LAST + 1] = { "Bindings", "Boolean", "Graph", "Syntax", "Unknown" }; /** * rasqal_query_results_type_label: * @type: #rasqal_query_results_type type * * Get a label for a query results type * * Return value: label or NULL on failure (invalid type) **/ const char* rasqal_query_results_type_label(rasqal_query_results_type type) { if(type > RASQAL_QUERY_RESULTS_LAST) type = RASQAL_QUERY_RESULTS_UNKNOWN; return rasqal_query_results_type_labels[RASQAL_GOOD_CAST(int, type)]; } /** * rasqal_query_results_is_bindings: * @query_results: #rasqal_query_results object * * Test if rasqal_query_results is variable bindings format. * * Return value: non-0 if true **/ int rasqal_query_results_is_bindings(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 0); return (query_results->type == RASQAL_QUERY_RESULTS_BINDINGS); } /** * rasqal_query_results_is_boolean: * @query_results: #rasqal_query_results object * * Test if rasqal_query_results is boolean format. * * Return value: non-0 if true **/ int rasqal_query_results_is_boolean(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 0); return (query_results->type == RASQAL_QUERY_RESULTS_BOOLEAN); } /** * rasqal_query_results_is_graph: * @query_results: #rasqal_query_results object * * Test if rasqal_query_results is RDF graph format. * * Return value: non-0 if true **/ int rasqal_query_results_is_graph(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 0); return (query_results->type == RASQAL_QUERY_RESULTS_GRAPH); } /** * rasqal_query_results_is_syntax: * @query_results: #rasqal_query_results object * * Test if the rasqal_query_results is a syntax. * * Many of the query results may be formatted as a syntax using the * #rasqal_query_formatter class however this function returns true * if a syntax result was specifically requested. * * Return value: non-0 if true **/ int rasqal_query_results_is_syntax(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 0); return (query_results->type == RASQAL_QUERY_RESULTS_SYNTAX); } /** * rasqal_query_check_limit_offset_core: * @result_offset: offset to check * @limit: limit * @offset: offset * * INTERNAL - Check the result_offset is in the limit and offset range if any. * * Return value: before range -1, in range 0, after range 1 */ int rasqal_query_check_limit_offset_core(int result_offset, int limit, int offset) { if(result_offset < 0) return -1; if(offset > 0) { /* offset */ if(result_offset <= offset) return -1; if(limit >= 0) { /* offset and limit */ if(result_offset > (offset + limit)) { return 1; } } } else if(limit >= 0) { /* limit */ if(result_offset > limit) { return 1; } } return 0; } /** * rasqal_query_check_limit_offset: * @query_results: query results object * @result_offset: offset to check * * INTERNAL - Check the query result count is in the limit and offset range if any. * * Return value: before range -1, in range 0, after range 1 */ int rasqal_query_check_limit_offset(rasqal_query* query, int result_offset) { int limit; int offset; if(!query) return 0; if(result_offset < 0) return -1; limit = rasqal_query_get_limit(query); /* Ensure ASK queries never do more than one result */ if(query->verb == RASQAL_QUERY_VERB_ASK) limit = 1; offset = rasqal_query_get_offset(query); return rasqal_query_check_limit_offset_core(result_offset, limit, offset); } /** * rasqal_query_results_get_row_from_saved: * @query_results: Query results to execute * * INTERNAL - Get next result row from a stored query result sequence * * Return value: result row or NULL if finished or failed */ static rasqal_row* rasqal_query_results_get_row_from_saved(rasqal_query_results* query_results) { rasqal_query* query = query_results->query; int size; rasqal_row* row = NULL; size = raptor_sequence_size(query_results->results_sequence); while(1) { int check; if(query_results->result_count >= size) { query_results->finished = 1; break; } query_results->result_count++; check = rasqal_query_check_limit_offset(query, query_results->result_count); /* finished if beyond result range */ if(check > 0) { query_results->finished = 1; query_results->result_count--; break; } /* continue if before start of result range */ if(check < 0) continue; /* else got result */ row = (rasqal_row*)raptor_sequence_get_at(query_results->results_sequence, query_results->result_count - 1); if(row) { row = rasqal_new_row_from_row(row); /* stored results may not be canonicalized yet - do it lazily */ rasqal_row_to_nodes(row); query_results->row = row; if(query && query->constructs) rasqal_query_results_update_query_bindings(query_results, query); } break; } return row; } /** * rasqal_query_results_ensure_have_row_internal: * @query_results: #rasqal_query_results query_results * * INTERNAL - Ensure there is a row in the query results by getting it from the generator/stored list * * If one already is held, nothing is done. It is assumed * that @query_results is not NULL and the query is neither finished * nor failed. * * Return value: non-0 if failed or results exhausted **/ static int rasqal_query_results_ensure_have_row_internal(rasqal_query_results* query_results) { /* already have row */ if(query_results->row) return 0; if(query_results->results_sequence) { query_results->row = rasqal_query_results_get_row_from_saved(query_results); } else if(query_results->execution_factory && query_results->execution_factory->get_row) { rasqal_engine_error execution_error = RASQAL_ENGINE_OK; /* handle limit/offset for incremental get_row() */ while(1) { int check; query_results->row = query_results->execution_factory->get_row(query_results->execution_data, &execution_error); if(execution_error == RASQAL_ENGINE_FAILED) { query_results->failed = 1; break; } if(execution_error != RASQAL_ENGINE_OK) break; query_results->result_count++; check = rasqal_query_check_limit_offset(query_results->query, query_results->result_count); /* finished if beyond result range */ if(check > 0) { query_results->finished = 1; query_results->result_count--; /* empty row to trigger finished */ rasqal_free_row(query_results->row); query_results->row = NULL; break; } /* continue if before start of result range */ if(check < 0) { /* empty row because continuing */ rasqal_free_row(query_results->row); query_results->row = NULL; continue; } /* got a row */ break; } /* end while */ } if(query_results->row) { rasqal_row_to_nodes(query_results->row); query_results->size = query_results->row->size; } else query_results->finished = 1; if(query_results->row && !query_results->vars_table_init) { /* build variables table once from first row seen */ int i; query_results->vars_table_init = 1; for(i = 0; 1; i++) { rasqal_variable* v; v = rasqal_row_get_variable_by_offset(query_results->row, i); if(!v) break; v = rasqal_variables_table_add2(query_results->vars_table, v->type, v->name, /* name len */ 0, /* value */ NULL); rasqal_free_variable(v); } } return (query_results->row == NULL); } /** * rasqal_query_results_get_current_row: * @query_results: query results object * * INTERNAL - Get the current query result as a row of values * * The returned row is shared and owned by query_results * * Return value: result row or NULL on failure */ rasqal_row* rasqal_query_results_get_current_row(rasqal_query_results* query_results) { if(!query_results || query_results->failed || query_results->finished) return NULL; if(!rasqal_query_results_is_bindings(query_results)) return NULL; /* ensure we have a row */ rasqal_query_results_ensure_have_row_internal(query_results); return query_results->row; } /** * rasqal_query_results_get_count: * @query_results: #rasqal_query_results query_results * * Get number of bindings so far. * * Return value: number of bindings found so far or < 0 on failure **/ int rasqal_query_results_get_count(rasqal_query_results* query_results) { rasqal_query* query; int offset = -1; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, -1); if(query_results->failed) return -1; if(!rasqal_query_results_is_bindings(query_results)) return -1; query = query_results->query; if(query) offset = rasqal_query_get_offset(query); if(query && offset > 0) return query_results->result_count - offset; else return query_results->result_count; } /* * rasqal_query_results_next_internal: * @query_results: #rasqal_query_results query_results * * INTERNAL - Move to the next result without query verb type checking * * Return value: non-0 if failed or results exhausted **/ static int rasqal_query_results_next_internal(rasqal_query_results* query_results) { if(query_results->failed || query_results->finished) return 1; /* Remove any current row */ if(query_results->row) { rasqal_free_row(query_results->row); query_results->row = NULL; } /* Now try to get a new one */ return rasqal_query_results_ensure_have_row_internal(query_results); } /** * rasqal_query_results_next: * @query_results: #rasqal_query_results query_results * * Move to the next result. * * Return value: non-0 if failed or results exhausted **/ int rasqal_query_results_next(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); if(!rasqal_query_results_is_bindings(query_results)) return 1; return rasqal_query_results_next_internal(query_results); } /** * rasqal_query_results_finished: * @query_results: #rasqal_query_results query_results * * Find out if binding results are exhausted. * * Return value: non-0 if results are finished or query failed **/ int rasqal_query_results_finished(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); if(query_results->failed || query_results->finished) return 1; if(!rasqal_query_results_is_bindings(query_results)) return 1; /* need to have at least tried to get a row once */ if(!query_results->failed && !query_results->finished) rasqal_query_results_ensure_have_row_internal(query_results); return (query_results->failed || query_results->finished); } /** * rasqal_query_results_rewind: * @query_results: #rasqal_query_results query_results * * Rewind stored query results to start * * This requires rasqal_query_set_store_results() to be called before * query execution. * * Return value: non-0 if rewinding is not available when results are not stored **/ int rasqal_query_results_rewind(rasqal_query_results* query_results) { int size; int limit = -1; int offset = -1; rasqal_query* query; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); if(!query_results->results_sequence) return 1; size = raptor_sequence_size(query_results->results_sequence); /* This may be NULL for a static query result */ query = query_results->query; if(query) { /* If the query failed, it remains failed */ if(query->failed) return 1; limit = rasqal_query_get_limit(query); offset = rasqal_query_get_offset(query); } /* reset to first result */ query_results->finished = (size == 0); if(query && !limit) query_results->finished = 1; if(!query_results->finished) { /* Reset to first result, index-1 into sequence of results */ query_results->result_count = 0; /* skip past any OFFSET */ if(query && offset > 0) { query_results->result_count += offset; if(query_results->result_count >= size) query_results->finished = 1; } } if(query_results->finished) query_results->result_count = 0; else { if(query && query->constructs) rasqal_query_results_update_query_bindings(query_results, query); } return 0; } /** * rasqal_query_results_get_bindings: * @query_results: #rasqal_query_results query_results * @names: pointer to an array of binding names (or NULL) * @values: pointer to an array of binding value #rasqal_literal (or NULL) * * Get all binding names, values for current result. * * If names is not NULL, it is set to the address of a shared array * of names of the bindings (an output parameter). These names * are shared and must not be freed by the caller * * If values is not NULL, it is set to the address of a shared array * of #rasqal_literal* binding values. These values are shaerd * and must not be freed by the caller. * * Return value: non-0 if the assignment failed **/ int rasqal_query_results_get_bindings(rasqal_query_results* query_results, const unsigned char ***names, rasqal_literal ***values) { rasqal_row* row; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); if(!rasqal_query_results_is_bindings(query_results)) return 1; row = rasqal_query_results_get_current_row(query_results); if(!row) { query_results->finished = 1; return 0; } if(names) *names = rasqal_variables_table_get_names(query_results->vars_table); if(values) *values = row->values; return 0; } /** * rasqal_query_results_get_binding_value: * @query_results: #rasqal_query_results query_results * @offset: offset of binding name into array of known names * * Get one binding value for the current result. * * Return value: a pointer to a shared #rasqal_literal binding value or NULL on failure **/ rasqal_literal* rasqal_query_results_get_binding_value(rasqal_query_results* query_results, int offset) { rasqal_row* row; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); if(!rasqal_query_results_is_bindings(query_results)) return NULL; if(offset < 0 || offset > query_results->size-1) return NULL; row = rasqal_query_results_get_current_row(query_results); if(row) return row->values[offset]; query_results->finished = 1; return NULL; } /** * rasqal_query_results_get_binding_name: * @query_results: #rasqal_query_results query_results * @offset: offset of binding name into array of known names * * Get binding name for the current result. * * Return value: a pointer to a shared copy of the binding name or NULL on failure **/ const unsigned char* rasqal_query_results_get_binding_name(rasqal_query_results* query_results, int offset) { rasqal_row* row; rasqal_variable* v; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); if(!rasqal_query_results_is_bindings(query_results)) return NULL; row = rasqal_query_results_get_current_row(query_results); if(!row) return NULL; v = rasqal_variables_table_get(query_results->vars_table, offset); if(!v) return NULL; return v->name; } /** * rasqal_query_results_get_binding_value_by_name: * @query_results: #rasqal_query_results query_results * @name: variable name * * Get one binding value for a given name in the current result. * * Return value: a pointer to a shared #rasqal_literal binding value or NULL on failure **/ rasqal_literal* rasqal_query_results_get_binding_value_by_name(rasqal_query_results* query_results, const unsigned char *name) { rasqal_row* row; rasqal_variable* v; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, char*, NULL); if(!rasqal_query_results_is_bindings(query_results)) return NULL; row = rasqal_query_results_get_current_row(query_results); if(!row) return NULL; v = rasqal_variables_table_get_by_name(query_results->vars_table, RASQAL_VARIABLE_TYPE_NORMAL, name); if(!v) return NULL; return row->values[v->offset]; } /** * rasqal_query_results_get_bindings_count: * @query_results: #rasqal_query_results query_results * * Get the number of bound variables in the result. * * Return value: <0 if failed or results exhausted **/ int rasqal_query_results_get_bindings_count(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, -1); if(query_results->failed) return -1; if(!rasqal_query_results_is_bindings(query_results)) return -1; /* ensures an attempt is made to get at least 1 row */ rasqal_query_results_ensure_have_row_internal(query_results); return query_results->size; } static unsigned char* rasqal_prefix_id(int prefix_id, const unsigned char *string) { int tmpid = prefix_id; unsigned char* buffer; size_t length = strlen(RASQAL_GOOD_CAST(const char*, string)) + 4; /* "r" +... + "q" +... \0 */ while(tmpid /= 10) length++; buffer = RASQAL_MALLOC(unsigned char*, length); if(!buffer) return NULL; sprintf(RASQAL_GOOD_CAST(char*, buffer), "r%dq%s", prefix_id, string); return buffer; } static raptor_term* rasqal_literal_to_result_term(rasqal_query_results* query_results, rasqal_literal* l) { rasqal_literal* nodel; raptor_term* t = NULL; unsigned char *nodeid; nodel = rasqal_literal_as_node(l); if(!nodel) return NULL; switch(nodel->type) { case RASQAL_LITERAL_URI: t = raptor_new_term_from_uri(query_results->world->raptor_world_ptr, nodel->value.uri); break; case RASQAL_LITERAL_BLANK: if(l->type == RASQAL_LITERAL_BLANK) { /* original was a genuine blank node not a variable with a * blank node value so make a new one every result, not every triple */ nodeid = rasqal_prefix_id(query_results->result_count, nodel->string); } else { nodeid = RASQAL_MALLOC(unsigned char*, nodel->string_len + 1); if(nodeid) memcpy(nodeid, nodel->string, nodel->string_len + 1); } if(nodeid) l = rasqal_new_simple_literal(query_results->world, RASQAL_LITERAL_BLANK, nodeid); if(!nodeid || !l) goto done; t = raptor_new_term_from_blank(query_results->world->raptor_world_ptr, nodeid); rasqal_free_literal(l); break; case RASQAL_LITERAL_STRING: t = raptor_new_term_from_literal(query_results->world->raptor_world_ptr, nodel->string, nodel->datatype, RASQAL_GOOD_CAST(const unsigned char*, nodel->language)); break; case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: /* QNames should be gone by the time expression eval happens * Everything else is removed by rasqal_literal_as_node() above. */ case RASQAL_LITERAL_UNKNOWN: default: break; } done: if(nodel) rasqal_free_literal(nodel); return t; } /** * rasqal_query_results_get_triple: * @query_results: #rasqal_query_results query_results * * Get the current triple in the result. * * The return value is a shared #raptor_statement. * * Return value: #raptor_statement or NULL if failed or results exhausted **/ raptor_statement* rasqal_query_results_get_triple(rasqal_query_results* query_results) { rasqal_query* query; rasqal_triple *t; raptor_statement *rs = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); if(query_results->failed || query_results->finished) return NULL; if(!rasqal_query_results_is_graph(query_results)) return NULL; query = query_results->query; if(!query) return NULL; if(query->verb == RASQAL_QUERY_VERB_DESCRIBE) return NULL; /* ensure we have a row to work on */ if(rasqal_query_results_ensure_have_row_internal(query_results)) return NULL; while(1) { int skip = 0; if(query_results->current_triple_result < 0) query_results->current_triple_result = 0; t = (rasqal_triple*)raptor_sequence_get_at(query->constructs, query_results->current_triple_result); rs = &query_results->result_triple; raptor_statement_clear(rs); rs->subject = rasqal_literal_to_result_term(query_results, t->subject); if(!rs->subject || rs->subject->type == RAPTOR_TERM_TYPE_LITERAL) { rasqal_log_warning_simple(query_results->world, RASQAL_WARNING_LEVEL_BAD_TRIPLE, &query->locator, "Triple with non-RDF subject term skipped"); skip = 1; } else { rs->predicate = rasqal_literal_to_result_term(query_results, t->predicate); if(!rs->predicate || rs->predicate->type != RAPTOR_TERM_TYPE_URI) { rasqal_log_warning_simple(query_results->world, RASQAL_WARNING_LEVEL_BAD_TRIPLE, &query->locator, "Triple with non-RDF predicate term skipped"); skip = 1; } else { rs->object = rasqal_literal_to_result_term(query_results, t->object); if(!rs->object) { rasqal_log_warning_simple(query_results->world, RASQAL_WARNING_LEVEL_BAD_TRIPLE, &query->locator, "Triple with non-RDF object term skipped"); skip = 1; } } } if(!skip) /* got triple, return it */ break; /* Have to move to next triple internally */ if(rasqal_query_results_next_triple(query_results)) { /* end of results or failed */ rs = NULL; break; } } return rs; } /** * rasqal_query_results_next_triple: * @query_results: #rasqal_query_results query_results * * Move to the next triple result. * * Return value: non-0 if failed or results exhausted **/ int rasqal_query_results_next_triple(rasqal_query_results* query_results) { rasqal_query* query; int rc = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); if(query_results->failed || query_results->finished) return 1; if(!rasqal_query_results_is_graph(query_results)) return 1; query = query_results->query; if(!query) return 1; if(query->verb == RASQAL_QUERY_VERB_DESCRIBE) return 1; if(++query_results->current_triple_result >= raptor_sequence_size(query->constructs)) { if(rasqal_query_results_next_internal(query_results)) return 1; query_results->current_triple_result = -1; } return rc; } /** * rasqal_query_results_get_boolean: * @query_results: #rasqal_query_results query_results * * Get boolean query result. * * The return value is only meaningful if this is a boolean * query result - see rasqal_query_results_is_boolean() * * Return value: boolean query result - >0 is true, 0 is false, <0 on error */ int rasqal_query_results_get_boolean(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, -1); if(query_results->failed) return -1; if(!rasqal_query_results_is_boolean(query_results)) return -1; if(query_results->ask_result >= 0) return query_results->ask_result; rasqal_query_results_ensure_have_row_internal(query_results); query_results->ask_result = (query_results->result_count > 0) ? 1 : 0; query_results->finished = 1; return query_results->ask_result; } /** * rasqal_query_results_set_boolean: * @query_results: #rasqal_query_results query_results * @value: boolean value * * INTERNAL - Set boolean query result value. * * Return value: boolean query result - >0 is true, 0 is false, <0 on error */ int rasqal_query_results_set_boolean(rasqal_query_results* query_results, int value) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, -1); if(query_results->failed) return -1; if(!rasqal_query_results_is_boolean(query_results)) return -1; query_results->finished = 1; query_results->ask_result = value; return 0; } /** * rasqal_query_results_write: * @iostr: #raptor_iostream to write the query to * @results: #rasqal_query_results query results format * @name: format name (or NULL) * @mime_type: format mime type (or NULL) * @format_uri: #raptor_uri describing the format to write (or NULL for default) * @base_uri: #raptor_uri base URI of the output format * * Write the query results to an iostream in a format. * * This uses the #rasqal_query_results_formatter class and the * rasqal_query_results_formatter_write() method to perform the * formatting. * * Note that after calling this method, the query results will be * empty and rasqal_query_results_finished() will return true (non-0) * * See rasqal_world_get_query_results_format_description() for obtaining the * supported format names, mime_types and URIs at run time. * * Return value: non-0 on failure **/ int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results* results, const char *name, const char *mime_type, raptor_uri *format_uri, raptor_uri *base_uri) { rasqal_query_results_formatter *formatter; int status; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(results, rasqal_query_results, 1); if(results->failed) return 1; formatter = rasqal_new_query_results_formatter(results->world, name, mime_type, format_uri); if(!formatter) return 1; status = rasqal_query_results_formatter_write(iostr, formatter, results, base_uri); rasqal_free_query_results_formatter(formatter); return status; } /** * rasqal_query_results_read: * @iostr: #raptor_iostream to read the query from * @results: #rasqal_query_results query results format * @name: format name (or NULL) * @mime_type: format mime type (or NULL) * @format_uri: #raptor_uri describing the format to read (or NULL for default) * @base_uri: #raptor_uri base URI of the input format * * Read the query results from an iostream in a format. * * This uses the #rasqal_query_results_formatter class * and the rasqal_query_results_formatter_read() method * to perform the formatting. * * See rasqal_world_get_query_results_format_description() for * obtaining the supported format URIs at run time. * * Return value: non-0 on failure **/ int rasqal_query_results_read(raptor_iostream *iostr, rasqal_query_results* results, const char *name, const char *mime_type, raptor_uri *format_uri, raptor_uri *base_uri) { rasqal_query_results_formatter *formatter; int status; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(results, rasqal_query_results, 1); if(results->failed) return 1; formatter = rasqal_new_query_results_formatter(results->world, name, mime_type, format_uri); if(!formatter) return 1; status = rasqal_query_results_formatter_read(results->world, iostr, formatter, results, base_uri); rasqal_free_query_results_formatter(formatter); return status; } /** * rasqal_query_results_add_row: * @query_results: query results object * @row: query result row * * Add a query result row to the sequence of result rows * * Return value: non-0 on failure */ int rasqal_query_results_add_row(rasqal_query_results* query_results, rasqal_row* row) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(row, rasqal_row, 1); if(!query_results->results_sequence) { query_results->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!query_results->results_sequence) return 1; query_results->result_count = 0; } row->offset = raptor_sequence_size(query_results->results_sequence); return raptor_sequence_push(query_results->results_sequence, row); } /** * rasqal_query_results_execute_and_store_results: * @query_results: query results object * * INTERNAL - Store all query result (rows) immediately * * Return value: non-0 on failure */ static int rasqal_query_results_execute_and_store_results(rasqal_query_results* query_results) { raptor_sequence* seq = NULL; if(query_results->results_sequence) raptor_free_sequence(query_results->results_sequence); if(query_results->execution_factory->get_all_rows) { rasqal_engine_error execution_error = RASQAL_ENGINE_OK; seq = query_results->execution_factory->get_all_rows(query_results->execution_data, &execution_error); if(execution_error == RASQAL_ENGINE_FAILED) query_results->failed = 1; } query_results->results_sequence = seq; if(!seq) { query_results->finished = 1; } else rasqal_query_results_rewind(query_results); return query_results->failed; } /* * rasqal_query_results_update_query_bindings: * @query_results: query results to read from * @query: query to set bindings to * * INTERNAL - bind the query variables to the values from the current query results row * * Used to handle query CONSTRUCT */ static void rasqal_query_results_update_query_bindings(rasqal_query_results* query_results, rasqal_query* query) { int i; int size; rasqal_row* row; RASQAL_ASSERT_OBJECT_POINTER_RETURN(query_results, rasqal_query_results); rasqal_query_results_ensure_have_row_internal(query_results); row = query_results->row; if(!row) { query_results->finished = 1; return; } size = rasqal_variables_table_get_named_variables_count(query_results->vars_table); for(i = 0; i < size; i++) { rasqal_variable* srcv; rasqal_variable* v; /* source value is in row */ rasqal_literal* value = row->values[i]; /* source variable is in query results */ srcv = rasqal_variables_table_get(query_results->vars_table, i); /* destination variable is in query */ v = rasqal_variables_table_get_by_name(query->vars_table, srcv->type, srcv->name); if(v) rasqal_variable_set_value(v, rasqal_new_literal_from_literal(value)); else { RASQAL_DEBUG2("Cannot bind query results variable %s into query", srcv->name); } } } void rasqal_query_results_remove_query_reference(rasqal_query_results* query_results) { rasqal_query* query; RASQAL_ASSERT_OBJECT_POINTER_RETURN(query_results, rasqal_query_results); query = query_results->query; query_results->query = NULL; rasqal_free_query(query); } rasqal_variables_table* rasqal_query_results_get_variables_table(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); return query_results->vars_table; } rasqal_world* rasqal_query_results_get_world(rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); return query_results->world; } /** * rasqal_query_results_get_row_by_offset: * @query_results: query result * @result_offset: index into result rows * * Get stored result row by an offset * * The result_offset index is 0-indexed into the subset of results * constrained by any query limit and offset. * * Return value: row or NULL if @result_offset is out of range */ rasqal_row* rasqal_query_results_get_row_by_offset(rasqal_query_results* query_results, int result_offset) { rasqal_query* query; int check; rasqal_row* row; int offset = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, NULL); if(!query_results->results_sequence) return NULL; if(result_offset < 0) return NULL; query = query_results->query; if(query) offset = rasqal_query_get_offset(query); /* Adjust 0-indexed to query results 1-indexed + query result offset */ result_offset += 1 + offset; check = rasqal_query_check_limit_offset(query_results->query, result_offset); /* outside limit/offset range in some way */ if(check < 0 || check > 0) return NULL; row = (rasqal_row*)raptor_sequence_get_at(query_results->results_sequence, result_offset - 1); if(row) { row = rasqal_new_row_from_row(row); /* stored results may not be canonicalized yet - do it lazily */ rasqal_row_to_nodes(row); } return row; } struct rqr_context { rasqal_query_results* results; /* size of @order - number of values */ int size; /* Sequence of offsets to variables in lexical order */ int* order; }; /** * rasqal_query_results_sort_compare_row: * @a: pointer to address of first #row * @b: pointer to address of second #row * @arg: query results pointer * * INTERNAL - compare two pointers to #row objects with user data arg * * Suitable for use as a compare function with raptor_sort_r() or * compatible. Used by rasqal_query_results_sort(). * * Return value: <0, 0 or >0 comparison */ static int rasqal_query_results_sort_compare_row(const void *a, const void *b, void *arg) { rasqal_row* row_a; rasqal_row* row_b; struct rqr_context* rqr; int result = 0; row_a = *(rasqal_row**)a; row_b = *(rasqal_row**)b; rqr = (struct rqr_context*)arg; result = rasqal_literal_array_compare_by_order(row_a->values, row_b->values, rqr->order, row_a->size, 0); /* still equal? make sort stable by using the original order */ if(!result) { result = row_a->offset - row_b->offset; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Got equality result so using offsets, returning %d\n", result); #endif } return result; } int rasqal_query_results_sort(rasqal_query_results* query_results) { struct rqr_context rqr; if(query_results->execution_factory && !query_results->results_sequence) { int rc; rc = rasqal_query_results_execute_and_store_results(query_results); if(rc) return rc; } rqr.results = query_results; rqr.size = query_results->size; rqr.order = rasqal_variables_table_get_order(query_results->vars_table); if(!rqr.order) return 1; if(query_results->results_sequence) { int size = raptor_sequence_size(query_results->results_sequence); if(size > 1) { #if RAPTOR_VERSION < 20015 raptor_sequence *seq; void** array; size_t i; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!seq) { RASQAL_FREE(int*, rqr.order); return 1; } array = rasqal_sequence_as_sorted(seq, rasqal_query_results_sort_compare_row, &rqr); if(!array) { raptor_free_sequence(seq); RASQAL_FREE(int*, rqr.order); return 1; } for(i = 0; i < RASQAL_GOOD_CAST(size_t, size); i++) { rasqal_row* row = rasqal_new_row_from_row(RASQAL_GOOD_CAST(rasqal_row*, array[i])); raptor_sequence_push(seq, row); } raptor_free_sequence(query_results->results_sequence); query_results->results_sequence = seq; RASQAL_FREE(void*, array); #else raptor_sequence_sort_r(query_results->results_sequence, rasqal_query_results_sort_compare_row, &rqr); #endif } } RASQAL_FREE(int*, rqr.order); return 0; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); #define NTESTS 2 const struct { const char* qr_string; int expected_vars_count; int expected_rows_count; int expected_equality; } expected_data[NTESTS] = { { "a\tb\tc\td\n\"a\"\t\"b\"\t\"c\"\t\"d\"\n", 4, 1, 1 }, { "a,b,c,d,e,f\n\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"\n", 6, 1, 1 } }; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 static void print_bindings_results_simple(rasqal_query_results *results, FILE* output) { while(!rasqal_query_results_finished(results)) { int i; fputs("row: [", output); for(i = 0; i < rasqal_query_results_get_bindings_count(results); i++) { const unsigned char *name; rasqal_literal *value; name = rasqal_query_results_get_binding_name(results, i); value = rasqal_query_results_get_binding_value(results, i); if(i > 0) fputs(", ", output); fprintf(output, "%s=", name); rasqal_literal_print(value, output); } fputs("]\n", output); rasqal_query_results_next(results); } } #endif int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_world* world = NULL; raptor_world* raptor_world_ptr; int failures = 0; int i; rasqal_query_results_type type = RASQAL_QUERY_RESULTS_BINDINGS; world = rasqal_new_world(); rasqal_world_open(world); raptor_world_ptr = rasqal_world_get_raptor(world); for(i = 0; i < NTESTS; i++) { raptor_uri* base_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://example.org/"); rasqal_query_results *qr; int expected_vars_count = expected_data[i].expected_vars_count; int vars_count; qr = rasqal_new_query_results_from_string(world, type, base_uri, expected_data[i].qr_string, 0); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("Query result from string:"); print_bindings_results_simple(first_qr, stderr); rasqal_query_results_rewind(first_qr); #endif raptor_free_uri(base_uri); if(!qr) { fprintf(stderr, "%s: failed to create query results\n", program); failures++; } else { rasqal_variables_table* vt; vt = rasqal_query_results_get_variables_table(qr); vars_count = rasqal_variables_table_get_named_variables_count(vt); RASQAL_DEBUG4("%s: query results test %d returned %d vars\n", program, i, vars_count); if(vars_count != expected_vars_count) { fprintf(stderr, "%s: FAILED query results test %d returned %d vars expected %d vars\n", program, i, vars_count, expected_vars_count); failures++; } } if(qr) rasqal_free_query_results(qr); } if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_formula.c0000644000175000017500000000540412134566305013765 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_formula.c - Rasqal formula class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" rasqal_formula* rasqal_new_formula(rasqal_world* world) { rasqal_formula* f; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); f = RASQAL_CALLOC(rasqal_formula*, 1, sizeof(*f)); if(!f) return NULL; f->world = world; return f; } void rasqal_free_formula(rasqal_formula* formula) { if(!formula) return; if(formula->triples) raptor_free_sequence(formula->triples); if(formula->value) rasqal_free_literal(formula->value); RASQAL_FREE(rasqal_formula, formula); } int rasqal_formula_print(rasqal_formula* formula, FILE *stream) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(formula, rasqal_formula, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(stream, FILE*, 1); fputs("formula(triples=", stream); if(formula->triples) raptor_sequence_print(formula->triples, stream); else fputs("[]", stream); fputs(", value=", stream); rasqal_literal_print(formula->value, stream); fputc(')', stream); return 0; } rasqal_formula* rasqal_formula_join(rasqal_formula* first_formula, rasqal_formula* second_formula) { if(!first_formula && !second_formula) return NULL; if(!first_formula) return second_formula; if(!second_formula) return first_formula; if(first_formula->triples || second_formula->triples) { if(!first_formula->triples) { first_formula->triples=second_formula->triples; second_formula->triples=NULL; } else if(second_formula->triples) if(raptor_sequence_join(first_formula->triples, second_formula->triples)) { rasqal_free_formula(first_formula); first_formula=NULL; } } rasqal_free_formula(second_formula); return first_formula; } rasqal-0.9.33/src/rasqal_service.c0000644000175000017500000003555012343762317013770 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_service.c - Rasqal SPARQL Protocol Service * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEFAULT_FORMAT "application/sparql-results+xml" struct rasqal_service_s { rasqal_world* world; /* request fields */ raptor_uri* service_uri; char* query_string; size_t query_string_len; raptor_sequence* data_graphs; /* background graph and named graphs */ char* format; /* MIME Type to use as request HTTP Accept: */ /* URL retrieval fields */ raptor_www* www; int started; /* response fields */ raptor_uri* final_uri; raptor_stringbuffer* sb; char* content_type; int usage; }; /** * rasqal_new_service: * @world: rasqal_world object * @service_uri: sparql protocol service URI * @query_string: query string (or NULL) * @data_graphs: sequence of #rasqal_data_graph graphs for service * * Constructor - create a new rasqal protocol service object. * * Create a structure to execute a sparql protocol service at * @service_uri running the query @query_string and returning * a sparql result set. * * All arguments are copied by the service object * * Return value: a new #rasqal_query object or NULL on failure */ rasqal_service* rasqal_new_service(rasqal_world* world, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs) { rasqal_service* svc; size_t len = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(service_uri, raptor_uri, NULL); svc = RASQAL_CALLOC(rasqal_service*, 1, sizeof(*svc)); if(!svc) return NULL; svc->usage = 1; svc->world = world; svc->service_uri = raptor_uri_copy(service_uri); if(query_string) { len = strlen(RASQAL_GOOD_CAST(const char*, query_string)); svc->query_string = RASQAL_MALLOC(char*, len + 1); if(!svc->query_string) { rasqal_free_service(svc); return NULL; } memcpy(svc->query_string, query_string, len + 1); } svc->query_string_len = len; if(data_graphs) { int i; rasqal_data_graph* dg; svc->data_graphs = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, NULL); if(!svc->data_graphs) { rasqal_free_service(svc); return NULL; } for(i = 0; (dg = (rasqal_data_graph*)raptor_sequence_get_at(data_graphs, i)); i++) { raptor_sequence_push(svc->data_graphs, rasqal_new_data_graph_from_data_graph(dg)); } } return svc; } /* * rasqal_new_service_from_service: * @service: #rasqal_service to copy * * INTERNAL - Copy Constructor - Create a new Rasqal service from an existing one * * This adds a new reference to the service, it does not do a deep copy * * Return value: a new #rasqal_service or NULL on failure. **/ rasqal_service* rasqal_new_service_from_service(rasqal_service* svc) { if(!svc) return NULL; svc->usage++; return svc; } /** * rasqal_free_service: * @svc: #rasqal_service object * * Destructor - destroy a #rasqal_service object. **/ void rasqal_free_service(rasqal_service* svc) { if(!svc) return; if(--svc->usage) return; if(svc->service_uri) raptor_free_uri(svc->service_uri); if(svc->query_string) RASQAL_FREE(char*, svc->query_string); if(svc->data_graphs) raptor_free_sequence(svc->data_graphs); rasqal_service_set_www(svc, NULL); RASQAL_FREE(rasqal_service, svc); } /** * rasqal_service_set_www: * @svc: #rasqal_service service object * @www: WWW object (or NULL) * * Set the WWW object to use when executing the service * * Return value: non 0 on failure **/ int rasqal_service_set_www(rasqal_service* svc, raptor_www* www) { if(svc->www) raptor_free_www(svc->www); svc->www = www; return 0; } /** * rasqal_service_set_format: * @svc: #rasqal_service service object * @format: service mime type (or NULL) * * Set the MIME Type to use in HTTP Accept when executing the service * * Return value: non 0 on failure **/ int rasqal_service_set_format(rasqal_service* svc, const char *format) { size_t len; if(svc->format) { RASQAL_FREE(char*, svc->format); svc->format = NULL; } if(!format) return 0; len = strlen(format); svc->format = RASQAL_MALLOC(char*, len + 1); if(!svc->format) return 1; memcpy(svc->format, format, len + 1); return 0; } static void rasqal_service_write_bytes(raptor_www* www, void *userdata, const void *ptr, size_t size, size_t nmemb) { rasqal_service* svc = (rasqal_service*)userdata; size_t len = size * nmemb; if(!svc->started) { svc->final_uri = raptor_www_get_final_uri(www); svc->started = 1; } raptor_stringbuffer_append_counted_string(svc->sb, RASQAL_GOOD_CAST(const unsigned char*, ptr), len, 1); } static void rasqal_service_content_type_handler(raptor_www* www, void* userdata, const char* content_type) { rasqal_service* svc = (rasqal_service*)userdata; size_t len; if(svc->content_type) RASQAL_FREE(char*, svc->content_type); len = strlen(content_type); svc->content_type = RASQAL_MALLOC(char*, len + 1); if(svc->content_type) { char* p; memcpy(svc->content_type, content_type, len + 1); for(p = svc->content_type; *p; p++) { if(*p == ';' || *p == ' ') { *p = '\0'; break; } } } } /** * rasqal_service_execute_as_rowsource: * @svc: rasqal service * * INTERNAL - Execute a rasqal sparql protocol service to a rowsurce * * Return value: query results or NULL on failure */ rasqal_rowsource* rasqal_service_execute_as_rowsource(rasqal_service* svc, rasqal_variables_table* vars_table) { raptor_iostream* read_iostr = NULL; raptor_uri* read_base_uri = NULL; rasqal_query_results_formatter* read_formatter = NULL; raptor_uri* retrieval_uri = NULL; raptor_stringbuffer* uri_sb = NULL; size_t len; unsigned char* str; raptor_world* raptor_world_ptr = rasqal_world_get_raptor(svc->world); rasqal_rowsource* rowsource = NULL; if(!svc->www) { svc->www = raptor_new_www(raptor_world_ptr); if(!svc->www) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to create WWW"); goto error; } } svc->started = 0; svc->final_uri = NULL; svc->sb = raptor_new_stringbuffer(); svc->content_type = NULL; if(svc->format) raptor_www_set_http_accept(svc->www, svc->format); else raptor_www_set_http_accept(svc->www, DEFAULT_FORMAT); raptor_www_set_write_bytes_handler(svc->www, rasqal_service_write_bytes, svc); raptor_www_set_content_type_handler(svc->www, rasqal_service_content_type_handler, svc); /* Construct a URI to retrieve following SPARQL protocol HTTP * binding from concatenation of * * 1. service_uri * 2. '?' * 3. "query=" query_string * 4. "&default-graph-uri=" background graph URI if any * 5. "&named-graph-uri=" named graph URI for all named graphs * with URI-escaping of the values */ uri_sb = raptor_new_stringbuffer(); if(!uri_sb) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to create stringbuffer"); goto error; } str = raptor_uri_as_counted_string(svc->service_uri, &len); raptor_stringbuffer_append_counted_string(uri_sb, str, len, 1); raptor_stringbuffer_append_counted_string(uri_sb, RASQAL_GOOD_CAST(const unsigned char*, "?"), 1, 1); if(svc->query_string) { raptor_stringbuffer_append_counted_string(uri_sb, RASQAL_GOOD_CAST(const unsigned char*, "query="), 6, 1); raptor_stringbuffer_append_uri_escaped_counted_string(uri_sb, svc->query_string, svc->query_string_len, 1); } if(svc->data_graphs) { rasqal_data_graph* dg; int i; int bg_graph_count; for(i = 0, bg_graph_count = 0; (dg = (rasqal_data_graph*)raptor_sequence_get_at(svc->data_graphs, i)); i++) { unsigned char* graph_str; size_t graph_len; raptor_uri* graph_uri; if(dg->flags & RASQAL_DATA_GRAPH_BACKGROUND) { if(bg_graph_count++) { if(bg_graph_count == 2) { /* Warn once, only when the second BG is seen */ rasqal_log_warning_simple(svc->world, RASQAL_WARNING_LEVEL_MULTIPLE_BG_GRAPHS, NULL, "Attempted to add multiple background graphs"); } /* always skip after first BG */ continue; } raptor_stringbuffer_append_counted_string(uri_sb, RASQAL_GOOD_CAST(const unsigned char*, "&default-graph-uri="), 19, 1); graph_uri = dg->uri; } else { raptor_stringbuffer_append_counted_string(uri_sb, RASQAL_GOOD_CAST(const unsigned char*, "&named-graph-uri="), 17, 1); graph_uri = dg->name_uri; } graph_str = raptor_uri_as_counted_string(graph_uri, &graph_len); raptor_stringbuffer_append_uri_escaped_counted_string(uri_sb, RASQAL_GOOD_CAST(const char*, graph_str), graph_len, 1); } } str = raptor_stringbuffer_as_string(uri_sb); retrieval_uri = raptor_new_uri(raptor_world_ptr, str); if(!retrieval_uri) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to create retrieval URI %s", raptor_uri_as_string(retrieval_uri)); goto error; } raptor_free_stringbuffer(uri_sb); uri_sb = NULL; if(raptor_www_fetch(svc->www, retrieval_uri)) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to fetch retrieval URI %s", raptor_uri_as_string(retrieval_uri)); goto error; } /* Takes ownership of svc->sb */ read_iostr = rasqal_new_iostream_from_stringbuffer(raptor_world_ptr, svc->sb); svc->sb = NULL; if(!read_iostr) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to create iostream from string"); goto error; } read_base_uri = svc->final_uri ? svc->final_uri : svc->service_uri; read_formatter = rasqal_new_query_results_formatter(svc->world, /* format name */ NULL, svc->content_type, /* format URI */ NULL); if(!read_formatter) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to find query results reader for content type %s returned from %s", svc->content_type, raptor_uri_as_string(read_base_uri)); goto error; } /* Takes ownership of read_iostr with flags = 1 */ rowsource = rasqal_query_results_formatter_get_read_rowsource(svc->world, read_iostr, read_formatter, vars_table, read_base_uri, /* flags */ 1); read_iostr = NULL; if(!rowsource) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to decode %s query results data returned from %s", svc->content_type, raptor_uri_as_string(read_base_uri)); goto error; } error: if(retrieval_uri) raptor_free_uri(retrieval_uri); if(uri_sb) raptor_free_stringbuffer(uri_sb); if(read_formatter) rasqal_free_query_results_formatter(read_formatter); if(read_iostr) raptor_free_iostream(read_iostr); if(svc->final_uri) { raptor_free_uri(svc->final_uri); svc->final_uri = NULL; } if(svc->content_type) { RASQAL_FREE(char*, svc->content_type); svc->content_type = NULL; } if(svc->sb) { raptor_free_stringbuffer(svc->sb); svc->sb = NULL; } return rowsource; } /** * rasqal_service_execute: * @svc: rasqal service * * Execute a rasqal sparql protocol service * * Return value: query results or NULL on failure */ rasqal_query_results* rasqal_service_execute(rasqal_service* svc) { rasqal_query_results* results = NULL; rasqal_variables_table* vars_table; rasqal_rowsource* rowsource = NULL; results = rasqal_new_query_results2(svc->world, NULL, RASQAL_QUERY_RESULTS_BINDINGS); if(!results) { rasqal_log_error_simple(svc->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to create query results"); goto error; } vars_table = rasqal_query_results_get_variables_table(results); rowsource = rasqal_service_execute_as_rowsource(svc, vars_table); if(!rowsource) goto error; while(1) { rasqal_row* row = rasqal_rowsource_read_row(rowsource); if(!row) break; rasqal_query_results_add_row(results, row); } error: if(rowsource) rasqal_free_rowsource(rowsource); return results; } rasqal-0.9.33/src/sparql_common.h0000644000175000017500000000414212302204137013617 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sparql_common.h - SPARQL lexer/parser shared internals * * Copyright (C) 2004-2008, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * */ #ifndef SPARQL_COMMON_H #define SPARQL_COMMON_H #ifdef __cplusplus extern "C" { #endif /* sparql_parser.y */ int sparql_syntax_error(rasqal_query *rq, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3); int sparql_syntax_warning(rasqal_query *rq, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3); int sparql_query_lex(void); struct rasqal_sparql_query_language_s { /* STATIC lexer */ yyscan_t scanner; int scanner_set; /* for error reporting */ unsigned int lineno; /* SPARQL query language language features supported */ /* querying with SELECT, CONSTRUCT, DESCRIBE, ASK */ int sparql_scda : 1; /* SPARQL 1.1 query language features (e.g. SELECT (expr AS var) ) */ int sparql11_query : 1; /* SPARQL 1.1 property path querying */ int sparql11_property_paths : 1; /* updating in general (LOAD, CLEAR, DROP, ADD, MOVE, COPY, CREATE, * INSERT, DELETE, MODIFY ) */ int sparql11_update : 1; /* laqrs */ int experimental : 1; /* count of errors in current query parse */ int error_count; /* for creating long literals */ raptor_stringbuffer* sb; }; typedef struct rasqal_sparql_query_language_s rasqal_sparql_query_language; #ifdef __cplusplus } #endif #endif rasqal-0.9.33/src/rasqal-config.10000644000175000017500000000333211317766506013426 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" .\" rasqal-config.1 - Rasqal RDF query library compiling utility manual page .\" .\" $Id$ .\" .\" Copyright (C) 2003-2009 David Beckett - http://www.dajobe.org/ .\" Copyright (C) 2003-2005 University of Bristol - http://www.bristol.ac.uk/ .\" .TH rasqal-config 1 "2006-01-11" .\" Please adjust this date whenever revising the manpage. .SH NAME rasqal-config \- script to get information about the installed version of the RDF query library .SH SYNOPSIS .B rasqal-config [\-\-prefix\fI[=DIR]\fP] [\-\-libs] [\-\-libtool\-libs] [\-\-cflags] [\-\-version] [\-\-version\-decimal] [\-\-help] .SH DESCRIPTION \fIrasqal-config\fP is a tool that is used to determine the compile and linker flags that should be used to compile and link programs that use the Rasqal RDF query library. .SH OPTIONS \fIrasqal-config\fP accepts the following options: .TP 8 .B \-\-version Print the currently installed version of rasqal on the standard output. .TP 8 .B \-\-version\-decimal Print the currently installed version of rasqal as a decimal integer. .TP 8 .B \-\-libs Print the linker flags that are necessary to link a program with Rasqal. .TP 8 .B \-\-libtool\-libs Print the path to the libtool file for rasqal. .TP 8 .B \-\-cflags Print the compiler flags that are necessary to compile a program with the RDF query language. .TP 8 .B \-\-prefix=PREFIX If specified, use PREFIX instead of the installation prefix that Rasqal was built with when computing the output for the \-\-cflags and \-\-libs options. This option must be specified before any \-\-libs or \-\-cflags options. .SH SEE ALSO .BR librasqal(3) .SH AUTHOR Dave Beckett - .UR http://www.dajobe.org/ http://www.dajobe.org/ .UE rasqal-0.9.33/src/rasqal_result_formats.c0000644000175000017500000006262712441120534015372 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_result_formats.c - Rasqal Query Result Format Class * * 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /* * rasqal_world_register_query_result_format_factory: * @world: rasqal world * @register_factory: pointer to function to call to register the factory * * INTERNAL - Register a query result format via a factory. * * All strings set in the @factory method are shared with the * #rasqal_query_result_format_factory * * Return value: new factory object or NULL on failure **/ rasqal_query_results_format_factory* rasqal_world_register_query_results_format_factory(rasqal_world* world, int (*register_factory)(rasqal_query_results_format_factory*)) { rasqal_query_results_format_factory *factory = NULL; factory = RASQAL_CALLOC(rasqal_query_results_format_factory*, 1, sizeof(*factory)); if(!factory) return NULL; factory->world = world; if(raptor_sequence_push(world->query_results_formats, factory)) return NULL; /* on error, factory is already freed by the sequence */ /* Call the factory registration function on the new object */ if(register_factory(factory)) /* factory is owned and freed by the query_results_formats sequence */ return NULL; factory->desc.flags = 0; if(factory->get_rowsource) factory->desc.flags |= RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER; if(factory->write) factory->desc.flags |= RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER; if(raptor_syntax_description_validate(&factory->desc)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Result query result format description failed to validate\n"); goto tidy; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Registered query result format %s with context size %d\n", factory->desc.names[0], factory->context_length); #endif return factory; /* Clean up on failure */ tidy: rasqal_free_query_results_format_factory(factory); return NULL; } void rasqal_free_query_results_format_factory(rasqal_query_results_format_factory* factory) { if(!factory) return; RASQAL_FREE(query_results_format_factory, factory); } int rasqal_init_result_formats(rasqal_world* world) { int rc = 0; world->query_results_formats = raptor_new_sequence((raptor_data_free_handler)rasqal_free_query_results_format_factory, NULL); if(!world->query_results_formats) return 1; rc += rasqal_init_result_format_sparql_xml(world) != 0; rc += rasqal_init_result_format_json(world) != 0; rc += rasqal_init_result_format_table(world) != 0; rc += rasqal_init_result_format_sv(world) != 0; rc += rasqal_init_result_format_html(world) != 0; rc += rasqal_init_result_format_turtle(world) != 0; rc += rasqal_init_result_format_rdf(world) != 0; return rc; } void rasqal_finish_result_formats(rasqal_world* world) { if(world->query_results_formats) { raptor_free_sequence(world->query_results_formats); world->query_results_formats = NULL; } } static rasqal_query_results_format_factory* rasqal_get_query_results_formatter_factory(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) { int i; rasqal_query_results_format_factory* factory = NULL; for(i = 0; 1; i++) { int factory_flags = 0; factory = (rasqal_query_results_format_factory*)raptor_sequence_get_at(world->query_results_formats, i); if(!factory) break; if(factory->get_rowsource) factory_flags |= RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER; if(factory->write) factory_flags |= RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER; /* Flags must match */ if(flags && (factory_flags & flags) != flags) continue; if(!name && !uri) /* the default is the first registered format */ break; if(name) { int namei; const char* fname; for(namei = 0; (fname = factory->desc.names[namei]); namei++) { if(!strcmp(fname, name)) return factory; } } if(uri && factory->desc.uri_strings) { int j; const char* uri_string = RASQAL_GOOD_CAST(const char*, raptor_uri_as_string(uri)); const char* factory_uri_string = NULL; for(j = 0; (factory_uri_string = factory->desc.uri_strings[j]); j++) { if(!strcmp(uri_string, factory_uri_string)) break; } if(factory_uri_string) /* got an exact match syntax for URI - return result */ break; } if(mime_type) { int mti; const char* mname; for(mti = 0; (mname = factory->desc.mime_types[mti].mime_type); mti++) { if(!strcmp(mname, mime_type)) return factory; } } } return factory; } /** * rasqal_query_results_formats_check2: * @world: rasqal_world object * @name: the query results format name (or NULL) * @uri: #raptor_uri query results format uri (or NULL) * @mime_type: mime type name * @flags: bitmask of flags to signify that format is needed for reading (#RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER ) or writing ( #RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER ) * * Check if a query results formatter exists for the requested format. * * Return value: non-0 if a formatter exists. **/ int rasqal_query_results_formats_check2(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) { rasqal_query_results_format_factory* factory = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); factory = rasqal_get_query_results_formatter_factory(world, name, uri, mime_type, flags); return (factory != NULL); } /** * rasqal_query_results_formats_check: * @world: rasqal_world object * @name: the query results format name (or NULL) * @uri: #raptor_uri query results format uri (or NULL) * @mime_type: mime type name * @flags: bitmask of flags to signify that format is needed for reading (#RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER ) or writing ( #RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER ) * * Check if a query results formatter exists for the requested format. * * @Deprecated: use rasqal_query_results_formats_check2() since the * implementation of this function returned an inverted boolean result. * * Return value: 0 if a formatter exists. **/ int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags) { return !rasqal_query_results_formats_check2(world, name, uri, mime_type, flags); } /** * rasqal_new_query_results_formatter: * @world: rasqal_world object * @name: the query results format name (or NULL) * @mime_type: the query results format mime type (or NULL) * @format_uri: #raptor_uri query results format uri (or NULL) * * Constructor - create a new rasqal_query_results_formatter for an identified format. * * A query results format can be found by name, mime type or URI, all * of which are optional. If multiple fields are given, the first * match is given that matches the name, URI, mime_type in that * order. The default query results format will be used if all are * format identifying fields are NULL. * * See rasqal_world_get_query_results_format_description() for * obtaining the supported format URIs at run time. * * Return value: a new #rasqal_query_results_formatter object or NULL on failure */ rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri) { rasqal_query_results_format_factory* factory; rasqal_query_results_formatter* formatter; int flags = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); factory = rasqal_get_query_results_formatter_factory(world, name, format_uri, mime_type, flags); if(!factory) return NULL; formatter = RASQAL_CALLOC(rasqal_query_results_formatter*, 1, sizeof(*formatter)); if(!formatter) return NULL; formatter->factory = factory; formatter->context = NULL; if(factory->context_length) { formatter->context = RASQAL_CALLOC(void*, 1, RASQAL_GOOD_CAST(size_t, factory->context_length)); if(!formatter->context) { rasqal_free_query_results_formatter(formatter); return NULL; } } if(formatter->factory->init) { if(formatter->factory->init(formatter, name)) { rasqal_free_query_results_formatter(formatter); return NULL; } } return formatter; } /** * rasqal_new_query_results_formatter_for_content: * @world: world object * @uri: URI identifying the syntax (or NULL) * @mime_type: mime type identifying the content (or NULL) * @buffer: buffer of content to guess (or NULL) * @len: length of buffer * @identifier: identifier of content (or NULL) * * Constructor - create a new queryresults formatter for an identified format. * * Uses rasqal_world_guess_query_results_format_name() to find a * query results formatter by scoring recognition of the syntax by a * block of characters, the content identifier or a mime type. The * content identifier is typically a filename or URI or some other * identifier. * * Return value: a new #rasqal_query_results_formatter object or NULL on failure **/ rasqal_query_results_formatter* rasqal_new_query_results_formatter_for_content(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier) { const char* name; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); name = rasqal_world_guess_query_results_format_name(world, uri, mime_type, buffer, len, identifier); return name ? rasqal_new_query_results_formatter(world, name, NULL, NULL) : NULL; } /** * rasqal_free_query_results_formatter: * @formatter: #rasqal_query_results_formatter object * * Destructor - destroy a #rasqal_query_results_formatter object. **/ void rasqal_free_query_results_formatter(rasqal_query_results_formatter* formatter) { if(!formatter) return; if(formatter->factory->finish) formatter->factory->finish(formatter); if(formatter->context) RASQAL_FREE(context, formatter->context); RASQAL_FREE(rasqal_query_results_formatter, formatter); } /** * rasqal_world_get_query_results_format_description: * @world: world object * @counter: index into the list of query result formats * * Get query result format descriptive syntax information * * Return value: description or NULL if counter is out of range **/ const raptor_syntax_description* rasqal_world_get_query_results_format_description(rasqal_world* world, unsigned int counter) { rasqal_query_results_format_factory* factory; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); rasqal_world_open(world); factory = (rasqal_query_results_format_factory*)raptor_sequence_get_at(world->query_results_formats, RASQAL_GOOD_CAST(int, counter)); if(!factory) return NULL; return &factory->desc; } /** * rasqal_query_results_formatter_write: * @iostr: #raptor_iostream to write the query to * @formatter: #rasqal_query_results_formatter object * @results: #rasqal_query_results query results format * @base_uri: #raptor_uri base URI of the output format (or NULL) * * Write the query results using the given formatter to an iostream * * Note that after calling this method, the query results will be * empty and rasqal_query_results_finished() will return true (non-0) * * See rasqal_world_get_query_results_format_description() for * obtaining the supported format URIs at run time. * * Return value: non-0 on failure **/ int rasqal_query_results_formatter_write(raptor_iostream *iostr, rasqal_query_results_formatter* formatter, rasqal_query_results* results, raptor_uri *base_uri) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(formatter, rasqal_query_results_formatter, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(results, rasqal_query_results, 1); if(!formatter->factory->write) return 1; return formatter->factory->write(formatter, iostr, results, base_uri); } /** * rasqal_query_results_formatter_get_read_rowsource: * @world: rasqal world object * @iostr: #raptor_iostream to read the query from * @formatter: #rasqal_query_results_formatter object * @vars_table: #rasqal_variables_table variables table * @base_uri: #raptor_uri base URI of the input format * @flags: non-0 to take ownership of @iostr * * INTERNAL - read result rows from a formatted input iostream * * See rasqal_world_get_query_results_format_description() for * obtaining the supported format URIs at run time. * * Takes OWNERSHIP of the @iostr * * Return value: rowsource to read from or NULL on failure **/ rasqal_rowsource* rasqal_query_results_formatter_get_read_rowsource(rasqal_world *world, raptor_iostream *iostr, rasqal_query_results_formatter* formatter, rasqal_variables_table* vars_table, raptor_uri *base_uri, unsigned int flags) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(formatter, rasqal_query_results_formatter, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(vars_table, rasqal_variables_table, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(base_uri, raptor_uri, NULL); if(!formatter->factory->get_rowsource) return NULL; return formatter->factory->get_rowsource(formatter, world, vars_table, iostr, base_uri, flags); } /** * rasqal_query_results_formatter_get_boolean: * @world: rasqal world object * @iostr: #raptor_iostream to read the query from * @formatter: #rasqal_query_results_formatter object * @base_uri: #raptor_uri base URI of the input format * @flags: non-0 to take ownership of @iostr * * INTERNAL - read boolean result from a formatted input iostream * * See rasqal_world_get_query_results_format_description() for * obtaining the supported format URIs at run time. * * Takes OWNERSHIP of the @iostr * * Return value: boolean value 0 (false), >0 (true) or <0 on failure **/ static int rasqal_query_results_formatter_get_boolean(rasqal_world *world, raptor_iostream *iostr, rasqal_query_results_formatter* formatter, raptor_uri *base_uri, unsigned int flags) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, -1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, -1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(formatter, rasqal_query_results_formatter, -1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(base_uri, raptor_uri, -1); if(!formatter->factory->get_boolean) return -1; return formatter->factory->get_boolean(formatter, world, iostr, base_uri, flags); } /** * rasqal_query_results_formatter_read: * @world: rasqal world object * @iostr: #raptor_iostream to read the query from * @formatter: #rasqal_query_results_formatter object * @results: #rasqal_query_results query results format * @base_uri: #raptor_uri base URI of the input format * * Read the query results using the given formatter from an iostream * * See rasqal_world_get_query_results_format_description() for * obtaining the supported format URIs at run time. * * Return value: non-0 on failure **/ int rasqal_query_results_formatter_read(rasqal_world *world, raptor_iostream *iostr, rasqal_query_results_formatter* formatter, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_query_results_type type; int rc = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(formatter, rasqal_query_results_formatter, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(results, rasqal_query_results, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(base_uri, raptor_uri, 1); type = rasqal_query_results_get_type(results); switch(type) { case RASQAL_QUERY_RESULTS_BINDINGS: if(1) { rasqal_rowsource* rowsource = NULL; rasqal_variables_table* vars_table; vars_table = rasqal_query_results_get_variables_table(results); rowsource = rasqal_query_results_formatter_get_read_rowsource(world, iostr, formatter, vars_table, base_uri, 0); if(!rowsource) return 1; while(1) { rasqal_row* row = rasqal_rowsource_read_row(rowsource); if(!row) break; rasqal_query_results_add_row(results, row); } if(rowsource) rasqal_free_rowsource(rowsource); } break; case RASQAL_QUERY_RESULTS_BOOLEAN: if(1) { int bvalue; bvalue = rasqal_query_results_formatter_get_boolean(world, iostr, formatter, base_uri, 0); if(bvalue < 0) return 1; rasqal_query_results_set_boolean(results, bvalue); } break; case RASQAL_QUERY_RESULTS_GRAPH: case RASQAL_QUERY_RESULTS_SYNTAX: case RASQAL_QUERY_RESULTS_UNKNOWN: /* failure */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot read '%s' query results format\n", rasqal_query_results_type_label(type)); rc = 1; } return rc; } struct syntax_score { int score; rasqal_query_results_format_factory *factory; }; static int compare_syntax_score(const void *a, const void *b) { return ((struct syntax_score*)b)->score - ((struct syntax_score*)a)->score; } /** * rasqal_world_guess_query_results_format_name: * @world: world object * @uri: URI identifying the syntax (or NULL) * @mime_type: mime type identifying the content (or NULL) * @buffer: buffer of content to guess (or NULL) * @len: length of buffer * @identifier: identifier of content (or NULL) * * Guess a query results format name for content. * * Find a query results format by scoring recognition of the syntax * by a block of characters, the content identifier or a mime type. * The content identifier is typically a filename or URI or some * other identifier. * * Return value: a query results format name or NULL if no guess * could be made **/ const char* rasqal_world_guess_query_results_format_name(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier) { unsigned int i; rasqal_query_results_format_factory *factory; unsigned char *suffix = NULL; struct syntax_score* scores; int size; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); size = raptor_sequence_size(world->query_results_formats); scores = RASQAL_CALLOC(struct syntax_score*, RASQAL_GOOD_CAST(size_t, size), sizeof(struct syntax_score)); if(!scores) return NULL; if(identifier) { unsigned char *p = RASQAL_GOOD_CAST(unsigned char*, strrchr(RASQAL_GOOD_CAST(const char*, identifier), '.')); if(p) { unsigned char *from, *to; p++; suffix = RASQAL_MALLOC(unsigned char*, strlen(RASQAL_GOOD_CAST(const char*, p)) + 1); if(!suffix) { RASQAL_FREE(syntax_scores, scores); return NULL; } for(from = p, to = suffix; *from; ) { unsigned char c = *from++; /* discard the suffix if it wasn't '\.[a-zA-Z0-9]+$' */ if(!isalpha(c) && !isdigit(c)) { RASQAL_FREE(char*, suffix); suffix = NULL; to = NULL; break; } *to++ = isupper(c) ? (unsigned char)tolower(c): c; } if(to) *to = '\0'; } } for(i = 0; (factory = (rasqal_query_results_format_factory*)raptor_sequence_get_at(world->query_results_formats, RASQAL_GOOD_CAST(int, i))); i++) { int score = -1; const raptor_type_q* type_q = NULL; if(mime_type && factory->desc.mime_types) { int j; type_q = NULL; for(j = 0; (type_q = &factory->desc.mime_types[j]) && type_q->mime_type; j++) { if(!strcmp(mime_type, type_q->mime_type)) break; } /* got an exact match mime type - score it via the Q */ if(type_q) score = type_q->q; } /* mime type match has high Q - return result */ if(score >= 10) break; if(uri && factory->desc.uri_strings) { int j; const char* uri_string = RASQAL_GOOD_CAST(const char*, raptor_uri_as_string(uri)); const char* factory_uri_string = NULL; for(j = 0; (factory_uri_string = factory->desc.uri_strings[j]); j++) { if(!strcmp(uri_string, factory_uri_string)) break; } if(factory_uri_string) /* got an exact match syntax for URI - return result */ break; } if(factory->recognise_syntax) { int c = -1; /* Only use first N bytes to avoid HTML documents that contain examples */ #define FIRSTN 1024 if(buffer && len && len > FIRSTN) { c = buffer[FIRSTN]; /* FIXME - casts a read only const buffer to writeable */ (RASQAL_BAD_CAST(char*, buffer))[FIRSTN] = '\0'; } score += factory->recognise_syntax(factory, buffer, len, identifier, suffix, mime_type); if(c >= 0) /* FIXME - casts a read only const buffer to writeable */ (RASQAL_BAD_CAST(char*, buffer))[FIRSTN] = RASQAL_GOOD_CAST(char, c); } scores[i].score = score < 10 ? score : 10; scores[i].factory = factory; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG3("Score %15s : %d\n", factory->desc.names[0], score); #endif } if(!factory) { /* sort the scores and pick a factory */ qsort(scores, i, sizeof(struct syntax_score), compare_syntax_score); if(scores[0].score >= 0) factory = scores[0].factory; } if(suffix) RASQAL_FREE(char*, suffix); RASQAL_FREE(syntax_scores, scores); return factory ? factory->desc.names[0] : NULL; } rasqal-0.9.33/src/sv_config.h0000644000175000017500000000234412315200222012717 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sv_config.h: Rasqal configure wrapper for libsv * * Copyright (C) 2013, David Beckett http://www.dajobe.org/ * * 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. * */ #ifndef SV_CONFIG_H #define SV_CONFIG_H #ifdef __cplusplus extern "C" { #endif #include #define sv_new rasqal_sv_new #define sv_free rasqal_sv_free #define sv_set_option rasqal_sv_set_option #define sv_get_line rasqal_sv_get_line #define sv_get_header rasqal_sv_get_header #define sv_parse_chunk rasqal_sv_parse_chunk #ifdef RASQAL_DEBUG #define SV_DEBUG 1 #endif #ifdef __cplusplus } #endif #endif rasqal-0.9.33/src/rasqal_rowsource_graph.c0000644000175000017500000001767112340216071015531 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_graph.c - Rasqal graph rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr /* This rowsource evaluates part #3 where a variable is given. rasqal_algebra_graph_algebra_node_to_rowsource() implements #1 and #2 http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#sparqlAlgebraEval SPARQL Query Language for RDF - Evaluation of a Graph Pattern #1 if IRI is a graph name in D eval(D(G), Graph(IRI,P)) = eval(D(D[IRI]), P) #2 if IRI is not a graph name in D eval(D(G), Graph(IRI,P)) = the empty multiset #3 eval(D(G), Graph(var,P)) = Let R be the empty multiset foreach IRI i in D R := Union(R, Join( eval(D(D[i]), P) , Ω(?var->i) ) the result is R */ typedef struct { /* inner rowsource */ rasqal_rowsource *rowsource; /* GRAPH literal constant URI or variable */ rasqal_variable* var; /* dataset graph offset */ int dg_offset; /* number of graphs total */ int dg_size; /* row offset for read_row() */ int offset; int finished; } rasqal_graph_rowsource_context; static int rasqal_graph_next_dg(rasqal_graph_rowsource_context *con) { rasqal_query *query = con->rowsource->query; rasqal_data_graph *dg; con->finished = 0; while(1) { rasqal_literal *o; con->dg_offset++; dg = rasqal_query_get_data_graph(query, con->dg_offset); if(!dg) { con->finished = 1; break; } if(!dg->name_uri) continue; o = rasqal_new_uri_literal(query->world, raptor_uri_copy(dg->name_uri)); if(!o) { RASQAL_DEBUG1("Failed to create new URI literal\n"); con->finished = 1; break; } RASQAL_DEBUG2("Using data graph URI literal <%s>\n", rasqal_literal_as_string(o)); rasqal_rowsource_set_origin(con->rowsource, o); /* this passes ownership of o to con->var */ rasqal_variable_set_value(con->var, o); break; } return con->finished; } static int rasqal_graph_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_graph_rowsource_context *con; raptor_sequence* seq; con = (rasqal_graph_rowsource_context*)user_data; seq = rasqal_query_get_data_graph_sequence(rowsource->query); if(!seq) return 1; con->dg_size = raptor_sequence_size(seq); con->finished = 0; con->dg_offset = -1; con->offset = 0; /* Do not care if finished at this stage (it is not an * error). rasqal_graph_rowsource_read_row() will deal with * returning NULL for an empty result. */ rasqal_graph_next_dg(con); return 0; } static int rasqal_graph_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_graph_rowsource_context *con; con = (rasqal_graph_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); rasqal_variable_set_value(con->var, NULL); RASQAL_FREE(rasqal_graph_rowsource_context, con); return 0; } static int rasqal_graph_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_graph_rowsource_context* con; con = (rasqal_graph_rowsource_context*)user_data; rasqal_rowsource_ensure_variables(con->rowsource); rowsource->size = 0; /* Put GRAPH variable first in result row */ rasqal_rowsource_add_variable(rowsource, con->var); rasqal_rowsource_copy_variables(rowsource, con->rowsource); return 0; } static rasqal_row* rasqal_graph_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_graph_rowsource_context *con; rasqal_row* row = NULL; con = (rasqal_graph_rowsource_context*)user_data; if(con->finished) return NULL; while(1) { row = rasqal_rowsource_read_row(con->rowsource); if(row) break; if(rasqal_graph_next_dg(con)) { con->finished = 1; break; } if(rasqal_rowsource_reset(con->rowsource)) { con->finished = 1; break; } } /* If a row is returned, put the GRAPH variable value as first literal */ if(row) { rasqal_row* nrow; int i; nrow = rasqal_new_row_for_size(rowsource->world, 1 + row->size); if(!nrow) { rasqal_free_row(row); row = NULL; } else { rasqal_row_set_rowsource(nrow, rowsource); nrow->offset = row->offset; /* Put GRAPH variable value (or NULL) first in result row */ nrow->values[0] = rasqal_new_literal_from_literal(con->var->value); /* Copy (size-1) remaining variables from input row */ for(i = 0; i < row->size; i++) nrow->values[i + 1] = rasqal_new_literal_from_literal(row->values[i]); rasqal_free_row(row); row = nrow; } } return row; } static int rasqal_graph_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_graph_rowsource_context *con; con = (rasqal_graph_rowsource_context*)user_data; con->finished = 0; con->dg_offset = -1; con->offset = 0; rasqal_graph_next_dg(con); return rasqal_rowsource_reset(con->rowsource); } static rasqal_rowsource* rasqal_graph_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_graph_rowsource_context *con; con = (rasqal_graph_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_graph_rowsource_handler = { /* .version = */ 1, "graph", /* .init = */ rasqal_graph_rowsource_init, /* .finish = */ rasqal_graph_rowsource_finish, /* .ensure_variables = */ rasqal_graph_rowsource_ensure_variables, /* .read_row = */ rasqal_graph_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_graph_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_graph_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_graph_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * @var: graph variable * * INTERNAL - create a new GRAPH rowsource that binds a variable * * The @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_graph_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, rasqal_variable *var) { rasqal_graph_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource || !var) return NULL; con = RASQAL_CALLOC(rasqal_graph_rowsource_context*, 1, sizeof(*con)); if(!con) return NULL; con->rowsource = rowsource; con->var = var; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_graph_rowsource_handler, query->vars_table, flags); } rasqal-0.9.33/src/rasqal_feature.c0000644000175000017500000001444111717115020013742 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_feature.c - Query system features * * Copyright (C) 2006-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include /* Rasqal includes */ #include "rasqal.h" #include "rasqal_internal.h" static const struct { rasqal_feature feature; /* flag bits * 1=query feature * 2=unused * 4=string value (else int) */ int flags; const char *name; const char *label; } rasqal_features_list [RASQAL_FEATURE_LAST + 1]= { { RASQAL_FEATURE_NO_NET, 1, "noNet", "Deny network requests." } , { RASQAL_FEATURE_RAND_SEED, 1, "randSeed", "Set rand() seed." } }; static const char * const rasqal_feature_uri_prefix="http://feature.librdf.org/rasqal-"; /* NOTE: this is strlen(rasqal_feature_uri_prefix) */ #define RASQAL_FEATURE_URI_PREFIX_LEN 33 /* * rasqal_features_enumerate_common: * @world: rasqal_world object * @feature: feature enumeration (0+) * @name: pointer to store feature short name (or NULL) * @uri: pointer to store feature URI (or NULL) * @label: pointer to feature label (or NULL) * @flags: flags to match * * Internal: Get list of rasqal features. * * If @uri is not NULL, a pointer to a new raptor_uri is returned * that must be freed by the caller with raptor_free_uri(). * * Return value: 0 on success, <0 on failure, >0 if feature is unknown **/ static int rasqal_features_enumerate_common(rasqal_world* world, const rasqal_feature feature, const char **name, raptor_uri **uri, const char **label, int flags) { int i; /* for compatibility with older binaries that do not call it */ rasqal_world_open(world); for(i=0; i <= RASQAL_FEATURE_LAST; i++) if(rasqal_features_list[i].feature == feature && (rasqal_features_list[i].flags & flags)) { if(name) *name=rasqal_features_list[i].name; if(uri) { raptor_uri *base_uri; base_uri = raptor_new_uri(world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, rasqal_feature_uri_prefix)); if(!base_uri) return -1; *uri = raptor_new_uri_from_uri_local_name(world->raptor_world_ptr, base_uri, RASQAL_GOOD_CAST(const unsigned char*, rasqal_features_list[i].name)); raptor_free_uri(base_uri); } if(label) *label=rasqal_features_list[i].label; return 0; } return 1; } /** * rasqal_features_enumerate: * @world: rasqal_world object * @feature: feature enumeration (0+) * @name: pointer to store feature short name (or NULL) * @uri: pointer to store feature URI (or NULL) * @label: pointer to feature label (or NULL) * * Get list of rasqal features. * * If uri is not NULL, a pointer to a new raptor_uri is returned * that must be freed by the caller with raptor_free_uri(). * * Return value: 0 on success, <0 on failure, >0 if feature is unknown **/ int rasqal_features_enumerate(rasqal_world* world, const rasqal_feature feature, const char **name, raptor_uri **uri, const char **label) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, -1); return rasqal_features_enumerate_common(world, feature, name, uri, label, 1); } /** * rasqal_feature_value_type * @feature: rasqal query feature * * Get the type of a features. * * The type of the @feature is 0=integer , 1=string. Other values are * undefined. Most features are integer values and use * rasqal_query_set_feature rasqal_query_get_feature() * * Return value: the type of the feature or <0 if @feature is unknown */ int rasqal_feature_value_type(const rasqal_feature feature) { if(feature > RASQAL_FEATURE_LAST) return -1; return (rasqal_features_list[feature].flags & 4) ? 1 : 0; } /** * rasqal_feature_from_uri: * @world: rasqal_world object * @uri: feature URI * * Turn a feature URI into an feature enum. * * The allowed feature URIs are available via rasqal_features_enumerate(). * * Return value: < 0 if the feature is unknown **/ rasqal_feature rasqal_feature_from_uri(rasqal_world* world, raptor_uri *uri) { unsigned char *uri_string; int i; rasqal_feature feature = (rasqal_feature)-1; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, feature); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(uri, rasqal_world, feature); /* for compatibility with older binaries that do not call it */ rasqal_world_open(world); uri_string = raptor_uri_as_string(uri); if(strncmp(RASQAL_GOOD_CAST(const char*, uri_string), rasqal_feature_uri_prefix, RASQAL_FEATURE_URI_PREFIX_LEN)) return feature; uri_string += RASQAL_FEATURE_URI_PREFIX_LEN; for(i = 0; i <= RASQAL_FEATURE_LAST; i++) if(!strcmp(rasqal_features_list[i].name, RASQAL_GOOD_CAST(const char*, uri_string))) { feature = (rasqal_feature)i; break; } return feature; } /** * rasqal_get_feature_count: * * Get the count of features defined. * * This is prefered to the compile time-only symbol #RASQAL_FEATURE_LAST * and returns a count of the number of features which is * #RASQAL_FEATURE_LAST+1. * * Return value: count of features in the #rasqal_feature enumeration **/ unsigned int rasqal_get_feature_count(void) { return RASQAL_FEATURE_LAST+1; } rasqal-0.9.33/src/rasqal_rowsource_distinct.c0000644000175000017500000001354012340216071016240 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_distinct.c - Rasqal distinct rowsource class * * Copyright (C) 2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { /* inner rowsource to distinct */ rasqal_rowsource *rowsource; /* map for distincting row values */ rasqal_map* map; /* offset into results for current row */ int offset; } rasqal_distinct_rowsource_context; static int rasqal_distinct_rowsource_init_common(rasqal_rowsource* rowsource, void *user_data) { rasqal_query *query = rowsource->query; rasqal_distinct_rowsource_context *con; con = (rasqal_distinct_rowsource_context*)user_data; con->offset = 0; con->map = rasqal_engine_new_rowsort_map(1, query->compare_flags, NULL); if(!con->map) return 1; return 0; } static int rasqal_distinct_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { /* rasqal_distinct_rowsource_context *con; con = (rasqal_distinct_rowsource_context*)user_data; */ return rasqal_distinct_rowsource_init_common(rowsource, user_data); } static int rasqal_distinct_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_distinct_rowsource_context* con; con = (rasqal_distinct_rowsource_context*)user_data; rasqal_rowsource_ensure_variables(con->rowsource); rowsource->size = 0; rasqal_rowsource_copy_variables(rowsource, con->rowsource); return 0; } static int rasqal_distinct_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_distinct_rowsource_context *con; con = (rasqal_distinct_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->map) rasqal_free_map(con->map); RASQAL_FREE(rasqal_distinct_rowsource_context, con); return 0; } static rasqal_row* rasqal_distinct_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_distinct_rowsource_context *con; rasqal_row *row = NULL; con = (rasqal_distinct_rowsource_context*)user_data; while(1) { int result; row = rasqal_rowsource_read_row(con->rowsource); if(!row) break; result = rasqal_engine_rowsort_map_add_row(con->map, row); RASQAL_DEBUG2("row is %s\n", result ? "not distinct" : "distinct"); if(!result) /* row was distinct (not a duplicate) so return it */ break; } if(row) { row = rasqal_new_row_from_row(row); rasqal_row_set_rowsource(row, rowsource); row->offset = con->offset++; } return row; } static int rasqal_distinct_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_distinct_rowsource_context *con; int rc; con = (rasqal_distinct_rowsource_context*)user_data; if(con->map) rasqal_free_map(con->map); rc = rasqal_distinct_rowsource_init_common(rowsource, user_data); if(rc) return rc; return rasqal_rowsource_reset(con->rowsource); } static rasqal_rowsource* rasqal_distinct_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_distinct_rowsource_context *con; con = (rasqal_distinct_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_distinct_rowsource_handler = { /* .version = */ 1, "distinct", /* .init = */ rasqal_distinct_rowsource_init, /* .finish = */ rasqal_distinct_rowsource_finish, /* .ensure_variables = */ rasqal_distinct_rowsource_ensure_variables, /* .read_row = */ rasqal_distinct_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_distinct_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_distinct_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_distinct_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * * INTERNAL - create a new DISTINCT rowsoruce * * The @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_distinct_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource) { rasqal_distinct_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource) goto fail; con = RASQAL_CALLOC(rasqal_distinct_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_distinct_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); return NULL; } rasqal-0.9.33/src/rasqal_engine.c0000644000175000017500000000356611717077764013610 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_engine.c - Rasqal query engine utility functions * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #include "rasqal.h" #include "rasqal_internal.h" #ifdef RASQAL_DEBUG static const char rasqal_engine_parts_string[16][5] = { /* 0 - 3 */ "----", "S---", "-P--", "SP--", /* 4 - 7 */ "--O-", "S-O-", "-PO-", "SPO-", /* 8 - 11 */ "---G", "S--G", "-P-G", "SP-G", /* 12 - 15 */ "--OG", "S-OG", "-POG", "SPOG", }; const char* rasqal_engine_get_parts_string(rasqal_triple_parts parts) { return rasqal_engine_parts_string[RASQAL_GOOD_CAST(int, parts) & RASQAL_TRIPLE_SPOG]; } #endif #ifdef RASQAL_DEBUG static const char* const rasqal_engine_error_labels[RASQAL_ENGINE_ERROR_LAST+2]= { "ok", "FAILED", "finished", "unknown" }; const char* rasqal_engine_error_as_string(rasqal_engine_error error) { if(error > RASQAL_ENGINE_ERROR_LAST) error = (rasqal_engine_error)(RASQAL_ENGINE_ERROR_LAST+1); return rasqal_engine_error_labels[RASQAL_GOOD_CAST(int, error)]; } #endif rasqal-0.9.33/src/rasqal_rowsource_having.c0000644000175000017500000001526211623522417015705 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_having.c - Rasqal having rowsource class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { /* inner rowsource to having */ rasqal_rowsource *rowsource; /* sequence of HAVING conditions */ raptor_sequence* exprs_seq; /* offset into results for current row */ int offset; } rasqal_having_rowsource_context; static int rasqal_having_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { return 0; } static int rasqal_having_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_having_rowsource_context* con; con = (rasqal_having_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; if(rasqal_rowsource_copy_variables(rowsource, con->rowsource)) return 1; return 0; } static int rasqal_having_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_having_rowsource_context *con; con = (rasqal_having_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->exprs_seq) raptor_free_sequence(con->exprs_seq); RASQAL_FREE(rasqal_having_rowsource_context, con); return 0; } static rasqal_row* rasqal_having_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_having_rowsource_context *con; rasqal_row *row = NULL; con = (rasqal_having_rowsource_context*)user_data; while(1) { raptor_sequence* literal_seq = NULL; int bresult = 1; int error = 0; row = rasqal_rowsource_read_row(con->rowsource); if(!row) break; literal_seq = rasqal_expression_sequence_evaluate(rowsource->query, con->exprs_seq, /* ignore_errors */ 0, &error); if(error) { if(literal_seq) raptor_free_sequence(literal_seq); rasqal_free_row(row); row = NULL; continue; } #ifdef RASQAL_DEBUG RASQAL_DEBUG1("having expression list result: "); if(!literal_seq) fputs("NULL", DEBUG_FH); else raptor_sequence_print(literal_seq, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(!literal_seq) { bresult = 0; } else { rasqal_literal* result; int i; /* Assume all conditions must evaluate to true */ for(i = 0; (result = (rasqal_literal*)raptor_sequence_get_at(literal_seq, i)); i++) { bresult = rasqal_literal_as_boolean(result, &error); #ifdef RASQAL_DEBUG if(error) RASQAL_DEBUG1("having boolean expression returned error\n"); else RASQAL_DEBUG2("having boolean expression result: %d\n", bresult); #endif if(error) bresult = 0; if(!bresult) break; } raptor_free_sequence(literal_seq); } if(bresult) /* Constraint succeeded so end */ break; rasqal_free_row(row); row = NULL; } if(row) { /* HAVING never adds/removes to the selection order from the * input row, no need to re-bind row->values[] */ row->offset = con->offset++; } return row; } static int rasqal_having_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_having_rowsource_context *con; con = (rasqal_having_rowsource_context*)user_data; return rasqal_rowsource_reset(con->rowsource); } static rasqal_rowsource* rasqal_having_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_having_rowsource_context *con; con = (rasqal_having_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_having_rowsource_handler = { /* .version = */ 1, "having", /* .init = */ rasqal_having_rowsource_init, /* .finish = */ rasqal_having_rowsource_finish, /* .ensure_variables = */ rasqal_having_rowsource_ensure_variables, /* .read_row = */ rasqal_having_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_having_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_having_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_having_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * @expr_seq: sequence of HAVING expressions * * INTERNAL - create a new HAVING rowsource * * The @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_having_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, raptor_sequence* exprs_seq) { rasqal_having_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource || !exprs_seq) goto fail; con = RASQAL_CALLOC(rasqal_having_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; con->exprs_seq = rasqal_expression_copy_expression_sequence(exprs_seq); return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_having_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); if(exprs_seq) raptor_free_sequence(exprs_seq); return NULL; } rasqal-0.9.33/src/ssort.h0000644000175000017500000000265412356406761012145 00000000000000/* ** ssort() -- Fast, small, qsort()-compatible Shell sort ** ** by Ray Gardner, public domain 5/90 */ #include /** * rasqal_ssort_r: * @base: base data * @nel: number of elements at @base * @width: width of an element * @comp: comparison function taking args (a, b, @arg) * @arg: user data (thunk) for the comparison function @comp * * Fast, small shell sort compatible to qsort_r() taking an extra thunk / user data arg. * * Sorts data at @base of @nel elements of width @width using * comparison function @comp that takes args (a, b, @arg). * * Return value: non-0 on failure * */ static int rasqal_ssort_r(void* base, size_t nel, size_t width, raptor_data_compare_arg_handler comp, void* arg) { size_t wnel, gap, k; /* bad args */ if(!base || !width || !comp) return -1; /* nothing to do */ if(nel < 2) return 0; wnel = width * nel; for(gap = 0; ++gap < nel;) gap *= 3; while((gap /= 3) != 0) { size_t wgap = width * gap; size_t i; for(i = wgap; i < wnel; i += width) { size_t j = i; do { char* a; char* b; j -= wgap; a = j + (char *)base; b = a + wgap; if ((*comp)(a, b, arg) <= 0) break; k = width; do { char tmp = *a; *a++ = *b; *b++ = tmp; } while (--k); } while(j >= wgap); } } return 0; } rasqal-0.9.33/src/rasqal_rowsource_service.c0000644000175000017500000002105512435675630016076 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_service.c - Rasqal SERVICE rowsource class * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE typedef struct { rasqal_service* svc; rasqal_query* query; rasqal_rowsource* rowsource; int count; /* bit flags; currently using RASQAL_ENGINE_BITFLAG_SILENT */ unsigned int flags; } rasqal_service_rowsource_context; static int rasqal_service_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_service_rowsource_context* con; con = (rasqal_service_rowsource_context*)user_data; con->rowsource = rasqal_service_execute_as_rowsource(con->svc, con->query->vars_table); if(!con->rowsource) { /* Silent errors return an empty rowsource */ if(con->flags & RASQAL_ENGINE_BITFLAG_SILENT) { con->rowsource = rasqal_new_empty_rowsource(con->query->world, con->query); return 0; } return 1; } return 0; } static int rasqal_service_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_service_rowsource_context* con; con = (rasqal_service_rowsource_context*)user_data; if(con->svc) rasqal_free_service(con->svc); if(con->rowsource) rasqal_free_rowsource(con->rowsource); RASQAL_FREE(rasqal_service_rowsource_context, con); return 0; } static int rasqal_service_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_service_rowsource_context* con; int rc; con = (rasqal_service_rowsource_context*)user_data; rc = rasqal_rowsource_ensure_variables(con->rowsource); if(rc) return rc; /* copy in variables from format rowsource */ rc = rasqal_rowsource_copy_variables(rowsource, con->rowsource); return rc; } static rasqal_row* rasqal_service_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_service_rowsource_context* con; con = (rasqal_service_rowsource_context*)user_data; return rasqal_rowsource_read_row(con->rowsource); } static raptor_sequence* rasqal_service_rowsource_read_all_rows(rasqal_rowsource* rowsource, void *user_data) { rasqal_service_rowsource_context* con; con = (rasqal_service_rowsource_context*)user_data; return rasqal_rowsource_read_all_rows(con->rowsource); } static const rasqal_rowsource_handler rasqal_service_rowsource_handler = { /* .version = */ 1, "service", /* .init = */ rasqal_service_rowsource_init, /* .finish = */ rasqal_service_rowsource_finish, /* .ensure_variables = */ rasqal_service_rowsource_ensure_variables, /* .read_row = */ rasqal_service_rowsource_read_row, /* .read_all_rows = */ rasqal_service_rowsource_read_all_rows, /* .reset = */ NULL, /* .set_preserve = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /** * rasqal_new_service_rowsource: * @world: world object * @query: query object * @service_uri: service URI * @query_string: query to send to service * @data_graphs: sequence of data graphs (or NULL) * @rs_flags: service rowsource flags * * INTERNAL - create a new rowsource that takes rows from a service * * All arguments are copied. * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_service_rowsource(rasqal_world *world, rasqal_query* query, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs, unsigned int rs_flags) { rasqal_service_rowsource_context* con = NULL; rasqal_service* svc = NULL; int flags = 0; int silent = (rs_flags & RASQAL_ENGINE_BITFLAG_SILENT); if(!world || !query_string) goto fail; svc = rasqal_new_service(query->world, service_uri, query_string, data_graphs); if(!svc) { if(!silent) goto fail; /* Silent errors so tidy up and return empty rowsource */ RASQAL_FREE(cstring, query_string); if(data_graphs) raptor_free_sequence(data_graphs); return rasqal_new_empty_rowsource(world, query); } con = RASQAL_CALLOC(rasqal_service_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->svc = svc; con->query = query; con->flags = rs_flags; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_service_rowsource_handler, query->vars_table, flags); fail: if(svc) rasqal_free_service(svc); if(con) RASQAL_FREE(rasqal_service_rowsource_context, con); if(query_string) RASQAL_FREE(cstring, query_string); if(data_graphs) raptor_free_sequence(data_graphs); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; rasqal_row* row = NULL; int count; raptor_sequence* seq = NULL; int failures = 0; raptor_uri* service_uri; const unsigned char* query_string; raptor_sequence* data_graphs = NULL; unsigned int rs_flags = 0; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } query = rasqal_new_query(world, "sparql", NULL); service_uri = raptor_new_uri(world->raptor_world_ptr, (const unsigned char *)"http://example.org/service"); query_string = (const unsigned char*)"SELECT * WHERE { ?s ?p ?o }"; rowsource = rasqal_new_service_rowsource(world, query, service_uri, query_string, data_graphs, rs_flags); if(!rowsource) { fprintf(stderr, "%s: failed to create service rowsource\n", program); failures++; goto tidy; } row = rasqal_rowsource_read_row(rowsource); if(!row) { fprintf(stderr, "%s: read_row failed to return a row for an service rowsource\n", program); failures++; goto tidy; } if(row->size) { fprintf(stderr, "%s: read_row returned an non-service row size %d for a service stream\n", program, row->size); failures++; goto tidy; } count = rasqal_rowsource_get_rows_count(rowsource); if(count != 1) { fprintf(stderr, "%s: read_rows returned count %d for a service stream\n", program, count); failures++; goto tidy; } rasqal_free_rowsource(rowsource); /* re-init rowsource */ rowsource = rasqal_new_service_rowsource(world, query, service_uri, query_string, data_graphs, rs_flags); seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: read_rows returned a NULL seq for a service stream\n", program); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != 1) { fprintf(stderr, "%s: read_rows returned size %d seq for a service stream\n", program, count); failures++; goto tidy; } tidy: if(seq) raptor_free_sequence(seq); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_digest.c0000644000175000017500000001351612434455625013607 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_digest.c - Rasqal message digests * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /* Implementations with alternative message digest libraries follow */ /* * libmhash (LGPL 2+) * http://mhash.sourceforge.net/ * * Requires: (nothing) * * code: #include * cflags: * ldflags -lmhash * * No config program * * No pkg-config support * * Debian packages: libmhash2, libmhash-dev * Redhat packages: ? */ #ifdef RASQAL_DIGEST_MHASH #undef PACKAGE #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef VERSION #include static hashid rasqal_digest_to_hashid[RASQAL_DIGEST_LAST + 1]={ (hashid)-1, MHASH_MD5, MHASH_SHA1, MHASH_SHA224, MHASH_SHA256, MHASH_SHA384, MHASH_SHA512 }; int rasqal_digest_buffer(rasqal_digest_type type, unsigned char *output, const unsigned char * const input, size_t len) { hashid hash_type; size_t output_len; MHASH m; if(type > RASQAL_DIGEST_LAST) return -1; hash_type = rasqal_digest_to_hashid[type]; if(hash_type == (hashid)-1) return -1; output_len = mhash_get_block_size(hash_type); if(!input) return RASQAL_GOOD_CAST(int, output_len); m = mhash_init(hash_type); if(m == MHASH_FAILED) return -1; mhash(m, (const void *)input, (mutils_word32)len); mhash_deinit(m, (void*)output); return RASQAL_GOOD_CAST(int, output_len); } #endif /* libgcrypt (LGPL 2.1+) * http://directory.fsf.org/project/libgcrypt/ * * Requires: GnuPG error [ libgpg-error0, libgpg-error-dev] * * Config program: libgcrypt-config * * code: #include * cflags: `libgcrypt-config --cflags` * ldflags: `libgcrypt-config --libs` * * Config program: libgcrypt-config * * No pkg-config support * * Debian packages: libgcrypt11, libgcrypt11-dev * Redhat packages:? */ #ifdef RASQAL_DIGEST_GCRYPT #ifdef HAVE_GCRYPT_H #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include #pragma GCC diagnostic warning "-Wdeprecated-declarations" #endif static enum gcry_md_algos rasqal_digest_to_gcry_md_algos[RASQAL_DIGEST_LAST + 1]={ GCRY_MD_NONE, GCRY_MD_MD5, GCRY_MD_SHA1, GCRY_MD_SHA224, GCRY_MD_SHA256, GCRY_MD_SHA384, GCRY_MD_SHA512 }; int rasqal_digest_buffer(rasqal_digest_type type, unsigned char *output, const unsigned char * const input, size_t len) { gcry_md_hd_t hash; enum gcry_md_algos algo; unsigned int output_len; if(type > RASQAL_DIGEST_LAST) return -1; algo = rasqal_digest_to_gcry_md_algos[type]; if(algo == GCRY_MD_NONE) return -1; output_len = gcry_md_get_algo_dlen(algo); if(!input) return output_len; if(gcry_md_open(&hash, algo, 0)) return -1; gcry_md_write(hash, input, len); gcry_md_final(hash); memcpy(output, gcry_md_read(hash, algo), output_len); gcry_md_close(hash); return output_len; } #endif /* apr-util (Apache 2.0) - a sub project of APR * http://apr.apache.org/ * * Requires: (probably) APR of same major version * * code: #include #include * cflags: `apu-config --includes` * ldflags: `apu-config --link-ld --libs` * * Config program: apu-config * * pkg-config: apr-util-1 * * Debian packages: libaprutil1, libaprutil1-dev * Redhat packages: apr-util * */ #ifdef RASQAL_DIGEST_APR #ifdef HAVE_APR_SHA1_H #include #endif #ifdef HAVE_APR_MD5_H #include #endif int rasqal_digest_buffer(rasqal_digest_type type, unsigned char *output, const unsigned char *input, size_t len) { unsigned int output_len = 0; if(type != RASQAL_DIGEST_SHA1 && type != RASQAL_DIGEST_MD5) return -1; #ifdef HAVE_APR_SHA1_H if(type == RASQAL_DIGEST_SHA1) output_len = APR_SHA1_DIGESTSIZE; #endif #ifdef HAVE_APR_MD5_H if(type == RASQAL_DIGEST_MD5) output_len = APR_MD5_DIGESTSIZE; if(!input) return output_len; #endif #ifdef HAVE_APR_SHA1_H if(type == RASQAL_DIGEST_SHA1) { struct apr_sha1_ctx_t c; apr_sha1_init(&c); apr_sha1_update_binary(&c, input, len); apr_sha1_final(RASQAL_GOOD_CAST(unsigned char*, output), &c); } #endif #ifdef HAVE_APR_MD5_H if(type == RASQAL_DIGEST_MD5) { if(apr_md5(RASQAL_GOOD_CAST(unsigned char*, output), input, len)) output_len = -1; } #endif return output_len; } #endif /* Internal message digests - MD5 and SHA1 */ #ifdef RASQAL_DIGEST_INTERNAL int rasqal_digest_buffer(rasqal_digest_type type, unsigned char *output, const unsigned char *input, size_t len) { int output_len = -1; if(type != RASQAL_DIGEST_SHA1 && type != RASQAL_DIGEST_MD5) return -1; if(type == RASQAL_DIGEST_SHA1) output_len = rasqal_digest_sha1_buffer(output, input, len); else output_len = rasqal_digest_md5_buffer(output, input, len); return output_len; } #endif rasqal-0.9.33/src/sparql_lexer.h0000644000175000017500000002171412434455661013472 00000000000000#ifndef sparql_lexer_HEADER_H #define sparql_lexer_HEADER_H 1 #define sparql_lexer_IN_HEADER 1 #line 6 "sparql_lexer.h" #line 8 "sparql_lexer.h" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) are macros in the reentrant scanner. */ #define yyin yyg->yyin_r #define yyout yyg->yyout_r #define yyextra yyg->yyextra_r #define yyleng yyg->yyleng_r #define yytext yyg->yytext_r #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ void sparql_lexer_restart (FILE *input_file ,yyscan_t yyscanner ); void sparql_lexer__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); void sparql_lexer__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); void sparql_lexer__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); void sparql_lexer_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); void sparql_lexer_pop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); YY_BUFFER_STATE sparql_lexer__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *sparql_lexer_alloc (yy_size_t ,yyscan_t yyscanner ); void *sparql_lexer_realloc (void *,yy_size_t ,yyscan_t yyscanner ); void sparql_lexer_free (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ #define yytext_ptr yytext_r #ifdef YY_HEADER_EXPORT_START_CONDITIONS #define INITIAL 0 #define ID 1 #define SPID 2 #define PREF 3 #define LITERAL 4 #define LITERAL2 5 #endif #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #define YY_EXTRA_TYPE rasqal_query* int sparql_lexer_lex_init (yyscan_t* scanner); int sparql_lexer_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int sparql_lexer_lex_destroy (yyscan_t yyscanner ); int sparql_lexer_get_debug (yyscan_t yyscanner ); void sparql_lexer_set_debug (int debug_flag ,yyscan_t yyscanner ); YY_EXTRA_TYPE sparql_lexer_get_extra (yyscan_t yyscanner ); void sparql_lexer_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *sparql_lexer_get_in (yyscan_t yyscanner ); void sparql_lexer_set_in (FILE * in_str ,yyscan_t yyscanner ); FILE *sparql_lexer_get_out (yyscan_t yyscanner ); void sparql_lexer_set_out (FILE * out_str ,yyscan_t yyscanner ); int sparql_lexer_get_leng (yyscan_t yyscanner ); char *sparql_lexer_get_text (yyscan_t yyscanner ); int sparql_lexer_get_lineno (yyscan_t yyscanner ); void sparql_lexer_set_lineno (int line_number ,yyscan_t yyscanner ); int sparql_lexer_get_column (yyscan_t yyscanner ); void sparql_lexer_set_column (int column_no ,yyscan_t yyscanner ); YYSTYPE * sparql_lexer_get_lval (yyscan_t yyscanner ); void sparql_lexer_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int sparql_lexer_wrap (yyscan_t yyscanner ); #else extern int sparql_lexer_wrap (yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int sparql_lexer_lex \ (YYSTYPE * yylval_param ,yyscan_t yyscanner); #define YY_DECL int sparql_lexer_lex \ (YYSTYPE * yylval_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* yy_get_previous_state - get the state just before the EOB char was reached */ #undef YY_NEW_FILE #undef YY_FLUSH_BUFFER #undef yy_set_bol #undef yy_new_buffer #undef yy_set_interactive #undef YY_DO_BEFORE_ACTION #ifdef YY_DECL_IS_OURS #undef YY_DECL_IS_OURS #undef YY_DECL #endif #line 786 "./sparql_lexer.l" #line 358 "sparql_lexer.h" #undef sparql_lexer_IN_HEADER #endif /* sparql_lexer_HEADER_H */ rasqal-0.9.33/src/rasqal_datetime.c0000644000175000017500000017573412434455625014137 00000000000000/* * rasqal_datetime.c - Rasqal XSD dateTime and XSD date * * Copyright (C) 2007-2011, David Beckett http://www.dajobe.org/ * * Contributions: * Copyright (C) 2007, Lauri Aalto * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_STDLIB_H #include #endif #include #include #include "rasqal.h" #include "rasqal_internal.h" /* Local definitions */ static int rasqal_xsd_datetime_parse(const char *datetime_string, rasqal_xsd_datetime *result, int is_dateTime); static unsigned int days_per_month(int month, int year); #ifndef ISNUM #define ISNUM(c) ((c) >= '0' && (c) <= '9') #endif /** * rasqal_xsd_datetime_normalize: * @datetime: date time * * INTERNAL - Normalize a date time into the allowed range * * The result will always give either * have_tz 'N' with timezone_minutes RASQAL_XSD_DATETIME_NO_TZ * have_tz 'Z' with timezone_minutes 0 * * Return value: zero on success, non zero on failure. */ static int rasqal_xsd_datetime_normalize(rasqal_xsd_datetime *datetime) { int t; if(datetime->have_tz == 'Y') { if(datetime->timezone_minutes) { /* Normalize to Zulu if there was a timezone offset */ datetime->hour = RASQAL_GOOD_CAST(signed char, datetime->hour - (datetime->timezone_minutes / 60)); datetime->minute = RASQAL_GOOD_CAST(signed char, datetime->minute - (datetime->timezone_minutes % 60)); datetime->timezone_minutes = 0; } datetime->have_tz = 'Z'; } /* second & second parts: no need to normalize as they are not * touched after range check */ /* minute */ if(datetime->minute < 0) { datetime->minute = RASQAL_GOOD_CAST(signed char, datetime->minute + 60); datetime->hour--; } else if(datetime->minute > 59) { datetime->minute = RASQAL_GOOD_CAST(signed char, datetime->minute - 60); datetime->hour++; } /* hour */ if(datetime->hour < 0) { datetime->hour = RASQAL_GOOD_CAST(signed char, datetime->hour + 24); datetime->day--; } else if(datetime->hour > 23) { datetime->hour = RASQAL_GOOD_CAST(signed char, datetime->hour - 24); datetime->day++; } /* day */ if(datetime->day < 1) { int y2; t = --datetime->month; /* going back beyond year boundary? */ if(!t) { t = 12; y2 = datetime->year-1; } else y2 = datetime->year; datetime->day = RASQAL_GOOD_CAST(unsigned char, datetime->day + days_per_month(t, y2)); } else { t = RASQAL_GOOD_CAST(int, days_per_month(datetime->month, datetime->year)); if(datetime->day > t) { datetime->day = RASQAL_GOOD_CAST(unsigned char, datetime->day - t); datetime->month++; } } /* month & year */ if(datetime->month < 1) { datetime->month = RASQAL_GOOD_CAST(unsigned char, datetime->month + 12); datetime->year--; /* there is no year 0 - go backwards to year -1 */ if(!datetime->year) datetime->year--; } else if(datetime->month > 12) { datetime->month = RASQAL_GOOD_CAST(unsigned char, datetime->month - 12); datetime->year++; /* there is no year 0 - go forwards to year 1 */ if(!datetime->year) datetime->year++; } datetime->time_on_timeline = rasqal_xsd_datetime_get_as_unixtime(datetime); /* success */ return 0; } /** * rasqal_xsd_datetime_parse: * @datetime_string: xsd:dateTime as lexical form string * @result: target struct for holding dateTime components * @is_dateTime: is xsd:dateTime and should look for time (hour, mins, secs) * otherwise is xsd:date and should skip to looking for timezone * * INTERNAL - Parse a xsd:dateTime string into a #rasqal_xsd_datetime struct. * * Does NOT normalize the structure. Call * rasqal_xsd_datetime_normalize() to do that. * * http://www.w3.org/TR/xmlschema-2/#dt-dateTime * * "The lexical space of dateTime consists of finite-length sequences of * characters of the form: * '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?, * where * * * '-'? yyyy is a four-or-more digit optionally negative-signed numeral that * represents the year; if more than four digits, leading zeros are * prohibited, and '0000' is prohibited (see the Note above (3.2.7); also * note that a plus sign is not permitted); * * the remaining '-'s are separators between parts of the date portion; * * the first mm is a two-digit numeral that represents the month; * * dd is a two-digit numeral that represents the day; * * 'T' is a separator indicating that time-of-day follows; * * hh is a two-digit numeral that represents the hour; '24' is permitted if * the minutes and seconds represented are zero, and the dateTime value so * represented is the first instant of the following day (the hour property * of a dateTime object in the value space cannot have a value greater * than 23); * * ':' is a separator between parts of the time-of-day portion; * * the second mm is a two-digit numeral that represents the minute; * * ss is a two-integer-digit numeral that represents the whole seconds; * * '.' s+ (if present) represents the fractional seconds; * * zzzzzz (if present) represents the timezone" * * * http://www.w3.org/TR/xmlschema-2/#dt-date * lexical space: '-'? yyyy '-' mm '-' dd zzzzzz? * * Return value: zero on success, non zero on failure. */ static int rasqal_xsd_datetime_parse(const char *datetime_string, rasqal_xsd_datetime *result, int is_dateTime) { const char *p, *q; #define B_SIZE 16 char b[B_SIZE]; unsigned int l, t, t2, is_neg; unsigned long u; #define MICROSECONDS_MAX_DIGITS 6 if(!datetime_string || !result) return -1; p = (const char *)datetime_string; is_neg = 0; /* Parse year */ /* negative years permitted */ if(*p == '-') { is_neg = 1; p++; } for(q = p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); /* error if - less than 4 digits in year - more than 4 digits && leading zeros - '-' does not follow numbers */ if(l < 4 || (l > 4 && *q=='0') || *p != '-') return -1; if(l >= (B_SIZE - 1)) l = RASQAL_GOOD_CAST(unsigned int, B_SIZE - 1); memcpy(b, q, l); b[l] = 0; /* ensure nul termination */ u = strtoul(b, 0, 10); /* year "0000" not permitted * restrict to signed int range * >= instead of > to allow for +-1 year adjustment in normalization * (however, these +-INT_MAX years cannot be parsed back in if * converted to string) */ if(!u || u >= INT_MAX) return -1; result->year = is_neg ? -RASQAL_GOOD_CAST(int, u) : RASQAL_GOOD_CAST(int, u); /* parse month */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); /* error if month is not 2 digits or '-' is not the separator */ if(l != 2 || *p != '-') return -2; t = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0')*10); t += RASQAL_GOOD_CAST(unsigned int, *q - '0'); /* month must be 1..12 */ if(t < 1 || t > 12) return -2; result->month = RASQAL_GOOD_CAST(unsigned char, t); /* parse day */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); if(is_dateTime) { /* xsd:dateTime: error if day is not 2 digits or 'T' is not the separator */ if(l != 2 || *p != 'T') return -3; } else { /* xsd:date: error if day is not 2 digits or separator is not * 'Z' (utc) * '+' or '-' (timezone offset) * nul (end of string - timezone is optional) */ if(l != 2 || (*p && *p != 'Z' && *p != '+' && *p != '-')) return -3; } t = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0') * 10); t += RASQAL_GOOD_CAST(unsigned int, *q - '0'); /* day must be 1..days_per_month */ if(t < 1 || t > days_per_month(result->month, result->year)) return -3; result->day = RASQAL_GOOD_CAST(unsigned char, t); if(is_dateTime) { /* parse hour */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); /* error if hour is not 2 digits or ':' is not the separator */ if(l != 2 || *p != ':') return -4; t = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0')*10); t += RASQAL_GOOD_CAST(unsigned int, *q - '0'); /* hour must be 0..24 - will handle special case 24 later * (no need to check for < 0) */ if(t > 24) return -4; result->hour = RASQAL_GOOD_CAST(signed char, t); /* parse minute */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); /* error if minute is not 2 digits or ':' is not the separator */ if(l != 2 || *p != ':') return -5; t = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0') * 10); t += RASQAL_GOOD_CAST(unsigned int, *q - '0'); /* minute must be 0..59 * (no need to check for < 0) */ if(t > 59) return -5; result->minute = RASQAL_GOOD_CAST(signed char, t); /* parse second whole part */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); /* error if second is not 2 digits or separator is not * '.' (second fraction) * 'Z' (utc) * '+' or '-' (timezone offset) * nul (end of string - second fraction and timezone are optional) */ if(l != 2 || (*p && *p != '.' && *p != 'Z' && *p != '+' && *p != '-')) return -6; t = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0')*10); t += RASQAL_GOOD_CAST(unsigned int, *q - '0'); /* second must be 0..59 * (no need to check for < 0) */ if(t > 59) return -6; result->second = RASQAL_GOOD_CAST(signed char, t); /* now that we have hour, minute and second, we can check * if hour == 24 -> only 24:00:00 permitted (normalized later) */ if(result->hour == 24 && (result->minute || result->second)) return -7; /* parse fraction seconds if any */ result->microseconds = 0; if(*p == '.') { for(q = ++p; ISNUM(*p); p++) ; /* ignore trailing zeros */ while(*--p == '0') ; p++; if(!(*q == '0' && q == p)) { /* allow ".0" */ l = RASQAL_GOOD_CAST(unsigned int, p - q); if(l < 1) /* need at least 1 num */ return -8; /* support only to microseconds with truncation */ if(l > MICROSECONDS_MAX_DIGITS) l = MICROSECONDS_MAX_DIGITS; result->microseconds = 0; for(t2 = 0; t2 < MICROSECONDS_MAX_DIGITS; ++t2) { if(t2 < l) result->microseconds += (*q++ - '0'); if(t2 != MICROSECONDS_MAX_DIGITS - 1) result->microseconds *= 10; } } /* skip ignored trailing zeros */ while(*p == '0') p++; } } else { /* end if is_dateTime */ /* set to center of day interval (noon) */ result->hour = 12; result->minute = 0; result->second = 0; result->microseconds = 0; } /* parse & adjust timezone offset */ /* result is normalized later */ result->timezone_minutes = RASQAL_XSD_DATETIME_NO_TZ; result->have_tz = 'N'; if(*p) { if(*p == 'Z') { /* utc timezone - no need to adjust */ result->timezone_minutes = 0; result->have_tz = 'Z'; p++; } else if(*p == '+' || *p == '-') { result->timezone_minutes = 0; result->have_tz = 'Y'; /* work out timezone offsets */ is_neg = *p == '-'; /* timezone hours */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); if(l != 2 || *p!=':') return -9; t2 = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0') * 10); t2 += RASQAL_GOOD_CAST(unsigned int, *q - '0'); if(t2 > 14) /* tz offset hours are restricted to 0..14 * (no need to check for < 0) */ return -9; result->timezone_minutes = RASQAL_GOOD_CAST(short int, (is_neg ? -t2 : t2) * 60); /* timezone minutes */ for(q = ++p; ISNUM(*p); p++) ; l = RASQAL_GOOD_CAST(unsigned int, p - q); if(l != 2) return -10; t = RASQAL_GOOD_CAST(unsigned int, (*q++ - '0') * 10); t += RASQAL_GOOD_CAST(unsigned int, *q - '0'); if(t > 59 || (t2 == 14 && t != 0)) { /* tz offset minutes are restricted to 0..59 * (no need to check for < 0) * or 0 if hour offset is exactly +-14 */ return -10; } result->timezone_minutes = RASQAL_GOOD_CAST(short int, result->timezone_minutes + RASQAL_GOOD_CAST(short int, (is_neg ? -t : t))); } /* failure if extra chars after the timezone part */ if(*p) return -11; } /* Initialise field even though this is not valid before * rasqal_xsd_datetime_normalize() is called on this object. */ result->time_on_timeline = 0; return 0; } static int rasqal_xsd_date_parse(const char *date_string, rasqal_xsd_date *result) { rasqal_xsd_datetime dt_result; /* on stack */ int rc; rc = rasqal_xsd_datetime_parse(date_string, &dt_result, 0); if(!rc) { result->year = dt_result.year; result->month = dt_result.month; result->day = dt_result.day; result->time_on_timeline = dt_result.time_on_timeline; result->timezone_minutes = dt_result.timezone_minutes; result->have_tz = dt_result.have_tz; /* This will be N or Z */ } return rc; } #ifdef STANDALONE /** * rasqal_xsd_date_normalize: * @date: date * * INTERNAL - Normalize a date into the allowed range * * Return value: zero on success, non zero on failure. */ static int rasqal_xsd_date_normalize(rasqal_xsd_date *date) { rasqal_xsd_datetime dt_result; /* on stack */ int rc; memset(&dt_result, '\0', sizeof(dt_result)); dt_result.year = date->year; dt_result.month = date->month; dt_result.day = date->day; /* set to center of day interval (noon) */ dt_result.hour = 12; dt_result.minute = 0; dt_result.second = 0; dt_result.microseconds = 0; dt_result.timezone_minutes = date->timezone_minutes; dt_result.have_tz = date->have_tz; rc = rasqal_xsd_datetime_normalize(&dt_result); if(!rc) { date->year = dt_result.year; date->month = dt_result.month; date->day = dt_result.day; date->time_on_timeline = dt_result.time_on_timeline; date->timezone_minutes = dt_result.timezone_minutes; date->have_tz = dt_result.have_tz; /* This will be N or Z */ } return rc; } #endif /* STANDALONE */ /** * rasqal_new_xsd_datetime: * @world: world object * @datetime_string: XSD Datetime string * * Constructor - make a new XSD datetime object from a string * * Return value: new datetime or NULL on failure */ rasqal_xsd_datetime* rasqal_new_xsd_datetime(rasqal_world* world, const char *datetime_string) { rasqal_xsd_datetime* dt; int rc = 0; dt = RASQAL_MALLOC(rasqal_xsd_datetime*, sizeof(*dt)); if(!dt) return NULL; rc = rasqal_xsd_datetime_parse(datetime_string, dt, 1); if(!rc) { rasqal_xsd_datetime dt_temp; /* copy on stack to normalize */ memcpy(&dt_temp, dt, sizeof(dt_temp)); rc = rasqal_xsd_datetime_normalize(&dt_temp); if(!rc) dt->time_on_timeline = dt_temp.time_on_timeline; } if(rc) { rasqal_free_xsd_datetime(dt); dt = NULL; } return dt; } /** * rasqal_new_xsd_datetime_from_unixtime: * @world: world object * @secs: unixtime * * Constructor - make a new XSD datetime object from unixtime seconds * * Return value: new datetime or NULL on failure */ rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_unixtime(rasqal_world* world, time_t secs) { rasqal_xsd_datetime* dt; int rc = 0; dt = RASQAL_MALLOC(rasqal_xsd_datetime*, sizeof(*dt)); if(!dt) return NULL; rc = rasqal_xsd_datetime_set_from_unixtime(dt, secs); if(rc) { rasqal_free_xsd_datetime(dt); dt = NULL; } return dt; } /** * rasqal_new_xsd_datetime_from_timeval: * @world: world object * @tv: pointer to struct timeval * * Constructor - make a new XSD datetime object from a timeval * * Return value: new datetime or NULL on failure */ rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_timeval(rasqal_world* world, struct timeval *tv) { rasqal_xsd_datetime* dt; int rc = 0; dt = RASQAL_MALLOC(rasqal_xsd_datetime*, sizeof(*dt)); if(!dt) return NULL; rc = rasqal_xsd_datetime_set_from_timeval(dt, tv); if(rc) { rasqal_free_xsd_datetime(dt); dt = NULL; } return dt; } /** * rasqal_new_xsd_datetime_from_xsd_date: * @world: world object * @date: pointer to XSD date * * Constructor - make a new XSD datetime object from an XSD date * * Return value: new datetime or NULL on failure */ rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_xsd_date(rasqal_world* world, rasqal_xsd_date *date) { rasqal_xsd_datetime* dt; dt = RASQAL_CALLOC(rasqal_xsd_datetime*, 1, sizeof(*dt)); if(!dt) return NULL; dt->year = date->year; dt->month = date->month; dt->day = date->day; /* hour, minute, seconds, microseconds are all zero from calloc */ dt->timezone_minutes = date->timezone_minutes; dt->time_on_timeline = date->time_on_timeline; dt->have_tz = date->have_tz; return dt; } /** * rasqal_free_xsd_datetime: * @dt: datetime object * * Destroy XSD datetime object. **/ void rasqal_free_xsd_datetime(rasqal_xsd_datetime* dt) { if(!dt) return; RASQAL_FREE(datetime, dt); } #define TIMEZONE_BUFFER_LEN 6 /* * rasqal_xsd_timezone_format: * @timezone_minutes: timezone minutes from #rasqal_xsd_datetime or #rasqal_xsd_date * @have_tz: have tz flag from #rasqal_xsd_datetime or #rasqal_xsd_date * @buffer: buffer to write the formatted timezone * @bufsize: length of @buffer; must be 7 or larger * * INTERNAL - format a timezone into the passed in buffer * * Return value: size of buffer or 0 on failure */ static int rasqal_xsd_timezone_format(signed short timezone_minutes, char have_tz, char* buffer, size_t bufsize) { size_t tz_len; if(!buffer || !bufsize) return -1; if(have_tz == 'N') { tz_len = 0; buffer[0] = '\0'; } else if(have_tz == 'Z') { tz_len = 1; if(bufsize < (tz_len + 1)) return -1; buffer[0] = 'Z'; buffer[1] = '\0'; } else { int mins; int hours; int digit; tz_len = TIMEZONE_BUFFER_LEN; if(bufsize < (tz_len + 1)) return -1; mins = abs(timezone_minutes); buffer[0] = (!mins || mins != timezone_minutes ? '-' : '+'); hours = (mins / 60); digit = (hours / 10); buffer[1] = RASQAL_GOOD_CAST(char, digit + '0'); buffer[2] = RASQAL_GOOD_CAST(char, hours - (digit * 10) + '0'); buffer[3] = ':'; mins -= hours * 60; buffer[4] = RASQAL_GOOD_CAST(char, (mins / 10) + '0'); mins -= mins * 10; buffer[5] = RASQAL_GOOD_CAST(char, mins + '0'); buffer[6] = '\0'; } return RASQAL_GOOD_CAST(int, tz_len); } static int rasqal_xsd_format_microseconds(char* buffer, size_t bufsize, unsigned int microseconds) { int len = 0; char *p; unsigned int value; unsigned int base = 10; unsigned int multiplier; value = microseconds; multiplier = 100000; do { value = value % multiplier; multiplier /= base; len++; } while(value && multiplier); if(!buffer || RASQAL_GOOD_CAST(int, bufsize) < (len + 1)) /* +1 for NUL */ return len; value = microseconds; multiplier = 100000; p = buffer; do { unsigned digit = value / multiplier; *p++ = RASQAL_GOOD_CAST(char, '0' + digit); value = value % multiplier; multiplier /= base; } while(value && multiplier); *p = '\0'; return len; } /** * rasqal_xsd_datetime_to_counted_string: * @dt: datetime struct * @len_p: output length (or NULL) * * Convert a #rasqal_xsd_datetime struct to a xsd:dateTime lexical form counted string. * * Caller should rasqal_free_memory() the returned string. * * See http://www.w3.org/TR/xmlschema-2/#dateTime-canonical-representation * * Return value: lexical form string or NULL on failure. */ char* rasqal_xsd_datetime_to_counted_string(const rasqal_xsd_datetime *dt, size_t *len_p) { size_t len; char *buffer = NULL; char *p; /* "[+-]HH:MM\0" */ char timezone_string[TIMEZONE_BUFFER_LEN + 1]; size_t year_len; int tz_string_len; size_t microseconds_len = 0; /* * http://www.w3.org/TR/xmlschema-2/#dateTime-canonical-representation * * "Except for trailing fractional zero digits in the seconds representation, * '24:00:00' time representations, and timezone (for timezoned values), * the mapping from literals to values is one-to-one. * Where there is more than one possible representation, * the canonical representation is as follows: * * The 2-digit numeral representing the hour must not be '24'; * * The fractional second string, if present, must not end in '0'; * * for timezoned values, the timezone must be represented with 'Z' * (All timezoned dateTime values are UTC.)." */ if(!dt) return NULL; tz_string_len = rasqal_xsd_timezone_format(dt->timezone_minutes, dt->have_tz, timezone_string, TIMEZONE_BUFFER_LEN + 1); if(tz_string_len < 0) return NULL; year_len = rasqal_format_integer(NULL, 0, dt->year, 4, '0'); len = year_len + RASQAL_GOOD_CAST(size_t, 15) + /* "-MM-DDTHH:MM:SS" = 15 */ RASQAL_GOOD_CAST(size_t, tz_string_len); if(dt->microseconds) { microseconds_len = RASQAL_GOOD_CAST(size_t, rasqal_xsd_format_microseconds(NULL, 0, RASQAL_GOOD_CAST(unsigned int, dt->microseconds))); len += 1 /* . */ + microseconds_len; } if(len_p) *len_p = len; buffer = RASQAL_MALLOC(char*, len + 1); if(!buffer) return NULL; p = buffer; p += rasqal_format_integer(p, year_len + 1, dt->year, 4, '0'); *p++ = '-'; p += rasqal_format_integer(p, 2 + 1, dt->month, 2, '0'); *p++ = '-'; p += rasqal_format_integer(p, 2 + 1, dt->day, 2, '0'); *p++ = 'T'; p += rasqal_format_integer(p, 2 + 1, dt->hour, 2, '0'); *p++ = ':'; p += rasqal_format_integer(p, 2 + 1, dt->minute, 2, '0'); *p++ = ':'; p += rasqal_format_integer(p, 2 + 1, dt->second, 2, '0'); if(dt->microseconds) { *p++ = '.'; p += rasqal_xsd_format_microseconds(p, microseconds_len + 1, RASQAL_GOOD_CAST(unsigned int, dt->microseconds)); } if(tz_string_len) { memcpy(p, timezone_string, RASQAL_GOOD_CAST(size_t, tz_string_len)); p += tz_string_len; } *p = '\0'; return buffer; } /** * rasqal_xsd_datetime_to_string: * @dt: datetime struct * * Convert a #rasqal_xsd_datetime struct to a xsd:dateTime lexical form string. * * Caller should rasqal_free_memory() the returned string. * * Return value: lexical form string or NULL on failure. */ char* rasqal_xsd_datetime_to_string(const rasqal_xsd_datetime *dt) { return rasqal_xsd_datetime_to_counted_string(dt, NULL); } /** * rasqal_xsd_datetime_equals2: * @dt1: first XSD dateTime * @dt2: second XSD dateTime * @incomparible_p: address to store incomparable flag (or NULL) * * Compare two XSD dateTimes for equality. * * Return value: non-0 if equal. **/ int rasqal_xsd_datetime_equals2(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p) { int cmp = rasqal_xsd_datetime_compare2(dt1, dt2, incomparible_p); return !cmp; } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_xsd_datetime_equals: * @dt1: first XSD dateTime * @dt2: second XSD dateTime * * Compare two XSD dateTimes for equality. * * @Deprecated: for rasqal_xsd_datetime_equals2 that returns incomparibility. * * Return value: non-0 if equal. **/ int rasqal_xsd_datetime_equals(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2) { return rasqal_xsd_datetime_equals2(dt1, dt2, NULL); } #endif /* * 3.2.7.4 Order relation on dateTime * http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dateTime */ static int rasqal_xsd_timeline_compare(time_t dt_timeline1, signed int dt_msec1, signed short tz_minutes1, time_t dt_timeline2, signed int dt_msec2, signed short tz_minutes2, int *incomparible_p) { int dt1_has_tz = (tz_minutes1 != RASQAL_XSD_DATETIME_NO_TZ); int dt2_has_tz = (tz_minutes2 != RASQAL_XSD_DATETIME_NO_TZ); int rc; #define SECS_FOR_14_HOURS (14 * 3600) /* Normalize - if there is a timezone that is not Z, convert it to Z * * Already done in rasqal_xsd_datetime_normalize() on construction */ if(dt1_has_tz == dt2_has_tz) { /* both are on same timeline */ if(dt_timeline1 < dt_timeline2) rc = -1; else if(dt_timeline1 > dt_timeline2) rc = 1; else rc = dt_msec1 - dt_msec2; } else if(dt1_has_tz) { /* dt1 has a tz, dt2 has no tz */ if(dt_timeline1 < (dt_timeline2 - SECS_FOR_14_HOURS)) rc = -1; else if(dt_timeline1 > (dt_timeline2 + SECS_FOR_14_HOURS)) rc = 1; else { if(incomparible_p) *incomparible_p = 1; rc = 2; /* incomparible really */ } } else { /* dt1 has no tz, dt2 has a tz */ if((dt_timeline1 + SECS_FOR_14_HOURS) < dt_timeline2) rc = -1; else if((dt_timeline1 - SECS_FOR_14_HOURS) > dt_timeline2) rc = 1; else { if(incomparible_p) *incomparible_p = 1; rc = 2; /* incomparible really */ } } return rc; } /** * rasqal_xsd_datetime_compare2: * @dt1: first XSD dateTime * @dt2: second XSD dateTime * @incomparible_p: address to store incomparable flag (or NULL) * * Compare two XSD dateTimes * * If the only one of the two dateTimes have timezones, the results * may be incomparible and that will return >0 and set the * value of the int point to by @incomparible_p to non-0 * * Return value: <0 if @dt1 is less than @dt2, 0 if equal, >0 otherwise **/ int rasqal_xsd_datetime_compare2(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p) { if(incomparible_p) *incomparible_p = 0; /* Handle NULLs */ if(!dt1 || !dt2) { /* NULLs sort earlier. equal only if both are NULL */ if(!dt1 && !dt2) return 0; return (!dt1) ? -1 : 1; } return rasqal_xsd_timeline_compare(dt1->time_on_timeline, dt1->microseconds, dt1->timezone_minutes, dt2->time_on_timeline, dt2->microseconds, dt2->timezone_minutes, incomparible_p); } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_xsd_datetime_compare: * @dt1: first XSD dateTime * @dt2: second XSD dateTime * * Compare two XSD dateTimes * * @Deprecated for rasqal_xsd_datetime_compare2() which can return the incomparible result. * * Return value: <0 if @dt1 is less than @dt2, 0 if equal, >0 otherwise **/ int rasqal_xsd_datetime_compare(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2) { return rasqal_xsd_datetime_compare2(dt1, dt2, NULL); } #endif /** * rasqal_xsd_datetime_get_seconds_as_decimal: * @world: world object * @dt: XSD dateTime * * Get the seconds component of a dateTime as a decimal * * Return value: decimal object or NULL on failure **/ rasqal_xsd_decimal* rasqal_xsd_datetime_get_seconds_as_decimal(rasqal_world* world, rasqal_xsd_datetime* dt) { rasqal_xsd_decimal* dec; dec = rasqal_new_xsd_decimal(world); if(!dec) return NULL; if(!dt->microseconds) { rasqal_xsd_decimal_set_long(dec, (long)dt->second); } else { /* Max len 9 "SS.UUUUUU\0" */ char str[10]; sprintf(str, "%d.%06d", dt->second, dt->microseconds); rasqal_xsd_decimal_set_string(dec, str); } return dec; } /* xsd:date formatted length excluding formatted year length */ #define DATE_BUFFER_LEN_NO_YEAR 6 /** * rasqal_xsd_date_to_counted_string: * @date: date struct * @len_p: output length (or NULL) * * Convert a #rasqal_xsd_date struct to a xsd:date lexical form string. * * Caller should rasqal_free_memory() the returned string. * * See http://www.w3.org/TR/xmlschema-2/#date-canonical-representation * * Return value: lexical form string or NULL on failure. */ char* rasqal_xsd_date_to_counted_string(const rasqal_xsd_date *date, size_t *len_p) { char *buffer = NULL; size_t len; char *p; int value; unsigned int d; size_t year_len; /* "[+-]HH:MM\0" */ char timezone_string[TIMEZONE_BUFFER_LEN + 1]; int tz_string_len; /* http://www.w3.org/TR/xmlschema-2/#date-canonical-representation * * "the date portion of the canonical representation (the entire * representation for nontimezoned values, and all but the timezone * representation for timezoned values) is always the date portion of * the dateTime canonical representation of the interval midpoint * (the dateTime representation, truncated on the right to eliminate * 'T' and all following characters). For timezoned values, append * the canonical representation of the ·recoverable timezone·. " * */ if(!date) return NULL; tz_string_len = rasqal_xsd_timezone_format(date->timezone_minutes, date->have_tz, timezone_string, TIMEZONE_BUFFER_LEN + 1); if(tz_string_len < 0) return NULL; year_len = rasqal_format_integer(NULL, 0, date->year, -1, '\0'); len = year_len + DATE_BUFFER_LEN_NO_YEAR + RASQAL_GOOD_CAST(size_t, tz_string_len); if(len_p) *len_p = len; buffer = RASQAL_MALLOC(char*, len + 1); if(!buffer) return NULL; p = buffer; /* value is year; length can vary */ p += rasqal_format_integer(p, year_len + 1, date->year, -1, '\0'); *p++ = '-'; /* value is 2-digit month */ value = date->month; d = RASQAL_GOOD_CAST(unsigned int, (value / 10)); *p++ = RASQAL_GOOD_CAST(char, d + '0'); value -= RASQAL_GOOD_CAST(int, d * 10); *p++ = RASQAL_GOOD_CAST(char, value + '0'); *p++ = '-'; /* value is 2-digit day */ value = date->day; d = RASQAL_GOOD_CAST(unsigned int, (value / 10)); *p++ = RASQAL_GOOD_CAST(char, d + '0'); value -= RASQAL_GOOD_CAST(int, d * 10); *p++ = RASQAL_GOOD_CAST(char, value + '0'); if(tz_string_len) { memcpy(p, timezone_string, RASQAL_GOOD_CAST(size_t, tz_string_len)); p += tz_string_len; } *p = '\0'; return buffer; } /** * rasqal_xsd_date_to_string: * @d: date struct * * Convert a #rasqal_xsd_date struct to a xsd:date lexical form string. * * Caller should rasqal_free_memory() the returned string. * * Return value: lexical form string or NULL on failure. */ char* rasqal_xsd_date_to_string(const rasqal_xsd_date *d) { return rasqal_xsd_date_to_counted_string(d, NULL); } /** * days_per_month: * @month: month 1-12 * @year: gregorian year * * INTERNAL - returns the number of days in given month and year. * * Return value: number of days or 0 on invalid arguments */ static unsigned int days_per_month(int month, int year) { switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: /* any of bottom 2 bits non-zero -> not 0 mod 4 -> not leap year */ if(year & 3) return 28; /* 0 mod 400 and 0 mod 4 -> leap year */ if(!(year % 400)) return 29; /* 0 mod 100 and not 0 mod 400 and 0 mod 4 -> not leap year */ if(!(year % 100)) return 28; /* other 0 mod 4 years -> leap year */ return 29; default: /* error */ return 0; } } int rasqal_xsd_datetime_check(const char* string) { rasqal_xsd_datetime d; /* This should be correct according to * http://www.w3.org/TR/xmlschema-2/#dateTime */ return !rasqal_xsd_datetime_parse(string, &d, 1); } int rasqal_xsd_date_check(const char* string) { rasqal_xsd_date d; /* This should be correct according to * http://www.w3.org/TR/xmlschema-2/#date */ return !rasqal_xsd_date_parse(string, &d); } #define TM_YEAR_ORIGIN 1900 #define TM_MONTH_ORIGIN 1 /** * rasqal_xsd_datetime_set_from_timeval: * @dt: datetime * @tv: timeval * * Set an XSD dateTime from a struct timeval pointer * * Returns: non-0 on failure **/ int rasqal_xsd_datetime_set_from_timeval(rasqal_xsd_datetime *dt, struct timeval *tv) { struct tm* my_time; #ifdef HAVE_GMTIME_R struct tm time_buf; #endif time_t sec; if(!dt || !tv) return 1; sec = (time_t)tv->tv_sec; #ifdef HAVE_GMTIME_R memset(&time_buf, '\0', sizeof(time_buf)); my_time = gmtime_r(&sec, &time_buf); #else my_time = gmtime(&sec); #endif if(!my_time) return 1; dt->year = my_time->tm_year + TM_YEAR_ORIGIN; dt->month = RASQAL_GOOD_CAST(unsigned char, my_time->tm_mon + TM_MONTH_ORIGIN); dt->day = RASQAL_GOOD_CAST(unsigned char, my_time->tm_mday); dt->hour = RASQAL_GOOD_CAST(signed char, my_time->tm_hour); dt->minute = RASQAL_GOOD_CAST(signed char, my_time->tm_min); dt->second = RASQAL_GOOD_CAST(signed char, my_time->tm_sec); dt->microseconds = RASQAL_GOOD_CAST(int, tv->tv_usec); dt->timezone_minutes = 0; /* always Zulu time */ dt->have_tz = 'Z'; return 0; } /** * rasqal_xsd_datetime_set_from_unixtime: * @dt: date time * @clock: unix time in seconds * * Set an XSD dateTime from unixtime seconds * * Returns: non-0 on failure **/ int rasqal_xsd_datetime_set_from_unixtime(rasqal_xsd_datetime* dt, time_t secs) { struct timeval tv; if(!dt) return 1; tv.tv_sec = secs; tv.tv_usec = 0; return rasqal_xsd_datetime_set_from_timeval(dt, &tv); } /** * rasqal_xsd_datetime_get_as_unixtime: * @dt: datetime * * Get a datetime as unix seconds * * Returns: unix seconds or 0 if @dt is NULL **/ time_t rasqal_xsd_datetime_get_as_unixtime(rasqal_xsd_datetime* dt) { struct tm time_buf; if(!dt) return 0; memset(&time_buf, '\0', sizeof(time_buf)); time_buf.tm_year = dt->year - TM_YEAR_ORIGIN; time_buf.tm_mon = dt->month - TM_MONTH_ORIGIN; time_buf.tm_mday = dt->day; time_buf.tm_hour = dt->hour; time_buf.tm_min = dt->minute; time_buf.tm_sec = dt->second; time_buf.tm_wday = 0; time_buf.tm_yday = 0; time_buf.tm_isdst = -1; #ifdef HAVE_TM_GMTOFF if(dt->timezone_minutes == RASQAL_XSD_DATETIME_NO_TZ) time_buf.tm_gmtoff = 0; else time_buf.tm_gmtoff = dt->timezone_minutes * 60; #endif return rasqal_timegm(&time_buf); } /** * rasqal_xsd_datetime_get_as_timeval: * @dt: datetime * * Get a datetime as struct timeval * * The returned timeval must be freed by the caller such as using * rasqal_free_memory(). * * Returns: pointer to a new timeval structure or NULL on failure **/ struct timeval* rasqal_xsd_datetime_get_as_timeval(rasqal_xsd_datetime *dt) { struct timeval *tv; if(!dt) return NULL; tv = RASQAL_CALLOC(struct timeval*, 1, sizeof(*tv)); if(!tv) return NULL; tv->tv_sec = rasqal_xsd_datetime_get_as_unixtime(dt); tv->tv_usec = dt->microseconds; return tv; } /** * rasqal_xsd_datetime_get_timezone_as_counted_string: * @dt: datetime * @len_p: pointer to store returned string length * * Get the timezone of a datetime as a duration format string with optional length count * * The returned string is owned by the caller and must be freed * by rasqal_free_memory(). * * Returns: pointer to a new string or NULL on failure **/ char* rasqal_xsd_datetime_get_timezone_as_counted_string(rasqal_xsd_datetime *dt, size_t *len_p) { /* timezone duration as implemented here is a signed integer number * of seconds like +- 14 hours:minutes (no days or larger units, no * seconds or smaller). * * When written in the canonical format, a restricted * xsd:dayTimeDuration format, it is constraint to a format like -?PThhmm * * For example: -PT14H59M PT14H59M and PT0S for a zero timezone offset */ #define TZ_STR_SIZE 10 char* tz_str; char* p; int minutes; unsigned int hours; if(!dt) return NULL; minutes = dt->timezone_minutes; if(minutes == RASQAL_XSD_DATETIME_NO_TZ) return NULL; tz_str = RASQAL_MALLOC(char*, TZ_STR_SIZE + 1); if(!tz_str) return NULL; p = tz_str; if(minutes < 0) { *p++ = '-'; minutes = -minutes; } *p++ = 'P'; *p++ = 'T'; hours = RASQAL_GOOD_CAST(unsigned int, (minutes / 60)); if(hours) { #if 1 if(hours > 9) { *p++ = RASQAL_GOOD_CAST(char, '0' + (hours / 10)); hours %= 10; } *p++ = RASQAL_GOOD_CAST(char, '0' + hours); *p++ = 'H'; #else p += sprintf(p, "%dH", hours); #endif minutes -= RASQAL_GOOD_CAST(int, hours * 60); } if(minutes) { #if 1 if(minutes > 9) { *p++ = RASQAL_GOOD_CAST(char, '0' + (minutes / 10)); minutes %= 10; } *p++ = RASQAL_GOOD_CAST(char, '0' + minutes); *p++ = 'M'; #else p += sprintf(p, "%dM", minutes); #endif } if(!dt->timezone_minutes) { *p++ = '0'; *p++ = 'S'; } *p = '\0'; if(len_p) *len_p = RASQAL_GOOD_CAST(size_t, p - tz_str); return tz_str; } /** * rasqal_xsd_datetime_get_tz_as_counted_string: * @dt: datetime * @len_p: pointer to store returned string length * * Get the timezone of a datetime as a timezone string * * The returned string is owned by the caller and must be freed * by rasqal_free_memory(). * * Returns: pointer to a new string or NULL on failure **/ char* rasqal_xsd_datetime_get_tz_as_counted_string(rasqal_xsd_datetime* dt, size_t *len_p) { char* s; s = RASQAL_MALLOC(char*, TIMEZONE_BUFFER_LEN + 1); if(!s) return NULL; if(rasqal_xsd_timezone_format(dt->timezone_minutes, dt->have_tz, s, TIMEZONE_BUFFER_LEN + 1) < 0) goto failed; if(len_p) *len_p = TIMEZONE_BUFFER_LEN; return s; failed: RASQAL_FREE(char*, s); return NULL; } /** * rasqal_new_xsd_date: * @world: world object * @date_string: XSD date string * * Constructor - make a new XSD date object from a string * * Return value: new datetime or NULL on failure */ rasqal_xsd_date* rasqal_new_xsd_date(rasqal_world* world, const char *date_string) { rasqal_xsd_datetime dt_result; /* on stack */ rasqal_xsd_date* d; int rc = 0; d = RASQAL_CALLOC(rasqal_xsd_date*, 1, sizeof(*d)); if(!d) return NULL; rc = rasqal_xsd_datetime_parse(date_string, &dt_result, 0); if(!rc) { d->year = dt_result.year; d->month = dt_result.month; d->day = dt_result.day; d->timezone_minutes = dt_result.timezone_minutes; d->have_tz = dt_result.have_tz; dt_result.hour = 12; /* Noon */ dt_result.minute = 0; dt_result.second = 0; dt_result.microseconds = 0; rc = rasqal_xsd_datetime_normalize(&dt_result); /* Track the starting instant as determined by the timezone */ d->time_on_timeline = dt_result.time_on_timeline; if(d->timezone_minutes != RASQAL_XSD_DATETIME_NO_TZ) d->time_on_timeline += (60 * dt_result.timezone_minutes); } if(rc) { rasqal_free_xsd_date(d); d = NULL; } return d; } /** * rasqal_free_xsd_date: * @d: date object * * Destroy XSD date object. **/ void rasqal_free_xsd_date(rasqal_xsd_date* d) { if(!d) return; RASQAL_FREE(rasqal_xsd_date, d); } /** * rasqal_xsd_date_equals: * @d1: first XSD date * @d2: second XSD date * @incomparible_p: address to store incomparable flag (or NULL) * * Compare two XSD dates for equality. * * Return value: non-0 if equal. **/ int rasqal_xsd_date_equals(const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p) { int cmp = rasqal_xsd_date_compare(d1, d2, incomparible_p); return !cmp; } /** * rasqal_xsd_date_compare: * @d1: first XSD date * @d2: second XSD date * @incomparible_p: address to store incomparable flag (or NULL) * * Compare two XSD dates * * If the only one of the two dates have timezones, the results * may be incomparible and that will return >0 and set the * value of the int point to by @incomparible_p to non-0 * * Return value: <0 if @d1 is less than @d2, 0 if equal, >0 otherwise **/ int rasqal_xsd_date_compare(const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p) { if(incomparible_p) *incomparible_p = 0; /* Handle NULLs */ if(!d1 || !d2) { /* NULLs sort earlier. equal only if both are NULL */ if(!d1 && !d2) return 0; return (!d1) ? -1 : 1; } return rasqal_xsd_timeline_compare(d1->time_on_timeline, 0 /* msec */, d1->timezone_minutes, d2->time_on_timeline, 0 /* msec */, d2->timezone_minutes, incomparible_p); } #ifdef STANDALONE #include #ifdef HAVE_SYS_TIME_H #include #endif int main(int argc, char *argv[]); #define MYASSERT(c) \ if(!(c)) { \ fprintf(stderr, "%s: assertion failed at %s:%d: %s\n", program, __FILE__, __LINE__, #c); \ exit(1); \ } static int test_datetime_parse_and_normalize(const char *datetime_string, rasqal_xsd_datetime *result) { if(rasqal_xsd_datetime_parse(datetime_string, result, 1)) return 1; return rasqal_xsd_datetime_normalize(result); } static int test_datetime_parser_tostring(const char *in_str, const char *out_expected) { rasqal_xsd_datetime d; /* allocated on stack */ char const *s = NULL; int r = 1; if(!test_datetime_parse_and_normalize(in_str, &d)) { s = rasqal_xsd_datetime_to_string(&d); } if(s) { r = strcmp(RASQAL_GOOD_CAST(char*, s), out_expected); if(r) fprintf(stderr, "input dateTime \"%s\" converted to canonical \"%s\", expected \"%s\"\n", in_str, s, out_expected); RASQAL_FREE(char*, s); } else fprintf(stderr, "input dateTime \"%s\" converted to canonical (null), expected \"%s\"\n", in_str, out_expected); return r; } static int test_date_parse_and_normalize(const char *date_string, rasqal_xsd_date *result) { if(rasqal_xsd_date_parse(date_string, result)) return 1; return rasqal_xsd_date_normalize(result); } static int test_date_parser_tostring(const char *in_str, const char *out_expected) { rasqal_xsd_date d; /* allocated on stack */ char const *s = NULL; int r = 1; if(!test_date_parse_and_normalize(in_str, &d)) { s = rasqal_xsd_date_to_string(&d); } if(s) { r = strcmp(RASQAL_GOOD_CAST(char*, s), out_expected); if(r) fprintf(stderr, "input date \"%s\" converted to canonical \"%s\", expected \"%s\"\n", in_str, s, out_expected); RASQAL_FREE(char*, s); } else fprintf(stderr, "input date \"%s\" converted to canonical (null), expected \"%s\"\n", in_str, out_expected); return r; } #define INCOMPARABLE 2 static int test_date_equals(rasqal_world* world, const char *value1, const char *value2, int expected_eq) { rasqal_xsd_date* d1; rasqal_xsd_date* d2; int r = 1; int incomparable = 0; int eq; d1 = rasqal_new_xsd_date(world, value1); d2 = rasqal_new_xsd_date(world, value2); eq = rasqal_xsd_date_equals(d1, d2, &incomparable); if(incomparable) eq = INCOMPARABLE; rasqal_free_xsd_date(d1); rasqal_free_xsd_date(d2); if(eq != expected_eq) { fprintf(stderr, "date equals \"%s\" to \"%s\" returned %d expected %d\n", value1, value2, eq, expected_eq); r = 1; } return r; } static int test_date_not_equals(rasqal_world* world, const char *value1, const char *value2, int expected_neq) { rasqal_xsd_date* d1; rasqal_xsd_date* d2; int r = 1; int incomparable = 0; int neq; d1 = rasqal_new_xsd_date(world, value1); d2 = rasqal_new_xsd_date(world, value2); neq = !rasqal_xsd_date_equals(d1, d2, &incomparable); if(incomparable) neq = INCOMPARABLE; rasqal_free_xsd_date(d1); rasqal_free_xsd_date(d2); if(neq != expected_neq) { fprintf(stderr, "date not equals \"%s\" to \"%s\" returned %d expected %d\n", value1, value2, neq, expected_neq); r = 1; } return r; } static int test_date_compare(rasqal_world* world, const char *value1, const char *value2, int expected_cmp) { rasqal_xsd_date* d1; rasqal_xsd_date* d2; int r = 1; int incomparable = 0; int cmp; d1 = rasqal_new_xsd_date(world, value1); d2 = rasqal_new_xsd_date(world, value2); cmp = rasqal_xsd_date_compare(d1, d2, &incomparable); if(incomparable) cmp = INCOMPARABLE; else if (cmp < 0) cmp = -1; else if (cmp > 0) cmp = 1; rasqal_free_xsd_date(d1); rasqal_free_xsd_date(d2); if(cmp != expected_cmp) { fprintf(stderr, "date compare \"%s\" to \"%s\" returned %d expected %d\n", value1, value2, cmp, expected_cmp); r = 1; } return r; } static int test_datetime_equals(rasqal_world* world, const char *value1, const char *value2, int expected_eq) { rasqal_xsd_datetime* d1; rasqal_xsd_datetime* d2; int r = 1; int incomparable = 0; int eq; d1 = rasqal_new_xsd_datetime(world, value1); d2 = rasqal_new_xsd_datetime(world, value2); eq = rasqal_xsd_datetime_equals2(d1, d2, &incomparable); if(incomparable) eq = INCOMPARABLE; rasqal_free_xsd_datetime(d1); rasqal_free_xsd_datetime(d2); if(eq != expected_eq) { fprintf(stderr, "datetime equals \"%s\" to \"%s\" returned %d expected %d\n", value1, value2, eq, expected_eq); r = 1; } return r; } static int test_datetime_compare(rasqal_world* world, const char *value1, const char *value2, int expected_cmp) { rasqal_xsd_datetime* d1; rasqal_xsd_datetime* d2; int r = 1; int incomparable = 0; int cmp; d1 = rasqal_new_xsd_datetime(world, value1); d2 = rasqal_new_xsd_datetime(world, value2); cmp = rasqal_xsd_datetime_compare2(d1, d2, &incomparable); if(incomparable) cmp = INCOMPARABLE; else if (cmp < 0) cmp = -1; else if (cmp > 0) cmp = 1; rasqal_free_xsd_datetime(d1); rasqal_free_xsd_datetime(d2); if(cmp != expected_cmp) { fprintf(stderr, "datetime compare \"%s\" to \"%s\" returned %d expected %d\n", value1, value2, cmp, expected_cmp); r = 1; } return r; } int main(int argc, char *argv[]) { char const *program = rasqal_basename(*argv); rasqal_world* world; rasqal_xsd_datetime dt; rasqal_xsd_date d; world = rasqal_new_world(); /* days_per_month */ MYASSERT(!days_per_month(0,287)); MYASSERT(days_per_month(1,467) == 31); MYASSERT(days_per_month(2,1900) == 28); MYASSERT(days_per_month(2,1901) == 28); MYASSERT(days_per_month(2,2000) == 29); MYASSERT(days_per_month(2,2004) == 29); MYASSERT(days_per_month(3,1955) == 31); MYASSERT(days_per_month(4,3612) == 30); MYASSERT(days_per_month(5,467) == 31); MYASSERT(days_per_month(6,398) == 30); MYASSERT(days_per_month(7,1832) == 31); MYASSERT(days_per_month(8,8579248) == 31); MYASSERT(days_per_month(9,843) == 30); MYASSERT(days_per_month(10,84409) == 31); MYASSERT(days_per_month(11,398) == 30); MYASSERT(days_per_month(12,4853) == 31); MYASSERT(!days_per_month(13,45894)); /* DATETIME */ /* rasqal_xsd_datetime_parse_and_normalize, rasqal_xsd_datetime_to_string and rasqal_xsd_datetime_string_to_canonical */ #define PARSE_AND_NORMALIZE_DATETIME(_s,_d) \ test_datetime_parse_and_normalize(_s, _d) /* generic */ MYASSERT(!rasqal_xsd_datetime_to_string(0)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME(0,0)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("uhgsufi",0)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME(0 ,&dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("fsdhufhdsuifhidu", &dt)); /* year */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("123-12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("-123-12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("0000-12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("01234-12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("-01234-12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("1234a12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("-1234b12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("g162-12-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("5476574658746587465874-12-12T12:12:12Z", &dt)); MYASSERT(test_datetime_parser_tostring("1234-12-12T12:12:12Z", "1234-12-12T12:12:12Z") == 0); MYASSERT(test_datetime_parser_tostring("-1234-12-12T12:12:12Z", "-1234-12-12T12:12:12Z") == 0); MYASSERT(test_datetime_parser_tostring("1234567890-12-12T12:12:12Z", "1234567890-12-12T12:12:12Z") == 0); MYASSERT(test_datetime_parser_tostring("-1234567890-12-12T12:12:12Z", "-1234567890-12-12T12:12:12Z") == 0); /* month */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-v-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-00-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("PARSE_AND_NORMALIZE-011-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-13-12T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-12.12T12:12:12Z", &dt)); MYASSERT(test_datetime_parser_tostring("2004-01-01T12:12:12Z", "2004-01-01T12:12:12Z") == 0); /* day */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-ffT12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-00T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-007T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-32T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01t12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01- 1T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2005-02-29T12:12:12Z", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2005-02-28T12:12:12Z", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-02-29T12:12:12Z", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2000-02-29T12:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("1900-02-29T12:12:12Z", &dt)); MYASSERT(test_datetime_parser_tostring("2012-04-12T12:12:12Z", "2012-04-12T12:12:12Z") == 0); /* hour */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01Tew:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T-1:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T001:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T25:12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T01.12:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T24:12:00Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T24:00:34Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T24:12:34Z", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T24:00:00Z", &dt)); MYASSERT(test_datetime_parser_tostring("2012-04-12T24:00:00", "2012-04-13T00:00:00") == 0); /* minute */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:ij:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:-1:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:042:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:69:12Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12.12Z", &dt)); /* second */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:ijZ", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:-1", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:054Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:69Z", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12z", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12", &dt)); /* fraction second */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.i", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.0", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.01", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.1", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.100", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.1000000000000000000000000000000000000000000", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.5798459847598743987549", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.1d", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12.1Z", &dt)); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.01Z", "2006-05-18T18:36:03.01Z") == 0); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.10Z", "2006-05-18T18:36:03.1Z") == 0); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.010Z", "2006-05-18T18:36:03.01Z") == 0); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.1234Z", "2006-05-18T18:36:03.1234Z") == 0); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.1234", "2006-05-18T18:36:03.1234") == 0); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.1239Z", "2006-05-18T18:36:03.1239Z") == 0); MYASSERT(test_datetime_parser_tostring("2006-05-18T18:36:03.1239", "2006-05-18T18:36:03.1239") == 0); /* timezones + normalization */ MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12-", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+00.00", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+aa:bb", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+15:00", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+14:01", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+14:00", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12-14:01", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12-14:00", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+10:99", &dt)); MYASSERT(!PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+10:59", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+10:059", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+010:59", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+10:59a", &dt)); MYASSERT(PARSE_AND_NORMALIZE_DATETIME("2004-01-01T12:12:12+10:059", &dt)); MYASSERT(test_datetime_parser_tostring("2004-12-31T23:50:22-01:15", "2005-01-01T01:05:22Z") == 0); MYASSERT(test_datetime_parser_tostring("2005-01-01T01:00:05+02:12", "2004-12-31T22:48:05Z") == 0); MYASSERT(test_datetime_parser_tostring("0001-01-01T00:00:00+00:01", "-0001-12-31T23:59:00Z") == 0); MYASSERT(test_datetime_parser_tostring("-0001-12-31T23:59:00-00:01", "0001-01-01T00:00:00Z") == 0); MYASSERT(test_datetime_parser_tostring("2005-03-01T00:00:00+01:00", "2005-02-28T23:00:00Z") == 0); MYASSERT(test_datetime_parser_tostring("2004-03-01T00:00:00+01:00", "2004-02-29T23:00:00Z") == 0); MYASSERT(test_datetime_parser_tostring("2005-02-28T23:00:00-01:00", "2005-03-01T00:00:00Z") == 0); MYASSERT(test_datetime_parser_tostring("2004-02-29T23:00:00-01:00", "2004-03-01T00:00:00Z") == 0); /* DATE */ #define PARSE_AND_NORMALIZE_DATE(_s,_d) \ test_date_parse_and_normalize(_s, _d) /* generic */ MYASSERT(!rasqal_xsd_date_to_string(0)); MYASSERT(PARSE_AND_NORMALIZE_DATE(0,0)); MYASSERT(PARSE_AND_NORMALIZE_DATE("uhgsufi",0)); MYASSERT(PARSE_AND_NORMALIZE_DATE(0 ,&d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("fsdhufhdsuifhidu", &d)); /* year */ MYASSERT(PARSE_AND_NORMALIZE_DATE("123-12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("-123-12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("0000-12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("01234-12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("-01234-12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("1234a12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("-1234b12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("g162-12-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("5476574658746587465874-12-12Z", &d)); MYASSERT(test_date_parser_tostring("1234-12-12Z", "1234-12-12Z") == 0); MYASSERT(test_date_parser_tostring("-1234-12-12Z", "-1234-12-12Z") == 0); MYASSERT(test_date_parser_tostring("1234567890-12-12Z", "1234567890-12-12Z") == 0); MYASSERT(test_date_parser_tostring("-1234567890-12-12Z", "-1234567890-12-12Z") == 0); /* month */ MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-v-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-00-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("PARSE_AND_NORMALIZE-011-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-13-12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-12.12Z", &d)); MYASSERT(test_date_parser_tostring("2004-01-01Z", "2004-01-01Z") == 0); /* day */ MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-ffZ", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-00Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-007Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-32Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01t12:12:12Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01- 1Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2005-02-29Z", &d)); MYASSERT(!PARSE_AND_NORMALIZE_DATE("2005-02-28Z", &d)); MYASSERT(!PARSE_AND_NORMALIZE_DATE("2004-02-29Z", &d)); MYASSERT(!PARSE_AND_NORMALIZE_DATE("2000-02-29Z", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("1900-02-29Z", &d)); MYASSERT(test_date_parser_tostring("2012-04-12Z", "2012-04-12Z") == 0); /* timezones + normalization */ MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01-", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+00.00", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+aa:bb", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+15:00", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+14:01", &d)); MYASSERT(!PARSE_AND_NORMALIZE_DATE("2004-01-01+14:00", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01-14:01", &d)); MYASSERT(!PARSE_AND_NORMALIZE_DATE("2004-01-01-14:00", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+10:99", &d)); MYASSERT(!PARSE_AND_NORMALIZE_DATE("2004-01-01+10:59", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+10:059", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+010:59", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+10:59a", &d)); MYASSERT(PARSE_AND_NORMALIZE_DATE("2004-01-01+10:059", &d)); MYASSERT(test_date_parser_tostring("2004-12-31-13:00", "2005-01-01Z") == 0); MYASSERT(test_date_parser_tostring("2005-01-01+13:00", "2004-12-31Z") == 0); MYASSERT(test_date_parser_tostring("2004-12-31-11:59", "2004-12-31Z") == 0); MYASSERT(test_date_parser_tostring("2005-01-01+11:59", "2005-01-01Z") == 0); /* Date equality */ /* May not be comparible since <14hrs apart */ MYASSERT(test_date_equals(world, "2011-01-02Z", "2011-01-02" , INCOMPARABLE)); MYASSERT(test_date_equals(world, "2011-01-02" , "2011-01-02" , 1)); MYASSERT(test_date_equals(world, "2011-01-02", "2011-01-02Z", INCOMPARABLE)); MYASSERT(test_date_equals(world, "2011-01-02Z", "2011-01-02Z", 1)); /* Are comparible across timelines since >14hrs apart */ MYASSERT(test_date_equals(world, "2011-01-02Z", "2011-01-03" , 0)); MYASSERT(test_date_equals(world, "2011-01-02" , "2011-01-03" , 0)); MYASSERT(test_date_equals(world, "2011-01-02", "2011-01-03Z", 0)); MYASSERT(test_date_equals(world, "2011-01-02Z", "2011-01-03Z", 0)); MYASSERT(test_date_not_equals(world, "2006-08-23", "2006-08-23", 0)); MYASSERT(test_date_not_equals(world, "2006-08-23", "2006-08-23Z", INCOMPARABLE)); MYASSERT(test_date_not_equals(world, "2006-08-23", "2006-08-23+00:00", INCOMPARABLE)); /* More than 14hrs apart so are comparible */ MYASSERT(test_date_not_equals(world, "2006-08-23", "2001-01-01", 1)); MYASSERT(test_date_not_equals(world, "2006-08-23", "2001-01-01Z", 1)); /* Date comparisons */ MYASSERT(test_date_compare(world, "2011-01-02Z", "2011-01-02" , INCOMPARABLE)); MYASSERT(test_date_compare(world, "2011-01-02", "2011-01-02" , 0)); MYASSERT(test_date_compare(world, "2011-01-02", "2011-01-02Z", INCOMPARABLE)); MYASSERT(test_date_compare(world, "2011-01-02Z", "2011-01-02Z", 0)); MYASSERT(test_date_compare(world, "2011-01-02Z", "2011-01-03" , -1)); MYASSERT(test_date_compare(world, "2011-01-02", "2011-01-03" , -1)); MYASSERT(test_date_compare(world, "2011-01-02", "2011-01-03Z", -1)); MYASSERT(test_date_compare(world, "2011-01-02Z", "2011-01-03Z", -1)); /* DateTime equality */ MYASSERT(test_datetime_equals(world, "2011-01-02T00:00:00", "2011-01-02T00:00:00", 1)); MYASSERT(test_datetime_equals(world, "2011-01-02T00:00:00", "2011-01-02T00:00:00Z", INCOMPARABLE)); MYASSERT(test_datetime_equals(world, "2011-01-02T00:00:00Z", "2011-01-02T00:00:00", INCOMPARABLE)); MYASSERT(test_datetime_equals(world, "2011-01-02T00:00:00Z", "2011-01-02T00:00:00Z", 1)); /* DateTime comparisons */ MYASSERT(test_datetime_compare(world, "2011-01-02T00:00:00", "2011-01-02T00:00:00" , 0)); MYASSERT(test_datetime_compare(world, "2011-01-02T00:00:00", "2011-01-02T00:00:00Z", INCOMPARABLE)); MYASSERT(test_datetime_compare(world, "2011-01-02T00:00:00Z", "2011-01-02T00:00:00", INCOMPARABLE)); MYASSERT(test_datetime_compare(world, "2011-01-02T00:00:00Z", "2011-01-02T00:00:00Z", 0)); if(1) { struct timeval my_tv; time_t secs; time_t new_secs; struct timeval* new_tv; /* 2010-12-14T06:22:36.868099Z or 2010-12-13T22:22:36.868099+0800 * when I was testing this */ my_tv.tv_sec = 1292307756; my_tv.tv_usec = 868099; secs = my_tv.tv_sec; MYASSERT(rasqal_xsd_datetime_set_from_timeval(&dt, &my_tv) == 0); MYASSERT((new_tv = rasqal_xsd_datetime_get_as_timeval(&dt))); MYASSERT(new_tv->tv_sec == my_tv.tv_sec); MYASSERT(new_tv->tv_usec == my_tv.tv_usec); RASQAL_FREE(timeval, new_tv); MYASSERT(rasqal_xsd_datetime_set_from_unixtime(&dt, secs) == 0); MYASSERT((new_secs = rasqal_xsd_datetime_get_as_unixtime(&dt))); MYASSERT(new_secs == secs); } rasqal_free_world(world); return 0; } #endif /* STANDALONE */ rasqal-0.9.33/src/mtwist_config.h0000644000175000017500000000064311660625365013643 00000000000000/* Rasqal configure wrapper for libmtwist * * Includes configuration file * Adjusts symbols to be all rasqal_ prefixed */ #include #define mtwist_new rasqal_mtwist_new #define mtwist_free rasqal_mtwist_free #define mtwist_init rasqal_mtwist_init #define mtwist_u32rand rasqal_mtwist_u32rand #define mtwist_drand rasqal_mtwist_drand #define mtwist_seed_from_system rasqal_mtwist_seed_from_system rasqal-0.9.33/src/rasqal_graph_pattern.c0000644000175000017500000011672612434455625015175 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_graph_pattern.c - Rasqal graph pattern class * * Copyright (C) 2004-2010, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /* * rasqal_new_graph_pattern: * @query: #rasqal_graph_pattern query object * @op: enum #rasqal_graph_pattern_operator operator * * INTERNAL - Create a new graph pattern object. * * NOTE: This does not initialise the graph pattern completely * but relies on other operations. The empty graph pattern * has no triples and no sub-graphs. * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ static rasqal_graph_pattern* rasqal_new_graph_pattern(rasqal_query* query, rasqal_graph_pattern_operator op) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); gp = RASQAL_CALLOC(rasqal_graph_pattern*, 1, sizeof(*gp)); if(!gp) return NULL; gp->op = op; gp->query = query; gp->triples = NULL; gp->start_column = -1; gp->end_column = -1; /* This is initialised by * rasqal_query_prepare_count_graph_patterns() inside * rasqal_query_prepare() */ gp->gp_index = -1; return gp; } /* * rasqal_new_basic_graph_pattern: * @query: #rasqal_graph_pattern query object * @triples: triples sequence containing the graph pattern * @start_column: first triple in the pattern * @end_column: last triple in the pattern * * INTERNAL - Create a new graph pattern object over triples. * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_basic_graph_pattern(rasqal_query* query, raptor_sequence *triples, int start_column, int end_column) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(triples, raptor_sequence, NULL); gp = rasqal_new_graph_pattern(query, RASQAL_GRAPH_PATTERN_OPERATOR_BASIC); if(!gp) return NULL; gp->triples = triples; gp->start_column = start_column; gp->end_column = end_column; return gp; } /* * rasqal_new_graph_pattern_from_sequence: * @query: #rasqal_graph_pattern query object * @graph_patterns: sequence containing the graph patterns (or NULL) * @operator: enum #rasqal_graph_pattern_operator such as * RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL * * INTERNAL - Create a new graph pattern from a sequence of graph_patterns. * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_graph_pattern_from_sequence(rasqal_query* query, raptor_sequence *graph_patterns, rasqal_graph_pattern_operator op) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); gp = rasqal_new_graph_pattern(query, op); if(!gp) { if(graph_patterns) raptor_free_sequence(graph_patterns); return NULL; } gp->graph_patterns = graph_patterns; return gp; } /* * rasqal_new_filter_graph_pattern: * @query: #rasqal_graph_pattern query object * @expr: expression * * INTERNAL - Create a new graph pattern from a sequence of graph_patterns. * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_filter_graph_pattern(rasqal_query* query, rasqal_expression* expr) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(expr, rasqal_expression, NULL); gp = rasqal_new_graph_pattern(query, RASQAL_GRAPH_PATTERN_OPERATOR_FILTER); if(!gp) { rasqal_free_expression(expr); return NULL; } if(rasqal_graph_pattern_set_filter_expression(gp, expr)) { rasqal_free_graph_pattern(gp); gp = NULL; } return gp; } /* * rasqal_new_let_graph_pattern: * @query: #rasqal_graph_pattern query object * @var: variable to assign * @expr: expression * * INTERNAL - Create a new assignment graph pattern * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_let_graph_pattern(rasqal_query *query, rasqal_variable *var, rasqal_expression *expr) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(var, rasqal_variable, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(expr, rasqal_expression, NULL); gp = rasqal_new_graph_pattern(query, RASQAL_GRAPH_PATTERN_OPERATOR_LET); if(!gp) { rasqal_free_expression(expr); return NULL; } gp->var = var; gp->filter_expression = expr; return gp; } /* * rasqal_new_select_graph_pattern: * @query: #rasqal_graph_pattern query object * @projection: projection object * @data_graphs: sequence of #rasqal_data_graph (or NULL) * @where: WHERE graph pattern * @modifier: solution modifier * @bindings: binding VALUES (or NULL) * * INTERNAL - Create a new SELECT graph pattern * * The @projection, @data_graphs, @where and @modifier all become owned * by the new graph pattern object. * * Roughly corresponds to: * SELECT DISTINCT [in @projection] {@projection} * FROM @data_graphs * WHERE @where * GROUP BY (HAVING)/ORDER BY [in @modifier] * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_select_graph_pattern(rasqal_query *query, rasqal_projection* projection, raptor_sequence* data_graphs, rasqal_graph_pattern* where, rasqal_solution_modifier* modifier, rasqal_bindings* bindings) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(projection, rasqal_projeciton, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(where, rasqal_graph_pattern, NULL); gp = rasqal_new_graph_pattern(query, RASQAL_GRAPH_PATTERN_OPERATOR_SELECT); if(!gp) { rasqal_free_projection(projection); if(where) rasqal_free_graph_pattern(where); if(modifier) rasqal_free_solution_modifier(modifier); if(bindings) rasqal_free_bindings(bindings); return NULL; } gp->projection = projection; gp->data_graphs = data_graphs; gp->modifier = modifier; gp->bindings = bindings; if(rasqal_graph_pattern_add_sub_graph_pattern(gp, where)) { rasqal_free_graph_pattern(gp); return NULL; } return gp; } /* * rasqal_new_single_graph_pattern: * @query: #rasqal_graph_pattern query object * @op: enum #rasqal_graph_pattern_operator operator * @single: single inner graph grattern * * INTERNAL - Create a new graph pattern object over a single graph pattern. * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_single_graph_pattern(rasqal_query* query, rasqal_graph_pattern_operator op, rasqal_graph_pattern* single) { rasqal_graph_pattern* gp; gp = rasqal_new_graph_pattern(query, op); if(!gp) { if(single) rasqal_free_graph_pattern(single); return NULL; } if(rasqal_graph_pattern_add_sub_graph_pattern(gp, single)) { rasqal_free_graph_pattern(gp); return NULL; } return gp; } /* * rasqal_free_graph_pattern: * @gp: #rasqal_graph_pattern object * * INTERNAL - Free a graph pattern object. * **/ void rasqal_free_graph_pattern(rasqal_graph_pattern* gp) { if(!gp) return; if(gp->graph_patterns) raptor_free_sequence(gp->graph_patterns); if(gp->filter_expression) rasqal_free_expression(gp->filter_expression); if(gp->origin) rasqal_free_literal(gp->origin); if(gp->projection) rasqal_free_projection(gp->projection); if(gp->modifier) rasqal_free_solution_modifier(gp->modifier); if(gp->data_graphs) raptor_free_sequence(gp->data_graphs); if(gp->var) rasqal_free_variable(gp->var); if(gp->bindings) rasqal_free_bindings(gp->bindings); RASQAL_FREE(rasqal_graph_pattern, gp); } /* * rasqal_graph_pattern_adjust: * @gp: #rasqal_graph_pattern graph pattern * @offset: adjustment * * INTERNAL - Adjust the column in a graph pattern by the offset. * **/ void rasqal_graph_pattern_adjust(rasqal_graph_pattern* gp, int offset) { gp->start_column += offset; gp->end_column += offset; } /** * rasqal_graph_pattern_set_filter_expression: * @gp: #rasqal_graph_pattern query object * @expr: #rasqal_expression expr - ownership taken * * Set a filter graph pattern constraint expression * * Return value: non-0 on failure **/ int rasqal_graph_pattern_set_filter_expression(rasqal_graph_pattern* gp, rasqal_expression* expr) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(expr, rasqal_expression, 1); if(gp->filter_expression) rasqal_free_expression(gp->filter_expression); gp->filter_expression = expr; return 0; } /** * rasqal_graph_pattern_get_filter_expression: * @gp: #rasqal_graph_pattern query object * * Get a filter graph pattern's constraint expression * * Return value: expression or NULL on failure **/ rasqal_expression* rasqal_graph_pattern_get_filter_expression(rasqal_graph_pattern* gp) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, NULL); return gp->filter_expression; } /** * rasqal_graph_pattern_get_operator: * @graph_pattern: #rasqal_graph_pattern graph pattern object * * Get the graph pattern operator . * * The operator for the given graph pattern. See also * rasqal_graph_pattern_operator_as_string(). * * Return value: graph pattern operator **/ rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator(rasqal_graph_pattern* graph_pattern) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN); return graph_pattern->op; } static const char* const rasqal_graph_pattern_operator_labels[RASQAL_GRAPH_PATTERN_OPERATOR_LAST + 1] = { "UNKNOWN", "Basic", "Optional", "Union", "Group", "Graph", "Filter", "Let", "Select", "Service", "Minus", "Values" }; /** * rasqal_graph_pattern_operator_as_string: * @op: the #rasqal_graph_pattern_operator verb of the query * * Get a string for the query verb. * * Return value: pointer to a shared string label for the query verb **/ const char* rasqal_graph_pattern_operator_as_string(rasqal_graph_pattern_operator op) { if(op <= RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN || op > RASQAL_GRAPH_PATTERN_OPERATOR_LAST) op = RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN; return rasqal_graph_pattern_operator_labels[RASQAL_GOOD_CAST(int, op)]; } #ifdef RASQAL_DEBUG #define DO_INDENTING 0 #else #define DO_INDENTING -1 #endif #define SPACES_LENGTH 80 static const char spaces[SPACES_LENGTH + 1] = " "; static void rasqal_graph_pattern_write_indent(raptor_iostream *iostr, int indent) { while(indent > 0) { int sp = (indent > SPACES_LENGTH) ? SPACES_LENGTH : indent; raptor_iostream_write_bytes(spaces, sizeof(char), RASQAL_GOOD_CAST(size_t, sp), iostr); indent -= sp; } } static void rasqal_graph_pattern_write_plurals(raptor_iostream *iostr, const char* label, int value) { raptor_iostream_decimal_write(value, iostr); raptor_iostream_write_byte(' ', iostr); raptor_iostream_string_write(label, iostr); if(value != 1) raptor_iostream_write_byte('s', iostr); } /** * rasqal_graph_pattern_print_indent: * @gp: the #rasqal_graph_pattern object * @iostr: the iostream to write to * @indent: the current indent level, <0 for no indenting * * INTERNAL - Print a #rasqal_graph_pattern in a debug format with indenting * **/ static int rasqal_graph_pattern_write_internal(rasqal_graph_pattern* gp, raptor_iostream* iostr, int indent) { int pending_nl = 0; raptor_iostream_counted_string_write("graph pattern", 13, iostr); if(gp->gp_index >= 0) { raptor_iostream_write_byte('[', iostr); raptor_iostream_decimal_write(gp->gp_index, iostr); raptor_iostream_write_byte(']', iostr); } raptor_iostream_write_byte(' ', iostr); raptor_iostream_string_write(rasqal_graph_pattern_operator_as_string(gp->op), iostr); raptor_iostream_write_byte('(', iostr); if(indent >= 0) indent += 2; if(gp->silent) { raptor_iostream_counted_string_write("silent", 6, iostr); pending_nl = 1; } if(gp->triples) { int size = gp->end_column - gp->start_column + 1; int i; if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } raptor_iostream_counted_string_write("over ", 5, iostr); rasqal_graph_pattern_write_plurals(iostr, "triple", size); raptor_iostream_write_byte('[', iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent += 2; rasqal_graph_pattern_write_indent(iostr, indent); } for(i = gp->start_column; i <= gp->end_column; i++) { rasqal_triple *t = (rasqal_triple*)raptor_sequence_get_at(gp->triples, i); if(i > gp->start_column) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } rasqal_triple_write(t, iostr); } if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent -= 2; rasqal_graph_pattern_write_indent(iostr, indent); } raptor_iostream_write_byte(']', iostr); pending_nl = 1; } if(gp->origin) { if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } raptor_iostream_counted_string_write("origin ", 7, iostr); rasqal_literal_write(gp->origin, iostr); pending_nl = 1; } if(gp->graph_patterns) { int size = raptor_sequence_size(gp->graph_patterns); int i; if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } raptor_iostream_counted_string_write("over ", 5, iostr); rasqal_graph_pattern_write_plurals(iostr, "graph pattern", size); raptor_iostream_write_byte('[', iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent += 2; rasqal_graph_pattern_write_indent(iostr, indent); } for(i = 0; i< size; i++) { rasqal_graph_pattern* sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(i) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } if(sgp) rasqal_graph_pattern_write_internal(sgp, iostr, indent); else raptor_iostream_counted_string_write("(empty)", 7, iostr); } if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent -= 2; rasqal_graph_pattern_write_indent(iostr, indent); } raptor_iostream_write_byte(']', iostr); pending_nl = 1; } if(gp->var) { rasqal_variable_write(gp->var, iostr); raptor_iostream_counted_string_write(" := ", 4, iostr); pending_nl = 0; } if(gp->filter_expression) { if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } if(gp->triples || gp->graph_patterns) raptor_iostream_counted_string_write("with ", 5, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent += 2; rasqal_graph_pattern_write_indent(iostr, indent); } rasqal_expression_write(gp->filter_expression, iostr); if(indent >= 0) indent -= 2; pending_nl = 1; } if(gp->projection) { raptor_sequence* vars_seq; if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent += 2; rasqal_graph_pattern_write_indent(iostr, indent); } raptor_iostream_counted_string_write("select-variables: [", 19, iostr); vars_seq = rasqal_projection_get_variables_sequence(gp->projection); if(!vars_seq) raptor_iostream_write_byte('*', iostr); else rasqal_variables_write(vars_seq, iostr); raptor_iostream_counted_string_write("]", 1, iostr); if(indent >= 0) indent -= 2; pending_nl = 1; } if(gp->bindings) { int i; if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } raptor_iostream_counted_string_write("bindings: [", 11, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent += 2; rasqal_graph_pattern_write_indent(iostr, indent); } raptor_iostream_counted_string_write("variables: [", 12, iostr); rasqal_variables_write(gp->bindings->variables, iostr); raptor_iostream_counted_string_write("]\n", 2, iostr); rasqal_graph_pattern_write_indent(iostr, indent); raptor_iostream_counted_string_write("rows: [", 7, iostr); indent += 2; for(i = 0; 1; i++) { rasqal_row* row = rasqal_bindings_get_row(gp->bindings, i); if(!row) break; raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); rasqal_row_write(row, iostr); } indent -= 2; raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); raptor_iostream_counted_string_write("]", 1, iostr); if(indent >= 0) indent -= 2; pending_nl = 1; } #if 0 if(gp->where) { if(pending_nl) { raptor_iostream_counted_string_write(" ,", 2, iostr); if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); indent += 2; rasqal_graph_pattern_write_indent(iostr, indent); } rasqal_graph_pattern_write_internal(gp->where, iostr, indent); if(indent >= 0) indent -= 2; pending_nl = 1; } #endif if(indent >= 0) indent -= 2; if(pending_nl) { if(indent >= 0) { raptor_iostream_write_byte('\n', iostr); rasqal_graph_pattern_write_indent(iostr, indent); } } raptor_iostream_write_byte(')', iostr); return 0; } /** * rasqal_graph_pattern_print: * @gp: the #rasqal_graph_pattern object * @fh: the FILE* handle to print to * * Print a #rasqal_graph_pattern in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* fh) { raptor_iostream* iostr; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); iostr = raptor_new_iostream_to_file_handle(gp->query->world->raptor_world_ptr, fh); rasqal_graph_pattern_write_internal(gp, iostr, DO_INDENTING); raptor_free_iostream(iostr); return 0; } /** * rasqal_graph_pattern_visit: * @query: #rasqal_query to operate on * @gp: #rasqal_graph_pattern graph pattern * @fn: pointer to function to apply that takes user data and graph pattern parameters * @user_data: user data for applied function * * Visit a user function over a #rasqal_graph_pattern * * If the user function @fn returns 0, the visit is truncated. * * Return value: 0 if the visit was truncated. **/ int rasqal_graph_pattern_visit(rasqal_query *query, rasqal_graph_pattern* gp, rasqal_graph_pattern_visit_fn fn, void *user_data) { raptor_sequence *seq; int result; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fn, rasqal_graph_pattern_visit_fn, 1); result = fn(query, gp, user_data); if(result) return result; seq = rasqal_graph_pattern_get_sub_graph_pattern_sequence(gp); if(seq && raptor_sequence_size(seq) > 0) { int gp_index=0; while(1) { rasqal_graph_pattern* sgp; sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, gp_index); if(!sgp) break; result = rasqal_graph_pattern_visit(query, sgp, fn, user_data); if(result) return result; gp_index++; } } return 0; } /** * rasqal_graph_pattern_get_index: * @gp: #rasqal_graph_pattern graph pattern * * Get the graph pattern absolute index in the array of graph patterns. * * The graph pattern index is assigned when rasqal_query_prepare() is * run on a query containing a graph pattern. * * Return value: index or <0 if no index has been assigned yet **/ int rasqal_graph_pattern_get_index(rasqal_graph_pattern* gp) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, -1); return gp->gp_index; } /** * rasqal_graph_pattern_add_sub_graph_pattern: * @graph_pattern: graph pattern to add to * @sub_graph_pattern: graph pattern to add inside * * Add a sub graph pattern to a graph pattern. * * Return value: non-0 on failure **/ int rasqal_graph_pattern_add_sub_graph_pattern(rasqal_graph_pattern* graph_pattern, rasqal_graph_pattern* sub_graph_pattern) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(sub_graph_pattern, rasqal_graph_pattern, 1); if(!graph_pattern->graph_patterns) { graph_pattern->graph_patterns = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!graph_pattern->graph_patterns) { if(sub_graph_pattern) rasqal_free_graph_pattern(sub_graph_pattern); return 1; } } return raptor_sequence_push(graph_pattern->graph_patterns, sub_graph_pattern); } /** * rasqal_graph_pattern_get_triple: * @graph_pattern: #rasqal_graph_pattern graph pattern object * @idx: index into the sequence of triples in the graph pattern * * Get a triple inside a graph pattern. * * Return value: #rasqal_triple or NULL if out of range **/ rasqal_triple* rasqal_graph_pattern_get_triple(rasqal_graph_pattern* graph_pattern, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); if(!graph_pattern->triples) return NULL; idx += graph_pattern->start_column; if(idx > graph_pattern->end_column) return NULL; return (rasqal_triple*)raptor_sequence_get_at(graph_pattern->triples, idx); } /** * rasqal_graph_pattern_get_sub_graph_pattern_sequence: * @graph_pattern: #rasqal_graph_pattern graph pattern object * * Get the sequence of graph patterns inside a graph pattern . * * Return value: a #raptor_sequence of #rasqal_graph_pattern pointers. **/ raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequence(rasqal_graph_pattern* graph_pattern) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); return graph_pattern->graph_patterns; } /** * rasqal_graph_pattern_get_sub_graph_pattern: * @graph_pattern: #rasqal_graph_pattern graph pattern object * @idx: index into the sequence of sub graph_patterns in the graph pattern * * Get a sub-graph pattern inside a graph pattern. * * Return value: #rasqal_graph_pattern or NULL if out of range **/ rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern(rasqal_graph_pattern* graph_pattern, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); if(!graph_pattern->graph_patterns) return NULL; return (rasqal_graph_pattern*)raptor_sequence_get_at(graph_pattern->graph_patterns, idx); } /** * rasqal_graph_pattern_get_origin: * @graph_pattern: #rasqal_graph_pattern graph pattern object * * Get the graph pattern literal for * #RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH graph pattern * * Return value: graph literal parameter or NULL if wrong graph pattern type or not defined **/ rasqal_literal* rasqal_graph_pattern_get_origin(rasqal_graph_pattern* graph_pattern) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); if(graph_pattern->op == RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH) return graph_pattern->origin; else return NULL; } /* * rasqal_graph_pattern_set_origin: * @graph_pattern: #rasqal_graph_pattern graph pattern object * @origin: #rasqal_literal variable or URI * * INTERNAL - Set the graph pattern triple origin. * **/ void rasqal_graph_pattern_set_origin(rasqal_graph_pattern* graph_pattern, rasqal_literal *origin) { graph_pattern->origin = rasqal_new_literal_from_literal(origin); } /** * rasqal_new_basic_graph_pattern_from_formula: * @query: #rasqal_graph_pattern query object * @formula: triples sequence containing the graph pattern * * INTERNAL - Create a new graph pattern object over a formula. This function * frees the formula passed in. * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_basic_graph_pattern_from_formula(rasqal_query* query, rasqal_formula* formula) { rasqal_graph_pattern* gp; raptor_sequence *triples = query->triples; raptor_sequence *formula_triples = formula->triples; int offset = raptor_sequence_size(triples); int triple_pattern_size = 0; if(formula_triples) { /* Move formula triples to end of main triples sequence */ triple_pattern_size = raptor_sequence_size(formula_triples); if(raptor_sequence_join(triples, formula_triples)) { rasqal_free_formula(formula); return NULL; } } rasqal_free_formula(formula); gp = rasqal_new_basic_graph_pattern(query, triples, offset, offset + triple_pattern_size - 1); return gp; } /** * rasqal_new_2_group_graph_pattern: * @query: query object * @first_gp: first graph pattern * @second_gp: second graph pattern * * INTERNAL - Make a new group graph pattern from two graph patterns * of which either or both may be NULL, in which case a group * of 0 graph patterns is created. * * @first_gp and @second_gp if given, become owned by the new graph * pattern. * * Return value: new group graph pattern or NULL on failure */ rasqal_graph_pattern* rasqal_new_2_group_graph_pattern(rasqal_query* query, rasqal_graph_pattern* first_gp, rasqal_graph_pattern* second_gp) { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { if(first_gp) rasqal_free_graph_pattern(first_gp); if(second_gp) rasqal_free_graph_pattern(second_gp); return NULL; } if(first_gp && raptor_sequence_push(seq, first_gp)) { raptor_free_sequence(seq); if(second_gp) rasqal_free_graph_pattern(second_gp); return NULL; } if(second_gp && raptor_sequence_push(seq, second_gp)) { raptor_free_sequence(seq); return NULL; } return rasqal_new_graph_pattern_from_sequence(query, seq, RASQAL_GRAPH_PATTERN_OPERATOR_GROUP); } /** * rasqal_graph_pattern_variable_bound_in: * @gp: graph pattern * @v: variable * * Is the variable bound in this graph pattern (not including children)? * * Return value: non-0 if variable is bound in the given graph pattern. */ int rasqal_graph_pattern_variable_bound_in(rasqal_graph_pattern *gp, rasqal_variable *v) { rasqal_query* query; int width; int gp_offset; unsigned short *row; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, 0); query = gp->query; width = rasqal_variables_table_get_total_variables_count(query->vars_table); gp_offset = (gp->gp_index + RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) * width; row = &query->variables_use_map[gp_offset]; return ((row[v->offset] & RASQAL_VAR_USE_BOUND_HERE) != 0); } /* * rasqal_graph_pattern_variable_bound_below: * @gp: graph pattern * @v: variable * * INTERNAL - Is the variable bound in the graph pattern or below? * * Return value: non-0 if variable is bound in the graph pattern tree */ int rasqal_graph_pattern_variable_bound_below(rasqal_graph_pattern *gp, rasqal_variable *v) { int bound; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(gp, rasqal_graph_pattern, 0); bound = rasqal_graph_pattern_variable_bound_in(gp, v); if(bound) return bound; if(gp->graph_patterns) { int size = raptor_sequence_size(gp->graph_patterns); int i; for(i = 0; i < size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); bound = rasqal_graph_pattern_variable_bound_below(sgp, v); if(bound) break; } } return bound; } /** * rasqal_new_basic_graph_pattern_from_triples: * @query: #rasqal_graph_pattern query object * @triples: triples sequence containing the graph pattern * * INTERNAL - Create a new graph pattern object from a sequence of triples. * * The @triples become owned by the graph pattern * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_basic_graph_pattern_from_triples(rasqal_query* query, raptor_sequence* triples) { rasqal_graph_pattern* gp; raptor_sequence *graph_triples = query->triples; int offset = raptor_sequence_size(graph_triples); int triple_pattern_size = 0; if(triples) { /* Move triples to end of graph triples sequence */ triple_pattern_size = raptor_sequence_size(triples); if(raptor_sequence_join(graph_triples, triples)) { raptor_free_sequence(triples); return NULL; } } raptor_free_sequence(triples); gp = rasqal_new_basic_graph_pattern(query, graph_triples, offset, offset + triple_pattern_size - 1); return gp; } /** * rasqal_new_values_graph_pattern: * @query: #rasqal_graph_pattern query object * @bindings: bindings object * * INTERNAL - Create a new values graph pattern object from a bindings * * The @bindings becomes owned by the graph pattern * * Return value: a new #rasqal_graph_pattern object or NULL on failure **/ rasqal_graph_pattern* rasqal_new_values_graph_pattern(rasqal_query* query, rasqal_bindings* bindings) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); gp = rasqal_new_graph_pattern(query, RASQAL_GRAPH_PATTERN_OPERATOR_VALUES); if(gp) gp->bindings = bindings; return gp; } /** * rasqal_graph_pattern_get_variable: * @graph_pattern: #rasqal_graph_pattern graph pattern object * * Get the variable for #RASQAL_GRAPH_PATTERN_OPERATOR_LET graph pattern * * Return value: graph variable or NULL if wrong graph pattern or not defined **/ rasqal_variable* rasqal_graph_pattern_get_variable(rasqal_graph_pattern* graph_pattern) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); if(graph_pattern->op == RASQAL_GRAPH_PATTERN_OPERATOR_LET) return graph_pattern->var; else return NULL; } /** * rasqal_graph_pattern_get_service: * @graph_pattern: #rasqal_graph_pattern graph pattern object * * Get the literal for #RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE graph pattern * * Return value: graph variable or NULL if wrong graph pattern or not defined **/ rasqal_literal* rasqal_graph_pattern_get_service(rasqal_graph_pattern* graph_pattern) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); if(graph_pattern->op == RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE) return graph_pattern->origin; else return NULL; } struct gpft { /* sequence owned here */ raptor_sequence* triples; /* shared pointer to current origin */ rasqal_literal* origin; }; static int rasqal_graph_pattern_get_flattened_triples_visit(rasqal_query* query, rasqal_graph_pattern* gp, struct gpft* state) { raptor_sequence* seq; int size; if(gp->op == RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH) state->origin = gp->origin; else if(gp->op != RASQAL_GRAPH_PATTERN_OPERATOR_BASIC) return 1; else { /* RASQAL_GRAPH_PATTERN_OPERATOR_BASIC */ rasqal_triples_sequence_set_origin(state->triples, gp->triples, state->origin); } seq = rasqal_graph_pattern_get_sub_graph_pattern_sequence(gp); if(seq) { int gp_index = 0; int result = 0; size = raptor_sequence_size(seq); while(size > 0) { rasqal_graph_pattern* sgp; sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, gp_index); if(!sgp) break; result = rasqal_graph_pattern_get_flattened_triples_visit(query, sgp, state); if(result) return result; gp_index++; size--; } } if(gp->op == RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH) state->origin = NULL; return 0; } /** * rasqal_graph_pattern_get_flattened_triples: * @query: query * @graph_pattern: graph pattern * * Get the triples inside a tree of graph patterns (BASIC + GRAPH) as a single sequence with GRAPHs turned into triple origin. * * The returned sequence and all the #rasqal_triple in it are owned * by the caller (hold references). * * Return value: new sequence of #raptor_triple or NULL on failure */ raptor_sequence* rasqal_graph_pattern_get_flattened_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern) { struct gpft state; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); memset(&state, '\0', sizeof(state)); state.triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); state.origin = NULL; if(rasqal_graph_pattern_get_flattened_triples_visit(query, graph_pattern, &state)) { raptor_free_sequence(state.triples); return NULL; } return state.triples; } /** * rasqal_graph_pattern_get_triples: * @query: query * @graph_pattern: graph pattern * * Get the triples inside this graph pattern (if any). * * The returned sequence and all the #rasqal_triple in it are owned * by the caller (hold references). * * Return value: new sequence of #raptor_triple or NULL on failure or no triples */ raptor_sequence* rasqal_graph_pattern_get_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern) { raptor_sequence* triples = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_pattern, rasqal_graph_pattern, NULL); if (graph_pattern->triples) { int i; triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); for(i = graph_pattern->start_column; i <= graph_pattern->end_column; i++) { rasqal_triple *t = (rasqal_triple*)raptor_sequence_get_at(graph_pattern->triples, i); t = rasqal_new_triple_from_triple(t); if(!t) { raptor_free_sequence(triples); return NULL; } raptor_sequence_push(triples, t); } } return triples; } struct find_parent_data { rasqal_graph_pattern* child_gp; rasqal_graph_pattern* parent_gp; }; static int rasqal_graph_pattern_find_parent(rasqal_query* query, rasqal_graph_pattern* gp, void* data) { struct find_parent_data* fpd = (struct find_parent_data*)data; int i; if(gp->graph_patterns) { int size = raptor_sequence_size(gp->graph_patterns); for(i = 0; i< size; i++) { rasqal_graph_pattern* sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(sgp == fpd->child_gp) { fpd->parent_gp = gp; /* Found - truncate search */ return 1; } } } return 0; } /** * rasqal_graph_pattern_get_parent: * @query: query * @gp: graph pattern to find parent * @tree_gp: graph pattern tree to search for @gp * * Find the parent graph pattern of @gp in the tree of graph patterns @gp_tree * * Return value: pointer to parent GP or NULL on error/not found */ rasqal_graph_pattern* rasqal_graph_pattern_get_parent(rasqal_query *query, rasqal_graph_pattern* gp, rasqal_graph_pattern* tree_gp) { struct find_parent_data fpd; fpd.child_gp = gp; fpd.parent_gp = NULL; if(gp == tree_gp || gp == query->query_graph_pattern) return NULL; (void)rasqal_graph_pattern_visit(query, tree_gp, rasqal_graph_pattern_find_parent, &fpd); return fpd.parent_gp; } rasqal-0.9.33/src/rasqal_rowsource_assignment.c0000644000175000017500000001252412340216071016570 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_assignment.c - Rasqal assignment rowsource class * * Copyright (C) 2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { /* assignment variable */ rasqal_variable *var; /* assignment expression */ rasqal_expression *expr; /* offset into results for current row */ int offset; } rasqal_assignment_rowsource_context; static int rasqal_assignment_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { return 0; } static int rasqal_assignment_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_assignment_rowsource_context *con; con = (rasqal_assignment_rowsource_context*)user_data; rowsource->size = 0; rasqal_rowsource_add_variable(rowsource, con->var); return 0; } static int rasqal_assignment_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_assignment_rowsource_context *con; con = (rasqal_assignment_rowsource_context*)user_data; if(con->expr) rasqal_free_expression(con->expr); RASQAL_FREE(rasqal_assignment_rowsource_context, con); return 0; } static rasqal_row* rasqal_assignment_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_query *query = rowsource->query; rasqal_assignment_rowsource_context *con; rasqal_literal* result = NULL; rasqal_row *row = NULL; int error = 0; con = (rasqal_assignment_rowsource_context*)user_data; if(con->offset) return NULL; RASQAL_DEBUG1("evaluating assignment expression\n"); result = rasqal_expression_evaluate2(con->expr, query->eval_context, &error); #ifdef RASQAL_DEBUG RASQAL_DEBUG2("assignment %s expression result: ", con->var->name); if(error) fputs("type error", DEBUG_FH); else rasqal_literal_print(result, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(!error) { rasqal_variable_set_value(con->var, result); row = rasqal_new_row_for_size(rowsource->world, rowsource->size); if(row) { rasqal_row_set_rowsource(row, rowsource); row->offset = con->offset++; row->values[0] = rasqal_new_literal_from_literal(result); } } return row; } static int rasqal_assignment_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_assignment_rowsource_context *con; con = (rasqal_assignment_rowsource_context*)user_data; con->offset = 0; return 0; } static rasqal_rowsource* rasqal_assignment_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { return NULL; } static const rasqal_rowsource_handler rasqal_assignment_rowsource_handler = { /* .version = */ 1, "assignment", /* .init = */ rasqal_assignment_rowsource_init, /* .finish = */ rasqal_assignment_rowsource_finish, /* .ensure_variables = */ rasqal_assignment_rowsource_ensure_variables, /* .read_row = */ rasqal_assignment_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_assignment_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_assignment_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_assignment_rowsource: * @world: world object * @query: query object * @var: variable to bind value to * @expr: expression to use to create value * * INTERNAL - create a new ASSIGNment * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_assignment_rowsource(rasqal_world *world, rasqal_query *query, rasqal_variable* var, rasqal_expression* expr) { rasqal_assignment_rowsource_context *con; int flags = 0; if(!world || !query || !var || !expr) return NULL; con = RASQAL_CALLOC(rasqal_assignment_rowsource_context*, 1, sizeof(*con)); if(!con) return NULL; con->var = rasqal_new_variable_from_variable(var); con->expr = rasqal_new_expression_from_expression(expr); return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_assignment_rowsource_handler, query->vars_table, flags); } rasqal-0.9.33/src/rasqal_format_rdf.c0000644000175000017500000010445112435141254014441 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_format_rdf.c - Format results in a serialized RDF graph * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #include #define DEBUG_FH stderr #ifndef FILE_READ_BUF_SIZE #ifdef BUFSIZ #define FILE_READ_BUF_SIZE BUFSIZ #else #define FILE_READ_BUF_SIZE 1024 #endif #endif #define QUERY_RESULTS_TURTLE_PRETTY 1 typedef struct { const char* name; const char* read_format_name; const char* write_format_name; /* Namespace URIs */ raptor_uri* rdf_ns_uri; raptor_uri* rs_ns_uri; /* Predicate URIs */ raptor_uri* rdf_type_uri; raptor_uri* rs_variable_uri; raptor_uri* rs_value_uri; raptor_uri* rs_solution_uri; raptor_uri* rs_binding_uri; raptor_uri* rs_resultVariable_uri; /* Class URIs */ raptor_uri* rs_ResultSet_uri; } rasqal_query_results_format_rdf; typedef struct { rasqal_world* world; raptor_world *raptor_world_ptr; rasqal_query_results_formatter* formatter; rasqal_rowsource* rowsource; int failed; raptor_uri* rs_uri; /* Input fields */ raptor_uri* base_uri; raptor_iostream* iostr; /* Parsing fields */ int parsed; rasqal_dataset* ds; const char* format_name; rasqal_row* row; /* current result row */ int offset; /* current result row number */ unsigned char buffer[FILE_READ_BUF_SIZE]; /* iostream read buffer */ /* Output fields */ raptor_sequence* results_sequence; /* saved result rows */ /* Variables table allocated for variables in the result set */ rasqal_variables_table* vars_table; int variables_count; unsigned int flags; } rasqal_rowsource_rdf_context; static const unsigned char* const rs_namespace_uri_string = RASQAL_GOOD_CAST(const unsigned char*, "http://www.w3.org/2001/sw/DataAccess/tests/result-set#"); static int rasqal_query_results_rdf_init(rasqal_query_results_formatter* formatter, const char* name) { rasqal_query_results_format_rdf* context = (rasqal_query_results_format_rdf*)formatter->context; raptor_world* raptor_world_ptr = formatter->factory->world->raptor_world_ptr; context->name = name; if(!strcmp(name, "rdfxml")) { context->read_format_name = "rdfxml"; context->write_format_name = "rdfxml-abbrev"; } else if(!strcmp(name, "turtle")) { context->read_format_name = "turtle"; context->write_format_name = "turtle"; } else { context->read_format_name = "guess"; context->write_format_name = NULL; } /* Namespaces */ context->rdf_ns_uri = raptor_new_uri(raptor_world_ptr, raptor_rdf_namespace_uri); context->rs_ns_uri = raptor_new_uri(raptor_world_ptr, rs_namespace_uri_string); /* Predicates */ context->rdf_type_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rdf_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "type")); context->rs_variable_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rs_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "variable")); context->rs_value_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rs_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "value")); context->rs_solution_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rs_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "solution")); context->rs_binding_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rs_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "binding")); context->rs_resultVariable_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rs_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "resultVariable")); /* Classes */ context->rs_ResultSet_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, context->rs_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "ResultSet")); return 0; } static void rasqal_query_results_rdf_finish(rasqal_query_results_formatter* formatter) { rasqal_query_results_format_rdf* context; context = (rasqal_query_results_format_rdf*)formatter->context; if(context->rdf_ns_uri) raptor_free_uri(context->rdf_ns_uri); if(context->rs_ns_uri) raptor_free_uri(context->rs_ns_uri); if(context->rdf_type_uri) raptor_free_uri(context->rdf_type_uri); if(context->rs_variable_uri) raptor_free_uri(context->rs_variable_uri); if(context->rs_value_uri) raptor_free_uri(context->rs_value_uri); if(context->rs_solution_uri) raptor_free_uri(context->rs_solution_uri); if(context->rs_binding_uri) raptor_free_uri(context->rs_binding_uri); if(context->rs_ResultSet_uri) raptor_free_uri(context->rs_ResultSet_uri); if(context->rs_resultVariable_uri) raptor_free_uri(context->rs_resultVariable_uri); } /* * rasqal_query_results_rdf_write: * @iostr: #raptor_iostream to write the query results to * @results: #rasqal_query_results query results input * @base_uri: #raptor_uri base URI of the output format * * INTERNAL - Write RDF serialized query results to an iostream in a format. * * If the writing succeeds, the query results will be exhausted. * * Return value: non-0 on failure **/ static int rasqal_query_results_rdf_write(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_world* world = rasqal_query_results_get_world(results); raptor_world *raptor_world_ptr; rasqal_query_results_format_rdf* formatter_context; int i; int size; raptor_term* resultset_node; raptor_serializer* ser; raptor_statement statement; int rc = 0; if(!rasqal_query_results_is_bindings(results)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Can only write RDF format for variable binding results"); return 1; } raptor_world_ptr = world->raptor_world_ptr; formatter_context = (rasqal_query_results_format_rdf*)formatter->context; if(!formatter_context->write_format_name) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot write RDF in format %s", formatter_context->name); return 1; } /* Start serializing */ ser = raptor_new_serializer(raptor_world_ptr, formatter_context->write_format_name); if(!ser) { rc = 1; goto tidy; } raptor_serializer_start_to_iostream(ser, base_uri, iostr); raptor_serializer_set_namespace(ser, formatter_context->rs_ns_uri, (const unsigned char *)"rs"); raptor_serializer_set_namespace(ser, formatter_context->rdf_ns_uri, (const unsigned char *)"rdf"); raptor_statement_init(&statement, raptor_world_ptr); /* create a result set blank node term */ resultset_node = raptor_new_term_from_blank(raptor_world_ptr, NULL); /* result set triple */ statement.subject = resultset_node; statement.predicate = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rdf_type_uri); statement.object = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rs_ResultSet_uri); raptor_serializer_serialize_statement(ser, &statement); raptor_free_term(statement.predicate); statement.predicate = NULL; raptor_free_term(statement.object); statement.object = NULL; /* variable name triples * all these statements have same predicate */ /* statement.subject = resultset_node; */ statement.predicate = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rs_resultVariable_uri); for(i = 0; 1; i++) { const unsigned char *name; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; statement.object = raptor_new_term_from_literal(raptor_world_ptr, name, NULL, NULL); raptor_serializer_serialize_statement(ser, &statement); raptor_free_term(statement.object); statement.object = NULL; } raptor_free_term(statement.predicate); statement.predicate = NULL; /* data triples */ size = rasqal_query_results_get_bindings_count(results); while(!rasqal_query_results_finished(results)) { raptor_term* row_node = raptor_new_term_from_blank(raptor_world_ptr, NULL); /* Result row triples */ statement.subject = resultset_node; statement.predicate = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rs_solution_uri); statement.object = row_node; raptor_serializer_serialize_statement(ser, &statement); raptor_free_term(statement.predicate); statement.predicate = NULL; /* Binding triples */ for(i = 0; i < size; i++) { raptor_term* binding_node = raptor_new_term_from_blank(raptor_world_ptr, NULL); const unsigned char *name; rasqal_literal *l; name = rasqal_query_results_get_binding_name(results, i); l = rasqal_query_results_get_binding_value(results, i); /* binding */ statement.subject = row_node; statement.predicate = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rs_binding_uri); statement.object = binding_node; raptor_serializer_serialize_statement(ser, &statement); raptor_free_term(statement.predicate); statement.predicate = NULL; /* only emit rs:value and rs:variable triples if there is a value */ if(l) { statement.subject = binding_node; statement.predicate = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rs_variable_uri); statement.object = raptor_new_term_from_literal(raptor_world_ptr, name, NULL, NULL); raptor_serializer_serialize_statement(ser, &statement); raptor_free_term(statement.predicate); statement.predicate = NULL; raptor_free_term(statement.object); statement.object = NULL; /* statement.subject = binding_node; */ statement.predicate = raptor_new_term_from_uri(raptor_world_ptr, formatter_context->rs_value_uri); switch(l->type) { case RASQAL_LITERAL_URI: statement.object = raptor_new_term_from_uri(raptor_world_ptr, l->value.uri); break; case RASQAL_LITERAL_BLANK: statement.object = raptor_new_term_from_blank(raptor_world_ptr, l->string); break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_UDT: statement.object = raptor_new_term_from_literal(raptor_world_ptr, l->string, l->datatype, RASQAL_GOOD_CAST(const unsigned char*, l->language)); break; case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_INTEGER_SUBTYPE: case RASQAL_LITERAL_UNKNOWN: default: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot turn literal type %u into RDF", l->type); goto tidy; } raptor_serializer_serialize_statement(ser, &statement); raptor_free_term(statement.predicate); statement.predicate = NULL; raptor_free_term(statement.object); statement.object = NULL; } raptor_free_term(binding_node); } rasqal_query_results_next(results); raptor_free_term(row_node); row_node = NULL; } raptor_free_term(resultset_node); raptor_serializer_serialize_end(ser); raptor_free_serializer(ser); tidy: return rc; } /* Local handlers for turning RDF graph read from an iostream into rows */ static int rasqal_rowsource_rdf_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_rdf_context* con; con = (rasqal_rowsource_rdf_context*)user_data; con->rowsource = rowsource; con->world = rowsource->world; con->raptor_world_ptr = rasqal_world_get_raptor(rowsource->world); con->rs_uri = raptor_new_uri(con->raptor_world_ptr, rs_namespace_uri_string); return 0; } static int rasqal_rowsource_rdf_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_rdf_context* con; con = (rasqal_rowsource_rdf_context*)user_data; if(con->base_uri) raptor_free_uri(con->base_uri); if(con->results_sequence) raptor_free_sequence(con->results_sequence); if(con->vars_table) rasqal_free_variables_table(con->vars_table); if(con->rs_uri) raptor_free_uri(con->rs_uri); if(con->ds) rasqal_free_dataset(con->ds); if(con->flags) { if(con->iostr) raptor_free_iostream(con->iostr); } RASQAL_FREE(rasqal_rowsource_rdf_context, con); return 0; } static int rasqal_rowsource_rdf_process(rasqal_rowsource_rdf_context* con) { rasqal_query_results_format_rdf* formatter_context; raptor_uri* rdf_ns_uri; raptor_uri* uri; rasqal_literal* predicate_uri_literal; rasqal_literal* object_uri_literal; rasqal_literal* binding_uri_literal; rasqal_literal* resultSet_node; rasqal_literal* solution_node; rasqal_dataset_term_iterator* solution_iter; rasqal_literal* variable_predicate; rasqal_literal* value_predicate; if(con->parsed) return 0; formatter_context = (rasqal_query_results_format_rdf*)con->formatter->context; con->ds = rasqal_new_dataset(con->world); if(rasqal_dataset_load_graph_iostream(con->ds, formatter_context->read_format_name, con->iostr, con->base_uri)) { return 1; } rdf_ns_uri = raptor_new_uri(con->raptor_world_ptr, raptor_rdf_namespace_uri); uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, rdf_ns_uri, RASQAL_GOOD_CAST(const unsigned char*, "type")); predicate_uri_literal = rasqal_new_uri_literal(con->world, uri); raptor_free_uri(rdf_ns_uri); rdf_ns_uri = NULL; uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, con->rs_uri, RASQAL_GOOD_CAST(const unsigned char*, "ResultSet")); object_uri_literal = rasqal_new_uri_literal(con->world, uri); uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, con->rs_uri, RASQAL_GOOD_CAST(const unsigned char*, "variable")); variable_predicate = rasqal_new_uri_literal(con->world, uri); uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, con->rs_uri, RASQAL_GOOD_CAST(const unsigned char*, "value")); value_predicate = rasqal_new_uri_literal(con->world, uri); /* find result set node ?rs := getSource(a, rs:ResultSet) */ resultSet_node = rasqal_dataset_get_source(con->ds, predicate_uri_literal, object_uri_literal); rasqal_free_literal(predicate_uri_literal); predicate_uri_literal = NULL; rasqal_free_literal(object_uri_literal); object_uri_literal = NULL; /* if no such triple, expecting empty results */ if(!resultSet_node) { rasqal_free_literal(value_predicate); rasqal_free_literal(variable_predicate); return 0; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1("Got result set node "); rasqal_literal_print(resultSet_node, DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* find variable names from all ?var := getTargets(?rs, rs:resultVariable) */ uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, con->rs_uri, RASQAL_GOOD_CAST(const unsigned char*, "resultVariable")); predicate_uri_literal = rasqal_new_uri_literal(con->world, uri); solution_iter = rasqal_dataset_get_targets_iterator(con->ds, resultSet_node, predicate_uri_literal); while(1) { solution_node = rasqal_dataset_term_iterator_get(solution_iter); if(!solution_node) break; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1("Got variable node "); rasqal_literal_print(solution_node, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(1) { const unsigned char* name; size_t len; name = rasqal_literal_as_counted_string(solution_node, &len, 0, NULL); if(name) { rasqal_variable *v; v = rasqal_variables_table_add2(con->vars_table, RASQAL_VARIABLE_TYPE_NORMAL, name, len, NULL); if(v) { rasqal_rowsource_add_variable(con->rowsource, v); /* above function takes a reference to v */ rasqal_free_variable(v); } } } rasqal_dataset_term_iterator_next(solution_iter); } rasqal_free_dataset_term_iterator(solution_iter); solution_iter = NULL; rasqal_free_literal(predicate_uri_literal); predicate_uri_literal = NULL; uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, con->rs_uri, RASQAL_GOOD_CAST(const unsigned char*, "binding")); binding_uri_literal = rasqal_new_uri_literal(con->world, uri); /* for each solution node ?sol := getTargets(?rs, rs:solution) */ uri = raptor_new_uri_from_uri_local_name(con->raptor_world_ptr, con->rs_uri, RASQAL_GOOD_CAST(const unsigned char*, "solution")); predicate_uri_literal = rasqal_new_uri_literal(con->world, uri); solution_iter = rasqal_dataset_get_targets_iterator(con->ds, resultSet_node, predicate_uri_literal); while(1) { rasqal_dataset_term_iterator* binding_iter; rasqal_row* row; solution_node = rasqal_dataset_term_iterator_get(solution_iter); if(!solution_node) break; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1("Got solution node (row) "); rasqal_literal_print(solution_node, DEBUG_FH); fputc('\n', DEBUG_FH); #endif row = rasqal_new_row(con->rowsource); /* for each binding node ?bn := getTargets(?sol, rs:binding) */ binding_iter = rasqal_dataset_get_targets_iterator(con->ds, solution_node, binding_uri_literal); while(1) { rasqal_literal* binding_node; rasqal_literal* var_literal; rasqal_literal* value_literal; binding_node = rasqal_dataset_term_iterator_get(binding_iter); if(!binding_node) break; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1(" Got binding node "); rasqal_literal_print(binding_node, DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* variable ?var := getTarget(?bn, rs:variable) */ var_literal = rasqal_dataset_get_target(con->ds, binding_node, variable_predicate); /* variable ?val := getTarget(?bn, rs:value) */ value_literal = rasqal_dataset_get_target(con->ds, binding_node, value_predicate); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 RASQAL_DEBUG1(" Variable: "); rasqal_literal_print(var_literal, DEBUG_FH); fputs(" Value: ", DEBUG_FH); rasqal_literal_print(value_literal, DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* save row[?var] = ?val */ if(1) { const unsigned char* name; int offset; name = rasqal_literal_as_string(var_literal); offset = rasqal_rowsource_get_variable_offset_by_name(con->rowsource, name); rasqal_row_set_value_at(row, offset, value_literal); } /* ?index := getTarget(?sol, rs:index) * if ?index exists then that is the integer order of the row * in the list of row results */ rasqal_dataset_term_iterator_next(binding_iter); } rasqal_free_dataset_term_iterator(binding_iter); binding_iter = NULL; /* save row at end of sequence of rows */ raptor_sequence_push(con->results_sequence, row); rasqal_dataset_term_iterator_next(solution_iter); } rasqal_free_dataset_term_iterator(solution_iter); solution_iter = NULL; rasqal_free_literal(value_predicate); value_predicate = NULL; rasqal_free_literal(variable_predicate); variable_predicate = NULL; rasqal_free_literal(predicate_uri_literal); predicate_uri_literal = NULL; rasqal_free_literal(binding_uri_literal); binding_uri_literal = NULL; if(!raptor_sequence_size(con->results_sequence)) /* Empty result set with variables defined; so remove vars */ rasqal_rowsource_remove_all_variables(con->rowsource); /* sort sequence of rows by ?index or original order */ con->parsed = 1; return 0; } static int rasqal_rowsource_rdf_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_rdf_context* con; con = (rasqal_rowsource_rdf_context*)user_data; rasqal_rowsource_rdf_process(con); return con->failed; } static rasqal_row* rasqal_rowsource_rdf_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_rdf_context* con; rasqal_row* row = NULL; con = (rasqal_rowsource_rdf_context*)user_data; rasqal_rowsource_rdf_process(con); if(!con->failed && raptor_sequence_size(con->results_sequence) > 0) { RASQAL_DEBUG1("getting row from stored sequence\n"); row = (rasqal_row*)raptor_sequence_unshift(con->results_sequence); } return row; } static const rasqal_rowsource_handler rasqal_rowsource_rdf_handler={ /* .version = */ 1, "RDF Query Results", /* .init = */ rasqal_rowsource_rdf_init, /* .finish = */ rasqal_rowsource_rdf_finish, /* .ensure_variables = */ rasqal_rowsource_rdf_ensure_variables, /* .read_row = */ rasqal_rowsource_rdf_read_row, /* .read_all_rows = */ NULL, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /* * rasqal_query_results_getrowsource_rdf: * @world: rasqal world object * @iostr: #raptor_iostream to read the query results from * @base_uri: #raptor_uri base URI of the input format * * Read the RDF serialized graph of query results from an * iostream in a format returning a rwosurce - INTERNAL. * * Return value: a new rasqal_rowsource or NULL on failure **/ static rasqal_rowsource* rasqal_query_results_rdf_get_rowsource(rasqal_query_results_formatter* formatter, rasqal_world *world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_rdf_context* con; con = RASQAL_CALLOC(rasqal_rowsource_rdf_context*, 1, sizeof(*con)); if(!con) return NULL; con->world = world; con->formatter = formatter; con->base_uri = base_uri ? raptor_uri_copy(base_uri) : NULL; con->iostr = iostr; con->flags = flags; con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); return rasqal_new_rowsource_from_handler(world, NULL, con, &rasqal_rowsource_rdf_handler, con->vars_table, 0); } static void rasqal_query_results_format_rdf_copy_syntax_description_from_parser(rasqal_query_results_format_factory *factory, const char* name) { raptor_world* raptor_world_ptr = factory->world->raptor_world_ptr; const raptor_syntax_description* desc; unsigned int i; for(i = 0; (desc = raptor_world_get_parser_description(raptor_world_ptr, i)); i++) { int j; for(j = 0; desc->names[j]; j++) { if(!strcmp(desc->names[j], name)) { factory->desc.mime_types = desc->mime_types; return; } } } } static int rasqal_query_results_rdfxml_recognise_syntax(rasqal_query_results_format_factory* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type) { if(suffix && !strcmp(RASQAL_GOOD_CAST(const char*, suffix), "rdf")) return 5; return 0; } static const char* const rdfxml_names[] = { "rdfxml", NULL}; static const raptor_type_q rdfxml_types[] = { { "application/rdf+xml", 19, 10}, { NULL, 0, 0} }; static int rasqal_query_results_rdfxml_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = rdfxml_names; factory->desc.mime_types = rdfxml_types; rasqal_query_results_format_rdf_copy_syntax_description_from_parser(factory, "rdfxml"); factory->desc.label = "RDF/XML Query Results"; factory->desc.uri_strings = NULL; factory->desc.flags = 0; factory->context_length = sizeof(rasqal_query_results_format_rdf); factory->init = rasqal_query_results_rdf_init; factory->finish = rasqal_query_results_rdf_finish; factory->write = rasqal_query_results_rdf_write; factory->get_rowsource = rasqal_query_results_rdf_get_rowsource; factory->recognise_syntax = rasqal_query_results_rdfxml_recognise_syntax; return rc; } int rasqal_init_result_format_rdf(rasqal_world* world) { return !rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_rdfxml_register_factory); } #ifdef QUERY_RESULTS_TURTLE_PRETTY /* * rasqal_query_results_turtle_write: * @iostr: #raptor_iostream to write the query to * @results: #rasqal_query_results query results format * @base_uri: #raptor_uri base URI of the output format * * Write a Turtle version of the query results format to an * iostream in a format - INTERNAL. * * If the writing succeeds, the query results will be exhausted. * * Return value: non-0 on failure **/ static int rasqal_query_results_turtle_write(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_world* world = rasqal_query_results_get_world(results); int i; int row_semicolon; int column_semicolon = 0; int size; if(!rasqal_query_results_is_bindings(results)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Can only write Turtle format for variable binding results"); return 1; } raptor_iostream_string_write("@prefix xsd: .\n", iostr); raptor_iostream_string_write("@prefix rs: .\n", iostr); raptor_iostream_string_write("@prefix rdf: .\n", iostr); raptor_iostream_write_byte('\n', iostr); raptor_iostream_counted_string_write("[] rdf:type rs:ResultSet ;\n", 35, iostr); /* Variable Binding Results */ for(i = 0; 1; i++) { const unsigned char *name; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; raptor_iostream_counted_string_write(" rs:resultVariable \"", 26, iostr); raptor_iostream_string_write(name, iostr); raptor_iostream_counted_string_write("\" ;\n", 4, iostr); } size = rasqal_query_results_get_bindings_count(results); row_semicolon = 0; while(!rasqal_query_results_finished(results)) { if(row_semicolon) raptor_iostream_counted_string_write(" ;\n", 3, iostr); /* Result row */ raptor_iostream_counted_string_write(" rs:solution [ ", 22, iostr); column_semicolon = 0; for(i = 0; i < size; i++) { const unsigned char *name; rasqal_literal *l; name = rasqal_query_results_get_binding_name(results, i); l = rasqal_query_results_get_binding_value(results, i); if(column_semicolon) raptor_iostream_counted_string_write("; \n ", 25, iostr); if(l) { /* only emit binding rs:value and rs:variable triples if * there is a value */ /* binding */ raptor_iostream_counted_string_write("rs:binding [ ", 16, iostr); raptor_iostream_counted_string_write("rs:variable \"", 15, iostr); raptor_iostream_string_write(name, iostr); raptor_iostream_counted_string_write("\" ;\n rs:value ", 56, iostr); rasqal_literal_write_turtle(l, iostr); raptor_iostream_counted_string_write("\n ] ", 39, iostr); column_semicolon = 1; } } /* End Result Row */ raptor_iostream_counted_string_write("\n ]", 8, iostr); row_semicolon = 1; rasqal_query_results_next(results); } raptor_iostream_counted_string_write(" .\n", 3, iostr); return 0; } #endif static int rasqal_query_results_turtle_recognise_syntax(rasqal_query_results_format_factory* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type) { if(suffix && (!strcmp(RASQAL_GOOD_CAST(const char*, suffix), "ttl") || !strcmp(RASQAL_GOOD_CAST(const char*, suffix), "n3"))) return 7; return 0; } static const char* const turtle_names[] = { "turtle", NULL}; static const char* const turtle_uri_strings[] = { "http://www.w3.org/TeamSubmission/turtle/", NULL }; static const raptor_type_q turtle_types[] = { { "application/turtle", 18, 10}, { NULL, 0, 0} }; static int rasqal_query_results_turtle_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = turtle_names; factory->desc.mime_types = turtle_types; rasqal_query_results_format_rdf_copy_syntax_description_from_parser(factory, "turtle"); factory->desc.label = "Turtle Query Results"; factory->desc.uri_strings = turtle_uri_strings; factory->context_length = sizeof(rasqal_query_results_format_rdf); factory->init = rasqal_query_results_rdf_init; factory->finish = rasqal_query_results_rdf_finish; #ifdef QUERY_RESULTS_TURTLE_PRETTY factory->write = rasqal_query_results_turtle_write; #else /* This is just not as pretty */ factory->write = rasqal_query_results_rdf_write; #endif factory->get_rowsource = rasqal_query_results_rdf_get_rowsource; factory->recognise_syntax = rasqal_query_results_turtle_recognise_syntax; return rc; } int rasqal_init_result_format_turtle(rasqal_world* world) { return !rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_turtle_register_factory); } rasqal-0.9.33/src/rasqal_rowsource_aggregation.c0000644000175000017500000011673312435141254016723 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_aggregation.c - Rasqal aggregation rowsource class * * Handles SPARQL Aggregation() algebra including Distinct of * expression arguments. * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE /* * rasqal_agg_expr_data: * * INTERNAL - data for defining an agg expression input args / output var/values * * This is separate from #rasqal_builtin_agg_expression_execute which contains * information only needed during execution. */ typedef struct { /* agg expression */ rasqal_expression* expr; /* aggregation function execution user data as created by * rasqal_builtin_agg_expression_execute_init() and destroyed by * rasqal_builtin_agg_expression_execute_finish(). */ void* agg_user_data; /* (shared) output variable for this expression pointing into * aggregation rowsource context vars_seq */ rasqal_variable* variable; /* sequence of aggregate function arguments */ raptor_sequence* exprs_seq; /* map for distincting literal values */ rasqal_map* map; } rasqal_agg_expr_data; /* * rasqal_aggregation_rowsource_context: * * INTERNAL - Aggregration rowsource context * * Structure for handing aggregation over a grouped input rowsource * created by rasqal_new_aggregation_rowsource(). * */ typedef struct { /* inner (grouped) rowsource */ rasqal_rowsource *rowsource; /* aggregate expressions */ raptor_sequence* exprs_seq; /* output variables to bind (in order) */ raptor_sequence* vars_seq; /* pointer to array of data per aggregate expression */ rasqal_agg_expr_data* expr_data; /* number of agg expressions (size of exprs_seq, vars_seq, expr_data) */ int expr_count; /* non-0 when done */ int finished; /* last group ID seen */ int last_group_id; /* saved row between group boundaries */ rasqal_row* saved_row; /* output row offset */ int offset; /* sequence of values from input rowsource to copy/sample through */ raptor_sequence* input_values; /* number of variables/values on input rowsource to copy/sample through * (size of @input_values) */ int input_values_count; /* step into current group */ int step_count; } rasqal_aggregation_rowsource_context; /* * rasqal_builtin_agg_expression_execute: * * INTERNAL - state for built-in execution of certain aggregate expressions * * Executes AVG, COUNT, GROUP_CONCAT, MAX, MIN, SAMPLE * */ typedef struct { rasqal_world* world; /* expression being executed */ rasqal_expression* expr; /* literal for computation (e.g. current MAX, MIN seen) */ rasqal_literal* l; /* number of steps executed - used for AVG in calculating result */ int count; /* error happened */ int error; /* separator for GROUP_CONCAT */ unsigned char separator[2]; /* string buffer for GROUP_CONCAT */ raptor_stringbuffer *sb; } rasqal_builtin_agg_expression_execute; static void rasqal_builtin_agg_expression_execute_finish(void* user_data); static void* rasqal_builtin_agg_expression_execute_init(rasqal_world *world, rasqal_expression* expr) { rasqal_builtin_agg_expression_execute* b; b = RASQAL_CALLOC(rasqal_builtin_agg_expression_execute*, 1, sizeof(*b)); if(!b) return NULL; b->expr = expr; b->world = world; b->l = NULL; b->count = 0; b->error = 0; if(expr->op == RASQAL_EXPR_GROUP_CONCAT) { b->sb = raptor_new_stringbuffer(); if(!b->sb) { rasqal_builtin_agg_expression_execute_finish(b); return NULL; } b->separator[0] = (unsigned char)' '; b->separator[1] = (unsigned char)'\0'; } return b; } static void rasqal_builtin_agg_expression_execute_finish(void* user_data) { rasqal_builtin_agg_expression_execute* b; b = (rasqal_builtin_agg_expression_execute*)user_data; if(b->l) rasqal_free_literal(b->l); if(b->sb) raptor_free_stringbuffer(b->sb); RASQAL_FREE(rasqal_builtin_agg_expression_execute, b); } static int rasqal_builtin_agg_expression_execute_reset(void* user_data) { rasqal_builtin_agg_expression_execute* b; b = (rasqal_builtin_agg_expression_execute*)user_data; b->count = 0; b->error = 0; if(b->l) { rasqal_free_literal(b->l); b->l = 0; } if(b->sb) { raptor_free_stringbuffer(b->sb); b->sb = raptor_new_stringbuffer(); if(!b->sb) return 1; } return 0; } static int rasqal_builtin_agg_expression_execute_step(void* user_data, raptor_sequence* literals) { rasqal_builtin_agg_expression_execute* b; rasqal_literal* l; int i; b = (rasqal_builtin_agg_expression_execute*)user_data; if(b->error) return b->error; if(b->expr->op == RASQAL_EXPR_COUNT) { /* COUNT(*) : counts every row (does not care about literals) */ if(b->expr->arg1->op == RASQAL_EXPR_VARSTAR) b->count++; /* COUNT(expr list) : counts rows with non-empty sequence of literals */ else if(raptor_sequence_size(literals) > 0) b->count++; return 0; } /* Other aggregate functions count every row */ b->count++; for(i = 0; (l = (rasqal_literal*)raptor_sequence_get_at(literals, i)); i++) { rasqal_literal* result = NULL; if(b->expr->op == RASQAL_EXPR_SAMPLE) { /* Sample chooses the first literal it sees */ if(!b->l) b->l = rasqal_new_literal_from_literal(l); break; } if(b->expr->op == RASQAL_EXPR_GROUP_CONCAT) { const unsigned char* str; int error = 0; str = RASQAL_GOOD_CAST(const unsigned char*, rasqal_literal_as_string_flags(l, 0, &error)); if(!error) { if(raptor_stringbuffer_length(b->sb)) raptor_stringbuffer_append_counted_string(b->sb, b->separator, 1, 1); raptor_stringbuffer_append_string(b->sb, str, 1); } continue; } if(!b->l) result = rasqal_new_literal_from_literal(l); else { if(b->expr->op == RASQAL_EXPR_SUM || b->expr->op == RASQAL_EXPR_AVG) { result = rasqal_literal_add(b->l, l, &b->error); } else if(b->expr->op == RASQAL_EXPR_MIN) { int cmp = rasqal_literal_compare(b->l, l, 0, &b->error); if(cmp <= 0) result = rasqal_new_literal_from_literal(b->l); else result = rasqal_new_literal_from_literal(l); } else if(b->expr->op == RASQAL_EXPR_MAX) { int cmp = rasqal_literal_compare(b->l, l, 0, &b->error); if(cmp >= 0) result = rasqal_new_literal_from_literal(b->l); else result = rasqal_new_literal_from_literal(l); } else { RASQAL_FATAL2("Builtin aggregation operation %u is not implemented", b->expr->op); } rasqal_free_literal(b->l); if(!result) b->error = 1; } b->l = result; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Aggregation step result %s (error=%d)\n", (result ? RASQAL_GOOD_CAST(const char*, rasqal_literal_as_string(result)) : "(NULL)"), b->error); #endif } return b->error; } static rasqal_literal* rasqal_builtin_agg_expression_execute_result(void* user_data) { rasqal_builtin_agg_expression_execute* b; b = (rasqal_builtin_agg_expression_execute*)user_data; if(b->error) return NULL; if(b->expr->op == RASQAL_EXPR_COUNT) { rasqal_literal* result; result = rasqal_new_integer_literal(b->world, RASQAL_LITERAL_INTEGER, b->count); return result; } if(b->expr->op == RASQAL_EXPR_GROUP_CONCAT) { size_t len; unsigned char* str; rasqal_literal* result; len = raptor_stringbuffer_length(b->sb); str = RASQAL_MALLOC(unsigned char*, len + 1); if(!str) return NULL; if(raptor_stringbuffer_copy_to_string(b->sb, str, len)) { RASQAL_FREE(char*, str); return NULL; } result = rasqal_new_string_literal(b->world, str, NULL, NULL, NULL); return result; } if(b->expr->op == RASQAL_EXPR_AVG) { rasqal_literal* count_l = NULL; rasqal_literal* result = NULL; if(b->count) count_l = rasqal_new_integer_literal(b->world, RASQAL_LITERAL_INTEGER, b->count); if(b->l && count_l) result = rasqal_literal_divide(b->l, count_l, &b->error); else /* No total to divide */ b->error = 1; if(count_l) rasqal_free_literal(count_l); if(b->error) { /* result will be NULL and error will be non-0 on division by 0 * in which case the result is literal(integer 0) */ result = rasqal_new_integer_literal(b->world, RASQAL_LITERAL_INTEGER, 0); } return result; } return rasqal_new_literal_from_literal(b->l); } static int rasqal_aggregation_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_aggregation_rowsource_context* con; con = (rasqal_aggregation_rowsource_context*)user_data; con->input_values = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); con->last_group_id = -1; con->offset = 0; con->step_count = 0; if(rasqal_rowsource_request_grouping(con->rowsource)) return 1; return 0; } static int rasqal_aggregation_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_aggregation_rowsource_context* con; con = (rasqal_aggregation_rowsource_context*)user_data; if(con->expr_data) { int i; for(i = 0; i < con->expr_count; i++) { rasqal_agg_expr_data* expr_data = &con->expr_data[i]; if(expr_data->agg_user_data) rasqal_builtin_agg_expression_execute_finish(expr_data->agg_user_data); if(expr_data->exprs_seq) raptor_free_sequence(expr_data->exprs_seq); if(expr_data->expr) rasqal_free_expression(expr_data->expr); if(expr_data->map) rasqal_free_map(expr_data->map); } RASQAL_FREE(rasqal_agg_expr_data, con->expr_data); } if(con->exprs_seq) raptor_free_sequence(con->exprs_seq); if(con->vars_seq) raptor_free_sequence(con->vars_seq); if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->saved_row) rasqal_free_row(con->saved_row); if(con->input_values) raptor_free_sequence(con->input_values); RASQAL_FREE(rasqal_aggregation_rowsource_context, con); return 0; } static int rasqal_aggregation_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_aggregation_rowsource_context* con; int offset; int i; con = (rasqal_aggregation_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; if(rasqal_rowsource_copy_variables(rowsource, con->rowsource)) return 1; con->input_values_count = rowsource->size; for(i = 0; i < con->expr_count; i++) { rasqal_agg_expr_data* expr_data = &con->expr_data[i]; offset = rasqal_rowsource_add_variable(rowsource, expr_data->variable); if(offset < 0) return 1; } return 0; } static rasqal_row* rasqal_aggregation_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_aggregation_rowsource_context* con; rasqal_row* row; int error = 0; con = (rasqal_aggregation_rowsource_context*)user_data; if(con->finished) return NULL; /* Iterate over input rows until last row seen or group done */ while(1) { error = 0; if(con->saved_row) row = con->saved_row; else row = rasqal_rowsource_read_row(con->rowsource); if(!row) { /* End of input - calculate last aggregation result */ con->finished = 1; break; } if(con->last_group_id != row->group_id) { int i; if(!con->saved_row && con->last_group_id >= 0) { /* Existing aggregation is done - return result */ /* save current row for next time this function is called */ con->saved_row = row; row = NULL; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("Aggregation ending group %d", con->last_group_id); fputc('\n', DEBUG_FH); #endif /* Empty distinct maps */ for(i = 0; i < con->expr_count; i++) { rasqal_agg_expr_data* expr_data = &con->expr_data[i]; if(expr_data->map) { rasqal_free_map(expr_data->map); expr_data->map = NULL; } } break; } /* reference is now in 'row' variable */ con->saved_row = NULL; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("Aggregation starting group %d", row->group_id); fputc('\n', DEBUG_FH); #endif /* next time this function is called we continue here */ for(i = 0; i < con->expr_count; i++) { rasqal_agg_expr_data* expr_data = &con->expr_data[i]; if(!expr_data->agg_user_data) { /* init once */ expr_data->agg_user_data = rasqal_builtin_agg_expression_execute_init(rowsource->world, expr_data->expr); if(!expr_data->agg_user_data) { error = 1; break; } } /* Init map for each group */ if(expr_data->expr->flags & RASQAL_EXPR_FLAG_DISTINCT) { expr_data->map = rasqal_new_literal_sequence_sort_map(1 /* is_distinct */, 0 /* compare_flags */); if(!expr_data->map) { error = 1; break; } } } if(error) break; con->last_group_id = row->group_id; } /* end if handling change of group ID */ /* Bind the values in the input row to the variables in the table */ rasqal_row_bind_variables(row, rowsource->query->vars_table); /* Evaluate the expressions giving a sequence of literals to * run the aggregation step over. */ if(1) { int i; if(!con->step_count) { /* copy first value row from input rowsource */ for(i = 0; i < con->input_values_count; i++) { rasqal_literal* value; value = rasqal_new_literal_from_literal(row->values[i]); raptor_sequence_set_at(con->input_values, i, value); } } con->step_count++; for(i = 0; i < con->expr_count; i++) { rasqal_agg_expr_data* expr_data = &con->expr_data[i]; raptor_sequence* seq; /* SPARQL Aggregation uses ListEvalE() to evaluate - ignoring * errors and filtering out expressions that fail */ seq = rasqal_expression_sequence_evaluate(rowsource->query, expr_data->exprs_seq, /* ignore_errors */ 1, &error); if(error) continue; if(expr_data->map) { if(rasqal_literal_sequence_sort_map_add_literal_sequence(expr_data->map, seq)) { /* duplicate found * * The above function just freed seq so no data is lost */ continue; } } #ifdef RASQAL_DEBUG RASQAL_DEBUG2("Aggregation expr %d step over literals: ", i); raptor_sequence_print(seq, DEBUG_FH); fputc('\n', DEBUG_FH); #endif error = rasqal_builtin_agg_expression_execute_step(expr_data->agg_user_data, seq); /* when DISTINCTing, seq remains owned by the map * otherwise seq is local and must be freed */ if(!expr_data->map) raptor_free_sequence(seq); if(error) { RASQAL_DEBUG2("Aggregation expr %d returned error\n", i); error = 0; } } } rasqal_free_row(row); row = NULL; if(error) break; } /* end while reading rows */ if(error) { /* Discard row on error */ if(row) { rasqal_free_row(row); row = NULL; } } else if (con->last_group_id >= 0) { int offset = 0; int i; /* Generate result row and reset for next group */ row = rasqal_new_row(rowsource); /* Copy scalar results through */ for(i = 0; i < con->input_values_count; i++) { rasqal_literal* result; /* Reset: get and delete any stored input rowsource literal */ result = (rasqal_literal*)raptor_sequence_delete_at(con->input_values, i); rasqal_row_set_value_at(row, offset, result); rasqal_free_literal(result); offset++; } /* Set aggregate results */ for(i = 0; i < con->expr_count; i++) { rasqal_literal* result; rasqal_agg_expr_data* expr_data = &con->expr_data[i]; rasqal_variable* v; /* Calculate the result because the input ended or a new group started */ result = rasqal_builtin_agg_expression_execute_result(expr_data->agg_user_data); #ifdef RASQAL_DEBUG RASQAL_DEBUG2("Aggregation %d ending group with result: ", i); rasqal_literal_print(result, DEBUG_FH); fputc('\n', DEBUG_FH); #endif v = rasqal_rowsource_get_variable_by_offset(rowsource, offset); result = rasqal_new_literal_from_literal(result); /* it is OK to bind to NULL */ rasqal_variable_set_value(v, result); rasqal_row_set_value_at(row, offset, result); if(result) rasqal_free_literal(result); offset++; if(rasqal_builtin_agg_expression_execute_reset(expr_data->agg_user_data)) { rasqal_free_row(row); row = NULL; break; } } con->step_count = 0; if(row) row->offset = con->offset++; } return row; } static rasqal_rowsource* rasqal_aggregation_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_aggregation_rowsource_context *con; con = (rasqal_aggregation_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_aggregation_rowsource_handler = { /* .version = */ 1, "aggregation", /* .init = */ rasqal_aggregation_rowsource_init, /* .finish = */ rasqal_aggregation_rowsource_finish, /* .ensure_variables = */ rasqal_aggregation_rowsource_ensure_variables, /* .read_row = */ rasqal_aggregation_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_aggregation_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_aggregation_rowsource: * @world: world * @query: query * @rowsource: input (grouped) rowsource - typically constructed by rasqal_new_groupby_rowsource() * @exprs_seq: sequence of #rasqal_expression * @vars_seq: sequence of #rasqal_variable to bind in output rows * * INTERNAL - Create a new rowsource for a aggregration * * The @rowsource becomes owned by the new rowsource. The @exprs_seq * and @vars_seq are not. * * For example with the SPARQL 1.1 example queries * * SELECT (MAX(?y) AS ?agg) WHERE { ?x ?y ?z } GROUP BY ?x * the aggregation part corresponds to * exprs_seq : [ expr MAX with sequence of expression args [?y] } * vars_seq : [ {internal variable name} ] * * SELECT (ex:agg(?y, ?z) AS ?agg) WHERE { ?x ?y ?z } GROUP BY ?x * the aggregation part corresponds to * exprs_seq : [ expr ex:agg with sequence of expression args [?y, ?z] ] * vars_seq : [ {internal variable name} ] * * SELECT ?x, (MIN(?z) AS ?agg) WHERE { ?x ?y ?z } GROUP BY ?x * the aggregation part corresponds to * exprs_seq : [ non-aggregate expression ?x, * expr MIN with sequence of expression args [?z] ] * vars_seq : [ ?x, {internal variable name} ] * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_aggregation_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* rowsource, raptor_sequence* exprs_seq, raptor_sequence* vars_seq) { rasqal_aggregation_rowsource_context* con = NULL; int flags = 0; int size; int i; if(!world || !query || !rowsource || !exprs_seq || !vars_seq) goto fail; exprs_seq = rasqal_expression_copy_expression_sequence(exprs_seq); vars_seq = rasqal_variable_copy_variable_sequence(vars_seq); size = raptor_sequence_size(exprs_seq); if(size != raptor_sequence_size(vars_seq)) { RASQAL_DEBUG3("expressions sequence size %d does not match vars sequence size %d\n", size, raptor_sequence_size(vars_seq)); goto fail; } con = RASQAL_CALLOC(rasqal_aggregation_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; con->exprs_seq = exprs_seq; con->vars_seq = vars_seq; /* allocate per-expr data */ con->expr_count = size; con->expr_data = RASQAL_CALLOC(rasqal_agg_expr_data*, RASQAL_GOOD_CAST(size_t, size), sizeof(rasqal_agg_expr_data)); if(!con->expr_data) goto fail; /* Initialise per-expr data */ for(i = 0; i < size; i++) { rasqal_expression* expr = (rasqal_expression *)raptor_sequence_get_at(exprs_seq, i); rasqal_variable* variable = (rasqal_variable*)raptor_sequence_get_at(vars_seq, i); rasqal_agg_expr_data* expr_data = &con->expr_data[i]; expr_data->expr = rasqal_new_expression_from_expression(expr); expr_data->variable = variable; /* Prepare expression arguments sequence in per-expr data */ if(expr->args) { /* list of #rasqal_expression arguments already in expr * #RASQAL_EXPR_FUNCTION and #RASQAL_EXPR_GROUP_CONCAT */ expr_data->exprs_seq = rasqal_expression_copy_expression_sequence(expr->args); } else { /* single argument */ expr_data->exprs_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); raptor_sequence_push(expr_data->exprs_seq, rasqal_new_expression_from_expression(expr->arg1)); } } return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_aggregation_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); if(exprs_seq) raptor_free_sequence(exprs_seq); if(vars_seq) raptor_free_sequence(vars_seq); if(con) RASQAL_FREE(rasqal_aggregation_rowsource_context*, con); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); #define AGGREGATION_TESTS_COUNT 6 #define MAX_TEST_VARS 3 /* Test 0 */ static const char* const data_xyz_3_rows[] = { /* 3 variable names and 3 rows */ "x", NULL, "y", NULL, "z", NULL, /* row 1 data */ "1", NULL, "2", NULL, "3", NULL, /* row 2 data */ "1", NULL, "3", NULL, "4", NULL, /* row 3 data */ "2", NULL, "5", NULL, "6", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, }; /* MAX(?y) GROUP BY ?x result */ static const int test0_output_rows[] = { 3, 5, }; /* MIN(?x) GROUP BY ?x result */ static const int test1_output_rows[] = { 1, 2, }; /* SUM(?z) GROUP BY ?x result */ static const int test2_output_rows[] = { 7, 6, }; /* AVG(?x) GROUP BY ?x result */ static const double test3_output_rows[] = { 1.0, 2.0, }; /* SAMPLE(?y) GROUP BY ?x result */ static const int test4_output_rows[] = { 2, 5, }; /* GROUP_CONCAT(?z) GROUP BY ?x result */ static const char* const test5_output_rows[] = { "3 4", "6", }; /* Input Group IDs expected */ /* Test 0 */ static const int test0_groupids[] = { 0, 0, 1 }; static const struct { int input_vars; int input_rows; int input_ngroups; int output_vars; int output_rows; const char* const *data; const int *group_ids; rasqal_literal_type result_type; const int *result_int_data; const double *result_double_data; const char* const *result_string_data; rasqal_op op; const char* const expr_agg_vars[MAX_TEST_VARS]; } test_data[AGGREGATION_TESTS_COUNT] = { /* * Execute the aggregation part of SELECT (MAX(?y) AS ?fake) ... GROUP BY ?x * Input 3 vars (x, y, z), 3 rows and 2 groups. * Output is 1 var (fake), 2 rows (1 per input group) * Expected result: [ ?fake => 3, ?fake => 5] */ {3, 3, 2, 1, 2, data_xyz_3_rows, test0_groupids, RASQAL_LITERAL_INTEGER, test0_output_rows, NULL, NULL, RASQAL_EXPR_MAX, { "y" } }, /* * Execute the aggregation part of SELECT (MIN(?x) AS ?fake) ... GROUP BY ?x * Expected result: [ ?fake => 1, ?fake => 2] */ {3, 3, 2, 1, 2, data_xyz_3_rows, test0_groupids, RASQAL_LITERAL_INTEGER, test1_output_rows, NULL, NULL, RASQAL_EXPR_MIN, { "x" } }, /* * Execute the aggregation part of SELECT (SUM(?z) AS ?fake) ... GROUP BY ?x * Expected result: [ ?fake => 7, ?fake => 6] */ {3, 3, 2, 1, 2, data_xyz_3_rows, test0_groupids, RASQAL_LITERAL_INTEGER, test2_output_rows, NULL, NULL, RASQAL_EXPR_SUM, { "z" } }, /* * Execute the aggregation part of SELECT (AVG(?x) AS ?fake) ... GROUP BY ?x * Expected result: [ ?fake => 1.0, ?fake => 2.0] */ {3, 3, 2, 1, 2, data_xyz_3_rows, test0_groupids, RASQAL_LITERAL_DECIMAL, NULL, test3_output_rows, NULL, RASQAL_EXPR_AVG, { "x" } }, /* * Execute the aggregation part of SELECT (SAMPLE(?y) AS ?fake) ... GROUP BY ?x * Expected result: [ ?fake => 2, ?fake => 5] */ {3, 3, 2, 1, 2, data_xyz_3_rows, test0_groupids, RASQAL_LITERAL_INTEGER, test4_output_rows, NULL, NULL, RASQAL_EXPR_SAMPLE, { "y" } }, /* * Execute the aggregation part of SELECT (GROUP_CONCAT(?z) AS ?fake) ... GROUP BY ?x * Expected result: [ ?fake => "3 4", ?fake => "6"] */ {3, 3, 2, 1, 2, data_xyz_3_rows, test0_groupids, RASQAL_LITERAL_INTEGER, NULL, NULL, test5_output_rows, RASQAL_EXPR_GROUP_CONCAT, { "z" } } }; static rasqal_expression* make_test_expr(rasqal_world* world, raptor_sequence* expr_vars_seq, rasqal_op op) { if(op == RASQAL_EXPR_MAX || op == RASQAL_EXPR_MIN || op == RASQAL_EXPR_SUM || op == RASQAL_EXPR_AVG || op == RASQAL_EXPR_SAMPLE) { rasqal_expression* arg1; arg1 = (rasqal_expression*)raptor_sequence_delete_at(expr_vars_seq, 0); raptor_free_sequence(expr_vars_seq); return rasqal_new_aggregate_function_expression(world, op, arg1, /* params */ NULL, /* flags */ 0); } if(op == RASQAL_EXPR_GROUP_CONCAT) { return rasqal_new_group_concat_expression(world, /* flags */ 0, expr_vars_seq, /* separator */ NULL); } return NULL; } int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; raptor_sequence* row_seq = NULL; raptor_sequence* expr_args_seq = NULL; int failures = 0; rasqal_variables_table* vt; rasqal_rowsource *input_rs = NULL; raptor_sequence* vars_seq = NULL; raptor_sequence* exprs_seq = NULL; int test_id; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } query = rasqal_new_query(world, "sparql", NULL); vt = query->vars_table; for(test_id = 0; test_id < AGGREGATION_TESTS_COUNT; test_id++) { int input_vars_count = test_data[test_id].input_vars; int output_rows_count = test_data[test_id].output_rows; int output_vars_count = test_data[test_id].output_vars; const int* input_group_ids = test_data[test_id].group_ids; rasqal_literal_type expected_type = test_data[test_id].result_type; const int* result_int_data = test_data[test_id].result_int_data; const double* result_double_data = test_data[test_id].result_double_data; const char* const* result_string_data = test_data[test_id].result_string_data; rasqal_op op = test_data[test_id].op; raptor_sequence* seq = NULL; int count; int size; int i; #define OUT_VAR_NAME_LEN 4 const char* output_var_name = "fake"; rasqal_variable* output_var; rasqal_expression* expr; int output_row_size = (input_vars_count + output_vars_count); if(output_vars_count != 1) { fprintf(stderr, "%s: test %d expects %d variables which is not supported. Test skipped\n", program, test_id, output_vars_count); failures++; goto tidy; } row_seq = rasqal_new_row_sequence(world, vt, test_data[test_id].data, test_data[test_id].input_vars, &vars_seq); if(row_seq) { for(i = 0; i < test_data[test_id].input_rows; i++) { rasqal_row* row = (rasqal_row*)raptor_sequence_get_at(row_seq, i); row->group_id = input_group_ids[i]; } input_rs = rasqal_new_rowsequence_rowsource(world, query, vt, row_seq, vars_seq); /* vars_seq and row_seq are now owned by input_rs */ vars_seq = row_seq = NULL; } if(!input_rs) { fprintf(stderr, "%s: failed to create rowsequence rowsource\n", program); failures++; goto tidy; } expr_args_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(test_data[test_id].expr_agg_vars[0] != NULL) { int vindex; const unsigned char* var_name; for(vindex = 0; (var_name = RASQAL_GOOD_CAST(const unsigned char*, test_data[test_id].expr_agg_vars[vindex] )); vindex++) { rasqal_variable* v; rasqal_literal *l = NULL; rasqal_expression* e = NULL; v = rasqal_variables_table_get_by_name(vt, RASQAL_VARIABLE_TYPE_NORMAL, var_name); /* returns SHARED pointer to variable */ if(v) { v = rasqal_new_variable_from_variable(v); l = rasqal_new_variable_literal(world, v); } if(l) e = rasqal_new_literal_expression(world, l); if(e) raptor_sequence_push(expr_args_seq, e); else { fprintf(stderr, "%s: failed to create variable %s\n", program, RASQAL_GOOD_CAST(const char*, var_name)); failures++; goto tidy; } } } /* if vars */ output_var = rasqal_variables_table_add2(vt, RASQAL_VARIABLE_TYPE_ANONYMOUS, RASQAL_GOOD_CAST(const unsigned char*, output_var_name), OUT_VAR_NAME_LEN, NULL); expr = make_test_expr(world, expr_args_seq, op); /* expr_args_seq is now owned by expr */ expr_args_seq = NULL; exprs_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); raptor_sequence_push(exprs_seq, expr); /* expr is now owned by exprs_seq */ expr = NULL; vars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); raptor_sequence_push(vars_seq, output_var); /* output_var is now owned by vars_seq */ output_var = NULL; rowsource = rasqal_new_aggregation_rowsource(world, query, input_rs, exprs_seq, vars_seq); /* input_rs is now owned by rowsource */ input_rs = NULL; /* these are no longer needed; agg rowsource made copies */ raptor_free_sequence(exprs_seq); exprs_seq = NULL; raptor_free_sequence(vars_seq); vars_seq = NULL; if(!rowsource) { fprintf(stderr, "%s: failed to create aggregation rowsource\n", program); failures++; goto tidy; } /* Test the rowsource */ seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: test %d rasqal_rowsource_read_all_rows() returned a NULL seq for a aggregation rowsource\n", program, test_id); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != output_rows_count) { fprintf(stderr, "%s: test %d rasqal_rowsource_read_all_rows() returned %d rows for a aggregation rowsource, expected %d\n", program, test_id, count, output_rows_count); failures++; goto tidy; } size = rasqal_rowsource_get_size(rowsource); if(size != output_row_size) { fprintf(stderr, "%s: test %d rasqal_rowsource_get_size() returned %d columns (variables) for a aggregation rowsource, expected %d\n", program, test_id, size, output_row_size); failures++; goto tidy; } if(result_int_data || result_double_data) { for(i = 0; i < output_rows_count; i++) { rasqal_row* row = (rasqal_row*)raptor_sequence_get_at(seq, i); rasqal_literal* value; int vc; if(row->size != output_row_size) { fprintf(stderr, "%s: test %d row #%d is size %d expected %d\n", program, test_id, i, row->size, output_row_size); failures++; goto tidy; } /* Expected variable ordering in output row is: * {input vars} {output_vars} */ for(vc = 0; vc < output_vars_count; vc++) { rasqal_variable* row_var; int offset = input_vars_count + vc; row_var = rasqal_rowsource_get_variable_by_offset(rowsource, offset); value = row->values[offset]; if(!value) { fprintf(stderr, "%s: test %d row #%d %s value #%d result is NULL\n", program, test_id, i, row_var->name, vc); failures++; goto tidy; } if(value->type != expected_type) { fprintf(stderr, "%s: test %d row #%d %s value #%d result is type %s expected %s\n", program, test_id, i, row_var->name, vc, rasqal_literal_type_label(value->type), rasqal_literal_type_label(expected_type)); failures++; goto tidy; } if(expected_type == RASQAL_LITERAL_INTEGER) { int expected_integer = result_int_data[i]; int integer; integer = rasqal_literal_as_integer(value, NULL); if(integer != expected_integer) { fprintf(stderr, "%s: test %d row #%d %s value #%d result is %d expected %d\n", program, test_id, i, row_var->name, vc, integer, expected_integer); failures++; goto tidy; } } else if(expected_type == RASQAL_LITERAL_DECIMAL) { double expected_double = result_double_data[i]; double d; d = rasqal_literal_as_double(value, NULL); if(!rasqal_double_approximately_equal(d, expected_double)) { fprintf(stderr, "%s: test %d row #%d %s value #%d result is %f expected %f\n", program, test_id, i, row_var->name, vc, d, expected_double); failures++; goto tidy; } } } } } if(result_string_data) { for(i = 0; i < output_rows_count; i++) { rasqal_row* row = (rasqal_row*)raptor_sequence_get_at(seq, i); rasqal_literal* value; const unsigned char* str; const char* expected_string = result_string_data[i]; int vc; if(row->size != output_row_size) { fprintf(stderr, "%s: test %d row #%d is size %d expected %d\n", program, test_id, i, row->size, output_row_size); failures++; goto tidy; } /* Expected variable ordering in output row is: * {input vars} {output_vars} */ for(vc = 0; vc < output_vars_count; vc++) { rasqal_variable* row_var; int offset = input_vars_count + vc; row_var = rasqal_rowsource_get_variable_by_offset(rowsource, offset); value = row->values[offset]; if(!value) { fprintf(stderr, "%s: test %d row #%d %s value #%d result is NULL\n", program, test_id, i, row_var->name, vc); failures++; goto tidy; } if(value->type != RASQAL_LITERAL_STRING) { fprintf(stderr, "%s: test %d row #%d %s value #%d is type %s expected integer\n", program, test_id, i, row_var->name, vc, rasqal_literal_type_label(value->type)); failures++; goto tidy; } str = rasqal_literal_as_string(value); if(strcmp(RASQAL_GOOD_CAST(const char*, str), expected_string)) { fprintf(stderr, "%s: test %d row #%d %s value #%d is %s expected %s\n", program, test_id, i, row_var->name, vc, str, expected_string); failures++; goto tidy; } } } } #ifdef RASQAL_DEBUG rasqal_rowsource_print_row_sequence(rowsource, seq, stderr); #endif raptor_free_sequence(seq); seq = NULL; rasqal_free_rowsource(rowsource); rowsource = NULL; if(expr_args_seq) raptor_free_sequence(expr_args_seq); expr_args_seq = NULL; } tidy: if(exprs_seq) raptor_free_sequence(exprs_seq); if(vars_seq) raptor_free_sequence(vars_seq); if(expr_args_seq) raptor_free_sequence(expr_args_seq); if(rowsource) rasqal_free_rowsource(rowsource); if(input_rs) rasqal_free_rowsource(input_rs); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_engine_sort.c0000644000175000017500000001450111753371514014634 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_engine_sort.c - Rasqal query engine row sorting routines * * Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { int is_distinct; int compare_flags; raptor_sequence* order_conditions_sequence; } rowsort_compare_data; static void rasqal_engine_rowsort_free_compare_data(const void* user_data) { rowsort_compare_data* rcd = (rowsort_compare_data*)user_data; RASQAL_FREE(rowsort_compare_data, rcd); } /** * rasqal_engine_rowsort_row_compare: * @user_data: comparison user data pointer * @a: pointer to address of first #row * @b: pointer to address of second #row * * INTERNAL - compare two pointers to #row objects * * Suitable for use as a compare function in qsort_r() or similar. * * Return value: <0, 0 or >1 comparison */ static int rasqal_engine_rowsort_row_compare(void* user_data, const void *a, const void *b) { rasqal_row* row_a; rasqal_row* row_b; rowsort_compare_data* rcd; int result = 0; rcd = (rowsort_compare_data*)user_data; row_a = (rasqal_row*)a; row_b = (rasqal_row*)b; if(rcd->is_distinct) { result = !rasqal_literal_array_equals(row_a->values, row_b->values, row_a->size); if(!result) /* duplicate, so return that */ return 0; } /* now order it */ if(rcd->order_conditions_sequence) result = rasqal_literal_array_compare(row_a->order_values, row_b->order_values, rcd->order_conditions_sequence, row_a->order_size, rcd->compare_flags); /* still equal? make sort stable by using the original order */ if(!result) { result = row_a->offset - row_b->offset; RASQAL_DEBUG2("Got equality result so using offsets, returning %d\n", result); } return result; } static int rasqal_engine_rowsort_map_print_row(void *object, FILE *fh) { if(object) rasqal_row_print((rasqal_row*)object, fh); else fputs("NULL", fh); return 0; } /** * rasqal_engine_new_rowsort_map: * @flags: 1: do distinct * * INTERNAL - create a new map for sorting rows * */ rasqal_map* rasqal_engine_new_rowsort_map(int is_distinct, int compare_flags, raptor_sequence* order_conditions_sequence) { rowsort_compare_data* rcd; rcd = RASQAL_MALLOC(rowsort_compare_data*, sizeof(*rcd)); if(!rcd) return NULL; rcd->is_distinct = is_distinct; if(is_distinct) { compare_flags &= ~RASQAL_COMPARE_XQUERY; compare_flags |= RASQAL_COMPARE_RDF; } rcd->compare_flags = compare_flags; rcd->order_conditions_sequence = order_conditions_sequence; return rasqal_new_map(rasqal_engine_rowsort_row_compare, rcd, (raptor_data_free_handler)rasqal_engine_rowsort_free_compare_data, (raptor_data_free_handler)rasqal_free_row, (raptor_data_free_handler)rasqal_free_row, rasqal_engine_rowsort_map_print_row, NULL, 0); } /** * rasqal_engine_rowsort_map_add_row: * @map: row map * @row: row to add * * INTERNAL - Add a row to a rowsort_map for sorting. The row * becomes owned by the map * * return value: non-0 if the row was a duplicate (and not added) */ int rasqal_engine_rowsort_map_add_row(rasqal_map* map, rasqal_row* row) { /* map. after this, row is owned by map */ if(!rasqal_map_add_kv(map, row, NULL)) return 0; /* duplicate, and not added so delete it */ #ifdef RASQAL_DEBUG RASQAL_DEBUG1("Got duplicate row "); rasqal_row_print(row, DEBUG_FH); fputc('\n', DEBUG_FH); #endif rasqal_free_row(row); return 1; } static void rasqal_engine_rowsort_map_add_to_sequence(void *key, void *value, void *user_data) { rasqal_row* row; row = rasqal_new_row_from_row((rasqal_row*)key); raptor_sequence_push((raptor_sequence*)user_data, row); } raptor_sequence* rasqal_engine_rowsort_map_to_sequence(rasqal_map* map, raptor_sequence* seq) { /* do sort/distinct: walk map in order, adding rows to seq */ rasqal_map_visit(map, rasqal_engine_rowsort_map_add_to_sequence, (void*)seq); return seq; } /** * rasqal_engine_rowsort_calculate_order_values: * @query: query object * @order_seq: order conditions sequence * @row: row * * INTERNAL - Calculate the order condition values for a row * * Return value: non-0 on failure */ int rasqal_engine_rowsort_calculate_order_values(rasqal_query* query, raptor_sequence* order_seq, rasqal_row* row) { int i; if(!row->order_size) return 1; for(i = 0; i < row->order_size; i++) { rasqal_expression* e; rasqal_literal *l; int error = 0; e = (rasqal_expression*)raptor_sequence_get_at(order_seq, i); l = rasqal_expression_evaluate2(e, query->eval_context, &error); if(row->order_values[i]) rasqal_free_literal(row->order_values[i]); if(error) row->order_values[i] = NULL; else { row->order_values[i] = rasqal_new_literal_from_literal(rasqal_literal_value(l)); rasqal_free_literal(l); } } return 0; } rasqal-0.9.33/src/sparql_parser.c0000644000175000017500000124156312434455661013651 00000000000000/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.0.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 2 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Substitute the variable and function names. */ #define yyparse sparql_parser_parse #define yylex sparql_parser_lex #define yyerror sparql_parser_error #define yydebug sparql_parser_debug #define yynerrs sparql_parser_nerrs /* Copy the first part of user declarations. */ #line 28 "./sparql_parser.y" /* yacc.c:339 */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #include #include #define YY_NO_UNISTD_H 1 #include #include /* Set RASQAL_DEBUG to 3 for super verbose parsing - watching the shift/reduces */ #if 0 #undef RASQAL_DEBUG #define RASQAL_DEBUG 3 #endif #define DEBUG_FH stderr /* Make verbose error messages for syntax errors */ #define YYERROR_VERBOSE 1 /* Fail with an debug error message if RASQAL_DEBUG > 1 */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 #define YYERROR_MSG(msg) do { fputs("** YYERROR ", DEBUG_FH); fputs(msg, DEBUG_FH); fputc('\n', DEBUG_FH); YYERROR; } while(0) #else #define YYERROR_MSG(ignore) YYERROR #endif #define YYERR_MSG_GOTO(label,msg) do { errmsg = msg; goto label; } while(0) /* Slow down the grammar operation and watch it work */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 #undef YYDEBUG #define YYDEBUG 1 #endif /* the lexer does not seem to track this */ #undef RASQAL_SPARQL_USE_ERROR_COLUMNS /* Prototypes */ int sparql_parser_error(rasqal_query* rq, void* scanner, const char *msg); /* Make lex/yacc interface as small as possible */ #undef yylex #define yylex sparql_lexer_lex /* Make the yyerror below use the rdf_parser */ #undef yyerror #define yyerror(rq, scanner, message) sparql_query_error(rq, message) /* Prototypes for local functions */ static int sparql_parse(rasqal_query* rq); static void sparql_query_error(rasqal_query* rq, const char *message); static void sparql_query_error_full(rasqal_query *rq, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3); static sparql_uri_applies* new_uri_applies(raptor_uri* uri, rasqal_update_graph_applies applies) { sparql_uri_applies* ua; ua = RASQAL_MALLOC(sparql_uri_applies*, sizeof(*ua)); if(!ua) return NULL; ua->uri = uri; ua->applies = applies; return ua; } static void free_uri_applies(sparql_uri_applies* ua) { if(ua->uri) raptor_free_uri(ua->uri); RASQAL_FREE(sparql_uri_applies*, ua); } static sparql_op_expr* new_op_expr(rasqal_op op, rasqal_expression *expr) { sparql_op_expr* oe; oe = RASQAL_MALLOC(sparql_op_expr*, sizeof(*oe)); if(!oe) return NULL; oe->op = op; oe->expr = expr; return oe; } static void free_op_expr(sparql_op_expr* oe) { if(oe->expr) rasqal_free_expression(oe->expr); RASQAL_FREE(sparql_op_expr*, oe); } static void print_op_expr(sparql_op_expr* oe, FILE* fh) { fputs("op), fh); fputs(", ", fh); if(oe->expr) rasqal_expression_print(oe->expr, fh); else fputs("NULL", fh); fputs(">", fh); } #line 208 "sparql_parser.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "sparql_parser.tab.h". */ #ifndef YY_SPARQL_PARSER_SPARQL_PARSER_TAB_H_INCLUDED # define YY_SPARQL_PARSER_SPARQL_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int sparql_parser_debug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { SELECT = 258, FROM = 259, WHERE = 260, OPTIONAL = 261, DESCRIBE = 262, CONSTRUCT = 263, ASK = 264, DISTINCT = 265, REDUCED = 266, LIMIT = 267, UNION = 268, PREFIX = 269, BASE = 270, BOUND = 271, GRAPH = 272, NAMED = 273, FILTER = 274, OFFSET = 275, ORDER = 276, BY = 277, REGEX = 278, ASC = 279, DESC = 280, LANGMATCHES = 281, A = 282, STRLANG = 283, STRDT = 284, STR = 285, IRI = 286, URI = 287, BNODE = 288, LANG = 289, DATATYPE = 290, ISURI = 291, ISBLANK = 292, ISLITERAL = 293, ISNUMERIC = 294, SAMETERM = 295, GROUP = 296, HAVING = 297, COUNT = 298, SUM = 299, AVG = 300, MIN = 301, MAX = 302, GROUP_CONCAT = 303, SAMPLE = 304, SEPARATOR = 305, DELETE = 306, INSERT = 307, WITH = 308, CLEAR = 309, CREATE = 310, SILENT = 311, DATA = 312, DROP = 313, LOAD = 314, INTO = 315, DEFAULT = 316, TO = 317, ADD = 318, MOVE = 319, COPY = 320, ALL = 321, COALESCE = 322, AS = 323, IF = 324, NOT = 325, IN = 326, BINDINGS = 327, UNDEF = 328, SERVICE = 329, MINUS = 330, YEAR = 331, MONTH = 332, DAY = 333, HOURS = 334, MINUTES = 335, SECONDS = 336, TIMEZONE = 337, TZ = 338, STRLEN = 339, SUBSTR = 340, UCASE = 341, LCASE = 342, STRSTARTS = 343, STRENDS = 344, CONTAINS = 345, ENCODE_FOR_URI = 346, CONCAT = 347, STRBEFORE = 348, STRAFTER = 349, REPLACE = 350, BIND = 351, ABS = 352, ROUND = 353, CEIL = 354, FLOOR = 355, RAND = 356, MD5 = 357, SHA1 = 358, SHA224 = 359, SHA256 = 360, SHA384 = 361, SHA512 = 362, UUID = 363, STRUUID = 364, VALUES = 365, EXPLAIN = 366, LET = 367, CURRENT_DATETIME = 368, NOW = 369, FROM_UNIXTIME = 370, TO_UNIXTIME = 371, HATHAT = 372, SC_OR = 373, SC_AND = 374, EQ = 375, NEQ = 376, LT = 377, GT = 378, LE = 379, GE = 380, ASSIGN = 381, STRING = 382, LANGTAG = 383, DOUBLE_LITERAL = 384, DOUBLE_POSITIVE_LITERAL = 385, DOUBLE_NEGATIVE_LITERAL = 386, INTEGER_LITERAL = 387, INTEGER_POSITIVE_LITERAL = 388, INTEGER_NEGATIVE_LITERAL = 389, DECIMAL_LITERAL = 390, DECIMAL_POSITIVE_LITERAL = 391, DECIMAL_NEGATIVE_LITERAL = 392, BOOLEAN_LITERAL = 393, URI_LITERAL = 394, URI_LITERAL_BRACE = 395, QNAME_LITERAL = 396, QNAME_LITERAL_BRACE = 397, BLANK_LITERAL = 398, IDENTIFIER = 399 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE YYSTYPE; union YYSTYPE { #line 196 "./sparql_parser.y" /* yacc.c:355 */ raptor_sequence *seq; rasqal_variable *variable; rasqal_literal *literal; rasqal_triple *triple; rasqal_expression *expr; rasqal_graph_pattern *graph_pattern; double floating; raptor_uri *uri; unsigned char *name; rasqal_formula *formula; rasqal_update_operation *update; unsigned int uinteger; rasqal_data_graph* data_graph; rasqal_row* row; rasqal_solution_modifier* modifier; int limit_offset[2]; int integer; rasqal_projection* projection; rasqal_bindings* bindings; sparql_uri_applies* uri_applies; sparql_op_expr* op_expr; #line 417 "sparql_parser.c" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int sparql_parser_parse (rasqal_query* rq, void* yyscanner); #endif /* !YY_SPARQL_PARSER_SPARQL_PARSER_TAB_H_INCLUDED */ /* Copy the second part of user declarations. */ #line 431 "sparql_parser.c" /* yacc.c:358 */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 8 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2245 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 161 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 164 /* YYNRULES -- Number of rules. */ #define YYNRULES 405 /* YYNSTATES -- Number of states. */ #define YYNSTATES 827 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 399 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 160, 2, 2, 125, 2, 2, 2, 118, 119, 137, 135, 117, 136, 159, 138, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 158, 2, 2, 2, 124, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 120, 2, 121, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 122, 2, 123, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 126, 127, 128, 129, 130, 131, 132, 133, 134, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 564, 564, 565, 570, 579, 593, 600, 620, 625, 630, 638, 642, 643, 644, 648, 652, 656, 660, 664, 668, 672, 676, 680, 684, 692, 700, 706, 713, 743, 750, 768, 783, 788, 793, 803, 807, 817, 826, 835, 853, 857, 899, 903, 907, 911, 915, 919, 923, 930, 944, 950, 954, 962, 983, 1004, 1025, 1046, 1067, 1074, 1083, 1092, 1108, 1136, 1158, 1181, 1226, 1250, 1267, 1276, 1285, 1301, 1322, 1326, 1334, 1342, 1362, 1394, 1414, 1458, 1475, 1508, 1523, 1527, 1535, 1550, 1559, 1579, 1609, 1629, 1673, 1715, 1757, 1781, 1785, 1789, 1793, 1797, 1810, 1842, 1877, 1882, 1889, 1916, 1951, 1987, 1996, 2015, 2019, 2026, 2030, 2038, 2050, 2077, 2123, 2154, 2185, 2216, 2222, 2231, 2236, 2243, 2267, 2290, 2298, 2302, 2310, 2315, 2322, 2336, 2346, 2366, 2371, 2378, 2382, 2386, 2413, 2427, 2441, 2448, 2455, 2465, 2485, 2499, 2506, 2511, 2516, 2521, 2527, 2535, 2540, 2547, 2557, 2577, 2584, 2591, 2599, 2616, 2624, 2636, 2650, 2663, 2668, 2675, 2680, 2686, 2695, 2714, 2719, 2728, 2740, 2762, 2790, 2797, 2811, 2834, 2840, 2846, 2854, 2872, 2876, 2880, 2884, 2888, 2900, 2904, 2915, 2973, 2987, 2999, 3036, 3041, 3053, 3101, 3114, 3142, 3143, 3148, 3179, 3187, 3191, 3195, 3199, 3203, 3207, 3211, 3215, 3223, 3262, 3312, 3329, 3350, 3357, 3361, 3369, 3378, 3383, 3398, 3414, 3424, 3434, 3449, 3456, 3466, 3491, 3512, 3520, 3524, 3528, 3535, 3540, 3547, 3586, 3620, 3648, 3655, 3665, 3682, 3690, 3698, 3703, 3714, 3744, 3759, 3803, 3851, 3949, 3954, 3961, 3966, 3973, 4051, 4056, 4063, 4071, 4081, 4109, 4113, 4121, 4188, 4307, 4360, 4397, 4401, 4409, 4421, 4434, 4440, 4448, 4452, 4459, 4471, 4475, 4479, 4489, 4493, 4497, 4501, 4505, 4509, 4519, 4527, 4534, 4542, 4550, 4559, 4566, 4573, 4580, 4587, 4594, 4601, 4606, 4611, 4653, 4679, 4686, 4700, 4706, 4725, 4744, 4765, 4788, 4802, 4807, 4825, 4848, 4854, 4882, 4905, 4911, 4922, 4938, 4944, 4955, 4962, 4966, 4973, 4987, 4991, 4995, 5004, 5010, 5020, 5028, 5036, 5043, 5050, 5057, 5064, 5079, 5086, 5093, 5100, 5107, 5114, 5121, 5128, 5135, 5142, 5149, 5156, 5163, 5170, 5177, 5184, 5191, 5198, 5202, 5206, 5213, 5220, 5227, 5234, 5241, 5248, 5255, 5262, 5266, 5270, 5277, 5284, 5291, 5298, 5305, 5312, 5319, 5326, 5333, 5340, 5347, 5354, 5361, 5368, 5379, 5386, 5397, 5404, 5411, 5418, 5425, 5432, 5439, 5446, 5457, 5474, 5492, 5510, 5535, 5541, 5561, 5565, 5569, 5576, 5580, 5584, 5592, 5596, 5600, 5608, 5612, 5616, 5628, 5634, 5654, 5660 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "SELECT", "FROM", "WHERE", "OPTIONAL", "DESCRIBE", "CONSTRUCT", "ASK", "DISTINCT", "REDUCED", "LIMIT", "UNION", "PREFIX", "BASE", "BOUND", "GRAPH", "NAMED", "FILTER", "OFFSET", "ORDER", "BY", "REGEX", "ASC", "DESC", "LANGMATCHES", "\"a\"", "\"strlang\"", "\"strdt\"", "\"str\"", "\"iri\"", "\"uri\"", "\"bnode\"", "\"lang\"", "\"datatype\"", "\"isUri\"", "\"isBlank\"", "\"isLiteral\"", "\"isNumeric\"", "\"sameTerm\"", "GROUP", "HAVING", "COUNT", "SUM", "AVG", "MIN", "MAX", "GROUP_CONCAT", "SAMPLE", "SEPARATOR", "DELETE", "INSERT", "WITH", "CLEAR", "CREATE", "SILENT", "DATA", "DROP", "LOAD", "INTO", "DEFAULT", "TO", "ADD", "MOVE", "COPY", "ALL", "COALESCE", "AS", "IF", "NOT", "IN", "BINDINGS", "UNDEF", "SERVICE", "MINUS", "YEAR", "MONTH", "DAY", "HOURS", "MINUTES", "SECONDS", "TIMEZONE", "TZ", "STRLEN", "SUBSTR", "UCASE", "LCASE", "STRSTARTS", "STRENDS", "CONTAINS", "ENCODE_FOR_URI", "CONCAT", "STRBEFORE", "STRAFTER", "REPLACE", "BIND", "ABS", "ROUND", "CEIL", "FLOOR", "RAND", "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "UUID", "STRUUID", "VALUES", "EXPLAIN", "LET", "CURRENT_DATETIME", "NOW", "FROM_UNIXTIME", "TO_UNIXTIME", "','", "'('", "')'", "'['", "']'", "'{'", "'}'", "'?'", "'$'", "\"^^\"", "SC_OR", "SC_AND", "EQ", "NEQ", "LT", "GT", "LE", "GE", "'+'", "'-'", "'*'", "'/'", "\":=\"", "\"string\"", "\"langtag\"", "\"double literal\"", "\"double positive literal\"", "\"double negative literal\"", "\"integer literal\"", "\"integer positive literal\"", "\"integer negative literal\"", "\"decimal literal\"", "\"decimal positive literal\"", "\"decimal negative literal\"", "\"boolean literal\"", "\"URI literal\"", "\"URI literal (\"", "\"QName literal\"", "\"QName literal (\"", "\"blank node literal\"", "\"identifier\"", "';'", "'.'", "'!'", "$accept", "Sparql", "Query", "ExplainOpt", "ReportFormat", "Update", "UpdateTailOpt", "UpdateOperation", "Prologue", "BaseDeclOpt", "PrefixDeclListOpt", "SelectQuery", "SubSelect", "SelectClause", "SelectExpressionList", "SelectExpressionListTail", "SelectTerm", "AggregateExpression", "DistinctOpt", "ExpressionOrStar", "CountAggregateExpression", "SumAggregateExpression", "AvgAggregateExpression", "MinAggregateExpression", "MaxAggregateExpression", "SeparatorOpt", "ExpressionList", "GroupConcatAggregateExpression", "SampleAggregateExpression", "ConstructQuery", "DescribeQuery", "VarOrIRIrefList", "AskQuery", "DatasetClause", "GraphRef", "DeleteQuery", "GraphTriples", "GraphTemplate", "ModifyTemplate", "ModifyTemplateList", "InsertQuery", "UpdateQuery", "GraphRefAll", "ClearQuery", "SilentOpt", "CreateQuery", "DropQuery", "IriRefList", "GraphOrDefault", "OldGraphRef", "LoadQuery", "AddQuery", "MoveQuery", "CopyQuery", "DatasetClauseList", "DatasetClauseListOpt", "DefaultGraphClause", "NamedGraphClause", "SourceSelector", "WhereClause", "WhereClauseOpt", "SolutionModifier", "GroupConditionList", "AsVarOpt", "GroupCondition", "GroupClauseOpt", "HavingCondition", "HavingConditionList", "HavingClauseOpt", "LimitOffsetClausesOpt", "OrderClauseOpt", "OrderConditionList", "OrderCondition", "LimitClause", "OffsetClause", "ValuesClauseOpt", "VarListOpt", "VarList", "DataBlockRowListOpt", "DataBlockRowList", "DataBlockRow", "DataBlockValueList", "RDFLiteral", "DataBlockValue", "GroupGraphPattern", "GroupGraphPatternSub", "TriplesBlockOpt", "GraphPatternListOpt", "GraphPatternList", "GraphPatternListFilter", "DotOptional", "TriplesBlock", "GraphPatternNotTriples", "OptionalGraphPattern", "GraphGraphPattern", "ServiceGraphPattern", "Bind", "InlineData", "DataBlock", "InlineDataOneVar", "DataBlockValueListOpt", "InlineDataFull", "InlineDataGraphPattern", "MinusGraphPattern", "GroupOrUnionGraphPattern", "GroupOrUnionGraphPatternList", "LetGraphPattern", "Filter", "Constraint", "ParamsOpt", "FunctionCall", "CoalesceExpression", "ArgList", "ArgListNoBraces", "ConstructTemplate", "ConstructTriplesOpt", "ConstructTriples", "TriplesSameSubject", "PropertyListNotEmpty", "PropertyListTailOpt", "PropertyList", "ObjectList", "ObjectTail", "Object", "Verb", "TriplesNode", "BlankNodePropertyList", "Collection", "GraphNodeListNotEmpty", "GraphNode", "VarOrTerm", "VarOrIRIref", "Var", "VarName", "VarOrBadVarName", "GraphTerm", "Expression", "ConditionalOrExpression", "ConditionalAndExpression", "RelationalExpression", "AdditiveExpression", "AdExOpExpressionListOuter", "AdExOpExpressionListInner", "AdExOpUnaryExpressionListOpt", "AdExOpUnaryExpressionList", "AdExOpUnaryExpression", "MultiplicativeExpression", "MuExOpUnaryExpressionList", "MuExOpUnaryExpression", "UnaryExpression", "PrimaryExpression", "BrackettedExpression", "BuiltInCall", "StringExpression", "RegexExpression", "DatetimeBuiltinAccessors", "DatetimeExtensions", "IRIrefBrace", "NumericLiteral", "NumericLiteralUnsigned", "NumericLiteralPositive", "NumericLiteralNegative", "IRIref", "BlankNode", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 44, 40, 41, 91, 93, 123, 125, 63, 36, 372, 373, 374, 375, 376, 377, 378, 379, 380, 43, 45, 42, 47, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 59, 46, 33 }; # endif #define YYPACT_NINF -595 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-595))) #define YYTABLE_NINF -113 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 115, -17, 157, -595, -595, 831, -595, -595, -595, 74, 66, 16, 25, 121, 121, 121, 121, 121, 121, -595, 131, 3, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 75, 51, 82, 85, 1941, -595, 128, 91, 1941, 128, 92, -595, 133, 54, 133, 64, -23, -23, -23, 222, 132, 43, 215, 116, -595, 215, -595, -595, -595, 105, -595, 103, -40, -595, -595, -595, -595, -595, -595, 97, -595, 1976, 137, 2015, 201, 107, 107, -20, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 389, -595, -595, 95, 84, -595, -595, 84, -595, -595, 141, -595, -595, -595, -595, -595, 82, -595, -595, -595, -595, 1976, 675, -595, 165, 6, -6, -595, -595, -595, -595, -595, 123, -595, -595, -595, 33, -4, -595, -595, 216, 236, 253, 233, 233, 1374, -595, -595, 156, -595, -595, 215, 73, -595, -595, -595, 2089, 215, 316, 215, 89, 238, -595, 89, -595, 723, 176, -595, 209, 89, 218, 472, -595, 180, 192, 229, -595, 242, -595, -595, 2054, -595, -595, -595, -595, 239, 2089, -595, -595, -595, -595, -40, -595, 89, -595, 2089, -595, -595, -595, -40, -595, 246, 89, 1941, 255, 1941, -595, -595, 29, -595, -23, -23, -23, -595, -595, 261, 268, 274, 278, 280, 282, 284, 285, 287, 289, 290, 291, 292, 294, 295, 296, 298, 310, 312, 314, 315, 317, 318, 319, 320, 322, 324, 330, 332, 333, 336, 337, 338, 341, 344, 345, 350, 352, 355, 365, 367, 368, 369, 370, 372, 374, 376, 377, 379, 388, 390, 398, 399, 400, 402, 404, 406, 408, 409, 410, 424, 426, 951, 427, 1515, 1515, -595, -595, 1515, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 481, 423, 436, -595, 619, 452, 181, -595, -595, -595, -595, -595, -595, -595, 1374, 434, 243, -595, 89, 137, 89, -595, 443, -595, 445, 89, -595, 199, -595, -595, -595, 447, 529, -595, -595, 529, -595, 82, 137, 1862, 121, 82, 453, 238, 454, 561, 472, -595, 414, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 2089, 455, -595, 2089, -595, -595, -595, 417, 459, -595, -595, -595, -595, -595, -595, -595, 712, 1976, 785, -595, -595, -595, -595, -595, -595, -595, 199, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1092, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 568, 568, 568, 568, 568, 568, 568, 1374, -595, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 462, 1374, 1374, 1374, 1374, 1374, 1374, 464, 470, 471, 473, 1374, 1374, 474, -595, -595, -595, -58, 1374, 1374, 520, 319, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 1374, 452, -595, 235, 235, 1374, 1374, 181, -595, -1, -595, 568, -595, 529, -595, 529, -595, 2089, 529, 478, 199, -595, 560, 581, -595, 562, 116, -595, 82, 1374, -595, -595, -595, -595, 434, 137, -595, 1374, -595, 199, 82, -595, -595, 2089, -595, 2089, 482, 84, -595, 2089, -595, 40, 484, 89, 490, 493, 494, 496, 497, 512, 513, 515, -595, 516, 517, 518, 519, 546, 553, 554, 498, -595, 1233, 1374, 1374, 1374, 1374, 1374, 1374, 7, 557, 556, 563, 564, 566, 567, 569, 572, 575, 576, 570, 577, 578, 596, 598, 599, 579, 146, -595, 600, 601, 603, 602, 605, 606, 608, -595, 609, 611, 614, 615, 617, 618, -595, -595, -595, -595, 620, 621, -595, 107, 107, -595, 622, 436, -595, 319, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 1374, 1374, -595, 235, -595, -595, -595, -595, -595, 1374, -595, 1374, -595, -595, 558, -595, 616, -595, -595, -595, 560, -595, -595, 623, 141, -595, 1759, 1862, 659, -595, -595, 82, 654, 624, -595, 729, -595, 631, -595, -595, -595, 634, -595, -595, -595, -595, 1374, 1374, 1374, 1374, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 1374, -595, 625, -595, 626, 638, 639, 640, -33, 641, -595, 1374, -595, -595, -595, -595, -595, -595, -595, -595, -595, 1374, -595, -595, 1374, 1374, 1374, -595, 1374, -595, 1374, 1374, 1374, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -31, 529, 643, -595, -595, 1374, 1759, -595, -595, -595, -595, -595, 1862, -595, 742, 60, -595, 199, 1374, 82, -595, 1941, 153, 660, 664, 665, 666, -595, -595, -595, -595, -595, 740, 672, -595, 656, 166, 673, 677, 678, -595, 682, 684, 687, -595, 686, -595, 275, 671, 643, -595, 738, -595, -595, 1656, 662, 663, -595, 789, 798, 692, 694, -595, 1886, 1374, -595, -595, -595, -595, -595, 685, -595, 1374, 1374, -595, -595, -595, -595, -595, -595, 1374, -595, -595, 411, -595, -595, 199, 709, 715, 715, 1656, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 89, 719, 699, 722, 724, 175, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, 1374, -595, 725, -595 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 27, 0, 0, 2, 3, 6, 29, 26, 1, 0, 0, 0, 101, 101, 101, 101, 101, 101, 101, 5, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 118, 127, 0, 0, 127, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 120, 162, 7, 120, 8, 9, 10, 27, 11, 0, 0, 402, 403, 72, 73, 121, 123, 188, 78, 0, 0, 0, 0, 0, 0, 175, 395, 398, 401, 393, 396, 399, 394, 397, 400, 277, 404, 83, 85, 0, 275, 82, 242, 249, 257, 256, 0, 264, 265, 276, 390, 391, 392, 274, 278, 0, 117, 126, 75, 125, 0, 0, 86, 0, 0, 0, 95, 94, 96, 93, 98, 0, 102, 103, 104, 106, 0, 107, 108, 0, 0, 0, 0, 0, 0, 36, 34, 35, 39, 40, 120, 120, 70, 266, 267, 240, 119, 0, 120, 0, 0, 4, 0, 12, 0, 0, 122, 0, 0, 0, 191, 187, 198, 0, 0, 79, 0, 279, 263, 0, 261, 262, 255, 405, 0, 0, 254, 270, 268, 269, 0, 176, 0, 84, 240, 248, 244, 243, 0, 124, 0, 127, 0, 0, 0, 97, 74, 0, 105, 0, 0, 0, 32, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 388, 389, 0, 323, 42, 43, 44, 45, 46, 47, 48, 320, 348, 322, 321, 0, 280, 282, 284, 293, 295, 309, 317, 318, 319, 347, 357, 358, 359, 237, 274, 0, 37, 127, 0, 127, 68, 0, 239, 0, 0, 71, 164, 161, 212, 213, 0, 138, 28, 184, 138, 185, 0, 0, 0, 101, 0, 0, 0, 0, 221, 186, 190, 196, 193, 200, 202, 203, 205, 218, 206, 201, 199, 204, 194, 188, 0, 77, 0, 259, 260, 258, 247, 252, 253, 177, 76, 241, 178, 88, 87, 0, 0, 0, 111, 110, 109, 113, 114, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 237, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 315, 316, 314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 294, 297, 303, 303, 0, 0, 308, 311, 0, 236, 50, 38, 138, 69, 138, 238, 0, 138, 0, 163, 166, 216, 0, 30, 143, 162, 207, 0, 0, 225, 228, 226, 227, 0, 0, 219, 0, 211, 0, 0, 189, 195, 188, 197, 0, 0, 249, 245, 0, 250, 127, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 333, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 334, 0, 0, 0, 0, 0, 0, 345, 346, 384, 385, 0, 0, 324, 0, 0, 273, 0, 281, 283, 0, 291, 285, 286, 287, 288, 289, 290, 298, 299, 296, 0, 0, 300, 302, 305, 301, 312, 313, 310, 0, 232, 237, 67, 66, 0, 64, 0, 165, 183, 182, 215, 180, 174, 0, 181, 179, 0, 0, 150, 31, 208, 0, 0, 0, 223, 220, 192, 0, 81, 246, 251, 0, 90, 92, 91, 329, 0, 0, 0, 0, 325, 330, 331, 332, 326, 328, 353, 354, 355, 356, 0, 52, 0, 51, 0, 0, 0, 0, 59, 0, 234, 0, 376, 377, 378, 379, 380, 381, 382, 383, 360, 0, 363, 364, 0, 0, 0, 368, 0, 369, 0, 0, 0, 335, 338, 336, 337, 339, 340, 341, 342, 343, 344, 386, 387, 271, 272, 41, 292, 306, 307, 304, 235, 230, 138, 168, 173, 214, 0, 137, 130, 134, 136, 133, 141, 142, 139, 0, 148, 209, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 53, 54, 55, 56, 57, 0, 0, 63, 0, 0, 0, 0, 0, 60, 0, 0, 0, 229, 0, 65, 0, 0, 167, 170, 132, 129, 140, 0, 0, 0, 128, 146, 147, 0, 0, 222, 0, 0, 374, 327, 350, 351, 352, 0, 62, 0, 0, 361, 365, 366, 367, 370, 371, 0, 231, 172, 0, 217, 169, 0, 0, 0, 0, 149, 152, 155, 156, 157, 158, 159, 160, 144, 145, 210, 224, 127, 0, 0, 0, 0, 0, 171, 131, 135, 153, 154, 151, 89, 375, 58, 349, 362, 0, 372, 0, 373 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -595, -595, -595, -595, -595, 781, -595, -595, 784, -595, -595, -595, -595, 775, 200, -595, -119, -595, -12, -595, -595, -595, -595, -595, -595, -595, 334, -595, -595, -595, -595, -595, -595, 50, -9, -595, -107, -595, -88, -26, -595, -595, 801, -595, 36, -595, -595, -595, 26, -595, -595, -595, -595, -595, 366, 198, -595, -595, 786, -127, -41, -294, -595, -595, 138, -595, 135, -595, -595, -595, -595, -595, 55, 90, 108, 387, -595, -595, -595, -595, 118, 122, -458, -594, -22, -595, -318, -595, 534, -595, -595, -54, -595, -595, -595, -595, -595, -595, 540, -595, -595, -595, -595, -595, -595, -595, -595, -595, 547, -595, -317, -595, -406, -388, -595, 693, -140, -50, 9, -595, 373, 384, -595, -595, -595, -72, -595, -595, -595, -18, -69, -37, 22, -76, -595, 109, 240, -595, 449, 444, 53, -595, 438, 439, -595, 304, -63, -595, 440, -357, 38, -312, -315, -595, -595, -595, -595, -595, -442, -595, -270, -266, -32, -595 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 2, 3, 20, 55, 4, 62, 21, 5, 6, 32, 56, 161, 57, 140, 141, 142, 277, 526, 653, 278, 279, 280, 281, 282, 737, 551, 283, 284, 58, 59, 145, 60, 37, 123, 22, 168, 91, 92, 93, 23, 24, 124, 25, 44, 26, 27, 130, 133, 371, 28, 29, 30, 31, 150, 151, 67, 68, 69, 111, 112, 478, 710, 791, 711, 479, 715, 716, 619, 761, 719, 794, 795, 762, 763, 155, 473, 474, 752, 753, 754, 611, 94, 613, 113, 163, 164, 335, 336, 337, 497, 165, 338, 339, 340, 341, 342, 343, 317, 318, 614, 319, 344, 345, 346, 626, 347, 348, 717, 749, 285, 286, 399, 463, 152, 311, 95, 96, 189, 502, 190, 356, 504, 357, 179, 97, 98, 99, 173, 358, 100, 180, 287, 182, 577, 288, 464, 290, 291, 292, 293, 455, 456, 593, 594, 595, 294, 461, 462, 295, 296, 297, 298, 299, 300, 301, 302, 303, 103, 104, 105, 106, 304, 108 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 116, 70, 183, 172, 107, 187, 175, 194, 107, 312, 533, 485, 72, 487, 115, 146, 486, 707, 612, 169, 148, 166, 306, 166, 457, -99, 315, 187, 458, 321, 480, 498, 70, -112, 615, 324, 127, 170, 131, 107, 581, 107, 148, 107, 148, 109, 125, 33, 312, 45, 46, 47, 48, 49, 50, 199, 201, 174, 101, 360, 169, 107, 101, 197, 166, 148, 574, 575, 148, 64, 33, 125, 759, 143, 147, 134, 135, 33, 33, 34, 760, 43, 107, 107, 679, 178, 600, 193, 110, 63, 368, 110, 632, 101, 109, 101, 147, 101, 147, 181, 51, 172, 597, 598, 175, -13, 184, 172, 310, 191, 175, 176, 65, 148, 66, 101, 600, 107, 601, 147, 1, 185, 147, 39, 600, 736, 661, 748, 198, 132, 1, 35, 33, 109, 51, 7, 101, 101, 52, 53, 54, 107, 334, 117, 118, 102, 200, 107, 202, 102, 119, 120, 359, 612, 364, 354, 107, 8, 143, 143, 362, 61, 71, 143, 107, 149, 107, 147, 42, 615, 365, 101, 367, 603, 699, 604, 320, 43, 606, 627, 102, 369, 102, -99, 102, 457, 466, 472, 40, 458, 308, -112, 370, 707, 121, 101, 36, 77, 78, 122, 110, 101, 102, 65, 71, 66, 126, 73, 77, 78, 101, 71, 500, 114, 704, 75, 129, 76, 101, 33, 101, 77, 78, 102, 102, 65, 154, 66, 176, 372, 373, 374, 136, 137, 700, 701, 65, 79, 66, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 71, 66, 153, 90, 188, 156, 77, 78, 102, 506, 159, 77, 78, 679, 181, 680, 467, 192, 469, 144, 768, 468, 769, 305, 138, 200, 148, 187, 203, 187, 77, 78, 102, 777, 65, 778, 66, 196, 102, 65, 482, 66, 823, 612, 824, 148, 488, 102, 204, 166, 712, 485, 714, 487, 481, 102, 486, 102, 490, 615, 439, 440, 169, 334, 441, 205, 166, 107, 459, 460, 107, 313, 177, 77, 78, 77, 78, 143, 322, 612, 147, 605, 323, 107, 107, 107, 206, 207, 475, 349, 138, 325, 307, 309, 350, 615, 77, 78, 609, 147, 314, 138, 351, 65, 320, 66, 316, 77, 78, 139, 355, 138, 77, 78, 352, 489, 576, 77, 78, 363, 139, 101, 591, 592, 101, 38, 41, 366, 289, 375, 527, 528, 529, 530, 531, 532, 376, 101, 101, 101, 588, 589, 377, 712, 786, 714, 378, 508, 379, 485, 380, 487, 381, 382, 486, 383, 74, 384, 385, 386, 387, 750, 388, 389, 390, 79, 391, 80, 81, 82, 83, 84, 85, 86, 87, 88, 610, 65, 392, 66, 393, 172, 394, 395, 175, 396, 397, 398, 400, 107, 401, 796, 402, 799, 616, 628, 798, 166, 403, 166, 404, 405, 622, 602, 406, 407, 408, 148, 102, 409, 621, 102, 410, 411, 633, 107, 635, 107, 412, 148, 413, 107, 625, 414, 102, 102, 102, 796, 326, 799, 815, 816, 798, 415, 609, 416, 417, 418, 419, 327, 420, 328, 421, 101, 422, 423, 608, 424, 696, 697, 582, 583, 584, 585, 586, 587, 425, 75, 426, 76, 438, 147, 186, 77, 78, 624, 427, 428, 429, 101, 430, 101, 431, 147, 432, 101, 433, 434, 435, 79, 812, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 436, 66, 437, 90, 329, 330, 177, 442, 443, 79, 465, 80, 81, 82, 83, 84, 85, 86, 87, 88, 610, 65, 444, 66, 470, 471, 331, 476, 477, 491, 493, 496, 494, 501, 503, 499, 525, 616, 102, 560, 332, 567, 333, 488, 488, 453, 454, 568, 569, 580, 570, 573, 71, 81, 82, 607, 84, 85, 720, 87, 88, 617, 618, 629, 102, 634, 102, 636, 637, 638, 102, 639, 640, 651, 509, 510, 511, 512, 513, 514, 515, 517, 518, 519, 520, 521, 522, 523, 524, 641, 642, 609, 643, 644, 645, 646, 647, 713, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 552, 553, 554, 555, 556, 557, 558, 559, 648, 561, 562, 563, 564, 565, 566, 649, 650, 662, 663, 571, 572, 488, 187, 718, 705, 664, 665, 488, 666, 667, 672, 668, 445, 446, 669, 74, 107, 670, 671, 673, 674, 678, 767, 79, 766, 80, 81, 82, 83, 84, 85, 86, 87, 88, 610, 65, 675, 66, 676, 677, 681, 682, 616, 683, 684, 721, 438, 685, 686, 488, 687, 688, 74, 689, 623, 713, 690, 691, 107, 692, 693, 706, 694, 695, 698, 723, 764, 731, 732, 708, 101, 447, 448, 449, 450, 451, 452, 724, 616, 725, 733, 734, 735, 738, 751, 488, 722, 758, 818, 654, 655, 656, 657, 658, 552, 660, 776, 9, 10, 11, 12, 13, 770, 797, 14, 15, 771, 772, 773, 16, 17, 18, 101, 774, 775, 779, 75, 788, 76, 780, 781, 195, 77, 78, 782, 74, 783, 784, 785, 790, 800, 801, 760, 759, 804, 813, 805, 808, 79, 797, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 814, 66, 75, 90, 76, 483, 102, 505, 77, 78, 819, 820, 703, 821, 157, 822, 826, 158, 162, 128, 756, 817, 160, 757, 79, 803, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 659, 66, 620, 90, 495, 802, 789, 492, 787, 630, 484, 102, 726, 727, 728, 729, 361, 9, 10, 11, 12, 13, 631, 579, 14, 15, 730, 578, 590, 16, 17, 18, 596, 702, 0, 0, 599, 739, 75, 0, 76, 0, 0, 507, 77, 78, 0, 740, 0, 0, 741, 742, 743, 0, 744, 0, 745, 746, 747, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 0, 66, 0, 90, 19, 0, 0, 0, 0, 0, 0, 755, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 765, 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 224, 225, 226, 227, 228, 229, 230, 0, 0, 0, 0, 0, 0, 0, 807, 0, 0, 0, 0, 0, 0, 0, 809, 810, 231, 0, 232, 0, 0, 0, 811, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 825, 266, 267, 268, 269, 0, 270, 171, 271, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 272, 273, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 274, 66, 275, 90, 208, 0, 0, 276, 0, 0, 0, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 224, 225, 226, 227, 228, 229, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 270, 516, 271, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 272, 273, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 274, 66, 275, 90, 208, 0, 0, 276, 0, 0, 0, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 224, 225, 226, 227, 228, 229, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 270, 0, 271, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 272, 273, 652, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 274, 66, 275, 90, 208, 0, 0, 276, 0, 0, 0, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 224, 225, 226, 227, 228, 229, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 270, 0, 271, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 272, 273, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 274, 66, 275, 90, 208, 0, 0, 276, 0, 0, 0, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 224, 225, 226, 227, 228, 229, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 270, 0, 271, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 274, 66, 275, 90, 208, 0, 0, 0, 0, 0, 0, 209, 792, 793, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 483, 208, 0, 0, 0, 0, 77, 78, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 0, 0, 0, 0, 0, 0, 65, 274, 66, 275, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 709, 208, 0, 0, 0, 0, 77, 78, 209, 0, 0, 210, 0, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 74, 0, 0, 0, 0, 0, 0, 0, 65, 274, 66, 275, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 232, 0, 0, 0, 0, 0, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 74, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 266, 267, 268, 269, 0, 483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 76, 0, 0, 806, 77, 78, 0, 0, 65, 274, 66, 275, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 0, 66, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 76, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 75, 66, 76, 90, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 0, 66, 0, 90, 75, 171, 76, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 0, 66, 0, 90, 75, 353, 76, 0, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 75, 66, 76, 90, 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 65, 0, 66, 0, 90 }; static const yytype_int16 yycheck[] = { 41, 33, 78, 75, 36, 93, 75, 114, 40, 149, 398, 328, 34, 328, 40, 52, 328, 611, 476, 73, 52, 71, 141, 73, 294, 0, 153, 115, 294, 156, 324, 349, 64, 0, 476, 162, 45, 74, 61, 71, 446, 73, 74, 75, 76, 5, 17, 4, 188, 13, 14, 15, 16, 17, 18, 61, 60, 75, 36, 186, 114, 93, 40, 57, 114, 97, 124, 125, 100, 18, 4, 17, 12, 51, 52, 49, 50, 4, 4, 5, 20, 56, 114, 115, 117, 76, 117, 109, 38, 14, 61, 41, 52, 71, 5, 73, 74, 75, 76, 157, 3, 173, 459, 460, 173, 0, 126, 179, 145, 100, 179, 27, 152, 145, 154, 93, 117, 149, 119, 97, 15, 141, 100, 57, 117, 158, 119, 158, 122, 152, 15, 57, 4, 5, 3, 152, 114, 115, 7, 8, 9, 173, 164, 51, 52, 36, 152, 179, 152, 40, 17, 18, 184, 611, 195, 173, 188, 0, 136, 137, 192, 158, 122, 141, 196, 122, 198, 145, 152, 611, 196, 149, 198, 467, 580, 469, 154, 56, 472, 497, 71, 152, 73, 158, 75, 455, 305, 314, 122, 455, 117, 158, 201, 787, 61, 173, 122, 124, 125, 66, 150, 179, 93, 152, 122, 154, 152, 122, 124, 125, 188, 122, 352, 122, 602, 118, 152, 120, 196, 4, 198, 124, 125, 114, 115, 152, 110, 154, 27, 203, 204, 205, 10, 11, 591, 592, 152, 140, 154, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 122, 154, 54, 156, 159, 57, 124, 125, 149, 366, 157, 124, 125, 117, 157, 119, 307, 126, 309, 137, 117, 308, 119, 117, 118, 152, 308, 365, 62, 367, 124, 125, 173, 117, 152, 119, 154, 122, 179, 152, 327, 154, 117, 751, 119, 327, 328, 188, 62, 349, 617, 618, 617, 618, 326, 196, 618, 198, 330, 751, 272, 273, 366, 335, 276, 62, 366, 349, 137, 138, 352, 5, 121, 124, 125, 124, 125, 305, 152, 787, 308, 471, 123, 365, 366, 367, 136, 137, 316, 159, 118, 123, 144, 145, 152, 787, 124, 125, 73, 327, 152, 118, 123, 152, 332, 154, 118, 124, 125, 137, 121, 118, 124, 125, 122, 329, 442, 124, 125, 123, 137, 349, 137, 138, 352, 9, 10, 122, 138, 118, 392, 393, 394, 395, 396, 397, 118, 365, 366, 367, 453, 454, 118, 710, 119, 710, 118, 375, 118, 716, 118, 716, 118, 118, 716, 118, 17, 118, 118, 118, 118, 705, 118, 118, 118, 140, 118, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 118, 154, 118, 503, 118, 118, 503, 118, 118, 118, 118, 471, 118, 758, 118, 758, 476, 499, 758, 497, 118, 499, 118, 118, 489, 465, 118, 118, 118, 489, 349, 118, 482, 352, 118, 118, 505, 497, 507, 499, 118, 501, 118, 503, 494, 118, 365, 366, 367, 794, 6, 794, 792, 793, 794, 118, 73, 118, 118, 118, 118, 17, 118, 19, 118, 471, 118, 118, 474, 118, 574, 575, 447, 448, 449, 450, 451, 452, 118, 118, 118, 120, 270, 489, 123, 124, 125, 493, 118, 118, 118, 497, 118, 499, 118, 501, 118, 503, 118, 118, 118, 140, 119, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 118, 154, 118, 156, 74, 75, 121, 68, 127, 140, 118, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 128, 154, 123, 122, 96, 122, 41, 118, 118, 159, 13, 158, 117, 122, 10, 611, 471, 119, 110, 119, 112, 617, 618, 135, 136, 119, 119, 71, 119, 119, 122, 143, 144, 119, 146, 147, 622, 149, 150, 22, 42, 123, 497, 123, 499, 119, 117, 117, 503, 117, 117, 117, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 119, 119, 73, 119, 119, 119, 119, 119, 617, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 119, 426, 427, 428, 429, 430, 431, 119, 119, 117, 119, 436, 437, 710, 767, 21, 123, 119, 119, 716, 119, 119, 117, 119, 70, 71, 119, 17, 725, 119, 119, 119, 119, 119, 725, 140, 723, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 117, 154, 117, 117, 117, 117, 751, 117, 119, 68, 483, 119, 119, 758, 119, 119, 17, 119, 491, 710, 119, 119, 767, 119, 119, 122, 119, 119, 119, 13, 721, 119, 119, 123, 725, 129, 130, 131, 132, 133, 134, 123, 787, 122, 119, 119, 119, 119, 118, 794, 139, 22, 806, 526, 527, 528, 529, 530, 531, 532, 117, 51, 52, 53, 54, 55, 119, 758, 58, 59, 119, 119, 119, 63, 64, 65, 767, 50, 119, 119, 118, 123, 120, 119, 119, 123, 124, 125, 119, 17, 119, 117, 119, 68, 145, 145, 20, 12, 119, 790, 119, 129, 140, 794, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 119, 154, 118, 156, 120, 118, 725, 123, 124, 125, 119, 140, 600, 119, 61, 119, 119, 61, 71, 46, 710, 794, 64, 716, 140, 763, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 531, 154, 480, 156, 335, 762, 753, 332, 751, 501, 328, 767, 637, 638, 639, 640, 188, 51, 52, 53, 54, 55, 503, 444, 58, 59, 651, 443, 455, 63, 64, 65, 458, 594, -1, -1, 461, 662, 118, -1, 120, -1, -1, 123, 124, 125, -1, 672, -1, -1, 675, 676, 677, -1, 679, -1, 681, 682, 683, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, -1, 154, -1, 156, 111, -1, -1, -1, -1, -1, -1, 709, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 722, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, 43, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, 768, -1, -1, -1, -1, -1, -1, -1, 776, 777, 67, -1, 69, -1, -1, -1, 784, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, 823, 113, 114, 115, 116, -1, 118, 119, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, 136, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 16, -1, -1, 160, -1, -1, -1, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, 43, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, 119, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, 136, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 16, -1, -1, 160, -1, -1, -1, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, 43, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, -1, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, 136, 137, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 16, -1, -1, 160, -1, -1, -1, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, 43, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, -1, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, 136, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 16, -1, -1, 160, -1, -1, -1, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, 43, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, -1, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 16, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, 16, -1, -1, -1, -1, 124, 125, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, -1, 152, 153, 154, 155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, 16, -1, -1, -1, -1, 124, 125, 23, -1, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 17, -1, -1, -1, -1, -1, -1, -1, 152, 153, 154, 155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 69, -1, -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 17, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, -1, 113, 114, 115, 116, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 118, -1, 120, -1, -1, 123, 124, 125, -1, -1, 152, 153, 154, 155, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 118, -1, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 118, 154, 120, 156, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, -1, 154, -1, 156, 118, 119, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, -1, 154, -1, 156, 118, 119, 120, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 118, 154, 120, 156, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, -1, 154, -1, 156 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 15, 162, 163, 166, 169, 170, 152, 0, 51, 52, 53, 54, 55, 58, 59, 63, 64, 65, 111, 164, 168, 196, 201, 202, 204, 206, 207, 211, 212, 213, 214, 171, 4, 5, 57, 122, 194, 215, 57, 122, 215, 152, 56, 205, 205, 205, 205, 205, 205, 205, 3, 7, 8, 9, 165, 172, 174, 190, 191, 193, 158, 167, 14, 18, 152, 154, 217, 218, 219, 323, 122, 245, 122, 17, 118, 120, 124, 125, 140, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 156, 198, 199, 200, 243, 277, 278, 286, 287, 288, 291, 293, 296, 319, 320, 321, 322, 323, 324, 5, 194, 220, 221, 245, 122, 200, 221, 51, 52, 17, 18, 61, 66, 195, 203, 17, 152, 195, 203, 152, 208, 61, 152, 209, 209, 209, 10, 11, 118, 137, 175, 176, 177, 293, 137, 192, 292, 293, 323, 122, 215, 216, 275, 216, 110, 236, 216, 166, 169, 157, 219, 173, 174, 246, 247, 252, 278, 17, 197, 252, 292, 119, 286, 289, 290, 291, 27, 121, 279, 285, 292, 157, 294, 294, 126, 141, 123, 199, 159, 279, 281, 279, 126, 245, 197, 123, 122, 57, 122, 61, 152, 60, 152, 62, 62, 62, 175, 175, 16, 23, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 43, 44, 45, 46, 47, 48, 49, 67, 69, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 118, 120, 135, 136, 153, 155, 160, 178, 181, 182, 183, 184, 185, 188, 189, 271, 272, 293, 296, 297, 298, 299, 300, 301, 307, 310, 311, 312, 313, 314, 315, 316, 317, 318, 323, 117, 177, 216, 117, 216, 292, 276, 277, 5, 216, 220, 118, 259, 260, 262, 293, 220, 152, 123, 220, 123, 6, 17, 19, 74, 75, 96, 110, 112, 245, 248, 249, 250, 253, 254, 255, 256, 257, 258, 263, 264, 265, 267, 268, 159, 152, 123, 122, 119, 290, 121, 282, 284, 290, 323, 220, 276, 323, 123, 221, 200, 122, 200, 61, 152, 195, 210, 209, 209, 209, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 273, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 297, 311, 311, 311, 68, 127, 128, 70, 71, 129, 130, 131, 132, 133, 134, 135, 136, 302, 303, 321, 322, 137, 138, 308, 309, 274, 297, 118, 177, 221, 292, 221, 123, 122, 220, 237, 238, 293, 122, 41, 222, 226, 222, 245, 292, 118, 269, 271, 312, 313, 323, 205, 245, 118, 259, 118, 13, 249, 159, 251, 247, 122, 277, 158, 280, 117, 283, 123, 197, 123, 293, 297, 297, 297, 297, 297, 297, 297, 119, 297, 297, 297, 297, 297, 297, 297, 297, 10, 179, 179, 179, 179, 179, 179, 179, 274, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 187, 297, 297, 297, 297, 297, 297, 297, 297, 119, 297, 297, 297, 297, 297, 297, 119, 119, 119, 119, 297, 297, 119, 124, 125, 294, 295, 299, 300, 71, 273, 301, 301, 301, 301, 301, 301, 307, 307, 303, 137, 138, 304, 305, 306, 304, 310, 310, 309, 117, 119, 179, 222, 222, 277, 222, 119, 293, 73, 151, 242, 243, 244, 261, 319, 323, 22, 42, 229, 236, 245, 292, 297, 293, 245, 266, 247, 252, 123, 281, 282, 52, 221, 123, 221, 119, 117, 117, 117, 117, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 117, 137, 180, 297, 297, 297, 297, 297, 187, 297, 119, 117, 119, 119, 119, 119, 119, 119, 119, 119, 119, 117, 119, 119, 117, 117, 117, 119, 117, 119, 117, 117, 117, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 294, 294, 119, 273, 310, 310, 306, 297, 274, 123, 122, 244, 123, 118, 223, 225, 271, 293, 313, 227, 228, 269, 21, 231, 245, 68, 139, 13, 123, 122, 297, 297, 297, 297, 297, 119, 119, 119, 119, 119, 158, 186, 119, 297, 297, 297, 297, 297, 297, 297, 297, 297, 158, 270, 222, 118, 239, 240, 241, 297, 225, 227, 22, 12, 20, 230, 234, 235, 293, 297, 245, 200, 117, 119, 119, 119, 119, 119, 50, 119, 117, 117, 119, 119, 119, 119, 119, 119, 117, 119, 119, 242, 123, 241, 68, 224, 24, 25, 232, 233, 271, 293, 312, 313, 145, 145, 235, 234, 119, 119, 123, 297, 129, 297, 297, 297, 119, 293, 119, 312, 312, 233, 221, 119, 140, 119, 119, 117, 119, 297, 119 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 161, 162, 162, 163, 164, 164, 165, 165, 165, 165, 166, 167, 167, 167, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, 170, 170, 171, 171, 172, 173, 174, 174, 174, 175, 175, 176, 176, 176, 177, 177, 178, 178, 178, 178, 178, 178, 178, 179, 179, 180, 180, 181, 182, 183, 184, 185, 186, 186, 187, 187, 188, 189, 190, 190, 191, 191, 192, 192, 192, 193, 194, 194, 195, 196, 196, 196, 196, 197, 197, 198, 199, 199, 200, 200, 201, 201, 201, 202, 202, 202, 202, 203, 203, 203, 203, 203, 204, 204, 205, 205, 206, 206, 207, 208, 208, 209, 209, 210, 210, 210, 211, 211, 212, 213, 214, 215, 215, 216, 216, 217, 218, 219, 220, 220, 221, 221, 222, 223, 223, 224, 224, 225, 225, 225, 225, 226, 226, 227, 228, 228, 229, 229, 230, 230, 230, 230, 230, 231, 231, 232, 232, 233, 233, 233, 233, 233, 233, 234, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 243, 244, 244, 244, 244, 244, 245, 245, 246, 247, 247, 248, 248, 248, 249, 250, 250, 251, 251, 252, 252, 253, 253, 253, 253, 253, 253, 253, 253, 254, 255, 256, 257, 258, 259, 259, 260, 261, 261, 262, 263, 264, 265, 265, 266, 266, 267, 268, 269, 269, 269, 270, 270, 271, 271, 272, 273, 274, 274, 274, 275, 276, 276, 277, 277, 278, 278, 279, 280, 280, 281, 281, 282, 283, 283, 284, 285, 285, 286, 286, 287, 288, 289, 289, 290, 290, 291, 291, 292, 292, 293, 293, 294, 295, 295, 295, 296, 296, 296, 296, 296, 296, 297, 298, 298, 299, 299, 300, 300, 300, 300, 300, 300, 300, 300, 300, 301, 301, 302, 302, 303, 303, 303, 303, 304, 304, 305, 305, 306, 306, 307, 307, 308, 308, 309, 309, 310, 310, 310, 310, 311, 311, 311, 311, 311, 311, 312, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 315, 315, 316, 316, 316, 316, 316, 316, 316, 316, 317, 317, 317, 317, 318, 318, 319, 319, 319, 320, 320, 320, 321, 321, 321, 322, 322, 322, 323, 323, 324, 324 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 4, 1, 0, 1, 1, 1, 1, 3, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 4, 0, 4, 4, 3, 3, 2, 1, 1, 2, 3, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 5, 5, 5, 5, 5, 4, 0, 3, 1, 6, 5, 5, 7, 5, 5, 2, 3, 1, 3, 2, 2, 2, 3, 5, 5, 3, 1, 5, 5, 1, 1, 2, 1, 3, 5, 5, 11, 7, 7, 7, 1, 1, 1, 1, 2, 3, 1, 1, 0, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 3, 5, 5, 5, 5, 2, 1, 1, 0, 1, 2, 1, 2, 1, 1, 0, 4, 2, 1, 2, 0, 1, 1, 4, 1, 3, 0, 1, 2, 1, 2, 0, 2, 2, 1, 1, 0, 3, 0, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 0, 1, 0, 2, 1, 1, 0, 2, 1, 3, 2, 2, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 3, 3, 2, 1, 0, 2, 1, 0, 3, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 6, 2, 1, 1, 4, 1, 0, 6, 1, 2, 3, 1, 3, 1, 6, 2, 1, 1, 1, 1, 0, 6, 3, 2, 3, 3, 1, 0, 3, 1, 0, 3, 1, 2, 2, 3, 2, 0, 1, 0, 2, 2, 0, 1, 1, 1, 1, 1, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 4, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 0, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 3, 4, 4, 6, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 1, 1, 8, 6, 6, 6, 4, 4, 4, 4, 1, 1, 1, 4, 6, 8, 4, 4, 6, 6, 6, 4, 4, 6, 6, 8, 10, 6, 8, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (rq, yyscanner, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, rq, yyscanner); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, rasqal_query* rq, void* yyscanner) { FILE *yyo = yyoutput; YYUSE (yyo); YYUSE (rq); YYUSE (yyscanner); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, rasqal_query* rq, void* yyscanner) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, rq, yyscanner); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, rasqal_query* rq, void* yyscanner) { unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) , rq, yyscanner); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule, rq, yyscanner); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); default: yyformat = YY_("syntax error"); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, rasqal_query* rq, void* yyscanner) { YYUSE (yyvaluep); YYUSE (rq); YYUSE (yyscanner); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN switch (yytype) { case 140: /* "string" */ #line 429 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).name)) RASQAL_FREE(char*, ((*yyvaluep).name)); } #line 2199 "sparql_parser.c" /* yacc.c:1257 */ break; case 141: /* "langtag" */ #line 429 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).name)) RASQAL_FREE(char*, ((*yyvaluep).name)); } #line 2208 "sparql_parser.c" /* yacc.c:1257 */ break; case 142: /* "double literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2217 "sparql_parser.c" /* yacc.c:1257 */ break; case 143: /* "double positive literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2226 "sparql_parser.c" /* yacc.c:1257 */ break; case 144: /* "double negative literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2235 "sparql_parser.c" /* yacc.c:1257 */ break; case 145: /* "integer literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2244 "sparql_parser.c" /* yacc.c:1257 */ break; case 146: /* "integer positive literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2253 "sparql_parser.c" /* yacc.c:1257 */ break; case 147: /* "integer negative literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2262 "sparql_parser.c" /* yacc.c:1257 */ break; case 148: /* "decimal literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2271 "sparql_parser.c" /* yacc.c:1257 */ break; case 149: /* "decimal positive literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2280 "sparql_parser.c" /* yacc.c:1257 */ break; case 150: /* "decimal negative literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2289 "sparql_parser.c" /* yacc.c:1257 */ break; case 151: /* "boolean literal" */ #line 408 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2298 "sparql_parser.c" /* yacc.c:1257 */ break; case 152: /* "URI literal" */ #line 418 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).uri)) raptor_free_uri(((*yyvaluep).uri)); } #line 2307 "sparql_parser.c" /* yacc.c:1257 */ break; case 153: /* "URI literal (" */ #line 418 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).uri)) raptor_free_uri(((*yyvaluep).uri)); } #line 2316 "sparql_parser.c" /* yacc.c:1257 */ break; case 154: /* "QName literal" */ #line 429 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).name)) RASQAL_FREE(char*, ((*yyvaluep).name)); } #line 2325 "sparql_parser.c" /* yacc.c:1257 */ break; case 155: /* "QName literal (" */ #line 429 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).name)) RASQAL_FREE(char*, ((*yyvaluep).name)); } #line 2334 "sparql_parser.c" /* yacc.c:1257 */ break; case 156: /* "blank node literal" */ #line 429 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).name)) RASQAL_FREE(char*, ((*yyvaluep).name)); } #line 2343 "sparql_parser.c" /* yacc.c:1257 */ break; case 157: /* "identifier" */ #line 429 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).name)) RASQAL_FREE(char*, ((*yyvaluep).name)); } #line 2352 "sparql_parser.c" /* yacc.c:1257 */ break; case 172: /* SelectQuery */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2361 "sparql_parser.c" /* yacc.c:1257 */ break; case 173: /* SubSelect */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2370 "sparql_parser.c" /* yacc.c:1257 */ break; case 174: /* SelectClause */ #line 535 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).projection)) rasqal_free_projection(((*yyvaluep).projection)); } #line 2379 "sparql_parser.c" /* yacc.c:1257 */ break; case 175: /* SelectExpressionList */ #line 535 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).projection)) rasqal_free_projection(((*yyvaluep).projection)); } #line 2388 "sparql_parser.c" /* yacc.c:1257 */ break; case 176: /* SelectExpressionListTail */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2397 "sparql_parser.c" /* yacc.c:1257 */ break; case 177: /* SelectTerm */ #line 511 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).variable)) rasqal_free_variable(((*yyvaluep).variable)); } #line 2406 "sparql_parser.c" /* yacc.c:1257 */ break; case 178: /* AggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2415 "sparql_parser.c" /* yacc.c:1257 */ break; case 180: /* ExpressionOrStar */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2424 "sparql_parser.c" /* yacc.c:1257 */ break; case 181: /* CountAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2433 "sparql_parser.c" /* yacc.c:1257 */ break; case 182: /* SumAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2442 "sparql_parser.c" /* yacc.c:1257 */ break; case 183: /* AvgAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2451 "sparql_parser.c" /* yacc.c:1257 */ break; case 184: /* MinAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2460 "sparql_parser.c" /* yacc.c:1257 */ break; case 185: /* MaxAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2469 "sparql_parser.c" /* yacc.c:1257 */ break; case 186: /* SeparatorOpt */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2478 "sparql_parser.c" /* yacc.c:1257 */ break; case 188: /* GroupConcatAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2487 "sparql_parser.c" /* yacc.c:1257 */ break; case 189: /* SampleAggregateExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2496 "sparql_parser.c" /* yacc.c:1257 */ break; case 190: /* ConstructQuery */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2505 "sparql_parser.c" /* yacc.c:1257 */ break; case 191: /* DescribeQuery */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2514 "sparql_parser.c" /* yacc.c:1257 */ break; case 192: /* VarOrIRIrefList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2523 "sparql_parser.c" /* yacc.c:1257 */ break; case 194: /* DatasetClause */ #line 517 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).data_graph)) rasqal_free_data_graph(((*yyvaluep).data_graph)); } #line 2532 "sparql_parser.c" /* yacc.c:1257 */ break; case 197: /* GraphTriples */ #line 453 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).update)) rasqal_free_update_operation(((*yyvaluep).update)); } #line 2541 "sparql_parser.c" /* yacc.c:1257 */ break; case 198: /* GraphTemplate */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2550 "sparql_parser.c" /* yacc.c:1257 */ break; case 199: /* ModifyTemplate */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2559 "sparql_parser.c" /* yacc.c:1257 */ break; case 200: /* ModifyTemplateList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2568 "sparql_parser.c" /* yacc.c:1257 */ break; case 203: /* GraphRefAll */ #line 424 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).uri_applies)) free_uri_applies(((*yyvaluep).uri_applies)); } #line 2577 "sparql_parser.c" /* yacc.c:1257 */ break; case 208: /* IriRefList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2586 "sparql_parser.c" /* yacc.c:1257 */ break; case 215: /* DatasetClauseList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2595 "sparql_parser.c" /* yacc.c:1257 */ break; case 216: /* DatasetClauseListOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2604 "sparql_parser.c" /* yacc.c:1257 */ break; case 217: /* DefaultGraphClause */ #line 517 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).data_graph)) rasqal_free_data_graph(((*yyvaluep).data_graph)); } #line 2613 "sparql_parser.c" /* yacc.c:1257 */ break; case 218: /* NamedGraphClause */ #line 517 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).data_graph)) rasqal_free_data_graph(((*yyvaluep).data_graph)); } #line 2622 "sparql_parser.c" /* yacc.c:1257 */ break; case 219: /* SourceSelector */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2631 "sparql_parser.c" /* yacc.c:1257 */ break; case 222: /* SolutionModifier */ #line 529 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).modifier)) rasqal_free_solution_modifier(((*yyvaluep).modifier)); } #line 2640 "sparql_parser.c" /* yacc.c:1257 */ break; case 223: /* GroupConditionList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2649 "sparql_parser.c" /* yacc.c:1257 */ break; case 224: /* AsVarOpt */ #line 511 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).variable)) rasqal_free_variable(((*yyvaluep).variable)); } #line 2658 "sparql_parser.c" /* yacc.c:1257 */ break; case 225: /* GroupCondition */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2667 "sparql_parser.c" /* yacc.c:1257 */ break; case 226: /* GroupClauseOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2676 "sparql_parser.c" /* yacc.c:1257 */ break; case 227: /* HavingCondition */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2685 "sparql_parser.c" /* yacc.c:1257 */ break; case 228: /* HavingConditionList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2694 "sparql_parser.c" /* yacc.c:1257 */ break; case 229: /* HavingClauseOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2703 "sparql_parser.c" /* yacc.c:1257 */ break; case 231: /* OrderClauseOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2712 "sparql_parser.c" /* yacc.c:1257 */ break; case 232: /* OrderConditionList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2721 "sparql_parser.c" /* yacc.c:1257 */ break; case 233: /* OrderCondition */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 2730 "sparql_parser.c" /* yacc.c:1257 */ break; case 236: /* ValuesClauseOpt */ #line 542 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).bindings)) rasqal_free_bindings(((*yyvaluep).bindings)); } #line 2739 "sparql_parser.c" /* yacc.c:1257 */ break; case 237: /* VarListOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2748 "sparql_parser.c" /* yacc.c:1257 */ break; case 238: /* VarList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2757 "sparql_parser.c" /* yacc.c:1257 */ break; case 239: /* DataBlockRowListOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2766 "sparql_parser.c" /* yacc.c:1257 */ break; case 240: /* DataBlockRowList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2775 "sparql_parser.c" /* yacc.c:1257 */ break; case 241: /* DataBlockRow */ #line 523 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).row)) rasqal_free_row(((*yyvaluep).row)); } #line 2784 "sparql_parser.c" /* yacc.c:1257 */ break; case 242: /* DataBlockValueList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2793 "sparql_parser.c" /* yacc.c:1257 */ break; case 243: /* RDFLiteral */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2802 "sparql_parser.c" /* yacc.c:1257 */ break; case 244: /* DataBlockValue */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 2811 "sparql_parser.c" /* yacc.c:1257 */ break; case 245: /* GroupGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2820 "sparql_parser.c" /* yacc.c:1257 */ break; case 246: /* GroupGraphPatternSub */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2829 "sparql_parser.c" /* yacc.c:1257 */ break; case 247: /* TriplesBlockOpt */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 2838 "sparql_parser.c" /* yacc.c:1257 */ break; case 248: /* GraphPatternListOpt */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2847 "sparql_parser.c" /* yacc.c:1257 */ break; case 249: /* GraphPatternList */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2856 "sparql_parser.c" /* yacc.c:1257 */ break; case 250: /* GraphPatternListFilter */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2865 "sparql_parser.c" /* yacc.c:1257 */ break; case 252: /* TriplesBlock */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 2874 "sparql_parser.c" /* yacc.c:1257 */ break; case 253: /* GraphPatternNotTriples */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2883 "sparql_parser.c" /* yacc.c:1257 */ break; case 254: /* OptionalGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2892 "sparql_parser.c" /* yacc.c:1257 */ break; case 255: /* GraphGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2901 "sparql_parser.c" /* yacc.c:1257 */ break; case 256: /* ServiceGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2910 "sparql_parser.c" /* yacc.c:1257 */ break; case 257: /* Bind */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2919 "sparql_parser.c" /* yacc.c:1257 */ break; case 258: /* InlineData */ #line 542 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).bindings)) rasqal_free_bindings(((*yyvaluep).bindings)); } #line 2928 "sparql_parser.c" /* yacc.c:1257 */ break; case 259: /* DataBlock */ #line 542 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).bindings)) rasqal_free_bindings(((*yyvaluep).bindings)); } #line 2937 "sparql_parser.c" /* yacc.c:1257 */ break; case 260: /* InlineDataOneVar */ #line 542 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).bindings)) rasqal_free_bindings(((*yyvaluep).bindings)); } #line 2946 "sparql_parser.c" /* yacc.c:1257 */ break; case 261: /* DataBlockValueListOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 2955 "sparql_parser.c" /* yacc.c:1257 */ break; case 262: /* InlineDataFull */ #line 542 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).bindings)) rasqal_free_bindings(((*yyvaluep).bindings)); } #line 2964 "sparql_parser.c" /* yacc.c:1257 */ break; case 263: /* InlineDataGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2973 "sparql_parser.c" /* yacc.c:1257 */ break; case 264: /* MinusGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2982 "sparql_parser.c" /* yacc.c:1257 */ break; case 265: /* GroupOrUnionGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 2991 "sparql_parser.c" /* yacc.c:1257 */ break; case 266: /* GroupOrUnionGraphPatternList */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 3000 "sparql_parser.c" /* yacc.c:1257 */ break; case 267: /* LetGraphPattern */ #line 470 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).graph_pattern)) rasqal_free_graph_pattern(((*yyvaluep).graph_pattern)); } #line 3009 "sparql_parser.c" /* yacc.c:1257 */ break; case 268: /* Filter */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3018 "sparql_parser.c" /* yacc.c:1257 */ break; case 269: /* Constraint */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3027 "sparql_parser.c" /* yacc.c:1257 */ break; case 270: /* ParamsOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3036 "sparql_parser.c" /* yacc.c:1257 */ break; case 271: /* FunctionCall */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3045 "sparql_parser.c" /* yacc.c:1257 */ break; case 272: /* CoalesceExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3054 "sparql_parser.c" /* yacc.c:1257 */ break; case 273: /* ArgList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3063 "sparql_parser.c" /* yacc.c:1257 */ break; case 274: /* ArgListNoBraces */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3072 "sparql_parser.c" /* yacc.c:1257 */ break; case 275: /* ConstructTemplate */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3081 "sparql_parser.c" /* yacc.c:1257 */ break; case 276: /* ConstructTriplesOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3090 "sparql_parser.c" /* yacc.c:1257 */ break; case 277: /* ConstructTriples */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3099 "sparql_parser.c" /* yacc.c:1257 */ break; case 278: /* TriplesSameSubject */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3108 "sparql_parser.c" /* yacc.c:1257 */ break; case 279: /* PropertyListNotEmpty */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3117 "sparql_parser.c" /* yacc.c:1257 */ break; case 280: /* PropertyListTailOpt */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3126 "sparql_parser.c" /* yacc.c:1257 */ break; case 281: /* PropertyList */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3135 "sparql_parser.c" /* yacc.c:1257 */ break; case 282: /* ObjectList */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3144 "sparql_parser.c" /* yacc.c:1257 */ break; case 283: /* ObjectTail */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3153 "sparql_parser.c" /* yacc.c:1257 */ break; case 284: /* Object */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3162 "sparql_parser.c" /* yacc.c:1257 */ break; case 285: /* Verb */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3171 "sparql_parser.c" /* yacc.c:1257 */ break; case 286: /* TriplesNode */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3180 "sparql_parser.c" /* yacc.c:1257 */ break; case 287: /* BlankNodePropertyList */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3189 "sparql_parser.c" /* yacc.c:1257 */ break; case 288: /* Collection */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3198 "sparql_parser.c" /* yacc.c:1257 */ break; case 289: /* GraphNodeListNotEmpty */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3207 "sparql_parser.c" /* yacc.c:1257 */ break; case 290: /* GraphNode */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3216 "sparql_parser.c" /* yacc.c:1257 */ break; case 291: /* VarOrTerm */ #line 459 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).formula)) rasqal_free_formula(((*yyvaluep).formula)); } #line 3225 "sparql_parser.c" /* yacc.c:1257 */ break; case 292: /* VarOrIRIref */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3234 "sparql_parser.c" /* yacc.c:1257 */ break; case 293: /* Var */ #line 511 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).variable)) rasqal_free_variable(((*yyvaluep).variable)); } #line 3243 "sparql_parser.c" /* yacc.c:1257 */ break; case 294: /* VarName */ #line 511 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).variable)) rasqal_free_variable(((*yyvaluep).variable)); } #line 3252 "sparql_parser.c" /* yacc.c:1257 */ break; case 296: /* GraphTerm */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3261 "sparql_parser.c" /* yacc.c:1257 */ break; case 297: /* Expression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3270 "sparql_parser.c" /* yacc.c:1257 */ break; case 298: /* ConditionalOrExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3279 "sparql_parser.c" /* yacc.c:1257 */ break; case 299: /* ConditionalAndExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3288 "sparql_parser.c" /* yacc.c:1257 */ break; case 300: /* RelationalExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3297 "sparql_parser.c" /* yacc.c:1257 */ break; case 301: /* AdditiveExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3306 "sparql_parser.c" /* yacc.c:1257 */ break; case 302: /* AdExOpExpressionListOuter */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3315 "sparql_parser.c" /* yacc.c:1257 */ break; case 303: /* AdExOpExpressionListInner */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3324 "sparql_parser.c" /* yacc.c:1257 */ break; case 304: /* AdExOpUnaryExpressionListOpt */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3333 "sparql_parser.c" /* yacc.c:1257 */ break; case 305: /* AdExOpUnaryExpressionList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3342 "sparql_parser.c" /* yacc.c:1257 */ break; case 306: /* AdExOpUnaryExpression */ #line 548 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).op_expr)) free_op_expr(((*yyvaluep).op_expr)); } #line 3351 "sparql_parser.c" /* yacc.c:1257 */ break; case 307: /* MultiplicativeExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3360 "sparql_parser.c" /* yacc.c:1257 */ break; case 308: /* MuExOpUnaryExpressionList */ #line 435 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).seq)) raptor_free_sequence(((*yyvaluep).seq)); } #line 3369 "sparql_parser.c" /* yacc.c:1257 */ break; case 309: /* MuExOpUnaryExpression */ #line 548 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).op_expr)) free_op_expr(((*yyvaluep).op_expr)); } #line 3378 "sparql_parser.c" /* yacc.c:1257 */ break; case 310: /* UnaryExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3387 "sparql_parser.c" /* yacc.c:1257 */ break; case 311: /* PrimaryExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3396 "sparql_parser.c" /* yacc.c:1257 */ break; case 312: /* BrackettedExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3405 "sparql_parser.c" /* yacc.c:1257 */ break; case 313: /* BuiltInCall */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3414 "sparql_parser.c" /* yacc.c:1257 */ break; case 315: /* RegexExpression */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3423 "sparql_parser.c" /* yacc.c:1257 */ break; case 316: /* DatetimeBuiltinAccessors */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3432 "sparql_parser.c" /* yacc.c:1257 */ break; case 317: /* DatetimeExtensions */ #line 483 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).expr)) rasqal_free_expression(((*yyvaluep).expr)); } #line 3441 "sparql_parser.c" /* yacc.c:1257 */ break; case 318: /* IRIrefBrace */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3450 "sparql_parser.c" /* yacc.c:1257 */ break; case 319: /* NumericLiteral */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3459 "sparql_parser.c" /* yacc.c:1257 */ break; case 320: /* NumericLiteralUnsigned */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3468 "sparql_parser.c" /* yacc.c:1257 */ break; case 321: /* NumericLiteralPositive */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3477 "sparql_parser.c" /* yacc.c:1257 */ break; case 322: /* NumericLiteralNegative */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3486 "sparql_parser.c" /* yacc.c:1257 */ break; case 323: /* IRIref */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3495 "sparql_parser.c" /* yacc.c:1257 */ break; case 324: /* BlankNode */ #line 500 "./sparql_parser.y" /* yacc.c:1257 */ { if(((*yyvaluep).literal)) rasqal_free_literal(((*yyvaluep).literal)); } #line 3504 "sparql_parser.c" /* yacc.c:1257 */ break; default: break; } YY_IGNORE_MAYBE_UNINITIALIZED_END } /*----------. | yyparse. | `----------*/ int yyparse (rasqal_query* rq, void* yyscanner) { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (&yylval, yyscanner); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 4: #line 571 "./sparql_parser.y" /* yacc.c:1646 */ { if((yyvsp[0].bindings)) rq->bindings = (yyvsp[0].bindings); } #line 3773 "sparql_parser.c" /* yacc.c:1646 */ break; case 5: #line 580 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(sparql->experimental) rq->explain = 1; else { sparql_syntax_error(rq, "EXPLAIN can only used with LAQRS"); YYERROR; } } #line 3790 "sparql_parser.c" /* yacc.c:1646 */ break; case 6: #line 593 "./sparql_parser.y" /* yacc.c:1646 */ { /* nothing to do */ } #line 3798 "sparql_parser.c" /* yacc.c:1646 */ break; case 7: #line 601 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_sequence* seq; rasqal_graph_pattern* where_gp; /* Query graph pattern is first GP inside sequence of sub-GPs */ seq = rasqal_graph_pattern_get_sub_graph_pattern_sequence((yyvsp[0].graph_pattern)); where_gp = (rasqal_graph_pattern*)raptor_sequence_delete_at(seq, 0); rasqal_query_store_select_query(rq, (yyvsp[0].graph_pattern)->projection, (yyvsp[0].graph_pattern)->data_graphs, where_gp, (yyvsp[0].graph_pattern)->modifier); (yyvsp[0].graph_pattern)->projection = NULL; (yyvsp[0].graph_pattern)->data_graphs = NULL; (yyvsp[0].graph_pattern)->modifier = NULL; rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); } #line 3822 "sparql_parser.c" /* yacc.c:1646 */ break; case 8: #line 621 "./sparql_parser.y" /* yacc.c:1646 */ { rq->constructs = (yyvsp[0].seq); rq->verb = RASQAL_QUERY_VERB_CONSTRUCT; } #line 3831 "sparql_parser.c" /* yacc.c:1646 */ break; case 9: #line 626 "./sparql_parser.y" /* yacc.c:1646 */ { rq->describes = (yyvsp[0].seq); rq->verb = RASQAL_QUERY_VERB_DESCRIBE; } #line 3840 "sparql_parser.c" /* yacc.c:1646 */ break; case 10: #line 631 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_ASK; } #line 3848 "sparql_parser.c" /* yacc.c:1646 */ break; case 15: #line 649 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_DELETE; } #line 3856 "sparql_parser.c" /* yacc.c:1646 */ break; case 16: #line 653 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_INSERT; } #line 3864 "sparql_parser.c" /* yacc.c:1646 */ break; case 17: #line 657 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3872 "sparql_parser.c" /* yacc.c:1646 */ break; case 18: #line 661 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3880 "sparql_parser.c" /* yacc.c:1646 */ break; case 19: #line 665 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3888 "sparql_parser.c" /* yacc.c:1646 */ break; case 20: #line 669 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3896 "sparql_parser.c" /* yacc.c:1646 */ break; case 21: #line 673 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3904 "sparql_parser.c" /* yacc.c:1646 */ break; case 22: #line 677 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3912 "sparql_parser.c" /* yacc.c:1646 */ break; case 23: #line 681 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3920 "sparql_parser.c" /* yacc.c:1646 */ break; case 24: #line 685 "./sparql_parser.y" /* yacc.c:1646 */ { rq->verb = RASQAL_QUERY_VERB_UPDATE; } #line 3928 "sparql_parser.c" /* yacc.c:1646 */ break; case 25: #line 693 "./sparql_parser.y" /* yacc.c:1646 */ { /* nothing to do */ } #line 3936 "sparql_parser.c" /* yacc.c:1646 */ break; case 26: #line 701 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_query_set_base_uri(rq, (yyvsp[0].uri)); rasqal_evaluation_context_set_base_uri(rq->eval_context, (yyvsp[0].uri)); } #line 3945 "sparql_parser.c" /* yacc.c:1646 */ break; case 27: #line 706 "./sparql_parser.y" /* yacc.c:1646 */ { /* nothing to do */ } #line 3953 "sparql_parser.c" /* yacc.c:1646 */ break; case 28: #line 714 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_sequence *seq = rq->prefixes; unsigned const char* prefix_string = (yyvsp[-1].name); size_t prefix_length = 0; if(prefix_string) prefix_length = strlen(RASQAL_GOOD_CAST(const char*, prefix_string)); if(raptor_namespaces_find_namespace(rq->namespaces, prefix_string, RASQAL_BAD_CAST(int, prefix_length))) { /* A prefix may be defined only once */ sparql_syntax_warning(rq, "PREFIX %s can be defined only once.", prefix_string ? RASQAL_GOOD_CAST(const char*, prefix_string) : ":"); RASQAL_FREE(char*, prefix_string); raptor_free_uri((yyvsp[0].uri)); } else { rasqal_prefix *p; p = rasqal_new_prefix(rq->world, prefix_string, (yyvsp[0].uri)); if(!p) YYERROR_MSG("PrefixDeclOpt: failed to create new prefix"); if(raptor_sequence_push(seq, p)) YYERROR_MSG("PrefixDeclOpt: cannot push prefix to seq"); if(rasqal_query_declare_prefix(rq, p)) { YYERROR_MSG("PrefixDeclOpt: cannot declare prefix"); } } } #line 3986 "sparql_parser.c" /* yacc.c:1646 */ break; case 29: #line 743 "./sparql_parser.y" /* yacc.c:1646 */ { /* nothing to do, rq->prefixes already initialised */ } #line 3994 "sparql_parser.c" /* yacc.c:1646 */ break; case 30: #line 751 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.graph_pattern) = NULL; if(!sparql->sparql_scda) { sparql_syntax_error(rq, "SELECT can only be used with a SPARQL query"); YYERROR; } else { (yyval.graph_pattern) = rasqal_new_select_graph_pattern(rq, (yyvsp[-3].projection), (yyvsp[-2].seq), (yyvsp[-1].graph_pattern), (yyvsp[0].modifier), NULL); } } #line 4013 "sparql_parser.c" /* yacc.c:1646 */ break; case 31: #line 769 "./sparql_parser.y" /* yacc.c:1646 */ { if((yyvsp[-3].projection) && (yyvsp[-2].graph_pattern) && (yyvsp[-1].modifier)) { (yyval.graph_pattern) = rasqal_new_select_graph_pattern(rq, (yyvsp[-3].projection), /* data graphs */ NULL, (yyvsp[-2].graph_pattern), (yyvsp[-1].modifier), (yyvsp[0].bindings)); } else (yyval.graph_pattern) = NULL; } #line 4029 "sparql_parser.c" /* yacc.c:1646 */ break; case 32: #line 784 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.projection) = (yyvsp[0].projection); (yyval.projection)->distinct = 1; } #line 4038 "sparql_parser.c" /* yacc.c:1646 */ break; case 33: #line 789 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.projection) = (yyvsp[0].projection); (yyval.projection)->distinct = 2; } #line 4047 "sparql_parser.c" /* yacc.c:1646 */ break; case 34: #line 794 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.projection) = (yyvsp[0].projection); } #line 4055 "sparql_parser.c" /* yacc.c:1646 */ break; case 35: #line 804 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.projection) = rasqal_new_projection(rq, (yyvsp[0].seq), 0, 0); } #line 4063 "sparql_parser.c" /* yacc.c:1646 */ break; case 36: #line 808 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.projection) = rasqal_new_projection(rq, NULL, /* wildcard */ 1, 0); } #line 4071 "sparql_parser.c" /* yacc.c:1646 */ break; case 37: #line 818 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].variable))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("SelectExpressionListTail 1: sequence push failed"); } } #line 4084 "sparql_parser.c" /* yacc.c:1646 */ break; case 38: #line 827 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-2].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].variable))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("SelectExpressionListTail 2: sequence push failed"); } } #line 4097 "sparql_parser.c" /* yacc.c:1646 */ break; case 39: #line 836 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!(yyval.seq)) YYERROR_MSG("SelectExpressionListTail 3: failed to create sequence"); if(raptor_sequence_push((yyval.seq), (yyvsp[0].variable))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("SelectExpressionListTail 3: sequence push failed"); } } #line 4113 "sparql_parser.c" /* yacc.c:1646 */ break; case 40: #line 854 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); } #line 4121 "sparql_parser.c" /* yacc.c:1646 */ break; case 41: #line 858 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.variable) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "SELECT ( expression ) AS Variable can only be used with SPARQL 1.1"); YYERROR; } else if((yyvsp[-3].expr) && (yyvsp[-1].variable)) { if(rasqal_expression_mentions_variable((yyvsp[-3].expr), (yyvsp[-1].variable))) { sparql_query_error_full(rq, "Expression in SELECT ( expression ) AS %s contains the variable name '%s'", (yyvsp[-1].variable)->name, (yyvsp[-1].variable)->name); YYERROR; } else { (yyval.variable) = (yyvsp[-1].variable); (yyval.variable)->expression = (yyvsp[-3].expr); } } } #line 4148 "sparql_parser.c" /* yacc.c:1646 */ break; case 42: #line 900 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4156 "sparql_parser.c" /* yacc.c:1646 */ break; case 43: #line 904 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4164 "sparql_parser.c" /* yacc.c:1646 */ break; case 44: #line 908 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4172 "sparql_parser.c" /* yacc.c:1646 */ break; case 45: #line 912 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4180 "sparql_parser.c" /* yacc.c:1646 */ break; case 46: #line 916 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4188 "sparql_parser.c" /* yacc.c:1646 */ break; case 47: #line 920 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4196 "sparql_parser.c" /* yacc.c:1646 */ break; case 48: #line 924 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4204 "sparql_parser.c" /* yacc.c:1646 */ break; case 49: #line 931 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_query) { sparql_syntax_error(rq, "functions with DISTINCT can only be used with SPARQL 1.1"); YYERROR; } (yyval.uinteger) = RASQAL_EXPR_FLAG_DISTINCT; } #line 4221 "sparql_parser.c" /* yacc.c:1646 */ break; case 50: #line 944 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uinteger) = 0; } #line 4229 "sparql_parser.c" /* yacc.c:1646 */ break; case 51: #line 951 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 4237 "sparql_parser.c" /* yacc.c:1646 */ break; case 52: #line 955 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_VARSTAR); } #line 4246 "sparql_parser.c" /* yacc.c:1646 */ break; case 53: #line 963 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "COUNT() can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.expr) = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_COUNT, (yyvsp[-1].expr), NULL /* params */, (yyvsp[-2].uinteger)); if(!(yyval.expr)) YYERROR_MSG("CountAggregateExpression: cannot create expr"); } } #line 4268 "sparql_parser.c" /* yacc.c:1646 */ break; case 54: #line 984 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "SUM() can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.expr) = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_SUM, (yyvsp[-1].expr), NULL /* params */, (yyvsp[-2].uinteger)); if(!(yyval.expr)) YYERROR_MSG("SumAggregateExpression: cannot create expr"); } } #line 4290 "sparql_parser.c" /* yacc.c:1646 */ break; case 55: #line 1005 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "AVG() can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.expr) = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_AVG, (yyvsp[-1].expr), NULL /* params */, (yyvsp[-2].uinteger)); if(!(yyval.expr)) YYERROR_MSG("AvgAggregateExpression: cannot create expr"); } } #line 4312 "sparql_parser.c" /* yacc.c:1646 */ break; case 56: #line 1026 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "MIN() can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.expr) = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_MIN, (yyvsp[-1].expr), NULL /* params */, (yyvsp[-2].uinteger)); if(!(yyval.expr)) YYERROR_MSG("MinAggregateExpression: cannot create expr"); } } #line 4334 "sparql_parser.c" /* yacc.c:1646 */ break; case 57: #line 1047 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "MAX() can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.expr) = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_MAX, (yyvsp[-1].expr), NULL /* params */, (yyvsp[-2].uinteger)); if(!(yyval.expr)) YYERROR_MSG("MaxAggregateExpression: cannot create expr"); } } #line 4356 "sparql_parser.c" /* yacc.c:1646 */ break; case 58: #line 1068 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_string_literal(rq->world, (yyvsp[0].name), NULL /* language */, NULL /* dt uri */, NULL /* dt_qname */); } #line 4366 "sparql_parser.c" /* yacc.c:1646 */ break; case 59: #line 1074 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = NULL; } #line 4374 "sparql_parser.c" /* yacc.c:1646 */ break; case 60: #line 1084 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-2].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("ExpressionList 1: sequence push failed"); } } #line 4387 "sparql_parser.c" /* yacc.c:1646 */ break; case 61: #line 1093 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyval.seq)) YYERROR_MSG("ExpressionList 2: failed to create sequence"); if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("ExpressionList 2: sequence push failed"); } } #line 4404 "sparql_parser.c" /* yacc.c:1646 */ break; case 62: #line 1109 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "GROUP_CONCAT() can only be used with SPARQL 1.1"); YYERROR; } else { int flags = 0; if((yyvsp[-3].uinteger)) flags |= RASQAL_EXPR_FLAG_DISTINCT; (yyval.expr) = rasqal_new_group_concat_expression(rq->world, flags /* flags */, (yyvsp[-2].seq) /* args */, (yyvsp[-1].literal) /* separator */); if(!(yyval.expr)) YYERROR_MSG("GroupConcatAggregateExpression: cannot create expr"); } } #line 4433 "sparql_parser.c" /* yacc.c:1646 */ break; case 63: #line 1137 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "SAMPLE() can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.expr) = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_SAMPLE, (yyvsp[-1].expr), NULL /* params */, (yyvsp[-2].uinteger)); if(!(yyval.expr)) YYERROR_MSG("SampleAggregateExpression: cannot create expr"); } } #line 4455 "sparql_parser.c" /* yacc.c:1646 */ break; case 64: #line 1160 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.seq) = NULL; if(!sparql->sparql_scda) { sparql_syntax_error(rq, "CONSTRUCT can only be used with a SPARQL query"); YYERROR; } (yyval.seq) = (yyvsp[-3].seq); if((yyvsp[-2].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-2].seq)); rq->query_graph_pattern = (yyvsp[-1].graph_pattern); if((yyvsp[0].modifier)) rq->modifier = (yyvsp[0].modifier); } #line 4481 "sparql_parser.c" /* yacc.c:1646 */ break; case 65: #line 1182 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_graph_pattern* where_gp; raptor_sequence* seq = NULL; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql_scda) { sparql_syntax_error(rq, "CONSTRUCT can only be used with a SPARQL query"); YYERROR; } if((yyvsp[-2].seq)) { int i; int size = raptor_sequence_size((yyvsp[-2].seq)); seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); for(i = 0; i < size; i++) { rasqal_triple* t = (rasqal_triple*)raptor_sequence_get_at((yyvsp[-2].seq), i); t = rasqal_new_triple_from_triple(t); raptor_sequence_push(seq, t); } } where_gp = rasqal_new_basic_graph_pattern_from_triples(rq, seq); seq = NULL; if(!where_gp) YYERROR_MSG("ConstructQuery: cannot create graph pattern"); (yyval.seq) = (yyvsp[-2].seq); if((yyvsp[-5].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-5].seq)); rq->query_graph_pattern = where_gp; if((yyvsp[0].modifier)) rq->modifier = (yyvsp[0].modifier); } #line 4526 "sparql_parser.c" /* yacc.c:1646 */ break; case 66: #line 1228 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.seq) = NULL; if(!sparql->sparql_scda) { sparql_syntax_error(rq, "DESCRIBE can only be used with a SPARQL query"); YYERROR; } (yyval.seq) = (yyvsp[-3].seq); if((yyvsp[-2].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-2].seq)); rq->query_graph_pattern = (yyvsp[-1].graph_pattern); if((yyvsp[0].modifier)) rq->modifier = (yyvsp[0].modifier); } #line 4553 "sparql_parser.c" /* yacc.c:1646 */ break; case 67: #line 1252 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; if((yyvsp[-2].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-2].seq)); rq->query_graph_pattern = (yyvsp[-1].graph_pattern); if((yyvsp[0].modifier)) rq->modifier = (yyvsp[0].modifier); } #line 4569 "sparql_parser.c" /* yacc.c:1646 */ break; case 68: #line 1268 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].literal))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("VarOrIRIrefList 1: sequence push failed"); } } #line 4582 "sparql_parser.c" /* yacc.c:1646 */ break; case 69: #line 1277 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-2].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].literal))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("VarOrIRIrefList 2: sequence push failed"); } } #line 4595 "sparql_parser.c" /* yacc.c:1646 */ break; case 70: #line 1286 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); if(!(yyval.seq)) YYERROR_MSG("VarOrIRIrefList 3: cannot create seq"); if(raptor_sequence_push((yyval.seq), (yyvsp[0].literal))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("VarOrIRIrefList 3: sequence push failed"); } } #line 4611 "sparql_parser.c" /* yacc.c:1646 */ break; case 71: #line 1303 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql_scda) { sparql_syntax_error(rq, "ASK can only be used with a SPARQL query"); YYERROR; } if((yyvsp[-1].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-1].seq)); rq->query_graph_pattern = (yyvsp[0].graph_pattern); } #line 4631 "sparql_parser.c" /* yacc.c:1646 */ break; case 72: #line 1323 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.data_graph) = (yyvsp[0].data_graph); } #line 4639 "sparql_parser.c" /* yacc.c:1646 */ break; case 73: #line 1327 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.data_graph) = (yyvsp[0].data_graph); } #line 4647 "sparql_parser.c" /* yacc.c:1646 */ break; case 74: #line 1335 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri) = (yyvsp[0].uri); } #line 4655 "sparql_parser.c" /* yacc.c:1646 */ break; case 75: #line 1343 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE can only be used with a SPARQL 1.1 Update"); YYERROR; } /* LAQRS: experimental syntax */ sparql_syntax_warning(rq, "DELETE FROM ... WHERE ... is deprecated LAQRS syntax."); if((yyvsp[-1].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-1].seq)); rq->query_graph_pattern = (yyvsp[0].graph_pattern); } #line 4679 "sparql_parser.c" /* yacc.c:1646 */ break; case 76: #line 1363 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE can only be used with a SPARQL 1.1 Update"); YYERROR; } /* SPARQL 1.1 (Draft) update: * deleting via template + query - not inline atomic triples */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph_uri */, NULL /* document_uri */, NULL /* insert templates */, (yyvsp[-2].seq) /* delete templates */, (yyvsp[0].graph_pattern) /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("DeleteQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("DeleteQuery: rasqal_query_add_update_operation failed"); } } #line 4715 "sparql_parser.c" /* yacc.c:1646 */ break; case 77: #line 1395 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE can only be used with a SPARQL 1.1 Update"); YYERROR; } /* SPARQL 1.1 (Draft) update: * deleting inline triples - not inserting from graph URIs */ (yyvsp[-1].update)->type = RASQAL_UPDATE_TYPE_UPDATE; (yyvsp[-1].update)->delete_templates = (yyvsp[-1].update)->insert_templates; (yyvsp[-1].update)->insert_templates = NULL; (yyvsp[-1].update)->flags |= RASQAL_UPDATE_FLAGS_DATA; rasqal_query_add_update_operation(rq, (yyvsp[-1].update)); } #line 4739 "sparql_parser.c" /* yacc.c:1646 */ break; case 78: #line 1415 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; raptor_sequence* delete_templates = NULL; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE WHERE { } can only be used with a SPARQL 1.1 Update"); YYERROR; } /* SPARQL 1.1 (Draft) update: * deleting via template - not inline atomic triples */ /* Turn GP into flattened triples */ if((yyvsp[0].graph_pattern)) { delete_templates = rasqal_graph_pattern_get_flattened_triples(rq, (yyvsp[0].graph_pattern)); rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); (yyvsp[0].graph_pattern) = NULL; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph_uri */, NULL /* document_uri */, NULL /* insert templates */, delete_templates /* delete templates */, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("DeleteQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("DeleteQuery: rasqal_query_add_update_operation failed"); } } #line 4783 "sparql_parser.c" /* yacc.c:1646 */ break; case 79: #line 1459 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.update) = NULL; if((yyvsp[0].formula)) { (yyval.update) = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UNKNOWN, NULL /* graph_uri */, NULL /* document_uri */, (yyvsp[0].formula)->triples /* insert templates */, NULL /* delete templates */, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); (yyvsp[0].formula)->triples = NULL; rasqal_free_formula((yyvsp[0].formula)); } } #line 4804 "sparql_parser.c" /* yacc.c:1646 */ break; case 80: #line 1476 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.update) = NULL; if((yyvsp[-1].formula)) { raptor_sequence* seq; seq = (yyvsp[-1].formula)->triples; if((yyvsp[-3].uri)) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, (yyvsp[-3].uri)); (yyvsp[-3].uri) = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, seq, origin_literal); rasqal_free_literal(origin_literal); } (yyval.update) = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UNKNOWN, NULL /* graph uri */, NULL /* document uri */, seq /* insert templates */, NULL /* delete templates */, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); (yyvsp[-1].formula)->triples = NULL; rasqal_free_formula((yyvsp[-1].formula)); } } #line 4837 "sparql_parser.c" /* yacc.c:1646 */ break; case 81: #line 1509 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[-3].literal)) { rasqal_triples_sequence_set_origin(NULL, (yyval.seq), (yyvsp[-3].literal)); rasqal_free_literal((yyvsp[-3].literal)); (yyvsp[-3].literal) = NULL; } } #line 4851 "sparql_parser.c" /* yacc.c:1646 */ break; case 82: #line 1524 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 4859 "sparql_parser.c" /* yacc.c:1646 */ break; case 83: #line 1528 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 4867 "sparql_parser.c" /* yacc.c:1646 */ break; case 84: #line 1536 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[0].seq)) { if(raptor_sequence_join((yyval.seq), (yyvsp[0].seq))) { raptor_free_sequence((yyvsp[0].seq)); raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("ModifyTemplateList: sequence join failed"); } raptor_free_sequence((yyvsp[0].seq)); } } #line 4886 "sparql_parser.c" /* yacc.c:1646 */ break; case 85: #line 1551 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 4894 "sparql_parser.c" /* yacc.c:1646 */ break; case 86: #line 1560 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "INSERT can only be used with a SPARQL 1.1 Update"); YYERROR; } /* LAQRS: experimental syntax */ sparql_syntax_warning(rq, "INSERT FROM ... WHERE ... is deprecated LAQRS syntax."); if((yyvsp[-1].seq)) rasqal_query_add_data_graphs(rq, (yyvsp[-1].seq)); rq->query_graph_pattern = (yyvsp[0].graph_pattern); } #line 4918 "sparql_parser.c" /* yacc.c:1646 */ break; case 87: #line 1580 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "INSERT can only be used with a SPARQL 1.1 Update"); YYERROR; } /* inserting via template + query - not inline atomic triples */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph_uri */, NULL /* document_uri */, (yyvsp[-2].seq) /* insert templates */, NULL /* delete templates */, (yyvsp[0].graph_pattern) /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("InsertQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("InsertQuery: rasqal_query_add_update_operation failed"); } } #line 4952 "sparql_parser.c" /* yacc.c:1646 */ break; case 88: #line 1610 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "INSERT DATA can only be used with a SPARQL 1.1 Update"); YYERROR; } /* inserting inline atomic triples (no variables) - not via template */ (yyvsp[-1].update)->type = RASQAL_UPDATE_TYPE_UPDATE; (yyvsp[-1].update)->flags |= RASQAL_UPDATE_FLAGS_DATA; rasqal_query_add_update_operation(rq, (yyvsp[-1].update)); } #line 4973 "sparql_parser.c" /* yacc.c:1646 */ break; case 89: #line 1633 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } if((yyvsp[-9].uri)) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, (yyvsp[-9].uri)); (yyvsp[-9].uri) = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, (yyvsp[-2].seq), origin_literal); rasqal_triples_sequence_set_origin(/* dest */ NULL, (yyvsp[-6].seq), origin_literal); rasqal_free_literal(origin_literal); } /* after this $5, $9 and $12 are owned by update */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph uri */, NULL /* document uri */, (yyvsp[-2].seq) /* insert templates */, (yyvsp[-6].seq) /* delete templates */, (yyvsp[0].graph_pattern) /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("UpdateQuery 1: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("UpdateQuery 1: rasqal_query_add_update_operation failed"); } } #line 5018 "sparql_parser.c" /* yacc.c:1646 */ break; case 90: #line 1676 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } if((yyvsp[-5].uri)) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, (yyvsp[-5].uri)); (yyvsp[-5].uri) = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, (yyvsp[-2].seq), origin_literal); rasqal_free_literal(origin_literal); } /* after this $5 and $7 are owned by update */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph uri */, NULL /* document uri */, NULL /* insert templates */, (yyvsp[-2].seq) /* delete templates */, (yyvsp[0].graph_pattern) /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("UpdateQuery 2: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("UpdateQuery 2: rasqal_query_add_update_operation failed"); } } #line 5062 "sparql_parser.c" /* yacc.c:1646 */ break; case 91: #line 1718 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } if((yyvsp[-5].uri)) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, (yyvsp[-5].uri)); (yyvsp[-5].uri) = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, (yyvsp[-2].seq), origin_literal); rasqal_free_literal(origin_literal); } /* after this $5 and $7 are owned by update */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph uri */, NULL /* document uri */, (yyvsp[-2].seq) /* insert templates */, NULL /* delete templates */, (yyvsp[0].graph_pattern) /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("UpdateQuery 3: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("UpdateQuery 3: rasqal_query_add_update_operation failed"); } } #line 5106 "sparql_parser.c" /* yacc.c:1646 */ break; case 92: #line 1759 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } /* inserting inline atomic triples (no variables) - not via template */ (yyvsp[-1].update)->graph_uri = (yyvsp[-5].uri); /* graph uri */ (yyvsp[-1].update)->type = RASQAL_UPDATE_TYPE_UPDATE; (yyvsp[-1].update)->flags |= RASQAL_UPDATE_FLAGS_DATA; rasqal_query_add_update_operation(rq, (yyvsp[-1].update)); } #line 5129 "sparql_parser.c" /* yacc.c:1646 */ break; case 93: #line 1782 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri_applies) = new_uri_applies((yyvsp[0].uri), RASQAL_UPDATE_GRAPH_ONE); } #line 5137 "sparql_parser.c" /* yacc.c:1646 */ break; case 94: #line 1786 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri_applies) = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_DEFAULT); } #line 5145 "sparql_parser.c" /* yacc.c:1646 */ break; case 95: #line 1790 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri_applies) = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_NAMED); } #line 5153 "sparql_parser.c" /* yacc.c:1646 */ break; case 96: #line 1794 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri_applies) = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_ALL); } #line 5161 "sparql_parser.c" /* yacc.c:1646 */ break; case 97: #line 1798 "./sparql_parser.y" /* yacc.c:1646 */ { /* Early draft syntax - deprecated */ sparql_syntax_warning(rq, "CLEAR GRAPH DEFAULT is replaced by CLEAR DEFAULT in later SPARQL 1.1 drafts"); (yyval.uri_applies) = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_DEFAULT); } #line 5174 "sparql_parser.c" /* yacc.c:1646 */ break; case 98: #line 1811 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CLEAR (SILENT) DEFAULT | NAMED | ALL can only be used with a SPARQL 1.1 Update"); YYERROR; } if((yyvsp[0].uri_applies)) { update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CLEAR, (yyvsp[0].uri_applies)->uri ? raptor_uri_copy((yyvsp[0].uri_applies)->uri) : NULL /* graph uri or NULL */, NULL /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-1].integer) /* flags */, (yyvsp[0].uri_applies)->applies /* applies */); free_uri_applies((yyvsp[0].uri_applies)); (yyvsp[0].uri_applies) = NULL; if(!update) { YYERROR_MSG("ClearQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("ClearQuery: rasqal_query_add_update_operation failed"); } } } #line 5210 "sparql_parser.c" /* yacc.c:1646 */ break; case 99: #line 1843 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CLEAR can only be used with a SPARQL 1.1 Update"); YYERROR; } /* Early draft syntax - deprecated */ sparql_syntax_warning(rq, "CLEAR is replaced by CLEAR DEFAULT in later SPARQL 1.1 drafts"); update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CLEAR, NULL /* graph uri */, NULL /* document uri */, NULL, NULL, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("ClearQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("ClearQuery: rasqal_query_add_update_operation failed"); } } #line 5245 "sparql_parser.c" /* yacc.c:1646 */ break; case 100: #line 1878 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.integer) = RASQAL_UPDATE_FLAGS_SILENT; } #line 5253 "sparql_parser.c" /* yacc.c:1646 */ break; case 101: #line 1882 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.integer) = 0; } #line 5261 "sparql_parser.c" /* yacc.c:1646 */ break; case 102: #line 1890 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CREATE (SILENT) can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CREATE, (yyvsp[0].uri) /* graph uri */, NULL /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-1].integer) /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("CreateQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("CreateQuery: rasqal_query_add_update_operation failed"); } } #line 5292 "sparql_parser.c" /* yacc.c:1646 */ break; case 103: #line 1917 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CREATE (SILENT) GRAPH can only be used with a SPARQL 1.1 Update"); YYERROR; } /* Early draft syntax - deprecated */ sparql_syntax_warning(rq, "CREATE (SILENT) GRAPH is replaced by CREATE (SILENT) in later SPARQL 1.1 drafts"); update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CREATE, (yyvsp[0].uri) /* graph uri */, NULL /* document uri */, NULL, NULL, NULL /*where */, RASQAL_UPDATE_FLAGS_SILENT /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("CreateQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("CreateQuery: rasqal_query_add_update_operation failed"); } } #line 5327 "sparql_parser.c" /* yacc.c:1646 */ break; case 104: #line 1952 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DROP (SILENT) DEFAULT | NAMED | ALL can only be used with a SPARQL 1.1 Update"); YYERROR; } if((yyvsp[0].uri_applies)) { update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_DROP, (yyvsp[0].uri_applies)->uri ? raptor_uri_copy((yyvsp[0].uri_applies)->uri) : NULL /* graph uri or NULL */, NULL /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-1].integer) /* flags */, (yyvsp[0].uri_applies)->applies /* applies */); free_uri_applies((yyvsp[0].uri_applies)); (yyvsp[0].uri_applies) = NULL; if(!update) { YYERROR_MSG("DropQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("DropQuery: rasqal_query_add_update_operation failed"); } } } #line 5363 "sparql_parser.c" /* yacc.c:1646 */ break; case 105: #line 1988 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].uri))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("IriRefList 1: sequence push failed"); } } #line 5376 "sparql_parser.c" /* yacc.c:1646 */ break; case 106: #line 1997 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)raptor_free_uri, (raptor_data_print_handler)raptor_uri_print); if(!(yyval.seq)) { if((yyvsp[0].uri)) raptor_free_uri((yyvsp[0].uri)); YYERROR_MSG("IriRefList 2: cannot create sequence"); } if(raptor_sequence_push((yyval.seq), (yyvsp[0].uri))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("IriRefList 2: sequence push failed"); } } #line 5395 "sparql_parser.c" /* yacc.c:1646 */ break; case 107: #line 2016 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri) = NULL; } #line 5403 "sparql_parser.c" /* yacc.c:1646 */ break; case 108: #line 2020 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri) = (yyvsp[0].uri); } #line 5411 "sparql_parser.c" /* yacc.c:1646 */ break; case 109: #line 2027 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.uri) = (yyvsp[0].uri); } #line 5419 "sparql_parser.c" /* yacc.c:1646 */ break; case 110: #line 2031 "./sparql_parser.y" /* yacc.c:1646 */ { /* Early draft syntax allowed a list of URIs - deprecated */ sparql_syntax_warning(rq, "LOAD INTO is replaced by LOAD INTO GRAPH in later SPARQL 1.1 drafts"); (yyval.uri) = (yyvsp[0].uri); } #line 5431 "sparql_parser.c" /* yacc.c:1646 */ break; case 111: #line 2039 "./sparql_parser.y" /* yacc.c:1646 */ { /* Early draft syntax allowed a list of URIs - deprecated */ sparql_syntax_warning(rq, "LOAD INTO DEFAULT is replaced by LOAD in later SPARQL 1.1 drafts"); (yyval.uri) = NULL; } #line 5443 "sparql_parser.c" /* yacc.c:1646 */ break; case 112: #line 2051 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "LOAD can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_LOAD, NULL /* graph uri */, (yyvsp[0].uri) /* document uri */, NULL, NULL, NULL /* where */, (yyvsp[-1].integer) /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("LoadQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("LoadQuery: rasqal_query_add_update_operation failed"); } } #line 5474 "sparql_parser.c" /* yacc.c:1646 */ break; case 113: #line 2078 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; int i; raptor_uri* doc_uri; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "LOAD INTO GRAPH / DEFAULT can only be used with a SPARQL 1.1 Update"); YYERROR; } for(i = 0; (doc_uri = (raptor_uri*)raptor_sequence_get_at((yyvsp[-2].seq), i)); i++) { rasqal_update_operation* update; update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_LOAD, (yyvsp[0].uri) ? raptor_uri_copy((yyvsp[0].uri)) : NULL /* graph uri */, raptor_uri_copy(doc_uri) /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-3].integer) /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("LoadQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("LoadQuery: rasqal_query_add_update_operation failed"); } if(i == 1) /* Early draft syntax allowed a list of URIs - deprecated */ sparql_syntax_warning(rq, "LOAD INTO / DEFAULT is replaced by LOAD INTO GRAPH or LOAD in later SPARQL 1.1 drafts"); } raptor_free_sequence((yyvsp[-2].seq)); if((yyvsp[0].uri)) raptor_free_uri((yyvsp[0].uri)); } #line 5520 "sparql_parser.c" /* yacc.c:1646 */ break; case 114: #line 2124 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "ADD (SILENT) TO can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_ADD, (yyvsp[-2].uri) /* graph uri or NULL */, (yyvsp[0].uri) /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-3].integer) /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("AddQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("AddQuery: rasqal_query_add_update_operation failed"); } } #line 5551 "sparql_parser.c" /* yacc.c:1646 */ break; case 115: #line 2155 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "MOVE (SILENT) TO can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_MOVE, (yyvsp[-2].uri) /* graph uri or NULL */, (yyvsp[0].uri) /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-3].integer) /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("MoveQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("MoveQuery: rasqal_query_add_update_operation failed"); } } #line 5582 "sparql_parser.c" /* yacc.c:1646 */ break; case 116: #line 2186 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "COPY (SILENT) TO can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_COPY, (yyvsp[-2].uri) /* graph uri or NULL */, (yyvsp[0].uri) /* document uri */, NULL, NULL, NULL /*where */, (yyvsp[-3].integer) /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("CopyQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("CopyQuery: rasqal_query_add_update_operation failed"); } } #line 5613 "sparql_parser.c" /* yacc.c:1646 */ break; case 117: #line 2217 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[-1].seq) && (yyvsp[0].data_graph)) raptor_sequence_push((yyvsp[-1].seq), (yyvsp[0].data_graph)); } #line 5623 "sparql_parser.c" /* yacc.c:1646 */ break; case 118: #line 2223 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, (raptor_data_print_handler)rasqal_data_graph_print); if((yyval.seq) && (yyvsp[0].data_graph)) raptor_sequence_push((yyval.seq), (yyvsp[0].data_graph)); } #line 5633 "sparql_parser.c" /* yacc.c:1646 */ break; case 119: #line 2232 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 5641 "sparql_parser.c" /* yacc.c:1646 */ break; case 120: #line 2236 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 5649 "sparql_parser.c" /* yacc.c:1646 */ break; case 121: #line 2244 "./sparql_parser.y" /* yacc.c:1646 */ { if((yyvsp[0].literal)) { raptor_uri* uri = rasqal_literal_as_uri((yyvsp[0].literal)); rasqal_data_graph* dg; dg = rasqal_new_data_graph_from_uri(rq->world, uri, NULL, RASQAL_DATA_GRAPH_BACKGROUND, NULL, NULL, NULL); if(!dg) { rasqal_free_literal((yyvsp[0].literal)); YYERROR_MSG("DefaultGraphClause: rasqal_query_new_data_graph_from_uri() failed"); } rasqal_free_literal((yyvsp[0].literal)); (yyval.data_graph) = dg; } else (yyval.data_graph) = NULL; } #line 5673 "sparql_parser.c" /* yacc.c:1646 */ break; case 122: #line 2268 "./sparql_parser.y" /* yacc.c:1646 */ { if((yyvsp[0].literal)) { raptor_uri* uri = rasqal_literal_as_uri((yyvsp[0].literal)); rasqal_data_graph* dg; dg = rasqal_new_data_graph_from_uri(rq->world, uri, uri, RASQAL_DATA_GRAPH_NAMED, NULL, NULL, NULL); if(!dg) { rasqal_free_literal((yyvsp[0].literal)); YYERROR_MSG("NamedGraphClause: rasqal_query_new_data_graph_from_uri() failed"); } rasqal_free_literal((yyvsp[0].literal)); (yyval.data_graph) = dg; } else (yyval.data_graph) = NULL; } #line 5696 "sparql_parser.c" /* yacc.c:1646 */ break; case 123: #line 2291 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 5704 "sparql_parser.c" /* yacc.c:1646 */ break; case 124: #line 2299 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 5712 "sparql_parser.c" /* yacc.c:1646 */ break; case 125: #line 2303 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 5720 "sparql_parser.c" /* yacc.c:1646 */ break; case 126: #line 2311 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 5728 "sparql_parser.c" /* yacc.c:1646 */ break; case 127: #line 2315 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = NULL; } #line 5736 "sparql_parser.c" /* yacc.c:1646 */ break; case 128: #line 2323 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.modifier) = rasqal_new_solution_modifier(rq, /* order_conditions */ (yyvsp[-1].seq), /* group_conditions */ (yyvsp[-3].seq), /* having_conditions */ (yyvsp[-2].seq), /* limit */ (yyvsp[0].limit_offset)[0], /* offset */ (yyvsp[0].limit_offset)[1]); } #line 5750 "sparql_parser.c" /* yacc.c:1646 */ break; case 129: #line 2337 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("GroupConditionList 1: sequence push failed"); } } #line 5764 "sparql_parser.c" /* yacc.c:1646 */ break; case 130: #line 2347 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyval.seq)) { if((yyvsp[0].expr)) rasqal_free_expression((yyvsp[0].expr)); YYERROR_MSG("GroupConditionList 2: cannot create sequence"); } if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("GroupConditionList 2: sequence push failed"); } } #line 5784 "sparql_parser.c" /* yacc.c:1646 */ break; case 131: #line 2367 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); } #line 5792 "sparql_parser.c" /* yacc.c:1646 */ break; case 132: #line 2371 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = NULL; } #line 5800 "sparql_parser.c" /* yacc.c:1646 */ break; case 133: #line 2379 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 5808 "sparql_parser.c" /* yacc.c:1646 */ break; case 134: #line 2383 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 5816 "sparql_parser.c" /* yacc.c:1646 */ break; case 135: #line 2387 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_literal* l; (yyval.expr) = (yyvsp[-2].expr); if((yyvsp[-1].variable)) { if(rasqal_expression_mentions_variable((yyval.expr), (yyvsp[-1].variable))) { sparql_query_error_full(rq, "Expression in GROUP BY ( expression ) AS %s contains the variable name '%s'", (yyvsp[-1].variable)->name, (yyvsp[-1].variable)->name); } else { /* Expression AS Variable */ (yyvsp[-1].variable)->expression = (yyval.expr); (yyval.expr) = NULL; l = rasqal_new_variable_literal(rq->world, (yyvsp[-1].variable)); if(!l) YYERROR_MSG("GroupCondition 4: cannot create variable literal"); (yyvsp[-1].variable) = NULL; (yyval.expr) = rasqal_new_literal_expression(rq->world, l); if(!(yyval.expr)) YYERROR_MSG("GroupCondition 4: cannot create variable literal expression"); } } } #line 5847 "sparql_parser.c" /* yacc.c:1646 */ break; case 136: #line 2414 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_literal* l; l = rasqal_new_variable_literal(rq->world, (yyvsp[0].variable)); if(!l) YYERROR_MSG("GroupCondition 5: cannot create lit"); (yyval.expr) = rasqal_new_literal_expression(rq->world, l); if(!(yyval.expr)) YYERROR_MSG("GroupCondition 5: cannot create lit expr"); } #line 5861 "sparql_parser.c" /* yacc.c:1646 */ break; case 137: #line 2428 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.seq) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "GROUP BY can only be used with SPARQL 1.1"); YYERROR; } else (yyval.seq) = (yyvsp[0].seq); } #line 5878 "sparql_parser.c" /* yacc.c:1646 */ break; case 138: #line 2441 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 5886 "sparql_parser.c" /* yacc.c:1646 */ break; case 139: #line 2449 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 5894 "sparql_parser.c" /* yacc.c:1646 */ break; case 140: #line 2456 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("HavingConditionList 1: sequence push failed"); } } #line 5908 "sparql_parser.c" /* yacc.c:1646 */ break; case 141: #line 2466 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyval.seq)) { if((yyvsp[0].expr)) rasqal_free_expression((yyvsp[0].expr)); YYERROR_MSG("HavingConditionList 2: cannot create sequence"); } if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("HavingConditionList 2: sequence push failed"); } } #line 5928 "sparql_parser.c" /* yacc.c:1646 */ break; case 142: #line 2486 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.seq) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "HAVING can only be used with SPARQL 1.1"); YYERROR; } else (yyval.seq) = (yyvsp[0].seq); } #line 5945 "sparql_parser.c" /* yacc.c:1646 */ break; case 143: #line 2499 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 5953 "sparql_parser.c" /* yacc.c:1646 */ break; case 144: #line 2507 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.limit_offset)[0] = (yyvsp[-1].integer); (yyval.limit_offset)[1] = (yyvsp[0].integer); } #line 5962 "sparql_parser.c" /* yacc.c:1646 */ break; case 145: #line 2512 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.limit_offset)[0] = (yyvsp[0].integer); (yyval.limit_offset)[1] = (yyvsp[-1].integer); } #line 5971 "sparql_parser.c" /* yacc.c:1646 */ break; case 146: #line 2517 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.limit_offset)[0] = (yyvsp[0].integer); (yyval.limit_offset)[1] = -1; } #line 5980 "sparql_parser.c" /* yacc.c:1646 */ break; case 147: #line 2522 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.limit_offset)[0] = -1; (yyval.limit_offset)[1] = (yyvsp[0].integer); } #line 5989 "sparql_parser.c" /* yacc.c:1646 */ break; case 148: #line 2527 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.limit_offset)[0] = -1; (yyval.limit_offset)[1] = -1; } #line 5998 "sparql_parser.c" /* yacc.c:1646 */ break; case 149: #line 2536 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 6006 "sparql_parser.c" /* yacc.c:1646 */ break; case 150: #line 2540 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 6014 "sparql_parser.c" /* yacc.c:1646 */ break; case 151: #line 2548 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("OrderConditionList 1: sequence push failed"); } } #line 6028 "sparql_parser.c" /* yacc.c:1646 */ break; case 152: #line 2558 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyval.seq)) { if((yyvsp[0].expr)) rasqal_free_expression((yyvsp[0].expr)); YYERROR_MSG("OrderConditionList 2: cannot create sequence"); } if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("OrderConditionList 2: sequence push failed"); } } #line 6048 "sparql_parser.c" /* yacc.c:1646 */ break; case 153: #line 2578 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("OrderCondition 1: cannot create expr"); } #line 6059 "sparql_parser.c" /* yacc.c:1646 */ break; case 154: #line 2585 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_DESC, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("OrderCondition 2: cannot create expr"); } #line 6070 "sparql_parser.c" /* yacc.c:1646 */ break; case 155: #line 2592 "./sparql_parser.y" /* yacc.c:1646 */ { /* The direction of ordering is ascending by default */ (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("OrderCondition 3: cannot create expr"); } #line 6082 "sparql_parser.c" /* yacc.c:1646 */ break; case 156: #line 2600 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_literal* l; rasqal_expression *e; l = rasqal_new_variable_literal(rq->world, (yyvsp[0].variable)); if(!l) YYERROR_MSG("OrderCondition 4: cannot create lit"); e = rasqal_new_literal_expression(rq->world, l); if(!e) YYERROR_MSG("OrderCondition 4: cannot create lit expr"); /* The direction of ordering is ascending by default */ (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, e); if(!(yyval.expr)) YYERROR_MSG("OrderCondition 1: cannot create expr"); } #line 6103 "sparql_parser.c" /* yacc.c:1646 */ break; case 157: #line 2617 "./sparql_parser.y" /* yacc.c:1646 */ { /* The direction of ordering is ascending by default */ (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("OrderCondition 5: cannot create expr"); } #line 6115 "sparql_parser.c" /* yacc.c:1646 */ break; case 158: #line 2625 "./sparql_parser.y" /* yacc.c:1646 */ { /* The direction of ordering is ascending by default */ (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("OrderCondition 6: cannot create expr"); } #line 6127 "sparql_parser.c" /* yacc.c:1646 */ break; case 159: #line 2637 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.integer) = -1; if((yyvsp[0].literal) != NULL) { (yyval.integer) = (yyvsp[0].literal)->value.integer; rasqal_free_literal((yyvsp[0].literal)); } } #line 6141 "sparql_parser.c" /* yacc.c:1646 */ break; case 160: #line 2651 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.integer) = -1; if((yyvsp[0].literal) != NULL) { (yyval.integer) = (yyvsp[0].literal)->value.integer; rasqal_free_literal((yyvsp[0].literal)); } } #line 6154 "sparql_parser.c" /* yacc.c:1646 */ break; case 161: #line 2664 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.bindings) = (yyvsp[0].bindings); } #line 6162 "sparql_parser.c" /* yacc.c:1646 */ break; case 162: #line 2668 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.bindings) = NULL; } #line 6170 "sparql_parser.c" /* yacc.c:1646 */ break; case 163: #line 2676 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 6178 "sparql_parser.c" /* yacc.c:1646 */ break; case 164: #line 2680 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 6186 "sparql_parser.c" /* yacc.c:1646 */ break; case 165: #line 2687 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].variable))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("VarList 1: sequence push failed"); } } #line 6199 "sparql_parser.c" /* yacc.c:1646 */ break; case 166: #line 2696 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!(yyval.seq)) YYERROR_MSG("VarList 2: cannot create seq"); if(raptor_sequence_push((yyval.seq), (yyvsp[0].variable))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("VarList 3: sequence push failed"); } } #line 6216 "sparql_parser.c" /* yacc.c:1646 */ break; case 167: #line 2715 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 6224 "sparql_parser.c" /* yacc.c:1646 */ break; case 168: #line 2719 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 6232 "sparql_parser.c" /* yacc.c:1646 */ break; case 169: #line 2729 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].row))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("DataBlockRowList 1: sequence push failed"); } else { int size = raptor_sequence_size((yyval.seq)); (yyvsp[0].row)->offset = size-1; } } #line 6248 "sparql_parser.c" /* yacc.c:1646 */ break; case 170: #line 2741 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!(yyval.seq)) { if((yyvsp[0].row)) rasqal_free_row((yyvsp[0].row)); YYERROR_MSG("DataBlockRowList 2: cannot create sequence"); } if(raptor_sequence_push((yyval.seq), (yyvsp[0].row))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("DataBlockRowList 2: sequence push failed"); } } #line 6268 "sparql_parser.c" /* yacc.c:1646 */ break; case 171: #line 2763 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.row) = NULL; if((yyvsp[-1].seq)) { int size; rasqal_row* row; int i; size = raptor_sequence_size((yyvsp[-1].seq)); row = rasqal_new_row_for_size(rq->world, size); if(!row) { YYERROR_MSG("DataBlockRow: cannot create row"); } else { for(i = 0; i < size; i++) { rasqal_literal* value = (rasqal_literal*)raptor_sequence_get_at((yyvsp[-1].seq), i); rasqal_row_set_value_at(row, i, value); } } raptor_free_sequence((yyvsp[-1].seq)); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("DataBlockRow returned: "); rasqal_row_print(row, stderr); fputc('\n', stderr); #endif (yyval.row) = row; } } #line 6300 "sparql_parser.c" /* yacc.c:1646 */ break; case 172: #line 2791 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.row) = NULL; } #line 6308 "sparql_parser.c" /* yacc.c:1646 */ break; case 173: #line 2798 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("DataBlockValue 1 value: "); rasqal_literal_print((yyvsp[0].literal), stderr); fputc('\n', stderr); #endif (yyval.seq) = (yyvsp[-1].seq); if(raptor_sequence_push((yyval.seq), (yyvsp[0].literal))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("IriRefList 1: sequence push failed"); } } #line 6326 "sparql_parser.c" /* yacc.c:1646 */ break; case 174: #line 2812 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("DataBlockValue 2 value: "); rasqal_literal_print((yyvsp[0].literal), stderr); fputc('\n', stderr); #endif (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); if(!(yyval.seq)) { if((yyvsp[0].literal)) rasqal_free_literal((yyvsp[0].literal)); YYERROR_MSG("IriRefList 2: cannot create sequence"); } if(raptor_sequence_push((yyval.seq), (yyvsp[0].literal))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("IriRefList 2: sequence push failed"); } } #line 6350 "sparql_parser.c" /* yacc.c:1646 */ break; case 175: #line 2835 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_string_literal(rq->world, (yyvsp[0].name), NULL /* language */, NULL /* dt uri */, NULL /* dt_qname */); } #line 6360 "sparql_parser.c" /* yacc.c:1646 */ break; case 176: #line 2841 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_string_literal(rq->world, (yyvsp[-1].name), RASQAL_GOOD_CAST(const char*, (yyvsp[0].name)), NULL /* dt uri */, NULL /* dt_qname */); } #line 6370 "sparql_parser.c" /* yacc.c:1646 */ break; case 177: #line 2847 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_uri* dt_uri = raptor_uri_copy(rasqal_literal_as_uri((yyvsp[0].literal))); (yyval.literal) = rasqal_new_string_literal(rq->world, (yyvsp[-2].name), NULL /* language */, dt_uri, NULL /* dt_qname */); rasqal_free_literal((yyvsp[0].literal)); } #line 6382 "sparql_parser.c" /* yacc.c:1646 */ break; case 178: #line 2855 "./sparql_parser.y" /* yacc.c:1646 */ { if((yyvsp[-2].literal)) { raptor_uri* dt_uri = raptor_uri_copy(rasqal_literal_as_uri((yyvsp[0].literal))); const unsigned char *str = (yyvsp[-2].literal)->string; (yyvsp[-2].literal)->string = NULL; (yyval.literal) = rasqal_new_string_literal(rq->world, str, NULL /* language */, dt_uri, NULL /* dt_qname */); } rasqal_free_literal((yyvsp[0].literal)); rasqal_free_literal((yyvsp[-2].literal)); } #line 6400 "sparql_parser.c" /* yacc.c:1646 */ break; case 179: #line 2873 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 6408 "sparql_parser.c" /* yacc.c:1646 */ break; case 180: #line 2877 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 6416 "sparql_parser.c" /* yacc.c:1646 */ break; case 181: #line 2881 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 6424 "sparql_parser.c" /* yacc.c:1646 */ break; case 182: #line 2885 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 6432 "sparql_parser.c" /* yacc.c:1646 */ break; case 183: #line 2889 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = NULL; } #line 6440 "sparql_parser.c" /* yacc.c:1646 */ break; case 184: #line 2901 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[-1].graph_pattern); } #line 6448 "sparql_parser.c" /* yacc.c:1646 */ break; case 185: #line 2905 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[-1].graph_pattern); } #line 6456 "sparql_parser.c" /* yacc.c:1646 */ break; case 186: #line 2916 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_graph_pattern *formula_gp = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GroupGraphPattern\n TriplesBlockOpt="); if((yyvsp[0].graph_pattern)) rasqal_formula_print((yyvsp[-1].formula), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", GraphpatternListOpt="); if((yyvsp[0].graph_pattern)) rasqal_graph_pattern_print((yyvsp[0].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(!(yyvsp[-1].formula) && !(yyvsp[0].graph_pattern)) { (yyval.graph_pattern) = rasqal_new_2_group_graph_pattern(rq, NULL, NULL); if(!(yyval.graph_pattern)) YYERROR_MSG("GroupGraphPattern: cannot create group gp"); } else { if((yyvsp[-1].formula)) { formula_gp = rasqal_new_basic_graph_pattern_from_formula(rq, (yyvsp[-1].formula)); if(!formula_gp) { if((yyvsp[0].graph_pattern)) rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); YYERROR_MSG("GroupGraphPattern: cannot create formula_gp"); } } if((yyvsp[0].graph_pattern)) { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); if(formula_gp && raptor_sequence_shift((yyval.graph_pattern)->graph_patterns, formula_gp)) { rasqal_free_graph_pattern((yyval.graph_pattern)); (yyval.graph_pattern) = NULL; YYERROR_MSG("GroupGraphPattern: sequence push failed"); } } else (yyval.graph_pattern) = formula_gp; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after graph pattern="); if((yyval.graph_pattern)) rasqal_graph_pattern_print((yyval.graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 6514 "sparql_parser.c" /* yacc.c:1646 */ break; case 187: #line 2974 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesBlockOpt 1\n TriplesBlock="); if((yyvsp[0].formula)) rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif (yyval.formula) = (yyvsp[0].formula); } #line 6531 "sparql_parser.c" /* yacc.c:1646 */ break; case 188: #line 2987 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = NULL; } #line 6539 "sparql_parser.c" /* yacc.c:1646 */ break; case 189: #line 3000 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternListOpt\n GraphPatternListOpt="); if((yyvsp[-1].graph_pattern)) rasqal_graph_pattern_print((yyvsp[-1].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", GraphPatternList="); if((yyvsp[0].graph_pattern)) rasqal_graph_pattern_print((yyvsp[0].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif (yyval.graph_pattern) = ((yyvsp[-1].graph_pattern) ? (yyvsp[-1].graph_pattern) : (yyvsp[0].graph_pattern)); if((yyvsp[-1].graph_pattern) && (yyvsp[0].graph_pattern)) { (yyval.graph_pattern) = (yyvsp[-1].graph_pattern); if(rasqal_graph_patterns_join((yyval.graph_pattern), (yyvsp[0].graph_pattern))) { rasqal_free_graph_pattern((yyval.graph_pattern)); rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); (yyval.graph_pattern) = NULL; YYERROR_MSG("GraphPatternListOpt: sequence join failed"); } rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after grouping graph pattern="); if((yyval.graph_pattern)) rasqal_graph_pattern_print((yyval.graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 6580 "sparql_parser.c" /* yacc.c:1646 */ break; case 190: #line 3037 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6588 "sparql_parser.c" /* yacc.c:1646 */ break; case 191: #line 3041 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = NULL; } #line 6596 "sparql_parser.c" /* yacc.c:1646 */ break; case 192: #line 3054 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_graph_pattern *formula_gp = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternList\n GraphPatternListFilter="); if((yyvsp[-2].graph_pattern)) rasqal_graph_pattern_print((yyvsp[-2].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", TriplesBlockOpt="); if((yyvsp[0].formula)) rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif if((yyvsp[0].formula)) { formula_gp = rasqal_new_basic_graph_pattern_from_formula(rq, (yyvsp[0].formula)); if(!formula_gp) { if((yyvsp[-2].graph_pattern)) rasqal_free_graph_pattern((yyvsp[-2].graph_pattern)); YYERROR_MSG("GraphPatternList: cannot create formula_gp"); } } (yyval.graph_pattern) = rasqal_new_2_group_graph_pattern(rq, (yyvsp[-2].graph_pattern), formula_gp); if(!(yyval.graph_pattern)) YYERROR_MSG("GraphPatternList: cannot create sequence"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after graph pattern="); if((yyval.graph_pattern)) rasqal_graph_pattern_print((yyval.graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 6640 "sparql_parser.c" /* yacc.c:1646 */ break; case 193: #line 3102 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternListFilter 1\n GraphPatternNotTriples="); if((yyvsp[0].graph_pattern)) rasqal_graph_pattern_print((yyvsp[0].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6657 "sparql_parser.c" /* yacc.c:1646 */ break; case 194: #line 3115 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternListFilter 2\n Filter="); if((yyvsp[0].expr)) rasqal_expression_print((yyvsp[0].expr), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif (yyval.graph_pattern) = rasqal_new_filter_graph_pattern(rq, (yyvsp[0].expr)); if(!(yyval.graph_pattern)) YYERROR_MSG("GraphPatternListFilter 2: cannot create graph pattern"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after graph pattern="); if((yyval.graph_pattern)) rasqal_graph_pattern_print((yyval.graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 6685 "sparql_parser.c" /* yacc.c:1646 */ break; case 197: #line 3149 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesBlock\n TriplesSameSubject="); if((yyvsp[-2].formula)) rasqal_formula_print((yyvsp[-2].formula), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", TriplesBlockOpt="); if((yyvsp[0].formula)) rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif (yyval.formula) = ((yyvsp[-2].formula) ? (yyvsp[-2].formula) : (yyvsp[0].formula)); if((yyvsp[-2].formula) && (yyvsp[0].formula)) { /* $1 and $3 are freed as necessary */ (yyval.formula) = rasqal_formula_join((yyvsp[-2].formula), (yyvsp[0].formula)); if(!(yyvsp[-2].formula)) YYERROR_MSG("TriplesBlock: formula join failed"); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after joining formula="); rasqal_formula_print((yyval.formula), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 6720 "sparql_parser.c" /* yacc.c:1646 */ break; case 198: #line 3180 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 6728 "sparql_parser.c" /* yacc.c:1646 */ break; case 199: #line 3188 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6736 "sparql_parser.c" /* yacc.c:1646 */ break; case 200: #line 3192 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6744 "sparql_parser.c" /* yacc.c:1646 */ break; case 201: #line 3196 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6752 "sparql_parser.c" /* yacc.c:1646 */ break; case 202: #line 3200 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6760 "sparql_parser.c" /* yacc.c:1646 */ break; case 203: #line 3204 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6768 "sparql_parser.c" /* yacc.c:1646 */ break; case 204: #line 3208 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6776 "sparql_parser.c" /* yacc.c:1646 */ break; case 205: #line 3212 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6784 "sparql_parser.c" /* yacc.c:1646 */ break; case 206: #line 3216 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 6792 "sparql_parser.c" /* yacc.c:1646 */ break; case 207: #line 3224 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "PatternElementForms 4\n graphpattern="); if((yyvsp[0].graph_pattern)) rasqal_graph_pattern_print((yyvsp[0].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif (yyval.graph_pattern) = NULL; if((yyvsp[0].graph_pattern)) { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); YYERROR_MSG("OptionalGraphPattern 1: cannot create sequence"); } else { if(raptor_sequence_push(seq, (yyvsp[0].graph_pattern))) { raptor_free_sequence(seq); YYERROR_MSG("OptionalGraphPattern 2: sequence push failed"); } else { (yyval.graph_pattern) = rasqal_new_graph_pattern_from_sequence(rq, seq, RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL); if(!(yyval.graph_pattern)) YYERROR_MSG("OptionalGraphPattern: cannot create graph pattern"); } } } } #line 6831 "sparql_parser.c" /* yacc.c:1646 */ break; case 208: #line 3263 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphGraphPattern 2\n varoruri="); rasqal_literal_print((yyvsp[-1].literal), DEBUG_FH); fprintf(DEBUG_FH, ", graphpattern="); if((yyvsp[0].graph_pattern)) rasqal_graph_pattern_print((yyvsp[0].graph_pattern), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif if((yyvsp[0].graph_pattern)) { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); YYERROR_MSG("GraphGraphPattern 1: cannot create sequence"); } else { if(raptor_sequence_push(seq, (yyvsp[0].graph_pattern))) { raptor_free_sequence(seq); YYERROR_MSG("GraphGraphPattern 2: sequence push failed"); } else { (yyval.graph_pattern) = rasqal_new_graph_pattern_from_sequence(rq, seq, RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH); if(!(yyval.graph_pattern)) YYERROR_MSG("GraphGraphPattern: cannot create graph pattern"); else rasqal_graph_pattern_set_origin((yyval.graph_pattern), (yyvsp[-1].literal)); } } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphGraphPattern\n graphpattern="); rasqal_graph_pattern_print((yyval.graph_pattern), DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif rasqal_free_literal((yyvsp[-1].literal)); } #line 6881 "sparql_parser.c" /* yacc.c:1646 */ break; case 209: #line 3313 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = rasqal_new_single_graph_pattern(rq, RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE, (yyvsp[0].graph_pattern)); if((yyval.graph_pattern)) { (yyval.graph_pattern)->silent = ((yyvsp[-2].integer) & RASQAL_UPDATE_FLAGS_SILENT) ? 1 : 0; (yyval.graph_pattern)->origin = (yyvsp[-1].literal); (yyvsp[-1].literal) = NULL; } else if((yyvsp[-1].literal)) rasqal_free_literal((yyvsp[-1].literal)); } #line 6898 "sparql_parser.c" /* yacc.c:1646 */ break; case 210: #line 3330 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.graph_pattern) = NULL; if((yyvsp[-3].expr) && (yyvsp[-1].variable)) { if(!sparql->sparql11_query) { sparql_syntax_error(rq, "BIND can only be used with SPARQL 1.1"); YYERROR; } else { (yyval.graph_pattern) = rasqal_new_let_graph_pattern(rq, (yyvsp[-1].variable), (yyvsp[-3].expr)); } } else (yyval.graph_pattern) = NULL; } #line 6919 "sparql_parser.c" /* yacc.c:1646 */ break; case 211: #line 3351 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.bindings) = (yyvsp[0].bindings); } #line 6927 "sparql_parser.c" /* yacc.c:1646 */ break; case 212: #line 3358 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.bindings) = (yyvsp[0].bindings); } #line 6935 "sparql_parser.c" /* yacc.c:1646 */ break; case 213: #line 3362 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.bindings) = (yyvsp[0].bindings); } #line 6943 "sparql_parser.c" /* yacc.c:1646 */ break; case 214: #line 3370 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.bindings) = rasqal_new_bindings_from_var_values(rq, (yyvsp[-3].variable), (yyvsp[-1].seq)); } #line 6951 "sparql_parser.c" /* yacc.c:1646 */ break; case 215: #line 3379 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 6959 "sparql_parser.c" /* yacc.c:1646 */ break; case 216: #line 3383 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 6967 "sparql_parser.c" /* yacc.c:1646 */ break; case 217: #line 3399 "./sparql_parser.y" /* yacc.c:1646 */ { if((yyvsp[-4].seq)) { (yyval.bindings) = rasqal_new_bindings(rq, (yyvsp[-4].seq), (yyvsp[-1].seq)); if(!(yyval.bindings)) YYERROR_MSG("InlineDataFull: cannot create bindings"); } else { if((yyvsp[-1].seq)) raptor_free_sequence((yyvsp[-1].seq)); (yyval.bindings) = NULL; } } #line 6984 "sparql_parser.c" /* yacc.c:1646 */ break; case 218: #line 3415 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = rasqal_new_values_graph_pattern(rq, (yyvsp[0].bindings)); if(!(yyval.graph_pattern)) YYERROR_MSG("InlineDataGraphPattern: cannot create gp"); } #line 6994 "sparql_parser.c" /* yacc.c:1646 */ break; case 219: #line 3425 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = rasqal_new_single_graph_pattern(rq, RASQAL_GRAPH_PATTERN_OPERATOR_MINUS, (yyvsp[0].graph_pattern)); } #line 7004 "sparql_parser.c" /* yacc.c:1646 */ break; case 220: #line 3435 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); if(raptor_sequence_shift((yyval.graph_pattern)->graph_patterns, (yyvsp[-2].graph_pattern))) { rasqal_free_graph_pattern((yyval.graph_pattern)); (yyval.graph_pattern) = NULL; YYERROR_MSG("GroupOrUnionGraphPattern: sequence push failed"); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "UnionGraphPattern\n graphpattern="); rasqal_graph_pattern_print((yyval.graph_pattern), DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif } #line 7023 "sparql_parser.c" /* yacc.c:1646 */ break; case 221: #line 3450 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[0].graph_pattern); } #line 7031 "sparql_parser.c" /* yacc.c:1646 */ break; case 222: #line 3457 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.graph_pattern) = (yyvsp[-2].graph_pattern); if((yyvsp[0].graph_pattern)) if(raptor_sequence_push((yyval.graph_pattern)->graph_patterns, (yyvsp[0].graph_pattern))) { rasqal_free_graph_pattern((yyval.graph_pattern)); (yyval.graph_pattern) = NULL; YYERROR_MSG("GroupOrUnionGraphPatternList 1: sequence push failed"); } } #line 7045 "sparql_parser.c" /* yacc.c:1646 */ break; case 223: #line 3467 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { if((yyvsp[0].graph_pattern)) rasqal_free_graph_pattern((yyvsp[0].graph_pattern)); YYERROR_MSG("GroupOrUnionGraphPatternList 2: cannot create sequence"); } if((yyvsp[0].graph_pattern)) if(raptor_sequence_push(seq, (yyvsp[0].graph_pattern))) { raptor_free_sequence(seq); YYERROR_MSG("GroupOrUnionGraphPatternList 2: sequence push failed"); } (yyval.graph_pattern) = rasqal_new_graph_pattern_from_sequence(rq, seq, RASQAL_GRAPH_PATTERN_OPERATOR_UNION); if(!(yyval.graph_pattern)) YYERROR_MSG("GroupOrUnionGraphPatternList 1: cannot create gp"); } #line 7070 "sparql_parser.c" /* yacc.c:1646 */ break; case 224: #line 3492 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.graph_pattern) = NULL; if((yyvsp[-3].variable) && (yyvsp[-1].expr)) { if(sparql->experimental) (yyval.graph_pattern) = rasqal_new_let_graph_pattern(rq, (yyvsp[-3].variable), (yyvsp[-1].expr)); else { sparql_syntax_error(rq, "LET can only be used with LAQRS"); YYERROR; } } else (yyval.graph_pattern) = NULL; } #line 7091 "sparql_parser.c" /* yacc.c:1646 */ break; case 225: #line 3513 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 7099 "sparql_parser.c" /* yacc.c:1646 */ break; case 226: #line 3521 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 7107 "sparql_parser.c" /* yacc.c:1646 */ break; case 227: #line 3525 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 7115 "sparql_parser.c" /* yacc.c:1646 */ break; case 228: #line 3529 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 7123 "sparql_parser.c" /* yacc.c:1646 */ break; case 229: #line 3536 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 7131 "sparql_parser.c" /* yacc.c:1646 */ break; case 230: #line 3540 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 7139 "sparql_parser.c" /* yacc.c:1646 */ break; case 231: #line 3548 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_uri* uri = rasqal_literal_as_uri((yyvsp[-5].literal)); if(!(yyvsp[-2].seq)) { (yyvsp[-2].seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyvsp[-2].seq)) { rasqal_free_literal((yyvsp[-5].literal)); YYERROR_MSG("FunctionCall: cannot create sequence"); } } uri = raptor_uri_copy(uri); if(raptor_sequence_size((yyvsp[-2].seq)) == 1 && rasqal_xsd_is_datatype_uri(rq->world, uri)) { rasqal_expression* e = (rasqal_expression*)raptor_sequence_pop((yyvsp[-2].seq)); (yyval.expr) = rasqal_new_cast_expression(rq->world, uri, e); if((yyval.expr)) (yyval.expr)->flags |= (yyvsp[-3].uinteger); raptor_free_sequence((yyvsp[-2].seq)); } else { unsigned int flags = 0; if((yyvsp[-3].uinteger)) flags |= 1; (yyval.expr) = rasqal_new_function_expression(rq->world, uri, (yyvsp[-2].seq), (yyvsp[-1].seq) /* params */, flags); if((yyval.expr)) (yyval.expr)->flags |= (yyvsp[-3].uinteger); } rasqal_free_literal((yyvsp[-5].literal)); if(!(yyval.expr)) YYERROR_MSG("FunctionCall: cannot create expr"); } #line 7181 "sparql_parser.c" /* yacc.c:1646 */ break; case 232: #line 3587 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_uri* uri = rasqal_literal_as_uri((yyvsp[-2].literal)); if(!(yyvsp[-1].seq)) { (yyvsp[-1].seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyvsp[-1].seq)) { rasqal_free_literal((yyvsp[-2].literal)); YYERROR_MSG("FunctionCall: cannot create sequence"); } } uri = raptor_uri_copy(uri); if(raptor_sequence_size((yyvsp[-1].seq)) == 1 && rasqal_xsd_is_datatype_uri(rq->world, uri)) { rasqal_expression* e = (rasqal_expression*)raptor_sequence_pop((yyvsp[-1].seq)); (yyval.expr) = rasqal_new_cast_expression(rq->world, uri, e); raptor_free_sequence((yyvsp[-1].seq)); } else { (yyval.expr) = rasqal_new_function_expression(rq->world, uri, (yyvsp[-1].seq), NULL /* params */, 0 /* flags */); } rasqal_free_literal((yyvsp[-2].literal)); if(!(yyval.expr)) YYERROR_MSG("FunctionCall: cannot create expr"); } #line 7215 "sparql_parser.c" /* yacc.c:1646 */ break; case 233: #line 3621 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "COALESCE can only be used with SPARQL 1.1"); YYERROR; } if(!(yyvsp[0].seq)) { (yyvsp[0].seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyvsp[0].seq)) YYERROR_MSG("FunctionCall: cannot create sequence"); } (yyval.expr) = rasqal_new_expr_seq_expression(rq->world, RASQAL_EXPR_COALESCE, (yyvsp[0].seq)); if(!(yyval.expr)) YYERROR_MSG("Coalesce: cannot create expr"); } #line 7243 "sparql_parser.c" /* yacc.c:1646 */ break; case 234: #line 3649 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); } #line 7251 "sparql_parser.c" /* yacc.c:1646 */ break; case 235: #line 3656 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-2].seq); if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("ArgListNoBraces 1: sequence push failed"); } } #line 7265 "sparql_parser.c" /* yacc.c:1646 */ break; case 236: #line 3666 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!(yyval.seq)) { if((yyvsp[0].expr)) rasqal_free_expression((yyvsp[0].expr)); YYERROR_MSG("ArgListNoBraces 2: cannot create sequence"); } if((yyvsp[0].expr)) if(raptor_sequence_push((yyval.seq), (yyvsp[0].expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("ArgListNoBraces 2: sequence push failed"); } } #line 7285 "sparql_parser.c" /* yacc.c:1646 */ break; case 237: #line 3682 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); } #line 7294 "sparql_parser.c" /* yacc.c:1646 */ break; case 238: #line 3691 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); } #line 7302 "sparql_parser.c" /* yacc.c:1646 */ break; case 239: #line 3699 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 7310 "sparql_parser.c" /* yacc.c:1646 */ break; case 240: #line 3703 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!(yyval.seq)) { YYERROR_MSG("ConstructTriplesOpt: cannot create sequence"); } } #line 7322 "sparql_parser.c" /* yacc.c:1646 */ break; case 241: #line 3715 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; if((yyvsp[-2].formula)) { (yyval.seq) = (yyvsp[-2].formula)->triples; (yyvsp[-2].formula)->triples = NULL; rasqal_free_formula((yyvsp[-2].formula)); } if((yyvsp[0].seq)) { if(!(yyval.seq)) { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!(yyval.seq)) { raptor_free_sequence((yyvsp[0].seq)); YYERROR_MSG("ConstructTriples: cannot create sequence"); } } if(raptor_sequence_join((yyval.seq), (yyvsp[0].seq))) { raptor_free_sequence((yyvsp[0].seq)); raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("ConstructTriples: sequence join failed"); } raptor_free_sequence((yyvsp[0].seq)); } } #line 7356 "sparql_parser.c" /* yacc.c:1646 */ break; case 242: #line 3745 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; if((yyvsp[0].formula)) { (yyval.seq) = (yyvsp[0].formula)->triples; (yyvsp[0].formula)->triples = NULL; rasqal_free_formula((yyvsp[0].formula)); } } #line 7371 "sparql_parser.c" /* yacc.c:1646 */ break; case 243: #line 3760 "./sparql_parser.y" /* yacc.c:1646 */ { int i; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesSameSubject 1\n subject="); rasqal_formula_print((yyvsp[-1].formula), DEBUG_FH); if((yyvsp[0].formula)) { fprintf(DEBUG_FH, "\n propertyList="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, "\n and empty propertyList\n"); #endif if((yyvsp[0].formula)) { raptor_sequence *seq = (yyvsp[0].formula)->triples; rasqal_literal *subject = (yyvsp[-1].formula)->value; int size = raptor_sequence_size(seq); /* non-empty property list, handle it */ for(i = 0; i < size; i++) { rasqal_triple* t2 = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(t2->subject) continue; t2->subject = rasqal_new_literal_from_literal(subject); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution propertyList="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif } (yyval.formula) = rasqal_formula_join((yyvsp[-1].formula), (yyvsp[0].formula)); if(!(yyval.formula)) YYERROR_MSG("TriplesSameSubject 1: formula join failed"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after joining formula="); rasqal_formula_print((yyval.formula), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 7419 "sparql_parser.c" /* yacc.c:1646 */ break; case 244: #line 3804 "./sparql_parser.y" /* yacc.c:1646 */ { int i; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesSameSubject 2\n TriplesNode="); rasqal_formula_print((yyvsp[-1].formula), DEBUG_FH); if((yyvsp[0].formula)) { fprintf(DEBUG_FH, "\n propertyList="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, "\n and empty propertyList\n"); #endif if((yyvsp[0].formula)) { raptor_sequence *seq = (yyvsp[0].formula)->triples; rasqal_literal *subject = (yyvsp[-1].formula)->value; int size = raptor_sequence_size(seq); /* non-empty property list, handle it */ for(i = 0; i < size; i++) { rasqal_triple* t2 = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(t2->subject) continue; t2->subject = rasqal_new_literal_from_literal(subject); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution propertyList="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif } (yyval.formula) = rasqal_formula_join((yyvsp[-1].formula), (yyvsp[0].formula)); if(!(yyval.formula)) YYERROR_MSG("TriplesSameSubject 2: formula join failed"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after joining formula="); rasqal_formula_print((yyval.formula), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 7467 "sparql_parser.c" /* yacc.c:1646 */ break; case 245: #line 3852 "./sparql_parser.y" /* yacc.c:1646 */ { int i; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "PropertyList 1\n Verb="); rasqal_formula_print((yyvsp[-2].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n ObjectList="); rasqal_formula_print((yyvsp[-1].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n PropertyListTail="); if((yyvsp[0].formula) != NULL) rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif if((yyvsp[-1].formula) == NULL) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " empty ObjectList not processed\n"); #endif } else if((yyvsp[-2].formula) && (yyvsp[-1].formula)) { raptor_sequence *seq = (yyvsp[-1].formula)->triples; rasqal_literal *predicate = (yyvsp[-2].formula)->value; rasqal_formula *formula; rasqal_triple *t2; int size; formula = rasqal_new_formula(rq->world); if(!formula) { rasqal_free_formula((yyvsp[-2].formula)); rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("PropertyList 1: cannot create formula"); } formula->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!formula->triples) { rasqal_free_formula(formula); rasqal_free_formula((yyvsp[-2].formula)); rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("PropertyList 1: cannot create sequence"); } /* non-empty property list, handle it */ size = raptor_sequence_size(seq); for(i = 0; i < size; i++) { t2 = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(!t2->predicate) t2->predicate = (rasqal_literal*)rasqal_new_literal_from_literal(predicate); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution ObjectList="); raptor_sequence_print(seq, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif while(raptor_sequence_size(seq)) { t2 = (rasqal_triple*)raptor_sequence_unshift(seq); if(raptor_sequence_push(formula->triples, t2)) { rasqal_free_formula(formula); rasqal_free_formula((yyvsp[-2].formula)); rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("PropertyList 1: sequence push failed"); } } (yyvsp[0].formula) = rasqal_formula_join(formula, (yyvsp[0].formula)); if(!(yyvsp[0].formula)) { rasqal_free_formula((yyvsp[-2].formula)); rasqal_free_formula((yyvsp[-1].formula)); YYERROR_MSG("PropertyList 1: formula join failed"); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after appending ObjectList="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif rasqal_free_formula((yyvsp[-1].formula)); } if((yyvsp[-2].formula)) rasqal_free_formula((yyvsp[-2].formula)); (yyval.formula) = (yyvsp[0].formula); } #line 7565 "sparql_parser.c" /* yacc.c:1646 */ break; case 246: #line 3950 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 7573 "sparql_parser.c" /* yacc.c:1646 */ break; case 247: #line 3954 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = NULL; } #line 7581 "sparql_parser.c" /* yacc.c:1646 */ break; case 248: #line 3962 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 7589 "sparql_parser.c" /* yacc.c:1646 */ break; case 249: #line 3966 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = NULL; } #line 7597 "sparql_parser.c" /* yacc.c:1646 */ break; case 250: #line 3974 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_formula *formula; rasqal_triple *triple; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "ObjectList 1\n"); fprintf(DEBUG_FH, " Object=\n"); rasqal_formula_print((yyvsp[-1].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); if((yyvsp[0].formula)) { fprintf(DEBUG_FH, " ObjectTail="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty ObjectTail\n"); #endif formula = rasqal_new_formula(rq->world); if(!formula) { rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("ObjectList: cannot create formula"); } formula->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!formula->triples) { rasqal_free_formula(formula); rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("ObjectList: cannot create sequence"); } triple = rasqal_new_triple(NULL, NULL, (yyvsp[-1].formula)->value); (yyvsp[-1].formula)->value = NULL; /* value now owned by triple */ if(!triple) { rasqal_free_formula(formula); rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("ObjectList: cannot create triple"); } if(raptor_sequence_push(formula->triples, triple)) { rasqal_free_formula(formula); rasqal_free_formula((yyvsp[-1].formula)); if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("ObjectList: sequence push failed"); } (yyval.formula) = rasqal_formula_join(formula, (yyvsp[-1].formula)); if(!(yyval.formula)) { if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("ObjectList: formula join $1 failed"); } (yyval.formula) = rasqal_formula_join((yyval.formula), (yyvsp[0].formula)); if(!(yyval.formula)) YYERROR_MSG("ObjectList: formula join $2 failed"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " objectList is now "); if((yyval.formula)) raptor_sequence_print((yyval.formula)->triples, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 7675 "sparql_parser.c" /* yacc.c:1646 */ break; case 251: #line 4052 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 7683 "sparql_parser.c" /* yacc.c:1646 */ break; case 252: #line 4056 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = NULL; } #line 7691 "sparql_parser.c" /* yacc.c:1646 */ break; case 253: #line 4064 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 7699 "sparql_parser.c" /* yacc.c:1646 */ break; case 254: #line 4072 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = rasqal_new_formula(rq->world); if(!(yyval.formula)) { if((yyvsp[0].literal)) rasqal_free_literal((yyvsp[0].literal)); YYERROR_MSG("Verb 1: cannot create formula"); } (yyval.formula)->value = (yyvsp[0].literal); } #line 7713 "sparql_parser.c" /* yacc.c:1646 */ break; case 255: #line 4082 "./sparql_parser.y" /* yacc.c:1646 */ { raptor_uri *uri; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "verb Verb=rdf:type (a)\n"); #endif uri = raptor_new_uri_for_rdf_concept(rq->world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, "type")); if(!uri) YYERROR_MSG("Verb 2: uri for rdf concept type failed"); (yyval.formula) = rasqal_new_formula(rq->world); if(!(yyval.formula)) { raptor_free_uri(uri); YYERROR_MSG("Verb 2: cannot create formula"); } (yyval.formula)->value = rasqal_new_uri_literal(rq->world, uri); if(!(yyval.formula)->value) { rasqal_free_formula((yyval.formula)); (yyval.formula) = NULL; YYERROR_MSG("Verb 2: cannot create uri literal"); } } #line 7741 "sparql_parser.c" /* yacc.c:1646 */ break; case 256: #line 4110 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 7749 "sparql_parser.c" /* yacc.c:1646 */ break; case 257: #line 4114 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 7757 "sparql_parser.c" /* yacc.c:1646 */ break; case 258: #line 4122 "./sparql_parser.y" /* yacc.c:1646 */ { int i; const unsigned char *id; if((yyvsp[-1].formula) == NULL) { (yyval.formula) = rasqal_new_formula(rq->world); if(!(yyval.formula)) YYERROR_MSG("BlankNodePropertyList: cannot create formula"); } else { (yyval.formula) = (yyvsp[-1].formula); if((yyval.formula)->value) { rasqal_free_literal((yyval.formula)->value); (yyval.formula)->value = NULL; } } id = rasqal_query_generate_bnodeid(rq, NULL); if(!id) { rasqal_free_formula((yyval.formula)); (yyval.formula) = NULL; YYERROR_MSG("BlankNodeProperyList: cannot create bnodeid"); } (yyval.formula)->value = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, id); if(!(yyval.formula)->value) { rasqal_free_formula((yyval.formula)); (yyval.formula) = NULL; YYERROR_MSG("BlankNodePropertyList: cannot create literal"); } if((yyvsp[-1].formula) == NULL) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesNode\n PropertyList="); rasqal_formula_print((yyval.formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif } else { raptor_sequence *seq = (yyvsp[-1].formula)->triples; /* non-empty property list, handle it */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesNode\n PropertyList="); raptor_sequence_print(seq, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif for(i = 0; isubject) continue; t2->subject = (rasqal_literal*)rasqal_new_literal_from_literal((yyval.formula)->value); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution formula="); rasqal_formula_print((yyval.formula), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } } #line 7824 "sparql_parser.c" /* yacc.c:1646 */ break; case 259: #line 4189 "./sparql_parser.y" /* yacc.c:1646 */ { int i; rasqal_literal* first_identifier = NULL; rasqal_literal* rest_identifier = NULL; rasqal_literal* object = NULL; rasqal_literal* blank = NULL; char const *errmsg = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "Collection\n GraphNodeListNotEmpty="); raptor_sequence_print((yyvsp[-1].seq), DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif (yyval.formula) = rasqal_new_formula(rq->world); if(!(yyval.formula)) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create formula"); (yyval.formula)->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!(yyval.formula)->triples) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create sequence"); first_identifier = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_first_uri)); if(!first_identifier) YYERR_MSG_GOTO(err_Collection, "Collection: cannot first_identifier"); rest_identifier = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_rest_uri)); if(!rest_identifier) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create rest_identifier"); object = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_nil_uri)); if(!object) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create nil object"); for(i = raptor_sequence_size((yyvsp[-1].seq))-1; i >= 0; i--) { rasqal_formula* f = (rasqal_formula*)raptor_sequence_get_at((yyvsp[-1].seq), i); rasqal_triple *t2; const unsigned char *blank_id = NULL; blank_id = rasqal_query_generate_bnodeid(rq, NULL); if(!blank_id) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create bnodeid"); blank = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, blank_id); if(!blank) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create bnode"); /* Move existing formula triples */ if(f->triples) if(raptor_sequence_join((yyval.formula)->triples, f->triples)) YYERR_MSG_GOTO(err_Collection, "Collection: sequence join failed"); /* add new triples we needed */ t2 = rasqal_new_triple(rasqal_new_literal_from_literal(blank), rasqal_new_literal_from_literal(first_identifier), rasqal_new_literal_from_literal(f->value)); if(!t2) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create triple"); if(raptor_sequence_push((yyval.formula)->triples, t2)) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create triple"); t2 = rasqal_new_triple(rasqal_new_literal_from_literal(blank), rasqal_new_literal_from_literal(rest_identifier), rasqal_new_literal_from_literal(object)); if(!t2) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create triple 2"); if(raptor_sequence_push((yyval.formula)->triples, t2)) YYERR_MSG_GOTO(err_Collection, "Collection: sequence push 2 failed"); rasqal_free_literal(object); object=blank; blank = NULL; } /* free sequence of formulas just processed */ raptor_free_sequence((yyvsp[-1].seq)); (yyval.formula)->value=object; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution collection="); rasqal_formula_print((yyval.formula), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif rasqal_free_literal(first_identifier); rasqal_free_literal(rest_identifier); err_Collection: if(errmsg) { if(blank) rasqal_free_literal(blank); if(object) rasqal_free_literal(object); if(rest_identifier) rasqal_free_literal(rest_identifier); if(first_identifier) rasqal_free_literal(first_identifier); if((yyvsp[-1].seq)) raptor_free_sequence((yyvsp[-1].seq)); if((yyval.formula)) { rasqal_free_formula((yyval.formula)); (yyval.formula) = NULL; } YYERROR_MSG(errmsg); } } #line 7942 "sparql_parser.c" /* yacc.c:1646 */ break; case 260: #line 4308 "./sparql_parser.y" /* yacc.c:1646 */ { char const *errmsg = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphNodeListNotEmpty 1\n"); if((yyvsp[0].formula)) { fprintf(DEBUG_FH, " GraphNode="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty GraphNode\n"); if((yyvsp[-1].seq)) { fprintf(DEBUG_FH, " GraphNodeListNotEmpty="); raptor_sequence_print((yyvsp[-1].seq), DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty GraphNodeListNotEmpty\n"); #endif (yyval.seq) = (yyvsp[-1].seq); if(!(yyval.seq)) { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_formula, (raptor_data_print_handler)rasqal_formula_print); if(!(yyval.seq)) YYERR_MSG_GOTO(err_GraphNodeListNotEmpty, "GraphNodeListNotEmpty: cannot create formula"); } if((yyvsp[0].formula)) { if(raptor_sequence_push((yyval.seq), (yyvsp[0].formula))) { YYERR_MSG_GOTO(err_GraphNodeListNotEmpty, "GraphNodeListNotEmpty 1: sequence push failed"); } (yyvsp[0].formula) = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " itemList is now "); raptor_sequence_print((yyval.seq), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } err_GraphNodeListNotEmpty: if(errmsg) { if((yyvsp[0].formula)) rasqal_free_formula((yyvsp[0].formula)); if((yyval.seq)) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; } YYERROR_MSG(errmsg); } } #line 7999 "sparql_parser.c" /* yacc.c:1646 */ break; case 261: #line 4361 "./sparql_parser.y" /* yacc.c:1646 */ { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphNodeListNotEmpty 2\n"); if((yyvsp[0].formula)) { fprintf(DEBUG_FH, " GraphNode="); rasqal_formula_print((yyvsp[0].formula), DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty GraphNode\n"); #endif if(!(yyvsp[0].formula)) (yyval.seq) = NULL; else { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)rasqal_free_formula, (raptor_data_print_handler)rasqal_formula_print); if(!(yyval.seq)) { rasqal_free_formula((yyvsp[0].formula)); YYERROR_MSG("GraphNodeListNotEmpty 2: cannot create sequence"); } if(raptor_sequence_push((yyval.seq), (yyvsp[0].formula))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("GraphNodeListNotEmpty 2: sequence push failed"); } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " GraphNodeListNotEmpty is now "); raptor_sequence_print((yyval.seq), DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } #line 8036 "sparql_parser.c" /* yacc.c:1646 */ break; case 262: #line 4398 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 8044 "sparql_parser.c" /* yacc.c:1646 */ break; case 263: #line 4402 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = (yyvsp[0].formula); } #line 8052 "sparql_parser.c" /* yacc.c:1646 */ break; case 264: #line 4410 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = rasqal_new_formula(rq->world); if(!(yyval.formula)) YYERROR_MSG("VarOrTerm 1: cannot create formula"); (yyval.formula)->value = rasqal_new_variable_literal(rq->world, (yyvsp[0].variable)); if(!(yyval.formula)->value) { rasqal_free_formula((yyval.formula)); (yyval.formula) = NULL; YYERROR_MSG("VarOrTerm 1: cannot create literal"); } } #line 8068 "sparql_parser.c" /* yacc.c:1646 */ break; case 265: #line 4422 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.formula) = rasqal_new_formula(rq->world); if(!(yyval.formula)) { if((yyvsp[0].literal)) rasqal_free_literal((yyvsp[0].literal)); YYERROR_MSG("VarOrTerm 2: cannot create formula"); } (yyval.formula)->value = (yyvsp[0].literal); } #line 8082 "sparql_parser.c" /* yacc.c:1646 */ break; case 266: #line 4435 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_variable_literal(rq->world, (yyvsp[0].variable)); if(!(yyval.literal)) YYERROR_MSG("VarOrIRIref: cannot create literal"); } #line 8092 "sparql_parser.c" /* yacc.c:1646 */ break; case 267: #line 4441 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 8100 "sparql_parser.c" /* yacc.c:1646 */ break; case 268: #line 4449 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); } #line 8108 "sparql_parser.c" /* yacc.c:1646 */ break; case 269: #line 4453 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); } #line 8116 "sparql_parser.c" /* yacc.c:1646 */ break; case 270: #line 4460 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = rasqal_variables_table_add2(rq->vars_table, RASQAL_VARIABLE_TYPE_NORMAL, (yyvsp[0].name), 0, NULL); if(!(yyval.variable)) YYERROR_MSG("VarName: cannot create var"); RASQAL_FREE(char*, (yyvsp[0].name)); } #line 8128 "sparql_parser.c" /* yacc.c:1646 */ break; case 271: #line 4472 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); } #line 8136 "sparql_parser.c" /* yacc.c:1646 */ break; case 272: #line 4476 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); } #line 8144 "sparql_parser.c" /* yacc.c:1646 */ break; case 273: #line 4480 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.variable) = (yyvsp[0].variable); sparql_syntax_warning(rq, "... AS varname is deprecated LAQRS syntax, use ... AS ?varname"); } #line 8154 "sparql_parser.c" /* yacc.c:1646 */ break; case 274: #line 4490 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 8162 "sparql_parser.c" /* yacc.c:1646 */ break; case 275: #line 4494 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 8170 "sparql_parser.c" /* yacc.c:1646 */ break; case 276: #line 4498 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 8178 "sparql_parser.c" /* yacc.c:1646 */ break; case 277: #line 4502 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 8186 "sparql_parser.c" /* yacc.c:1646 */ break; case 278: #line 4506 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 8194 "sparql_parser.c" /* yacc.c:1646 */ break; case 279: #line 4510 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_nil_uri)); if(!(yyval.literal)) YYERROR_MSG("GraphTerm: cannot create literal"); } #line 8205 "sparql_parser.c" /* yacc.c:1646 */ break; case 280: #line 4520 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8213 "sparql_parser.c" /* yacc.c:1646 */ break; case 281: #line 4528 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("ConditionalOrExpression: cannot create expr"); } #line 8224 "sparql_parser.c" /* yacc.c:1646 */ break; case 282: #line 4535 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8232 "sparql_parser.c" /* yacc.c:1646 */ break; case 283: #line 4543 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("ConditionalAndExpression: cannot create expr"); ; } #line 8244 "sparql_parser.c" /* yacc.c:1646 */ break; case 284: #line 4551 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8252 "sparql_parser.c" /* yacc.c:1646 */ break; case 285: #line 4560 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_EQ, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("RelationalExpression 1: cannot create expr"); } #line 8263 "sparql_parser.c" /* yacc.c:1646 */ break; case 286: #line 4567 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_NEQ, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("RelationalExpression 2: cannot create expr"); } #line 8274 "sparql_parser.c" /* yacc.c:1646 */ break; case 287: #line 4574 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_LT, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("RelationalExpression 3: cannot create expr"); } #line 8285 "sparql_parser.c" /* yacc.c:1646 */ break; case 288: #line 4581 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_GT, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("RelationalExpression 4: cannot create expr"); } #line 8296 "sparql_parser.c" /* yacc.c:1646 */ break; case 289: #line 4588 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_LE, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("RelationalExpression 5: cannot create expr"); } #line 8307 "sparql_parser.c" /* yacc.c:1646 */ break; case 290: #line 4595 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_GE, (yyvsp[-2].expr), (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("RelationalExpression 6: cannot create expr"); } #line 8318 "sparql_parser.c" /* yacc.c:1646 */ break; case 291: #line 4602 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_set_expression(rq->world, RASQAL_EXPR_IN, (yyvsp[-2].expr), (yyvsp[0].seq)); } #line 8327 "sparql_parser.c" /* yacc.c:1646 */ break; case 292: #line 4607 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_set_expression(rq->world, RASQAL_EXPR_NOT_IN, (yyvsp[-3].expr), (yyvsp[0].seq)); } #line 8336 "sparql_parser.c" /* yacc.c:1646 */ break; case 293: #line 4612 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8344 "sparql_parser.c" /* yacc.c:1646 */ break; case 294: #line 4654 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[-1].expr); if((yyvsp[0].seq)) { int i; int size = raptor_sequence_size((yyvsp[0].seq)); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AdExOpExpressionListOuter sequence: "); if((yyvsp[0].seq)) raptor_sequence_print((yyvsp[0].seq), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* Walk sequence forming tree of exprs in $$ */ for(i = 0; i < size; i++) { sparql_op_expr* op_expr = (sparql_op_expr*)raptor_sequence_get_at((yyvsp[0].seq), i); (yyval.expr) = rasqal_new_2op_expression(rq->world, op_expr->op, (yyval.expr), op_expr->expr); op_expr->expr = NULL; } raptor_free_sequence((yyvsp[0].seq)); } } #line 8374 "sparql_parser.c" /* yacc.c:1646 */ break; case 295: #line 4680 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8382 "sparql_parser.c" /* yacc.c:1646 */ break; case 296: #line 4687 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyvsp[0].seq)) { if(raptor_sequence_join((yyval.seq), (yyvsp[0].seq))) { raptor_free_sequence((yyvsp[0].seq)); raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("AdExOpExpressionListOuter: sequence join failed"); } raptor_free_sequence((yyvsp[0].seq)); } } #line 8400 "sparql_parser.c" /* yacc.c:1646 */ break; case 297: #line 4701 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); } #line 8408 "sparql_parser.c" /* yacc.c:1646 */ break; case 298: #line 4707 "./sparql_parser.y" /* yacc.c:1646 */ { sparql_op_expr* oe; (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!(yyval.seq)) YYERROR_MSG("AdExOpExpressionListInner 1: failed to create sequence"); oe = new_op_expr(RASQAL_EXPR_PLUS, (yyvsp[0].expr)); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 1: cannot create plus expr"); if(raptor_sequence_push((yyval.seq), oe)) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("AdExOpExpressionListInner 1: sequence push failed"); } } #line 8431 "sparql_parser.c" /* yacc.c:1646 */ break; case 299: #line 4726 "./sparql_parser.y" /* yacc.c:1646 */ { sparql_op_expr* oe; (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!(yyval.seq)) YYERROR_MSG("AdExOpExpressionListInner 2: failed to create sequence"); oe = new_op_expr(RASQAL_EXPR_MINUS, (yyvsp[0].expr)); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 2: cannot create minus expr"); if(raptor_sequence_push((yyval.seq), oe)) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("AdExOpExpressionListInner 2: sequence push failed"); } } #line 8454 "sparql_parser.c" /* yacc.c:1646 */ break; case 300: #line 4745 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_expression *e; sparql_op_expr* oe; (yyval.seq) = (yyvsp[0].seq); if(!(yyval.seq)) { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!(yyval.seq)) YYERROR_MSG("AdExOpExpressionListInner 2: failed to create sequence"); } e = rasqal_new_literal_expression(rq->world, (yyvsp[-1].literal)); if(!e) YYERROR_MSG("AdExOpExpressionListInner 2: cannot create NumericLiteralPositive literal expression"); oe = new_op_expr(RASQAL_EXPR_PLUS, e); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 2: cannot create plus expr"); raptor_sequence_shift((yyval.seq), oe); } #line 8479 "sparql_parser.c" /* yacc.c:1646 */ break; case 301: #line 4766 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_expression *e; sparql_op_expr* oe; (yyval.seq) = (yyvsp[0].seq); if(!(yyval.seq)) { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!(yyval.seq)) YYERROR_MSG("AdExOpExpressionListInner 3: failed to create sequence"); } e = rasqal_new_literal_expression(rq->world, (yyvsp[-1].literal)); if(!e) YYERROR_MSG("AdExOpExpressionListInner 3: cannot create NumericLiteralNegative literal expression"); oe = new_op_expr(RASQAL_EXPR_MINUS, e); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 3: cannot create minus expr"); raptor_sequence_shift((yyval.seq), oe); } #line 8504 "sparql_parser.c" /* yacc.c:1646 */ break; case 302: #line 4789 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[0].seq); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AEListOpt sequence: "); if((yyval.seq)) raptor_sequence_print((yyval.seq), DEBUG_FH); else fputs("NULL", DEBUG_FH); fputc('\n', DEBUG_FH); #endif } #line 8521 "sparql_parser.c" /* yacc.c:1646 */ break; case 303: #line 4802 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = NULL; } #line 8529 "sparql_parser.c" /* yacc.c:1646 */ break; case 304: #line 4808 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyval.seq) && (yyvsp[0].op_expr)) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AdExOpUnaryExpressionList adding AdExOpUnaryExpression: "); print_op_expr((yyvsp[0].op_expr), DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(raptor_sequence_push((yyval.seq), (yyvsp[0].op_expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("AdExOpUnaryExpressionListOpt 1: sequence push failed"); } } } #line 8551 "sparql_parser.c" /* yacc.c:1646 */ break; case 305: #line 4826 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!(yyval.seq)) YYERROR_MSG("AdExOpUnaryExpressionListOpt 2: failed to create sequence"); if((yyvsp[0].op_expr)) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AdExOpUnaryExpressionList adding AdExOpUnaryExpression: "); print_op_expr((yyvsp[0].op_expr), DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(raptor_sequence_push((yyval.seq), (yyvsp[0].op_expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("AdExOpUnaryExpressionListOpt 2: sequence push failed"); } } } #line 8576 "sparql_parser.c" /* yacc.c:1646 */ break; case 306: #line 4849 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.op_expr) = new_op_expr(RASQAL_EXPR_STAR, (yyvsp[0].expr)); if(!(yyval.op_expr)) YYERROR_MSG("AdExOpUnaryExpression 1: cannot create star expr"); } #line 8586 "sparql_parser.c" /* yacc.c:1646 */ break; case 307: #line 4855 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.op_expr) = new_op_expr(RASQAL_EXPR_SLASH, (yyvsp[0].expr)); if(!(yyval.op_expr)) YYERROR_MSG("AdExOpUnaryExpression 2: cannot create slash expr"); } #line 8596 "sparql_parser.c" /* yacc.c:1646 */ break; case 308: #line 4883 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[-1].expr); if((yyvsp[0].seq)) { int i; int size = raptor_sequence_size((yyvsp[0].seq)); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("MuExOpUnaryExpressionList sequence: "); raptor_sequence_print((yyvsp[0].seq), DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* Walk sequence forming tree of exprs in $$ */ for(i = 0; i < size; i++) { sparql_op_expr* op_expr = (sparql_op_expr*)raptor_sequence_get_at((yyvsp[0].seq), i); (yyval.expr) = rasqal_new_2op_expression(rq->world, op_expr->op, (yyval.expr), op_expr->expr); op_expr->expr = NULL; } raptor_free_sequence((yyvsp[0].seq)); } } #line 8623 "sparql_parser.c" /* yacc.c:1646 */ break; case 309: #line 4906 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8631 "sparql_parser.c" /* yacc.c:1646 */ break; case 310: #line 4912 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = (yyvsp[-1].seq); if((yyval.seq) && (yyvsp[0].op_expr)) { if(raptor_sequence_push((yyval.seq), (yyvsp[0].op_expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("MuExOpUnaryExpressionListOpt 1: sequence push failed"); } } } #line 8646 "sparql_parser.c" /* yacc.c:1646 */ break; case 311: #line 4923 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.seq) = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!(yyval.seq)) YYERROR_MSG("MuExOpUnaryExpressionListOpt 2: failed to create sequence"); if(raptor_sequence_push((yyval.seq), (yyvsp[0].op_expr))) { raptor_free_sequence((yyval.seq)); (yyval.seq) = NULL; YYERROR_MSG("MuExOpUnaryExpressionListOpt 2: sequence push failed"); } } #line 8663 "sparql_parser.c" /* yacc.c:1646 */ break; case 312: #line 4939 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.op_expr) = new_op_expr(RASQAL_EXPR_STAR, (yyvsp[0].expr)); if(!(yyval.op_expr)) YYERROR_MSG("MuExOpUnaryExpression 1: cannot create star expr"); } #line 8673 "sparql_parser.c" /* yacc.c:1646 */ break; case 313: #line 4945 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.op_expr) = new_op_expr(RASQAL_EXPR_SLASH, (yyvsp[0].expr)); if(!(yyval.op_expr)) YYERROR_MSG("MuExOpUnaryExpression 2: cannot create slash expr"); } #line 8683 "sparql_parser.c" /* yacc.c:1646 */ break; case 314: #line 4956 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BANG, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("UnaryExpression 1: cannot create expr"); } #line 8694 "sparql_parser.c" /* yacc.c:1646 */ break; case 315: #line 4963 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8702 "sparql_parser.c" /* yacc.c:1646 */ break; case 316: #line 4967 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_UMINUS, (yyvsp[0].expr)); if(!(yyval.expr)) YYERROR_MSG("UnaryExpression 3: cannot create expr"); } #line 8713 "sparql_parser.c" /* yacc.c:1646 */ break; case 317: #line 4974 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8721 "sparql_parser.c" /* yacc.c:1646 */ break; case 318: #line 4988 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8729 "sparql_parser.c" /* yacc.c:1646 */ break; case 319: #line 4992 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8737 "sparql_parser.c" /* yacc.c:1646 */ break; case 320: #line 4996 "./sparql_parser.y" /* yacc.c:1646 */ { /* Grammar has IRIrefOrFunction here which is "IRIref ArgList?" * and essentially shorthand for FunctionCall | IRIref. The Rasqal * SPARQL lexer distinguishes these for us with IRIrefBrace. * IRIref is covered below by GraphTerm. */ (yyval.expr) = (yyvsp[0].expr); } #line 8750 "sparql_parser.c" /* yacc.c:1646 */ break; case 321: #line 5005 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_literal_expression(rq->world, (yyvsp[0].literal)); if(!(yyval.expr)) YYERROR_MSG("PrimaryExpression 4: cannot create expr"); } #line 8760 "sparql_parser.c" /* yacc.c:1646 */ break; case 322: #line 5011 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_literal *l; l = rasqal_new_variable_literal(rq->world, (yyvsp[0].variable)); if(!l) YYERROR_MSG("PrimaryExpression 5: cannot create literal"); (yyval.expr) = rasqal_new_literal_expression(rq->world, l); if(!(yyval.expr)) YYERROR_MSG("PrimaryExpression 5: cannot create expr"); } #line 8774 "sparql_parser.c" /* yacc.c:1646 */ break; case 323: #line 5021 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 8782 "sparql_parser.c" /* yacc.c:1646 */ break; case 324: #line 5029 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[-1].expr); } #line 8790 "sparql_parser.c" /* yacc.c:1646 */ break; case 325: #line 5037 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_STR, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 1: cannot create expr"); } #line 8801 "sparql_parser.c" /* yacc.c:1646 */ break; case 326: #line 5044 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_LANG, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 2: cannot create expr"); } #line 8812 "sparql_parser.c" /* yacc.c:1646 */ break; case 327: #line 5051 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_LANGMATCHES, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 3: cannot create expr"); } #line 8823 "sparql_parser.c" /* yacc.c:1646 */ break; case 328: #line 5058 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_DATATYPE, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 4: cannot create expr"); } #line 8834 "sparql_parser.c" /* yacc.c:1646 */ break; case 329: #line 5065 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_literal *l; rasqal_expression *e; l = rasqal_new_variable_literal(rq->world, (yyvsp[-1].variable)); if(!l) YYERROR_MSG("BuiltInCall 5: cannot create literal"); e = rasqal_new_literal_expression(rq->world, l); if(!e) YYERROR_MSG("BuiltInCall 6: cannot create literal expr"); (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BOUND, e); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7: cannot create expr"); } #line 8853 "sparql_parser.c" /* yacc.c:1646 */ break; case 330: #line 5080 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_IRI, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7a: cannot create expr"); } #line 8864 "sparql_parser.c" /* yacc.c:1646 */ break; case 331: #line 5087 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_IRI, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7b: cannot create expr"); } #line 8875 "sparql_parser.c" /* yacc.c:1646 */ break; case 332: #line 5094 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BNODE, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7c: cannot create expr"); } #line 8886 "sparql_parser.c" /* yacc.c:1646 */ break; case 333: #line 5101 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BNODE, NULL); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7d: cannot create expr"); } #line 8897 "sparql_parser.c" /* yacc.c:1646 */ break; case 334: #line 5108 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_RAND); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7e: cannot create expr"); } #line 8908 "sparql_parser.c" /* yacc.c:1646 */ break; case 335: #line 5115 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ABS, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7f: cannot create expr"); } #line 8919 "sparql_parser.c" /* yacc.c:1646 */ break; case 336: #line 5122 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_CEIL, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7g: cannot create expr"); } #line 8930 "sparql_parser.c" /* yacc.c:1646 */ break; case 337: #line 5129 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_FLOOR, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7h: cannot create expr"); } #line 8941 "sparql_parser.c" /* yacc.c:1646 */ break; case 338: #line 5136 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ROUND, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7i: cannot create expr"); } #line 8952 "sparql_parser.c" /* yacc.c:1646 */ break; case 339: #line 5143 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_MD5, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7j: cannot create expr"); } #line 8963 "sparql_parser.c" /* yacc.c:1646 */ break; case 340: #line 5150 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA1, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7k: cannot create expr"); } #line 8974 "sparql_parser.c" /* yacc.c:1646 */ break; case 341: #line 5157 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA224, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7l: cannot create expr"); } #line 8985 "sparql_parser.c" /* yacc.c:1646 */ break; case 342: #line 5164 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA256, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7m: cannot create expr"); } #line 8996 "sparql_parser.c" /* yacc.c:1646 */ break; case 343: #line 5171 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA384, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7n: cannot create expr"); } #line 9007 "sparql_parser.c" /* yacc.c:1646 */ break; case 344: #line 5178 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA512, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7o: cannot create expr"); } #line 9018 "sparql_parser.c" /* yacc.c:1646 */ break; case 345: #line 5185 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_UUID); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7p: cannot create expr"); } #line 9029 "sparql_parser.c" /* yacc.c:1646 */ break; case 346: #line 5192 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_STRUUID); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7q: cannot create expr"); } #line 9040 "sparql_parser.c" /* yacc.c:1646 */ break; case 347: #line 5199 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 9048 "sparql_parser.c" /* yacc.c:1646 */ break; case 348: #line 5203 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 9056 "sparql_parser.c" /* yacc.c:1646 */ break; case 349: #line 5207 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_IF, (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7e: cannot create expr"); } #line 9067 "sparql_parser.c" /* yacc.c:1646 */ break; case 350: #line 5214 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRLANG, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7f: cannot create expr"); } #line 9078 "sparql_parser.c" /* yacc.c:1646 */ break; case 351: #line 5221 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRDT, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 7g: cannot create expr"); } #line 9089 "sparql_parser.c" /* yacc.c:1646 */ break; case 352: #line 5228 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_SAMETERM, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 8: cannot create expr"); } #line 9100 "sparql_parser.c" /* yacc.c:1646 */ break; case 353: #line 5235 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISURI, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 9: cannot create expr"); } #line 9111 "sparql_parser.c" /* yacc.c:1646 */ break; case 354: #line 5242 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISBLANK, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 10: cannot create expr"); } #line 9122 "sparql_parser.c" /* yacc.c:1646 */ break; case 355: #line 5249 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISLITERAL, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 11: cannot create expr"); } #line 9133 "sparql_parser.c" /* yacc.c:1646 */ break; case 356: #line 5256 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISNUMERIC, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("BuiltInCall 12: cannot create expr"); } #line 9144 "sparql_parser.c" /* yacc.c:1646 */ break; case 357: #line 5263 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 9152 "sparql_parser.c" /* yacc.c:1646 */ break; case 358: #line 5267 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 9160 "sparql_parser.c" /* yacc.c:1646 */ break; case 359: #line 5271 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } #line 9168 "sparql_parser.c" /* yacc.c:1646 */ break; case 360: #line 5278 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_STRLEN, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create STRLEN() expr"); } #line 9179 "sparql_parser.c" /* yacc.c:1646 */ break; case 361: #line 5285 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_SUBSTR, (yyvsp[-3].expr), (yyvsp[-1].expr), NULL); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create SUBSTR() expr"); } #line 9190 "sparql_parser.c" /* yacc.c:1646 */ break; case 362: #line 5292 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_SUBSTR, (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create SUBSTR() expr"); } #line 9201 "sparql_parser.c" /* yacc.c:1646 */ break; case 363: #line 5299 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_UCASE, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create UCASE() expr"); } #line 9212 "sparql_parser.c" /* yacc.c:1646 */ break; case 364: #line 5306 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_LCASE, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create LCASE() expr"); } #line 9223 "sparql_parser.c" /* yacc.c:1646 */ break; case 365: #line 5313 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRSTARTS, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create STRSTARTS() expr"); } #line 9234 "sparql_parser.c" /* yacc.c:1646 */ break; case 366: #line 5320 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRENDS, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create STRENDS() expr"); } #line 9245 "sparql_parser.c" /* yacc.c:1646 */ break; case 367: #line 5327 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_CONTAINS, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create YEAR expr"); } #line 9256 "sparql_parser.c" /* yacc.c:1646 */ break; case 368: #line 5334 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ENCODE_FOR_URI, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create ENCODE_FOR_URI() expr"); } #line 9267 "sparql_parser.c" /* yacc.c:1646 */ break; case 369: #line 5341 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_expr_seq_expression(rq->world, RASQAL_EXPR_CONCAT, (yyvsp[-1].seq)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create CONCAT() expr"); } #line 9278 "sparql_parser.c" /* yacc.c:1646 */ break; case 370: #line 5348 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRBEFORE, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create STRBEFORE() expr"); } #line 9289 "sparql_parser.c" /* yacc.c:1646 */ break; case 371: #line 5355 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRAFTER, (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create STRAFTER() expr"); } #line 9300 "sparql_parser.c" /* yacc.c:1646 */ break; case 372: #line 5362 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_REPLACE, (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create REPLACE() expr"); } #line 9311 "sparql_parser.c" /* yacc.c:1646 */ break; case 373: #line 5369 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_4op_expression(rq->world, RASQAL_EXPR_REPLACE, (yyvsp[-7].expr), (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("StringExpression: cannot create REPLACE() expr"); } #line 9322 "sparql_parser.c" /* yacc.c:1646 */ break; case 374: #line 5380 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_REGEX, (yyvsp[-3].expr), (yyvsp[-1].expr), NULL); if(!(yyval.expr)) YYERROR_MSG("RegexExpression 1: cannot create expr"); } #line 9333 "sparql_parser.c" /* yacc.c:1646 */ break; case 375: #line 5387 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_REGEX, (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("RegexExpression 2: cannot create expr"); } #line 9344 "sparql_parser.c" /* yacc.c:1646 */ break; case 376: #line 5398 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_YEAR, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create YEAR expr"); } #line 9355 "sparql_parser.c" /* yacc.c:1646 */ break; case 377: #line 5405 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_MONTH, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create MONTH expr"); } #line 9366 "sparql_parser.c" /* yacc.c:1646 */ break; case 378: #line 5412 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_DAY, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create DAY expr"); } #line 9377 "sparql_parser.c" /* yacc.c:1646 */ break; case 379: #line 5419 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_HOURS, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create HOURS expr"); } #line 9388 "sparql_parser.c" /* yacc.c:1646 */ break; case 380: #line 5426 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_MINUTES, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create MINUTES expr"); } #line 9399 "sparql_parser.c" /* yacc.c:1646 */ break; case 381: #line 5433 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SECONDS, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create SECONDS expr"); } #line 9410 "sparql_parser.c" /* yacc.c:1646 */ break; case 382: #line 5440 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_TIMEZONE, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create TIMEZONE expr"); } #line 9421 "sparql_parser.c" /* yacc.c:1646 */ break; case 383: #line 5447 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_TZ, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create TZ expr"); } #line 9432 "sparql_parser.c" /* yacc.c:1646 */ break; case 384: #line 5458 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(sparql->experimental) { (yyval.expr) = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_CURRENT_DATETIME); if(!(yyval.expr)) YYERROR_MSG("DatetimeExtensions: cannot create CURRENT_DATETIME() expr"); } else { sparql_syntax_error(rq, "CURRENT_DATETIME() can only used with LAQRS"); YYERROR; } } #line 9453 "sparql_parser.c" /* yacc.c:1646 */ break; case 385: #line 5475 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "NOW() can only be used with SPARQL 1.1"); YYERROR; } (yyval.expr) = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_NOW); if(!(yyval.expr)) YYERROR_MSG("DatetimeExtensions: cannot create NOW()"); } #line 9475 "sparql_parser.c" /* yacc.c:1646 */ break; case 386: #line 5493 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(sparql->experimental) { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_FROM_UNIXTIME, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeExtensions: cannot create FROM_UNIXTIME() expr"); } else { sparql_syntax_error(rq, "FROM_UNIXTIME() can only used with LAQRS"); YYERROR; } } #line 9497 "sparql_parser.c" /* yacc.c:1646 */ break; case 387: #line 5511 "./sparql_parser.y" /* yacc.c:1646 */ { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); (yyval.expr) = NULL; if(sparql->experimental) { (yyval.expr) = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_TO_UNIXTIME, (yyvsp[-1].expr)); if(!(yyval.expr)) YYERROR_MSG("DatetimeExtensions: cannot create TO_UNIXTIME() expr"); } else { sparql_syntax_error(rq, "TO_UNIXTIME() can only used with LAQRS"); YYERROR; } } #line 9519 "sparql_parser.c" /* yacc.c:1646 */ break; case 388: #line 5536 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_uri_literal(rq->world, (yyvsp[0].uri)); if(!(yyval.literal)) YYERROR_MSG("IRIrefBrace 1: cannot create literal"); } #line 9529 "sparql_parser.c" /* yacc.c:1646 */ break; case 389: #line 5542 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_QNAME, (yyvsp[0].name)); if(!(yyval.literal)) YYERROR_MSG("IRIrefBrace 2: cannot create literal"); if(rasqal_literal_expand_qname(rq, (yyval.literal))) { sparql_query_error_full(rq, "QName %s cannot be expanded", (yyvsp[0].name)); rasqal_free_literal((yyval.literal)); (yyval.literal) = NULL; YYERROR_MSG("IRIrefBrace 2: cannot expand qname"); } } #line 9547 "sparql_parser.c" /* yacc.c:1646 */ break; case 390: #line 5562 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9555 "sparql_parser.c" /* yacc.c:1646 */ break; case 391: #line 5566 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9563 "sparql_parser.c" /* yacc.c:1646 */ break; case 392: #line 5570 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9571 "sparql_parser.c" /* yacc.c:1646 */ break; case 393: #line 5577 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9579 "sparql_parser.c" /* yacc.c:1646 */ break; case 394: #line 5581 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9587 "sparql_parser.c" /* yacc.c:1646 */ break; case 395: #line 5585 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9595 "sparql_parser.c" /* yacc.c:1646 */ break; case 396: #line 5593 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9603 "sparql_parser.c" /* yacc.c:1646 */ break; case 397: #line 5597 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9611 "sparql_parser.c" /* yacc.c:1646 */ break; case 398: #line 5601 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9619 "sparql_parser.c" /* yacc.c:1646 */ break; case 399: #line 5609 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9627 "sparql_parser.c" /* yacc.c:1646 */ break; case 400: #line 5613 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9635 "sparql_parser.c" /* yacc.c:1646 */ break; case 401: #line 5617 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } #line 9643 "sparql_parser.c" /* yacc.c:1646 */ break; case 402: #line 5629 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_uri_literal(rq->world, (yyvsp[0].uri)); if(!(yyval.literal)) YYERROR_MSG("IRIref 1: cannot create literal"); } #line 9653 "sparql_parser.c" /* yacc.c:1646 */ break; case 403: #line 5635 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_QNAME, (yyvsp[0].name)); if(!(yyval.literal)) YYERROR_MSG("IRIref 2: cannot create literal"); if(rasqal_literal_expand_qname(rq, (yyval.literal))) { sparql_query_error_full(rq, "QName %s cannot be expanded", (yyvsp[0].name)); rasqal_free_literal((yyval.literal)); (yyval.literal) = NULL; YYERROR_MSG("IRIrefBrace 2: cannot expand qname"); } } #line 9671 "sparql_parser.c" /* yacc.c:1646 */ break; case 404: #line 5655 "./sparql_parser.y" /* yacc.c:1646 */ { (yyval.literal) = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, (yyvsp[0].name)); if(!(yyval.literal)) YYERROR_MSG("BlankNode 1: cannot create literal"); } #line 9682 "sparql_parser.c" /* yacc.c:1646 */ break; case 405: #line 5661 "./sparql_parser.y" /* yacc.c:1646 */ { const unsigned char *id; id = rasqal_query_generate_bnodeid(rq, NULL); if(!id) YYERROR_MSG("BlankNode 2: cannot create bnodeid"); (yyval.literal) = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, id); if(!(yyval.literal)) YYERROR_MSG("BlankNode 2: cannot create literal"); } #line 9697 "sparql_parser.c" /* yacc.c:1646 */ break; #line 9701 "sparql_parser.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (rq, yyscanner, YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; if(yytoken < 0) yytoken = YYUNDEFTOK; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { if(yytoken < 0) yytoken = YYUNDEFTOK; yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (rq, yyscanner, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, rq, yyscanner); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp, rq, yyscanner); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (rq, yyscanner, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, rq, yyscanner); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp, rq, yyscanner); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } #line 5680 "./sparql_parser.y" /* yacc.c:1906 */ /* Support functions */ /* This is declared in sparql_lexer.h but never used, so we always get * a warning unless this dummy code is here. Used once below in an error case. */ static int yy_init_globals (yyscan_t yyscanner ) { return 0; } /* * rasqal_sparql_query_language_init: * @rdf_query: query * @name: language name (or NULL) * * Internal: Initialise the SPARQL query language parser * * Return value: non 0 on failure **/ static int rasqal_sparql_query_language_init(rasqal_query* rdf_query, const char *name) { rasqal_sparql_query_language* rqe; rqe = (rasqal_sparql_query_language*)rdf_query->context; rdf_query->compare_flags = RASQAL_COMPARE_XQUERY; /* All the sparql query families support this */ rqe->sparql_scda = 1; /* SELECT CONSTRUCT DESCRIBE ASK */ /* SPARQL 1.1 Query + Update is the default */ rqe->sparql_scda = 1; /* SELECT CONSTRUCT DESCRIBE ASK */ rqe->sparql11_query = 1; rqe->sparql11_property_paths = 1; rqe->sparql11_update = 1; if(name) { /* SPARQL 1.0 disables SPARQL 1.1 features */ if(!strncmp(name, "sparql10", 8)) { rqe->sparql11_query = 0; rqe->sparql11_property_paths = 0; rqe->sparql11_update = 0; } if(!strcmp(name, "sparql11-query")) { /* No update if SPARQL 1.1 query */ rqe->sparql11_update = 0; } if(!strcmp(name, "sparql11-update")) { /* No query (SELECT, CONSTRUCT, DESCRIBE, ASK) if SPARQL 1.1 update */ rqe->sparql_scda = 0; } /* LAQRS for experiments */ if(!strcmp(name, "laqrs")) rqe->experimental = 1; } return 0; } /** * rasqal_sparql_query_language_terminate - Free the SPARQL query language parser * * Return value: non 0 on failure **/ static void rasqal_sparql_query_language_terminate(rasqal_query* rdf_query) { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)rdf_query->context; if(sparql && sparql->scanner_set) { sparql_lexer_lex_destroy(sparql->scanner); sparql->scanner_set = 0; } } static int rasqal_sparql_query_language_prepare(rasqal_query* rdf_query) { /* rasqal_sparql_query_language* sparql = (rasqal_sparql_query_language*)rdf_query->context; */ int rc; if(!rdf_query->query_string) return 1; rc = rasqal_query_reset_select_query(rdf_query); if(rc) return 1; rc = sparql_parse(rdf_query); if(rc) return rc; /* FIXME - should check remaining query parts */ if(rasqal_sequence_has_qname(rdf_query->triples) || rasqal_sequence_has_qname(rdf_query->constructs) || rasqal_query_constraints_has_qname(rdf_query)) { sparql_query_error(rdf_query, "SPARQL query has unexpanded QNames"); return 1; } /* SPARQL: Turn [] into anonymous variables */ if(rasqal_query_build_anonymous_variables(rdf_query)) return 1; /* SPARQL: Expand 'SELECT *' */ if(rasqal_query_expand_wildcards(rdf_query, rasqal_query_get_projection(rdf_query))) return 1; return 0; } static int sparql_parse(rasqal_query* rq) { rasqal_sparql_query_language* rqe; raptor_locator *locator=&rq->locator; rqe = (rasqal_sparql_query_language*)rq->context; if(!rq->query_string) return yy_init_globals(NULL); /* 0 but a way to use yy_init_globals */ locator->line = 1; locator->column = -1; /* No column info */ locator->byte = -1; /* No bytes info */ rqe->lineno = 1; if(sparql_lexer_lex_init(&rqe->scanner)) return 1; rqe->scanner_set = 1; #if defined(YYDEBUG) && YYDEBUG > 0 sparql_lexer_set_debug(1 ,&rqe->scanner); sparql_parser_debug = 1; #endif sparql_lexer_set_extra(rq, rqe->scanner); (void)sparql_lexer__scan_buffer(RASQAL_GOOD_CAST(char*, rq->query_string), rq->query_string_length, rqe->scanner); rqe->error_count = 0; sparql_parser_parse(rq, rqe->scanner); sparql_lexer_lex_destroy(rqe->scanner); rqe->scanner_set = 0; /* Parsing failed */ if(rq->failed) return 1; return 0; } static void sparql_query_error(rasqal_query *rq, const char *msg) { rasqal_sparql_query_language* rqe; rqe = (rasqal_sparql_query_language*)rq->context; if(rqe->error_count++) return; rq->locator.line = rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rq->locator.column = sparql_lexer_get_column(yyscanner);*/ #endif rq->failed = 1; rasqal_log_error_simple(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_ERROR, &rq->locator, "%s", msg); } static void sparql_query_error_full(rasqal_query *rq, const char *message, ...) { va_list arguments; rasqal_sparql_query_language* rqe; rqe = (rasqal_sparql_query_language*)rq->context; if(rqe->error_count++) return; rq->locator.line = rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rq->locator.column = sparql_lexer_get_column(yyscanner);*/ #endif va_start(arguments, message); rq->failed = 1; rasqal_log_error_varargs(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_ERROR, &rq->locator, message, arguments); va_end(arguments); } int sparql_syntax_error(rasqal_query *rq, const char *message, ...) { rasqal_sparql_query_language *rqe; va_list arguments; rqe = (rasqal_sparql_query_language*)rq->context; if(rqe->error_count++) return 0; rq->locator.line=rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rp->locator.column=sparql_lexer_get_column(yyscanner);*/ #endif va_start(arguments, message); rq->failed = 1; rasqal_log_error_varargs(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_ERROR, &rq->locator, message, arguments); va_end(arguments); return 0; } int sparql_syntax_warning(rasqal_query *rq, const char *message, ...) { rasqal_sparql_query_language *rqe; va_list arguments; if(RASQAL_WARNING_LEVEL_QUERY_SYNTAX < rq->world->warning_level) return 0; rqe = (rasqal_sparql_query_language*)rq->context; rq->locator.line = rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rq->locator.column=sparql_lexer_get_column(yyscanner);*/ #endif va_start(arguments, message); rasqal_log_error_varargs(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_WARN, &rq->locator, message, arguments); va_end(arguments); return 0; } static int rasqal_sparql_query_language_iostream_write_escaped_counted_string(rasqal_query* query, raptor_iostream* iostr, const unsigned char* string, size_t len) { const char delim = '"'; raptor_iostream_write_byte(delim, iostr); if(raptor_string_ntriples_write(string, len, delim, iostr)) return 1; raptor_iostream_write_byte(delim, iostr); return 0; } static const char* const sparql_names[] = { "sparql10", NULL}; static const raptor_type_q sparql_types[] = { { NULL, 0, 0} }; static int rasqal_sparql_query_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql_names; factory->desc.mime_types = sparql_types; factory->desc.label = "SPARQL 1.0 W3C RDF Query Language"; factory->desc.uri_strings = NULL; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } int rasqal_init_query_language_sparql(rasqal_world* world) { return !rasqal_query_language_register_factory(world, &rasqal_sparql_query_language_register_factory); } static const char* const sparql11_names[] = { "sparql", "sparql11", NULL }; static const char* const sparql11_uri_strings[] = { "http://www.w3.org/TR/rdf-sparql-query/", NULL }; static const raptor_type_q sparql11_types[] = { { "application/sparql", 18, 10}, { NULL, 0, 0} }; static int rasqal_sparql11_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql11_names; factory->desc.mime_types = sparql11_types; factory->desc.label = "SPARQL 1.1 (DRAFT) Query and Update Languages"; /* What URI describes Query and Update languages? */ factory->desc.uri_strings = sparql11_uri_strings; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } static const char* const sparql11_query_names[] = { "sparql11-query", NULL }; static const char* const sparql11_query_uri_strings[] = { "http://www.w3.org/TR/2010/WD-sparql11-query-20101014/", NULL }; static const raptor_type_q sparql11_query_types[] = { { NULL, 0, 0} }; static int rasqal_sparql11_query_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql11_query_names; factory->desc.mime_types = sparql11_query_types; factory->desc.label = "SPARQL 1.1 (DRAFT) Query Language"; factory->desc.uri_strings = sparql11_query_uri_strings; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } static const char* const sparql11_update_names[] = { "sparql11-update", NULL }; static const char* const sparql11_update_uri_strings[] = { "http://www.w3.org/TR/2010/WD-sparql11-update-20101014/", NULL }; static const raptor_type_q sparql11_update_types[] = { { NULL, 0, 0} }; static int rasqal_sparql11_update_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql11_update_names; factory->desc.mime_types = sparql11_update_types; factory->desc.label = "SPARQL 1.1 (DRAFT) Update Language"; factory->desc.uri_strings = sparql11_update_uri_strings; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } int rasqal_init_query_language_sparql11(rasqal_world* world) { if(!rasqal_query_language_register_factory(world, &rasqal_sparql11_language_register_factory)) return 1; if(!rasqal_query_language_register_factory(world, &rasqal_sparql11_query_language_register_factory)) return 1; if(!rasqal_query_language_register_factory(world, &rasqal_sparql11_update_language_register_factory)) return 1; return 0; } static const char* const laqrs_names[] = { "laqrs", NULL}; static const raptor_type_q laqrs_types[] = { { NULL, 0, 0} }; static int rasqal_laqrs_query_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = laqrs_names; factory->desc.mime_types = laqrs_types; factory->desc.label = "LAQRS adds to Querying RDF in SPARQL"; factory->desc.uri_strings = NULL; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } int rasqal_init_query_language_laqrs(rasqal_world* world) { return !rasqal_query_language_register_factory(world, &rasqal_laqrs_query_language_register_factory); } #ifdef STANDALONE #include #include #ifdef HAVE_GETOPT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifndef HAVE_GETOPT #include #endif #ifdef NEED_OPTIND_DECLARATION extern int optind; extern char *optarg; #endif #define GETOPT_STRING "di:" #define SPARQL_FILE_BUF_SIZE 4096 static char query_string[SPARQL_FILE_BUF_SIZE]; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_query *query = NULL; FILE *fh; int rc; const char *filename = NULL; raptor_uri* base_uri = NULL; unsigned char *uri_string = NULL; const char* query_language = "sparql"; int usage = 0; rasqal_world *world; size_t read_len; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) exit(1); filename = getenv("SPARQL_QUERY_FILE"); while(!usage) { int c = getopt (argc, argv, GETOPT_STRING); if (c == -1) break; switch (c) { case 0: case '?': /* getopt() - unknown option */ usage = 1; break; case 'd': #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 sparql_parser_debug = 1; #endif break; case 'i': if(optarg) { if(rasqal_language_name_check(world, optarg)) { query_language = optarg; } else { fprintf(stderr, "%s: Unknown query language '%s'\n", program, optarg); usage = 1; } } break; } } if(!filename) { if((argc-optind) != 1) { fprintf(stderr, "%s: Too many arguments.\n", program); usage = 1; } else filename = argv[optind]; } if(usage) { fprintf(stderr, "SPARQL/LAQRS parser test for Rasqal %s\n", rasqal_version_string); fprintf(stderr, "USAGE: %s [OPTIONS] SPARQL-QUERY-FILE\n", program); fprintf(stderr, "OPTIONS:\n"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 fprintf(stderr, " -d Bison parser debugging\n"); #endif fprintf(stderr, " -i LANGUAGE Set query language\n"); rc = 1; goto tidy; } fh = fopen(filename, "r"); if(!fh) { fprintf(stderr, "%s: Cannot open file %s - %s\n", program, filename, strerror(errno)); rc = 1; goto tidy; } memset(query_string, 0, SPARQL_FILE_BUF_SIZE); read_len = fread(query_string, SPARQL_FILE_BUF_SIZE, 1, fh); if(read_len < SPARQL_FILE_BUF_SIZE) { if(ferror(fh)) { fprintf(stderr, "%s: file '%s' read failed - %s\n", program, filename, strerror(errno)); fclose(fh); rc = 1; goto tidy; } } fclose(fh); query = rasqal_new_query(world, query_language, NULL); rc = 1; if(query) { uri_string = raptor_uri_filename_to_uri_string(filename); if(uri_string) { base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); if(base_uri) { rc = rasqal_query_prepare(query, RASQAL_GOOD_CAST(const unsigned char*, query_string), base_uri); if(!rc) rasqal_query_print(query, stdout); } } } tidy: if(query) rasqal_free_query(query); if(base_uri) raptor_free_uri(base_uri); if(uri_string) raptor_free_memory(uri_string); if(world) rasqal_free_world(world); return rc; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal.h.in0000644000175000017500000022264212434455625012664 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal.h - Rasqal RDF Query library interfaces and definition * * 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. * */ #ifndef RASQAL_H #define RASQAL_H #ifdef __cplusplus extern "C" { #endif /** * RASQAL_VERSION: * * Rasqal library version number * * Format: major * 10000 + minor * 100 + release */ #define RASQAL_VERSION @RASQAL_VERSION_DECIMAL@ /** * RASQAL_VERSION_STRING: * * Rasqal library version string */ #define RASQAL_VERSION_STRING "@VERSION@" /** * RASQAL_VERSION_MAJOR: * * Rasqal library major version */ #define RASQAL_VERSION_MAJOR @RASQAL_VERSION_MAJOR@ /** * RASQAL_VERSION_MINOR: * * Rasqal library minor version */ #define RASQAL_VERSION_MINOR @RASQAL_VERSION_MINOR@ /** * RASQAL_VERSION_RELEASE: * * Rasqal library release */ #define RASQAL_VERSION_RELEASE @RASQAL_VERSION_RELEASE@ /** * RASQAL_API: * * Macro for wrapping API function call declarations. * */ #ifndef RASQAL_API # ifdef WIN32 # ifdef __GNUC__ # undef _declspec # define _declspec(x) __declspec(x) # endif # ifdef RASQAL_STATIC # define RASQAL_API # else # ifdef RASQAL_INTERNAL # define RASQAL_API _declspec(dllexport) # else # define RASQAL_API _declspec(dllimport) # endif # endif # else # define RASQAL_API # endif #endif /* Use gcc 3.1+ feature to allow marking of deprecated API calls. * This gives a warning during compiling. */ #if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3 #define RASQAL_DEPRECATED __attribute__((deprecated)) #else #define RASQAL_DEPRECATED #endif #ifndef LIBRDF_OBJC_FRAMEWORK #include #else #include #endif #if @HAVE_SYS_TIME_H@ #include #endif #if @HAVE_TIME_H@ #include #endif /* Public statics */ /** * rasqal_short_copyright_string: * * Short copyright string (one line). */ RASQAL_API extern const char * const rasqal_short_copyright_string; /** * rasqal_copyright_string: * * Copyright string (multiple lines). */ RASQAL_API extern const char * const rasqal_copyright_string; /** * rasqal_version_string: * * Rasqal version as a string. */ RASQAL_API extern const char * const rasqal_version_string; /** * rasqal_version_major: * * Rasqal major version number. */ RASQAL_API extern const unsigned int rasqal_version_major; /** * rasqal_version_minor: * * Rasqal minor version number. */ RASQAL_API extern const unsigned int rasqal_version_minor; /** * rasqal_version_release: * * Rasqal release version number. */ RASQAL_API extern const unsigned int rasqal_version_release; /** * rasqal_version_decimal: * * Rasqal version as a decimal number. * * Format: major * 10000 + minor * 100 + release */ RASQAL_API extern const unsigned int rasqal_version_decimal; /** * rasqal_license_string: * * Rasqal license string. */ RASQAL_API extern const char * const rasqal_license_string; /** * rasqal_home_url_string: * * Rasqal home page URL. */ RASQAL_API extern const char * const rasqal_home_url_string; /** * RASQAL_RAPTOR_VERSION: * * Version of Raptor that Rasqal was configured against. */ #define RASQAL_RAPTOR_VERSION @RAPTOR_VERSION_DEC@ /* Public structures */ #ifndef RASQAL_WORLD_DECLARED #define RASQAL_WORLD_DECLARED 1 /** * rasqal_world: * * Rasqal world class. */ typedef struct rasqal_world_s rasqal_world; #endif /** * rasqal_query: * * Rasqal query class. */ typedef struct rasqal_query_s rasqal_query; /** * rasqal_query_results: * * Rasqal query results class. */ typedef struct rasqal_query_results_s rasqal_query_results; #ifndef RASQAL_QUERY_RESULTS_FORMATTER_DECLARED #define RASQAL_QUERY_RESULTS_FORMATTER_DECLARED 1 /** * rasqal_query_results_formatter: * * Rasqal query results formatter class. */ typedef struct rasqal_query_results_formatter_s rasqal_query_results_formatter; #endif typedef struct rasqal_literal_s rasqal_literal; /** * rasqal_graph_pattern: * * Rasqal graph pattern class. */ typedef struct rasqal_graph_pattern_s rasqal_graph_pattern; /** * rasqal_variables_table: * * Rasqal variables table class. */ typedef struct rasqal_variables_table_s rasqal_variables_table; /** * rasqal_feature: * @RASQAL_FEATURE_NO_NET: Deny network requests. * @RASQAL_FEATURE_RAND_SEED: Set rand() / rand_r() seed * @RASQAL_FEATURE_LAST: Internal. * * Query features. * * None currently defined. */ typedef enum { RASQAL_FEATURE_NO_NET, RASQAL_FEATURE_RAND_SEED, RASQAL_FEATURE_LAST = RASQAL_FEATURE_RAND_SEED } rasqal_feature; /** * rasqal_prefix: * @world: rasqal_world object * @prefix: short prefix string * @uri: URI associated with the prefix. * @declared: Internal flag. * @depth: Internal flag. * * Namespace (prefix, uri) pair. * * Includes internal flags used for marking when prefixes are * declared and at what XML element depth when used in XML formats. */ typedef struct { rasqal_world* world; const unsigned char *prefix; raptor_uri* uri; int declared; int depth; } rasqal_prefix; /** * rasqal_variable_type: * @RASQAL_VARIABLE_TYPE_NORMAL: The regular variable type. * @RASQAL_VARIABLE_TYPE_ANONYMOUS: Anonymous variable type. * @RASQAL_VARIABLE_TYPE_UNKNOWN: Internal. * * Rasqal variable types. * * ANONYMOUS can be used in queries but cannot be returned in a * result. */ typedef enum { RASQAL_VARIABLE_TYPE_UNKNOWN = 0, RASQAL_VARIABLE_TYPE_NORMAL = 1, RASQAL_VARIABLE_TYPE_ANONYMOUS = 2 } rasqal_variable_type; /* forward reference */ struct rasqal_expression_s; /** * rasqal_variable: * @vars_table: variables table that owns this variable * @name: Variable name. * @value: Variable value or NULL if unbound. * @offset: Internal. * @type: Variable type. * @expression: Expression when the variable is a computed SELECT expression * @user_data: Pointer to user data associated with a variable. This is not used by rasqal. * @usage: reference count * * Binding between a variable name and a value. * * Includes internal field @offset for recording the offset into the * (internal) rasqal_query variables array. */ typedef struct { rasqal_variables_table* vars_table; const unsigned char *name; rasqal_literal* value; int offset; rasqal_variable_type type; struct rasqal_expression_s* expression; void *user_data; int usage; } rasqal_variable; /** * rasqal_data_graph_flags: * @RASQAL_DATA_GRAPH_NONE: Internal. * @RASQAL_DATA_GRAPH_NAMED: Graphs with a source and name. * @RASQAL_DATA_GRAPH_BACKGROUND: Graphs with a source only. * * Flags for the type of #rasqal_data_graph. * * These are used by rasqal_new_data_graph_from_uri() and * rasqal_new_data_graph_from_iostream(). See #rasqal_data_graph. */ typedef enum { RASQAL_DATA_GRAPH_NONE = 0, RASQAL_DATA_GRAPH_NAMED = 1, RASQAL_DATA_GRAPH_BACKGROUND = 2 } rasqal_data_graph_flags; /** * rasqal_data_graph: * @world: rasqal_world object * @uri: source URI * @name_uri: name of graph for %RASQAL_DATA_GRAPH_NAMED * @flags: %RASQAL_DATA_GRAPH_NAMED or %RASQAL_DATA_GRAPH_BACKGROUND * @format_type: MIME Type of data format at @uri (or NULL) * @format_name: Raptor parser Name of data format at @uri (or NULL) * @format_uri: URI of data format at @uri (or NULL) * @iostr: Raptor iostream for content, overriding @uri if present (or NULL) * @base_uri: base URI for reading from iostream * @usage: usage count of this object * * A source of RDF data for querying. * * If @iostr is present, the graph can be constructed by parsing the * iostream and using @base_uri as a base uri. Otherwise the graph * can be constructed from the graph at URI @uri. * * In either case the @name_uri is the graph name as long as @flags * is %RASQAL_DATA_GRAPH_NAMED */ typedef struct { rasqal_world* world; raptor_uri* uri; raptor_uri* name_uri; unsigned int flags; char* format_type; char* format_name; raptor_uri* format_uri; raptor_iostream* iostr; raptor_uri* base_uri; int usage; } rasqal_data_graph; /** * rasqal_literal_type: * @RASQAL_LITERAL_BLANK: RDF blank node literal (SPARQL r:bNode) * @RASQAL_LITERAL_URI: RDF URI Literal (SPARQL r:URI) * @RASQAL_LITERAL_STRING: RDF Plain Literal - no datatype (SPARQL r:Literal) * @RASQAL_LITERAL_XSD_STRING: String xsd:string * @RASQAL_LITERAL_BOOLEAN: Boolean literal xsd:boolean. * @RASQAL_LITERAL_INTEGER: Integer literal xsd:integer. * @RASQAL_LITERAL_DOUBLE: Double floating point literal xsd:double. * @RASQAL_LITERAL_FLOAT: Floating point literal xsd:float. * @RASQAL_LITERAL_DECIMAL: Decimal integer xsd:decimal. * @RASQAL_LITERAL_DATETIME: Date/Time literal xsd:dateTime. * @RASQAL_LITERAL_UDT: User defined typed literal with unknown datatype URI * @RASQAL_LITERAL_PATTERN: Pattern literal for a regex. * @RASQAL_LITERAL_QNAME: XML Qname literal. * @RASQAL_LITERAL_VARIABLE: Variable literal. * @RASQAL_LITERAL_DATE: Date literal xsd:date. * @RASQAL_LITERAL_INTEGER_SUBTYPE: Internal. * @RASQAL_LITERAL_UNKNOWN: Internal. * @RASQAL_LITERAL_FIRST_XSD: Internal. * @RASQAL_LITERAL_LAST_XSD: Internal. * @RASQAL_LITERAL_LAST: Internal. * * Types of literal. * * The order in the enumeration is significant as it encodes * the SPARQL term ordering conditions: * * Blank Nodes << IRIs << RDF literals << typed literals * * which coresponds to in enum values * * BLANK << URI << STRING << * (BOOLEAN | INTEGER | DOUBLE | FLOAT | DECIMAL | DATETIME | XSD_STRING) * * (RASQAL_LITERAL_FIRST_XSD ... RASQAL_LITERAL_LAST_XSD) * * Not used (internal): PATTERN, QNAME, VARIABLE * * See rasqal_literal_compare() when used with flags * %RASQAL_COMPARE_XQUERY */ typedef enum { /* internal */ RASQAL_LITERAL_UNKNOWN, RASQAL_LITERAL_BLANK, RASQAL_LITERAL_URI, RASQAL_LITERAL_STRING, RASQAL_LITERAL_XSD_STRING, RASQAL_LITERAL_BOOLEAN, RASQAL_LITERAL_INTEGER, RASQAL_LITERAL_FLOAT, RASQAL_LITERAL_DOUBLE, RASQAL_LITERAL_DECIMAL, RASQAL_LITERAL_DATETIME, /* internal */ RASQAL_LITERAL_FIRST_XSD = RASQAL_LITERAL_XSD_STRING, /* internal */ RASQAL_LITERAL_LAST_XSD = RASQAL_LITERAL_DATETIME, RASQAL_LITERAL_UDT, RASQAL_LITERAL_PATTERN, RASQAL_LITERAL_QNAME, RASQAL_LITERAL_VARIABLE, /* internal */ RASQAL_LITERAL_INTEGER_SUBTYPE, RASQAL_LITERAL_DATE, /* internal */ RASQAL_LITERAL_LAST = RASQAL_LITERAL_DATE } rasqal_literal_type; #define RASQAL_LITERAL_UDT_DEFINED 1 /** * rasqal_row: * * Rasqal Result Row class. */ typedef struct rasqal_row_s rasqal_row; /** * rasqal_xsd_decimal: * * Rasqal XSD Decimal class. */ typedef struct rasqal_xsd_decimal_s rasqal_xsd_decimal; /** * RASQAL_XSD_DATETIME_NO_TZ: * * Sentinel XSD Decimal timezone value indicating no timezone is present. */ #define RASQAL_XSD_DATETIME_NO_TZ (9999) /** * rasqal_xsd_date: * @year: year * @month: month 1-12 * @day: 1-31 * @timezone_minutes: minutes +/- against UTC or RASQAL_XSD_DATETIME_NO_TZ if there is no timezone in the dateTime. * @time_on_timeline: time on timeline of first instant of date in timezone * @have_tz: timezone flag: 'Z' if Zulu, 'Y' if has other timezone offset in @timezone_minutes, 'N' if there is no timezone * * XML schema date datatype (xsd:date) * * Examples of timezone fields: * "2010-01-02" : timezone_minutes RASQAL_XSD_DATETIME_NO_TZ, have_tz 'N' * "2010-01-02Z" : timezone_minutes 0, have_tz 'Z' * "2010-01-02+00:00" : timezone_minutes 0, have_tz 'Y' * "2010-01-02-01:00" : timezone_minutes -60, have_tz 'Y' */ typedef struct { signed int year; /* the following fields are integer values not characters */ unsigned char month; unsigned char day; signed short timezone_minutes; time_t time_on_timeline; char have_tz; } rasqal_xsd_date; /** * rasqal_xsd_datetime: * @year: year * @month: month 1-12 * @day: 1-31 * @hour: hour 0-23 * @minute: minute 0-59 * @second: second 0-60 (yes 60 is allowed for leap seconds) * @microseconds: microseconds * @timezone_minutes: minutes +/- against UTC or RASQAL_XSD_DATETIME_NO_TZ if there is no timezone in the dateTime. * @time_on_timeline: time on timeline * @have_tz: timezone flag: 'Z' if Zulu, 'Y' if has other timezone offset in @timezone_minutes, 'N' if there is no timezone * * XML Schema dateTime datatype (xsd:dateTime) * * Signed types are required for normalization process where a value * can be negative temporarily. * * Examples of timezone fields: * "2010-01-02T01:02:03" : timezone_minutes RASQAL_XSD_DATETIME_NO_TZ, have_tz 'N' * "2010-01-02T01:02:03Z" : timezone_minutes 0, have_tz 'Z' * "2010-01-02T01:02:03+00:00" : timezone_minutes 0, have_tz 'Y' * "2010-01-02T01:02:03-01:00" : timezone_minutes -60, have_tz 'Y' */ typedef struct { signed int year; unsigned char month; unsigned char day; /* the following fields are integer values not characters */ signed char hour; signed char minute; signed char second; signed int microseconds; signed short timezone_minutes; time_t time_on_timeline; char have_tz; } rasqal_xsd_datetime; /** * rasqal_literal: * @world: world object pointer * @usage: Usage count. * @type: Type of literal. * @string: String form of literal for literal types UTF-8 string, pattern, qname, blank, double, float, decimal, datetime. * @string_len: Length of @string. * @value: Alternate value content. * @language: Language for string literal type. * @datatype: Datatype for string literal type. * @flags: Flags for literal types * @parent_type: parent XSD type if any or RASQAL_LITERAL_UNKNOWN * @valid: >0 if literal format is a valid lexical form for this datatype. 0 if not valid. <0 if this has not been checked yet * * Rasqal literal class. * */ struct rasqal_literal_s { rasqal_world *world; int usage; rasqal_literal_type type; /* UTF-8 string, pattern, qname, blank, double, float, decimal, datetime */ const unsigned char *string; unsigned int string_len; union { /* integer and boolean types */ int integer; /* double and float */ double floating; /* uri (can be temporarily NULL if a qname, see flags below) */ raptor_uri* uri; /* variable */ rasqal_variable* variable; /* decimal */ rasqal_xsd_decimal* decimal; /* datetime */ rasqal_xsd_datetime* datetime; /* date */ rasqal_xsd_date* date; } value; /* for string */ char *language; raptor_uri *datatype; /* various flags for literal types: * pattern regex flags * string datatype of qname * uri qname of URI not yet expanded (temporary) */ const unsigned char *flags; rasqal_literal_type parent_type; int valid; }; /** * rasqal_op: * @RASQAL_EXPR_AND: Expression for AND(A, B) * @RASQAL_EXPR_OR: Expression for OR(A, B) * @RASQAL_EXPR_EQ: Expression for A equals B * @RASQAL_EXPR_NEQ: Expression for A not equals B. * @RASQAL_EXPR_LT: Expression for A less than B. * @RASQAL_EXPR_GT: Expression for A greather than B. * @RASQAL_EXPR_LE: Expression for A less than or equal to B. * @RASQAL_EXPR_GE: Expression for A greater than or equal to B. * @RASQAL_EXPR_UMINUS: Expression for -A. * @RASQAL_EXPR_PLUS: Expression for +A. * @RASQAL_EXPR_MINUS: Expression for A-B. * @RASQAL_EXPR_STAR: Expression for A*B. * @RASQAL_EXPR_SLASH: Expression for A/B. * @RASQAL_EXPR_REM: Expression for A/B remainder. * @RASQAL_EXPR_STR_EQ: Expression for A string equals B. * @RASQAL_EXPR_STR_NEQ: Expression for A string not-equals B. * @RASQAL_EXPR_STR_MATCH: Expression for string A matches literal regex B with flags. * @RASQAL_EXPR_STR_NMATCH: Expression for string A not-matches literal regex B with flags. * @RASQAL_EXPR_REGEX: Expression for string A matches expression regex B with flags. * @RASQAL_EXPR_TILDE: Expression for binary not A. * @RASQAL_EXPR_BANG: Expression for logical not A. * @RASQAL_EXPR_LITERAL: Expression for a #rasqal_literal. * @RASQAL_EXPR_FUNCTION: Expression for a function A with arguments (B...). * @RASQAL_EXPR_BOUND: Expression for SPARQL ISBOUND(A). * @RASQAL_EXPR_STR: Expression for SPARQL STR(A). * @RASQAL_EXPR_LANG: Expression for SPARQL LANG(A). * @RASQAL_EXPR_LANGMATCHES: Expression for SPARQL LANGMATCHES(A, B). * @RASQAL_EXPR_DATATYPE: Expression for SPARQL DATATYPE(A). * @RASQAL_EXPR_ISURI: Expression for SPARQL ISURI(A). * @RASQAL_EXPR_ISBLANK: Expression for SPARQL ISBLANK(A). * @RASQAL_EXPR_ISLITERAL: Expression for SPARQL ISLITERAL(A). * @RASQAL_EXPR_CAST: Expression for cast literal A to type B. * @RASQAL_EXPR_ORDER_COND_ASC: Expression for SPARQL order condition ascending. * @RASQAL_EXPR_ORDER_COND_DESC: Expression for SPARQL order condition descending. * @RASQAL_EXPR_GROUP_COND_ASC: Obsolete - not used * @RASQAL_EXPR_GROUP_COND_DESC: Obsolete - not used * @RASQAL_EXPR_COUNT: Expression for LAQRS select COUNT() aggregate function * @RASQAL_EXPR_VARSTAR: Expression for LAQRS select Variable * * @RASQAL_EXPR_SAMETERM: Expression for SPARQL sameTerm * @RASQAL_EXPR_SUM: Expression for LAQRS select SUM() aggregate function * @RASQAL_EXPR_AVG: Expression for LAQRS select AVG() aggregate function * @RASQAL_EXPR_MIN: Expression for LAQRS select MIN() aggregate function * @RASQAL_EXPR_MAX: Expression for LAQRS select MAX() aggregate function * @RASQAL_EXPR_COALESCE: Expression for LAQRS COALESCE(Expr+) * @RASQAL_EXPR_IF: Expression for LAQRS IF(expr, expr, expr) * @RASQAL_EXPR_URI: Expression for LAQRS URI(expr) * @RASQAL_EXPR_IRI: Expression for LAQRS IRI(expr) * @RASQAL_EXPR_STRLANG: Expression for LAQRS STRLANG(expr, expr) * @RASQAL_EXPR_STRDT: Expression for LAQRS STRDT(expr, expr) * @RASQAL_EXPR_BNODE: Expression for LAQRS BNODE() and BNODE(expr) * @RASQAL_EXPR_GROUP_CONCAT: Expression for LAQRS GROUP_CONCAT(arglist) aggregate function * @RASQAL_EXPR_SAMPLE: Expression for LAQRS SAMPLE(expr) aggregate function * @RASQAL_EXPR_IN: Expression for LAQRS expr IN ( list of expr ) * @RASQAL_EXPR_NOT_IN: Expression for LAQRS expr NOT IN ( list of expr ) * @RASQAL_EXPR_ISNUMERIC: Expression for SPARQL 1.1 isNUMERIC(expr) * @RASQAL_EXPR_YEAR: Expression for SPARQL 1.1 YEAR(datetime) * @RASQAL_EXPR_MONTH: Expression for SPARQL 1.1 MONTH(datetime) * @RASQAL_EXPR_DAY: Expression for SPARQL 1.1 DAY(datetime) * @RASQAL_EXPR_HOURS: Expression for SPARQL 1.1 HOURS(datetime) * @RASQAL_EXPR_MINUTES: Expression for SPARQL 1.1 MINUTES(datetime) * @RASQAL_EXPR_SECONDS: Expression for SPARQL 1.1 SECONDS(datetime) * @RASQAL_EXPR_TIMEZONE: Expression for SPARQL 1.1 TIMEZONE(datetime) * @RASQAL_EXPR_CURRENT_DATETIME: Expression for LAQRS CURRENT_DATETIME( void ) * @RASQAL_EXPR_NOW: Expression for LAQRS NOW( void ) * @RASQAL_EXPR_FROM_UNIXTIME: Expression for LAQRS FROM_UNIXTIME(int) * @RASQAL_EXPR_TO_UNIXTIME: Expression for LAQRS TO_UNIXTIME(datetime) * @RASQAL_EXPR_CONCAT: Expression for SPARQL 1.1 CONCAT(strings) * @RASQAL_EXPR_STRLEN: Expression for SPARQL 1.1 STRLEN(str) * @RASQAL_EXPR_SUBSTR: Expression for SPARQL 1.1 SUBSTR(str, start[,offset]) * @RASQAL_EXPR_UCASE: Expression for SPARQL 1.1 UCASE(str) * @RASQAL_EXPR_LCASE: Expression for SPARQL 1.1 LCASE(str) * @RASQAL_EXPR_STRSTARTS: Expression for SPARQL 1.1 STRSTARTS(str, str) * @RASQAL_EXPR_STRENDS: Expression for SPARQL 1.1 STRENDS(str, str) * @RASQAL_EXPR_CONTAINS: Expression for SPARQL 1.1 CONTAINS(str, str) * @RASQAL_EXPR_ENCODE_FOR_URI: Expression for SPARQL 1.1 ENCODE_FOR_URI(str) * @RASQAL_EXPR_TZ: Expression for SPARQL 1.1 TZ() * @RASQAL_EXPR_RAND: Expression for SPARQL 1.1 RAND() * @RASQAL_EXPR_ABS: Expression for SPARQL 1.1 ABS() * @RASQAL_EXPR_ROUND: Expression for SPARQL 1.1 ROUND() * @RASQAL_EXPR_CEIL: Expression for SPARQL 1.1 CEIL() * @RASQAL_EXPR_FLOOR: Expression for SPARQL 1.1 FLOOR() * @RASQAL_EXPR_MD5: Expression for SPARQL 1.1 MD5() * @RASQAL_EXPR_SHA1: Expression for SPARQL 1.1 SHA1() * @RASQAL_EXPR_SHA224: Expression for SPARQL 1.1 SHA224() * @RASQAL_EXPR_SHA256: Expression for SPARQL 1.1 SHA256() * @RASQAL_EXPR_SHA384: Expression for SPARQL 1.1 SHA384() * @RASQAL_EXPR_SHA512: Expression for SPARQL 1.1 SHA512() * @RASQAL_EXPR_STRBEFORE: Expression for SPARQL 1.1 STRBEFORE() * @RASQAL_EXPR_STRAFTER: Expression for SPARQL 1.1 STRAFTER() * @RASQAL_EXPR_REPLACE: Expression for SPARQL 1.1 REPLACE() * @RASQAL_EXPR_UUID: Expression for SPARQL 1.1 UUID() * @RASQAL_EXPR_STRUUID: Expression for SPARQL 1.1 STRUUID() * @RASQAL_EXPR_UNKNOWN: Internal * @RASQAL_EXPR_LAST: Internal * * Rasqal expression operators. A mixture of unary, binary and * tertiary operators (string matches). Also includes casting and * two ordering operators from ORDER BY in SPARQL. */ typedef enum { /* internal */ RASQAL_EXPR_UNKNOWN, RASQAL_EXPR_AND, RASQAL_EXPR_OR, RASQAL_EXPR_EQ, RASQAL_EXPR_NEQ, RASQAL_EXPR_LT, RASQAL_EXPR_GT, RASQAL_EXPR_LE, RASQAL_EXPR_GE, RASQAL_EXPR_UMINUS, RASQAL_EXPR_PLUS, RASQAL_EXPR_MINUS, RASQAL_EXPR_STAR, RASQAL_EXPR_SLASH, RASQAL_EXPR_REM, RASQAL_EXPR_STR_EQ, RASQAL_EXPR_STR_NEQ, RASQAL_EXPR_STR_MATCH, RASQAL_EXPR_STR_NMATCH, RASQAL_EXPR_TILDE, RASQAL_EXPR_BANG, RASQAL_EXPR_LITERAL, RASQAL_EXPR_FUNCTION, RASQAL_EXPR_BOUND, RASQAL_EXPR_STR, RASQAL_EXPR_LANG, RASQAL_EXPR_DATATYPE, RASQAL_EXPR_ISURI, RASQAL_EXPR_ISBLANK, RASQAL_EXPR_ISLITERAL, RASQAL_EXPR_CAST, RASQAL_EXPR_ORDER_COND_ASC, RASQAL_EXPR_ORDER_COND_DESC, RASQAL_EXPR_LANGMATCHES, RASQAL_EXPR_REGEX, RASQAL_EXPR_GROUP_COND_ASC, RASQAL_EXPR_GROUP_COND_DESC, RASQAL_EXPR_COUNT, RASQAL_EXPR_VARSTAR, RASQAL_EXPR_SAMETERM, RASQAL_EXPR_SUM, RASQAL_EXPR_AVG, RASQAL_EXPR_MIN, RASQAL_EXPR_MAX, RASQAL_EXPR_COALESCE, RASQAL_EXPR_IF, RASQAL_EXPR_URI, RASQAL_EXPR_IRI, RASQAL_EXPR_STRLANG, RASQAL_EXPR_STRDT, RASQAL_EXPR_BNODE, RASQAL_EXPR_GROUP_CONCAT, RASQAL_EXPR_SAMPLE, RASQAL_EXPR_IN, RASQAL_EXPR_NOT_IN, RASQAL_EXPR_ISNUMERIC, RASQAL_EXPR_YEAR, RASQAL_EXPR_MONTH, RASQAL_EXPR_DAY, RASQAL_EXPR_HOURS, RASQAL_EXPR_MINUTES, RASQAL_EXPR_SECONDS, RASQAL_EXPR_TIMEZONE, RASQAL_EXPR_CURRENT_DATETIME, RASQAL_EXPR_NOW, RASQAL_EXPR_FROM_UNIXTIME, RASQAL_EXPR_TO_UNIXTIME, RASQAL_EXPR_CONCAT, RASQAL_EXPR_STRLEN, RASQAL_EXPR_SUBSTR, RASQAL_EXPR_UCASE, RASQAL_EXPR_LCASE, RASQAL_EXPR_STRSTARTS, RASQAL_EXPR_STRENDS, RASQAL_EXPR_CONTAINS, RASQAL_EXPR_ENCODE_FOR_URI, RASQAL_EXPR_TZ, RASQAL_EXPR_RAND, RASQAL_EXPR_ABS, RASQAL_EXPR_ROUND, RASQAL_EXPR_CEIL, RASQAL_EXPR_FLOOR, RASQAL_EXPR_MD5, RASQAL_EXPR_SHA1, RASQAL_EXPR_SHA224, RASQAL_EXPR_SHA256, RASQAL_EXPR_SHA384, RASQAL_EXPR_SHA512, RASQAL_EXPR_STRBEFORE, RASQAL_EXPR_STRAFTER, RASQAL_EXPR_REPLACE, RASQAL_EXPR_UUID, RASQAL_EXPR_STRUUID, /* internal */ RASQAL_EXPR_LAST = RASQAL_EXPR_STRUUID } rasqal_op; /** * rasqal_expression_flags: * @RASQAL_EXPR_FLAG_DISTINCT: Distinct * @RASQAL_EXPR_FLAG_AGGREGATE: Aggregate function expression * * Flags for expressions. */ typedef enum { RASQAL_EXPR_FLAG_DISTINCT = 1, RASQAL_EXPR_FLAG_AGGREGATE = 2 } rasqal_expression_flags; /** * rasqal_expression: * @world: rasqal_world object * @usage: reference count - 1 for itself * @op: expression operation * @arg1: first argument * @arg2: second argument * @arg3: third argument (for #RASQAL_EXPR_REGEX ) * @literal: literal argument * @value: UTF-8 value * @name: name for extension function qname(args...) and cast-to-uri * @args: args for extension function qname(args...), cast-to-uri and COALESCE * @params: args for extension function parameters (SPARQL 1.1) (Rasqal 0.9.20+) * @flags: bitflags from #rasqal_expression_flags for expressions (Rasqal 0.9.20+) * @arg4: fourth argument (for #RASQAL_EXPR_REPLACE ) * * Expression with arguments * */ struct rasqal_expression_s { rasqal_world* world; int usage; rasqal_op op; struct rasqal_expression_s* arg1; struct rasqal_expression_s* arg2; struct rasqal_expression_s* arg3; rasqal_literal* literal; unsigned char *value; raptor_uri* name; raptor_sequence* args; raptor_sequence* params; unsigned int flags; struct rasqal_expression_s* arg4; }; typedef struct rasqal_expression_s rasqal_expression; /** * rasqal_triple: * @subject: Triple subject. * @predicate: Triple predicate. * @object: Triple object. * @origin: Triple origin. * @flags: Or of enum #rasqal_triple_flags bits. * * A triple pattern or RDF triple. * * This is used as a triple pattern in queries and * an RDF triple when generating RDF triples such as with SPARQL CONSTRUCT. */ typedef struct { rasqal_literal* subject; rasqal_literal* predicate; rasqal_literal* object; rasqal_literal* origin; unsigned int flags; } rasqal_triple; /** * rasqal_pattern_flags: * @RASQAL_PATTERN_FLAGS_OPTIONAL: True when the graph pattern is an optional match. * @RASQAL_PATTERN_FLAGS_LAST: Internal * * Flags for #rasqal_graph_pattern. */ typedef enum { RASQAL_PATTERN_FLAGS_OPTIONAL = 1, RASQAL_PATTERN_FLAGS_LAST = RASQAL_PATTERN_FLAGS_OPTIONAL } rasqal_pattern_flags; /** * rasqal_generate_bnodeid_handler: * @world: world arg * @user_data: user data given to * @user_bnodeid: user blank node ID string passed in * * User handler used with rasqal_world_set_generate_bnodeid_handler() to set method for generating a blank node ID. * * Return value: blank node ID string or NULL on failure. */ typedef unsigned char* (*rasqal_generate_bnodeid_handler)(rasqal_world* world, void *user_data, unsigned char *user_bnodeid); /** * rasqal_query_verb: * @RASQAL_QUERY_VERB_SELECT: SPARQL query select verb. * @RASQAL_QUERY_VERB_CONSTRUCT: SPARQL query construct verb. * @RASQAL_QUERY_VERB_DESCRIBE: SPARQL query describe verb. * @RASQAL_QUERY_VERB_ASK: SPARQL query ask verb. * @RASQAL_QUERY_VERB_DELETE: LAQRS query delete verb. * @RASQAL_QUERY_VERB_INSERT: LAQRS query insert verb. * @RASQAL_QUERY_VERB_UPDATE: SPARQL 1.1 (draft) update operation * @RASQAL_QUERY_VERB_UNKNOWN: Internal * @RASQAL_QUERY_VERB_LAST: Internal * * Query main operation verbs describing the major type of query * being performed. */ typedef enum { /* internal */ RASQAL_QUERY_VERB_UNKNOWN = 0, RASQAL_QUERY_VERB_SELECT = 1, RASQAL_QUERY_VERB_CONSTRUCT = 2, RASQAL_QUERY_VERB_DESCRIBE = 3, RASQAL_QUERY_VERB_ASK = 4, RASQAL_QUERY_VERB_DELETE = 5, RASQAL_QUERY_VERB_INSERT = 6, RASQAL_QUERY_VERB_UPDATE = 7, /* internal */ RASQAL_QUERY_VERB_LAST = RASQAL_QUERY_VERB_UPDATE } rasqal_query_verb; /** * rasqal_query_results_type: * @RASQAL_QUERY_RESULTS_BINDINGS: variable binding * @RASQAL_QUERY_RESULTS_BOOLEAN: a single boolean * @RASQAL_QUERY_RESULTS_GRAPH: an RDF graph * @RASQAL_QUERY_RESULTS_SYNTAX: a syntax * @RASQAL_QUERY_RESULTS_UNKNOWN: unknown type * @RASQAL_QUERY_RESULTS_LAST: internal * * Query result type. */ typedef enum { RASQAL_QUERY_RESULTS_BINDINGS, RASQAL_QUERY_RESULTS_BOOLEAN, RASQAL_QUERY_RESULTS_GRAPH, RASQAL_QUERY_RESULTS_SYNTAX, RASQAL_QUERY_RESULTS_UNKNOWN, RASQAL_QUERY_RESULTS_LAST = RASQAL_QUERY_RESULTS_UNKNOWN } rasqal_query_results_type; /** * rasqal_update_type: * @RASQAL_UPDATE_TYPE_CLEAR: Clear graph. * @RASQAL_UPDATE_TYPE_CREATE: Create graph. * @RASQAL_UPDATE_TYPE_DROP: Drop graph. * @RASQAL_UPDATE_TYPE_LOAD: Load graph. * @RASQAL_UPDATE_TYPE_UPDATE: Insert or Delete graph or triples. * @RASQAL_UPDATE_TYPE_ADD: Add graph to another graph. * @RASQAL_UPDATE_TYPE_MOVE: Move graph to another grpah. * @RASQAL_UPDATE_TYPE_COPY: Copy graph to another graph. * @RASQAL_UPDATE_TYPE_UNKNOWN: Internal * @RASQAL_UPDATE_TYPE_LAST: Internal * * Update type being performed. * */ typedef enum { /* internal */ RASQAL_UPDATE_TYPE_UNKNOWN = 0, RASQAL_UPDATE_TYPE_CLEAR = 1, RASQAL_UPDATE_TYPE_CREATE = 2, RASQAL_UPDATE_TYPE_DROP = 3, RASQAL_UPDATE_TYPE_LOAD = 4, RASQAL_UPDATE_TYPE_UPDATE = 5, RASQAL_UPDATE_TYPE_ADD = 6, RASQAL_UPDATE_TYPE_MOVE = 7, RASQAL_UPDATE_TYPE_COPY = 8, /* internal */ RASQAL_UPDATE_TYPE_LAST = RASQAL_UPDATE_TYPE_COPY } rasqal_update_type; /** * rasqal_update_flags: * @RASQAL_UPDATE_FLAGS_SILENT: the update operation should be silent * @RASQAL_UPDATE_FLAGS_DATA: the update operation is triple data not templates * * Bitflags for graph update operations */ typedef enum { RASQAL_UPDATE_FLAGS_SILENT = 1, RASQAL_UPDATE_FLAGS_DATA = 2 } rasqal_update_flags; /** * rasqal_update_graph_applies: * @RASQAL_UPDATE_GRAPH_ONE: the update operation applies to 1 graph * @RASQAL_UPDATE_GRAPH_DEFAULT: the update operation applies to the default graph * @RASQAL_UPDATE_GRAPH_NAMED: the update operation applies to all named graphs * @RASQAL_UPDATE_GRAPH_ALL: the update operation applies ALL graphs * * The graph(s) that the update operation applies to. */ typedef enum { RASQAL_UPDATE_GRAPH_ONE = 0, RASQAL_UPDATE_GRAPH_DEFAULT = 1, RASQAL_UPDATE_GRAPH_NAMED = 2, RASQAL_UPDATE_GRAPH_ALL = 3 } rasqal_update_graph_applies; /** * rasqal_update_operation: * @type: type of update * @graph_uri: optional graph URI (clear, drop, load, with ... delete, insert); source graph (add, move, copy) * @document_uri: optional document URI (load); destination graph (add, move, copy) * @insert_templates: optional sequence of #rasqal_triple to insert. Data triples if @flags is #RASQAL_UPDATE_FLAGS_DATA set, templates otherwise. * @delete_templates: optional sequence of #rasqal_triple templates to delete * @where: optional where template (insert/delete) * @flags: update flags - bit-or of flags defined in #rasqal_update_flags * @applies: the graph(s) that the update operation applies to, or @graph_uri if #RASQAL_UPDATE_GRAPH_ONE * * Update operation - changing the dataset * * For LOAD and CLEAR if @applies is set (not 0) then the operation * applies to just those graph(), otherwise it applies to the @graph_uri. * * For ADD, MOVE and COPY the source graph is stored in @graph_uri * field and the destination graph in the @document_uri field. The * field names have no meaning in this case since both values are * always present, always graphs and a NULL value signifies the * default graph. * */ typedef struct { rasqal_update_type type; raptor_uri* graph_uri; raptor_uri* document_uri; raptor_sequence* insert_templates; raptor_sequence* delete_templates; rasqal_graph_pattern* where; int flags; rasqal_update_graph_applies applies; } rasqal_update_operation; /** * rasqal_graph_pattern_operator: * @RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: Just triple patterns and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: Set of graph patterns (ANDed) and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_UNION: Set of graph patterns (UNIONed) and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: Set of graph patterns (ANDed) and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: A graph term + a graph pattern and constraints. * @RASQAL_GRAPH_PATTERN_OPERATOR_FILTER: A filter graph pattern with an expression * @RASQAL_GRAPH_PATTERN_OPERATOR_LET: LET ?var := Expression (LAQRS) * @RASQAL_GRAPH_PATTERN_OPERATOR_SELECT: SELECT graph pattern * @RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE: SERVICE graph pattern * @RASQAL_GRAPH_PATTERN_OPERATOR_MINUS: MINUS graph pattern * @RASQAL_GRAPH_PATTERN_OPERATOR_VALUES: VALUES graph pattern * @RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: Internal. * @RASQAL_GRAPH_PATTERN_OPERATOR_LAST: Internal. * * Graph pattern operators */ typedef enum { RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN = 0, RASQAL_GRAPH_PATTERN_OPERATOR_BASIC = 1, RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL = 2, RASQAL_GRAPH_PATTERN_OPERATOR_UNION = 3, RASQAL_GRAPH_PATTERN_OPERATOR_GROUP = 4, RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH = 5, RASQAL_GRAPH_PATTERN_OPERATOR_FILTER = 6, RASQAL_GRAPH_PATTERN_OPERATOR_LET = 7, RASQAL_GRAPH_PATTERN_OPERATOR_SELECT = 8, RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE = 9, RASQAL_GRAPH_PATTERN_OPERATOR_MINUS = 10, RASQAL_GRAPH_PATTERN_OPERATOR_VALUES = 11, RASQAL_GRAPH_PATTERN_OPERATOR_LAST = RASQAL_GRAPH_PATTERN_OPERATOR_VALUES } rasqal_graph_pattern_operator; /** * rasqal_graph_pattern_visit_fn: * @query: #rasqal_query containing the graph pattern * @gp: current graph_pattern * @user_data: user data passed in * * User function to visit an graph_pattern and operate on it with * rasqal_graph_pattern_visit() or rasqal_query_graph_pattern_visit() * * Return value: non-0 to truncate the visit */ typedef int (*rasqal_graph_pattern_visit_fn)(rasqal_query* query, rasqal_graph_pattern* gp, void *user_data); /* RASQAL API */ /* Public functions */ RASQAL_API rasqal_world *rasqal_new_world(void); RASQAL_API int rasqal_world_open(rasqal_world* world); RASQAL_API void rasqal_free_world(rasqal_world* world); RASQAL_API void rasqal_world_set_raptor(rasqal_world* world, raptor_world* raptor_world_ptr); RASQAL_API raptor_world *rasqal_world_get_raptor(rasqal_world* world); RASQAL_API void rasqal_world_set_log_handler(rasqal_world* world, void *user_data, raptor_log_handler handler); RASQAL_API int rasqal_world_set_default_generate_bnodeid_parameters(rasqal_world* world, char *prefix, int base); RASQAL_API int rasqal_world_set_generate_bnodeid_handler(rasqal_world* world, void *user_data, rasqal_generate_bnodeid_handler handler); RASQAL_API int rasqal_world_set_warning_level(rasqal_world* world, unsigned int warning_level); RASQAL_API const raptor_syntax_description* rasqal_world_get_query_results_format_description(rasqal_world* world, unsigned int counter); RASQAL_API const char* rasqal_world_guess_query_results_format_name(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier); /* Features */ RASQAL_API int rasqal_features_enumerate(rasqal_world* world, const rasqal_feature feature, const char **name, raptor_uri **uri, const char **label); RASQAL_API unsigned int rasqal_get_feature_count(void); RASQAL_API rasqal_feature rasqal_feature_from_uri(rasqal_world* world, raptor_uri *uri); RASQAL_API int rasqal_feature_value_type(const rasqal_feature feature); RASQAL_API const raptor_syntax_description* rasqal_world_get_query_language_description(rasqal_world* world, unsigned int counter); RASQAL_API RASQAL_DEPRECATED int rasqal_languages_enumerate(rasqal_world* world, unsigned int counter, const char **name, const char **label, const unsigned char **uri_string); RASQAL_API int rasqal_language_name_check(rasqal_world* world, const char *name); /* Query class */ /* Create */ RASQAL_API rasqal_query* rasqal_new_query(rasqal_world* world, const char *name, const unsigned char *uri); /* Destroy */ RASQAL_API void rasqal_free_query(rasqal_query* query); /* Methods */ RASQAL_API const char* rasqal_query_get_name(rasqal_query* query); RASQAL_API const char* rasqal_query_get_label(rasqal_query* query); RASQAL_API int rasqal_query_set_feature(rasqal_query* query, rasqal_feature feature, int value); RASQAL_API int rasqal_query_set_feature_string(rasqal_query *query, rasqal_feature feature, const unsigned char *value); RASQAL_API int rasqal_query_get_feature(rasqal_query *query, rasqal_feature feature); RASQAL_API const unsigned char* rasqal_query_get_feature_string(rasqal_query *query, rasqal_feature feature); RASQAL_API rasqal_query_verb rasqal_query_get_verb(rasqal_query* query); RASQAL_API int rasqal_query_get_wildcard(rasqal_query* query); RASQAL_API void rasqal_query_set_wildcard(rasqal_query* query, int wildcard); RASQAL_API int rasqal_query_get_distinct(rasqal_query* query); RASQAL_API void rasqal_query_set_distinct(rasqal_query* query, int distinct_mode); RASQAL_API int rasqal_query_get_explain(rasqal_query* query); RASQAL_API void rasqal_query_set_explain(rasqal_query* query, int is_explain); RASQAL_API int rasqal_query_get_limit(rasqal_query* query); RASQAL_API void rasqal_query_set_limit(rasqal_query* query, int limit); RASQAL_API int rasqal_query_get_offset(rasqal_query* query); RASQAL_API void rasqal_query_set_offset(rasqal_query* query, int offset); RASQAL_API int rasqal_query_add_data_graph(rasqal_query* query, rasqal_data_graph* data_graph); RASQAL_API int rasqal_query_add_data_graphs(rasqal_query* query, raptor_sequence* data_graphs); RASQAL_API raptor_sequence* rasqal_query_get_data_graph_sequence(rasqal_query* query); RASQAL_API rasqal_data_graph* rasqal_query_get_data_graph(rasqal_query* query, int idx); RASQAL_API int rasqal_query_dataset_contains_named_graph(rasqal_query* query, raptor_uri *graph_uri); RASQAL_API int rasqal_query_add_variable(rasqal_query* query, rasqal_variable* var); RASQAL_API raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal_query* query); RASQAL_API raptor_sequence* rasqal_query_get_describe_sequence(rasqal_query* query); RASQAL_API raptor_sequence* rasqal_query_get_anonymous_variable_sequence(rasqal_query* query); RASQAL_API raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_query* query); RASQAL_API rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx); RASQAL_API int rasqal_query_has_variable2(rasqal_query* query, rasqal_variable_type type, const unsigned char *name); RASQAL_API RASQAL_DEPRECATED int rasqal_query_has_variable(rasqal_query* query, const unsigned char *name); RASQAL_API int rasqal_query_set_variable2(rasqal_query* query, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value); RASQAL_API RASQAL_DEPRECATED int rasqal_query_set_variable(rasqal_query* query, const unsigned char *name, rasqal_literal* value); RASQAL_API raptor_sequence* rasqal_query_get_triple_sequence(rasqal_query* query); RASQAL_API rasqal_triple* rasqal_query_get_triple(rasqal_query* query, int idx); RASQAL_API int rasqal_query_add_prefix(rasqal_query* query, rasqal_prefix* prefix); RASQAL_API raptor_sequence* rasqal_query_get_prefix_sequence(rasqal_query* query); RASQAL_API rasqal_prefix* rasqal_query_get_prefix(rasqal_query* query, int idx); RASQAL_API raptor_sequence* rasqal_query_get_order_conditions_sequence(rasqal_query* query); RASQAL_API rasqal_expression* rasqal_query_get_order_condition(rasqal_query* query, int idx); RASQAL_API raptor_sequence* rasqal_query_get_group_conditions_sequence(rasqal_query* query); RASQAL_API rasqal_expression* rasqal_query_get_group_condition(rasqal_query* query, int idx); RASQAL_API raptor_sequence* rasqal_query_get_having_conditions_sequence(rasqal_query* query); RASQAL_API rasqal_expression* rasqal_query_get_having_condition(rasqal_query* query, int idx); RASQAL_API raptor_sequence* rasqal_query_get_construct_triples_sequence(rasqal_query* query); RASQAL_API rasqal_triple* rasqal_query_get_construct_triple(rasqal_query* query, int idx); RASQAL_API RASQAL_DEPRECATED void rasqal_query_graph_pattern_visit(rasqal_query* query, rasqal_graph_pattern_visit_fn visit_fn, void* data); RASQAL_API int rasqal_query_graph_pattern_visit2(rasqal_query* query, rasqal_graph_pattern_visit_fn visit_fn, void* data); RASQAL_API int rasqal_query_write(raptor_iostream* iostr, rasqal_query* query, raptor_uri* format_uri, raptor_uri* base_uri); /* update */ RASQAL_API raptor_sequence* rasqal_query_get_update_operations_sequence(rasqal_query* query); RASQAL_API rasqal_update_operation* rasqal_query_get_update_operation(rasqal_query* query, int idx); /* results */ int rasqal_query_set_store_results(rasqal_query* query, int store_results); /* graph patterns */ RASQAL_API rasqal_graph_pattern* rasqal_query_get_query_graph_pattern(rasqal_query* query); RASQAL_API raptor_sequence* rasqal_query_get_graph_pattern_sequence(rasqal_query* query); RASQAL_API rasqal_graph_pattern* rasqal_query_get_graph_pattern(rasqal_query* query, int idx); RASQAL_API int rasqal_graph_pattern_add_sub_graph_pattern(rasqal_graph_pattern* graph_pattern, rasqal_graph_pattern* sub_graph_pattern); RASQAL_API rasqal_triple* rasqal_graph_pattern_get_triple(rasqal_graph_pattern* graph_pattern, int idx); RASQAL_API raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequence(rasqal_graph_pattern* graph_pattern); RASQAL_API rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern(rasqal_graph_pattern* graph_pattern, int idx); RASQAL_API rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator(rasqal_graph_pattern* graph_pattern); RASQAL_API const char* rasqal_graph_pattern_operator_as_string(rasqal_graph_pattern_operator op); RASQAL_API int rasqal_graph_pattern_print(rasqal_graph_pattern* gp, FILE* fh); RASQAL_API int rasqal_graph_pattern_set_filter_expression(rasqal_graph_pattern* gp, rasqal_expression* expr); RASQAL_API rasqal_expression* rasqal_graph_pattern_get_filter_expression(rasqal_graph_pattern* gp); RASQAL_API int rasqal_graph_pattern_visit(rasqal_query* query, rasqal_graph_pattern *gp, rasqal_graph_pattern_visit_fn fn, void* user_data); RASQAL_API int rasqal_graph_pattern_get_index(rasqal_graph_pattern* gp); RASQAL_API int rasqal_graph_pattern_variable_bound_in(rasqal_graph_pattern *gp, rasqal_variable *v); RASQAL_API rasqal_literal* rasqal_graph_pattern_get_origin(rasqal_graph_pattern* graph_pattern); RASQAL_API rasqal_variable* rasqal_graph_pattern_get_variable(rasqal_graph_pattern* graph_pattern); RASQAL_API rasqal_literal* rasqal_graph_pattern_get_service(rasqal_graph_pattern* graph_pattern); RASQAL_API raptor_sequence* rasqal_graph_pattern_get_flattened_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern); RASQAL_API raptor_sequence* rasqal_graph_pattern_get_triples(rasqal_query* query, rasqal_graph_pattern* graph_pattern); /* Utility methods */ RASQAL_API const char* rasqal_query_verb_as_string(rasqal_query_verb verb); RASQAL_API int rasqal_query_print(rasqal_query* query, FILE* fh); /* Query */ RASQAL_API int rasqal_query_prepare(rasqal_query* query, const unsigned char *query_string, raptor_uri *base_uri); RASQAL_API rasqal_query_results* rasqal_query_execute(rasqal_query* query); RASQAL_API void* rasqal_query_get_user_data(rasqal_query* query); RASQAL_API void rasqal_query_set_user_data(rasqal_query* query, void *user_data); RASQAL_API raptor_sequence* rasqal_query_get_bindings_variables_sequence(rasqal_query* query); RASQAL_API rasqal_variable* rasqal_query_get_bindings_variable(rasqal_query* query, int idx); RASQAL_API raptor_sequence* rasqal_query_get_bindings_rows_sequence(rasqal_query* query); RASQAL_API rasqal_row* rasqal_query_get_bindings_row(rasqal_query* query, int idx); RASQAL_API rasqal_query_results_type rasqal_query_get_result_type(rasqal_query* query); /* query results */ RASQAL_API rasqal_query_results* rasqal_new_query_results2(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type); RASQAL_API RASQAL_DEPRECATED rasqal_query_results* rasqal_new_query_results(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type, rasqal_variables_table* vars_table); RASQAL_API rasqal_query_results* rasqal_new_query_results_from_string(rasqal_world* world, rasqal_query_results_type type, raptor_uri* base_uri, const char* string, size_t string_len); RASQAL_API void rasqal_free_query_results(rasqal_query_results *query_results); RASQAL_API rasqal_query* rasqal_query_results_get_query(rasqal_query_results* query_results); /* Bindings result format */ RASQAL_API rasqal_query_results_type rasqal_query_results_get_type(rasqal_query_results* query_results); RASQAL_API const char* rasqal_query_results_type_label(rasqal_query_results_type type); RASQAL_API int rasqal_query_results_is_bindings(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_get_count(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_next(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_finished(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_get_bindings(rasqal_query_results *query_results, const unsigned char ***names, rasqal_literal ***values); RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value(rasqal_query_results *query_results, int offset); RASQAL_API const unsigned char* rasqal_query_results_get_binding_name(rasqal_query_results *query_results, int offset); RASQAL_API rasqal_literal* rasqal_query_results_get_binding_value_by_name(rasqal_query_results *query_results, const unsigned char *name); RASQAL_API int rasqal_query_results_get_bindings_count(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_add_row(rasqal_query_results* query_results, rasqal_row* row); RASQAL_API rasqal_row* rasqal_query_results_get_row_by_offset(rasqal_query_results* query_results, int result_offset); /* Boolean result format */ RASQAL_API int rasqal_query_results_is_boolean(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_get_boolean(rasqal_query_results *query_results); /* Graph result format */ RASQAL_API int rasqal_query_results_is_graph(rasqal_query_results *query_results); RASQAL_API raptor_statement* rasqal_query_results_get_triple(rasqal_query_results *query_results); RASQAL_API int rasqal_query_results_next_triple(rasqal_query_results *query_results); /* Syntax result format */ RASQAL_API int rasqal_query_results_is_syntax(rasqal_query_results* query_results); RASQAL_API int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri); RASQAL_API int rasqal_query_results_read(raptor_iostream *iostr, rasqal_query_results *results, const char* name, const char* mime_type, raptor_uri *format_uri, raptor_uri *base_uri); /* One more time */ RASQAL_API int rasqal_query_results_rewind(rasqal_query_results* query_results); /** * rasqal_query_results_format_flags: * @RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER: format can be read. * @RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER: format can be written. * * Bitflags for rasqal_query_results_formats_check() to find formats with features. */ typedef enum { RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER = 1, RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER = 2 } rasqal_query_results_format_flags; RASQAL_API int rasqal_query_results_formats_check2(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags); RASQAL_API RASQAL_API RASQAL_DEPRECATED int rasqal_query_results_formats_check(rasqal_world* world, const char *name, raptor_uri* uri, const char *mime_type, int flags); RASQAL_API rasqal_query_results_formatter* rasqal_new_query_results_formatter(rasqal_world* world, const char *name, const char *mime_type, raptor_uri* format_uri); RASQAL_API rasqal_query_results_formatter* rasqal_new_query_results_formatter_for_content(rasqal_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier); RASQAL_API void rasqal_free_query_results_formatter(rasqal_query_results_formatter* formatter); RASQAL_API int rasqal_query_results_formatter_write(raptor_iostream *iostr, rasqal_query_results_formatter* formatter, rasqal_query_results* results, raptor_uri *base_uri); RASQAL_API int rasqal_query_results_formatter_read(rasqal_world* world, raptor_iostream *iostr, rasqal_query_results_formatter* formatter, rasqal_query_results* results, raptor_uri *base_uri); RASQAL_API int rasqal_query_iostream_write_escaped_counted_string(rasqal_query* query, raptor_iostream* iostr, const unsigned char* string, size_t len); RASQAL_API unsigned char* rasqal_query_escape_counted_string(rasqal_query* query, const unsigned char *string, size_t len, size_t* output_len_p); /* Data graph class */ RASQAL_API rasqal_data_graph* rasqal_new_data_graph_from_uri(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri); RASQAL_API rasqal_data_graph* rasqal_new_data_graph_from_iostream(rasqal_world* world, raptor_iostream* iostr, raptor_uri* base_uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri); RASQAL_API rasqal_data_graph* rasqal_new_data_graph_from_data_graph(rasqal_data_graph* dg); RASQAL_API void rasqal_free_data_graph(rasqal_data_graph* dg); RASQAL_API int rasqal_data_graph_print(rasqal_data_graph* dg, FILE* fh); /** * rasqal_compare_flags: * @RASQAL_COMPARE_NOCASE: String comparisons are case independent. * @RASQAL_COMPARE_XQUERY: XQuery comparsion rules apply. * @RASQAL_COMPARE_RDF: RDF Term comparsion rules apply. * @RASQAL_COMPARE_URI: Allow comparison of URIs and allow strings to have a boolean value (unused; was for RDQL) * @RASQAL_COMPARE_SAMETERM: SPARQL sameTerm() builtin rules apply. * * Flags for rasqal_expression_evaluate(), rasqal_literal_compare() or * rasqal_literal_as_string_flags() */ typedef enum { RASQAL_COMPARE_NOCASE = 1, RASQAL_COMPARE_XQUERY = 2, RASQAL_COMPARE_RDF = 4, RASQAL_COMPARE_URI = 8, RASQAL_COMPARE_SAMETERM = 16 } rasqal_compare_flags; /** * rasqal_random: * * Internal */ typedef struct rasqal_random_s rasqal_random; /** * rasqal_evaluation_context: * @world: rasqal world * @base_uri: base URI of expression context (or NULL) * @locator: locator or NULL * @flags: expression comparison flags * @seed: random seeed * @random: random number generator object * * A context for evaluating an expression such as with * rasqal_expression_evaluate2() */ typedef struct { rasqal_world *world; raptor_uri* base_uri; raptor_locator *locator; int flags; unsigned int seed; rasqal_random* random; } rasqal_evaluation_context; /* Expression class */ RASQAL_API rasqal_expression* rasqal_new_0op_expression(rasqal_world* world, rasqal_op op); RASQAL_API rasqal_expression* rasqal_new_1op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg); RASQAL_API rasqal_expression* rasqal_new_2op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2); RASQAL_API rasqal_expression* rasqal_new_3op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3); RASQAL_API rasqal_expression* rasqal_new_4op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2, rasqal_expression* arg3, rasqal_expression* arg4); RASQAL_API rasqal_expression* rasqal_new_string_op_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal); RASQAL_API rasqal_expression* rasqal_new_literal_expression(rasqal_world* world, rasqal_literal* literal); RASQAL_API rasqal_expression* rasqal_new_function_expression(rasqal_world* world, raptor_uri* name, raptor_sequence* args, raptor_sequence* params, unsigned int flags); RASQAL_API rasqal_expression* rasqal_new_aggregate_function_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, raptor_sequence* params, unsigned int flags); RASQAL_API rasqal_expression* rasqal_new_cast_expression(rasqal_world* world, raptor_uri* name, rasqal_expression *value); RASQAL_API rasqal_expression* rasqal_new_expr_seq_expression(rasqal_world* world, rasqal_op op, raptor_sequence* args); RASQAL_API rasqal_expression* rasqal_new_set_expression(rasqal_world* world, rasqal_op op, rasqal_expression* arg1, raptor_sequence* args); RASQAL_API rasqal_expression* rasqal_new_group_concat_expression(rasqal_world* world, unsigned int flags, raptor_sequence* args, rasqal_literal* separator); RASQAL_API rasqal_expression* rasqal_new_expression_from_expression(rasqal_expression* e); RASQAL_API void rasqal_free_expression(rasqal_expression* e); RASQAL_API void rasqal_expression_print_op(rasqal_expression* e, FILE* fh); RASQAL_API int rasqal_expression_print(rasqal_expression* e, FILE* fh); RASQAL_API RASQAL_DEPRECATED rasqal_literal* rasqal_expression_evaluate(rasqal_world *world, raptor_locator *locator, rasqal_expression* e, int flags); RASQAL_API rasqal_literal* rasqal_expression_evaluate2(rasqal_expression *e, rasqal_evaluation_context* eval_context, int *error_p); RASQAL_API const char* rasqal_expression_op_label(rasqal_op op); RASQAL_API int rasqal_expression_compare(rasqal_expression* e1, rasqal_expression* e2, int flags, int* error_p); /** * rasqal_expression_visit_fn: * @user_data: user data passed in with rasqal_expression_visit() * @e: current expression * * User function to visit an expression and operate on it with * rasqal_expression_visit() * * Return value: non-0 to truncate the visit */ typedef int (*rasqal_expression_visit_fn)(void *user_data, rasqal_expression *e); RASQAL_API int rasqal_expression_visit(rasqal_expression* e, rasqal_expression_visit_fn fn, void *user_data); RASQAL_API rasqal_evaluation_context* rasqal_new_evaluation_context(rasqal_world* world, raptor_locator* locator, int flags); RASQAL_API void rasqal_free_evaluation_context(rasqal_evaluation_context* eval_context); RASQAL_API int rasqal_evaluation_context_set_base_uri(rasqal_evaluation_context* eval_context, raptor_uri *base_uri); RASQAL_API int rasqal_evaluation_context_set_rand_seed(rasqal_evaluation_context* eval_context, unsigned int seed); /* Literal class */ RASQAL_API rasqal_literal* rasqal_new_integer_literal(rasqal_world* world, rasqal_literal_type type, int integer); RASQAL_API rasqal_literal* rasqal_new_numeric_literal_from_long(rasqal_world* world, rasqal_literal_type type, long value); RASQAL_API rasqal_literal* rasqal_new_typed_literal(rasqal_world* world, rasqal_literal_type type, const unsigned char* string); RASQAL_API rasqal_literal* rasqal_new_double_literal(rasqal_world* world, double d); RASQAL_API rasqal_literal* rasqal_new_floating_literal(rasqal_world *world, rasqal_literal_type type, double d); RASQAL_API RASQAL_DEPRECATED rasqal_literal* rasqal_new_float_literal(rasqal_world* world, float f); RASQAL_API rasqal_literal* rasqal_new_uri_literal(rasqal_world* world, raptor_uri* uri); RASQAL_API rasqal_literal* rasqal_new_pattern_literal(rasqal_world* world, const unsigned char *pattern, const char *flags); RASQAL_API rasqal_literal* rasqal_new_string_literal(rasqal_world* world, const unsigned char *string, const char *language, raptor_uri *datatype, const unsigned char *datatype_qname); RASQAL_API rasqal_literal* rasqal_new_simple_literal(rasqal_world* world, rasqal_literal_type type, const unsigned char *string); RASQAL_API rasqal_literal* rasqal_new_boolean_literal(rasqal_world* world, int value); RASQAL_API rasqal_literal* rasqal_new_variable_literal(rasqal_world* world, rasqal_variable *variable); RASQAL_API rasqal_literal* rasqal_new_decimal_literal(rasqal_world* world, const unsigned char *string); RASQAL_API rasqal_literal* rasqal_new_decimal_literal_from_decimal(rasqal_world* world, const unsigned char *string, rasqal_xsd_decimal* decimal); RASQAL_API rasqal_literal* rasqal_new_datetime_literal_from_datetime(rasqal_world* world, rasqal_xsd_datetime* dt); RASQAL_API rasqal_literal* rasqal_new_literal_from_literal(rasqal_literal* l); RASQAL_API void rasqal_free_literal(rasqal_literal* l); RASQAL_API int rasqal_literal_print(rasqal_literal* l, FILE* fh); RASQAL_API const char* rasqal_literal_type_label(rasqal_literal_type type); RASQAL_API void rasqal_literal_print_type(rasqal_literal* l, FILE* fh); RASQAL_API rasqal_variable* rasqal_literal_as_variable(rasqal_literal* l); RASQAL_API const unsigned char* rasqal_literal_as_counted_string(rasqal_literal* l, size_t *len_p, int flags, int *error_p); RASQAL_API const unsigned char* rasqal_literal_as_string(rasqal_literal* l); RASQAL_API const unsigned char* rasqal_literal_as_string_flags(rasqal_literal* l, int flags, int *error_p); RASQAL_API rasqal_literal* rasqal_literal_as_node(rasqal_literal* l); RASQAL_API raptor_uri* rasqal_literal_datatype(rasqal_literal* l); RASQAL_API rasqal_literal* rasqal_literal_value(rasqal_literal* l); RASQAL_API int rasqal_literal_compare(rasqal_literal* l1, rasqal_literal* l2, int flags, int *error_p); RASQAL_API int rasqal_literal_equals(rasqal_literal* l1, rasqal_literal* l2); RASQAL_API int rasqal_literal_same_term(rasqal_literal* l1, rasqal_literal* l2); RASQAL_API rasqal_literal_type rasqal_literal_get_rdf_term_type(rasqal_literal* l); RASQAL_API rasqal_literal_type rasqal_literal_get_type(rasqal_literal* l); RASQAL_API char* rasqal_literal_get_language(rasqal_literal* l); RASQAL_API int rasqal_literal_is_rdf_literal(rasqal_literal* l); RASQAL_API rasqal_prefix* rasqal_new_prefix(rasqal_world* world, const unsigned char* prefix, raptor_uri* uri); RASQAL_API void rasqal_free_prefix(rasqal_prefix* p); RASQAL_API int rasqal_prefix_print(rasqal_prefix* p, FILE* fh); /* Row class */ RASQAL_API rasqal_row* rasqal_new_row_for_size(rasqal_world* world, int size); RASQAL_API void rasqal_free_row(rasqal_row* row); RASQAL_API int rasqal_row_set_value_at(rasqal_row* row, int offset, rasqal_literal* value); /* Triple class */ RASQAL_API rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal_literal* predicate, rasqal_literal* object); RASQAL_API rasqal_triple* rasqal_new_triple_from_triple(rasqal_triple* t); RASQAL_API void rasqal_free_triple(rasqal_triple* t); RASQAL_API int rasqal_triple_print(rasqal_triple* t, FILE* fh); RASQAL_API void rasqal_triple_set_origin(rasqal_triple* t, rasqal_literal *l); RASQAL_API rasqal_literal* rasqal_triple_get_origin(rasqal_triple* t); /* Variable class */ RASQAL_API rasqal_variable* rasqal_new_variable_from_variable(rasqal_variable* v); RASQAL_API void rasqal_free_variable(rasqal_variable* v); RASQAL_API int rasqal_variable_print(rasqal_variable* v, FILE* fh); RASQAL_API void rasqal_variable_set_value(rasqal_variable* v, rasqal_literal* l); /* Variables Table */ RASQAL_API rasqal_variables_table* rasqal_new_variables_table(rasqal_world* world); RASQAL_API void rasqal_free_variables_table(rasqal_variables_table* vt); RASQAL_API RASQAL_DEPRECATED rasqal_variable* rasqal_variables_table_add(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, rasqal_literal *value); RASQAL_API rasqal_variable* rasqal_variables_table_add2(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, size_t name_len, rasqal_literal *value); RASQAL_API int rasqal_variables_table_add_variable(rasqal_variables_table* vt, rasqal_variable* variable); RASQAL_API rasqal_variable* rasqal_variables_table_get_by_name(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name); RASQAL_API int rasqal_variables_table_contains(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name); /* memory functions */ RASQAL_API void rasqal_free_memory(void *ptr); RASQAL_API void* rasqal_alloc_memory(size_t size); RASQAL_API void* rasqal_calloc_memory(size_t nmemb, size_t size); /* decimal functions */ RASQAL_API rasqal_xsd_decimal* rasqal_new_xsd_decimal(rasqal_world* world); RASQAL_API void rasqal_free_xsd_decimal(rasqal_xsd_decimal* dec); RASQAL_API int rasqal_xsd_decimal_set_string(rasqal_xsd_decimal* dec, const char* string); RASQAL_API double rasqal_xsd_decimal_get_double(rasqal_xsd_decimal* dec); RASQAL_API long rasqal_xsd_decimal_get_long(rasqal_xsd_decimal* dec, int* error_p); RASQAL_API char* rasqal_xsd_decimal_as_string(rasqal_xsd_decimal* dec); RASQAL_API char* rasqal_xsd_decimal_as_counted_string(rasqal_xsd_decimal* dec, size_t* len_p); RASQAL_API int rasqal_xsd_decimal_set_long(rasqal_xsd_decimal* dec, long l); RASQAL_API int rasqal_xsd_decimal_set_double(rasqal_xsd_decimal* dec, double d); RASQAL_API int rasqal_xsd_decimal_print(rasqal_xsd_decimal* dec, FILE* stream); RASQAL_API int rasqal_xsd_decimal_add(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b); RASQAL_API int rasqal_xsd_decimal_subtract(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b); RASQAL_API int rasqal_xsd_decimal_multiply(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b); RASQAL_API int rasqal_xsd_decimal_divide(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b); RASQAL_API int rasqal_xsd_decimal_negate(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a); RASQAL_API int rasqal_xsd_decimal_compare(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b); RASQAL_API int rasqal_xsd_decimal_equals(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b); RASQAL_API int rasqal_xsd_decimal_is_zero(rasqal_xsd_decimal* d); RASQAL_API int rasqal_xsd_decimal_abs(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a); RASQAL_API int rasqal_xsd_decimal_round(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a); RASQAL_API int rasqal_xsd_decimal_ceil(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a); RASQAL_API int rasqal_xsd_decimal_floor(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a); /* date functions */ RASQAL_API rasqal_xsd_date* rasqal_new_xsd_date(rasqal_world* world, const char *date_string); RASQAL_API void rasqal_free_xsd_date(rasqal_xsd_date* d); RASQAL_API char* rasqal_xsd_date_to_counted_string(const rasqal_xsd_date *date, size_t *len_p); RASQAL_API char* rasqal_xsd_date_to_string(const rasqal_xsd_date *d); RASQAL_API int rasqal_xsd_date_equals(const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p); RASQAL_API int rasqal_xsd_date_compare(const rasqal_xsd_date *d1, const rasqal_xsd_date *d2, int *incomparible_p); /* datetime functions */ RASQAL_API rasqal_xsd_datetime* rasqal_new_xsd_datetime(rasqal_world* world, const char *datetime_string); RASQAL_API rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_unixtime(rasqal_world* world, time_t secs); RASQAL_API rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_timeval(rasqal_world* world, struct timeval *tv); RASQAL_API rasqal_xsd_datetime* rasqal_new_xsd_datetime_from_xsd_date(rasqal_world* world, rasqal_xsd_date *date); RASQAL_API void rasqal_free_xsd_datetime(rasqal_xsd_datetime* dt); RASQAL_API char* rasqal_xsd_datetime_to_counted_string(const rasqal_xsd_datetime *dt, size_t *len_p); RASQAL_API char* rasqal_xsd_datetime_to_string(const rasqal_xsd_datetime *dt); RASQAL_API int rasqal_xsd_datetime_equals2(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p); RASQAL_API RASQAL_DEPRECATED int rasqal_xsd_datetime_equals(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2); RASQAL_API int rasqal_xsd_datetime_compare2(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2, int *incomparible_p); RASQAL_API RASQAL_DEPRECATED int rasqal_xsd_datetime_compare(const rasqal_xsd_datetime *dt1, const rasqal_xsd_datetime *dt2); RASQAL_API rasqal_xsd_decimal* rasqal_xsd_datetime_get_seconds_as_decimal(rasqal_world* world, rasqal_xsd_datetime* dt); RASQAL_API int rasqal_xsd_datetime_set_from_timeval(rasqal_xsd_datetime *dt, struct timeval *tv); RASQAL_API int rasqal_xsd_datetime_set_from_unixtime(rasqal_xsd_datetime* dt, time_t clock); RASQAL_API time_t rasqal_xsd_datetime_get_as_unixtime(rasqal_xsd_datetime* dt); RASQAL_API struct timeval* rasqal_xsd_datetime_get_as_timeval(rasqal_xsd_datetime *dt); RASQAL_API char* rasqal_xsd_datetime_get_timezone_as_counted_string(rasqal_xsd_datetime *dt, size_t *len_p); RASQAL_API char* rasqal_xsd_datetime_get_tz_as_counted_string(rasqal_xsd_datetime* dt, size_t *len_p); /* regex utilities */ RASQAL_API char* rasqal_regex_replace(rasqal_world* world, raptor_locator* locator, const char* pattern, const char* regex_flags, const char* subject, size_t subject_len, const char* replace, size_t replace_len, size_t* result_len_p); /** * rasqal_service: * * Rasqal SPARQL Protocol Service */ typedef struct rasqal_service_s rasqal_service; RASQAL_API rasqal_service* rasqal_new_service(rasqal_world* world, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs); RASQAL_API void rasqal_free_service(rasqal_service* svc); RASQAL_API rasqal_query_results* rasqal_service_execute(rasqal_service* svc); RASQAL_API int rasqal_service_set_www(rasqal_service* svc, raptor_www* www); RASQAL_API int rasqal_service_set_format(rasqal_service* svc, const char *format); /** * rasqal_triple_parts: * @RASQAL_TRIPLE_NONE: no parts * @RASQAL_TRIPLE_SUBJECT: Subject present in a triple. * @RASQAL_TRIPLE_PREDICATE: Predicate present in a triple. * @RASQAL_TRIPLE_OBJECT: Object present in a triple. * @RASQAL_TRIPLE_ORIGIN: Origin/graph present in a triple. * @RASQAL_TRIPLE_GRAPH: Alias for RASQAL_TRIPLE_ORIGIN * @RASQAL_TRIPLE_SPO: Subject, Predicate and Object present in a triple. * @RASQAL_TRIPLE_SPOG: Subject, Predicate, Object, Graph present in a triple. * * Flags for parts of a triple. */ typedef enum { RASQAL_TRIPLE_NONE = 0, RASQAL_TRIPLE_SUBJECT = 1, RASQAL_TRIPLE_PREDICATE= 2, RASQAL_TRIPLE_OBJECT = 4, RASQAL_TRIPLE_ORIGIN = 8, RASQAL_TRIPLE_GRAPH = RASQAL_TRIPLE_ORIGIN, RASQAL_TRIPLE_SPO = RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT, RASQAL_TRIPLE_SPOG = RASQAL_TRIPLE_SPO | RASQAL_TRIPLE_GRAPH } rasqal_triple_parts; /** * rasqal_triples_match: * @world: rasqal_world object * @user_data: User data pointer for factory methods. * @bind_match: The [4]array (s,p,o,origin) bindings against the current triple match only touching triple parts given. Returns parts that were bound or 0 on failure. * @next_match: Move to next match. * @is_end: Check for end of triple match - return non-0 if is end. * @finish: Finish triples match and destroy any allocated memory. * @is_exact: non-0 if triple to match is all literal constants * @finished: >0 if the match has finished * * Triples match structure as initialised by #rasqal_triples_source * method init_triples_match. */ struct rasqal_triples_match_s { rasqal_world *world; void *user_data; rasqal_triple_parts (*bind_match)(struct rasqal_triples_match_s* rtm, void *user_data, rasqal_variable *bindings[4], rasqal_triple_parts parts); void (*next_match)(struct rasqal_triples_match_s* rtm, void *user_data); int (*is_end)(struct rasqal_triples_match_s* rtm, void *user_data); void (*finish)(struct rasqal_triples_match_s* rtm, void *user_data); int is_exact; int finished; }; typedef struct rasqal_triples_match_s rasqal_triples_match; /** * rasqal_triple_meta: * @bindings: Variable bindings for this triple+origin to set. * @triples_match: The matcher that is setting these bindings. * @context: Context data used by the matcher. * @parts: Bitmask of #rasqal_triple_parts flags describing the parts of the triple pattern that will bind to variables. There may also be variables mentioned that are bound in other triple patterns even if @parts is 0. * @is_exact: unused * @executed: unused * * Metadata for triple pattern matching for one triple pattern. */ typedef struct { /* triple (subject, predicate, object) and origin */ rasqal_variable* bindings[4]; rasqal_triples_match *triples_match; void *context; rasqal_triple_parts parts; int is_exact; int executed; } rasqal_triple_meta; /** * RASQAL_TRIPLES_SOURCE_MIN_VERSION: * * Lowest accepted @rasqal_triples_source API version */ #define RASQAL_TRIPLES_SOURCE_MIN_VERSION 1 /** * RASQAL_TRIPLES_SOURCE_MAX_VERSION: * * Highest accepted @rasqal_triples_source API version */ #define RASQAL_TRIPLES_SOURCE_MAX_VERSION 2 /** * rasqal_triples_source_feature: * @RASQAL_TRIPLES_SOURCE_FEATURE_NONE: No feature * @RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH: Support raptor_iostream data graphs * * Optional features that may be supported by a triple source factory */ typedef enum { RASQAL_TRIPLES_SOURCE_FEATURE_NONE, RASQAL_TRIPLES_SOURCE_FEATURE_IOSTREAM_DATA_GRAPH } rasqal_triples_source_feature; /** * rasqal_triples_source: * @version: API version - only V1 is defined for now * @query: Source for this query. * @user_data: Context user data passed into the factory methods. * @init_triples_match: Factory method to initalise a new #rasqal_triples_match. * @triple_present: Factory method to return presence or absence of a complete triple. * @free_triples_source: Factory method to deallocate resources. * @support_feature: Factory method to test support for a feature, returning non-0 if supported * * Triples source as initialised by a #rasqal_triples_source_factory. */ struct rasqal_triples_source_s { int version; rasqal_query* query; void *user_data; /* API v1 */ int (*init_triples_match)(rasqal_triples_match* rtm, struct rasqal_triples_source_s* rts, void *user_data, rasqal_triple_meta *m, rasqal_triple *t); int (*triple_present)(struct rasqal_triples_source_s* rts, void *user_data, rasqal_triple *t); void (*free_triples_source)(void *user_data); /* API v2 onwards */ int (*support_feature)(void *user_data, rasqal_triples_source_feature feature); }; typedef struct rasqal_triples_source_s rasqal_triples_source; /** * RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION: * * Lowest accepted @rasqal_triples_source_factory API version */ #define RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION 1 /** * RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION: * * Highest accepted @rasqal_triples_source_factory API version */ #define RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION 3 /** * rasqal_triples_error_handler: * @query: query object * @locator: error locator (or NULL) * @message: error message * * Triples source factory error handler callback. */ typedef void (*rasqal_triples_error_handler)(rasqal_query* query, raptor_locator* locator, const char* message); /** * rasqal_triples_error_handler2: * @world: world object * @locator: error locator (or NULL) * @message: error message * * Triples source factory error handler callback. */ typedef void (*rasqal_triples_error_handler2)(rasqal_world* world, raptor_locator* locator, const char* message); /** * rasqal_triples_source_factory: * @version: API factory version from 1 to 3 * @user_data: User data for triples_source_factory. * @user_data_size: Size of @user_data for new_triples_source. * @new_triples_source: Create a new triples source - returns non-zero on failure < 0 is a 'no rdf data error', > 0 is an unspecified error. Error messages are generated by rasqal internally. (V1) * @init_triples_source: Initialise a new triples source V2 for a particular source URI/base URI and syntax. Returns non-zero on failure with errors reported via the handler callback by the implementation. (V2) * @init_triples_source2: Initialise a new triples source V3 for a particular source URI/base URI and syntax and given data graphs. Returns non-zero on failure with errors reported via the handler callback by the implementation. If bit 0 of flags is 1, enforce RAPTOR_FEATURE_NO_NET (V3) * * A factory that initialises #rasqal_triples_source structures to * returning matches to a triple pattern across the dataset formed * from the data graphs recorded in the @query object. */ typedef struct { int version; void *user_data; size_t user_data_size; /* API v1 */ int (*new_triples_source)(rasqal_query* query, void *factory_user_data, void *user_data, rasqal_triples_source* rts); /* API v2 onwards */ int (*init_triples_source)(rasqal_query* query, void *factory_user_data, void *user_data, rasqal_triples_source* rts, rasqal_triples_error_handler handler); /* API v3 onwards */ int (*init_triples_source2)(rasqal_world* world, raptor_sequence* data_graphs, void *factory_user_data, void *user_data, rasqal_triples_source *rts, rasqal_triples_error_handler2 handler, unsigned int flags); } rasqal_triples_source_factory; /** * rasqal_triples_source_factory_register_fn: * @factory: factory to register * * Register a factory for generating triples sources #rasqal_triples_source * * Return value: non-0 on failure */ typedef int (*rasqal_triples_source_factory_register_fn)(rasqal_triples_source_factory *factory); /* set the triples_source_factory */ RASQAL_API int rasqal_set_triples_source_factory(rasqal_world* world, rasqal_triples_source_factory_register_fn register_fn, void* user_data); /* The info below is solely for gtk-doc - ignore it */ /** * raptor_world: * * Internal */ /** * RASQAL_QUERY_RESULTS_FORMATTER_DECLARED: * * Internal */ /** * RASQAL_WORLD_DECLARED: * * Internal */ /** * RASQAL_LITERAL_UDT_DEFINED * * Internal */ /** * rasqal_expression_s: * @world: Internal * @usage: Internal * @op: Internal * @arg1: Internal * @arg2: Internal * @arg3: Internal * @literal: Internal * @value: Internal * @name: Internal * @args: Internal * @params: Internal * @flags: Internal * @arg4: Internal * * Internal - see #rasqal_expression. * */ /** * bind_match: * @rtm: triples match context * @user_data: user data * @bindings: variable binding for parts of triple (s, p, o, g) * @parts: parts of triple to match * * Internal - see #rasqal_triples_match * * Return value: match parts */ /** * next_match: * @rtm: triples match context * @user_data: user data * * Internal - see #rasqal_triples_match */ /** * is_end: * @rtm: triples match context * @user_data: user data * * Internal - see #rasqal_triples_match * * Return value: non-0 if end of match */ /** * finish: * @rtm: triples match context * @user_data: user data * * Internal - see #rasqal_triples_match */ /** * init_triples_match: * @rtm: triples match context * @rts: triples match source * @user_data: user data * @m: triple meta * @t: triple * * Internal - see #rasqal_triples_source * * Return value: non-0 on failure */ /** * triple_present: * @rts: triples match source * @user_data: user data * @t: triple to test for presence * * Internal - see #rasqal_triples_source * * Return value: non-0 on failure */ /** * free_triples_source: * @user_data: user data * * Internal - see #rasqal_triples_source */ /** * support_feature: * @user_data: user data * @feature: feature to test * * Internal - see #rasqal_triples_source * * Return value: non-0 if supported */ /** * rasqal_variables_table: * * Internal - for now */ #ifdef __cplusplus } #endif #endif rasqal-0.9.33/src/rasqal_query.c0000644000175000017500000017510612441120534013463 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_query.c - Rasqal RDF Query * * Copyright (C) 2003-2009, 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /* * * Query Class Internals * * This is the main Rasqal class for constructing RDF graph queries * from a syntax or by API, preparing them for execution with a query * execution and executing them to return a result set. * * Queries are constructed from a syntax in some query language * syntax and build an RDF query API structure based on triple * patterns, filter expressions, graph patterns above them operating * over a set of graphs. * * This class does not deal with manipulating result sets which are * handled by the #rasqal_query_results and methods on it although * rasqal_query_execute() does return a newly constructed result * object. * * It also does not deal with executing a query which is handled by * #rasqal_query_execution_factory instances that have their own * simpler API. * */ #define DEBUG_FH stderr static int rasqal_query_add_query_result(rasqal_query* query, rasqal_query_results* query_results); /** * rasqal_new_query: * @world: rasqal_world object * @name: the query language name (or NULL) * @uri: #raptor_uri language uri (or NULL) * * Constructor - create a new rasqal_query object. * * A query language can be named or identified by a URI, either * of which is optional. The default query language will be used * if both are NULL. rasqal_world_get_query_language_description returns * the description of the known names, labels, MIME types and URIs. * * Return value: a new #rasqal_query object or NULL on failure */ rasqal_query* rasqal_new_query(rasqal_world *world, const char *name, const unsigned char *uri) { rasqal_query_language_factory* factory; rasqal_query* query; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); /* for compatibility with older binaries that do not call it */ rasqal_world_open(world); factory = rasqal_get_query_language_factory(world, name, uri); if(!factory) return NULL; query = RASQAL_CALLOC(rasqal_query*, 1, sizeof(*query)); if(!query) return NULL; /* set usage first to 1 so we can clean up with rasqal_free_query() on error */ query->usage = 1; query->world = world; query->factory = factory; query->context = RASQAL_CALLOC(void*, 1, factory->context_length); if(!query->context) goto tidy; query->namespaces = raptor_new_namespaces(world->raptor_world_ptr, 0); if(!query->namespaces) goto tidy; query->vars_table = rasqal_new_variables_table(query->world); if(!query->vars_table) goto tidy; query->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!query->triples) goto tidy; query->prefixes = raptor_new_sequence((raptor_data_free_handler)rasqal_free_prefix, (raptor_data_print_handler)rasqal_prefix_print); if(!query->prefixes) goto tidy; query->data_graphs = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, (raptor_data_print_handler)rasqal_data_graph_print); if(!query->data_graphs) goto tidy; query->results = raptor_new_sequence((raptor_data_free_handler)rasqal_query_results_remove_query_reference, NULL); if(!query->results) goto tidy; query->eval_context = rasqal_new_evaluation_context(query->world, &query->locator, query->compare_flags); if(!query->eval_context) goto tidy; if(factory->init(query, name)) goto tidy; return query; tidy: rasqal_free_query(query); return NULL; } /** * rasqal_free_query: * @query: #rasqal_query object * * Destructor - destroy a #rasqal_query object. **/ void rasqal_free_query(rasqal_query* query) { if(!query) return; if(--query->usage) return; if(query->factory) query->factory->terminate(query); if(query->eval_context) rasqal_free_evaluation_context(query->eval_context); if(query->context) RASQAL_FREE(rasqal_query_context, query->context); if(query->namespaces) raptor_free_namespaces(query->namespaces); if(query->base_uri) raptor_free_uri(query->base_uri); if(query->query_string) RASQAL_FREE(char*, query->query_string); if(query->data_graphs) raptor_free_sequence(query->data_graphs); if(query->describes) raptor_free_sequence(query->describes); if(query->triples) raptor_free_sequence(query->triples); if(query->optional_triples) raptor_free_sequence(query->optional_triples); if(query->constructs) raptor_free_sequence(query->constructs); if(query->prefixes) raptor_free_sequence(query->prefixes); if(query->results) raptor_free_sequence(query->results); if(query->triples_use_map) RASQAL_FREE(shortarray, query->triples_use_map); if(query->variables_use_map) RASQAL_FREE(shortarray, query->variables_use_map); if(query->query_graph_pattern) rasqal_free_graph_pattern(query->query_graph_pattern); if(query->graph_patterns_sequence) raptor_free_sequence(query->graph_patterns_sequence); if(query->query_results_formatter_name) RASQAL_FREE(char*, query->query_results_formatter_name); /* Do this last since most everything above could refer to a variable */ if(query->vars_table) rasqal_free_variables_table(query->vars_table); if(query->updates) raptor_free_sequence(query->updates); if(query->modifier) rasqal_free_solution_modifier(query->modifier); if(query->bindings) rasqal_free_bindings(query->bindings); if(query->projection) rasqal_free_projection(query->projection); RASQAL_FREE(rasqal_query, query); } /* Methods */ /** * rasqal_query_get_name: * @query: #rasqal_query query object * * Get a short name for the query language. * * Return value: shared string label value **/ const char* rasqal_query_get_name(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->factory->desc.names[0]; } /** * rasqal_query_get_label: * @query: #rasqal_query query object * * Get a readable label for the query language. * * Return value: shared string label value **/ const char* rasqal_query_get_label(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->factory->desc.label; } /** * rasqal_query_set_feature: * @query: #rasqal_query query object * @feature: feature to set from enumerated #rasqal_feature values * @value: integer feature value * * Set various query features. * * The allowed features are available via rasqal_features_enumerate(). * * Return value: non 0 on failure or if the feature is unknown **/ int rasqal_query_set_feature(rasqal_query* query, rasqal_feature feature, int value) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); switch(feature) { case RASQAL_FEATURE_NO_NET: case RASQAL_FEATURE_RAND_SEED: if(feature == RASQAL_FEATURE_RAND_SEED) query->user_set_rand = 1; query->features[RASQAL_GOOD_CAST(int, feature)] = value; break; } return 0; } /** * rasqal_query_set_feature_string: * @query: #rasqal_query query object * @feature: feature to set from enumerated #rasqal_feature values * @value: feature value * * Set query features with string values. * * The allowed features are available via rasqal_features_enumerate(). * If the feature type is integer, the value is interpreted as an integer. * * Return value: non 0 on failure or if the feature is unknown **/ int rasqal_query_set_feature_string(rasqal_query *query, rasqal_feature feature, const unsigned char *value) { int value_is_string = (rasqal_feature_value_type(feature) == 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(!value_is_string) return rasqal_query_set_feature(query, feature, atoi(RASQAL_GOOD_CAST(const char*, value))); return -1; } /** * rasqal_query_get_feature: * @query: #rasqal_query query object * @feature: feature to get value * * Get various query features. * * The allowed features are available via rasqal_features_enumerate(). * * Note: no feature value is negative * * Return value: feature value or < 0 for an illegal feature **/ int rasqal_query_get_feature(rasqal_query *query, rasqal_feature feature) { int result= -1; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); switch(feature) { case RASQAL_FEATURE_NO_NET: case RASQAL_FEATURE_RAND_SEED: result = (query->features[RASQAL_GOOD_CAST(int, feature)] != 0); break; } return result; } /** * rasqal_query_get_feature_string: * @query: #rasqal_query query object * @feature: feature to get value * * Get query features with string values. * * The allowed features are available via rasqal_features_enumerate(). * If a string is returned, it must be freed by the caller. * * Return value: feature value or NULL for an illegal feature or no value **/ const unsigned char * rasqal_query_get_feature_string(rasqal_query *query, rasqal_feature feature) { int value_is_string = (rasqal_feature_value_type(feature) == 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!value_is_string) return NULL; return NULL; } /** * rasqal_query_get_distinct: * @query: #rasqal_query query object * * Get the query distinct mode * * See rasqal_query_set_distinct() for the distinct modes. * * Return value: non-0 if the results should be distinct **/ int rasqal_query_get_distinct(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); if(!query->projection) return 0; return query->projection->distinct; } /** * rasqal_query_set_distinct: * @query: #rasqal_query query object * @distinct_mode: distinct mode * * Set the query distinct results mode. * * The allowed @distinct_mode values are: * 0 if not given * 1 if DISTINCT: ensure solutions are unique * 2 if SPARQL REDUCED: permit elimination of some non-unique solutions * **/ void rasqal_query_set_distinct(rasqal_query* query, int distinct_mode) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); if(distinct_mode < 0 || distinct_mode > 2) distinct_mode = 0; if(!query->projection) { query->projection = rasqal_new_projection(query, /* variables */ NULL, /* wildcard */ 0, /* distinct */ 0); if(!query->projection) return; } query->projection->distinct = distinct_mode; } /** * rasqal_query_get_explain: * @query: #rasqal_query query object * * Get the query explain results flag. * * Return value: non-0 if the results should be explain **/ int rasqal_query_get_explain(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); return query->explain; } /** * rasqal_query_set_explain: * @query: #rasqal_query query object * @is_explain: non-0 if explain * * Set the query explain results flag. * **/ void rasqal_query_set_explain(rasqal_query* query, int is_explain) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); query->explain = (is_explain != 0) ? 1 : 0; } /** * rasqal_query_get_limit: * @query: #rasqal_query query object * * Get the query-specified limit on results. * * This is the limit given in the query on the number of results allowed. * * Return value: integer >=0 if a limit is given, otherwise <0 **/ int rasqal_query_get_limit(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); if(query->modifier) return query->modifier->limit; else return -1; } /** * rasqal_query_set_limit: * @query: #rasqal_query query object * @limit: the limit on results, >=0 to set a limit, <0 to have no limit * * Set the query-specified limit on results. * * This is the limit given in the query on the number of results * allowed. It is only guaranteed to work after the query is * prepared and before it is executed. **/ void rasqal_query_set_limit(rasqal_query* query, int limit) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); if(query->modifier) query->modifier->limit = limit; } /** * rasqal_query_get_offset: * @query: #rasqal_query query object * * Get the query-specified offset on results. * * This is the offset given in the query on the number of results * allowed. It is only guaranteed to work after the query is * prepared and before it is executed. * * Return value: integer >=0 if a offset is given, otherwise <0 **/ int rasqal_query_get_offset(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); if(query->modifier) return query->modifier->offset; else return -1; } /** * rasqal_query_set_offset: * @query: #rasqal_query query object * @offset: offset for results, >=0 to set an offset, <0 to have no offset * * Set the query-specified offset on results. * * This is the offset given in the query on the number of results allowed. **/ void rasqal_query_set_offset(rasqal_query* query, int offset) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); if(query->modifier) query->modifier->offset = offset; } /** * rasqal_query_add_data_graph: * @query: #rasqal_query query object * @data_graph: data graph * * Add a data graph to the query. * * Return value: non-0 on failure **/ int rasqal_query_add_data_graph(rasqal_query* query, rasqal_data_graph* data_graph) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(data_graph, rasqal_data_graph, 1); if(raptor_sequence_push(query->data_graphs, (void*)data_graph)) return 1; return 0; } /** * rasqal_query_add_data_graphs: * @query: #rasqal_query query object * @data_graphs: sequence of #rasqal_data_graph * * Add a set of data graphs to the query. * * The objects in the passed-in @data_graphs sequence becomes owne by the query. * The @data_graphs sequence itself is freed and must not be used after this call. * * Return value: non-0 on failure **/ int rasqal_query_add_data_graphs(rasqal_query* query, raptor_sequence* data_graphs) { int rc; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(data_graphs, raptor_sequence, 1); rc = raptor_sequence_join(query->data_graphs, data_graphs); raptor_free_sequence(data_graphs); return rc; } /** * rasqal_query_get_data_graph_sequence: * @query: #rasqal_query query object * * Get the sequence of data_graph URIs. * * Return value: a #raptor_sequence of #raptor_uri pointers. **/ raptor_sequence* rasqal_query_get_data_graph_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->data_graphs; } /** * rasqal_query_get_data_graph: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a rasqal_data_graph* in the sequence of data_graphs. * * Return value: a #rasqal_data_graph pointer or NULL if out of the sequence range **/ rasqal_data_graph* rasqal_query_get_data_graph(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->data_graphs) return NULL; return (rasqal_data_graph*)raptor_sequence_get_at(query->data_graphs, idx); } /** * rasqal_query_dataset_contains_named_graph: * @query: #rasqal_query query object * @graph_uri: query URI * * Test if the query dataset contains a named graph * * Return value: non-0 if the dataset contains a named graph */ int rasqal_query_dataset_contains_named_graph(rasqal_query* query, raptor_uri *graph_uri) { rasqal_data_graph *dg; int idx; int found = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(graph_uri, raptor_uri, 1); for(idx = 0; (dg = rasqal_query_get_data_graph(query, idx)); idx++) { if(dg->name_uri && raptor_uri_equals(dg->name_uri, graph_uri)) { /* graph_uri is a graph name in the dataset */ found = 1; break; } } return found; } /** * rasqal_query_add_variable: * @query: #rasqal_query query object * @var: #rasqal_variable variable * * Add a projected (named) variable to the query. * * See also rasqal_query_set_variable() which assigns or removes a value to * a previously added variable in the query. * * Return value: non-0 on failure **/ int rasqal_query_add_variable(rasqal_query* query, rasqal_variable* var) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(var, rasqal_variable, 1); if(!rasqal_variables_table_contains(query->vars_table, var->type, var->name)) { if(rasqal_variables_table_add_variable(query->vars_table, var)) return 1; } if(!query->projection) { query->projection = rasqal_new_projection(query, /* variables */ NULL, /* wildcard */ 0, /* distinct */ 0); if(!query->projection) return 1; } return rasqal_projection_add_variable(query->projection, var); } /** * rasqal_query_get_bound_variable_sequence: * @query: #rasqal_query query object * * Get the sequence of projected variables in the query. * * This returns the sequence of variables that are explicitly chosen * via SELECT in SPARQL. Or all variables mentioned with SELECT * * * Return value: a #raptor_sequence of #rasqal_variable pointers. **/ raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->projection) return NULL; return rasqal_projection_get_variables_sequence(query->projection); } /** * rasqal_query_get_describe_sequence: * @query: #rasqal_query query object * * Get the sequence of literals described in the query. * * This returns the sequence of literals (constants or variables) that are * explicitly chosen via DESCRIBE in SPARQL. * * Return value: a #raptor_sequence of #rasqal_literal pointers. **/ raptor_sequence* rasqal_query_get_describe_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->describes; } /** * rasqal_query_get_anonymous_variable_sequence: * @query: #rasqal_query query object * * Get the sequence of anonymous variables mentioned in the query. * * Return value: a #raptor_sequence of #rasqal_variable pointers. **/ raptor_sequence* rasqal_query_get_anonymous_variable_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return rasqal_variables_table_get_anonymous_variables_sequence(query->vars_table); } /** * rasqal_query_get_all_variable_sequence: * @query: #rasqal_query query object * * Get the sequence of all variables mentioned in the query. * * Return value: a #raptor_sequence of #rasqal_variable pointers. **/ raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return rasqal_variables_table_get_named_variables_sequence(query->vars_table); } /** * rasqal_query_get_variable: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a variable in the query * * Return value: pointer to shared #rasqal_variable or NULL if out of range **/ rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return rasqal_variables_table_get(query->vars_table, idx); } /** * rasqal_query_has_variable2: * @query: #rasqal_query query object * @type: the variable type to match or #RASQAL_VARIABLE_TYPE_UNKNOWN for any. * @name: variable name * * Find if the named variable of the given type is in the query * * Note that looking up for any type #RASQAL_VARIABLE_TYPE_UNKNOWN * may a name match but for any type so in cases where the query has * both a named and anonymous (extensional) variable, an arbitrary one * will be returned. * * Return value: non-0 if the variable name was found. **/ int rasqal_query_has_variable2(rasqal_query* query, rasqal_variable_type type, const unsigned char *name) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, char*, 0); return rasqal_variables_table_contains(query->vars_table, type, name); } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_query_has_variable: * @query: #rasqal_query query object * @name: variable name * * Find if the named variable is in the query (of any type) * * @Deprecated: Use rasqal_query_has_variable2() with the variable type arg * * Return value: non-0 if the variable name was found. **/ int rasqal_query_has_variable(rasqal_query* query, const unsigned char *name) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, char*, 0); return rasqal_query_has_variable2(query, RASQAL_VARIABLE_TYPE_UNKNOWN, name); } #endif /** * rasqal_query_set_variable2: * @query: #rasqal_query query object * @type: the variable type to match or #RASQAL_VARIABLE_TYPE_UNKNOWN for any. * @name: #rasqal_variable variable * @value: #rasqal_literal value to set or NULL * * Bind an existing typed variable to a value to the query. * * See also rasqal_query_add_variable() which adds a new binding variable * and must be called before this method is invoked. * * Return value: non-0 on failure **/ int rasqal_query_set_variable2(rasqal_query* query, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, char*, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(value, rasqal_literal, 1); return rasqal_variables_table_set(query->vars_table, type, name, value); } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_query_set_variable: * @query: #rasqal_query query object * @name: #rasqal_variable variable * @value: #rasqal_literal value to set or NULL * * Bind an existing named (selected) variable to a value to the query. * * @Deprecated for rasqal_query_set_variable2() that includes a type * arg. This function only sets named variables of type * #RASQAL_VARIABLE_TYPE_NORMAL * * Return value: non-0 on failure **/ int rasqal_query_set_variable(rasqal_query* query, const unsigned char *name, rasqal_literal* value) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, char*, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(value, rasqal_literal, 1); return rasqal_query_set_variable2(query, RASQAL_VARIABLE_TYPE_NORMAL, name, value); } #endif /** * rasqal_query_get_triple_sequence: * @query: #rasqal_query query object * * Get the sequence of matching triples in the query. * * Return value: a #raptor_sequence of #rasqal_triple pointers. **/ raptor_sequence* rasqal_query_get_triple_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->triples; } /** * rasqal_query_get_triple: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a triple in the sequence of matching triples in the query. * * Return value: a #rasqal_triple pointer or NULL if out of the sequence range **/ rasqal_triple* rasqal_query_get_triple(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->triples) return NULL; return (rasqal_triple*)raptor_sequence_get_at(query->triples, idx); } int rasqal_query_declare_prefix(rasqal_query *rq, rasqal_prefix *p) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(rq, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(p, rasqal_prefix, 1); if(p->declared) return 0; if(raptor_namespaces_start_namespace_full(rq->namespaces, p->prefix, raptor_uri_as_string(p->uri), rq->prefix_depth)) return 1; p->declared = 1; rq->prefix_depth++; return 0; } static int rasqal_query_undeclare_prefix(rasqal_query *rq, rasqal_prefix *prefix) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(rq, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(prefix, rasqal_prefix, 1); if(!prefix->declared) { prefix->declared = 1; return 0; } raptor_namespaces_end_for_depth(rq->namespaces, prefix->depth); return 0; } int rasqal_query_declare_prefixes(rasqal_query *rq) { int i; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(rq, rasqal_query, 1); if(!rq->prefixes) return 0; for(i = 0; i< raptor_sequence_size(rq->prefixes); i++) { rasqal_prefix* p = (rasqal_prefix*)raptor_sequence_get_at(rq->prefixes, i); if(rasqal_query_declare_prefix(rq, p)) return 1; } return 0; } /** * rasqal_query_add_prefix: * @query: #rasqal_query query object * @prefix: #rasqal_prefix namespace prefix, URI * * Add a namespace prefix to the query. * * If the prefix has already been used, the old URI will be overridden. * * Return value: non-0 on failure **/ int rasqal_query_add_prefix(rasqal_query* query, rasqal_prefix* prefix) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(prefix, rasqal_prefix, 1); if(!query->prefixes) { query->prefixes = raptor_new_sequence((raptor_data_free_handler)rasqal_free_prefix, (raptor_data_print_handler)rasqal_prefix_print); if(!query->prefixes) return 1; } else { int i; for(i = 0; i < raptor_sequence_size(query->prefixes); i++) { rasqal_prefix* p; p = (rasqal_prefix*)raptor_sequence_get_at(query->prefixes, i); if((!p->prefix && !prefix->prefix) || ((p->prefix && prefix->prefix && !strcmp(RASQAL_GOOD_CAST(const char*, p->prefix), RASQAL_GOOD_CAST(const char*, prefix->prefix)))) ) { rasqal_query_undeclare_prefix(query, p); break; } } } return raptor_sequence_push(query->prefixes, (void*)prefix); } /** * rasqal_query_get_prefix_sequence: * @query: #rasqal_query query object * * Get the sequence of namespace prefixes in the query. * * Return value: a #raptor_sequence of #rasqal_prefix pointers. **/ raptor_sequence* rasqal_query_get_prefix_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->prefixes; } /** * rasqal_query_get_prefix: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a prefix in the sequence of namespsace prefixes in the query. * * Return value: a #rasqal_prefix pointer or NULL if out of the sequence range **/ rasqal_prefix* rasqal_query_get_prefix(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->prefixes) return NULL; return (rasqal_prefix*)raptor_sequence_get_at(query->prefixes, idx); } /** * rasqal_query_get_query_graph_pattern: * @query: #rasqal_query query object * * Get the top query graph pattern. * * Return value: a #rasqal_graph_pattern of the top query graph pattern **/ rasqal_graph_pattern* rasqal_query_get_query_graph_pattern(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->query_graph_pattern; } /** * rasqal_query_get_graph_pattern_sequence: * @query: #rasqal_query query object * * Get the sequence of graph_patterns expressions inside the top query graph pattern. * * Return value: a #raptor_sequence of #rasqal_graph_pattern pointers. **/ raptor_sequence* rasqal_query_get_graph_pattern_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return rasqal_graph_pattern_get_sub_graph_pattern_sequence(query->query_graph_pattern); } /** * rasqal_query_get_graph_pattern: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a graph_pattern in the sequence of graph_pattern expressions in the top query graph pattern. * * Return value: a #rasqal_graph_pattern pointer or NULL if out of the sequence range **/ rasqal_graph_pattern* rasqal_query_get_graph_pattern(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return rasqal_graph_pattern_get_sub_graph_pattern(query->query_graph_pattern, idx); } /** * rasqal_query_get_construct_triples_sequence: * @query: #rasqal_query query object * * Get the sequence of triples for a construct. * * Return value: a #raptor_sequence of #rasqal_triple pointers. **/ raptor_sequence* rasqal_query_get_construct_triples_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->constructs; } /** * rasqal_query_get_construct_triple: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a triple in the sequence of construct triples. * * Return value: a #rasqal_triple pointer or NULL if out of the sequence range **/ rasqal_triple* rasqal_query_get_construct_triple(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->constructs) return NULL; return (rasqal_triple*)raptor_sequence_get_at(query->constructs, idx); } /** * rasqal_query_prepare: * @query: the #rasqal_query object * @query_string: the query string (or NULL) * @base_uri: base URI of query string (optional) * * Prepare a query - typically parse it. * * Some query languages may require a base URI to resolve any * relative URIs in the query string. If this is not given, * the current directory in the filesystem is used as the base URI. * * The query string may be NULL in which case it is not parsed * and the query parts may be created by API calls such as * rasqal_query_add_source etc. * * Return value: non-0 on failure. **/ int rasqal_query_prepare(rasqal_query* query, const unsigned char *query_string, raptor_uri *base_uri) { int rc = 0; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(query->failed) return 1; if(query->prepared) return 0; query->prepared = 1; query->store_results = 0; if(query_string) { /* flex lexers require two NULs at the end of the lexed buffer. * Add them here instead of parser to allow resource cleanup on error. * * flex manual: * * Function: YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t size) * which scans in place the buffer starting at `base', consisting of * `size' bytes, the last two bytes of which _must_ be * `YY_END_OF_BUFFER_CHAR' (ASCII NUL). These last two bytes are not * scanned; thus, scanning consists of `base[0]' through * `base[size-2]', inclusive. */ size_t len = strlen(RASQAL_GOOD_CAST(const char*, query_string)) + 3; /* +3 for " \0\0" */ unsigned char *query_string_copy = RASQAL_MALLOC(unsigned char*, len); if(!query_string_copy) { query->failed = 1; return 1; } memcpy(query_string_copy, query_string, len - 3); query_string_copy[len - 3] = ' '; query_string_copy[len - 2] = query_string_copy[len - 1] = '\0'; query->query_string = query_string_copy; query->query_string_length = len; } if(base_uri) base_uri = raptor_uri_copy(base_uri); else { unsigned char *uri_string = raptor_uri_filename_to_uri_string(""); base_uri = raptor_new_uri(query->world->raptor_world_ptr, uri_string); if(uri_string) raptor_free_memory(uri_string); } rasqal_query_set_base_uri(query, base_uri); query->locator.line = query->locator.column = query->locator.byte = -1; /* set evaluaton context with latest copies of query fields */ query->eval_context->flags = query->compare_flags; rasqal_evaluation_context_set_base_uri(query->eval_context, query->base_uri); /* set random seed */ if(1) { unsigned int seed; /* get seed either from user or system sources */ if(query->user_set_rand) /* it is ok to truncate here for the purposes of getting a seed */ seed = RASQAL_GOOD_CAST(unsigned int, query->features[RASQAL_GOOD_CAST(int, RASQAL_FEATURE_RAND_SEED)]); else seed = rasqal_random_get_system_seed(query->world); rasqal_evaluation_context_set_rand_seed(query->eval_context, seed); } rc = query->factory->prepare(query); if(rc) { query->failed = 1; rc = 1; } else if(rasqal_query_prepare_common(query)) { query->failed = 1; rc = 1; } return rc; } /** * rasqal_query_get_engine_by_name: * @name: query engine name * * INTERNAL - Get a query engine by name * * If @name is NULL or the name is unknown, the default factory is returned * * return value: pointer to factory **/ const rasqal_query_execution_factory* rasqal_query_get_engine_by_name(const char* name) { const rasqal_query_execution_factory* engine; /* default */ engine = &rasqal_query_engine_algebra; if(name) { if(!strcmp(name, "2") || !strcmp(name, "algebra")) engine = &rasqal_query_engine_algebra; else engine = NULL; } return engine; } /** * rasqal_query_execute_with_engine: * @query: the #rasqal_query object * @engine: execution engine factory (or NULL) * * INTERNAL - Excecute a query with a given factory and return results. * * return value: a #rasqal_query_results structure or NULL on failure. **/ rasqal_query_results* rasqal_query_execute_with_engine(rasqal_query* query, const rasqal_query_execution_factory* engine) { rasqal_query_results *query_results = NULL; rasqal_query_results_type type; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(query->failed) return NULL; type = rasqal_query_get_result_type(query); if(type == RASQAL_QUERY_RESULTS_UNKNOWN) return NULL; query_results = rasqal_new_query_results2(query->world, query, type); if(!query_results) return NULL; if(!engine) engine = rasqal_query_get_engine_by_name(NULL); if(rasqal_query_results_execute_with_engine(query_results, engine, query->store_results)) { rasqal_free_query_results(query_results); query_results = NULL; } if(query_results && rasqal_query_add_query_result(query, query_results)) { rasqal_free_query_results(query_results); query_results = NULL; } return query_results; } /** * rasqal_query_execute: * @query: the #rasqal_query object * * Excute a query - run and return results. * * return value: a #rasqal_query_results structure or NULL on failure. **/ rasqal_query_results* rasqal_query_execute(rasqal_query* query) { return rasqal_query_execute_with_engine(query, NULL); } static const char* const rasqal_query_verb_labels[RASQAL_QUERY_VERB_LAST+1] = { "Unknown", "SELECT", "CONSTRUCT", "DESCRIBE", "ASK", "DELETE", "INSERT", "UPDATE" }; /* Utility methods */ /** * rasqal_query_verb_as_string: * @verb: the #rasqal_query_verb verb of the query * * Get a string for the query verb. * * Return value: pointer to a shared string label for the query verb **/ const char* rasqal_query_verb_as_string(rasqal_query_verb verb) { if(verb <= RASQAL_QUERY_VERB_UNKNOWN || verb > RASQAL_QUERY_VERB_LAST) verb = RASQAL_QUERY_VERB_UNKNOWN; return rasqal_query_verb_labels[RASQAL_GOOD_CAST(int, verb)]; } /** * rasqal_query_print: * @query: the #rasqal_query object * @fh: the FILE* handle to print to. * * Print a query in a debug format. * * Return value: non-0 on failure **/ int rasqal_query_print(rasqal_query* query, FILE *fh) { rasqal_variables_table* vars_table = query->vars_table; raptor_sequence* seq; int distinct_mode; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); fprintf(fh, "query verb: %s\n", rasqal_query_verb_as_string(query->verb)); distinct_mode = rasqal_query_get_distinct(query); if(distinct_mode) fprintf(fh, "query results distinct mode: %s\n", (distinct_mode == 1 ? "distinct" : "reduced")); if(query->explain) fputs("query results explain: yes\n", fh); if(query->modifier) { if(query->modifier->limit > 0) fprintf(fh, "query results limit: %d\n", query->modifier->limit); if(query->modifier->offset > 0) fprintf(fh, "query results offset: %d\n", query->modifier->offset); } fputs("data graphs: ", fh); if(query->data_graphs) raptor_sequence_print(query->data_graphs, fh); seq = rasqal_variables_table_get_named_variables_sequence(vars_table); if(seq) { fputs("\nnamed variables: ", fh); raptor_sequence_print(seq, fh); } seq = rasqal_variables_table_get_anonymous_variables_sequence(vars_table); if(seq) { fputs("\nanonymous variables: ", fh); raptor_sequence_print(seq, fh); } seq = rasqal_query_get_bound_variable_sequence(query); if(seq) { int i; fputs("\nprojected variable names: ", fh); for(i = 0; 1; i++) { rasqal_variable* v = (rasqal_variable*)raptor_sequence_get_at(seq, i); if(!v) break; if(i > 0) fputs(", ", fh); fputs((const char*)v->name, fh); } fputc('\n', fh); fputs("\nbound variables: ", fh); raptor_sequence_print(seq, fh); } if(query->describes) { fputs("\ndescribes: ", fh); raptor_sequence_print(query->describes, fh); } if(query->triples) { fputs("\ntriples: ", fh); raptor_sequence_print(query->triples, fh); } if(query->optional_triples) { fputs("\noptional triples: ", fh); raptor_sequence_print(query->optional_triples, fh); } if(query->constructs) { fputs("\nconstructs: ", fh); raptor_sequence_print(query->constructs, fh); } if(query->prefixes) { fputs("\nprefixes: ", fh); raptor_sequence_print(query->prefixes, fh); } if(query->query_graph_pattern) { fputs("\nquery graph pattern: ", fh); rasqal_graph_pattern_print(query->query_graph_pattern, fh); } if(query->modifier) { if(query->modifier->order_conditions) { fputs("\nquery order conditions: ", fh); raptor_sequence_print(query->modifier->order_conditions, fh); } if(query->modifier->group_conditions) { fputs("\nquery group conditions: ", fh); raptor_sequence_print(query->modifier->group_conditions, fh); } if(query->modifier->having_conditions) { fputs("\nquery having conditions: ", fh); raptor_sequence_print(query->modifier->having_conditions, fh); } } if(query->updates) { fputs("\nupdate operations: ", fh); raptor_sequence_print(query->updates, fh); } if(query->bindings) { fputs("\nbindings: ", fh); rasqal_bindings_print(query->bindings, fh); } fputc('\n', fh); return 0; } static int rasqal_query_add_query_result(rasqal_query* query, rasqal_query_results* query_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); /* add reference to ensure query lives as long as this runs */ /* query->results sequence has rasqal_query_results_remove_query_reference() as the free handler which calls rasqal_free_query() decrementing query->usage */ query->usage++; return raptor_sequence_push(query->results, query_results); } int rasqal_query_remove_query_result(rasqal_query* query, rasqal_query_results* query_results) { int i; int size; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, rasqal_query_results, 1); size = raptor_sequence_size(query->results); for(i = 0 ; i < size; i++) { rasqal_query_results *result; result = (rasqal_query_results*)raptor_sequence_get_at(query->results, i); if(result == query_results) { raptor_sequence_set_at(query->results, i, NULL); break; } } return 0; } /** * rasqal_query_get_user_data: * @query: #rasqal_query * * Get query user data. * * Return value: user data as set by rasqal_query_set_user_data() **/ void* rasqal_query_get_user_data(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->user_data; } /** * rasqal_query_set_user_data: * @query: #rasqal_query * @user_data: some user data to associate with the query * * Set the query user data. * **/ void rasqal_query_set_user_data(rasqal_query* query, void *user_data) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); query->user_data = user_data; } /** * rasqal_query_get_verb: * @query: #rasqal_query * * Get the query verb. * * Return value: the operating verb of the query of type rasqal_query_verb **/ rasqal_query_verb rasqal_query_get_verb(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, RASQAL_QUERY_VERB_UNKNOWN); return query->verb; } /** * rasqal_query_get_wildcard: * @query: #rasqal_query * * Get the query verb is wildcard flag. * * Return value: non-0 if the query verb was a wildcard (such as SELECT *) **/ int rasqal_query_get_wildcard(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 0); if(!query->projection) return 0; return query->projection->wildcard; } /** * rasqal_query_set_wildcard: * @query: #rasqal_query query object * @wildcard: wildcard * * Set the query projection wildcard flag * **/ void rasqal_query_set_wildcard(rasqal_query* query, int wildcard) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); if(!query->projection) { query->projection = rasqal_new_projection(query, /* variables */ NULL, /* wildcard */ 0, /* wildcard */ 0); if(!query->projection) return; } query->projection->wildcard = wildcard ? 1 : 0; } /** * rasqal_query_get_order_conditions_sequence: * @query: #rasqal_query query object * * Get the sequence of query ordering conditions. * * Return value: a #raptor_sequence of #rasqal_expression pointers. **/ raptor_sequence* rasqal_query_get_order_conditions_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(query->modifier) return query->modifier->order_conditions; else return NULL; } /** * rasqal_query_get_order_condition: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a query ordering expression in the sequence of query ordering conditions. * * Return value: a #rasqal_expression pointer or NULL if out of the sequence range **/ rasqal_expression* rasqal_query_get_order_condition(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->modifier || !query->modifier->order_conditions) return NULL; return (rasqal_expression*)raptor_sequence_get_at(query->modifier->order_conditions, idx); } /** * rasqal_query_get_group_conditions_sequence: * @query: #rasqal_query query object * * Get the sequence of query grouping conditions. * * Return value: a #raptor_sequence of #rasqal_expression pointers. **/ raptor_sequence* rasqal_query_get_group_conditions_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(query->modifier) return query->modifier->group_conditions; else return NULL; } /** * rasqal_query_get_group_condition: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a query grouping expression in the sequence of query grouping conditions. * * Return value: a #rasqal_expression pointer or NULL if out of the sequence range **/ rasqal_expression* rasqal_query_get_group_condition(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->modifier || !query->modifier->group_conditions) return NULL; return (rasqal_expression*)raptor_sequence_get_at(query->modifier->group_conditions, idx); } /** * rasqal_query_get_having_conditions_sequence: * @query: #rasqal_query query object * * Get the sequence of query having conditions. * * Return value: a #raptor_sequence of #rasqal_expression pointers. **/ raptor_sequence* rasqal_query_get_having_conditions_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(query->modifier) return query->modifier->having_conditions; else return NULL; } /** * rasqal_query_get_having_condition: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a query having expression in the sequence of query havinging conditions. * * Return value: a #rasqal_expression pointer or NULL if out of the sequence range **/ rasqal_expression* rasqal_query_get_having_condition(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->modifier || !query->modifier->having_conditions) return NULL; return (rasqal_expression*)raptor_sequence_get_at(query->modifier->having_conditions, idx); } /** * rasqal_query_graph_pattern_visit2: * @query: query * @visit_fn: user function to operate on * @data: user data to pass to function * * Visit all graph patterns in a query with a user function @visit_fn. * * See also rasqal_graph_pattern_visit(). * * Return value: result from visit function @visit_fn if it returns non-0 **/ int rasqal_query_graph_pattern_visit2(rasqal_query* query, rasqal_graph_pattern_visit_fn visit_fn, void* data) { rasqal_graph_pattern* gp; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); gp = rasqal_query_get_query_graph_pattern(query); if(!gp) return 1; return rasqal_graph_pattern_visit(query, gp, visit_fn, data); } #ifndef RASQAL_DISABLE_DEPRECATED /** * rasqal_query_graph_pattern_visit: * @query: query * @visit_fn: user function to operate on * @data: user data to pass to function * * Visit all graph patterns in a query with a user function @visit_fn. * * @Deprecated: use rasqal_query_graph_pattern_visit2() that returns the @visit_fn status code. * * See also rasqal_graph_pattern_visit(). **/ void rasqal_query_graph_pattern_visit(rasqal_query* query, rasqal_graph_pattern_visit_fn visit_fn, void* data) { (void)rasqal_query_graph_pattern_visit2(query, visit_fn, data); } #endif /** * rasqal_query_write: * @iostr: #raptor_iostream to write the query to * @query: #rasqal_query pointer. * @format_uri: #raptor_uri describing the format to write (or NULL for default) * @base_uri: #raptor_uri base URI of the output format * * Write a query to an iostream in a specified format. * * The supported URIs for the format_uri are: * * Default: SPARQL Query Language 2006-04-06 * http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/ * * Return value: non-0 on failure **/ int rasqal_query_write(raptor_iostream* iostr, rasqal_query* query, raptor_uri* format_uri, raptor_uri* base_uri) { const char *format_uri_str = NULL; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(format_uri) format_uri_str = RASQAL_GOOD_CAST(const char*, raptor_uri_as_string(format_uri)); if(!format_uri || !strcmp(format_uri_str, "http://www.w3.org/TR/rdf-sparql-query/") || !strcmp(format_uri_str, "http://www.w3.org/TR/2006/WD-rdf-sparql-query-20060220/") || !strcmp(format_uri_str, "http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/")) return rasqal_query_write_sparql_20060406(iostr, query, base_uri); return 1; } /** * rasqal_query_iostream_write_escaped_counted_string: * @query: #rasqal_query object * @iostr: #raptor_iostream to write the escaped string to * @string: string to escape * @len: Length of string to escape * * Write a string to an iostream in escaped form suitable for the query string. * * Return value: non-0 on failure **/ int rasqal_query_iostream_write_escaped_counted_string(rasqal_query* query, raptor_iostream* iostr, const unsigned char* string, size_t len) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(iostr, raptor_iostream, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, 1); if(query->factory->iostream_write_escaped_counted_string) return query->factory->iostream_write_escaped_counted_string(query, iostr, string, len); else return 1; } /** * rasqal_query_escape_counted_string: * @query: #rasqal_query object * @string: string to escape * @len: Length of string to escape * @output_len_p: Pointer to store length of output string (or NULL) * * Convert a string into an escaped form suitable for the query string. * * The returned string must be freed by the caller with * rasqal_free_memory() * * Return value: the escaped string or NULL on failure. **/ unsigned char* rasqal_query_escape_counted_string(rasqal_query* query, const unsigned char* string, size_t len, size_t* output_len_p) { raptor_iostream* iostr; void* output_string = NULL; int rc; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(string, char*, NULL); iostr = raptor_new_iostream_to_string(query->world->raptor_world_ptr, &output_string, output_len_p, rasqal_alloc_memory); if(!iostr) return NULL; rc = rasqal_query_iostream_write_escaped_counted_string(query, iostr, string, len); raptor_free_iostream(iostr); if(rc && output_string) { rasqal_free_memory(output_string); output_string = NULL; } return (unsigned char *)output_string; } void rasqal_query_set_base_uri(rasqal_query* query, raptor_uri* base_uri) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(query, rasqal_query); RASQAL_ASSERT_OBJECT_POINTER_RETURN(base_uri, raptor_uri); if(query->base_uri) raptor_free_uri(query->base_uri); query->base_uri = base_uri; query->locator.uri = base_uri; } /** * rasqal_query_set_store_results: * @query: the #rasqal_query object * @store_results: store results flag * * Request that query results are stored during execution * * When called after a rasqal_query_prepare(), this tells * rasqal_query_execute() to execute the entire query immediately * rather than generate them lazily, and store all the results in * memory. The results will then be available for reading multiple * times using rasqal_query_results_rewind() to move back to the * start of the result object. If called after preparation, returns * failure. * * Return value: non-0 on failure. **/ int rasqal_query_set_store_results(rasqal_query* query, int store_results) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(!query->prepared) return 1; query->store_results = store_results; return 0; } rasqal_variable* rasqal_query_get_variable_by_offset(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return rasqal_variables_table_get(query->vars_table, idx); } /* * rasqal_query_add_update_operation: * @query: #rasqal_query query object * @update: #rasqal_update_operation to add * * Add a update operation to the query. * * INTERNAL - The @update object becomes owned by the query. * * Return value: non-0 on failure **/ int rasqal_query_add_update_operation(rasqal_query* query, rasqal_update_operation *update) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(!update) return 1; if(!query->updates) { query->updates = raptor_new_sequence((raptor_data_free_handler)rasqal_free_update_operation, (raptor_data_print_handler)rasqal_update_operation_print); if(!query->updates) { rasqal_free_update_operation(update); return 1; } } if(raptor_sequence_push(query->updates, (void*)update)) return 1; return 0; } /** * rasqal_query_get_update_operations_sequence: * @query: #rasqal_query query object * * Get the sequence of update operations * * Return value: a #raptor_sequence of #rasqal_update_operation pointers. **/ raptor_sequence* rasqal_query_get_update_operations_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->updates; } /** * rasqal_query_get_update_operation: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a query update operation in the sequence of update operations * * Return value: a #rasqal_update_operation pointer or NULL if out of the sequence range **/ rasqal_update_operation* rasqal_query_get_update_operation(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->updates) return NULL; return (rasqal_update_operation*)raptor_sequence_get_at(query->updates, idx); } /* * rasqal_query_generate_bnodeid - Default generate id - internal */ unsigned char* rasqal_query_generate_bnodeid(rasqal_query* rdf_query, unsigned char *user_bnodeid) { /* prefer world generate handler/data */ if(rdf_query->world->generate_bnodeid_handler) return rasqal_world_generate_bnodeid(rdf_query->world, user_bnodeid); return rasqal_world_default_generate_bnodeid_handler(rdf_query->world, user_bnodeid); } /** * rasqal_query_get_bindings_variables_sequence: * @query: #rasqal_query query object * * Get the sequence of BINDINGS block variables * * Return value: a #raptor_sequence of #raptor_variable pointers **/ raptor_sequence* rasqal_query_get_bindings_variables_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(query->bindings) return query->bindings->variables; else return NULL; } /** * rasqal_query_get_bindings_variable: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a rasqal_variable* in the sequence of BINDINGS block variables * * Return value: a #raptor_sequence of #raptor_variable pointers **/ rasqal_variable* rasqal_query_get_bindings_variable(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->bindings || !query->bindings->variables) return NULL; return (rasqal_variable*)raptor_sequence_get_at(query->bindings->variables, idx); } /** * rasqal_query_get_bindings_rows_sequence: * @query: #rasqal_query query object * * Get the sequence of BINDINGS block result rows * * Return value: a #raptor_sequence of #raptor_row pointers **/ raptor_sequence* rasqal_query_get_bindings_rows_sequence(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(query->bindings) return query->bindings->rows; else return NULL; } /** * rasqal_query_get_bindings_row: * @query: #rasqal_query query object * @idx: index into the sequence (0 or larger) * * Get a rasqal_row* in the sequence of BINDINGS block result rows * * Return value: a #raptor_sequence of #raptor_row pointers **/ rasqal_row* rasqal_query_get_bindings_row(rasqal_query* query, int idx) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); if(!query->bindings || !query->bindings->rows) return NULL; return (rasqal_row*)raptor_sequence_get_at(query->bindings->rows, idx); } /* * rasqal_query_variable_bound_in_triple: * @query: #rasqal_query query object * @variable: variable * @column: triple column * * INTERNAL - Test if variable is bound in given triple * * Return value: part of triple the variable is bound in */ rasqal_triple_parts rasqal_query_variable_bound_in_triple(rasqal_query* query, rasqal_variable* v, int column) { int width; unsigned short *triple_row; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, (rasqal_triple_parts)0); width = rasqal_variables_table_get_total_variables_count(query->vars_table); triple_row = &query->triples_use_map[column * width]; return (rasqal_triple_parts)((triple_row[v->offset] & RASQAL_TRIPLES_BOUND_MASK) >> 4); } /** * rasqal_query_get_result_type: * @query: #rasqal_query query object * * Get the result type expected from executing the query. * * This function is only valid after rasqal_query_prepare() has been * run on the query and will return #RASQAL_QUERY_RESULTS_UNKNOWN if * called before preparation. * * Return value: result type or #RASQAL_QUERY_RESULTS_UNKNOWN if not known or on error **/ rasqal_query_results_type rasqal_query_get_result_type(rasqal_query* query) { rasqal_query_results_type type = RASQAL_QUERY_RESULTS_BINDINGS; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, RASQAL_QUERY_RESULTS_UNKNOWN); if(!query->prepared) return RASQAL_QUERY_RESULTS_UNKNOWN; if(query->query_results_formatter_name) type = RASQAL_QUERY_RESULTS_SYNTAX; else switch(query->verb) { case RASQAL_QUERY_VERB_SELECT: type = RASQAL_QUERY_RESULTS_BINDINGS; break; case RASQAL_QUERY_VERB_ASK: type = RASQAL_QUERY_RESULTS_BOOLEAN; break; case RASQAL_QUERY_VERB_CONSTRUCT: case RASQAL_QUERY_VERB_DESCRIBE: type = RASQAL_QUERY_RESULTS_GRAPH; break; case RASQAL_QUERY_VERB_UNKNOWN: case RASQAL_QUERY_VERB_DELETE: case RASQAL_QUERY_VERB_INSERT: case RASQAL_QUERY_VERB_UPDATE: default: type = RASQAL_QUERY_RESULTS_UNKNOWN; } return type; } /* * rasqal_query_store_select_query: * @query: query * @gp: SELECT graph pattern * * INTERNAL - store a select query * * The query object owns the @projection, @data_graphs, @where_gp and * the @modifier after this call. * * Return value: non-0 on failure */ int rasqal_query_store_select_query(rasqal_query* query, rasqal_projection* projection, raptor_sequence* data_graphs, rasqal_graph_pattern* where_gp, rasqal_solution_modifier* modifier) { if(!projection || !where_gp || !modifier) return 1; query->verb = RASQAL_QUERY_VERB_SELECT; rasqal_query_set_projection(query, projection); query->query_graph_pattern = where_gp; if(data_graphs) rasqal_query_add_data_graphs(query, data_graphs); rasqal_query_set_modifier(query, modifier); return 0; } int rasqal_query_reset_select_query(rasqal_query* query) { rasqal_query_set_projection(query, NULL); rasqal_query_set_modifier(query, NULL); if(query->data_graphs) { while(1) { rasqal_data_graph* dg; dg = (rasqal_data_graph*)raptor_sequence_pop(query->data_graphs); if(!dg) break; rasqal_free_data_graph(dg); } } return 0; } /* * rasqal_query_get_projection: * @query: #rasqal_query * * INTERNAL - Get the query variable projection * * This may be NULL if the query does not project any variables such * as for CONSTRUCT or ASK queries. * * Return value: projection or NULL. **/ rasqal_projection* rasqal_query_get_projection(rasqal_query* query) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); return query->projection; } /* * rasqal_query_set_projection: * @query: #rasqal_query * @projection: variable projection and flags * * INTERNAL - Set the query projection * * Return value: non-0 on failure **/ int rasqal_query_set_projection(rasqal_query* query, rasqal_projection* projection) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(query->projection) rasqal_free_projection(query->projection); query->projection = projection; return 0; } /* * rasqal_query_set_modifier: * @query: #rasqal_query * @modifier: variable modifier and flags * * INTERNAL - Set the query modifier * * Return value: non-0 on failure **/ int rasqal_query_set_modifier(rasqal_query* query, rasqal_solution_modifier* modifier) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, 1); if(query->modifier) rasqal_free_solution_modifier(query->modifier); query->modifier = modifier; return 0; } rasqal-0.9.33/src/rasqal_update.c0000644000175000017500000001372212441120534013573 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_update.c - Rasqal graph update operations * * Copyright (C) 2010-2011, Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" static const char* const rasqal_update_type_labels[RASQAL_UPDATE_TYPE_LAST + 1] = { "Unknown", "CLEAR", "CREATE", "DROP", "LOAD", "UPDATE", "ADD", "MOVE", "COPY" }; /* * rasqal_update_type_label: * @type: the #rasqal_update_type type of the update operation * * INTERNAL - Get a string for the update operation type. * * Return value: pointer to a shared string label **/ const char* rasqal_update_type_label(rasqal_update_type type) { if(type <= RASQAL_UPDATE_TYPE_UNKNOWN || type > RASQAL_UPDATE_TYPE_LAST) type = RASQAL_UPDATE_TYPE_UNKNOWN; return rasqal_update_type_labels[RASQAL_GOOD_CAST(int, type)]; } /* * rasqal_new_update_operation: * @type: type of update * @graph_uri: optional graph URI * @document_uri: optional document URI * @insert_templates: optional sequence of #rasqal_triple to insert. Data triples if @flags is #RASQAL_UPDATE_FLAGS_DATA set, templates otherwise. * @delete_templates: optional sequence of #rasqal_triple templates to delete * @where: optional where BASIC graph pattern * @flags: update flags - bit-or of flags defined in #rasqal_update_flags * @applies: graph to which update applies defined in #rasqal_update_graph_applies * * INTERNAL - Constructor - Create new update operation * * All parameters become owned by the update operation. * * At least one of @graph_uri, @document_uri, @insert_templates, * @delete_templates or @graph_pattern must be given unless type is * #RASQAL_UPDATE_TYPE_CLEAR * * Return value: new update object or NULL on failure */ rasqal_update_operation* rasqal_new_update_operation(rasqal_update_type type, raptor_uri* graph_uri, raptor_uri* document_uri, raptor_sequence* insert_templates, raptor_sequence* delete_templates, rasqal_graph_pattern* where, int flags, rasqal_update_graph_applies applies) { rasqal_update_operation* update; int is_always_2_args = (type >= RASQAL_UPDATE_TYPE_ADD && type <= RASQAL_UPDATE_TYPE_COPY); if(!is_always_2_args && type != RASQAL_UPDATE_TYPE_CLEAR) { if(!graph_uri && !document_uri && !insert_templates && !delete_templates && !where) return NULL; } update = RASQAL_MALLOC(rasqal_update_operation*, sizeof(*update)); if(!update) return NULL; update->type = type; update->graph_uri = graph_uri; update->document_uri = document_uri; update->insert_templates = insert_templates; update->delete_templates = delete_templates; update->where = where; update->flags = flags; update->applies = applies; return update; } /* * rasqal_free_update_operation: * @update: update operation * * INTERNAL - Destructor - Free update operation * */ void rasqal_free_update_operation(rasqal_update_operation *update) { if(!update) return; if(update->graph_uri) raptor_free_uri(update->graph_uri); if(update->document_uri) raptor_free_uri(update->document_uri); if(update->insert_templates) raptor_free_sequence(update->insert_templates); if(update->delete_templates) raptor_free_sequence(update->delete_templates); if(update->where) rasqal_free_graph_pattern(update->where); RASQAL_FREE(update_operation, update); } int rasqal_update_operation_print(rasqal_update_operation *update, FILE* stream) { int is_always_2_args = (update->type >= RASQAL_UPDATE_TYPE_ADD && update->type <= RASQAL_UPDATE_TYPE_COPY); fputs("update-operation(type=", stream); fputs(rasqal_update_type_label(update->type), stream); if(update->graph_uri || is_always_2_args) { fputs(", graph-uri=", stream); if(update->graph_uri) raptor_uri_print(update->graph_uri, stream); else fputs("default", stream); } if(update->document_uri || is_always_2_args) { fputs(", document-uri=", stream); if(update->document_uri) raptor_uri_print(update->document_uri, stream); else fputs("default", stream); } switch(update->applies) { case RASQAL_UPDATE_GRAPH_ONE: fputs(", applies: one graph", stream); break; case RASQAL_UPDATE_GRAPH_DEFAULT: fputs(", applies: default", stream); break; case RASQAL_UPDATE_GRAPH_NAMED: fputs(", applies: named", stream); break; case RASQAL_UPDATE_GRAPH_ALL: fputs(", applies: all", stream); break; } if(update->insert_templates) { fputs(", insert-templates=", stream); raptor_sequence_print(update->insert_templates, stream); } if(update->delete_templates) { fputs(", delete-templates=", stream); raptor_sequence_print(update->delete_templates, stream); } if(update->where) { fputs(", where=", stream); rasqal_graph_pattern_print(update->where, stream); } fputc(')', stream); return 0; } rasqal-0.9.33/src/rasqal_digest_md5.c0000644000175000017500000002351512241743242014343 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_digest_md5.c - MD5 Message Digest Algorithm * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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. * * */ /* Original code notes: */ /* An independent implementation of MD5 by Colin Plumb. */ /* Original copyright message: */ /* * This code implements the MD5 message-digest algorithm. To compute * the message digest of a chunk of bytes, declare an MD5Context * structure, pass it to MD5Init, call MD5Update as needed on * buffers full of bytes, and then call MD5Final, which will fill a * supplied 16-byte array with the digest. * * Equivalent code is available from RSA Data Security, Inc. This code * has been tested against that, and is equivalent, except that you * don't need to include two pages of legalese with every copy. */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #include "rasqal.h" #include "rasqal_internal.h" #define u32 uint32_t #define MD5_DIGEST_LEN 16 /* original code from header - function names have changed */ /* make compiler align u32* and unsigned char buffers */ struct MD5Context { union { unsigned char c[128]; u32 w[32]; } buf; u32 bits[2]; union { unsigned char c[64]; u32 w[16]; } in; unsigned char digest[MD5_DIGEST_LEN]; }; static void MD5Init(struct MD5Context *context); static void MD5Update(struct MD5Context *context, const unsigned char *buf, size_t len); static void MD5Final(struct MD5Context *context); static void MD5Transform (u32 buf[4], u32 const in[MD5_DIGEST_LEN]); /* original code from C file - GNU configurised */ #ifndef WORDS_BIGENDIAN #define byteReverse(buf, len) /* Nothing */ #else static void byteReverse(unsigned char *buf, unsigned longs); /* ASM ifdef removed */ /* * Note: this code is harmless on little-endian machines. */ static void byteReverse(unsigned char *buf, unsigned longs) { u32 t; do { t = (u32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]); *(u32 *) buf = t; buf += 4; } while (--longs); } #endif /* WORDS_BIGENDIAN */ /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ static void MD5Init(struct MD5Context *ctx) { ctx->buf.w[0] = 0x67452301; ctx->buf.w[1] = 0xefcdab89; ctx->buf.w[2] = 0x98badcfe; ctx->buf.w[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ static void MD5Update(struct MD5Context *ctx, const unsigned char* buf, size_t len) { u32 t; u32 ulen = RASQAL_BAD_CAST(u32, len); /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + (ulen << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += ulen >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = ctx->in.c + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in.c, 16); MD5Transform(ctx->buf.w, ctx->in.w); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in.c, buf, 64); byteReverse(ctx->in.c, 16); MD5Transform(ctx->buf.w, ctx->in.w); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in.c, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ /* Interface altered by DJB to write digest into pre-allocated context */ static void MD5Final(struct MD5Context *ctx) { unsigned count; unsigned char *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = ctx->in.c + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in.c, 16); MD5Transform(ctx->buf.w, ctx->in.w); /* Now fill the next block with 56 bytes */ memset(ctx->in.c, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in.c, 14); /* Append length in bits and transform */ (ctx->in.w)[14] = ctx->bits[0]; (ctx->in.w)[15] = ctx->bits[1]; MD5Transform(ctx->buf.w, ctx->in.w); byteReverse(ctx->buf.c, 4); memcpy(ctx->digest, ctx->buf.c, MD5_DIGEST_LEN); } /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ static void MD5Transform(u32 buf[4], u32 const in[MD5_DIGEST_LEN]) { register u32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } /* DJB code from here */ int rasqal_digest_md5_buffer(const unsigned char *output, const unsigned char *input, size_t len) { struct MD5Context ctx; /* static */ if(!input) return MD5_DIGEST_LEN; MD5Init(&ctx); MD5Update(&ctx, input, len); MD5Final(&ctx); memcpy((void*)output, ctx.digest, MD5_DIGEST_LEN); return MD5_DIGEST_LEN; } rasqal-0.9.33/src/rasqal_format_html.c0000644000175000017500000002333512435141254014633 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_format_html.c - Format results in HTML Table * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #include static int rasqal_iostream_write_html_literal(rasqal_world* world, raptor_iostream *iostr, rasqal_literal* l) { if(!l) { raptor_iostream_counted_string_write("", 22, iostr); raptor_iostream_counted_string_write("unbound", 7, iostr); } else { const unsigned char* str; size_t len; switch(l->type) { case RASQAL_LITERAL_URI: str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->value.uri, &len)); raptor_iostream_counted_string_write("", 18, iostr); raptor_iostream_counted_string_write("", 2, iostr); raptor_xml_escape_string_write(str, len, 0, iostr); raptor_iostream_counted_string_write("", 4, iostr); break; case RASQAL_LITERAL_BLANK: raptor_iostream_counted_string_write("", 20, iostr); raptor_xml_escape_string_write(l->string, l->string_len, 0, iostr); break; case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: raptor_iostream_counted_string_write("", 22, iostr); raptor_iostream_counted_string_write("language) { str = RASQAL_GOOD_CAST(const unsigned char*, l->language); raptor_iostream_counted_string_write(" xml:lang=\"", 11, iostr); raptor_xml_escape_string_write(str, strlen(l->language), '"', iostr); raptor_iostream_write_byte('"', iostr); } raptor_iostream_write_byte('>', iostr); raptor_xml_escape_string_write(l->string, l->string_len, 0, iostr); raptor_iostream_counted_string_write("", 7, iostr); if(l->datatype) { raptor_iostream_counted_string_write("^^<", 29, iostr); str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->datatype, &len)); raptor_xml_escape_string_write(str, len, 0, iostr); raptor_iostream_counted_string_write(">", 11, iostr); } break; case RASQAL_LITERAL_VARIABLE: return rasqal_iostream_write_html_literal(world, iostr, l->value.variable->value); case RASQAL_LITERAL_UNKNOWN: default: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot turn literal type %u into HTML", l->type); return 1; } } raptor_iostream_counted_string_write("", 7, iostr); return 0; } static int rasqal_query_results_write_html_bindings(raptor_iostream *iostr, rasqal_query_results* results) { rasqal_world* world = rasqal_query_results_get_world(results); int i; raptor_iostream_counted_string_write( " \n", 34, iostr); raptor_iostream_counted_string_write(" \n", 9, iostr); for(i = 0; 1; i++) { const unsigned char *name; size_t len; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; len = strlen(RASQAL_GOOD_CAST(char*, name)); raptor_iostream_counted_string_write(" \n", 6, iostr); } raptor_iostream_counted_string_write(" \n", 10, iostr); while(!rasqal_query_results_finished(results)) { raptor_iostream_counted_string_write(" \n", 24, iostr); for(i = 0; i < rasqal_query_results_get_bindings_count(results); i++) { rasqal_literal *l = rasqal_query_results_get_binding_value(results, i); raptor_iostream_counted_string_write(" \n", 6, iostr); } raptor_iostream_counted_string_write(" \n", 10, iostr); rasqal_query_results_next(results); } raptor_iostream_counted_string_write("
?", 11, iostr); raptor_xml_escape_string_write(name, len, 0, iostr); raptor_iostream_counted_string_write("
", 10, iostr); rasqal_iostream_write_html_literal(world, iostr, l); raptor_iostream_counted_string_write("
\n", 11, iostr); raptor_iostream_counted_string_write( "

Total number of rows: ", 47, iostr); raptor_iostream_decimal_write(rasqal_query_results_get_count(results), iostr); raptor_iostream_counted_string_write(".

\n", 13, iostr); return 0; } static int rasqal_query_results_write_html_boolean(raptor_iostream *iostr, rasqal_query_results* results) { raptor_iostream_counted_string_write("

The result of your query is:\n", 34, iostr); if(rasqal_query_results_get_boolean(results)) { raptor_iostream_counted_string_write(" true\n", 34, iostr); } else { raptor_iostream_counted_string_write(" false\n", 35, iostr); } raptor_iostream_counted_string_write("

\n", 7, iostr); return 0; } /* * rasqal_query_results_write_html: * @iostr: #raptor_iostream to write the query results to * @results: #rasqal_query_results query results input * @base_uri: #raptor_uri base URI of the output format * * Write an HTML Table of the query results format to an iostream - INTERNAL. * * If the writing succeeds, the query results will be exhausted. * * Return value: non-0 on failure **/ static int rasqal_query_results_write_html(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { rasqal_query* query = rasqal_query_results_get_query(results); rasqal_query_results_type type; type = rasqal_query_results_get_type(results); if(type != RASQAL_QUERY_RESULTS_BINDINGS && type != RASQAL_QUERY_RESULTS_BOOLEAN) { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Cannot write HTML Table for %s query result format", rasqal_query_results_type_label(type)); return 1; } /* XML and HTML declarations */ raptor_iostream_counted_string_write( "\n", 39, iostr); raptor_iostream_counted_string_write( "\n", 106, iostr); raptor_iostream_counted_string_write( "\n", 44, iostr); raptor_iostream_counted_string_write("\n", 7, iostr); raptor_iostream_counted_string_write(" SPARQL Query Results\n", 38, iostr); raptor_iostream_counted_string_write("\n", 8, iostr); raptor_iostream_counted_string_write("\n", 7, iostr); if(rasqal_query_results_is_boolean(results)) rasqal_query_results_write_html_boolean(iostr, results); else if(rasqal_query_results_is_bindings(results)) rasqal_query_results_write_html_bindings(iostr, results); raptor_iostream_counted_string_write("\n", 8, iostr); raptor_iostream_counted_string_write("\n", 8, iostr); return 0; } static const char* const html_names[] = { "html", NULL}; static const char* const html_uri_strings[] = { "http://www.w3.org/1999/xhtml", NULL }; static const raptor_type_q html_types[] = { { "application/xhtml+xml", 21, 10}, { "text/html", 9, 10}, { NULL, 0, 0} }; static int rasqal_query_results_html_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = html_names; factory->desc.mime_types = html_types; factory->desc.label = "HTML Table"; factory->desc.uri_strings = html_uri_strings; factory->desc.flags = 0; factory->write = rasqal_query_results_write_html; factory->get_rowsource = NULL; return rc; } int rasqal_init_result_format_html(rasqal_world* world) { return !rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_html_register_factory); } rasqal-0.9.33/src/rasqal_iostream.c0000644000175000017500000001022411717115020014125 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_iostream.c - Rasqal I/O stream utility code * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" struct rasqal_read_stringbuffer_iostream_context { /* stringbuffer owned by this object */ raptor_stringbuffer* sb; /* input buffer pointer into sb */ void* string; size_t length; /* pointer into buffer */ size_t offset; }; /* Local handlers for reading from a string */ static void rasqal_read_stringbuffer_iostream_finish(void *user_data) { struct rasqal_read_stringbuffer_iostream_context* con; con = (struct rasqal_read_stringbuffer_iostream_context*)user_data; if(con->sb) raptor_free_stringbuffer(con->sb); RASQAL_FREE(rasqal_read_stringbuffer_iostream_context, con); return; } static int rasqal_read_stringbuffer_iostream_read_bytes(void *user_data, void *ptr, size_t size, size_t nmemb) { struct rasqal_read_stringbuffer_iostream_context* con; size_t avail; size_t blen; if(!ptr || size <= 0 || !nmemb) return -1; con = (struct rasqal_read_stringbuffer_iostream_context*)user_data; if(con->offset >= con->length) return 0; avail = RASQAL_BAD_CAST(int, ((con->length - con->offset) / size)); if(avail > nmemb) avail = nmemb; blen = (avail * size); memcpy(ptr, RASQAL_GOOD_CAST(char*, con->string) + con->offset, blen); con->offset += blen; return RASQAL_BAD_CAST(int, avail); } static int rasqal_read_stringbuffer_iostream_read_eof(void *user_data) { struct rasqal_read_stringbuffer_iostream_context* con; con = (struct rasqal_read_stringbuffer_iostream_context*)user_data; return (con->offset >= con->length); } static const raptor_iostream_handler rasqal_iostream_read_stringbuffer_handler = { /* .version = */ 2, /* .init = */ NULL, /* .finish = */ rasqal_read_stringbuffer_iostream_finish, /* .write_byte = */ NULL, /* .write_bytes = */ NULL, /* .write_end = */ NULL, /* .read_bytes = */ rasqal_read_stringbuffer_iostream_read_bytes, /* .read_eof = */ rasqal_read_stringbuffer_iostream_read_eof }; /* * rasqal_new_iostream_from_stringbuffer: * @world: raptor world * @sb: stringbuffer * * INTERNAL - create a new iostream reading from a stringbuffer. * * The stringbuffer @sb becomes owned by the iostream * * This is intended to be replaced by * raptor_new_iostream_from_stringbuffer() in a newer raptor release. * * Return value: new #raptor_iostream object or NULL on failure **/ raptor_iostream* rasqal_new_iostream_from_stringbuffer(raptor_world *raptor_world_ptr, raptor_stringbuffer* sb) { struct rasqal_read_stringbuffer_iostream_context* con; const raptor_iostream_handler* handler; if(!sb) return NULL; handler = &rasqal_iostream_read_stringbuffer_handler; con = RASQAL_CALLOC(struct rasqal_read_stringbuffer_iostream_context*, 1, sizeof(*con)); if(!con) { raptor_free_stringbuffer(sb); return NULL; } con->sb = sb; con->string = raptor_stringbuffer_as_string(sb); con->length = raptor_stringbuffer_length(sb); return raptor_new_iostream_from_handler(raptor_world_ptr, con, handler); } rasqal-0.9.33/src/strcasecmp.c0000644000175000017500000000435612435141254013122 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * strcasecmp.c - strcasecmp compatibility * * This file is in the public domain. * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE int rasqal_strcasecmp(const char* s1, const char* s2) { register int c1, c2; while(*s1 && *s2) { c1 = tolower(RASQAL_GOOD_CAST(int, *s1)); c2 = tolower(RASQAL_GOOD_CAST(int, *s2)); if (c1 != c2) return (c1 - c2); s1++; s2++; } return RASQAL_GOOD_CAST(int, (*s1 - *s2)); } int rasqal_strncasecmp(const char* s1, const char* s2, size_t n) { register int c1, c2; while(*s1 && *s2 && n) { c1 = tolower(RASQAL_GOOD_CAST(int, *s1)); c2 = tolower(RASQAL_GOOD_CAST(int, *s2)); if (c1 != c2) return (c1 - c2); s1++; s2++; n--; } return 0; } #endif /* not STANDALONE */ #ifdef STANDALONE #include /* one more prototype */ int main(int argc, char *argv[]); static int assert_strcasecmp (const char *s1, const char *s2, int expected) { int result=strcasecmp(s1, s2); result=(result>0) ? 1 : ((result <0) ? -1 : 0); if (result != expected) { fprintf(stderr, "FAIL strcasecmp (%s, %s) gave %d != %d\n", s1, s2, result, expected); return 1; } return 0; } static int assert_strncasecmp (const char *s1, const char *s2, size_t size, int expected) { int result=strncasecmp(s1, s2, size); result=(result>0) ? 1 : ((result <0) ? -1 : 0); if (result != expected) { fprintf(stderr, "FAIL strncasecmp (%s, %s, %u) gave %d != %d\n", s1, s2, RASQAL_GOOD_CAST(unsigned int, size), result, expected); return 1; } return 0; } int main(int argc, char *argv[]) { int failures=0; failures += assert_strcasecmp("foo", "foo", 0); failures += assert_strcasecmp("foo", "FOO", 0); failures += assert_strcasecmp("foo", "BaR", 1); failures += assert_strncasecmp("foo", "foobar", 3, 0); failures += assert_strncasecmp("foo", "FOOxyz", 3, 0); failures += assert_strncasecmp("foo", "BaRfoo", 3, 1); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_query_transform.c0000644000175000017500000024014412441120534015551 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_query_transform.c - Rasqal query transformations * * Copyright (C) 2004-2011, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #if 0 #undef RASQAL_DEBUG #define RASQAL_DEBUG 2 #endif #define DEBUG_FH stderr /* prototype for later */ static int rasqal_query_build_variables_use_map(rasqal_query* query, rasqal_projection* projection); static int rasqal_query_graph_build_variables_use_map_binds(rasqal_graph_pattern* gp, unsigned short* vars_scope); static void rasqal_query_expression_build_variables_use_map(unsigned short *use_map, rasqal_expression* e); static void rasqal_query_let_build_variables_use_map(rasqal_query* query, unsigned short *use_map, rasqal_expression* e); static int rasqal_query_let_build_variables_use_map_binds(rasqal_graph_pattern* gp, unsigned short* vars_scope); static int rasqal_query_select_build_variables_use_map(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp); static int rasqal_query_select_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope); static int rasqal_query_union_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope); static int rasqal_query_values_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope); int rasqal_query_expand_triple_qnames(rasqal_query* rq) { int i; if(!rq->triples) return 0; /* expand qnames in triples */ for(i = 0; i< raptor_sequence_size(rq->triples); i++) { rasqal_triple* t = (rasqal_triple*)raptor_sequence_get_at(rq->triples, i); if(rasqal_literal_expand_qname(rq, t->subject) || rasqal_literal_expand_qname(rq, t->predicate) || rasqal_literal_expand_qname(rq, t->object)) return 1; } return 0; } int rasqal_sequence_has_qname(raptor_sequence *seq) { int i; if(!seq) return 0; /* expand qnames in triples */ for(i = 0; i< raptor_sequence_size(seq); i++) { rasqal_triple* t = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(rasqal_literal_has_qname(t->subject) || rasqal_literal_has_qname(t->predicate) || rasqal_literal_has_qname(t->object)) return 1; } return 0; } static int rasqal_graph_pattern_constraints_has_qname(rasqal_graph_pattern* gp) { int i; /* check for qnames in sub graph patterns */ if(gp->graph_patterns) { /* check for constraint qnames in rasqal_graph_patterns */ for(i = 0; i < raptor_sequence_size(gp->graph_patterns); i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(rasqal_graph_pattern_constraints_has_qname(sgp)) return 1; } } if(!gp->filter_expression) return 0; /* check for qnames in constraint expressions */ if(rasqal_expression_visit(gp->filter_expression, rasqal_expression_has_qname, gp)) return 1; return 0; } int rasqal_query_constraints_has_qname(rasqal_query* rq) { if(!rq->query_graph_pattern) return 0; return rasqal_graph_pattern_constraints_has_qname(rq->query_graph_pattern); } int rasqal_query_expand_graph_pattern_constraints_qnames(rasqal_query *rq, rasqal_graph_pattern* gp) { int i; /* expand qnames in sub graph patterns */ if(gp->graph_patterns) { /* check for constraint qnames in rasqal_graph_patterns */ for(i = 0; i < raptor_sequence_size(gp->graph_patterns); i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(rasqal_query_expand_graph_pattern_constraints_qnames(rq, sgp)) return 1; } } if(!gp->filter_expression) return 0; /* expand qnames in constraint expressions */ if(rasqal_expression_visit(gp->filter_expression, rasqal_expression_expand_qname, rq)) return 1; return 0; } int rasqal_query_expand_query_constraints_qnames(rasqal_query *rq) { return rasqal_query_expand_graph_pattern_constraints_qnames(rq, rq->query_graph_pattern); } static int rasqal_query_convert_blank_node_to_anonymous_variable(rasqal_query *rq, rasqal_literal *l) { rasqal_variable* v; v = rasqal_variables_table_add2(rq->vars_table, RASQAL_VARIABLE_TYPE_ANONYMOUS, RASQAL_GOOD_CAST(unsigned char*, l->string), l->string_len, NULL); /* rasqal_new_variable_typed took ownership of the l->string name. * Set to NULL to prevent double delete. */ l->string = NULL; if(!v) return 1; /* error */ /* Convert the blank node literal into a variable literal */ l->type = RASQAL_LITERAL_VARIABLE; l->value.variable = v; return 0; /* success */ } /** * rasqal_query_build_anonymous_variables: * @rq: query * * INTERNAL - Turn triple blank node parts into anonymous variables * * These are the blank nodes such as (Turtle/SPARQL): * _:name or [] or [ prop value ] or ( collection of things ) * * Return value: non-0 on failure */ int rasqal_query_build_anonymous_variables(rasqal_query* rq) { int i; int rc = 1; raptor_sequence *s = rq->triples; for(i = 0; i < raptor_sequence_size(s); i++) { rasqal_triple* t = (rasqal_triple*)raptor_sequence_get_at(s, i); if(t->subject->type == RASQAL_LITERAL_BLANK && rasqal_query_convert_blank_node_to_anonymous_variable(rq, t->subject)) goto done; if(t->predicate->type == RASQAL_LITERAL_BLANK && rasqal_query_convert_blank_node_to_anonymous_variable(rq, t->predicate)) goto done; if(t->object->type == RASQAL_LITERAL_BLANK && rasqal_query_convert_blank_node_to_anonymous_variable(rq, t->object)) goto done; } rc = 0; done: return rc; } /** * rasqal_query_expand_wildcards: * @rq: query * * INTERNAL - expand SPARQL SELECT * to a full list of select variables * * Return value: non-0 on failure */ int rasqal_query_expand_wildcards(rasqal_query* rq, rasqal_projection* projection) { int i; int size; if(rq->verb != RASQAL_QUERY_VERB_SELECT || !projection || !projection->wildcard) return 0; /* If 'SELECT *' was given, make the selects be a list of all variables */ size = rasqal_variables_table_get_named_variables_count(rq->vars_table); for(i = 0; i < size; i++) { rasqal_variable* v = rasqal_variables_table_get(rq->vars_table, i); rasqal_query_add_variable(rq, v); } return 0; } /** * rasqal_query_remove_duplicate_select_vars: * @rq: query * * INTERNAL - remove duplicate variables in SELECT sequence and warn * * The order of the select variables is preserved. * * Return value: non-0 on failure */ int rasqal_query_remove_duplicate_select_vars(rasqal_query* rq, rasqal_projection* projection) { int i; int modified = 0; int size; raptor_sequence* seq; raptor_sequence* new_seq; if(!projection) return 1; seq = projection->variables; if(!seq) return 0; size = raptor_sequence_size(seq); if(!size) return 0; new_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!new_seq) return 1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("bound variables before deduping: "); raptor_sequence_print(seq, DEBUG_FH); fputs("\n", DEBUG_FH); #endif for(i = 0; i < size; i++) { int j; rasqal_variable *v; int warned = 0; v = (rasqal_variable*)raptor_sequence_get_at(seq, i); if(!v) continue; for(j = 0; j < i; j++) { rasqal_variable *v2; v2 = (rasqal_variable*)raptor_sequence_get_at(seq, j); if(v == v2) { if(!warned) { rasqal_log_warning_simple(rq->world, RASQAL_WARNING_LEVEL_DUPLICATE_VARIABLE, &rq->locator, "Variable %s duplicated in SELECT.", v->name); warned = 1; } } } if(!warned) { v = rasqal_new_variable_from_variable(v); raptor_sequence_push(new_seq, v); modified = 1; } } if(modified) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("bound variables after deduping: "); raptor_sequence_print(new_seq, DEBUG_FH); fputs("\n", DEBUG_FH); #endif raptor_free_sequence(projection->variables); projection->variables = new_seq; } else raptor_free_sequence(new_seq); return 0; } /** * rasqal_query_build_variable_agg_use: * @query: the query * * INTERNAL - calculate the usage of variables across all parts of the query * * Return value: array of variable usage info or NULL on failure */ static unsigned short* rasqal_query_build_variable_agg_use(rasqal_query* query) { int width; int height; unsigned short* agg_row; int row_index; width = rasqal_variables_table_get_total_variables_count(query->vars_table); height = RASQAL_VAR_USE_MAP_OFFSET_LAST + 1 + query->graph_pattern_count; agg_row = RASQAL_CALLOC(unsigned short*, RASQAL_GOOD_CAST(size_t, width), sizeof(unsigned short)); if(!agg_row) return NULL; for(row_index = 0; row_index < height; row_index++) { unsigned short *row; int i; row = &query->variables_use_map[row_index * width]; for(i = 0; i < width; i++) agg_row[i] |= row[i]; } return agg_row; } /** * rasqal_query_check_unused_variables: * @query: the #rasqal_query to check * * INTERNAL - warn variables that are selected but not bound in a triple * * FIXME: Fails to handle variables bound in LET * * Return value: non-0 on failure */ static int rasqal_query_check_unused_variables(rasqal_query* query) { int i; int size; /* check only for named variables since only they can * appear in SELECT $vars */ size = rasqal_variables_table_get_named_variables_count(query->vars_table); for(i = 0; i < size; i++) { rasqal_variable *v; v = rasqal_variables_table_get(query->vars_table, i); if(!rasqal_query_variable_is_bound(query, v)) { rasqal_log_warning_simple(query->world, RASQAL_WARNING_LEVEL_UNUSED_SELECTED_VARIABLE, &query->locator, "Variable %s was selected but is unused in the query", v->name); } } return 0; } /** * rasqal_query_merge_triple_patterns: * @query: query (not used here) * @gp: current graph pattern * @data: visit data (not used here) * * INTERNAL - Join triple patterns in adjacent basic graph patterns into * single basic graph pattern. * * For group graph pattern move all triples * from { { a } { b } { c } D... } * to { a b c D... } * if the types of a, b, c are all BASIC GPs (just triples) * D... is anything else * */ static int rasqal_query_merge_triple_patterns(rasqal_query* query, rasqal_graph_pattern* gp, void* data) { int* modified = (int*)data; int checking; int offset; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 printf("rasqal_query_merge_triple_patterns: Checking graph pattern #%d:\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stdout); fputs("\n", stdout); RASQAL_DEBUG3("Columns %d to %d\n", gp->start_column, gp->end_column); #endif if(!gp->graph_patterns) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Ending graph patterns %d - no sub-graph patterns\n", gp->gp_index); #endif return 0; } if(gp->op != RASQAL_GRAPH_PATTERN_OPERATOR_GROUP) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Ending graph patterns %d - operator %s\n", gp->gp_index, rasqal_graph_pattern_operator_as_string(gp->op)); #endif return 0; } checking = 1; offset = 0; while(checking) { int bgp_count; rasqal_graph_pattern *dest_bgp; raptor_sequence *seq; int i, j; int first = 0, last = 0; int size = raptor_sequence_size(gp->graph_patterns); /* find first basic graph pattern starting at offset */ for(i= offset; i < size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(sgp->op == RASQAL_GRAPH_PATTERN_OPERATOR_BASIC) { first = i; break; } } /* None found */ if(i >= size) break; /* Next time, start after this BGP */ offset = i+1; /* count basic graph patterns */ bgp_count = 0; dest_bgp = NULL; /* destination graph pattern */ for(j = i; j < size; j++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, j); if(sgp->op == RASQAL_GRAPH_PATTERN_OPERATOR_BASIC) { bgp_count++; if(!dest_bgp) dest_bgp = sgp; last = j; } else break; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Found sequence of %d basic sub-graph patterns in %d\n", bgp_count, gp->gp_index); #endif if(bgp_count < 2) continue; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("OK to merge %d basic sub-graph patterns of %d\n", bgp_count, gp->gp_index); RASQAL_DEBUG3("Initial columns %d to %d\n", gp->start_column, gp->end_column); #endif seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) return 1; for(i = 0; raptor_sequence_size(gp->graph_patterns) > 0; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_unshift(gp->graph_patterns); if(i >= first && i <= last) { if(sgp != dest_bgp) { if(rasqal_graph_patterns_join(dest_bgp, sgp)) { RASQAL_DEBUG1("Cannot join graph patterns\n"); *modified = -1; /* error flag */ } rasqal_free_graph_pattern(sgp); } else raptor_sequence_push(seq, sgp); } else raptor_sequence_push(seq, sgp); } raptor_free_sequence(gp->graph_patterns); gp->graph_patterns = seq; if(!*modified) *modified = 1; } /* end while checking */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Ending columns %d to %d\n", gp->start_column, gp->end_column); RASQAL_DEBUG2("Ending graph pattern #%d\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stdout); fputs("\n\n", stdout); #endif return 0; } /** * rasqal_graph_pattern_move_constraints: * @dest_gp: destination graph pattern * @src_gp: src graph pattern * * INTERNAL - copy all constraints from @src_gp graph pattern to @src_gp graph pattern * * Return value: non-0 on error */ int rasqal_graph_pattern_move_constraints(rasqal_graph_pattern* dest_gp, rasqal_graph_pattern* src_gp) { int rc = 0; rasqal_expression* fs = NULL; rasqal_expression* e; if(!src_gp->filter_expression) return 0; /* no constraints is not an error */ e = rasqal_new_expression_from_expression(src_gp->filter_expression); fs = dest_gp->filter_expression; if(fs) e = rasqal_new_2op_expression(e->world, RASQAL_EXPR_AND, fs, e); dest_gp->filter_expression = e; return rc; } /** * rasqal_query_remove_empty_group_graph_patterns: * @query: query (not used here) * @gp: current graph pattern * @data: visit data (not used here) * * INTERNAL - Remove empty group graph patterns * * Return value: non-0 on failure */ static int rasqal_query_remove_empty_group_graph_patterns(rasqal_query* query, rasqal_graph_pattern* gp, void* data) { int i; int saw_empty_gp = 0; raptor_sequence *seq; int* modified = (int*)data; if(!gp->graph_patterns) return 0; if(gp->op != RASQAL_GRAPH_PATTERN_OPERATOR_GROUP) return 0; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 printf("rasqal_query_remove_empty_group_graph_patterns: Checking graph pattern #%d:\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stdout); fputs("\n", stdout); #endif for(i = 0; i < raptor_sequence_size(gp->graph_patterns); i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(sgp->graph_patterns && !raptor_sequence_size(sgp->graph_patterns)) { /* One is enough to know we need to rewrite */ saw_empty_gp = 1; break; } } if(!saw_empty_gp) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Ending graph patterns %d - saw no empty groups\n", gp->gp_index); #endif return 0; } seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { RASQAL_DEBUG1("Cannot create new gp sequence\n"); *modified = -1; return 1; } while(raptor_sequence_size(gp->graph_patterns) > 0) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_unshift(gp->graph_patterns); if(sgp->graph_patterns && !raptor_sequence_size(sgp->graph_patterns)) { rasqal_graph_pattern_move_constraints(gp, sgp); rasqal_free_graph_pattern(sgp); continue; } raptor_sequence_push(seq, sgp); } raptor_free_sequence(gp->graph_patterns); gp->graph_patterns = seq; if(!*modified) *modified = 1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Ending graph pattern #%d\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stdout); fputs("\n\n", stdout); #endif return 0; } /** * rasqal_query_merge_graph_patterns: * @query: query (not used here) * @gp: current graph pattern * @data: pointer to int modified flag * * INTERNAL - Merge graph patterns where possible * * When size = 1 (never for UNION) * GROUP { A } -> A * OPTIONAL { A } -> OPTIONAL { A } * * When size > 1 * GROUP { BASIC{2,} } -> merge-BASIC * OPTIONAL { BASIC{2,} } -> OPTIONAL { merge-BASIC } * * Never merged: UNION */ int rasqal_query_merge_graph_patterns(rasqal_query* query, rasqal_graph_pattern* gp, void* data) { rasqal_graph_pattern_operator op; int merge_gp_ok = 0; int all_gp_op_same = 0; int i; int size; int* modified = (int*)data; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 printf("rasqal_query_merge_graph_patterns: Checking graph pattern #%d:\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stdout); fputs("\n", stdout); RASQAL_DEBUG3("Columns %d to %d\n", gp->start_column, gp->end_column); #endif if(!gp->graph_patterns) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Ending graph pattern #%d - operator %s: no sub-graph patterns\n", gp->gp_index, rasqal_graph_pattern_operator_as_string(gp->op)); #endif return 0; } if(gp->op != RASQAL_GRAPH_PATTERN_OPERATOR_GROUP) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Ending graph patterns %d - operator %s: not GROUP\n", gp->gp_index, rasqal_graph_pattern_operator_as_string(gp->op)); #endif return 0; } size = raptor_sequence_size(gp->graph_patterns); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Doing %d sub-graph patterns of %d\n", size, gp->gp_index); #endif op = RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN; all_gp_op_same = 1; for(i = 0; i < size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(op == RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN) { op = sgp->op; } else { if(op != sgp->op) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG4("Sub-graph pattern #%d is %s different from first %s, cannot merge\n", i, rasqal_graph_pattern_operator_as_string(sgp->op), rasqal_graph_pattern_operator_as_string(op)); #endif all_gp_op_same = 0; } } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Sub-graph patterns of %d done\n", gp->gp_index); #endif if(!all_gp_op_same) { merge_gp_ok = 0; goto merge_check_done; } if(size == 1) { /* Never merge a FILTER to an outer GROUP since you lose * knowledge about variable scope */ merge_gp_ok = (op != RASQAL_GRAPH_PATTERN_OPERATOR_FILTER); goto merge_check_done; } /* if size > 1 check if ALL sub-graph patterns are basic graph * patterns and either: * 1) a single triple * 2) a single constraint */ for(i = 0; i < size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(sgp->op != RASQAL_GRAPH_PATTERN_OPERATOR_BASIC) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Found %s sub-graph pattern #%d\n", rasqal_graph_pattern_operator_as_string(sgp->op), sgp->gp_index); #endif merge_gp_ok = 0; break; } /* not ok if there are >1 triples */ if(sgp->triples && (sgp->end_column-sgp->start_column+1) > 1) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Found >1 triples in sub-graph pattern #%d\n", sgp->gp_index); #endif merge_gp_ok = 0; break; } /* not ok if there are triples and constraints */ if(sgp->triples && sgp->filter_expression) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Found triples and constraints in sub-graph pattern #%d\n", sgp->gp_index); #endif merge_gp_ok = 0; break; } /* was at least 1 OK sub graph-pattern */ merge_gp_ok = 1; } merge_check_done: if(merge_gp_ok) { raptor_sequence *seq; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("OK to merge sub-graph patterns of %d\n", gp->gp_index); RASQAL_DEBUG3("Initial columns %d to %d\n", gp->start_column, gp->end_column); #endif /* Pretend dest is an empty basic graph pattern */ seq = gp->graph_patterns; gp->graph_patterns = NULL; gp->op = op; while(raptor_sequence_size(seq) > 0) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_unshift(seq); /* fake this so that the join happens */ sgp->op = gp->op; if(rasqal_graph_patterns_join(gp, sgp)) { RASQAL_DEBUG1("Cannot join graph patterns\n"); *modified = -1; /* error flag */ } rasqal_free_graph_pattern(sgp); } /* If result is 'basic' but contains graph patterns, turn it into a group */ if(gp->graph_patterns && gp->op == RASQAL_GRAPH_PATTERN_OPERATOR_BASIC) gp->op = RASQAL_GRAPH_PATTERN_OPERATOR_GROUP; /* Delete any evidence of sub graph patterns */ raptor_free_sequence(seq); if(!*modified) *modified = 1; } else { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("NOT OK to merge sub-graph patterns of %d\n", gp->gp_index); #endif } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 if(merge_gp_ok) { RASQAL_DEBUG2("Ending graph pattern #%d\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stdout); fputs("\n\n", stdout); } #endif return 0; } /** * rasqal_query_filter_variable_scope: * @query: query * @gp: current graph pattern * @data: pointer to int modified flag * * Replace a FILTER in a GROUP refering to out-of-scope var with FALSE * * For each variable in a FILTER expression, if there is one defined * outside the GROUP, the FILTER is always FALSE - so set it thus and * the tree of GP is modified * * Return value: 0 */ static int rasqal_query_filter_variable_scope(rasqal_query* query, rasqal_graph_pattern* gp, void* data) { int vari; int* modified = (int*)data; rasqal_graph_pattern *qgp; int size; /* Scan up from FILTER GPs */ if(gp->op != RASQAL_GRAPH_PATTERN_OPERATOR_FILTER) return 0; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Checking FILTER graph pattern #%d:\n ", gp->gp_index); rasqal_graph_pattern_print(gp, stderr); fputs("\n", stderr); #endif qgp = rasqal_query_get_query_graph_pattern(query); size = rasqal_variables_table_get_named_variables_count(query->vars_table); for(vari = 0; vari < size; vari++) { rasqal_variable* v = rasqal_variables_table_get(query->vars_table, vari); int var_in_scope = 2; rasqal_graph_pattern *sgp; if(!rasqal_expression_mentions_variable(gp->filter_expression, v)) continue; RASQAL_DEBUG3("FILTER GP #%d expression mentions %s\n", gp->gp_index, v->name); sgp = gp; while(1) { int bound_here; sgp = rasqal_graph_pattern_get_parent(query, sgp, qgp); if(!sgp) break; bound_here = rasqal_graph_pattern_variable_bound_below(sgp, v); RASQAL_DEBUG4("Checking parent GP #%d op %s - bound below: %d\n", sgp->gp_index, rasqal_graph_pattern_operator_as_string(sgp->op), bound_here); if(sgp->op == RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL) { /* Collapse OPTIONAL { GROUP } */ var_in_scope++; } if(sgp->op == RASQAL_GRAPH_PATTERN_OPERATOR_GROUP) { var_in_scope--; if(bound_here) { /* It was defined in first GROUP so life is good - done */ if(var_in_scope == 1) break; /* It was defined in an outer GROUP so this is bad */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("FILTER Variable %s defined in GROUP GP #%d and now out of scope\n", v->name, sgp->gp_index); #endif var_in_scope = 0; break; } } } if(!var_in_scope) { rasqal_literal* l; l = rasqal_new_boolean_literal(query->world, 0); /* In-situ conversion of filter_expression to a literal expression */ rasqal_expression_convert_to_literal(gp->filter_expression, l); *modified = 1; RASQAL_DEBUG2("FILTER Variable %s was defined outside FILTER's parent group\n", v->name); break; } } return 0; } struct folding_state { rasqal_query* query; int changes; int failed; }; static int rasqal_expression_foreach_fold(void *user_data, rasqal_expression *e) { struct folding_state *st = (struct folding_state*)user_data; rasqal_query* query; rasqal_literal* l; int error = 0; /* skip if already a literal or this expression tree is not constant */ if(e->op == RASQAL_EXPR_LITERAL || !rasqal_expression_is_constant(e)) return 0; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("folding expression %p: ", e); rasqal_expression_print(e, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif query = st->query; l = rasqal_expression_evaluate2(e, query->eval_context, &error); if(error) { st->failed++; return 1; } /* In-situ conversion of 'e' to a literal expression */ rasqal_expression_convert_to_literal(e, l); #ifdef RASQAL_DEBUG RASQAL_DEBUG1("folded expression now: "); rasqal_expression_print(e, DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* change made */ st->changes++; return 0; } static int rasqal_query_expression_fold(rasqal_query* rq, rasqal_expression* e) { struct folding_state st; st.query = rq; while(1) { st.changes = 0; st.failed = 0; rasqal_expression_visit(e, rasqal_expression_foreach_fold, (void*)&st); if(!st.changes || st.failed) break; } return st.failed; } static int rasqal_graph_pattern_fold_expressions(rasqal_query* rq, rasqal_graph_pattern* gp) { if(!gp) return 1; /* fold expressions in sub graph patterns */ if(gp->graph_patterns) { int i; for(i = 0; i < raptor_sequence_size(gp->graph_patterns); i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(rasqal_graph_pattern_fold_expressions(rq, sgp)) return 1; } } if(gp->filter_expression) return rasqal_query_expression_fold(rq, gp->filter_expression); return 0; } static int rasqal_query_fold_expressions(rasqal_query* rq) { rasqal_graph_pattern *gp = rq->query_graph_pattern; int order_size; raptor_sequence *order_seq = rasqal_query_get_order_conditions_sequence(rq); if(gp) rasqal_graph_pattern_fold_expressions(rq, gp); if(!order_seq) return 0; order_size = raptor_sequence_size(order_seq); if(order_size) { int i; for(i = 0; i < order_size; i++) { rasqal_expression* e; e = (rasqal_expression*)raptor_sequence_get_at(order_seq, i); rasqal_query_expression_fold(rq, e); } } return 0; } static int rasqal_query_prepare_count_graph_pattern(rasqal_query* query, rasqal_graph_pattern* gp, void* data) { raptor_sequence* seq = (raptor_sequence*)data; if(raptor_sequence_push(seq, gp)) { query->failed = 1; return 1; } gp->gp_index = (query->graph_pattern_count++); return 0; } /** * rasqal_query_enumerate_graph_patterns: * @query: query object * * INTERNAL - Label all graph patterns in query graph patterns with an index 0.. * * Used for the size of the graph pattern execution data array. * Used to allocate in rasqal_query_build_variables_use_map() * and rasqal_query_build_variable_agg_use() and used in * rasqal_query_print_variables_use_map() and * rasqal_query_variable_is_bound(). * * Return value: non-0 on failure */ static int rasqal_query_enumerate_graph_patterns(rasqal_query *query) { query->graph_pattern_count = 0; if(query->graph_patterns_sequence) raptor_free_sequence(query->graph_patterns_sequence); /* This sequence stores shared pointers to the graph patterns it * finds, indexed by the gp_index */ query->graph_patterns_sequence = raptor_new_sequence(NULL, NULL); if(!query->graph_patterns_sequence) return 1; return rasqal_query_graph_pattern_visit2(query, rasqal_query_prepare_count_graph_pattern, query->graph_patterns_sequence); } /** * rasqal_query_build_variables_use: * @query: query * * INTERNAL - build structures recording variable use in the query * * Should be called if the query variable usage is modified such as * a variable added during query planning. * * Return value: non-0 on failure */ int rasqal_query_build_variables_use(rasqal_query* query, rasqal_projection* projection) { int rc; /* create query->variables_use_map that marks where a variable is * mentioned, bound or used in a graph pattern. */ rc = rasqal_query_build_variables_use_map(query, projection); if(rc) return rc; if(1) { unsigned short* agg_row; int i; int errors = 0; agg_row = rasqal_query_build_variable_agg_use(query); if(!agg_row) return 1; for(i = 0; 1; i++) { rasqal_variable* v = rasqal_variables_table_get(query->vars_table, i); if(!v) break; if( (agg_row[i] & RASQAL_VAR_USE_BOUND_HERE) && !(agg_row[i] & RASQAL_VAR_USE_MENTIONED_HERE)) { rasqal_log_warning_simple(query->world, RASQAL_WARNING_LEVEL_VARIABLE_UNUSED, &query->locator, "Variable %s was bound but is unused in the query", v->name); } else if(!(agg_row[i] & RASQAL_VAR_USE_BOUND_HERE) && (agg_row[i] & RASQAL_VAR_USE_MENTIONED_HERE)) { rasqal_log_warning_simple(query->world, RASQAL_WARNING_LEVEL_SELECTED_NEVER_BOUND, &query->locator, "Variable %s was used but is not bound in the query", v->name); } else if(!(agg_row[i] & RASQAL_VAR_USE_BOUND_HERE) && !(agg_row[i] & RASQAL_VAR_USE_MENTIONED_HERE)) { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Variable %s was not bound and not used in the query (where is it from?)", v->name); errors++; } } RASQAL_FREE(shortarray, agg_row); if(errors) return 1; } return rc; } /** * rasqal_query_prepare_common: * @query: query * * INTERNAL - initialise the remainder of the query structures * * Does not do any execution prepration - this is once-only stuff. * * NOTE: The caller is responsible for ensuring this is called at * most once. This is currently enforced by rasqal_query_prepare() * using the query->prepared flag when it calls the query factory * prepare method which does the query string parsing and ends by * calling this function. * * Return value: non-0 on failure */ int rasqal_query_prepare_common(rasqal_query *query) { int rc = 1; rasqal_projection* projection; if(!query->triples) goto done; /* turn SELECT $a, $a into SELECT $a - editing the projection */ projection = rasqal_query_get_projection(query); if(projection) { if(rasqal_query_remove_duplicate_select_vars(query, projection)) goto done; } rasqal_query_fold_expressions(query); if(query->query_graph_pattern) { /* This query prepare processing requires a query graph pattern. * Not the case for a legal query like 'DESCRIBE ' */ int modified; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fputs("Initial query graph pattern:\n ", DEBUG_FH); rasqal_graph_pattern_print(query->query_graph_pattern, DEBUG_FH); fputs("\n", DEBUG_FH); #endif do { modified = 0; rc = rasqal_query_graph_pattern_visit2(query, rasqal_query_merge_triple_patterns, &modified); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "modified=%d after merge triples, query graph pattern now:\n ", modified); rasqal_graph_pattern_print(query->query_graph_pattern, DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(rc) { modified = rc; break; } rc = rasqal_query_graph_pattern_visit2(query, rasqal_query_remove_empty_group_graph_patterns, &modified); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "modified=%d after remove empty groups, query graph pattern now:\n ", modified); rasqal_graph_pattern_print(query->query_graph_pattern, DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(rc) { modified = rc; break; } rc = rasqal_query_graph_pattern_visit2(query, rasqal_query_merge_graph_patterns, &modified); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "modified=%d after merge graph patterns, query graph pattern now:\n ", modified); rasqal_graph_pattern_print(query->query_graph_pattern, DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(rc) { modified = rc; break; } } while(modified > 0); rc = modified; /* error if modified<0, success if modified==0 */ if(rc) goto done; rc = rasqal_query_enumerate_graph_patterns(query); if(rc) goto done; rc = rasqal_query_build_variables_use(query, projection); if(rc) goto done; /* Turn FILTERs that refer to out-of-scope variables into FALSE */ (void)rasqal_query_graph_pattern_visit2(query, rasqal_query_filter_variable_scope, &modified); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "modified=%d after filter variable scope, query graph pattern now:\n ", modified); rasqal_graph_pattern_print(query->query_graph_pattern, DEBUG_FH); fputs("\n", DEBUG_FH); #endif /* warn if any of the selected named variables are not in a triple */ rc = rasqal_query_check_unused_variables(query); if(rc) goto done; } rc = 0; done: return rc; } /** * rasqal_graph_patterns_join: * @dest_gp: destination graph pattern * @src_gp: src graph pattern * * INTERNAL - merge @src_gp graph pattern into @dest_gp graph pattern * * Return value: non-0 on error */ int rasqal_graph_patterns_join(rasqal_graph_pattern *dest_gp, rasqal_graph_pattern *src_gp) { int rc; if(!src_gp || !dest_gp) return 0; if(src_gp->op != dest_gp->op) { RASQAL_DEBUG3("Source operator %s != Destination operator %s, ending\n", rasqal_graph_pattern_operator_as_string(src_gp->op), rasqal_graph_pattern_operator_as_string(dest_gp->op)); return 1; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Joining graph pattern #%d\n ", src_gp->gp_index); rasqal_graph_pattern_print(src_gp, DEBUG_FH); fprintf(DEBUG_FH, "\nto graph pattern #%d\n ", dest_gp->gp_index); rasqal_graph_pattern_print(dest_gp, DEBUG_FH); fprintf(DEBUG_FH, "\nboth of operator %s\n", rasqal_graph_pattern_operator_as_string(src_gp->op)); #endif if(src_gp->graph_patterns) { if(!dest_gp->graph_patterns) { dest_gp->graph_patterns = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!dest_gp->graph_patterns) return -1; } rc = raptor_sequence_join(dest_gp->graph_patterns, src_gp->graph_patterns); if(rc) return rc; } if(src_gp->triples) { int start_c = src_gp->start_column; int end_c = src_gp->end_column; /* if this is our first triple, save a free/alloc */ dest_gp->triples = src_gp->triples; src_gp->triples = NULL; if((dest_gp->start_column < 0) || start_c < dest_gp->start_column) dest_gp->start_column = start_c; if((dest_gp->end_column < 0) || end_c > dest_gp->end_column) dest_gp->end_column = end_c; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG3("Moved triples from columns %d to %d\n", start_c, end_c); RASQAL_DEBUG3("Columns now %d to %d\n", dest_gp->start_column, dest_gp->end_column); #endif } rc = rasqal_graph_pattern_move_constraints(dest_gp, src_gp); if(src_gp->origin) { dest_gp->origin = src_gp->origin; src_gp->origin = NULL; } if(src_gp->var) { dest_gp->var = src_gp->var; src_gp->var = NULL; } if(src_gp->projection) { dest_gp->projection = src_gp->projection; src_gp->projection = NULL; } if(src_gp->modifier) { dest_gp->modifier = src_gp->modifier; src_gp->modifier = NULL; } if(src_gp->bindings) { dest_gp->bindings = src_gp->bindings; src_gp->bindings = NULL; } dest_gp->silent = src_gp->silent; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG2("Result graph pattern #%d\n ", dest_gp->gp_index); rasqal_graph_pattern_print(dest_gp, stdout); fputs("\n", stdout); #endif return rc; } /** * rasqal_query_triples_build_variables_use_map_row: * @triples: triples sequence to use * @use_map_row: 1D array of size num. variables to write * @start_column: first column in triples array * @end_column: last column in triples array * * INTERNAL - Mark variables mentioned in a sequence of triples * **/ static int rasqal_query_triples_build_variables_use_map_row(raptor_sequence *triples, unsigned short *use_map_row, int start_column, int end_column) { int rc = 0; int col; for(col = start_column; col <= end_column; col++) { rasqal_triple *t; rasqal_variable *v; t = (rasqal_triple*)raptor_sequence_get_at(triples, col); if((v = rasqal_literal_as_variable(t->subject))) { use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; } if((v = rasqal_literal_as_variable(t->predicate))) { use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; } if((v = rasqal_literal_as_variable(t->object))) { use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; } if(t->origin) { if((v = rasqal_literal_as_variable(t->origin))) { use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; } } } return rc; } /** * rasqal_query_graph_build_variables_use_map: * @use_map_row: 1D array of size num. variables to write * @literal: graph origin literal * * INTERNAL - Mark variables mentioned in a GRAPH graph pattern * **/ static int rasqal_query_graph_build_variables_use_map(unsigned short *use_map_row, rasqal_literal *origin) { rasqal_variable* v = rasqal_literal_as_variable(origin); if(v) use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; return 0; } /** * rasqal_query_graph_pattern_build_variables_use_map: * @query: the #rasqal_query to find the variables in * @use_map: 2D array of (num. variables x num. GPs) to write * @width: width of array (num. variables) * @gp: graph pattern to use * * INTERNAL - Mark where variables are used (mentioned) in a graph_pattern tree walk * **/ static int rasqal_query_graph_pattern_build_variables_use_map(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern *gp) { int offset; if(gp->graph_patterns) { int i; for(i = 0; i < raptor_sequence_size(gp->graph_patterns); i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(rasqal_query_graph_pattern_build_variables_use_map(query, use_map, width, sgp)) return 1; } } /* write to the 1D array for this GP */ offset = (gp->gp_index + RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) * width; switch(gp->op) { case RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: /* BGP (part 1) - everything is a mention */ rasqal_query_triples_build_variables_use_map_row(query->triples, &use_map[offset], gp->start_column, gp->end_column); break; case RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: /* Mentions the graph variable */ rasqal_query_graph_build_variables_use_map(&use_map[offset], gp->origin); break; case RASQAL_GRAPH_PATTERN_OPERATOR_FILTER: /* Only mentions */ rasqal_query_expression_build_variables_use_map(&use_map[offset], gp->filter_expression); break; case RASQAL_GRAPH_PATTERN_OPERATOR_LET: /* Mentions in expression */ rasqal_query_let_build_variables_use_map(query, &use_map[offset], gp->filter_expression); break; case RASQAL_GRAPH_PATTERN_OPERATOR_SELECT: rasqal_query_select_build_variables_use_map(query, &use_map[offset], width, gp); break; case RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: case RASQAL_GRAPH_PATTERN_OPERATOR_UNION: case RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: case RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE: case RASQAL_GRAPH_PATTERN_OPERATOR_MINUS: case RASQAL_GRAPH_PATTERN_OPERATOR_VALUES: case RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: break; } return 0; } /** * rasqal_graph_pattern_mentions_variable: * @gp: graph pattern * @v: variable * * INTERNAL - test if a variable is bound in a graph pattern directly * * Return value: non-0 if variable is bound in the given graph pattern */ static int rasqal_graph_pattern_mentions_variable(rasqal_graph_pattern* gp, rasqal_variable* v) { rasqal_query* query = gp->query; int width; int gp_offset; unsigned short *row; width = rasqal_variables_table_get_total_variables_count(query->vars_table); gp_offset = (gp->gp_index + RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) * width; row = &query->variables_use_map[gp_offset]; return (row[v->offset] & RASQAL_VAR_USE_MENTIONED_HERE); } /** * rasqal_graph_pattern_tree_mentions_variable: * @query: query * @gp: graph pattern * @v: variable * * INTERNAL - test if a variable is mentioned in a graph pattern tree * * Return value: non-0 if variable is mentioned in GP tree */ static int rasqal_graph_pattern_tree_mentions_variable(rasqal_graph_pattern* gp, rasqal_variable* v) { if(gp->graph_patterns) { int size = raptor_sequence_size(gp->graph_patterns); int i; for(i = 0; i < size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); if(rasqal_graph_pattern_tree_mentions_variable(sgp, v)) return 1; } } return rasqal_graph_pattern_mentions_variable(gp, v); } /** * rasqal_graph_pattern_promote_variable_mention_to_bind: * @gp: graph pattern * @v: variable * @vars_scope: variable in scope array * * INTERNAL - Promote a variable from a mention to a bind - for a basic graph pattenr * * Return value: non-0 on failure */ static int rasqal_graph_pattern_promote_variable_mention_to_bind(rasqal_graph_pattern* gp, rasqal_variable* v, unsigned short* vars_scope) { rasqal_query* query = gp->query; int width; int gp_offset; unsigned short* row; /* If already bound, do nothing - not an error */ if(vars_scope[v->offset]) return 0; RASQAL_DEBUG3("Converting variable %s from mention to bound in GP #%d\n", v->name, gp->gp_index); width = rasqal_variables_table_get_total_variables_count(query->vars_table); gp_offset = (gp->gp_index + RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) * width; row = &query->variables_use_map[gp_offset]; /* new variable - bind it */ row[v->offset] |= RASQAL_VAR_USE_BOUND_HERE; vars_scope[v->offset] = 1; return 0; } /** * rasqal_query_triples_build_variables_use_map_binds: * @use_map: 2D array of (num. variables x num. GPs) to READ and WRITE * @width: width of array (num. variables) * @gp: graph pattern to use * @vars_scope: variables bound in current scope * * INTERNAL - Mark variables bound in a BASIC graph pattern (triple pattern) * **/ static int rasqal_query_triples_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope) { int start_column = gp->start_column; int end_column = gp->end_column; int col; int gp_offset; unsigned short* gp_use_map_row; int var_index; gp_offset = (gp->gp_index + RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) * width; gp_use_map_row = &query->variables_use_map[gp_offset]; /* Scan all triples and mark per-triple use/bind and for entire BGP use*/ for(col = start_column; col <= end_column; col++) { rasqal_triple *t; rasqal_variable *v; unsigned short* triple_row = &query->triples_use_map[col * width]; t = (rasqal_triple*)raptor_sequence_get_at(gp->triples, col); if((v = rasqal_literal_as_variable(t->subject))) { if(!vars_scope[v->offset]) { /* v needs binding in this triple as SUBJECT */ triple_row[v->offset] |= RASQAL_TRIPLES_BOUND_SUBJECT; } else triple_row[v->offset] |= RASQAL_TRIPLES_USE_SUBJECT; } if((v = rasqal_literal_as_variable(t->predicate))) { if(!vars_scope[v->offset]) { /* v needs binding in this triple as PREDICATE */ triple_row[v->offset] |= RASQAL_TRIPLES_BOUND_PREDICATE; } else triple_row[v->offset] |= RASQAL_TRIPLES_USE_PREDICATE; } if((v = rasqal_literal_as_variable(t->object))) { if(!vars_scope[v->offset]) { /* v needs binding in this triple as OBJECT */ triple_row[v->offset] |= RASQAL_TRIPLES_BOUND_OBJECT; } else triple_row[v->offset] |= RASQAL_TRIPLES_USE_OBJECT; } if(t->origin) { if((v = rasqal_literal_as_variable(t->origin))) { if(!vars_scope[v->offset]) { /* v needs binding in this triple as GRAPH */ triple_row[v->offset] |= RASQAL_TRIPLES_BOUND_GRAPH; } else triple_row[v->offset] |= RASQAL_TRIPLES_USE_GRAPH; } } /* Promote first use of a variable into a bind. */ if((v = rasqal_literal_as_variable(t->subject)) && triple_row[v->offset] & RASQAL_TRIPLES_BOUND_SUBJECT) { rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); } if((v = rasqal_literal_as_variable(t->predicate)) && triple_row[v->offset] & RASQAL_TRIPLES_BOUND_PREDICATE) { rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); } if((v = rasqal_literal_as_variable(t->object)) && triple_row[v->offset] & RASQAL_TRIPLES_BOUND_OBJECT) { rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); } if(t->origin) { if((v = rasqal_literal_as_variable(t->origin)) && triple_row[v->offset] & RASQAL_TRIPLES_BOUND_GRAPH) { rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); } } } /* Scan all triples for USEs of variables and update BGP mentioned bits */ for(var_index = 0; var_index < width; var_index++) { int mentioned = 0; for(col = start_column; col <= end_column; col++) { unsigned short* triple_row = &query->triples_use_map[col * width]; if(triple_row[var_index] & RASQAL_TRIPLES_USE_MASK) { mentioned = 1; break; } } if(mentioned) gp_use_map_row[var_index] |= RASQAL_VAR_USE_MENTIONED_HERE; else gp_use_map_row[var_index] = RASQAL_GOOD_CAST(unsigned short, gp_use_map_row[var_index] & ~RASQAL_VAR_USE_MENTIONED_HERE); } return 0; } #ifdef RASQAL_DEBUG static void rasqal_query_dump_vars_scope(rasqal_query* query, int width, unsigned short *vars_scope) { int j; for(j = 0; j < width; j++) { rasqal_variable* v = rasqal_variables_table_get(query->vars_table, j); fprintf(DEBUG_FH, "%8s ", v->name); } fputs("\n ", DEBUG_FH); for(j = 0; j < width; j++) { fprintf(DEBUG_FH, "%8d ", vars_scope[j]); } fputc('\n', DEBUG_FH); } #endif /** * rasqal_query_graph_pattern_build_variables_use_map_binds: * @use_map: 2D array of (num. variables x num. GPs) to READ and WRITE * @width: width of array (num. variables) * @gp: graph pattern to use * @vars_scope: variables bound in current scope * * INTERNAL - Calculate which GPs bind variables in a graph_pattern tree walk * * Return value: non-0 on failure **/ static int rasqal_query_graph_pattern_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern *gp, unsigned short *vars_scope) { int rc = 0; /* This a query in-order walk so SELECT ... AS ?var, BIND .. AS * ?var and GRAPH ?var come before any sub-graph patterns */ switch(gp->op) { case RASQAL_GRAPH_PATTERN_OPERATOR_BASIC: rc = rasqal_query_triples_build_variables_use_map_binds(query, use_map, width, gp, vars_scope); break; case RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH: rc = rasqal_query_graph_build_variables_use_map_binds(gp, vars_scope); break; case RASQAL_GRAPH_PATTERN_OPERATOR_FILTER: /* Only mentions */ break; case RASQAL_GRAPH_PATTERN_OPERATOR_LET: rc = rasqal_query_let_build_variables_use_map_binds(gp, vars_scope); break; case RASQAL_GRAPH_PATTERN_OPERATOR_SELECT: rc = rasqal_query_select_build_variables_use_map_binds(query, use_map, width, gp, vars_scope); break; case RASQAL_GRAPH_PATTERN_OPERATOR_UNION: case RASQAL_GRAPH_PATTERN_OPERATOR_GROUP: case RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL: rc = rasqal_query_union_build_variables_use_map_binds(query, use_map, width, gp, vars_scope); break; case RASQAL_GRAPH_PATTERN_OPERATOR_VALUES: rc = rasqal_query_values_build_variables_use_map_binds(query, use_map, width, gp, vars_scope); break; case RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE: case RASQAL_GRAPH_PATTERN_OPERATOR_MINUS: case RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN: break; } #ifdef RASQAL_DEBUG RASQAL_DEBUG3("vars_scope after %s graph pattern #%d verb is now:\n ", rasqal_graph_pattern_operator_as_string(gp->op), gp->gp_index); rasqal_query_dump_vars_scope(query, width, vars_scope); #endif /* Bind sub-graph patterns but not sub-SELECT gp twice */ if(gp->op != RASQAL_GRAPH_PATTERN_OPERATOR_SELECT && gp->graph_patterns) { int gp_size = raptor_sequence_size(gp->graph_patterns); int i; /* recursively call binds */ for(i = 0; i < gp_size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, i); RASQAL_DEBUG2("checking vars_scope for SGP #%d\n", sgp->gp_index); rc = rasqal_query_graph_pattern_build_variables_use_map_binds(query, use_map, width, sgp, vars_scope); if(rc) goto done; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("vars_scope after SGP #%d is now:\n ", sgp->gp_index); rasqal_query_dump_vars_scope(query, width, vars_scope); #endif } } done: return rc; } /** * rasqal_query_build_variables_use_map_binds: * @query: the #rasqal_query to find the variables in * @use_map: 2D array of (num. variables x num. GPs) to READ and WRITE * @width: width of array (num. variables) * @gp: graph pattern to use * * INTERNAL - Calculate which GPs bind variables in a graph_pattern tree walk * * Return value: non-0 on failure **/ static int rasqal_query_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern *gp) { int rc; unsigned short* vars_scope; raptor_sequence* seq; vars_scope = RASQAL_CALLOC(unsigned short*, RASQAL_GOOD_CAST(size_t, width), sizeof(unsigned short)); if(!vars_scope) return 1; rc = rasqal_query_graph_pattern_build_variables_use_map_binds(query, use_map, width, gp, vars_scope); /* Record variable binding for GROUP BY expressions (SPARQL 1.1) */ seq = rasqal_query_get_group_conditions_sequence(query); if(seq) { int size = raptor_sequence_size(seq); int i; unsigned short *use_map_row; use_map_row = &use_map[RASQAL_VAR_USE_MAP_OFFSET_GROUP_BY * width]; /* sequence of rasqal_expression of operation RASQAL_EXPR_LITERAL * containing a variable literal, with the variable having * ->expression set to the expression */ for(i = 0; i < size; i++) { rasqal_expression *e; rasqal_literal *l; e = (rasqal_expression*)raptor_sequence_get_at(seq, i); l = e->literal; if(l) { rasqal_variable* v = l->value.variable; if(v && v->expression) { use_map_row[v->offset] |= RASQAL_VAR_USE_BOUND_HERE; vars_scope[v->offset] = 1; } } } } RASQAL_FREE(intarray, vars_scope); return rc; } #ifdef RASQAL_DEBUG static const char* const use_map_offset_labels[RASQAL_VAR_USE_MAP_OFFSET_LAST + 1] = { "Verbs", "GROUP BY", "HAVING", "ORDER BY", "VALUES" }; #define N_MAP_FLAGS_LABELS 8 static const char* const use_map_flags_labels[N_MAP_FLAGS_LABELS + 1] = { " ", " I", " M ", " I", "B ", "B I", "BM ", "B I", "???" }; static void rasqal_query_print_variables_use_map(FILE* fh, rasqal_query* query) { int width; int height; int i; int row_index; width = rasqal_variables_table_get_total_variables_count(query->vars_table); height = (RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) + query->graph_pattern_count; fprintf(fh, "Query GP variables-use map (B=bound, M=mentioned, U=used):\n"); fputs("GP# Type ", fh); for(i = 0; i < width; i++) { rasqal_variable* v = rasqal_variables_table_get(query->vars_table, i); fprintf(fh, "%-12s ", v->name); } fputc('\n', fh); for(row_index = 0; row_index < height; row_index++) { unsigned short *row = &query->variables_use_map[row_index * width]; int gp_index = row_index - (RASQAL_VAR_USE_MAP_OFFSET_LAST + 1); if(gp_index < 0) fprintf(fh, "-- %-8s ", use_map_offset_labels[row_index]); else { rasqal_graph_pattern* gp; gp = (rasqal_graph_pattern*)raptor_sequence_get_at(query->graph_patterns_sequence, gp_index); fprintf(fh, "%-2d %-8s ", gp_index, rasqal_graph_pattern_operator_as_string(gp->op)); } for(i = 0; i < width; i++) { int flag_index = row[i]; /* Turn unknown flags into "???" */ if(flag_index > N_MAP_FLAGS_LABELS - 1) flag_index = N_MAP_FLAGS_LABELS; fprintf(fh, "%-12s ", use_map_flags_labels[flag_index]); } fputc('\n', fh); } } static const char bit_label[9] = "spogSPOG"; static void rasqal_query_print_triples_use_map(FILE* fh, rasqal_query* query) { int width; int height; int i; int column; width = rasqal_variables_table_get_total_variables_count(query->vars_table); height = raptor_sequence_size(query->triples); fprintf(fh, "Query triples variables-use map (mentioned: spog, bound: SPOG):\n"); fputs("Triple# ", fh); for(i = 0; i < width; i++) { rasqal_variable* v = rasqal_variables_table_get(query->vars_table, i); fprintf(fh, "%-12s ", v->name); } fputc('\n', fh); for(column = 0; column < height; column++) { unsigned short *row = &query->triples_use_map[column * width]; rasqal_triple* t; fprintf(fh, "%-7d ", column); for(i = 0; i < width; i++) { int flag = row[i]; char label[14] = " "; int bit; /* bit 0: RASQAL_TRIPLES_USE_SUBJECT * to * bit 7: RASQAL_TRIPLES_BOUND_GRAPH */ for(bit = 0; bit < 8; bit++) { if(flag & (1 << bit)) label[(bit & 3)] = bit_label[bit]; } fputs(label, fh); } fputc(' ', fh); t = (rasqal_triple*)raptor_sequence_get_at(query->triples, column); rasqal_triple_print(t, fh); fputc('\n', fh); } } #endif /* for use with rasqal_expression_visit and user_data=rasqal_query */ static int rasqal_query_expression_build_variables_use_map_row(unsigned short *use_map_row, rasqal_expression *e) { if(e->literal) { rasqal_variable* v; v = rasqal_literal_as_variable(e->literal); if(v) use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; } return 0; } /* * rasqal_query_build_variables_sequence_use_map_row: * @use_map_row: row to write to * @vars_seq: sequence of variables * @bind: force bind; otherwise binds only if var has an expression * * INTERNAL: Mark variables seen / bound in a sequence of variables (with optional expression) * * Return value: non-0 on failure */ static int rasqal_query_build_variables_sequence_use_map_row(unsigned short* use_map_row, raptor_sequence *vars_seq, int bind) { int rc = 0; int idx; for(idx = 0; 1; idx++) { rasqal_variable* v; int flags = RASQAL_VAR_USE_MENTIONED_HERE; v = (rasqal_variable*)raptor_sequence_get_at(vars_seq, idx); if(!v) break; if(bind) flags |= RASQAL_VAR_USE_BOUND_HERE; else { rasqal_expression *e; e = v->expression; if(e) { rasqal_query_expression_build_variables_use_map(use_map_row, e); flags |= RASQAL_VAR_USE_BOUND_HERE; } } use_map_row[v->offset] = RASQAL_GOOD_CAST(unsigned short, use_map_row[v->offset] | flags); } return rc; } /* * Mark variables seen in a sequence of literals */ static int rasqal_query_build_literals_sequence_use_map_row(unsigned short* use_map_row, raptor_sequence *lits_seq) { int idx; for(idx = 0; 1; idx++) { rasqal_literal* l; rasqal_variable* v; l = (rasqal_literal*)raptor_sequence_get_at(lits_seq, idx); if(!l) break; v = rasqal_literal_as_variable(l); if(v) use_map_row[v->offset] |= RASQAL_VAR_USE_MENTIONED_HERE; } return 0; } /* * Mark variables seen in a sequence of expressions */ static int rasqal_query_build_expressions_sequence_use_map_row(unsigned short* use_map_row, raptor_sequence *exprs_seq) { int rc = 0; int idx; for(idx = 0; 1; idx++) { rasqal_expression *e; e = (rasqal_expression*)raptor_sequence_get_at(exprs_seq, idx); if(!e) break; rasqal_query_expression_build_variables_use_map(use_map_row, e); } return rc; } /** * rasqal_query_build_variables_use_map: * @query: the #rasqal_query to find the variables in * * INTERNAL - Record where variables are mentioned in query structures * * Need to walk query components that may mention or bind variables * and record their variable use: * 1) Query verbs: ASK SELECT CONSTRUCT DESCRIBE (SPARQL 1.0) * 1a) SELECT project-expressions (SPARQL 1.1) * 2) GROUP BY expr/var (SPARQL 1.1 TBD) * 3) HAVING expr (SPARQL 1.1 TBD) * 4) ORDER list-of-expr (SPARQL 1.0) * * Constructs a 2D array of * width: number of variables * height: (number of graph patterns + #RASQAL_VAR_USE_MAP_OFFSET_LAST+1) * where each row records how a variable is bound/used in a GP or query * structure. * * The first #RASQAL_VAR_USE_MAP_OFFSET_LAST+1 rows are used for the * query structures above defined by the #rasqal_var_use_map_offset * enum. Example: row 0 (#RASQAL_VAR_USE_MAP_OFFSET_VERBS) is used * to record variable use for the query verbs - item 1) in the list * above. * * Graph pattern rows are recorded at row * + #RASQAL_VAR_USE_MAP_OFFSET_LAST + 1 * * Return value: non-0 on failure **/ static int rasqal_query_build_variables_use_map(rasqal_query* query, rasqal_projection* projection) { int width; int height; int rc = 0; unsigned short *use_map; raptor_sequence* seq; unsigned short *use_map_row; width = rasqal_variables_table_get_total_variables_count(query->vars_table); height = RASQAL_VAR_USE_MAP_OFFSET_LAST + 1 + query->graph_pattern_count; use_map = RASQAL_CALLOC(unsigned short*, RASQAL_GOOD_CAST(size_t, width * height), sizeof(unsigned short)); if(!use_map) return 1; if(query->variables_use_map) RASQAL_FREE(shortarray, query->variables_use_map); query->variables_use_map = use_map; height = raptor_sequence_size(query->triples); use_map = RASQAL_CALLOC(unsigned short*, RASQAL_GOOD_CAST(size_t, width * height), sizeof(unsigned short)); if(!use_map) { RASQAL_FREE(shortarray, query->variables_use_map); query->variables_use_map = NULL; return 1; } if(query->triples_use_map) RASQAL_FREE(shortarray, query->triples_use_map); query->triples_use_map = use_map; use_map = query->variables_use_map; use_map_row = &use_map[RASQAL_VAR_USE_MAP_OFFSET_VERBS * width]; /* record variable use for 1) Query verbs */ switch(query->verb) { case RASQAL_QUERY_VERB_SELECT: /* This also handles 1a) select/project expressions */ if(projection && projection->variables) rc = rasqal_query_build_variables_sequence_use_map_row(use_map_row, projection->variables, 0); break; case RASQAL_QUERY_VERB_DESCRIBE: /* This is a list of rasqal_literal not rasqal_variable */ rc = rasqal_query_build_literals_sequence_use_map_row(use_map_row, query->describes); break; case RASQAL_QUERY_VERB_CONSTRUCT: if(1) { int last_column = raptor_sequence_size(query->constructs)-1; rc = rasqal_query_triples_build_variables_use_map_row(query->constructs, use_map_row, 0, last_column); } break; case RASQAL_QUERY_VERB_DELETE: case RASQAL_QUERY_VERB_INSERT: case RASQAL_QUERY_VERB_UPDATE: /* FIXME - should mark the verbs using triple patterns as using vars */ break; case RASQAL_QUERY_VERB_UNKNOWN: case RASQAL_QUERY_VERB_ASK: default: break; } if(rc) goto done; /* Record variable use for 2) GROUP BY expressions (SPARQL 1.1) */ seq = rasqal_query_get_group_conditions_sequence(query); if(seq) { use_map_row = &use_map[RASQAL_VAR_USE_MAP_OFFSET_GROUP_BY * width]; rc = rasqal_query_build_expressions_sequence_use_map_row(use_map_row, seq); if(rc) goto done; } /* Record variable use for 3) HAVING expr (SPARQL 1.1) */ seq = rasqal_query_get_having_conditions_sequence(query); if(seq) { use_map_row = &use_map[RASQAL_VAR_USE_MAP_OFFSET_HAVING * width]; rc = rasqal_query_build_expressions_sequence_use_map_row(use_map_row, seq); if(rc) goto done; } /* record variable use for 4) ORDER list-of-expr (SPARQL 1.0) */ seq = rasqal_query_get_order_conditions_sequence(query); if(seq) { use_map_row = &use_map[RASQAL_VAR_USE_MAP_OFFSET_ORDER_BY * width]; rc = rasqal_query_build_expressions_sequence_use_map_row(use_map_row, seq); if(rc) goto done; } /* record variable use for 5) VALUES (SPARQL 1.1) */ if(query->bindings) { use_map_row = &use_map[RASQAL_VAR_USE_MAP_OFFSET_VALUES * width]; rc = rasqal_query_build_variables_sequence_use_map_row(use_map_row, query->bindings->variables, 1); if(rc) goto done; } /* record variable use for graph patterns */ rc = rasqal_query_graph_pattern_build_variables_use_map(query, use_map, width, query->query_graph_pattern); if(rc) goto done; #ifdef RASQAL_DEBUG RASQAL_DEBUG1("variables use map after mentions: "); rasqal_query_print_variables_use_map(DEBUG_FH, query); fputs("\n", DEBUG_FH); #endif /* calculate which GPs bind variables for all query graph patterns * reading from the use_map */ rc = rasqal_query_build_variables_use_map_binds(query, use_map, width, query->query_graph_pattern); if(rc) goto done; #ifdef RASQAL_DEBUG RASQAL_DEBUG1("use map after binds and mentions: "); rasqal_query_print_variables_use_map(DEBUG_FH, query); fputs("\n", DEBUG_FH); RASQAL_DEBUG1("triples use map after binds and mentions: "); rasqal_query_print_triples_use_map(DEBUG_FH, query); fputs("\n", DEBUG_FH); #endif done: return rc; } /** * rasqal_query_graph_build_variables_use_map_binds: * @gp: the #rasqal_graph_pattern GRAPH pattern * @vars_scope: variable scope array * * INTERNAL - Mark variables bound in a GRAPH graph pattern * **/ static int rasqal_query_graph_build_variables_use_map_binds(rasqal_graph_pattern* gp, unsigned short* vars_scope) { rasqal_variable *v; v = rasqal_literal_as_variable(gp->origin); if(v) rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); return 0; } /** * rasqal_query_expression_build_variables_use_map: * @use_map_row: 1D array of size num. variables to write * @e: filter expression to use * * INTERNAL - Mark variables mentioned in an expression * **/ static void rasqal_query_expression_build_variables_use_map(unsigned short *use_map_row, rasqal_expression* e) { rasqal_expression_visit(e, (rasqal_expression_visit_fn)rasqal_query_expression_build_variables_use_map_row, use_map_row); } /** * rasqal_query_let_build_variables_use_map: * @query: the #rasqal_query to find the variables in * @use_map_row: 1D array of size num. variables to write * @e: let expression to use * * INTERNAL - Mark variables mentioned in a LET graph pattern * **/ static void rasqal_query_let_build_variables_use_map(rasqal_query* query, unsigned short *use_map_row, rasqal_expression* e) { rasqal_expression_visit(e, (rasqal_expression_visit_fn)rasqal_query_expression_build_variables_use_map_row, use_map_row); } /** * rasqal_query_let_build_variables_use_map_binds: * @gp: the #rasqal_graph_pattern LET graph pattern * @vars_scope: variable scope array * * INTERNAL - Mark variables bound in a LET graph pattern * **/ static int rasqal_query_let_build_variables_use_map_binds(rasqal_graph_pattern* gp, unsigned short* vars_scope) { rasqal_variable* v = gp->var; rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); return 0; } /** * rasqal_query_select_build_variables_use_map: * @query: the #rasqal_query to find the variables in * @use_map_row: 1D array of size num. variables to write * @width: width of array (num. variables) * @gp: the SELECT graph pattern * * INTERNAL - Mark variables mentioned in a sub-SELECT graph pattern * **/ static int rasqal_query_select_build_variables_use_map(rasqal_query* query, unsigned short *use_map_row, int width, rasqal_graph_pattern* gp) { int rc = 0; raptor_sequence* seq; /* mention any variables in the projection */ seq = rasqal_projection_get_variables_sequence(gp->projection); if(!seq && gp->graph_patterns) { int var_index; int gp_size; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); gp_size = raptor_sequence_size(gp->graph_patterns); /* No variables; must be SELECT * so form it from all mentioned * variables in the sub graph patterns */ for(var_index = 0; var_index < width; var_index++) { rasqal_variable *v; int gp_index; v = rasqal_variables_table_get(query->vars_table, var_index); for(gp_index = 0; gp_index < gp_size; gp_index++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(gp->graph_patterns, gp_index); if(rasqal_graph_pattern_tree_mentions_variable(sgp, v)) { raptor_sequence_push(seq, rasqal_new_variable_from_variable(v)); /* if any sub-GP mentions the variable we can end the SGP loop */ break; } } } /* FIXME: uses internal knowledge of projection structure */ gp->projection->variables = seq; } rc = rasqal_query_build_variables_sequence_use_map_row(use_map_row, seq, 0); if(rc) return rc; if(gp->bindings) { rc = rasqal_query_build_variables_sequence_use_map_row(use_map_row, gp->bindings->variables, 1); if(rc) return rc; } return rc; } /** * rasqal_query_select_build_variables_use_map_binds: * @use_map: 2D array of (num. variables x num. GPs) to READ and WRITE * @width: width of array (num. variables) * @gp: graph pattern to use * @vars_scope: variables bound in current scope * * INTERNAL - Mark variables bound in a sub-SELECT graph pattern * **/ static int rasqal_query_select_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope) { unsigned short* inner_vars_scope; raptor_sequence* seq; int size; int i; inner_vars_scope = RASQAL_CALLOC(unsigned short*, RASQAL_GOOD_CAST(size_t, width), sizeof(unsigned short)); if(!inner_vars_scope) return 1; seq = gp->graph_patterns; size = raptor_sequence_size(seq); for(i = 0; i < size; i++) { rasqal_graph_pattern *sgp; sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(seq, i); rasqal_query_graph_pattern_build_variables_use_map_binds(query, use_map, width, sgp, inner_vars_scope); } RASQAL_FREE(intarray, inner_vars_scope); inner_vars_scope = NULL; /* Mark as binding in the OUTER scope all variables that were bound * in the INNER SELECT projection */ seq = rasqal_projection_get_variables_sequence(gp->projection); size = raptor_sequence_size(seq); for(i = 0; i < size; i++) { rasqal_variable * v; v = (rasqal_variable*)raptor_sequence_get_at(seq, i); rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); } return 0; } /** * rasqal_query_union_build_variables_use_map_binds: * @use_map: 2D array of (num. variables x num. GPs) to READ and WRITE * @width: width of array (num. variables) * @gp: graph pattern to use * @vars_scope: variables bound in current scope * * INTERNAL - Mark variables bound in a UNION sub-graph patterns * **/ static int rasqal_query_union_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope) { unsigned short* inner_vars_scope; raptor_sequence* seq; int gp_size; int i; int rc = 0; seq = gp->graph_patterns; gp_size = raptor_sequence_size(seq); inner_vars_scope = RASQAL_CALLOC(unsigned short*, RASQAL_GOOD_CAST(size_t, width), sizeof(unsigned short)); if(!inner_vars_scope) return 1; for(i = 0; i < gp_size; i++) { rasqal_graph_pattern *sgp; /* UNION starts with a copy of all scoped outer variables */ memcpy(inner_vars_scope, vars_scope, RASQAL_GOOD_CAST(size_t, RASQAL_GOOD_CAST(size_t, width) * sizeof(unsigned short))); sgp = (rasqal_graph_pattern*)raptor_sequence_get_at(seq, i); rc = rasqal_query_graph_pattern_build_variables_use_map_binds(query, use_map, width, sgp, inner_vars_scope); if(rc) goto done; } done: RASQAL_FREE(intarray, inner_vars_scope); return rc; } /** * rasqal_query_values_build_variables_use_map_binds: * @use_map: 2D array of (num. variables x num. GPs) to READ and WRITE * @width: width of array (num. variables) * @gp: graph pattern to use * @vars_scope: variables bound in current scope * * INTERNAL - Mark variables bound in a VALUES sub-graph patterns * **/ static int rasqal_query_values_build_variables_use_map_binds(rasqal_query* query, unsigned short *use_map, int width, rasqal_graph_pattern* gp, unsigned short* vars_scope) { raptor_sequence* seq; int size; int i; int rc = 0; seq = gp->bindings->variables; size = raptor_sequence_size(seq); for(i = 0; i < size; i++) { rasqal_variable * v; v = (rasqal_variable*)raptor_sequence_get_at(seq, i); rasqal_graph_pattern_promote_variable_mention_to_bind(gp, v, vars_scope); } return rc; } /* * rasqal_query_variable_is_bound: * @gp: #rasqal_graph_pattern object * @variable: variable * * INTERNAL - Test if a variable is bound in the given GP * * Return value: non-0 if bound */ int rasqal_query_variable_is_bound(rasqal_query* query, rasqal_variable* v) { unsigned short *use_map = query->variables_use_map; int width; int height; int row_index; width = rasqal_variables_table_get_total_variables_count(query->vars_table); height = (RASQAL_VAR_USE_MAP_OFFSET_LAST + 1) + query->graph_pattern_count; for(row_index = 0; row_index < height; row_index++) { unsigned short *row = &use_map[row_index * width]; if(row[v->offset]) return 1; } return 0; } rasqal-0.9.33/src/rasqal_bindings.c0000644000175000017500000001521312340724203014104 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_bindings.c - Rasqal result bindings class * * Copyright (C) 2010-2013, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /* * rasqal_new_bindings: * @query: rasqal query * @variables: sequence of variables * @rows: sequence of #rasqal_row (or NULL) * * INTERNAL - Create a new bindings object. * * The @variables and @rows become owned by the bindings object. * * Return value: a new #rasqal_bindings object or NULL on failure **/ rasqal_bindings* rasqal_new_bindings(rasqal_query* query, raptor_sequence* variables, raptor_sequence* rows) { rasqal_bindings* bindings; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(variables, raptor_sequence, NULL); bindings = RASQAL_CALLOC(rasqal_bindings*, 1, sizeof(*bindings)); if(!bindings) return NULL; bindings->usage = 1; bindings->query = query; bindings->variables = variables; bindings->rows = rows; return bindings; } /* * rasqal_new_bindings_from_bindings: * @bindings: #rasqal_bindings to copy * * INTERNAL - Copy Constructor - Create a new Rasqal bindings from an existing one * * This adds a new reference to the bindings, it does not do a deep copy * * Return value: a new #rasqal_bindings or NULL on failure. **/ rasqal_bindings* rasqal_new_bindings_from_bindings(rasqal_bindings* bindings) { if(!bindings) return NULL; bindings->usage++; return bindings; } /* * rasqal_new_bindings_from_var_values: * @query: rasqal query * @var: variable * @values: sequence of #rasqal_value (or NULL) * * INTERNAL - Create a new bindings object for one variable with multiple bindings * * The @var and @values become owned by the bindings object. * * Return value: a new #rasqal_bindings object or NULL on failure **/ rasqal_bindings* rasqal_new_bindings_from_var_values(rasqal_query* query, rasqal_variable* var, raptor_sequence* values) { rasqal_bindings* bindings = NULL; raptor_sequence* varlist = NULL; rasqal_row* row = NULL; raptor_sequence* rowlist = NULL; int size = 0; int i; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(query, rasqal_query, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(var, rasqal_variable, NULL); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("binding "); rasqal_variable_print(var, stderr); fputs(" and row values ", stderr); raptor_sequence_print(values, stderr); fputc('\n', stderr); #endif varlist = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!varlist) { RASQAL_DEBUG1("Cannot create varlist sequence"); goto tidy; } if(raptor_sequence_push(varlist, var)) { RASQAL_DEBUG1("varlist sequence push failed"); goto tidy; } var = NULL; if(values) size = raptor_sequence_size(values); row = rasqal_new_row_for_size(query->world, size); if(!row) { RASQAL_DEBUG1("cannot create row"); goto tidy; } for(i = 0; i < size; i++) { rasqal_literal* value = (rasqal_literal*)raptor_sequence_get_at(values, i); rasqal_row_set_value_at(row, i, value); } rowlist = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!rowlist) { RASQAL_DEBUG1("cannot create rowlist sequence"); goto tidy; } if(raptor_sequence_push(rowlist, row)) { RASQAL_DEBUG1("rowlist sequence push failed"); goto tidy; } row = NULL; bindings = rasqal_new_bindings(query, varlist, rowlist); varlist = NULL; rowlist = NULL; tidy: if(row) rasqal_free_row(row); if(rowlist) raptor_free_sequence(rowlist); if(varlist) raptor_free_sequence(varlist); if(var) rasqal_free_variable(var); if(values) raptor_free_sequence(values); return bindings; } /* * rasqal_free_bindings: * @bindings: #rasqal_bindings object * * INTERNAL - Free a bindings object. * **/ void rasqal_free_bindings(rasqal_bindings* bindings) { if(!bindings) return; if(--bindings->usage) return; raptor_free_sequence(bindings->variables); if(bindings->rows) raptor_free_sequence(bindings->rows); RASQAL_FREE(rasqal_bindings, bindings); } /* * rasqal_bindings_print: * @bindings: the #rasqal_bindings object * @fh: the FILE* handle to print to * * INTERNAL - Print a #rasqal_bindings in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_bindings_print(rasqal_bindings* bindings, FILE* fh) { int i; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(bindings, rasqal_bindings, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); fputs("\n variables: ", fh); raptor_sequence_print(bindings->variables, fh); fputs("\n rows: [\n ", fh); if(bindings->rows) { for(i = 0; i < raptor_sequence_size(bindings->rows); i++) { rasqal_row* row; row = (rasqal_row*)raptor_sequence_get_at(bindings->rows, i); if(i > 0) fputs("\n ", fh); rasqal_row_print(row, fh); } } fputs("\n ]\n", fh); return 0; } /* * rasqal_bindings_get_row: * @bindings: the #rasqal_bindings object * @offset: row offset into bindings (0+) * * INTERNAL - get a row from a binding at the given offset * * Return value: new row or NULL if out of range */ rasqal_row* rasqal_bindings_get_row(rasqal_bindings* bindings, int offset) { rasqal_row* row = NULL; if(bindings->rows) { row = (rasqal_row*)raptor_sequence_get_at(bindings->rows, offset); if(row) row = rasqal_new_row_from_row(row); } return row; } rasqal-0.9.33/src/rasqal_internal.h0000644000175000017500000023673412434455625014162 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_internal.h - Rasqal RDF Query library internals * * 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. * */ #ifndef RASQAL_INTERNAL_H #define RASQAL_INTERNAL_H #if defined(_MSC_VER) && _MSC_VER < 1600 typedef unsigned __int32 uint32_t; typedef __int16 int16_t; #else #include #endif #ifdef __cplusplus extern "C" { #define RASQAL_EXTERN_C extern "C" #else #define RASQAL_EXTERN_C #endif #ifdef RASQAL_INTERNAL #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) #define RASQAL_PRINTF_FORMAT(string_index, first_to_check_index) \ __attribute__((__format__(__printf__, string_index, first_to_check_index))) #else #define RASQAL_PRINTF_FORMAT(string_index, first_to_check_index) #endif #ifdef __GNUC__ #define RASQAL_NORETURN __attribute__((noreturn)) #else #define RASQAL_NORETURN #endif /* Can be over-ridden or undefined in a config.h file or -Ddefine */ #ifndef RASQAL_INLINE #define RASQAL_INLINE inline #endif #ifdef LIBRDF_DEBUG #define RASQAL_DEBUG 1 #endif #if defined(RASQAL_MEMORY_SIGN) #define RASQAL_SIGN_KEY 0x08A59A10 void* rasqal_sign_malloc(size_t size); void* rasqal_sign_calloc(size_t nmemb, size_t size); void* rasqal_sign_realloc(void *ptr, size_t size); void rasqal_sign_free(void *ptr); #define RASQAL_MALLOC(type, size) (type)rasqal_sign_malloc(size) #define RASQAL_CALLOC(type, nmemb, size) (type)rasqal_sign_calloc(nmemb, size) #define RASQAL_REALLOC(type, ptr, size) (type0rasqal_sign_realloc(ptr, size) #define RASQAL_FREE(type, ptr) rasqal_sign_free((void*)ptr) #else #define RASQAL_MALLOC(type, size) (type)malloc(size) #define RASQAL_CALLOC(type, size, count) (type)calloc(size, count) #define RASQAL_FREE(type, ptr) free((void*)ptr) #endif #ifdef HAVE___FUNCTION__ #else #define __FUNCTION__ "???" #endif #ifdef RASQAL_DEBUG /* Debugging messages */ #define RASQAL_DEBUG1(msg) do {fprintf(stderr, "%s:%d:%s: " msg, __FILE__, __LINE__, __FUNCTION__); } while(0) #define RASQAL_DEBUG2(msg, arg1) do {fprintf(stderr, "%s:%d:%s: " msg, __FILE__, __LINE__, __FUNCTION__, arg1);} while(0) #define RASQAL_DEBUG3(msg, arg1, arg2) do {fprintf(stderr, "%s:%d:%s: " msg, __FILE__, __LINE__, __FUNCTION__, arg1, arg2);} while(0) #define RASQAL_DEBUG4(msg, arg1, arg2, arg3) do {fprintf(stderr, "%s:%d:%s: " msg, __FILE__, __LINE__, __FUNCTION__, arg1, arg2, arg3);} while(0) #define RASQAL_DEBUG5(msg, arg1, arg2, arg3, arg4) do {fprintf(stderr, "%s:%d:%s: " msg, __FILE__, __LINE__, __FUNCTION__, arg1, arg2, arg3, arg4);} while(0) #define RASQAL_DEBUG6(msg, arg1, arg2, arg3, arg4, arg5) do {fprintf(stderr, "%s:%d:%s: " msg, __FILE__, __LINE__, __FUNCTION__, arg1, arg2, arg3, arg4, arg5);} while(0) #if defined(HAVE_DMALLOC_H) && defined(RASQAL_MEMORY_DEBUG_DMALLOC) void* rasqal_system_malloc(size_t size); void rasqal_system_free(void *ptr); #define SYSTEM_MALLOC(size) rasqal_system_malloc(size) #define SYSTEM_FREE(ptr) rasqal_system_free(ptr) #else #define SYSTEM_MALLOC(size) malloc(size) #define SYSTEM_FREE(ptr) free(ptr) #endif #ifndef RASQAL_ASSERT_DIE #define RASQAL_ASSERT_DIE abort(); #endif #else /* DEBUGGING TURNED OFF */ /* No debugging messages */ #define RASQAL_DEBUG1(msg) #define RASQAL_DEBUG2(msg, arg1) #define RASQAL_DEBUG3(msg, arg1, arg2) #define RASQAL_DEBUG4(msg, arg1, arg2, arg3) #define RASQAL_DEBUG5(msg, arg1, arg2, arg3, arg4) #define RASQAL_DEBUG6(msg, arg1, arg2, arg3, arg4, arg5) #define SYSTEM_MALLOC(size) malloc(size) #define SYSTEM_FREE(ptr) free(ptr) #ifndef RASQAL_ASSERT_DIE #define RASQAL_ASSERT_DIE #endif #endif #ifdef RASQAL_DISABLE_ASSERT_MESSAGES #define RASQAL_ASSERT_REPORT(line) #else #define RASQAL_ASSERT_REPORT(msg) fprintf(stderr, "%s:%d: (%s) assertion failed: " msg "\n", __FILE__, __LINE__, __FUNCTION__); #endif #ifdef RASQAL_DISABLE_ASSERT #define RASQAL_ASSERT(condition, msg) #define RASQAL_ASSERT_RETURN(condition, msg, ret) #define RASQAL_ASSERT_OBJECT_POINTER_RETURN(pointer, type) do { \ if(!pointer) \ return; \ } while(0) #define RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(pointer, type, ret) #else #define RASQAL_ASSERT(condition, msg) do { \ if(condition) { \ RASQAL_ASSERT_REPORT(msg) \ RASQAL_ASSERT_DIE \ } \ } while(0) #define RASQAL_ASSERT_RETURN(condition, msg, ret) do { \ if(condition) { \ RASQAL_ASSERT_REPORT(msg) \ RASQAL_ASSERT_DIE \ return ret; \ } \ } while(0) #define RASQAL_ASSERT_OBJECT_POINTER_RETURN(pointer, type) do { \ if(!pointer) { \ RASQAL_ASSERT_REPORT("object pointer of type " #type " is NULL.") \ RASQAL_ASSERT_DIE \ return; \ } \ } while(0) #define RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(pointer, type, ret) do { \ if(!pointer) { \ RASQAL_ASSERT_REPORT("object pointer of type " #type " is NULL.") \ RASQAL_ASSERT_DIE \ return ret; \ } \ } while(0) #endif /* Fatal errors - always happen */ #define RASQAL_FATAL1(msg) do {fprintf(stderr, "%s:%d:%s: fatal error: " msg, __FILE__, __LINE__ , __FUNCTION__); abort();} while(0) #define RASQAL_FATAL2(msg,arg) do {fprintf(stderr, "%s:%d:%s: fatal error: " msg, __FILE__, __LINE__ , __FUNCTION__, arg); abort();} while(0) #define RASQAL_FATAL3(msg,arg1,arg2) do {fprintf(stderr, "%s:%d:%s: fatal error: " msg, __FILE__, __LINE__ , __FUNCTION__, arg1, arg2); abort();} while(0) #ifndef NO_STATIC_DATA #define RASQAL_DEPRECATED_MESSAGE(msg) do {static int warning_given=0; if(!warning_given++) fprintf(stderr, "Function %s is deprecated - " msg, __FUNCTION__); } while(0) #define RASQAL_DEPRECATED_WARNING(rq, msg) do {static int warning_given=0; if(!warning_given++) rasqal_query_warning(rq, msg); } while(0) #else #define RASQAL_DEPRECATED_MESSAGE(msg) do { fprintf(stderr, "Function %s is deprecated - " msg, __FUNCTION__); } while(0) #define RASQAL_DEPRECATED_WARNING(rq, msg) do { rasqal_query_warning(rq, msg); } while(0) #endif typedef struct rasqal_query_execution_factory_s rasqal_query_execution_factory; typedef struct rasqal_query_language_factory_s rasqal_query_language_factory; /** * rasqal_projection: * @query: rasqal query * @wildcard: non-0 if @variables was '*' * @distinct: 1 if distinct, 2 if reduced, otherwise neither * * Query projection (SELECT vars, SELECT *, SELECT DISTINCT/REDUCED ...) * */ typedef struct { rasqal_query* query; raptor_sequence* variables; unsigned int wildcard:1; int distinct; } rasqal_projection; /** * rasqal_solution_modifier: * @query: rasqal query * @order_conditions: sequence of order condition expressions (or NULL) * @group_conditions: sequence of group by condition expressions (or NULL) * @having_conditions: sequence of (group by ...) having condition expressions (or NULL) * @limit: result limit LIMIT (>=0) or <0 if not given * @offset: result offset OFFSET (>=0) or <0 if not given * * Query solution modifiers * */ typedef struct { rasqal_query* query; raptor_sequence* order_conditions; raptor_sequence* group_conditions; raptor_sequence* having_conditions; int limit; int offset; } rasqal_solution_modifier; /** * rasqal_bindings: * @query: rasqal query * @variables: sequence of variables * @rows: sequence of #rasqal_row (or NULL) * * Result bindings from SPARQL 1.1 BINDINGS block * */ typedef struct { /* usage/reference count */ int usage; rasqal_query* query; raptor_sequence* variables; raptor_sequence* rows; } rasqal_bindings; /* * Graph Pattern */ struct rasqal_graph_pattern_s { rasqal_query* query; /* operator for this graph pattern's contents */ rasqal_graph_pattern_operator op; raptor_sequence* triples; /* ... rasqal_triple* */ raptor_sequence* graph_patterns; /* ... rasqal_graph_pattern* */ int start_column; int end_column; /* the FILTER / LET expression */ rasqal_expression* filter_expression; /* index of the graph pattern in the query (0.. query->graph_pattern_count-1) */ int gp_index; /* Graph literal / SERVICE literal */ rasqal_literal *origin; /* Variable for LET graph pattern */ rasqal_variable *var; /* SELECT projection */ rasqal_projection* projection; /* SELECT modifiers */ rasqal_solution_modifier* modifier; /* SILENT flag for SERVICE graph pattern */ unsigned int silent : 1; /* SELECT graph pattern: sequence of #rasqal_data_graph */ raptor_sequence* data_graphs; /* VALUES bindings for VALUES and sub-SELECT graph patterns */ rasqal_bindings* bindings; }; rasqal_graph_pattern* rasqal_new_basic_graph_pattern(rasqal_query* query, raptor_sequence* triples, int start_column, int end_column); rasqal_graph_pattern* rasqal_new_graph_pattern_from_sequence(rasqal_query* query, raptor_sequence* graph_patterns, rasqal_graph_pattern_operator op); rasqal_graph_pattern* rasqal_new_filter_graph_pattern(rasqal_query* query, rasqal_expression* expr); rasqal_graph_pattern* rasqal_new_let_graph_pattern(rasqal_query *query, rasqal_variable *var, rasqal_expression *expr); rasqal_graph_pattern* rasqal_new_select_graph_pattern(rasqal_query *query, rasqal_projection* projection, raptor_sequence* data_graphs, rasqal_graph_pattern* where, rasqal_solution_modifier* modifier, rasqal_bindings* bindings); rasqal_graph_pattern* rasqal_new_single_graph_pattern(rasqal_query* query, rasqal_graph_pattern_operator op, rasqal_graph_pattern* single); rasqal_graph_pattern* rasqal_new_values_graph_pattern(rasqal_query* query, rasqal_bindings* bindings); void rasqal_free_graph_pattern(rasqal_graph_pattern* gp); void rasqal_graph_pattern_adjust(rasqal_graph_pattern* gp, int offset); void rasqal_graph_pattern_set_origin(rasqal_graph_pattern* graph_pattern, rasqal_literal* origin); /** * rasqal_var_use_map_flags: * @RASQAL_VAR_USE_IN_SCOPE: variable is in-scope in this GP * @RASQAL_VAR_USE_MENTIONED_HERE: variable is mentioned/used in this GP * @RASQAL_VAR_USE_BOUND_HERE: variable is bound in this GP */ typedef enum { RASQAL_VAR_USE_IN_SCOPE = 1 << 0, RASQAL_VAR_USE_MENTIONED_HERE = 1 << 1, RASQAL_VAR_USE_BOUND_HERE = 1 << 2 } rasqal_var_use_map_flags; /** * rasqal_var_use_map_offset: * @RASQAL_VAR_USE_MAP_OFFSET_VERBS: Variables in query verbs: ASK: never, SELECT: project-expressions (SPARQL 1.1), CONSTRUCT: in constructed triple patterns, DESCRIBE: in argument (SPARQL 1.0) * @RASQAL_VAR_USE_MAP_OFFSET_GROUP_BY: Variables in GROUP BY expr/var (SPARQL 1.1) * @RASQAL_VAR_USE_MAP_OFFSET_HAVING: Variables in HAVING expr (SPARQL 1.1) * @RASQAL_VAR_USE_MAP_OFFSET_ORDER_BY: Variables in ORDER BY list-of-expr (SPARQL 1.0) * @RASQAL_VAR_USE_MAP_OFFSET_VALUES: Variables bound in VALUES (SPARQL 1.1) * @RASQAL_VAR_USE_MAP_OFFSET_LAST: internal * * Offsets into variables use-map for non-graph pattern parts of #rasqal_query structure */ typedef enum { RASQAL_VAR_USE_MAP_OFFSET_VERBS = 0, RASQAL_VAR_USE_MAP_OFFSET_GROUP_BY = 1, RASQAL_VAR_USE_MAP_OFFSET_HAVING = 2, RASQAL_VAR_USE_MAP_OFFSET_ORDER_BY = 3, RASQAL_VAR_USE_MAP_OFFSET_VALUES = 4, RASQAL_VAR_USE_MAP_OFFSET_LAST = RASQAL_VAR_USE_MAP_OFFSET_VALUES } rasqal_var_use_map_offset; /** * rasqal_triples_use_map_flags: * @RASQAL_TRIPLES_USE_SUBJECT: variable used in subject of this triple * @RASQAL_TRIPLES_USE_PREDICATE: ditto predicate * @RASQAL_TRIPLES_USE_OBJECT: ditto object * @RASQAL_TRIPLES_USE_GRAPH: ditto graph * @RASQAL_TRIPLES_BOUND_SUBJECT: variable bound in subject of this triple * @RASQAL_TRIPLES_BOUND_PREDICATE: ditto predicate * @RASQAL_TRIPLES_BOUND_OBJECT: ditto object * @RASQAL_TRIPLES_BOUND_GRAPH: ditto graph * @RASQAL_TRIPLES_USE_MASK: mask to check if variable is used in any part of TP * @RASQAL_TRIPLES_BOUND_MASK: mask to check if variable is bound in any part of TP (a single variable can be bound at most once in a triple pattern) */ typedef enum { RASQAL_TRIPLES_USE_SUBJECT = RASQAL_TRIPLE_SUBJECT, RASQAL_TRIPLES_USE_PREDICATE = RASQAL_TRIPLE_PREDICATE, RASQAL_TRIPLES_USE_OBJECT = RASQAL_TRIPLE_OBJECT, RASQAL_TRIPLES_USE_GRAPH = RASQAL_TRIPLE_GRAPH, RASQAL_TRIPLES_BOUND_SUBJECT = RASQAL_TRIPLE_SUBJECT << 4, RASQAL_TRIPLES_BOUND_PREDICATE = RASQAL_TRIPLE_PREDICATE << 4, RASQAL_TRIPLES_BOUND_OBJECT = RASQAL_TRIPLE_OBJECT << 4, RASQAL_TRIPLES_BOUND_GRAPH = RASQAL_TRIPLE_GRAPH << 4, RASQAL_TRIPLES_USE_MASK = (RASQAL_TRIPLES_USE_SUBJECT | RASQAL_TRIPLES_USE_PREDICATE | RASQAL_TRIPLES_USE_OBJECT | RASQAL_TRIPLES_USE_GRAPH), RASQAL_TRIPLES_BOUND_MASK = (RASQAL_TRIPLES_BOUND_SUBJECT | RASQAL_TRIPLES_BOUND_PREDICATE | RASQAL_TRIPLES_BOUND_OBJECT | RASQAL_TRIPLES_BOUND_GRAPH) } rasqal_triples_use_map_flags; /* * A query in some query language */ struct rasqal_query_s { rasqal_world* world; /* world object */ int usage; /* reference count - 1 for itself, plus for query_results */ unsigned char* query_string; size_t query_string_length; /* length including NULs */ raptor_namespace_stack* namespaces; /* query graph pattern, containing the sequence of graph_patterns below */ rasqal_graph_pattern* query_graph_pattern; /* the query verb - in SPARQL terms: SELECT, CONSTRUCT, DESCRIBE or ASK */ rasqal_query_verb verb; /* WAS: selects - sequence of rasqal_variable# */ raptor_sequence* unused10; /* ... rasqal_variable* names only */ /* sequences of ... */ raptor_sequence* data_graphs; /* ... rasqal_data_graph* */ /* NOTE: Cannot assume that triples are in any of * graph pattern use / query execution / document order */ raptor_sequence* triples; /* ... rasqal_triple* */ raptor_sequence* prefixes; /* ... rasqal_prefix* */ raptor_sequence* constructs; /* ... rasqal_triple* SPARQL */ raptor_sequence* optional_triples; /* ... rasqal_triple* SPARQL */ raptor_sequence* describes; /* ... rasqal_literal* (var or URIs) SPARQL */ /* WAS: distinct 0..2; now projection->distinct */ unsigned int unused9; /* WAS: result limit LIMIT (>=0) or <0 if not given */ int unused4; /* WAS: result offset OFFSET (>=0) or <0 if not given */ int unused5; /* WAS: wildcard flag; now projection->wildcard */ int unused12; /* flag: non-0 if query has been prepared */ int prepared; rasqal_variables_table* vars_table; /* WAS: The number of selected variables: these are always the first * in the variables table and are the ones returend to the user. */ int unused11; /* INTERNAL 2D array of: * width (number of total variables) * height (number of triples) * marking how a variable is mentioned/used in a TRIPLE PATTERN * Each triple pattern has a row and the short values are per-variable * with flags from #rasqal_triples_use_map_flags */ unsigned short* triples_use_map; /* can be filled with error location information */ raptor_locator locator; /* base URI of this query for resolving relative URIs in queries */ raptor_uri* base_uri; /* non 0 if query had fatal error in parsing and cannot be executed */ int failed; /* stuff for our user */ void* user_data; /* former state for generating blank node IDs; now in world object */ int unused1; char *unused2; size_t unused3; /* query engine specific stuff */ void* context; struct rasqal_query_language_factory_s* factory; rasqal_triples_source_factory* triples_source_factory; /* sequence of query results made from this query */ raptor_sequence* results; /* incrementing counter for declaring prefixes in order of appearance */ int prefix_depth; /* WAS: sequence of order condition expressions */ void* unused6; /* WAS: sequence of group by condition expressions */ void* unused7; /* INTERNAL rasqal_literal_compare / rasqal_expression_evaluate flags */ int compare_flags; /* Number of graph patterns in this query */ int graph_pattern_count; /* Graph pattern shared pointers by gp index (after prepare) */ raptor_sequence* graph_patterns_sequence; /* Features */ int features[RASQAL_FEATURE_LAST+1]; /* Name of requested query results syntax. If present, this * is the name used for constructing a rasqal_query_formatter * from the results. */ char* query_results_formatter_name; /* flag: non-0 if EXPLAIN was given */ int explain; /* INTERNAL lexer internal data */ void* lexer_user_data; /* INTERNAL flag for now: non-0 to store results otherwise lazy eval results */ int store_results; /* INTERNAL 2D array of: * width (number of total variables) * height (number of graph patterns) * marking how a variable is mentioned/used in a GP * Each graph pattern has a row and the short values are per-variable * with flags: * 1 RASQAL_USE_IN_SCOPE * 2 RASQAL_USE_MENTIONED_HERE * 4 RASQAL_USE_BOUND_HERE */ unsigned short* variables_use_map; /* sequence of #rasqal_update_operation when @verb is * INSERT (deprecated), DELETE (deprecated) or UPDATE */ raptor_sequence* updates; /* WAS: sequence of (group by ...) having condition expressions */ raptor_sequence* unused8; /* INTERNAL solution modifier */ rasqal_solution_modifier* modifier; /* INTERNAL SELECT bindings */ rasqal_bindings* bindings; /* INTERNAL static structure for expresion evaluation*/ rasqal_evaluation_context *eval_context; /* INTERNAL flag: non-0 if user set a random seed via RASQAL_FEATURE_RAND_SEED */ unsigned int user_set_rand : 1; /* Variable projection (or NULL when invalid such as for ASK) */ rasqal_projection* projection; }; /* * A query language factory for a query language. * * This structure is about turning a query syntax string into a * #rasqal_query structure. It does not deal with execution of the * query in any manner. */ struct rasqal_query_language_factory_s { rasqal_world* world; struct rasqal_query_language_factory_s* next; /* static description that the query language registration initialises */ raptor_syntax_description desc; /* the rest of this structure is populated by the query-language-specific register function */ size_t context_length; /* create a new query */ int (*init)(rasqal_query* rq, const char *name); /* destroy a query */ void (*terminate)(rasqal_query* rq); /* prepare a query */ int (*prepare)(rasqal_query* rq); /* finish the query language factory */ void (*finish_factory)(rasqal_query_language_factory* factory); /* Write a string to an iostream in escaped form suitable for the query */ int (*iostream_write_escaped_counted_string)(rasqal_query* rq, raptor_iostream* iostr, const unsigned char* string, size_t len); }; typedef struct rasqal_rowsource_s rasqal_rowsource; #define RASQAL_ROW_FLAG_WEAK_ROWSOURCE 0x01 /* * A row of values from a query result, usually generated by a rowsource */ struct rasqal_row_s { /* reference count */ int usage; /* Rowsource this row is associated with (or NULL if none) */ rasqal_rowsource* rowsource; /* current row number in the sequence of rows*/ int offset; /* values for each variable in the query sequence of values */ int size; rasqal_literal** values; /* literal values for ORDER BY expressions evaluated for this row */ /* number of expressions (can be 0) */ int order_size; rasqal_literal** order_values; /* Group ID */ int group_id; /* Bit mask of flags: bit 0 = WEAK ROWSOURCE */ unsigned int flags; }; typedef struct rasqal_map_s rasqal_map; /** * rasqal_join_type: * @RASQAL_JOIN_TYPE_UNKNOWN: unknown join type * @RASQAL_JOIN_TYPE_NATURAL: natural join. returns compatible rows and no NULLs * @RASQAL_JOIN_TYPE_LEFT: left join. returns compatible rows plus rows from left rowsource that are not compatible or fail filter condition * * Rowsource join type. */ typedef enum { RASQAL_JOIN_TYPE_UNKNOWN, RASQAL_JOIN_TYPE_NATURAL, RASQAL_JOIN_TYPE_LEFT } rasqal_join_type; /* rasqal_rowsource_aggregation.c */ rasqal_rowsource* rasqal_new_aggregation_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* rowsource, raptor_sequence* exprs_seq, raptor_sequence* vars_seq); /* rasqal_rowsource_empty.c */ rasqal_rowsource* rasqal_new_empty_rowsource(rasqal_world *world, rasqal_query* query); /* rasqal_rowsource_engine.c */ rasqal_rowsource* rasqal_new_execution_rowsource(rasqal_query_results* query_results); /* rasqal_rowsource_assignment.c */ rasqal_rowsource* rasqal_new_assignment_rowsource(rasqal_world *world, rasqal_query *query, rasqal_variable* var, rasqal_expression* expr); /* rasqal_rowsource_bindings.c */ rasqal_rowsource* rasqal_new_bindings_rowsource(rasqal_world *world, rasqal_query *query, rasqal_bindings* bindings); /* rasqal_rowsource_distinct.c */ rasqal_rowsource* rasqal_new_distinct_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rs); /* rasqal_rowsource_filter.c */ rasqal_rowsource* rasqal_new_filter_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rs, rasqal_expression* expr); /* rasqal_rowsource_graph.c */ rasqal_rowsource* rasqal_new_graph_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, rasqal_variable *var); /* rasqal_rowsource_groupby.c */ rasqal_rowsource* rasqal_new_groupby_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* rowsource, raptor_sequence* exprs_seq); /* rasqal_rowsource_having.c */ rasqal_rowsource* rasqal_new_having_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, raptor_sequence* exprs_seq); /* rasqal_rowsource_join.c */ rasqal_rowsource* rasqal_new_join_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* left, rasqal_rowsource* right, rasqal_join_type join_type, rasqal_expression *expr); /* rasqal_rowsource_project.c */ rasqal_rowsource* rasqal_new_project_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, raptor_sequence* projection_variables); /* rasqal_rowsource_rowsequence.c */ rasqal_rowsource* rasqal_new_rowsequence_rowsource(rasqal_world *world, rasqal_query* query, rasqal_variables_table* vt, raptor_sequence* rows_seq, raptor_sequence* vars_seq); /* rasqal_rowsource_slice.c */ rasqal_rowsource* rasqal_new_slice_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, int limit, int offset); /* rasqal_rowsource_service.c */ rasqal_rowsource* rasqal_new_service_rowsource(rasqal_world *world, rasqal_query* query, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs, unsigned int rs_flags); /* rasqal_rowsource_sort.c */ rasqal_rowsource* rasqal_new_sort_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource *rowsource, raptor_sequence* order_seq, int distinct); /* rasqal_rowsource_triples.c */ rasqal_rowsource* rasqal_new_triples_rowsource(rasqal_world *world, rasqal_query* query, rasqal_triples_source* triples_source, raptor_sequence* triples, int start_column, int end_column); /* rasqal_rowsource_union.c */ rasqal_rowsource* rasqal_new_union_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* left, rasqal_rowsource* right); /** * rasqal_rowsource_init_func: * @context: stream context data * * Handler function for #rasqal_rowsource initialising. * * Return value: non-0 on failure. */ typedef int (*rasqal_rowsource_init_func) (rasqal_rowsource* rowsource, void *user_data); /** * rasqal_rowsource_finish_func: * @user_data: user data * * Handler function for #rasqal_rowsource terminating. * * Return value: non-0 on failure */ typedef int (*rasqal_rowsource_finish_func) (rasqal_rowsource* rowsource, void *user_data); /** * rasqal_rowsource_ensure_variables_func * @rowsource: #rasqal_rowsource * @user_data: user data * * Handler function for ensuring rowsource variables fields are initialised * * Return value: non-0 on failure */ typedef int (*rasqal_rowsource_ensure_variables_func) (rasqal_rowsource* rowsource, void *user_data); /** * rasqal_rowsource_read_row_func * @user_data: user data * * Handler function for returning the next result row * * Return value: a query result row or NULL if exhausted */ typedef rasqal_row* (*rasqal_rowsource_read_row_func) (rasqal_rowsource* rowsource, void *user_data); /** * rasqal_rowsource_read_all_rows_func * @user_data: user data * * Handler function for returning all rows as a sequence * * Return value: a sequence of result rows (which may be size 0) or NULL if exhausted */ typedef raptor_sequence* (*rasqal_rowsource_read_all_rows_func) (rasqal_rowsource* rowsource, void *user_data); /** * rasqal_rowsource_reset_func * @user_data: user data * * Handler function for resetting a rowsource to generate the same set of rows * * Return value: non-0 on failure */ typedef int (*rasqal_rowsource_reset_func) (rasqal_rowsource* rowsource, void *user_data); /* bit flags */ #define RASQAL_ROWSOURCE_REQUIRE_RESET (1 << 0) /** * rasqal_rowsource_set_requirements_func * @user_data: user data * @flags: bit flags * * Handler function for one rowsource setting requirements on inner rowsources * * Return value: non-0 on failure */ typedef int (*rasqal_rowsource_set_requirements_func) (rasqal_rowsource* rowsource, void *user_data, unsigned int flags); /** * rasqal_rowsource_get_inner_rowsource_func * @user_data: user data * @offset: offset * * Handler function for getting an inner rowsource at an offset * * Return value: rowsource object or NULL if offset out of range */ typedef rasqal_rowsource* (*rasqal_rowsource_get_inner_rowsource_func) (rasqal_rowsource* rowsource, void *user_data, int offset); /** * rasqal_rowsource_set_origin_func * @user_data: user data * @origin: Graph URI literal * * Handler function for setting the rowsource origin (GRAPH) * * Return value: non-0 on failure */ typedef int (*rasqal_rowsource_set_origin_func) (rasqal_rowsource* rowsource, void *user_data, rasqal_literal *origin); /** * rasqal_rowsource_handler: * @version: API version - 1 * @name: rowsource name for debugging * @init: initialisation handler - optional, called at most once (V1) * @finish: finishing handler - optional, called at most once (V1) * @ensure_variables: update variables handler- optional, called at most once (V1) * @read_row: read row handler - this or @read_all_rows required (V1) * @read_all_rows: read all rows handler - this or @read_row required (V1) * @reset: reset rowsource to starting state handler - optional (V1) * @set_requirements: set requirements flag handler - optional (V1) * @get_inner_rowsource: get inner rowsource handler - optional if has no inner rowsources (V1) * @set_origin: set origin (GRAPH) handler - optional (V1) * * Row Source implementation factory handler structure. * */ typedef struct { int version; const char* name; /* API V1 methods */ rasqal_rowsource_init_func init; rasqal_rowsource_finish_func finish; rasqal_rowsource_ensure_variables_func ensure_variables; rasqal_rowsource_read_row_func read_row; rasqal_rowsource_read_all_rows_func read_all_rows; rasqal_rowsource_reset_func reset; rasqal_rowsource_set_requirements_func set_requirements; rasqal_rowsource_get_inner_rowsource_func get_inner_rowsource; rasqal_rowsource_set_origin_func set_origin; } rasqal_rowsource_handler; /** * rasqal_row_compatible: * @variables_table: variables table * @rowsource1: first rowsource * @rowsource2: second rowsource * @variables_count: number of variables in the map * @variables_in_both_rows_count: number of shared variables * @defined_in_map: of size @variables_count * * Lookup data constructed for two rowsources to enable quick * checking if rows from the two rowsource are compatible with * rasqal_row_compatible_check() * */ typedef struct { rasqal_variables_table* variables_table; rasqal_rowsource *first_rowsource; rasqal_rowsource *second_rowsource; int variables_count; int variables_in_both_rows_count; int* defined_in_map; } rasqal_row_compatible; typedef struct rasqal_results_compare_s rasqal_results_compare; /* * Rowsource Internal flags * * RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS: need to save all rows in * @rows_sequence for reset operation * * RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS: have saved rows ready for reply */ #define RASQAL_ROWSOURCE_FLAGS_SAVE_ROWS 0x01 #define RASQAL_ROWSOURCE_FLAGS_SAVED_ROWS 0x02 /** * rasqal_rowsource: * @world: rasqal world * @query: query that this may be associated with (or NULL) * @flags: flags - none currently defined. * @user_data: rowsource handler data * @handler: rowsource handler pointer * @finished: non-0 if rowsource has been exhausted * @count: number of rows returned * @updated_variables: non-0 if ensure_variables factory method has been called to get the variables_sequence updated * @vars_table: variables table where variables used in this row are declared/owned * @variables_sequence: variables declared in this row from @vars_table * @size: number of variables in @variables_sequence * @rows_sequence: stored sequence of rows for use by rasqal_rowsource_read_row() (or NULL) * @offset: size of @rows_sequence * @generate_group: non-0 to generate a group (ID 0) around all the returned rows, if there is no grouping returned. * @usage: reference count * * Rasqal Row Source class providing a sequence of rows of values similar to a SQL table. * * The table has @size columns which are #rasqal_variable names that * are declared in the associated variables table. * @variables_sequence contains the ordered projection of the * variables for the columns for this row sequence, from the full set * of variables in @vars_table. * * Each row has @size #rasqal_literal values for the variables or * NULL if unset. * * Row sources are constructed indirectly via an @handler passed * to the rasqal_new_rowsource_from_handler() constructor. * * The main methods are rasqal_rowsource_read_row() to read one row * and rasqal_rowsource_read_all_rows() to get all rows as a * sequence, draining the row source. * rasqal_rowsource_get_rows_count() returns the current number of * rows that have been read which is only useful in the read one row * case. * * The variables associated with a rowsource can be read by * rasqal_rowsource_get_variable_by_offset() and * rasqal_rowsource_get_variable_offset_by_name() which all are * offsets into @variables_sequence but refer to variables owned by * the full internal variables table @vars_table * * The @rows_sequence and @offset variables are used by the * rasqal_rowsource_read_row() function when operating over a handler * that will only return a full sequence: handler->read_all_rows is NULL. */ struct rasqal_rowsource_s { rasqal_world* world; rasqal_query* query; int flags; void *user_data; const rasqal_rowsource_handler* handler; unsigned int finished : 1; int count; int updated_variables; rasqal_variables_table* vars_table; raptor_sequence* variables_sequence; int size; raptor_sequence* rows_sequence; int offset; unsigned int generate_group : 1; int usage; }; /* rasqal_rowsource.c */ rasqal_rowsource* rasqal_new_rowsource_from_handler(rasqal_world *world, rasqal_query* query, void* user_data, const rasqal_rowsource_handler *handler, rasqal_variables_table* vars_table, int flags); rasqal_rowsource* rasqal_new_rowsource_from_rowsource(rasqal_rowsource* rowsource); void rasqal_free_rowsource(rasqal_rowsource *rowsource); rasqal_row* rasqal_rowsource_read_row(rasqal_rowsource *rowsource); int rasqal_rowsource_get_rows_count(rasqal_rowsource *rowsource); raptor_sequence* rasqal_rowsource_read_all_rows(rasqal_rowsource *rowsource); int rasqal_rowsource_get_size(rasqal_rowsource *rowsource); int rasqal_rowsource_add_variable(rasqal_rowsource *rowsource, rasqal_variable* v); rasqal_variable* rasqal_rowsource_get_variable_by_offset(rasqal_rowsource *rowsource, int offset); int rasqal_rowsource_get_variable_offset_by_name(rasqal_rowsource *rowsource, const unsigned char* name); int rasqal_rowsource_copy_variables(rasqal_rowsource *dest_rowsource, rasqal_rowsource *src_rowsource); void rasqal_rowsource_print_row_sequence(rasqal_rowsource* rowsource,raptor_sequence* seq, FILE* fh); int rasqal_rowsource_reset(rasqal_rowsource* rowsource); int rasqal_rowsource_set_requirements(rasqal_rowsource* rowsource, unsigned int requirement); rasqal_rowsource* rasqal_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, int offset); int rasqal_rowsource_write(rasqal_rowsource *rowsource, raptor_iostream *iostr); void rasqal_rowsource_print(rasqal_rowsource* rs, FILE* fh); int rasqal_rowsource_ensure_variables(rasqal_rowsource *rowsource); int rasqal_rowsource_set_origin(rasqal_rowsource* rowsource, rasqal_literal *literal); int rasqal_rowsource_request_grouping(rasqal_rowsource* rowsource); void rasqal_rowsource_remove_all_variables(rasqal_rowsource *rowsource); typedef struct rasqal_query_results_format_factory_s rasqal_query_results_format_factory; typedef int (*rasqal_query_results_init_func)(rasqal_query_results_formatter* formatter, const char* name); typedef void (*rasqal_query_results_finish_func)(rasqal_query_results_formatter* formatter); typedef int (*rasqal_query_results_write_func)(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri); typedef rasqal_rowsource* (*rasqal_query_results_get_rowsource_func)(rasqal_query_results_formatter* formatter, rasqal_world* world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags); typedef int (*rasqal_query_results_recognise_syntax_func)(struct rasqal_query_results_format_factory_s* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type); typedef int (*rasqal_query_results_get_boolean_func)(rasqal_query_results_formatter *formatter, rasqal_world* world, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags); typedef int (*rasqal_rowsource_visit_fn)(rasqal_rowsource* rowsource, void *user_data); int rasqal_rowsource_visit(rasqal_rowsource* rowsource, rasqal_rowsource_visit_fn fn, void *user_data); struct rasqal_query_results_format_factory_s { rasqal_world* world; struct rasqal_query_results_format_factory_s* next; /* static desc that the parser registration initialises */ raptor_syntax_description desc; /* Memory to allocate for per-formatter data */ int context_length; /* format initialisation (OPTIONAL) */ rasqal_query_results_init_func init; /* format initialisation (OPTIONAL) */ rasqal_query_results_finish_func finish; /* format writer: READ from results, WRITE syntax (using base URI) to iostr */ rasqal_query_results_write_func write; /* format get rowsource: get a rowsource that will return a sequence of rows from an iostream */ rasqal_query_results_get_rowsource_func get_rowsource; /* recognize a format (OPTIONAL) */ rasqal_query_results_recognise_syntax_func recognise_syntax; /* get a boolean result (OPTIONAL) */ rasqal_query_results_get_boolean_func get_boolean; }; /* * A query results formatter for some query_results */ struct rasqal_query_results_formatter_s { rasqal_query_results_format_factory* factory; /* Per-formatter data */ void* context; }; /* rasqal_results_formats.c */ rasqal_rowsource* rasqal_query_results_formatter_get_read_rowsource(rasqal_world *world, raptor_iostream *iostr, rasqal_query_results_formatter* formatter, rasqal_variables_table* vars_table, raptor_uri *base_uri, unsigned int flags); typedef struct { rasqal_world *world; raptor_sequence *triples; rasqal_literal *value; } rasqal_formula; /* rasqal_datetime.c */ int rasqal_xsd_datetime_check(const char* string); int rasqal_xsd_date_check(const char* string); /* rasqal_dataset.c */ typedef struct rasqal_dataset_s rasqal_dataset; typedef struct rasqal_dataset_term_iterator_s rasqal_dataset_term_iterator; typedef struct rasqal_dataset_triples_iterator_s rasqal_dataset_triples_iterator; rasqal_dataset* rasqal_new_dataset(rasqal_world* world); void rasqal_free_dataset(rasqal_dataset* ds); int rasqal_dataset_load_graph_iostream(rasqal_dataset* ds, const char* name, raptor_iostream* iostr, raptor_uri* base_uri); int rasqal_dataset_load_graph_uri(rasqal_dataset* ds, const char* name, raptor_uri* uri, raptor_uri* base_uri); void rasqal_free_dataset_term_iterator(rasqal_dataset_term_iterator* iter); rasqal_literal* rasqal_dataset_term_iterator_get(rasqal_dataset_term_iterator* iter); int rasqal_dataset_term_iterator_next(rasqal_dataset_term_iterator* iter); rasqal_dataset_term_iterator* rasqal_dataset_get_sources_iterator(rasqal_dataset* ds, rasqal_literal* predicate, rasqal_literal* object); rasqal_dataset_term_iterator* rasqal_dataset_get_targets_iterator(rasqal_dataset* ds, rasqal_literal* subject, rasqal_literal* predicate); rasqal_literal* rasqal_dataset_get_source(rasqal_dataset* ds, rasqal_literal* predicate, rasqal_literal* object); rasqal_literal* rasqal_dataset_get_target(rasqal_dataset* ds, rasqal_literal* subject, rasqal_literal* predicate); rasqal_dataset_triples_iterator* rasqal_dataset_get_triples_iterator(rasqal_dataset* ds); void rasqal_free_dataset_triples_iterator(rasqal_dataset_triples_iterator* ti); rasqal_triple* rasqal_dataset_triples_iterator_get(rasqal_dataset_triples_iterator* ti); int rasqal_dataset_triples_iterator_next(rasqal_dataset_triples_iterator* ti); int rasqal_dataset_print(rasqal_dataset* ds, FILE *fh); /* rasqal_general.c */ char* rasqal_vsnprintf(const char* message, va_list arguments); unsigned char* rasqal_world_generate_bnodeid(rasqal_world* world, unsigned char *user_bnodeid); int rasqal_world_reset_now(rasqal_world* world); struct timeval* rasqal_world_get_now_timeval(rasqal_world* world); typedef enum { /* Warnings in 0..100 range. Warn if LEVEL < world->warning_level */ RASQAL_WARNING_LEVEL_MAYBE_ERROR = 10, RASQAL_WARNING_LEVEL_STYLE = 30, RASQAL_WARNING_LEVEL_STRICT_STYLE = 90, /* Default warning level */ RASQAL_WARNING_LEVEL_DEFAULT = 50, RASQAL_WARNING_LEVEL_MAX = 100, /* Warnings level in code base */ RASQAL_WARNING_LEVEL_DUPLICATE_VARIABLE = RASQAL_WARNING_LEVEL_STYLE, RASQAL_WARNING_LEVEL_VARIABLE_UNUSED = RASQAL_WARNING_LEVEL_STYLE, RASQAL_WARNING_LEVEL_MULTIPLE_BG_GRAPHS = RASQAL_WARNING_LEVEL_STYLE, RASQAL_WARNING_LEVEL_QUERY_SYNTAX = RASQAL_WARNING_LEVEL_STYLE, RASQAL_WARNING_LEVEL_NOT_IMPLEMENTED = RASQAL_WARNING_LEVEL_MAYBE_ERROR, RASQAL_WARNING_LEVEL_MISSING_SUPPORT = RASQAL_WARNING_LEVEL_MAYBE_ERROR, RASQAL_WARNING_LEVEL_BAD_TRIPLE = RASQAL_WARNING_LEVEL_MAYBE_ERROR, RASQAL_WARNING_LEVEL_SELECTED_NEVER_BOUND = RASQAL_WARNING_LEVEL_MAYBE_ERROR, RASQAL_WARNING_LEVEL_UNUSED_SELECTED_VARIABLE = RASQAL_WARNING_LEVEL_STRICT_STYLE } rasqal_warning_level; rasqal_query_language_factory* rasqal_query_language_register_factory(rasqal_world *world, int (*factory) (rasqal_query_language_factory*)); rasqal_query_language_factory* rasqal_get_query_language_factory (rasqal_world*, const char* name, const unsigned char* uri); void rasqal_log_error_simple(rasqal_world* world, raptor_log_level level, raptor_locator* locator, const char* message, ...) RASQAL_PRINTF_FORMAT(4, 5); void rasqal_log_error_varargs(rasqal_world* world, raptor_log_level level, raptor_locator* locator, const char* message, va_list arguments) RASQAL_PRINTF_FORMAT(4, 0); void rasqal_query_simple_error(void* user_data /* query */, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3); void rasqal_world_simple_error(void* user_data /* world */, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3); void rasqal_log_warning_simple(rasqal_world* world, rasqal_warning_level warn_level, raptor_locator* locator, const char* message, ...) RASQAL_PRINTF_FORMAT(4, 5); const char* rasqal_basename(const char* name); unsigned char* rasqal_world_default_generate_bnodeid_handler(void *user_data, unsigned char *user_bnodeid); extern const raptor_unichar rasqal_unicode_max_codepoint; unsigned char* rasqal_escaped_name_to_utf8_string(const unsigned char* src, size_t len, size_t* dest_lenp, int (*error_handler)(rasqal_query *error_data, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3), rasqal_query* error_data); /* rasqal_graph_pattern.c */ unsigned char* rasqal_query_generate_bnodeid(rasqal_query* rdf_query, unsigned char *user_bnodeid); rasqal_graph_pattern* rasqal_new_basic_graph_pattern_from_formula(rasqal_query* query, rasqal_formula* formula); rasqal_graph_pattern* rasqal_new_basic_graph_pattern_from_triples(rasqal_query* query, raptor_sequence* triples); rasqal_graph_pattern* rasqal_new_2_group_graph_pattern(rasqal_query* query, rasqal_graph_pattern* first_gp, rasqal_graph_pattern* second_gp); rasqal_graph_pattern* rasqal_graph_pattern_get_parent(rasqal_query *query, rasqal_graph_pattern* gp, rasqal_graph_pattern* tree_gp); /* sparql_parser.y */ typedef struct { raptor_uri* uri; rasqal_update_graph_applies applies; } sparql_uri_applies; typedef struct { rasqal_op op; rasqal_expression *expr; } sparql_op_expr; int rasqal_init_query_language_sparql(rasqal_world*); int rasqal_init_query_language_sparql11(rasqal_world*); int rasqal_init_query_language_laqrs(rasqal_world*); /* rasqal_query_transform.c */ int rasqal_query_expand_triple_qnames(rasqal_query* rq); int rasqal_sequence_has_qname(raptor_sequence* seq); int rasqal_query_constraints_has_qname(rasqal_query* gp); int rasqal_query_expand_graph_pattern_constraints_qnames(rasqal_query* rq, rasqal_graph_pattern* gp); int rasqal_query_expand_query_constraints_qnames(rasqal_query* rq); int rasqal_query_build_anonymous_variables(rasqal_query* rq); int rasqal_query_expand_wildcards(rasqal_query* rq, rasqal_projection* projection); int rasqal_query_remove_duplicate_select_vars(rasqal_query* rq, rasqal_projection* projection); int rasqal_query_build_variables_use(rasqal_query* query, rasqal_projection* projection); int rasqal_query_prepare_common(rasqal_query *query); int rasqal_query_merge_graph_patterns(rasqal_query* query, rasqal_graph_pattern* gp, void* data); int rasqal_graph_patterns_join(rasqal_graph_pattern *dest_gp, rasqal_graph_pattern *src_gp); int rasqal_graph_pattern_move_constraints(rasqal_graph_pattern* dest_gp, rasqal_graph_pattern* src_gp); int rasqal_graph_pattern_variable_bound_below(rasqal_graph_pattern *gp, rasqal_variable *v); /* rasqal_double.c */ int rasqal_double_approximately_compare(double a, double b); int rasqal_double_approximately_equal(double a, double b); /* rasqal_expr.c */ rasqal_literal* rasqal_new_string_literal_node(rasqal_world*, const unsigned char *string, const char *language, raptor_uri *datatype); int rasqal_literal_as_boolean(rasqal_literal* literal, int* error_p); int rasqal_literal_as_integer(rasqal_literal* l, int* error_p); double rasqal_literal_as_double(rasqal_literal* l, int* error_p); raptor_uri* rasqal_literal_as_uri(rasqal_literal* l); int rasqal_literal_string_to_native(rasqal_literal *l, int flags); int rasqal_literal_has_qname(rasqal_literal* l); int rasqal_literal_expand_qname(void* user_data, rasqal_literal* l); int rasqal_literal_is_constant(rasqal_literal* l); int rasqal_expression_has_qname(void* user_data, rasqal_expression* e); int rasqal_expression_expand_qname(void* user_data, rasqal_expression* e); int rasqal_literal_ebv(rasqal_literal* l); int rasqal_expression_is_constant(rasqal_expression* e); void rasqal_expression_clear(rasqal_expression* e); void rasqal_expression_convert_to_literal(rasqal_expression* e, rasqal_literal* l); int rasqal_expression_mentions_variable(rasqal_expression* e, rasqal_variable* v); void rasqal_triple_write(rasqal_triple* t, raptor_iostream* iostr); void rasqal_variable_write(rasqal_variable* v, raptor_iostream* iostr); int rasqal_expression_is_aggregate(rasqal_expression* e); int rasqal_expression_convert_aggregate_to_variable(rasqal_expression* e_in, rasqal_variable* v, rasqal_expression** e_out); int rasqal_expression_mentions_aggregate(rasqal_expression* e); raptor_sequence* rasqal_expression_copy_expression_sequence(raptor_sequence* exprs_seq); int rasqal_literal_sequence_compare(int compare_flags, raptor_sequence* values_a, raptor_sequence* values_b); raptor_sequence* rasqal_expression_sequence_evaluate(rasqal_query* query, raptor_sequence* exprs_seq, int ignore_errors, int* error_p); int rasqal_literal_sequence_equals(raptor_sequence* values_a, raptor_sequence* values_b); /* rasqal_expr_evaluate.c */ int rasqal_language_matches(const unsigned char* lang_tag, const unsigned char* lang_range); /* rasqal_expr_datetimes.c */ rasqal_literal* rasqal_expression_evaluate_now(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_to_unixtime(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_from_unixtime(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_datetime_part(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_datetime_timezone(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_datetime_tz(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); /* rasqal_expr_numerics.c */ rasqal_literal* rasqal_expression_evaluate_abs(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_round(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_ceil(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_floor(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_rand(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_digest(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_uriuuid(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_struuid(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); /* rasqal_expr_strings.c */ rasqal_literal* rasqal_expression_evaluate_substr(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_set_case(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_str_prefix_suffix(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_strlen(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_encode_for_uri(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_concat(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_langmatches(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_strmatch(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_strbefore(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_strafter(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); rasqal_literal* rasqal_expression_evaluate_replace(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p); /* strcasecmp.c */ #ifdef HAVE_STRCASECMP # define rasqal_strcasecmp strcasecmp # define rasqal_strncasecmp strncasecmp #else # ifdef HAVE_STRICMP # define rasqal_strcasecmp stricmp # define rasqal_strncasecmp strnicmp # else int rasqal_strcasecmp(const char* s1, const char* s2); int rasqal_strncasecmp(const char* s1, const char* s2, size_t n); # endif #endif /* timegm.c */ #ifdef HAVE_TIMEGM #define rasqal_timegm timegm #else time_t rasqal_timegm(struct tm *tm); #endif /* rasqal_raptor.c */ int rasqal_raptor_init(rasqal_world*); #ifdef RAPTOR_TRIPLES_SOURCE_REDLAND /* rasqal_redland.c */ int rasqal_redland_init(rasqal_world*); void rasqal_redland_finish(void); #endif rasqal_triple* raptor_statement_as_rasqal_triple(rasqal_world* world, const raptor_statement *statement); int rasqal_raptor_triple_match(rasqal_world* world, rasqal_triple *triple, rasqal_triple *match, unsigned int parts); /* rasqal_general.c */ int rasqal_uri_init(rasqal_world*); void rasqal_uri_finish(rasqal_world*); /* rasqal_literal.c */ rasqal_formula* rasqal_new_formula(rasqal_world* world); void rasqal_free_formula(rasqal_formula* formula); int rasqal_formula_print(rasqal_formula* formula, FILE *stream); rasqal_formula* rasqal_formula_join(rasqal_formula* first_formula, rasqal_formula* second_formula); /* The following should be public eventually in rasqal.h or raptor.h or ...? */ typedef int (rasqal_compare_fn)(void* user_data, const void *a, const void *b); typedef void (rasqal_kv_free_fn)(const void *key, const void *value); #define RASQAL_XSD_BOOLEAN_TRUE_LEN 4 extern const unsigned char* rasqal_xsd_boolean_true; #define RASQAL_XSD_BOOLEAN_FALSE_LEN 5 extern const unsigned char* rasqal_xsd_boolean_false; rasqal_literal* rasqal_literal_cast(rasqal_literal* l, raptor_uri* datatype, int flags, int* error_p); rasqal_literal* rasqal_new_numeric_literal(rasqal_world*, rasqal_literal_type type, double d); int rasqal_literal_is_numeric(rasqal_literal* literal); rasqal_literal* rasqal_literal_add(rasqal_literal* l1, rasqal_literal* l2, int *error); rasqal_literal* rasqal_literal_subtract(rasqal_literal* l1, rasqal_literal* l2, int *error); rasqal_literal* rasqal_literal_multiply(rasqal_literal* l1, rasqal_literal* l2, int *error); rasqal_literal* rasqal_literal_divide(rasqal_literal* l1, rasqal_literal* l2, int *error); rasqal_literal* rasqal_literal_negate(rasqal_literal* l, int *error_p); rasqal_literal* rasqal_literal_abs(rasqal_literal* l1, int *error_p); rasqal_literal* rasqal_literal_round(rasqal_literal* l1, int *error_p); rasqal_literal* rasqal_literal_ceil(rasqal_literal* l1, int *error_p); rasqal_literal* rasqal_literal_floor(rasqal_literal* l1, int *error_p); int rasqal_literal_equals_flags(rasqal_literal* l1, rasqal_literal* l2, int flags, int* error); int rasqal_literal_not_equals_flags(rasqal_literal* l1, rasqal_literal* l2, int flags, int* error); void rasqal_literal_write_type(rasqal_literal* l, raptor_iostream* iostr); void rasqal_literal_write(rasqal_literal* l, raptor_iostream* iostr); void rasqal_expression_write_op(rasqal_expression* e, raptor_iostream* iostr); void rasqal_expression_write(rasqal_expression* e, raptor_iostream* iostr); int rasqal_literal_write_turtle(rasqal_literal* l, raptor_iostream* iostr); int rasqal_literal_array_equals(rasqal_literal** values_a, rasqal_literal** values_b, int size); int rasqal_literal_array_compare(rasqal_literal** values_a, rasqal_literal** values_b, raptor_sequence* exprs_seq, int size, int compare_flags); int rasqal_literal_array_compare_by_order(rasqal_literal** values_a, rasqal_literal** values_b, int* order, int size, int compare_flags); rasqal_map* rasqal_new_literal_sequence_sort_map(int is_distinct, int compare_flags); int rasqal_literal_sequence_sort_map_add_literal_sequence(rasqal_map* map, raptor_sequence* literals_sequence); raptor_sequence* rasqal_new_literal_sequence_of_sequence_from_data(rasqal_world* world, const char* const row_data[], int width); rasqal_literal* rasqal_new_literal_from_term(rasqal_world* world, raptor_term* term); int rasqal_literal_string_datatypes_compare(rasqal_literal* l1, rasqal_literal* l2); int rasqal_literal_string_languages_compare(rasqal_literal* l1, rasqal_literal* l2); int rasqal_literal_is_string(rasqal_literal* l1); /* rasqal_map.c */ typedef void (*rasqal_map_visit_fn)(void *key, void *value, void *user_data); rasqal_map* rasqal_new_map(rasqal_compare_fn* compare_fn, void* compare_user_data, raptor_data_free_handler free_compare_user_data, raptor_data_free_handler free_key_fn, raptor_data_free_handler free_value_fn, raptor_data_print_handler print_key_fn, raptor_data_print_handler print_value_fn, int flags); void rasqal_free_map(rasqal_map *map); int rasqal_map_add_kv(rasqal_map* map, void* key, void *value); void rasqal_map_visit(rasqal_map* map, rasqal_map_visit_fn fn, void *user_data); int rasqal_map_print(rasqal_map* map, FILE* fh); void* rasqal_map_search(rasqal_map* map, const void* key); /* rasqal_query.c */ rasqal_query_results* rasqal_query_execute_with_engine(rasqal_query* query, const rasqal_query_execution_factory* engine); int rasqal_query_remove_query_result(rasqal_query* query, rasqal_query_results* query_results); int rasqal_query_declare_prefix(rasqal_query* rq, rasqal_prefix* prefix); int rasqal_query_declare_prefixes(rasqal_query* rq); void rasqal_query_set_base_uri(rasqal_query* rq, raptor_uri* base_uri); rasqal_variable* rasqal_query_get_variable_by_offset(rasqal_query* query, int idx); const rasqal_query_execution_factory* rasqal_query_get_engine_by_name(const char* name); int rasqal_query_variable_is_bound(rasqal_query* query, rasqal_variable* v); rasqal_triple_parts rasqal_query_variable_bound_in_triple(rasqal_query* query, rasqal_variable* v, int column); int rasqal_query_store_select_query(rasqal_query* query, rasqal_projection* projection, raptor_sequence* data_graphs, rasqal_graph_pattern* where_gp, rasqal_solution_modifier* modifier); int rasqal_query_reset_select_query(rasqal_query* query); rasqal_projection* rasqal_query_get_projection(rasqal_query* query); int rasqal_query_set_projection(rasqal_query* query, rasqal_projection* projection); int rasqal_query_set_modifier(rasqal_query* query, rasqal_solution_modifier* modifier); /* rasqal_query_results.c */ int rasqal_init_query_results(void); void rasqal_finish_query_results(void); int rasqal_query_results_execute_with_engine(rasqal_query_results* query_results, const rasqal_query_execution_factory* factory, int store_results); int rasqal_query_check_limit_offset_core(int result_offset, int limit, int offset); int rasqal_query_check_limit_offset(rasqal_query* query, int result_offset); void rasqal_query_results_remove_query_reference(rasqal_query_results* query_results); rasqal_variables_table* rasqal_query_results_get_variables_table(rasqal_query_results* query_results); rasqal_row* rasqal_query_results_get_current_row(rasqal_query_results* query_results); rasqal_world* rasqal_query_results_get_world(rasqal_query_results* query_results); #if RAPTOR_VERSION < 20015 typedef int (*raptor_data_compare_arg_handler)(const void *data1, const void *data2, void *user_data); #endif int rasqal_query_results_sort(rasqal_query_results* query_result); int rasqal_query_results_set_boolean(rasqal_query_results* query_results, int value); /* rasqal_query_write.c */ int rasqal_query_write_sparql_20060406_graph_pattern(rasqal_graph_pattern* gp, raptor_iostream *iostr,raptor_uri* base_uri); int rasqal_query_write_sparql_20060406(raptor_iostream *iostr, rasqal_query* query, raptor_uri *base_uri); /* rasqal_result_formats.c */ rasqal_query_results_format_factory* rasqal_world_register_query_results_format_factory(rasqal_world* world, int (*register_factory) (rasqal_query_results_format_factory*)); void rasqal_free_query_results_format_factory(rasqal_query_results_format_factory* factory); int rasqal_init_result_formats(rasqal_world*); void rasqal_finish_result_formats(rasqal_world*); /* rasqal_format_sv.c */ int rasqal_init_result_format_sv(rasqal_world* world); /* rasqal_format_json.c */ int rasqal_init_result_format_json(rasqal_world*); /* rasqal_format_sparql_xml.c */ int rasqal_init_result_format_sparql_xml(rasqal_world*); /* rasqal_format_table.c */ int rasqal_init_result_format_table(rasqal_world*); /* rasqal_format_html.c */ int rasqal_init_result_format_html(rasqal_world*); /* rasqal_format_turtle.c */ int rasqal_init_result_format_turtle(rasqal_world*); /* rasqal_format_rdf.c */ int rasqal_init_result_format_rdf(rasqal_world*); /* rasqal_row.c */ rasqal_row* rasqal_new_row(rasqal_rowsource* rowsource); rasqal_row* rasqal_new_row_from_row(rasqal_row* row); int rasqal_row_print(rasqal_row* row, FILE* fh); int rasqal_row_write(rasqal_row* row, raptor_iostream* iostr); raptor_sequence* rasqal_new_row_sequence(rasqal_world* world, rasqal_variables_table* vt, const char* const row_data[], int vars_count, raptor_sequence** vars_seq_p); int rasqal_row_to_nodes(rasqal_row* row); void rasqal_row_set_values_from_variables_table(rasqal_row* row, rasqal_variables_table* vars_table); int rasqal_row_set_order_size(rasqal_row *row, int order_size); int rasqal_row_expand_size(rasqal_row *row, int size); int rasqal_row_bind_variables(rasqal_row* row, rasqal_variables_table* vars_table); raptor_sequence* rasqal_row_sequence_copy(raptor_sequence *seq); void rasqal_row_set_rowsource(rasqal_row* row, rasqal_rowsource* rowsource); void rasqal_row_set_weak_rowsource(rasqal_row* row, rasqal_rowsource* rowsource); rasqal_variable* rasqal_row_get_variable_by_offset(rasqal_row* row, int offset); /* rasqal_row_compatible.c */ rasqal_row_compatible* rasqal_new_row_compatible(rasqal_variables_table* vt, rasqal_rowsource *first_rowsource, rasqal_rowsource *second_rowsource); void rasqal_free_row_compatible(rasqal_row_compatible* map); int rasqal_row_compatible_check(rasqal_row_compatible* map, rasqal_row *first_row, rasqal_row *second_row); void rasqal_print_row_compatible(FILE *handle, rasqal_row_compatible* map); /* rasqal_triples_source.c */ rasqal_triples_source* rasqal_new_triples_source(rasqal_query* query); int rasqal_reset_triple_meta(rasqal_triple_meta* m); void rasqal_free_triples_source(rasqal_triples_source *rts); int rasqal_triples_source_triple_present(rasqal_triples_source *rts, rasqal_triple *t); int rasqal_triples_source_support_feature(rasqal_triples_source *rts, rasqal_triples_source_feature feature); rasqal_triples_match* rasqal_new_triples_match(rasqal_query* query, rasqal_triples_source* triples_source, rasqal_triple_meta *m, rasqal_triple *t); rasqal_triple_parts rasqal_triples_match_bind_match(struct rasqal_triples_match_s* rtm, rasqal_variable *bindings[4],rasqal_triple_parts parts); void rasqal_triples_match_next_match(struct rasqal_triples_match_s* rtm); int rasqal_triples_match_is_end(struct rasqal_triples_match_s* rtm); /* rasqal_xsd_datatypes.c */ int rasqal_xsd_init(rasqal_world*); void rasqal_xsd_finish(rasqal_world*); rasqal_literal_type rasqal_xsd_datatype_uri_to_type(rasqal_world*, raptor_uri* uri); raptor_uri* rasqal_xsd_datatype_type_to_uri(rasqal_world*, rasqal_literal_type type); int rasqal_xsd_datatype_check(rasqal_literal_type native_type, const unsigned char* string, int flags); const char* rasqal_xsd_datatype_label(rasqal_literal_type native_type); int rasqal_xsd_is_datatype_uri(rasqal_world*, raptor_uri* uri); int rasqal_xsd_datatype_is_numeric(rasqal_literal_type type); unsigned char* rasqal_xsd_format_integer(int i, size_t *len_p); unsigned char* rasqal_xsd_format_float(float f, size_t *len_p); unsigned char* rasqal_xsd_format_double(double d, size_t *len_p); rasqal_literal_type rasqal_xsd_datatype_parent_type(rasqal_literal_type type); int rasqal_xsd_boolean_value_from_string(const unsigned char* string); typedef struct rasqal_graph_factory_s rasqal_graph_factory; /* rasqal_world structure */ struct rasqal_world_s { /* opened flag */ int opened; /* raptor_world object */ raptor_world *raptor_world_ptr; /* should rasqal free the raptor_world */ int raptor_world_allocated_here; /* log handler */ raptor_log_handler log_handler; void *log_handler_user_data; /* sequence of query language factories */ raptor_sequence *query_languages; /* registered query results formats */ raptor_sequence *query_results_formats; /* rasqal_uri rdf uris */ raptor_uri *rdf_namespace_uri; raptor_uri *rdf_first_uri; raptor_uri *rdf_rest_uri; raptor_uri *rdf_nil_uri; /* triples source factory */ rasqal_triples_source_factory triples_source_factory; /* rasqal_xsd_datatypes */ raptor_uri *xsd_namespace_uri; raptor_uri **xsd_datatype_uris; /* graph factory */ rasqal_graph_factory *graph_factory; void *graph_factory_user_data; int default_generate_bnodeid_handler_base; char *default_generate_bnodeid_handler_prefix; size_t default_generate_bnodeid_handler_prefix_length; void *generate_bnodeid_handler_user_data; rasqal_generate_bnodeid_handler generate_bnodeid_handler; /* used for NOW() value */ struct timeval now; /* set when now is a cached value */ unsigned int now_set : 1; rasqal_warning_level warning_level; /* generated counter - increments at every generation */ int genid_counter; }; /* * Rasqal Algebra * * Based on http://www.w3.org/TR/rdf-sparql-query/#sparqlAlgebra */ typedef enum { RASQAL_ALGEBRA_OPERATOR_UNKNOWN = 0, RASQAL_ALGEBRA_OPERATOR_BGP = 1, RASQAL_ALGEBRA_OPERATOR_FILTER = 2, RASQAL_ALGEBRA_OPERATOR_JOIN = 3, RASQAL_ALGEBRA_OPERATOR_DIFF = 4, RASQAL_ALGEBRA_OPERATOR_LEFTJOIN = 5, RASQAL_ALGEBRA_OPERATOR_UNION = 6, RASQAL_ALGEBRA_OPERATOR_TOLIST = 7, RASQAL_ALGEBRA_OPERATOR_ORDERBY = 8, RASQAL_ALGEBRA_OPERATOR_PROJECT = 9, RASQAL_ALGEBRA_OPERATOR_DISTINCT = 10, RASQAL_ALGEBRA_OPERATOR_REDUCED = 11, RASQAL_ALGEBRA_OPERATOR_SLICE = 12, RASQAL_ALGEBRA_OPERATOR_GRAPH = 13, RASQAL_ALGEBRA_OPERATOR_ASSIGN = 14, RASQAL_ALGEBRA_OPERATOR_GROUP = 15, RASQAL_ALGEBRA_OPERATOR_AGGREGATION = 16, RASQAL_ALGEBRA_OPERATOR_HAVING = 17, RASQAL_ALGEBRA_OPERATOR_VALUES = 18, RASQAL_ALGEBRA_OPERATOR_SERVICE = 19, RASQAL_ALGEBRA_OPERATOR_LAST = RASQAL_ALGEBRA_OPERATOR_SERVICE } rasqal_algebra_node_operator; /* bitflags used by rasqal_algebra_node and rasqal_rowsource */ typedef enum { /* used by */ RASQAL_ENGINE_BITFLAG_SILENT = 1 } rasqal_engine_bitflags; /* * Algebra Node * * Rasqal graph pattern class. */ struct rasqal_algebra_node_s { rasqal_query* query; /* operator for this algebra_node's contents */ rasqal_algebra_node_operator op; /* type BGP (otherwise NULL and start_column and end_column are -1) */ raptor_sequence* triples; int start_column; int end_column; /* types JOIN, DIFF, LEFTJOIN, UNION, ORDERBY: node1 and node2 ALWAYS present * types FILTER, TOLIST: node1 ALWAYS present, node2 ALWAYS NULL * type PROJECT, GRAPH, GROUPBY, AGGREGATION, HAVING: node1 always present * (otherwise NULL) */ struct rasqal_algebra_node_s *node1; struct rasqal_algebra_node_s *node2; /* types FILTER, LEFTJOIN * (otherwise NULL) */ rasqal_expression* expr; /* types ORDERBY, GROUPBY, AGGREGATION, HAVING always present: sequence of * #rasqal_expression * (otherwise NULL) */ raptor_sequence* seq; /* types PROJECT, DISTINCT, REDUCED * FIXME: sequence of solution mappings */ /* types PROJECT, AGGREGATION: sequence of #rasqal_variable */ raptor_sequence* vars_seq; /* type SLICE: limit and offset rows */ int limit; int offset; /* type GRAPH */ rasqal_literal *graph; /* type LET */ rasqal_variable *var; /* type ORDERBY */ int distinct; /* type VALUES */ rasqal_bindings *bindings; /* type SERVICE */ raptor_uri* service_uri; const unsigned char* query_string; raptor_sequence* data_graphs; /* flags */ unsigned int flags; }; typedef struct rasqal_algebra_node_s rasqal_algebra_node; /** * rasqal_algebra_node_visit_fn: * @query: #rasqal_query containing the graph pattern * @gp: current algebra_node * @user_data: user data passed in * * User function to visit an algebra_node and operate on it with * rasqal_algebra_node_visit() or rasqal_query_algebra_node_visit() * * Return value: 0 to truncate the visit */ typedef int (*rasqal_algebra_node_visit_fn)(rasqal_query* query, rasqal_algebra_node* node, void *user_data); typedef struct { rasqal_query* query; /* aggregate expression variables map * key: rasqal_expression* tree with an aggregate function at top * value: rasqal_variable* */ rasqal_map* agg_vars; /* sequence of aggregate #rasqal_expression in same order as @agg_vars_seq */ raptor_sequence* agg_exprs; /* sequence of aggregate #rasqal_expression in same order as @agg_exprs */ raptor_sequence* agg_vars_seq; /* number of aggregate expressions seen * ( = number of internal variables created ) */ int counter; /* compare flags */ int flags; /* error indicator */ int error; /* if set, finding a new expression is an error */ unsigned int adding_new_vars_is_error : 1; /* query part for error messages */ const char* error_part; } rasqal_algebra_aggregate; /* rasqal_algebra.c */ rasqal_algebra_node* rasqal_new_assignment_algebra_node(rasqal_query* query, rasqal_variable *var, rasqal_expression *expr); rasqal_algebra_node* rasqal_new_distinct_algebra_node(rasqal_query* query, rasqal_algebra_node* node1); rasqal_algebra_node* rasqal_new_filter_algebra_node(rasqal_query* query, rasqal_expression* expr, rasqal_algebra_node* node); rasqal_algebra_node* rasqal_new_empty_algebra_node(rasqal_query* query); rasqal_algebra_node* rasqal_new_triples_algebra_node(rasqal_query* query, raptor_sequence* triples, int start_column, int end_column); rasqal_algebra_node* rasqal_new_2op_algebra_node(rasqal_query* query, rasqal_algebra_node_operator op, rasqal_algebra_node* node1, rasqal_algebra_node* node2); rasqal_algebra_node* rasqal_new_leftjoin_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, rasqal_algebra_node* node2, rasqal_expression* expr); rasqal_algebra_node* rasqal_new_join_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, rasqal_algebra_node* node2, rasqal_expression* expr); rasqal_algebra_node* rasqal_new_orderby_algebra_node(rasqal_query* query, rasqal_algebra_node* node, raptor_sequence* seq, int distinct); rasqal_algebra_node* rasqal_new_slice_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, int limit, int offset); rasqal_algebra_node* rasqal_new_project_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* vars_seq); rasqal_algebra_node* rasqal_new_graph_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, rasqal_literal *graph); rasqal_algebra_node* rasqal_new_let_algebra_node(rasqal_query* query, rasqal_variable *var, rasqal_expression *expr); rasqal_algebra_node* rasqal_new_groupby_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* seq); rasqal_algebra_node* rasqal_new_aggregation_algebra_node(rasqal_query* query, rasqal_algebra_node* node1, raptor_sequence* exprs_seq, raptor_sequence* vars_seq); rasqal_algebra_node* rasqal_new_having_algebra_node(rasqal_query* query,rasqal_algebra_node* node1, raptor_sequence* exprs_seq); rasqal_algebra_node* rasqal_new_values_algebra_node(rasqal_query* query, rasqal_bindings* bindings); rasqal_algebra_node* rasqal_new_service_algebra_node(rasqal_query* query, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs, int silent); void rasqal_free_algebra_node(rasqal_algebra_node* node); rasqal_algebra_node_operator rasqal_algebra_node_get_operator(rasqal_algebra_node* node); const char* rasqal_algebra_node_operator_as_counted_string(rasqal_algebra_node_operator op, size_t* length_p); int rasqal_algebra_algebra_node_write(rasqal_algebra_node *node, raptor_iostream* iostr); int rasqal_algebra_node_print(rasqal_algebra_node* node, FILE* fh); int rasqal_algebra_node_visit(rasqal_query *query, rasqal_algebra_node* node, rasqal_algebra_node_visit_fn fn, void *user_data); rasqal_algebra_node* rasqal_algebra_query_to_algebra(rasqal_query* query); rasqal_algebra_node* rasqal_algebra_query_add_group_by(rasqal_query* query, rasqal_algebra_node* node, rasqal_solution_modifier* modifier); rasqal_algebra_node* rasqal_algebra_query_add_orderby(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection, rasqal_solution_modifier* modifier); rasqal_algebra_node* rasqal_algebra_query_add_slice(rasqal_query* query, rasqal_algebra_node* node, rasqal_solution_modifier* modifier); rasqal_algebra_node* rasqal_algebra_query_add_aggregation(rasqal_query* query, rasqal_algebra_aggregate* ae, rasqal_algebra_node* node); rasqal_algebra_node* rasqal_algebra_query_add_projection(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection); rasqal_algebra_node* rasqal_algebra_query_add_construct_projection(rasqal_query* query, rasqal_algebra_node* node); rasqal_algebra_node* rasqal_algebra_query_add_distinct(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection); rasqal_algebra_node* rasqal_algebra_query_add_having(rasqal_query* query, rasqal_algebra_node* node, rasqal_solution_modifier* modifier); int rasqal_algebra_node_is_empty(rasqal_algebra_node* node); rasqal_algebra_aggregate* rasqal_algebra_query_prepare_aggregates(rasqal_query* query, rasqal_algebra_node* node, rasqal_projection* projection, rasqal_solution_modifier* modifier); void rasqal_free_algebra_aggregate(rasqal_algebra_aggregate* ae); /* rasqal_variable.c */ rasqal_variables_table* rasqal_new_variables_table_from_variables_table(rasqal_variables_table* vt); rasqal_variable* rasqal_variables_table_get(rasqal_variables_table* vt, int idx); rasqal_literal* rasqal_variables_table_get_value(rasqal_variables_table* vt, int idx); int rasqal_variables_table_set(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value); int rasqal_variables_table_get_named_variables_count(rasqal_variables_table* vt); int rasqal_variables_table_get_anonymous_variables_count(rasqal_variables_table* vt); int rasqal_variables_table_get_total_variables_count(rasqal_variables_table* vt); raptor_sequence* rasqal_variables_table_get_named_variables_sequence(rasqal_variables_table* vt); raptor_sequence* rasqal_variables_table_get_anonymous_variables_sequence(rasqal_variables_table* vt); const unsigned char** rasqal_variables_table_get_names(rasqal_variables_table* vt); raptor_sequence* rasqal_variable_copy_variable_sequence(raptor_sequence* vars_seq); int rasqal_variables_write(raptor_sequence* seq, raptor_iostream* iostr); /** * rasqal_engine_error: * @RASQAL_ENGINE_OK: * @RASQAL_ENGINE_FAILED: * @RASQAL_ENGINE_FINISHED: * * Execution engine errors. * */ typedef enum { RASQAL_ENGINE_OK, RASQAL_ENGINE_FAILED, RASQAL_ENGINE_FINISHED, RASQAL_ENGINE_ERROR_LAST = RASQAL_ENGINE_FINISHED } rasqal_engine_error; /* * A query execution engine factory * * This structure is about executing the query recorded in * #rasqal_query structure into results accessed via #rasqal_query_results */ struct rasqal_query_execution_factory_s { /* execution engine name */ const char* name; /* size of execution engine private data */ size_t execution_data_size; /* * @ex_data: execution data * @query: query to execute * @query_results: query results * @flags: execution flags. 1: execute and store results * @error_p: execution error (OUT variable) * * Initialise a new execution * * Return value: non-0 on failure */ int (*execute_init)(void* ex_data, rasqal_query* query, rasqal_query_results* query_results, int flags, rasqal_engine_error *error_p); /** * @ex_data: execution data * @error_p: execution error (OUT variable) * * Get all bindings result rows (returning a new raptor_sequence object holding new objects. * * Will not be called if query results is NULL, finished or failed. */ raptor_sequence* (*get_all_rows)(void* ex_data, rasqal_engine_error *error_p); /* * @ex_data: execution object * @error_p: execution error (OUT variable) * * Get current bindings result row (returning a new object) * * Will not be called if query results is NULL, finished or failed. */ rasqal_row* (*get_row)(void* ex_data, rasqal_engine_error *error_p); /* finish (free) execution */ int (*execute_finish)(void* ex_data, rasqal_engine_error *error_p); /* finish the query execution factory */ void (*finish_factory)(rasqal_query_execution_factory* factory); }; /* rasqal_engine.c */ #ifdef RASQAL_DEBUG const char* rasqal_engine_get_parts_string(rasqal_triple_parts parts); const char* rasqal_engine_error_as_string(rasqal_engine_error error); #endif /* rasqal_engine_sort.c */ rasqal_map* rasqal_engine_new_rowsort_map(int is_distinct, int compare_flags, raptor_sequence* order_conditions_sequence); int rasqal_engine_rowsort_map_add_row(rasqal_map* map, rasqal_row* row); raptor_sequence* rasqal_engine_rowsort_map_to_sequence(rasqal_map* map, raptor_sequence* seq); int rasqal_engine_rowsort_calculate_order_values(rasqal_query* query, raptor_sequence* order_seq, rasqal_row* row); /* rasqal_engine_algebra.c */ /* New query engine based on executing over query algebra */ extern const rasqal_query_execution_factory rasqal_query_engine_algebra; /* rasqal_iostream.c */ raptor_iostream* rasqal_new_iostream_from_stringbuffer(raptor_world *raptor_world_ptr, raptor_stringbuffer* sb); /* rasqal_service.c */ rasqal_rowsource* rasqal_service_execute_as_rowsource(rasqal_service* svc, rasqal_variables_table* vars_table); /* rasqal_triples_source.c */ void rasqal_triples_source_error_handler(rasqal_query* rdf_query, raptor_locator* locator, const char* message); void rasqal_triples_source_error_handler2(rasqal_world* world, raptor_locator* locator, const char* message); /* rasqal_update.c */ const char* rasqal_update_type_label(rasqal_update_type type); rasqal_update_operation* rasqal_new_update_operation(rasqal_update_type type, raptor_uri* graph_uri, raptor_uri* document_uri, raptor_sequence* insert_templates, raptor_sequence* delete_templates, rasqal_graph_pattern* graph_pattern, int flags, rasqal_update_graph_applies applies); void rasqal_free_update_operation(rasqal_update_operation *update); int rasqal_update_operation_print(rasqal_update_operation *update, FILE* stream); int rasqal_query_add_update_operation(rasqal_query* query, rasqal_update_operation *update); /* rasqal_bindings.c */ rasqal_bindings* rasqal_new_bindings(rasqal_query* query, raptor_sequence* variables, raptor_sequence* rows); rasqal_bindings* rasqal_new_bindings_from_var_values(rasqal_query* query, rasqal_variable* var, raptor_sequence* values); rasqal_bindings* rasqal_new_bindings_from_bindings(rasqal_bindings* bindings); void rasqal_free_bindings(rasqal_bindings* bindings); int rasqal_bindings_print(rasqal_bindings* bindings, FILE* fh); rasqal_row* rasqal_bindings_get_row(rasqal_bindings* bindings, int offset); /* rasqal_ntriples.c */ rasqal_literal* rasqal_new_literal_from_ntriples_counted_string(rasqal_world* world, unsigned char* string, size_t length); /* rasqal_projection.c */ rasqal_projection* rasqal_new_projection(rasqal_query* query, raptor_sequence* variables, int wildcard, int distinct); void rasqal_free_projection(rasqal_projection* projection); raptor_sequence* rasqal_projection_get_variables_sequence(rasqal_projection* projection); int rasqal_projection_add_variable(rasqal_projection* projection, rasqal_variable* var); /* rasqal_regex.c */ int rasqal_regex_match(rasqal_world* world, raptor_locator* locator, const char* pattern, const char* regex_flags, const char* subject, size_t subject_len); /* rasqal_results_compare.c */ rasqal_results_compare* rasqal_new_results_compare(rasqal_world* world, rasqal_query_results *first_qr, const char* first_qr_label, rasqal_query_results *second_qr, const char* second_qr_label); void rasqal_free_results_compare(rasqal_results_compare* rrc); void rasqal_results_compare_set_log_handler(rasqal_results_compare* rrc, void* log_user_data, raptor_log_handler log_handler); int rasqal_results_compare_compare(rasqal_results_compare* rrc); rasqal_variable* rasqal_results_compare_get_variable_by_offset(rasqal_results_compare* rrc, int idx); int rasqal_results_compare_get_variable_offset_for_result(rasqal_results_compare* rrc, int var_idx, int qr_index); int rasqal_results_compare_variables_equal(rasqal_results_compare* rrc); void rasqal_print_results_compare(FILE *handle, rasqal_results_compare* rrc); /* rasqal_service.c */ rasqal_service* rasqal_new_service_from_service(rasqal_service* svc); /* rasqal_solution_modifier.c */ rasqal_solution_modifier* rasqal_new_solution_modifier(rasqal_query* query, raptor_sequence* order_conditions, raptor_sequence* group_conditions, raptor_sequence* having_conditions, int limit, int offset); void rasqal_free_solution_modifier(rasqal_solution_modifier* sm); /* rasqal_triples.c */ int rasqal_triples_sequence_set_origin(raptor_sequence* dest_seq, raptor_sequence* src_seq, rasqal_literal* origin); /* rasqal_random.c */ /** * RASQAL_RANDOM_STATE_SIZE: * * Size of BSD random state * * "With 256 bytes of state information, the period of the random * number generator is greater than 2**69 , which should be * sufficient for most purposes." - BSD random(3) man page */ #define RASQAL_RANDOM_STATE_SIZE 256 /** * rasqal_random: * @world: world object * @seed: used for rand_r() (if available) or srand() * @state: used for BSD initstate(), setstate() and random() (if available) * @data: internal to random algorithm * * A class providing a random number generator * */ struct rasqal_random_s { rasqal_world* world; unsigned int seed; char state[RASQAL_RANDOM_STATE_SIZE]; void* data; }; unsigned int rasqal_random_get_system_seed(rasqal_world *world); rasqal_random* rasqal_new_random(rasqal_world *world); void rasqal_free_random(rasqal_random *random_object); int rasqal_random_seed(rasqal_random *random_object, unsigned int seed); int rasqal_random_irand(rasqal_random *random_object); double rasqal_random_drand(rasqal_random *random_object); /* rasqal_sort.c */ #if RAPTOR_VERSION < 20015 void** rasqal_sequence_as_sorted(raptor_sequence* seq, raptor_data_compare_arg_handler compare, void* user_data); #endif int* rasqal_variables_table_get_order(rasqal_variables_table* vt); /* * rasqal_digest_type: * RASQAL_DIGEST_NONE: No digest * RASQAL_DIGEST_MD5: MD5 * RASQAL_DIGEST_SHA1: SHA1 * RASQAL_DIGEST_SHA224: SHA224 * RASQAL_DIGEST_SHA256: SHA256 * RASQAL_DIGEST_SHA384: SHA384 * RASQAL_DIGEST_SHA512: SHA512 * RASQAL_DIGEST_LAST: Internal * * INTERNAL - Message digest algorithm for rasqal_digest_buffer() */ typedef enum { RASQAL_DIGEST_NONE, RASQAL_DIGEST_MD5, RASQAL_DIGEST_SHA1, RASQAL_DIGEST_SHA224, RASQAL_DIGEST_SHA256, RASQAL_DIGEST_SHA384, RASQAL_DIGEST_SHA512, RASQAL_DIGEST_LAST = RASQAL_DIGEST_SHA512 } rasqal_digest_type; int rasqal_digest_buffer(rasqal_digest_type type, unsigned char *output, const unsigned char * const input, size_t len); #ifdef RASQAL_DIGEST_INTERNAL int rasqal_digest_sha1_buffer(const unsigned char *output, const unsigned char *input, size_t len); int rasqal_digest_md5_buffer(const unsigned char *output, const unsigned char *input, size_t len); #endif /* snprint.c */ size_t rasqal_format_integer(char* buffer, size_t bufsize, int integer, int width, char padding); /* Safe casts: widening a value */ #define RASQAL_GOOD_CAST(t, v) (t)(v) /* Unsafe casts: narrowing a value */ #define RASQAL_BAD_CAST(t, v) (t)(v) /* Converting a double / float to int - OK but not great */ #define RASQAL_FLOATING_AS_INT(v) ((int)(v)) /* IEEE 32 bit double ~ 1E-07 and 64 bit double ~ 2E-16 */ #define RASQAL_DOUBLE_EPSILON (DBL_EPSILON) /* end of RASQAL_INTERNAL */ #endif #ifdef __cplusplus } #endif #endif rasqal-0.9.33/src/rasqal_rowsource_union.c0000644000175000017500000003717412434455625015576 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_union.c - Rasqal union rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE typedef struct { rasqal_rowsource* left; rasqal_rowsource* right; /* array of size (number of variables in @right) with this row offset value */ int* right_map; /* array of size (number of variables in @right) holding right row temporarily */ rasqal_literal** right_tmp_values; /* 0 = reading from left rs, 1 = reading from right rs, 2 = finished */ int state; int failed; /* row offset for read_row() */ int offset; } rasqal_union_rowsource_context; static int rasqal_union_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_union_rowsource_context* con; con = (rasqal_union_rowsource_context*)user_data; con->state = 0; con->failed = 0; rasqal_rowsource_set_requirements(con->left, RASQAL_ROWSOURCE_REQUIRE_RESET); rasqal_rowsource_set_requirements(con->right, RASQAL_ROWSOURCE_REQUIRE_RESET); return 0; } static int rasqal_union_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_union_rowsource_context* con; con = (rasqal_union_rowsource_context*)user_data; if(con->left) rasqal_free_rowsource(con->left); if(con->right) rasqal_free_rowsource(con->right); if(con->right_map) RASQAL_FREE(int, con->right_map); if(con->right_tmp_values) RASQAL_FREE(ptrarray, con->right_tmp_values); RASQAL_FREE(rasqal_union_rowsource_context, con); return 0; } static int rasqal_union_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_union_rowsource_context* con; int map_size; int i; con = (rasqal_union_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->left)) return 1; if(rasqal_rowsource_ensure_variables(con->right)) return 1; map_size = rasqal_rowsource_get_size(con->right); con->right_map = RASQAL_MALLOC(int*, RASQAL_GOOD_CAST(size_t, sizeof(int) * RASQAL_GOOD_CAST(size_t, map_size))); if(!con->right_map) return 1; con->right_tmp_values = RASQAL_MALLOC(rasqal_literal**, sizeof(rasqal_literal*) * RASQAL_GOOD_CAST(size_t, map_size)); if(!con->right_tmp_values) return 1; rowsource->size = 0; /* copy in variables from left rowsource */ if(rasqal_rowsource_copy_variables(rowsource, con->left)) return 1; /* add any new variables not already seen from right rowsource */ for(i = 0; i < map_size; i++) { rasqal_variable* v; int offset; v = rasqal_rowsource_get_variable_by_offset(con->right, i); if(!v) break; offset = rasqal_rowsource_add_variable(rowsource, v); if(offset < 0) return 1; con->right_map[i] = offset; } return 0; } static void rasqal_union_rowsource_adjust_right_row(rasqal_rowsource *rowsource, rasqal_union_rowsource_context* con, rasqal_row *row) { rasqal_rowsource *right_rowsource = con->right; int i; /* save right row values */ for(i = 0; i < right_rowsource->size; i++) con->right_tmp_values[i] = row->values[i]; /* NULL out other pointers */ for(i = 0; i < rowsource->size; i++) row->values[i] = NULL; /* map them into correct order in result row */ for(i = 0; i < right_rowsource->size; i++) { int offset = con->right_map[i]; row->values[offset] = con->right_tmp_values[i]; } } static rasqal_row* rasqal_union_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_union_rowsource_context* con; rasqal_row* row = NULL; con = (rasqal_union_rowsource_context*)user_data; if(con->failed || con->state > 1) return NULL; if(con->state == 0) { row = rasqal_rowsource_read_row(con->left); #ifdef RASQAL_DEBUG RASQAL_DEBUG2("rowsource %p read left row : ", rowsource); if(row) rasqal_row_print(row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif if(!row) con->state = 1; else { /* otherwise: rows from left are correct order but wrong size */ if(rasqal_row_expand_size(row, rowsource->size)) { rasqal_free_row(row); return NULL; } } } if(!row && con->state == 1) { row = rasqal_rowsource_read_row(con->right); #ifdef RASQAL_DEBUG RASQAL_DEBUG2("rowsource %p read right row : ", rowsource); if(row) rasqal_row_print(row, stderr); else fputs("NONE", stderr); fputs("\n", stderr); #endif if(!row) /* finished */ con->state = 2; else { if(rasqal_row_expand_size(row, rowsource->size)) { rasqal_free_row(row); return NULL; } /* transform row from right to match new projection */ rasqal_union_rowsource_adjust_right_row(rowsource, con, row); } } if(row) { rasqal_row_set_rowsource(row, rowsource); row->offset = con->offset++; } return row; } static raptor_sequence* rasqal_union_rowsource_read_all_rows(rasqal_rowsource* rowsource, void *user_data) { rasqal_union_rowsource_context* con; raptor_sequence* seq1 = NULL; raptor_sequence* seq2 = NULL; int left_size; int right_size; int i; con = (rasqal_union_rowsource_context*)user_data; if(con->failed) return NULL; seq1 = rasqal_rowsource_read_all_rows(con->left); if(!seq1) { con->failed = 1; return NULL; } seq2 = rasqal_rowsource_read_all_rows(con->right); if(!seq2) { con->failed = 1; raptor_free_sequence(seq1); return NULL; } #ifdef RASQAL_DEBUG fprintf(DEBUG_FH, "left rowsource (%d vars):\n", rasqal_rowsource_get_size(con->left)); rasqal_rowsource_print_row_sequence(con->left, seq1, DEBUG_FH); fprintf(DEBUG_FH, "right rowsource (%d vars):\n", rasqal_rowsource_get_size(con->right)); rasqal_rowsource_print_row_sequence(con->right, seq2, DEBUG_FH); #endif /* transform rows from left to match new projection */ left_size = raptor_sequence_size(seq1); for(i = 0; i < left_size; i++) { rasqal_row *row = (rasqal_row*)raptor_sequence_get_at(seq1, i); /* rows from left are correct order but wrong size */ rasqal_row_expand_size(row, rowsource->size); rasqal_row_set_rowsource(row, rowsource); } /* transform rows from right to match new projection */ right_size = raptor_sequence_size(seq2); for(i = 0; i < right_size; i++) { rasqal_row *row = (rasqal_row*)raptor_sequence_get_at(seq2, i); /* rows from right need resizing and adjusting by offset */ rasqal_row_expand_size(row, rowsource->size); rasqal_union_rowsource_adjust_right_row(rowsource, con, row); row->offset += left_size; rasqal_row_set_rowsource(row, rowsource); } if(raptor_sequence_join(seq1, seq2)) { raptor_free_sequence(seq1); seq1 = NULL; } raptor_free_sequence(seq2); con->state = 2; return seq1; } static int rasqal_union_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_union_rowsource_context* con; int rc; con = (rasqal_union_rowsource_context*)user_data; con->state = 0; con->failed = 0; rc = rasqal_rowsource_reset(con->left); if(rc) return rc; return rasqal_rowsource_reset(con->right); } static rasqal_rowsource* rasqal_union_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_union_rowsource_context *con; con = (rasqal_union_rowsource_context*)user_data; if(offset == 0) return con->left; else if(offset == 1) return con->right; else return NULL; } static const rasqal_rowsource_handler rasqal_union_rowsource_handler = { /* .version = */ 1, "union", /* .init = */ rasqal_union_rowsource_init, /* .finish = */ rasqal_union_rowsource_finish, /* .ensure_variables = */ rasqal_union_rowsource_ensure_variables, /* .read_row = */ rasqal_union_rowsource_read_row, /* .read_all_rows = */ rasqal_union_rowsource_read_all_rows, /* .reset = */ rasqal_union_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_union_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_union_rowsource: * @world: world object * @query: query object * @left: left (first) rowsource * @right: right (second) rowsource * * INTERNAL - create a new UNION over two rowsources * * This uses the number of variables in @vt to set the rowsource size * (order size is always 0) and then checks that all the rows in the * sequence are the same. If not, construction fails and NULL is * returned. * * The @left and @right rowsources become owned by the new rowsource. * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_union_rowsource(rasqal_world *world, rasqal_query* query, rasqal_rowsource* left, rasqal_rowsource* right) { rasqal_union_rowsource_context* con; int flags = 0; if(!world || !query || !left || !right) goto fail; con = RASQAL_CALLOC(rasqal_union_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->left = left; con->right = right; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_union_rowsource_handler, query->vars_table, flags); fail: if(left) rasqal_free_rowsource(left); if(right) rasqal_free_rowsource(right); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); const char* const union_1_data_2x3_rows[] = { /* 2 variable names and 3 rows */ "a", NULL, "b", NULL, /* row 1 data */ "foo", NULL, "bar", NULL, /* row 2 data */ "baz", NULL, "fez", NULL, /* row 3 data */ "bob", NULL, "sue", NULL, /* end of data */ NULL, NULL, NULL, NULL }; const char* const union_2_data_3x4_rows[] = { /* 3 variable names and 4 rows */ "b", NULL, "c", NULL, "d", NULL, /* row 1 data */ "red", NULL, "orange", NULL, "yellow", NULL, /* row 2 data */ "blue", NULL, "indigo", NULL, "violet", NULL, /* row 3 data */ "black", NULL, "silver", NULL, "gold", NULL, /* row 4 data */ "green", NULL, "tope", NULL, "bronze", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL }; #define EXPECTED_ROWS_COUNT (3 + 4) /* there is one duplicate variable 'b' */ #define EXPECTED_COLUMNS_COUNT (2 + 3 - 1) const char* const union_result_vars[] = { "a" , "b" , "c", "d" }; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_rowsource *left_rs = NULL; rasqal_rowsource *right_rs = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; int count; raptor_sequence* seq = NULL; int failures = 0; int vars_count; rasqal_variables_table* vt; int size; int expected_count = EXPECTED_ROWS_COUNT; int expected_size = EXPECTED_COLUMNS_COUNT; int i; raptor_sequence* vars_seq = NULL; world = rasqal_new_world(); rasqal_world_open(world); query = rasqal_new_query(world, "sparql", NULL); vt = query->vars_table; /* 2 variables and 3 rows */ vars_count = 2; seq = rasqal_new_row_sequence(world, vt, union_1_data_2x3_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create left sequence of %d vars\n", program, vars_count); failures++; goto tidy; } left_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!left_rs) { fprintf(stderr, "%s: failed to create left rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by left_rs */ vars_seq = seq = NULL; /* 3 variables and 4 rows */ vars_count = 3; seq = rasqal_new_row_sequence(world, vt, union_2_data_3x4_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create right sequence of %d rows\n", program, vars_count); failures++; goto tidy; } right_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!right_rs) { fprintf(stderr, "%s: failed to create right rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by right_rs */ vars_seq = seq = NULL; rowsource = rasqal_new_union_rowsource(world, query, left_rs, right_rs); if(!rowsource) { fprintf(stderr, "%s: failed to create union rowsource\n", program); failures++; goto tidy; } /* left_rs and right_rs are now owned by rowsource */ left_rs = right_rs = NULL; seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: read_rows returned a NULL seq for a union rowsource\n", program); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != expected_count) { fprintf(stderr, "%s: read_rows returned %d rows for a union rowsource, expected %d\n", program, count, expected_count); failures++; goto tidy; } size = rasqal_rowsource_get_size(rowsource); if(size != expected_size) { fprintf(stderr, "%s: read_rows returned %d columns (variables) for a union rowsource, expected %d\n", program, size, expected_size); failures++; goto tidy; } for(i = 0; i < expected_size; i++) { rasqal_variable* v; const char* name = NULL; const char *expected_name = union_result_vars[i]; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(!v) { fprintf(stderr, "%s: read_rows had NULL column (variable) #%d expected %s\n", program, i, expected_name); failures++; goto tidy; } name = RASQAL_GOOD_CAST(const char*, v->name); if(strcmp(name, expected_name)) { fprintf(stderr, "%s: read_rows returned column (variable) #%d %s but expected %s\n", program, i, name, expected_name); failures++; goto tidy; } } #ifdef RASQAL_DEBUG rasqal_rowsource_print_row_sequence(rowsource, seq, DEBUG_FH); #endif tidy: if(seq) raptor_free_sequence(seq); if(left_rs) rasqal_free_rowsource(left_rs); if(right_rs) rasqal_free_rowsource(right_rs); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_expr_numerics.c0000644000175000017500000003120412434455625015205 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_expr_numerics.c - Rasqal expression evaluation * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #if defined(RASQAL_UUID_OSSP) #include #endif #if defined(RASQAL_UUID_LIBUUID) #include #endif #ifdef RASQAL_UUID_LIBC #include #endif #define DEBUG_FH stderr /* * rasqal_expression_evaluate_abs: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_ABS (numeric) expression. * * Return value: A #rasqal_literal value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_abs(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_literal* l1; rasqal_literal* result = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; if(!rasqal_literal_is_numeric(l1)) goto failed; result = rasqal_literal_abs(l1, error_p); rasqal_free_literal(l1); l1 = NULL; if(error_p && *error_p) goto failed; return result; failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_round: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_ROUND (numeric) expression. * * Return value: A #rasqal_literal value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_round(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_literal* l1; rasqal_literal* result = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; if(!rasqal_literal_is_numeric(l1)) goto failed; result = rasqal_literal_round(l1, error_p); rasqal_free_literal(l1); l1 = NULL; if(error_p && *error_p) goto failed; return result; failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_ceil: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_CEIL (numeric) expression. * * Return value: A #rasqal_literal value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_ceil(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_literal* l1; rasqal_literal* result = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; if(!rasqal_literal_is_numeric(l1)) goto failed; result = rasqal_literal_ceil(l1, error_p); rasqal_free_literal(l1); l1 = NULL; if(error_p && *error_p) goto failed; return result; failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_floor: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_FLOOR (numeric) expression. * * Return value: A #rasqal_literal value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_floor(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_literal* l1; rasqal_literal* result = NULL; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; if(!rasqal_literal_is_numeric(l1)) goto failed; result = rasqal_literal_floor(l1, error_p); rasqal_free_literal(l1); l1 = NULL; if(error_p && *error_p) goto failed; return result; failed: if(error_p) *error_p = 1; if(l1) rasqal_free_literal(l1); return NULL; } /* * rasqal_expression_evaluate_rand: * @e: The expression to evaluate. * @eval_context: Evaluation context * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_RAND (integer expr) expression. * * Return value: A #rasqal_literal xsd:double value in range [0, 1) or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_rand(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; double d; d = rasqal_random_drand(eval_context->random); return rasqal_new_double_literal(world, d); } /* * rasqal_expression_evaluate_digest: * @e: The expression to evaluate. * @eval_context: Evaluation context * @error_p: pointer to error flag or NULL * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_MD5, RASQAL_EXPR_SHA1, * RASQAL_EXPR_SHA224, RASQAL_EXPR_SHA256, RASQAL_EXPR_SHA384, * RASQAL_EXPR_SHA512 (string) expression. * * Return value: A #rasqal_literal xsd:string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_digest(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { rasqal_world* world = eval_context->world; rasqal_digest_type md_type = RASQAL_DIGEST_NONE; rasqal_literal* l1 = NULL; const unsigned char *s; unsigned char *new_s; size_t len; int output_len; unsigned char *output = NULL; unsigned int i; unsigned char* p; /* Turn EXPR enum into DIGEST enum - we know they are ordered the same */ if(e->op >= RASQAL_EXPR_MD5 && e->op <= RASQAL_EXPR_SHA512) md_type = RASQAL_GOOD_CAST(rasqal_digest_type, e->op - RASQAL_EXPR_MD5 + RASQAL_DIGEST_MD5); else goto failed; l1 = rasqal_expression_evaluate2(e->arg1, eval_context, error_p); if((error_p && *error_p) || !l1) goto failed; s = rasqal_literal_as_counted_string(l1, &len, eval_context->flags, error_p); if(error_p && *error_p) goto failed; output_len = rasqal_digest_buffer(md_type, NULL, NULL, 0); if(output_len < 0) goto failed; output = RASQAL_MALLOC(unsigned char*, RASQAL_GOOD_CAST(size_t, output_len)); if(!output) goto failed; output_len = rasqal_digest_buffer(md_type, output, s, len); if(output_len < 0) goto failed; new_s = RASQAL_MALLOC(unsigned char*, (RASQAL_GOOD_CAST(size_t, output_len) * 2) + 1); if(!new_s) goto failed; p = new_s; for(i = 0; i < RASQAL_GOOD_CAST(unsigned int, output_len); i++) { unsigned short hex; unsigned char c = output[i]; hex = (c & 0xf0) >> 4; *p++ = RASQAL_GOOD_CAST(unsigned char, (hex < 10) ? ('0' + hex) : ('a' + hex - 10)); hex = (c & 0x0f); *p++ = RASQAL_GOOD_CAST(unsigned char, (hex < 10) ? ('0' + hex) : ('a' + hex - 10)); } *p = '\0'; RASQAL_FREE(char, output); rasqal_free_literal(l1); /* after this new_s becomes owned by result */ return rasqal_new_string_literal(world, new_s, NULL, NULL, NULL); failed: if(error_p) *error_p = 1; if(output) RASQAL_FREE(char, output); if(l1) rasqal_free_literal(l1); return NULL; } #define RASQAL_UUID_LEN 16 #define RASQAL_UUID_HEXDIGIT_LEN (RASQAL_UUID_LEN << 1) /* 4 '-' chars added after 8, 12, 16, 20 output hex digit */ #define RASQAL_UUID_STRING_LEN (RASQAL_UUID_HEXDIGIT_LEN + 4) #define RASQAL_UUID_URI_PREFIX "urn:uuid:" #define RASQAL_UUID_URI_PREFIX_LEN 9 #ifdef RASQAL_UUID_INTERNAL typedef union { unsigned char b[16]; int16_t w[8]; } uuid_t; /* * rasqal_uuid_generate: * @eval_context: evaluation context * @uuid: uuid object * * INTERNAL - Generate a random UUID based on rasqal random * * Byte offset * 0 1 2 3 4 5 6 7 8 9 101112131415 * xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx Hex string * * where x is any hexadecimal digit and y is one of 8, 9, a, or b. */ static void rasqal_uuid_generate(rasqal_evaluation_context *eval_context, uuid_t ptr) { int16_t* out = ptr.w; unsigned char* outc = ptr.b; unsigned int i; for(i = 0; i < (RASQAL_UUID_LEN / sizeof(int16_t)); i++) { *out++ = rasqal_random_irand(eval_context->random); } outc[6] = (outc[6] & 0x0F) | 0x40; outc[8] = (outc[8] & 0x3F) | 0x80; } #endif /* * rasqal_expression_evaluate_uuid: * @e: The expression to evaluate. * @eval_context: Evaluation context * @want_uri: non-0 to return URI otherwise string * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_UUID, RASQAL_EXPR_STRUUID * * Return value: A #rasqal_literal URI / string value or NULL on failure. */ static rasqal_literal* rasqal_expression_evaluate_uuid(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p, int want_uri) { #ifdef RASQAL_UUID_NONE return NULL; #else rasqal_world* world = eval_context->world; #if defined(RASQAL_UUID_OSSP) uuid_t* data; #else uuid_t data; /* static */ int i; #endif size_t output_len = RASQAL_UUID_STRING_LEN; unsigned char* output; unsigned char* p; #if defined(RASQAL_UUID_LIBUUID) || defined(RASQAL_UUID_LIBC) uuid_generate(data); #endif #if defined(RASQAL_UUID_OSSP) uuid_create(&data); uuid_make(data, UUID_MAKE_V1); #endif #ifdef RASQAL_UUID_INTERNAL rasqal_uuid_generate(eval_context, data); #endif if(want_uri) output_len += RASQAL_UUID_URI_PREFIX_LEN; output = RASQAL_MALLOC(unsigned char*, output_len + 1); if(!output) { #if defined(RASQAL_UUID_OSSP) uuid_destroy(data); #endif return NULL; } p = output; if(want_uri) { memcpy(p, RASQAL_UUID_URI_PREFIX, RASQAL_UUID_URI_PREFIX_LEN); p += RASQAL_UUID_URI_PREFIX_LEN; } #if defined(RASQAL_UUID_OSSP) uuid_export(data, UUID_FMT_STR, p, /* data_len */ NULL); uuid_destroy(data); #else for(i = 0; i < RASQAL_UUID_LEN; i++) { unsigned short hex; #ifdef RASQAL_UUID_INTERNAL unsigned char c = data.b[i]; #else unsigned char c = data[i]; #endif hex = (c & 0xf0) >> 4; *p++ = RASQAL_GOOD_CAST(unsigned char, (hex < 10) ? ('0' + hex) : ('a' + hex - 10)); hex = (c & 0x0f); *p++ = RASQAL_GOOD_CAST(unsigned char, (hex < 10) ? ('0' + hex) : ('a' + hex - 10)); if(i == 3 || i == 5 || i == 7 || i == 9) *p++ = '-'; } *p = '\0'; #endif /* end if !RASQAL_UUID_OSSP */ /* after this output becomes owned by result */ if(want_uri) { raptor_uri* u; rasqal_literal* l = NULL; u = raptor_new_uri(world->raptor_world_ptr, output); if(u) l = rasqal_new_uri_literal(world, u); RASQAL_FREE(char*, output); return l; } else { return rasqal_new_string_literal(world, output, NULL, NULL, NULL); } #endif } /* * rasqal_expression_evaluate_uriuuid: * @e: The expression to evaluate. * @eval_context: Evaluation context * @want_uri: non-0 to return URI otherwise string * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_UUID * * Return value: A #rasqal_literal URI value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_uriuuid(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { return rasqal_expression_evaluate_uuid(e, eval_context, error_p, 1); } /* * rasqal_expression_evaluate_uuid: * @e: The expression to evaluate. * @eval_context: Evaluation context * @want_uri: non-0 to return URI otherwise string * * INTERNAL - Evaluate SPARQL 1.1 RASQAL_EXPR_STRUUID * * Return value: A #rasqal_literal string value or NULL on failure. */ rasqal_literal* rasqal_expression_evaluate_struuid(rasqal_expression *e, rasqal_evaluation_context *eval_context, int *error_p) { return rasqal_expression_evaluate_uuid(e, eval_context, error_p, 0); } rasqal-0.9.33/src/rasqal_digest_sha1.c0000644000175000017500000002245512127603460014514 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_digest_sha1.c - SHA1 Message Digest Algorithm * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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. * * Based on the public domain version with the credits below. * */ /* SHA-1 in C By Steve Reid 100% Public Domain ----------------- Modified 7/98 By James H. Brown Still 100% Public Domain Corrected a problem which generated improper hash values on 16 bit machines Routine SHA1Update changed from void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len) to void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned long len) The 'len' parameter was declared an int which works fine on 32 bit machines. However, on 16 bit machines an int is too small for the shifts being done against it. This caused the hash function to generate incorrect values if len was greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update(). Since the file IO in main() reads 16K at a time, any file 8K or larger would be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million "a"s). I also changed the declaration of variables i & j in SHA1Update to unsigned long from unsigned int for the same reason. These changes should make no difference to any 32 bit implementations since an int and a long are the same size in those environments. -- I also corrected a few compiler warnings generated by Borland C. 1. Added #include for exit() prototype 2. Removed unused variable 'j' in SHA1Final 3. Changed exit(0) to return(0) at end of main. ALL changes I made can be located by searching for comments containing 'JHB' ----------------- Modified 8/98 By Steve Reid Still 100% public domain 1- Removed #include and used return() instead of exit() 2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall) 3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net */ /* Test Vectors (from FIPS PUB 180-1) "abc" A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 A million repetitions of "a" 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #include "rasqal.h" #include "rasqal_internal.h" #define u32 uint32_t /* #define SHA1HANDSOFF * Copies data before messing with it. */ /* Using return() instead of exit() - SWR */ #define SHA1_DIGEST_LENGTH 20 typedef struct { u32 state[5]; u32 count[2]; unsigned char buffer[64]; unsigned char digest[SHA1_DIGEST_LENGTH]; } SHA1Context; static void SHA1Transform(u32 state[5], const unsigned char buffer[64]); static void SHA1Init(SHA1Context* context); static void SHA1Update(SHA1Context* context, const unsigned char* data, size_t len); /* JHB */ static void SHA1Final(SHA1Context* context); #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ /* I got the idea of expanding during the round function from SSLeay */ #ifdef WORDS_BIGENDIAN #define blk0(i) block->l[i] #else #define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ |(rol(block->l[i],8)&0x00FF00FF)) #endif #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ ^block->l[(i+2)&15]^block->l[i&15],1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); /* Hash a single 512-bit block. This is the core of the algorithm. */ static void SHA1Transform(u32 state[5], const unsigned char buffer[64]) { u32 a, b, c, d, e; typedef union { unsigned char c[64]; u32 l[16]; } CHAR64LONG16; CHAR64LONG16* block; #ifdef SHA1HANDSOFF static unsigned char workspace[64]; block = (CHAR64LONG16*)workspace; memcpy(block, buffer, 64); #else block = (CHAR64LONG16*)buffer; #endif /* Copy context->state[] to working vars */ a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; /* 4 rounds of 20 operations each. Loop unrolled. */ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); /* Add the working vars back into context.state[] */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; /* Wipe variables */ /* a = b = c = d = e = 0; */ /* CLANG: useless */ } /* SHA1Init - Initialize new context */ static void SHA1Init(SHA1Context* context) { /* SHA1 initialization constants */ context->state[0] = 0x67452301; context->state[1] = 0xEFCDAB89; context->state[2] = 0x98BADCFE; context->state[3] = 0x10325476; context->state[4] = 0xC3D2E1F0; context->count[0] = context->count[1] = 0; } /* Run your data through this. */ static void SHA1Update(SHA1Context* context, const unsigned char* data, size_t len) /* JHB */ { u32 i, j; /* JHB */ u32 ulen = RASQAL_BAD_CAST(u32, len); j = (context->count[0] >> 3) & 63; if ((context->count[0] += ulen << 3) < (ulen << 3)) context->count[1]++; context->count[1] += (ulen >> 29); if ((j + len) > 63) { memcpy(&context->buffer[j], data, (i = 64-j)); SHA1Transform(context->state, context->buffer); for ( ; i + 63 < len; i += 64) { SHA1Transform(context->state, &data[i]); } j = 0; } else i = 0; memcpy(&context->buffer[j], &data[i], len - i); } /* Add padding and return the message digest. */ static void SHA1Final(SHA1Context* context) { u32 i; /* JHB */ unsigned char finalcount[8]; for (i = 0; i < 8; i++) { finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ } SHA1Update(context, RASQAL_GOOD_CAST(const unsigned char*, "\200"), 1); while ((context->count[0] & 504) != 448) { SHA1Update(context, RASQAL_GOOD_CAST(const unsigned char*, "\0"), 1); } SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ for (i = 0; i < SHA1_DIGEST_LENGTH; i++) { context->digest[i] = (unsigned char) ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } /* Wipe variables */ /* i = 0; */ /* JHB */ /* CLANG: useless */ memset(context->buffer, 0, 64); memset(context->state, 0, SHA1_DIGEST_LENGTH); memset(context->count, 0, 8); memset(finalcount, 0, 8); /* SWR */ #ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ SHA1Transform(context->state, context->buffer); #endif } /* DJB code from here */ int rasqal_digest_sha1_buffer(const unsigned char *output, const unsigned char *input, size_t len) { SHA1Context ctx; /* static */ if(!input) return SHA1_DIGEST_LENGTH; SHA1Init(&ctx); SHA1Update(&ctx, input, len); SHA1Final(&ctx); memcpy((void*)output, ctx.digest, SHA1_DIGEST_LENGTH); return SHA1_DIGEST_LENGTH; } rasqal-0.9.33/src/rasqal_prefix.c0000644000175000017500000000537411717115020013611 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_prefix.c - Rasqal prefix class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /** * rasqal_new_prefix: * @world: rasqal_world object * @prefix: Short prefix string to stand for URI (or NULL) * @uri: Name #raptor_uri. * * Constructor - create a new #rasqal_prefix. * Takes ownership of prefix and uri. * * Return value: a new #rasqal_prefix or NULL on failure. **/ rasqal_prefix* rasqal_new_prefix(rasqal_world* world, const unsigned char *prefix, raptor_uri* uri) { rasqal_prefix* p; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(uri, raptor_uri, NULL); p = RASQAL_CALLOC(rasqal_prefix*, 1, sizeof(*p)); if(p) { p->world = world; p->prefix = prefix; p->uri = uri; } else { RASQAL_FREE(char*, prefix); raptor_free_uri(uri); } return p; } /** * rasqal_free_prefix: * @p: #rasqal_prefix object. * * Destructor - destroy a #rasqal_prefix object. **/ void rasqal_free_prefix(rasqal_prefix* p) { if(!p) return; if(p->prefix) RASQAL_FREE(char*, p->prefix); if(p->uri) raptor_free_uri(p->uri); RASQAL_FREE(rasqal_prefix, p); } /** * rasqal_prefix_print: * @p: #rasqal_prefix object. * @fh: The FILE* handle to print to. * * Print a Rasqal prefix in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_prefix_print(rasqal_prefix* p, FILE* fh) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(p, rasqal_prefix, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); fprintf(fh, "prefix(%s as %s)", (p->prefix ? RASQAL_GOOD_CAST(const char*, p->prefix) : "(default)"), raptor_uri_as_string(p->uri)); return 0; } rasqal-0.9.33/src/rasqal_data_graph.c0000644000175000017500000001775612435141254014423 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_data_graph.c - Rasqal data graph class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" static rasqal_data_graph* rasqal_new_data_graph_common(rasqal_world* world, raptor_uri* uri, raptor_iostream* iostr, raptor_uri* base_uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) { rasqal_data_graph* dg; dg = RASQAL_CALLOC(rasqal_data_graph*, 1, sizeof(*dg)); if(dg) { dg->world = world; dg->usage = 1; if(iostr) dg->iostr = iostr; else if(uri) dg->uri = raptor_uri_copy(uri); if(name_uri) dg->name_uri = raptor_uri_copy(name_uri); dg->flags = flags; if(format_type) { size_t len = strlen(format_type); dg->format_type = RASQAL_MALLOC(char*, len + 1); if(!dg->format_type) goto error; memcpy(dg->format_type, format_type, len + 1); } if(format_name) { size_t len = strlen(format_name); dg->format_name = RASQAL_MALLOC(char*, len + 1); if(!dg->format_name) goto error; memcpy(dg->format_name, format_name, len + 1); } if(format_uri) dg->format_uri = raptor_uri_copy(format_uri); if(base_uri) dg->base_uri = raptor_uri_copy(base_uri); } return dg; error: rasqal_free_data_graph(dg); return NULL; } /** * rasqal_new_data_graph_from_uri: * @world: rasqal_world object * @uri: source URI * @name_uri: name of graph (or NULL) * @flags: %RASQAL_DATA_GRAPH_NAMED or %RASQAL_DATA_GRAPH_BACKGROUND * @format_type: MIME Type of data format at @uri (or NULL) * @format_name: Raptor parser Name of data format at @uri (or NULL) * @format_uri: URI of data format at @uri (or NULL) * * Constructor - create a new #rasqal_data_graph. * * The name_uri is only used when the flags are %RASQAL_DATA_GRAPH_NAMED. * * Return value: a new #rasqal_data_graph or NULL on failure. **/ rasqal_data_graph* rasqal_new_data_graph_from_uri(rasqal_world* world, raptor_uri* uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(uri, raptor_uri, NULL); return rasqal_new_data_graph_common(world, uri, /* iostr */ NULL, /* base URI */ NULL, name_uri, flags, format_type, format_name, format_uri); } /** * rasqal_new_data_graph_from_iostream: * @world: rasqal_world object * @iostr: source graph format iostream * @base_uri: base URI for iostream content * @name_uri: name of graph (or NULL) * @flags: %RASQAL_DATA_GRAPH_NAMED or %RASQAL_DATA_GRAPH_BACKGROUND * @format_type: MIME Type of data format at @uri (or NULL) * @format_name: Raptor parser Name of data format at @uri (or NULL) * @format_uri: URI of data format at @uri (or NULL) * * Constructor - create a new #rasqal_data_graph from iostream content * * The @name_uri is used when the flags are %RASQAL_DATA_GRAPH_NAMED. * * The @base_uri is used to provide the Raptor parser a base URI. If * a base URI is required but none is given, the parsing will fail * and the query that uses this data source will fail. * * Return value: a new #rasqal_data_graph or NULL on failure. **/ rasqal_data_graph* rasqal_new_data_graph_from_iostream(rasqal_world* world, raptor_iostream* iostr, raptor_uri* base_uri, raptor_uri* name_uri, unsigned int flags, const char* format_type, const char* format_name, raptor_uri* format_uri) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); return rasqal_new_data_graph_common(world, /* uri */ NULL, iostr, base_uri, name_uri, flags, format_type, format_name, format_uri); } /** * rasqal_new_data_graph_from_data_graph: * @dg: #rasqal_data_graph object to copy or NULL * * Copy Constructor - create a new #rasqal_data_graph object from an existing #rasqal_data_graph object. * * Return value: a new #rasqal_data_graph object or NULL if @dg was NULL. **/ rasqal_data_graph* rasqal_new_data_graph_from_data_graph(rasqal_data_graph* dg) { dg->usage++; return dg; } /** * rasqal_free_data_graph: * @dg: #rasqal_data_graph object * * Destructor - destroy a #rasqal_data_graph object. * **/ void rasqal_free_data_graph(rasqal_data_graph* dg) { if(!dg) return; if(--dg->usage) return; if(dg->uri) raptor_free_uri(dg->uri); if(dg->name_uri) raptor_free_uri(dg->name_uri); if(dg->format_type) RASQAL_FREE(char*, dg->format_type); if(dg->format_name) RASQAL_FREE(char*, dg->format_name); if(dg->format_uri) raptor_free_uri(dg->format_uri); if(dg->base_uri) raptor_free_uri(dg->base_uri); RASQAL_FREE(rasqal_data_graph, dg); } /** * rasqal_data_graph_print: * @dg: #rasqal_data_graph object * @fh: the FILE* handle to print to * * Print a Rasqal data graph in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_data_graph_print(rasqal_data_graph* dg, FILE* fh) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(dg, rasqal_data_graph, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); if(dg->iostr) { if(dg->name_uri) fprintf(fh, "data graph(from iostream, named as %s, flags %u", raptor_uri_as_string(dg->name_uri), dg->flags); else fprintf(fh, "data graph(from iostream, %u", dg->flags); } else { /* dg->uri must exist */ if(dg->name_uri) fprintf(fh, "data graph(from uri %s, named as %s, flags %u", raptor_uri_as_string(dg->uri), raptor_uri_as_string(dg->name_uri), dg->flags); else fprintf(fh, "data graph(from uri %s, flags %u", raptor_uri_as_string(dg->uri), dg->flags); } if(dg->format_type || dg->format_name || dg->format_uri) { fputs(" with format ", fh); if(dg->format_type) fprintf(fh, "type %s", dg->format_type); if(dg->format_name) fprintf(fh, "name %s", dg->format_name); if(dg->format_uri) fprintf(fh, "uri %s", raptor_uri_as_string(dg->format_uri)); if(dg->base_uri) fprintf(fh, "base uri %s", raptor_uri_as_string(dg->base_uri)); } fputc(')', fh); return 0; } rasqal-0.9.33/src/rasqal_format_sv.c0000644000175000017500000007053612435675630014336 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_format_sv.c - Format results in CSV/TSV * * Intended to read and write the * SPARQL 1.1 Query Results CSV and TSV Formats (DRAFT) * http://www.w3.org/2009/sparql/docs/csv-tsv-results/results-csv-tsv.html * * Copyright (C) 2009-2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #ifndef FILE_READ_BUF_SIZE #ifdef BUFSIZ #define FILE_READ_BUF_SIZE BUFSIZ #else #define FILE_READ_BUF_SIZE 1024 #endif #endif #include "rasqal.h" #include "rasqal_internal.h" #include "sv_config.h" #include "sv.h" static int rasqal_iostream_write_csv_string(const unsigned char *string, size_t len, raptor_iostream *iostr) { const char delim = '\x22'; int quoting_needed = 0; size_t i; for(i = 0; i < len; i++) { char c = RASQAL_GOOD_CAST(char, string[i]); /* Quoting needed for delim (double quote), comma, linefeed or return */ if(c == delim || c == ',' || c == '\r' || c == '\n') { quoting_needed++; break; } } if(!quoting_needed) return raptor_iostream_counted_string_write(string, len, iostr); raptor_iostream_write_byte(delim, iostr); for(i = 0; i < len; i++) { char c = RASQAL_GOOD_CAST(char, string[i]); if(c == delim) raptor_iostream_write_byte(delim, iostr); raptor_iostream_write_byte(c, iostr); } raptor_iostream_write_byte(delim, iostr); return 0; } /* * rasqal_query_results_write_sv: * @iostr: #raptor_iostream to write the query to * @results: #rasqal_query_results query results format * @base_uri: #raptor_uri base URI of the output format * @label: name of this format for errors * @sep: column sep character * @csv_escape: non-0 if values are written escaped with CSV rules, else turtle * @variable_prefix: char to print before a variable name or NUL * @eol_str: end of line string * @eol_str_len: length of @eol_str * * INTERNAL - Write a @sep-separated values version of the query results format to an iostream. * * If the writing succeeds, the query results will be exhausted. * * Return value: non-0 on failure **/ static int rasqal_query_results_write_sv(raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri, const char* label, const char sep, int csv_escape, const char variable_prefix, const char* eol_str, size_t eol_str_len) { rasqal_query* query = rasqal_query_results_get_query(results); int i; int vars_count; int emit_mkr; if(!strcmp(label, (const char*)"mkr")) emit_mkr = 1; else emit_mkr = 0; if(!rasqal_query_results_is_bindings(results)) { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Can only write %s format for variable binding results", label); return 1; } if(emit_mkr) { raptor_iostream_counted_string_write("result is relation with format = csv;\n", 38, iostr); raptor_iostream_counted_string_write("begin relation result;\n", 23, iostr); } /* Header */ for(i = 0; 1; i++) { const unsigned char *name; name = rasqal_query_results_get_binding_name(results, i); if(!name) break; if(i > 0) raptor_iostream_write_byte(sep, iostr); if(variable_prefix) raptor_iostream_write_byte(variable_prefix, iostr); raptor_iostream_string_write(name, iostr); } if(emit_mkr) raptor_iostream_counted_string_write(";", 1, iostr); raptor_iostream_counted_string_write(eol_str, eol_str_len, iostr); /* Variable Binding Results */ vars_count = rasqal_query_results_get_bindings_count(results); while(!rasqal_query_results_finished(results)) { /* Result row */ for(i = 0; i < vars_count; i++) { rasqal_literal *l = rasqal_query_results_get_binding_value(results, i); if(i > 0) raptor_iostream_write_byte(sep, iostr); if(l) { const unsigned char* str; size_t len; switch(l->type) { case RASQAL_LITERAL_URI: str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->value.uri, &len)); if(csv_escape) rasqal_iostream_write_csv_string(str, len, iostr); else { raptor_iostream_write_byte('<', iostr); if(str && len > 0) raptor_string_ntriples_write(str, len, '"', iostr); raptor_iostream_write_byte('>', iostr); } break; case RASQAL_LITERAL_BLANK: raptor_bnodeid_ntriples_write(l->string, l->string_len, iostr); break; case RASQAL_LITERAL_STRING: if(csv_escape) { rasqal_iostream_write_csv_string(l->string, l->string_len, iostr); } else { if(l->datatype && l->valid) { rasqal_literal_type ltype; ltype = rasqal_xsd_datatype_uri_to_type(l->world, l->datatype); if(ltype >= RASQAL_LITERAL_INTEGER && ltype <= RASQAL_LITERAL_DECIMAL) { /* write integer, float, double and decimal XSD typed * data without quotes, datatype or language */ raptor_string_ntriples_write(l->string, l->string_len, '\0', iostr); break; } } raptor_iostream_write_byte('"', iostr); raptor_string_ntriples_write(l->string, l->string_len, '"', iostr); raptor_iostream_write_byte('"', iostr); if(l->language) { raptor_iostream_write_byte('@', iostr); raptor_iostream_string_write(RASQAL_GOOD_CAST(const unsigned char*, l->language), iostr); } if(l->datatype) { raptor_iostream_string_write("^^<", iostr); str = RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_counted_string(l->datatype, &len)); raptor_string_ntriples_write(str, len, '"', iostr); raptor_iostream_write_byte('>', iostr); } } break; case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_UDT: case RASQAL_LITERAL_INTEGER_SUBTYPE: case RASQAL_LITERAL_UNKNOWN: default: rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Cannot turn literal type %u into %s", l->type, label); } } /* End Binding */ } /* End Result Row */ if(emit_mkr) raptor_iostream_counted_string_write(";", 1, iostr); raptor_iostream_counted_string_write(eol_str, eol_str_len, iostr); rasqal_query_results_next(results); } if(emit_mkr) raptor_iostream_counted_string_write("end relation result;\n", 21, iostr); /* end sparql */ return 0; } static int rasqal_query_results_write_csv(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { return rasqal_query_results_write_sv(iostr, results, base_uri, "CSV", ',', 1, '\0', "\r\n", 2); } static int rasqal_query_results_write_mkr(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { return rasqal_query_results_write_sv(iostr, results, base_uri, "mkr", ',', 1, '\0', "\n", 1); } static int rasqal_query_results_write_tsv(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { return rasqal_query_results_write_sv(iostr, results, base_uri, "TSV", '\t', 0, '?', "\n", 1); } typedef struct { rasqal_world* world; rasqal_rowsource* rowsource; int failed; /* Input fields */ raptor_uri* base_uri; raptor_iostream* iostr; raptor_locator locator; /* SV processing */ int emit_mkr; /* Non 0 for mKR relation */ char sep; sv* t; char buffer[FILE_READ_BUF_SIZE]; /* iostream read buffer */ int offset; /* current result row number */ /* Output fields */ raptor_sequence* results_sequence; /* saved result rows */ /* Variables table allocated for variables in the result set */ rasqal_variables_table* vars_table; size_t variables_count; unsigned int flags; int data_is_turtle; } rasqal_rowsource_sv_context; static sv_status_t rasqal_rowsource_sv_header_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { rasqal_rowsource_sv_context* con; unsigned i; con = (rasqal_rowsource_sv_context*)user_data; con->variables_count = count; for(i = 0; i < count; i++) { rasqal_variable *v; char *p = fields[i]; size_t len = widths[i]; if(*p == '?') { p++; len--; } v = rasqal_variables_table_add2(con->vars_table, RASQAL_VARIABLE_TYPE_NORMAL, RASQAL_GOOD_CAST(const unsigned char*, p), len, NULL); if(v) { rasqal_rowsource_add_variable(con->rowsource, v); /* above function takes a reference to v */ rasqal_free_variable(v); } } return SV_STATUS_OK; } static sv_status_t rasqal_rowsource_sv_data_callback(sv *t, void *user_data, char** fields, size_t *widths, size_t count) { rasqal_rowsource_sv_context* con; rasqal_row* row; unsigned i; con = (rasqal_rowsource_sv_context*)user_data; row = rasqal_new_row(con->rowsource); if(!row) goto fail; RASQAL_DEBUG2("Made new row %d\n", con->offset); con->offset++; for(i = 0; i < count; i++) { char* field = fields[i]; size_t field_len = widths[i]; rasqal_literal* l; if(!field_len) { /* missing */ l = NULL; } else if(con->data_is_turtle) { l = rasqal_new_literal_from_ntriples_counted_string(con->world, RASQAL_GOOD_CAST(unsigned char*,field), field_len); if(!l) goto fail; } else { unsigned char* lvalue; lvalue = RASQAL_MALLOC(unsigned char*, field_len + 1); if(!lvalue) goto fail; if(!widths[i]) *lvalue = '\0'; else memcpy(lvalue, field, field_len + 1); l = rasqal_new_string_literal_node(con->world, lvalue, NULL, NULL); if(!l) goto fail; } rasqal_row_set_value_at(row, RASQAL_GOOD_CAST(int, i), l); if(l) { RASQAL_DEBUG4("Saving row result %d %s value at offset %u\n", con->offset, rasqal_literal_type_label(l->type), i); rasqal_free_literal(l); } else { RASQAL_DEBUG3("Saving row result %d NULL value at offset %u\n", con->offset, i); } } raptor_sequence_push(con->results_sequence, row); return SV_STATUS_OK; fail: rasqal_free_row(row); return SV_STATUS_NO_MEMORY; } static int rasqal_rowsource_sv_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sv_context* con; con = (rasqal_rowsource_sv_context*)user_data; con->rowsource = rowsource; con->t = sv_new(con, rasqal_rowsource_sv_header_callback, rasqal_rowsource_sv_data_callback, con->sep); if(!con->t) return 1; if(con->data_is_turtle) sv_set_option(con->t, SV_OPTION_QUOTED_FIELDS, 0L); return 0; } static int rasqal_rowsource_sv_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sv_context* con; con = (rasqal_rowsource_sv_context*)user_data; if(con->t) sv_free(con->t); if(con->base_uri) raptor_free_uri(con->base_uri); if(con->results_sequence) raptor_free_sequence(con->results_sequence); if(con->vars_table) rasqal_free_variables_table(con->vars_table); if(con->flags) { if(con->iostr) raptor_free_iostream(con->iostr); } RASQAL_FREE(rasqal_rowsource_sv_context, con); return 0; } static void rasqal_rowsource_sv_process(rasqal_rowsource_sv_context* con) { if(raptor_sequence_size(con->results_sequence) && con->variables_count > 0) return; /* do some parsing - need some results */ while(!raptor_iostream_read_eof(con->iostr)) { size_t read_len; read_len = RASQAL_BAD_CAST(size_t, raptor_iostream_read_bytes(RASQAL_GOOD_CAST(char*, con->buffer), 1, FILE_READ_BUF_SIZE, con->iostr)); if(read_len > 0) { sv_status_t status; RASQAL_DEBUG2("processing %d bytes\n", RASQAL_GOOD_CAST(int, read_len)); status = sv_parse_chunk(con->t, con->buffer, read_len); if(status != SV_STATUS_OK) { con->failed++; break; } } if(read_len < FILE_READ_BUF_SIZE) { /* finished */ break; } /* end with variables sequence done AND at least one row */ if(con->variables_count > 0 && raptor_sequence_size(con->results_sequence) > 0) break; } } static int rasqal_rowsource_sv_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sv_context* con; con = (rasqal_rowsource_sv_context*)user_data; rasqal_rowsource_sv_process(con); return con->failed; } static rasqal_row* rasqal_rowsource_sv_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sv_context* con; rasqal_row* row=NULL; con = (rasqal_rowsource_sv_context*)user_data; rasqal_rowsource_sv_process(con); if(!con->failed && raptor_sequence_size(con->results_sequence) > 0) { RASQAL_DEBUG1("getting row from stored sequence\n"); row=(rasqal_row*)raptor_sequence_unshift(con->results_sequence); } return row; } static const rasqal_rowsource_handler rasqal_rowsource_csv_handler={ /* .version = */ 1, "CSV", /* .init = */ rasqal_rowsource_sv_init, /* .finish = */ rasqal_rowsource_sv_finish, /* .ensure_variables = */ rasqal_rowsource_sv_ensure_variables, /* .read_row = */ rasqal_rowsource_sv_read_row, /* .read_all_rows = */ NULL, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; static const rasqal_rowsource_handler rasqal_rowsource_mkr_handler={ /* .version = */ 1, "mkr", /* .init = */ rasqal_rowsource_sv_init, /* .finish = */ rasqal_rowsource_sv_finish, /* .ensure_variables = */ rasqal_rowsource_sv_ensure_variables, /* .read_row = */ rasqal_rowsource_sv_read_row, /* .read_all_rows = */ NULL, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; static const rasqal_rowsource_handler rasqal_rowsource_tsv_handler={ /* .version = */ 1, "TSV", /* .init = */ rasqal_rowsource_sv_init, /* .finish = */ rasqal_rowsource_sv_finish, /* .ensure_variables = */ rasqal_rowsource_sv_ensure_variables, /* .read_row = */ rasqal_rowsource_sv_read_row, /* .read_all_rows = */ NULL, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /* * rasqal_query_results_getrowsource_csv: * @world: rasqal world object * @iostr: #raptor_iostream to read the query results from * @base_uri: #raptor_uri base URI of the input format * * INTERNAL - Read SPARQL CSV query results format from an iostream * in a format returning a rowsource. * * Return value: a new rasqal_rowsource or NULL on failure **/ static rasqal_rowsource* rasqal_query_results_get_rowsource_csv(rasqal_query_results_formatter* formatter, rasqal_world *world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_sv_context* con; con = RASQAL_CALLOC(rasqal_rowsource_sv_context*, 1, sizeof(*con)); if(!con) return NULL; con->world = world; con->base_uri = base_uri ? raptor_uri_copy(base_uri) : NULL; con->iostr = iostr; con->locator.uri = base_uri; con->flags = flags; con->emit_mkr = 0; con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); con->sep = ','; return rasqal_new_rowsource_from_handler(world, NULL, con, &rasqal_rowsource_csv_handler, con->vars_table, 0); } /* * rasqal_query_results_getrowsource_mkr: * @world: rasqal world object * @iostr: #raptor_iostream to read the query results from * @base_uri: #raptor_uri base URI of the input format * * INTERNAL - Read SPARQL mKR query results format from an iostream * in a format returning a rowsource. * * Return value: a new rasqal_rowsource or NULL on failure **/ static rasqal_rowsource* rasqal_query_results_get_rowsource_mkr(rasqal_query_results_formatter* formatter, rasqal_world *world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_sv_context* con; con = RASQAL_CALLOC(rasqal_rowsource_sv_context*, 1, sizeof(*con)); if(!con) return NULL; con->world = world; con->base_uri = base_uri ? raptor_uri_copy(base_uri) : NULL; con->iostr = iostr; con->locator.uri = base_uri; con->flags = flags; con->emit_mkr = 1; con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); con->sep = ','; return rasqal_new_rowsource_from_handler(world, NULL, con, &rasqal_rowsource_mkr_handler, con->vars_table, 0); } /* * rasqal_query_results_getrowsource_tsv: * @world: rasqal world object * @iostr: #raptor_iostream to read the query results from * @base_uri: #raptor_uri base URI of the input format * * INTERNAL - Read SPARQL TSV query results format from an iostream * in a format returning a rowsource. * * Return value: a new rasqal_rowsource or NULL on failure **/ static rasqal_rowsource* rasqal_query_results_get_rowsource_tsv(rasqal_query_results_formatter* formatter, rasqal_world *world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_sv_context* con; con = RASQAL_CALLOC(rasqal_rowsource_sv_context*, 1, sizeof(*con)); if(!con) return NULL; con->world = world; con->base_uri = base_uri ? raptor_uri_copy(base_uri) : NULL; con->iostr = iostr; con->locator.uri = base_uri; con->flags = flags; con->emit_mkr = 0; con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); con->sep = '\t'; con->data_is_turtle = 1; return rasqal_new_rowsource_from_handler(world, NULL, con, &rasqal_rowsource_tsv_handler, con->vars_table, 0); } /* * Calculate score for buffer based on score of number of 'sep' chars * in first line; minimum @min_count gives a based score, boosted if * more than @boost_count */ static int rasqal_query_results_sv_score_first_line(const unsigned char* p, size_t len, const char sep, unsigned int min_count, unsigned int boost_count) { unsigned int count = 0; int score = 0; if(!p || !len) return 0; for(; (len && *p && *p !='\r' && *p != '\n'); p++, len--) { if(*p == sep) { count++; if(count >= min_count) { score = 6; if(count >= boost_count) { score += 2; /* if the score is this high, we can end */ break; } } } } return score; } static int rasqal_query_results_csv_recognise_syntax(rasqal_query_results_format_factory* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type) { int score = 0; if(suffix && !strcmp(RASQAL_GOOD_CAST(const char*, suffix), "csv")) return 7; if(buffer && len) { /* use number of tabs in first line - comma needs higher counts since it * is more likely to appear in text. */ score = rasqal_query_results_sv_score_first_line(buffer, len, ',', 5, 7); } return score; } static int rasqal_query_results_mkr_recognise_syntax(rasqal_query_results_format_factory* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type) { unsigned int score = 0; if(suffix && !strcmp(RASQAL_GOOD_CAST(const char*, suffix), "mkr")) return 7; if(buffer && len) { /* use number of tabs in first line - comma needs higher counts since it * is more likely to appear in text. */ score = rasqal_query_results_sv_score_first_line(buffer, len, ',', 5, 7); } return score; } static int rasqal_query_results_tsv_recognise_syntax(rasqal_query_results_format_factory* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type) { int score = 0; if(suffix && !strcmp(RASQAL_GOOD_CAST(const char*, suffix), "tsv")) return 7; if(buffer && len) { /* use number of tabs in first line - tab is more rare so guess * with fewer than csv's comma. */ score = rasqal_query_results_sv_score_first_line(buffer, len, '\t', 3, 5); } return score; } static const char* const csv_names[] = { "csv", NULL}; static const char* const csv_uri_strings[] = { "http://www.w3.org/ns/formats/SPARQL_Results_CSV", "http://www.w3.org/TR/sparql11-results-csv-tsv/", "http://www.ietf.org/rfc/rfc4180.txt", NULL }; static const raptor_type_q csv_types[] = { { "text/csv", 8, 10}, { "text/csv; header=present", 24, 10}, { NULL, 0, 0} }; static int rasqal_query_results_csv_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = csv_names; factory->desc.mime_types = csv_types; factory->desc.label = "Comma Separated Values (CSV)"; factory->desc.uri_strings = csv_uri_strings; factory->desc.flags = 0; factory->write = rasqal_query_results_write_csv; factory->get_rowsource = rasqal_query_results_get_rowsource_csv; factory->recognise_syntax = rasqal_query_results_csv_recognise_syntax; return rc; } static const char* const mkr_names[] = { "mkr", NULL}; static const char* const mkr_uri_strings[] = { NULL }; static const raptor_type_q mkr_types[] = { { "text/mkr", 8, 10}, { "text/mkr; header=present", 24, 10}, { NULL, 0, 0} }; static int rasqal_query_results_mkr_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = mkr_names; factory->desc.mime_types = mkr_types; factory->desc.label = "mKR relation (mkr)"; factory->desc.uri_strings = mkr_uri_strings; factory->desc.flags = 0; factory->write = rasqal_query_results_write_mkr; factory->get_rowsource = rasqal_query_results_get_rowsource_mkr; factory->recognise_syntax = rasqal_query_results_mkr_recognise_syntax; return rc; } static const char* const tsv_names[] = { "tsv", NULL}; static const char* const tsv_uri_strings[] = { "http://www.w3.org/ns/formats/SPARQL_Results_TSV", "http://www.w3.org/TR/sparql11-results-csv-tsv/", "http://www.iana.org/assignments/media-types/text/tab-separated-values", NULL }; static const raptor_type_q tsv_types[] = { { "text/tab-separated-values", 25, 10}, { NULL, 0, 0} }; static int rasqal_query_results_tsv_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = tsv_names; factory->desc.mime_types = tsv_types; factory->desc.label = "Tab Separated Values (TSV)"; factory->desc.uri_strings = tsv_uri_strings; factory->desc.flags = 0; factory->write = rasqal_query_results_write_tsv; factory->get_rowsource = rasqal_query_results_get_rowsource_tsv; factory->recognise_syntax = rasqal_query_results_tsv_recognise_syntax; return rc; } int rasqal_init_result_format_sv(rasqal_world* world) { if(!rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_csv_register_factory)) return 1; if(!rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_mkr_register_factory)) return 1; if(!rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_tsv_register_factory)) return 1; return 0; } rasqal-0.9.33/src/rasqal_triples_source.c0000644000175000017500000002526312311460057015361 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_triples_source.c - Rasqal triples source matching triple patterns against triples * * Copyright (C) 2004-2009, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /** * rasqal_set_triples_source_factory: * @world: rasqal_world object * @register_fn: registration function * @user_data: user data for registration * * Register a factory to generate triple sources. * * Registers the factory that returns triples sources. Note that * there is only one of these per runtime. * * The #rasqal_triples_source_factory factory method new_triples_source is * called with the user data for some query and #rasqal_triples_source. * * Return value: non-zero on failure **/ RASQAL_EXTERN_C int rasqal_set_triples_source_factory(rasqal_world* world, rasqal_triples_source_factory_register_fn register_fn, void* user_data) { int rc; int version; if(!world || !register_fn) return 1; /* for compatibility with old API that does not call this - FIXME Remove V2 */ rasqal_world_open(world); world->triples_source_factory.user_data = user_data; rc = register_fn(&world->triples_source_factory); /* Failed if the factory API version is not in the supported range */ version = world->triples_source_factory.version; if(!(version >= RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION && version <= RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION) ) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to register triples source factory - API %d is not in supported range %d to %d", version, RASQAL_TRIPLES_SOURCE_FACTORY_MIN_VERSION, RASQAL_TRIPLES_SOURCE_FACTORY_MAX_VERSION); rc = 1; } return rc; } /** * rasqal_triples_source_error_handler: * @query: query * @locator: any locator information * @message: error message * * INTERNAL - Return an error during creation of a triples source */ void rasqal_triples_source_error_handler(rasqal_query* rdf_query, raptor_locator* locator, const char* message) { rasqal_log_error_simple(rdf_query->world, RAPTOR_LOG_LEVEL_ERROR, locator, "%s", message); } /** * rasqal_triples_source_error_handler2: * @world: world * @locator: any locator information * @message: error message * * INTERNAL - Return an error during creation of a triples source */ void rasqal_triples_source_error_handler2(rasqal_world* world, raptor_locator* locator, const char* message) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "%s", message); } /** * rasqal_new_triples_source: * @query: query * * INTERNAL - Create a new triples source * * Return value: a new triples source or NULL on failure */ rasqal_triples_source* rasqal_new_triples_source(rasqal_query* query) { rasqal_triples_source_factory* rtsf = &query->world->triples_source_factory; rasqal_triples_source* rts; int rc = 0; rts = RASQAL_CALLOC(rasqal_triples_source*, 1, sizeof(*rts)); if(!rts) return NULL; rts->user_data = RASQAL_CALLOC(void*, 1, rtsf->user_data_size); if(!rts->user_data) { RASQAL_FREE(rasqal_triples_source, rts); return NULL; } rts->query = query; if(rtsf->version >= 3 && rtsf->init_triples_source2) { /* rasqal_triples_source_factory API V3 */ unsigned int flags = 0; if(query->features[RASQAL_FEATURE_NO_NET]) flags |= 1; rc = rtsf->init_triples_source2(query->world, query->data_graphs, rtsf->user_data, rts->user_data, rts, rasqal_triples_source_error_handler2, flags); /* if there is an error, it will have been already reported more * specifically via the error handler so no need to do it again * below in a generic form. */ goto error_tidy; } else if(rtsf->version >= 2 && rtsf->init_triples_source) { /* rasqal_triples_source_factory API V2 */ rc = rtsf->init_triples_source(query, rtsf->user_data, rts->user_data, rts, rasqal_triples_source_error_handler); /* if there is an error, it will have been already reported more * specifically via the error handler so no need to do it again * below in a generic form. */ goto error_tidy; } else /* rasqal_triples_source_factory API V1 */ rc = rtsf->new_triples_source(query, rtsf->user_data, rts->user_data, rts); /* Failure if the returned triples source API version is not in the * supported range */ if(!(rts->version >= RASQAL_TRIPLES_SOURCE_MIN_VERSION && rts->version <= RASQAL_TRIPLES_SOURCE_MAX_VERSION) ) { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to create triples source - API %d not in range %d to %d", rts->version, RASQAL_TRIPLES_SOURCE_MIN_VERSION, RASQAL_TRIPLES_SOURCE_MAX_VERSION); rc = 1; } if(rc) { if(rc > 0) { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "Failed to make triples source."); } else { rasqal_log_error_simple(query->world, RAPTOR_LOG_LEVEL_ERROR, &query->locator, "No data to query."); } } error_tidy: if(rc) { RASQAL_FREE(user_data, rts->user_data); RASQAL_FREE(rasqal_triples_source, rts); return NULL; } return rts; } void rasqal_free_triples_source(rasqal_triples_source *rts) { if(!rts) return; if(rts->user_data) { rts->free_triples_source(rts->user_data); RASQAL_FREE(user_data, rts->user_data); rts->user_data = NULL; } RASQAL_FREE(rasqal_triples_source, rts); } int rasqal_triples_source_triple_present(rasqal_triples_source *rts, rasqal_triple *t) { return rts->triple_present(rts, rts->user_data, t); } static void rasqal_free_triples_match(rasqal_triples_match* rtm) { if(!rtm) return; if(!rtm->is_exact) rtm->finish(rtm, rtm->user_data); RASQAL_FREE(rasqal_triples_match, rtm); } rasqal_triples_match* rasqal_new_triples_match(rasqal_query* query, rasqal_triples_source* triples_source, rasqal_triple_meta *m, rasqal_triple *t) { rasqal_triples_match* rtm; if(!triples_source) return NULL; rtm = RASQAL_CALLOC(rasqal_triples_match*, 1, sizeof(*rtm)); if(rtm) { rtm->world = query->world; /* exact if there are no variables in the triple parts */ rtm->is_exact = 1; if(rasqal_literal_as_variable(t->predicate) || rasqal_literal_as_variable(t->subject) || rasqal_literal_as_variable(t->object)) rtm->is_exact = 0; if(rtm->is_exact) { if(!triples_source->triple_present(triples_source, triples_source->user_data, t)) { rasqal_free_triples_match(rtm); rtm = NULL; } } else { if(triples_source->init_triples_match(rtm, triples_source, triples_source->user_data, m, t)) { rasqal_free_triples_match(rtm); rtm = NULL; } } } return rtm; } /* methods */ rasqal_triple_parts rasqal_triples_match_bind_match(struct rasqal_triples_match_s* rtm, rasqal_variable *bindings[4], rasqal_triple_parts parts) { if(rtm->is_exact) return RASQAL_TRIPLE_SPO; return rtm->bind_match(rtm, rtm->user_data, bindings, parts); } void rasqal_triples_match_next_match(struct rasqal_triples_match_s* rtm) { if(rtm->is_exact) { rtm->finished++; return; } rtm->next_match(rtm, rtm->user_data); } int rasqal_triples_match_is_end(struct rasqal_triples_match_s* rtm) { if(rtm->finished) return 1; if(rtm->is_exact) return rtm->finished; return rtm->is_end(rtm, rtm->user_data); } /** * rasqal_reset_triple_meta: * @m: Triple pattern metadata * * INTERNAL - reset the metadata associated with a triple pattern * * Return value: number of parts of the triple that were reset (0..4) **/ int rasqal_reset_triple_meta(rasqal_triple_meta* m) { int resets = 0; if(m->triples_match) { rasqal_free_triples_match(m->triples_match); m->triples_match = NULL; } if(m->bindings[0] && (m->parts & RASQAL_TRIPLE_SUBJECT)) { rasqal_variable_set_value(m->bindings[0], NULL); resets++; } if(m->bindings[1] && (m->parts & RASQAL_TRIPLE_PREDICATE)) { rasqal_variable_set_value(m->bindings[1], NULL); resets++; } if(m->bindings[2] && (m->parts & RASQAL_TRIPLE_OBJECT)) { rasqal_variable_set_value(m->bindings[2], NULL); resets++; } if(m->bindings[3] && (m->parts & RASQAL_TRIPLE_ORIGIN)) { rasqal_variable_set_value(m->bindings[3], NULL); resets++; } m->executed = 0; return resets; } /* * rasqal_triples_source_support_feature: * @rts: triples source * @feature: triples source feature * * INTERNAL - Test support for a feature * * Return value: non-0 if @feature is supported */ int rasqal_triples_source_support_feature(rasqal_triples_source *rts, rasqal_triples_source_feature feature) { if(rts->version >= 2 && rts->support_feature) return rts->support_feature(rts->user_data, feature); else return 0; } rasqal-0.9.33/src/rasqal_rowsource_bindings.c0000644000175000017500000001123012135276415016220 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_bindings.c - Rasqal bindings rows rowsource class * * Copyright (C) 2013, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" typedef struct { /* bindings object */ rasqal_bindings* bindings; /* bindings row offset */ int offset; } rasqal_bindings_rowsource_context; static int rasqal_bindings_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_bindings_rowsource_context *con; con = (rasqal_bindings_rowsource_context*)user_data; con->offset = 0; return 0; } static int rasqal_bindings_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_bindings_rowsource_context* con; raptor_sequence* vars_seq; int i; con = (rasqal_bindings_rowsource_context*)user_data; rowsource->size = 0; vars_seq = con->bindings->variables; if(!vars_seq) return 0; for(i = 0; 1; i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(vars_seq, i); if(!v) break; if(rasqal_rowsource_add_variable(rowsource, v) < 0) return 1; } return 0; } static int rasqal_bindings_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_bindings_rowsource_context *con; con = (rasqal_bindings_rowsource_context*)user_data; if(con->bindings) rasqal_free_bindings(con->bindings); RASQAL_FREE(rasqal_bindings_rowsource_context, con); return 0; } static rasqal_row* rasqal_bindings_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_bindings_rowsource_context *con; rasqal_row *row; con = (rasqal_bindings_rowsource_context*)user_data; row = rasqal_bindings_get_row(con->bindings, con->offset++); return row; } static int rasqal_bindings_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_bindings_rowsource_context *con; con = (rasqal_bindings_rowsource_context*)user_data; con->offset = 0; return 0; } static const rasqal_rowsource_handler rasqal_bindings_rowsource_handler = { /* .version = */ 1, "bindings", /* .init = */ rasqal_bindings_rowsource_init, /* .finish = */ rasqal_bindings_rowsource_finish, /* .ensure_variables = */ rasqal_bindings_rowsource_ensure_variables, /* .read_row = */ rasqal_bindings_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_bindings_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /** * rasqal_new_bindings_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * @limit: max rows limit (or <0 for no limit) * @offset: start row offset (or <0 for no offset) * * INTERNAL - create a new bindings (LIMIT, OFFSET) rowsource * * The @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_bindings_rowsource(rasqal_world *world, rasqal_query *query, rasqal_bindings* bindings) { rasqal_bindings_rowsource_context *con; int flags = 0; if(!world || !query || !bindings) goto fail; con = RASQAL_CALLOC(rasqal_bindings_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->bindings = bindings; con->offset = 0; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_bindings_rowsource_handler, query->vars_table, flags); fail: if(bindings) rasqal_free_bindings(bindings); return NULL; } rasqal-0.9.33/src/sparql_parser.y0000644000175000017500000046633712425715323013700 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * sparql_parser.y - Rasqal SPARQL parser over tokens from sparql_lexer.l * * Copyright (C) 2004-2014, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * References: * SPARQL Query Language for RDF, W3C Recommendation 15 January 2008 * http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/ * */ %{ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #include #include #define YY_NO_UNISTD_H 1 #include #include /* Set RASQAL_DEBUG to 3 for super verbose parsing - watching the shift/reduces */ #if 0 #undef RASQAL_DEBUG #define RASQAL_DEBUG 3 #endif #define DEBUG_FH stderr /* Make verbose error messages for syntax errors */ #define YYERROR_VERBOSE 1 /* Fail with an debug error message if RASQAL_DEBUG > 1 */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 #define YYERROR_MSG(msg) do { fputs("** YYERROR ", DEBUG_FH); fputs(msg, DEBUG_FH); fputc('\n', DEBUG_FH); YYERROR; } while(0) #else #define YYERROR_MSG(ignore) YYERROR #endif #define YYERR_MSG_GOTO(label,msg) do { errmsg = msg; goto label; } while(0) /* Slow down the grammar operation and watch it work */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 #undef YYDEBUG #define YYDEBUG 1 #endif /* the lexer does not seem to track this */ #undef RASQAL_SPARQL_USE_ERROR_COLUMNS /* Prototypes */ int sparql_parser_error(rasqal_query* rq, void* scanner, const char *msg); /* Make lex/yacc interface as small as possible */ #undef yylex #define yylex sparql_lexer_lex /* Make the yyerror below use the rdf_parser */ #undef yyerror #define yyerror(rq, scanner, message) sparql_query_error(rq, message) /* Prototypes for local functions */ static int sparql_parse(rasqal_query* rq); static void sparql_query_error(rasqal_query* rq, const char *message); static void sparql_query_error_full(rasqal_query *rq, const char *message, ...) RASQAL_PRINTF_FORMAT(2, 3); static sparql_uri_applies* new_uri_applies(raptor_uri* uri, rasqal_update_graph_applies applies) { sparql_uri_applies* ua; ua = RASQAL_MALLOC(sparql_uri_applies*, sizeof(*ua)); if(!ua) return NULL; ua->uri = uri; ua->applies = applies; return ua; } static void free_uri_applies(sparql_uri_applies* ua) { if(ua->uri) raptor_free_uri(ua->uri); RASQAL_FREE(sparql_uri_applies*, ua); } static sparql_op_expr* new_op_expr(rasqal_op op, rasqal_expression *expr) { sparql_op_expr* oe; oe = RASQAL_MALLOC(sparql_op_expr*, sizeof(*oe)); if(!oe) return NULL; oe->op = op; oe->expr = expr; return oe; } static void free_op_expr(sparql_op_expr* oe) { if(oe->expr) rasqal_free_expression(oe->expr); RASQAL_FREE(sparql_op_expr*, oe); } static void print_op_expr(sparql_op_expr* oe, FILE* fh) { fputs("op), fh); fputs(", ", fh); if(oe->expr) rasqal_expression_print(oe->expr, fh); else fputs("NULL", fh); fputs(">", fh); } %} /* directives */ %require "3.0.0" /* File prefix (bison -b) */ %file-prefix "sparql_parser" /* Symbol prefix (bison -d : deprecated) */ %name-prefix "sparql_parser_" /* Write parser header file with macros (bison -d) */ %defines /* Write output file with verbose descriptions of parser states */ %verbose /* Generate code processing locations */ /* %locations */ /* Pure parser - want a reentrant parser */ %define api.pure full /* Push or pull parser? */ %define api.push-pull pull /* Pure parser argument: lexer - yylex() and parser - yyparse() */ %lex-param { yyscan_t yyscanner } %parse-param { rasqal_query* rq } { void* yyscanner } /* Interface between lexer and parser */ %union { raptor_sequence *seq; rasqal_variable *variable; rasqal_literal *literal; rasqal_triple *triple; rasqal_expression *expr; rasqal_graph_pattern *graph_pattern; double floating; raptor_uri *uri; unsigned char *name; rasqal_formula *formula; rasqal_update_operation *update; unsigned int uinteger; rasqal_data_graph* data_graph; rasqal_row* row; rasqal_solution_modifier* modifier; int limit_offset[2]; int integer; rasqal_projection* projection; rasqal_bindings* bindings; sparql_uri_applies* uri_applies; sparql_op_expr* op_expr; } /* * shift/reduce conflicts * FIXME: document this * 35 total * * 7 shift/reduce are OPTIONAL/GRAPH/FILTER/SERVICE/MINUS/LET/{ * after a TriplesBlockOpt has been accepted but before a * GraphPatternListOpt. Choice is made to reduce with GraphPatternListOpt. * */ %expect 35 /* word symbols */ %token SELECT FROM WHERE %token OPTIONAL DESCRIBE CONSTRUCT ASK DISTINCT REDUCED LIMIT UNION %token PREFIX BASE BOUND %token GRAPH NAMED FILTER OFFSET ORDER BY REGEX ASC DESC LANGMATCHES %token A "a" %token STRLANG "strlang" %token STRDT "strdt" %token STR "str" %token IRI "iri" %token URI "uri" %token BNODE "bnode" %token LANG "lang" %token DATATYPE "datatype" %token ISURI "isUri" %token ISBLANK "isBlank" %token ISLITERAL "isLiteral" %token ISNUMERIC "isNumeric" %token SAMETERM "sameTerm" /* SPARQL 1.1 (draft) / LAQRS */ %token GROUP HAVING %token COUNT SUM AVG MIN MAX GROUP_CONCAT SAMPLE SEPARATOR %token DELETE INSERT WITH CLEAR CREATE SILENT DATA DROP LOAD INTO DEFAULT %token TO ADD MOVE COPY ALL %token COALESCE %token AS IF %token NOT IN %token BINDINGS UNDEF SERVICE MINUS %token YEAR MONTH DAY HOURS MINUTES SECONDS TIMEZONE TZ %token STRLEN SUBSTR UCASE LCASE STRSTARTS STRENDS CONTAINS ENCODE_FOR_URI CONCAT %token STRBEFORE STRAFTER REPLACE %token BIND %token ABS ROUND CEIL FLOOR RAND %token MD5 SHA1 SHA224 SHA256 SHA384 SHA512 %token UUID STRUUID %token VALUES /* LAQRS */ %token EXPLAIN LET %token CURRENT_DATETIME NOW FROM_UNIXTIME TO_UNIXTIME /* expression delimiters */ %token ',' '(' ')' '[' ']' '{' '}' %token '?' '$' %token HATHAT "^^" /* SC booleans */ %left SC_OR %left SC_AND /* operations */ %left EQ %left NEQ %left LT %left GT %left LE %left GE /* arithmetic operations */ %left '+' '-' '*' '/' /* unary operations */ /* laqrs operations */ %token ASSIGN ":=" /* string */ %token STRING "string" %token LANGTAG "langtag" /* literals */ %token DOUBLE_LITERAL "double literal" %token DOUBLE_POSITIVE_LITERAL "double positive literal" %token DOUBLE_NEGATIVE_LITERAL "double negative literal" %token INTEGER_LITERAL "integer literal" %token INTEGER_POSITIVE_LITERAL "integer positive literal" %token INTEGER_NEGATIVE_LITERAL "integer negative literal" %token DECIMAL_LITERAL "decimal literal" %token DECIMAL_POSITIVE_LITERAL "decimal positive literal" %token DECIMAL_NEGATIVE_LITERAL "decimal negative literal" %token BOOLEAN_LITERAL "boolean literal" %token URI_LITERAL "URI literal" %token URI_LITERAL_BRACE "URI literal (" %token QNAME_LITERAL "QName literal" %token QNAME_LITERAL_BRACE "QName literal (" %token BLANK_LITERAL "blank node literal" %token IDENTIFIER "identifier" %type ConstructQuery DescribeQuery %type VarOrIRIrefList ArgListNoBraces ArgList %type ConstructTriples ConstructTriplesOpt %type ConstructTemplate OrderConditionList GroupConditionList %type HavingConditionList %type GraphNodeListNotEmpty SelectExpressionListTail %type ModifyTemplateList %type IriRefList %type ParamsOpt %type ExpressionList %type DataBlockValueList DataBlockValueListOpt DataBlockRowList DataBlockRowListOpt %type DatasetClauseList DatasetClauseListOpt %type VarList VarListOpt %type GroupClauseOpt HavingClauseOpt OrderClauseOpt %type GraphTemplate ModifyTemplate %type AdExOpExpressionListInner AdExOpExpressionListOuter AdExOpUnaryExpressionList AdExOpUnaryExpressionListOpt MuExOpUnaryExpressionList %type DatasetClause DefaultGraphClause NamedGraphClause %type GraphTriples %type TriplesSameSubject %type PropertyList PropertyListTailOpt PropertyListNotEmpty %type ObjectList ObjectTail Collection %type VarOrTerm Verb Object GraphNode TriplesNode %type BlankNodePropertyList %type TriplesBlock TriplesBlockOpt %type SelectQuery %type GroupGraphPattern SubSelect GroupGraphPatternSub %type GraphGraphPattern OptionalGraphPattern MinusGraphPattern %type GroupOrUnionGraphPattern GroupOrUnionGraphPatternList %type GraphPatternNotTriples %type GraphPatternListOpt GraphPatternList GraphPatternListFilter %type LetGraphPattern Bind ServiceGraphPattern %type WhereClause WhereClauseOpt %type InlineDataGraphPattern %type Expression ConditionalOrExpression ConditionalAndExpression %type RelationalExpression AdditiveExpression %type MultiplicativeExpression UnaryExpression %type BuiltInCall RegexExpression FunctionCall StringExpression %type DatetimeBuiltinAccessors DatetimeExtensions %type BrackettedExpression PrimaryExpression %type OrderCondition GroupCondition %type Filter Constraint HavingCondition %type AggregateExpression CountAggregateExpression SumAggregateExpression %type AvgAggregateExpression MinAggregateExpression MaxAggregateExpression %type CoalesceExpression GroupConcatAggregateExpression %type SampleAggregateExpression ExpressionOrStar %type GraphTerm IRIref RDFLiteral BlankNode %type VarOrIRIref %type IRIrefBrace SourceSelector %type NumericLiteral NumericLiteralUnsigned %type NumericLiteralPositive NumericLiteralNegative %type SeparatorOpt %type DataBlockValue %type Var VarName VarOrBadVarName SelectTerm AsVarOpt %type GraphRef GraphOrDefault OldGraphRef %type DistinctOpt %type DataBlockRow %type SolutionModifier %type LimitOffsetClausesOpt %type LimitClause OffsetClause %type SilentOpt %type GraphRefAll %type SelectClause SelectExpressionList %type InlineData InlineDataOneVar InlineDataFull DataBlock ValuesClauseOpt %type AdExOpUnaryExpression MuExOpUnaryExpression %destructor { if($$) rasqal_free_literal($$); } DOUBLE_LITERAL INTEGER_LITERAL DECIMAL_LITERAL DOUBLE_POSITIVE_LITERAL DOUBLE_NEGATIVE_LITERAL INTEGER_POSITIVE_LITERAL INTEGER_NEGATIVE_LITERAL DECIMAL_POSITIVE_LITERAL DECIMAL_NEGATIVE_LITERAL BOOLEAN_LITERAL %destructor { if($$) raptor_free_uri($$); } URI_LITERAL URI_LITERAL_BRACE %destructor { if($$) free_uri_applies($$); } GraphRefAll %destructor { if($$) RASQAL_FREE(char*, $$); } STRING LANGTAG QNAME_LITERAL QNAME_LITERAL_BRACE BLANK_LITERAL IDENTIFIER %destructor { if($$) raptor_free_sequence($$); } ConstructQuery DescribeQuery VarOrIRIrefList ArgListNoBraces ArgList ConstructTriples ConstructTriplesOpt ConstructTemplate OrderConditionList GroupConditionList HavingConditionList GraphNodeListNotEmpty SelectExpressionListTail ModifyTemplateList IriRefList ParamsOpt DataBlockValueList DataBlockValueListOpt DataBlockRowList DataBlockRowListOpt DatasetClauseList DatasetClauseListOpt VarList VarListOpt GroupClauseOpt HavingClauseOpt OrderClauseOpt GraphTemplate ModifyTemplate AdExOpExpressionListInner AdExOpExpressionListOuter AdExOpUnaryExpressionList AdExOpUnaryExpressionListOpt MuExOpUnaryExpressionList %destructor { if($$) rasqal_free_update_operation($$); } GraphTriples %destructor { if($$) rasqal_free_formula($$); } TriplesSameSubject PropertyList PropertyListTailOpt PropertyListNotEmpty ObjectList ObjectTail Collection VarOrTerm Verb Object GraphNode TriplesNode BlankNodePropertyList TriplesBlock TriplesBlockOpt %destructor { if($$) rasqal_free_graph_pattern($$); } SelectQuery GroupGraphPattern SubSelect GroupGraphPatternSub GraphGraphPattern OptionalGraphPattern MinusGraphPattern GroupOrUnionGraphPattern GroupOrUnionGraphPatternList GraphPatternNotTriples GraphPatternListOpt GraphPatternList GraphPatternListFilter LetGraphPattern Bind ServiceGraphPattern InlineDataGraphPattern %destructor { if($$) rasqal_free_expression($$); } Expression ConditionalOrExpression ConditionalAndExpression RelationalExpression AdditiveExpression MultiplicativeExpression UnaryExpression BuiltInCall RegexExpression FunctionCall DatetimeBuiltinAccessors DatetimeExtensions BrackettedExpression PrimaryExpression OrderCondition GroupCondition Filter Constraint HavingCondition AggregateExpression CountAggregateExpression SumAggregateExpression AvgAggregateExpression MinAggregateExpression MaxAggregateExpression CoalesceExpression GroupConcatAggregateExpression SampleAggregateExpression ExpressionOrStar %destructor { if($$) rasqal_free_literal($$); } GraphTerm IRIref RDFLiteral BlankNode DataBlockValue VarOrIRIref IRIrefBrace SourceSelector NumericLiteral NumericLiteralUnsigned NumericLiteralPositive NumericLiteralNegative SeparatorOpt %destructor { if($$) rasqal_free_variable($$); } Var VarName SelectTerm AsVarOpt %destructor { if($$) rasqal_free_data_graph($$); } DatasetClause DefaultGraphClause NamedGraphClause %destructor { if($$) rasqal_free_row($$); } DataBlockRow %destructor { if($$) rasqal_free_solution_modifier($$); } SolutionModifier %destructor { if($$) rasqal_free_projection($$); } SelectClause SelectExpressionList %destructor { if($$) rasqal_free_bindings($$); } InlineData InlineDataOneVar InlineDataFull DataBlock ValuesClauseOpt %destructor { if($$) free_op_expr($$); } AdExOpUnaryExpression MuExOpUnaryExpression %% /* Below here, grammar terms are numbered from * http://www.w3.org/TR/2010/WD-sparql11-query-20100601/ * except where noted */ /* NEW Grammar Token: parse both Query and Update in one */ Sparql: Query | Update ; /* SPARQL Query 1.1 Grammar: Query */ Query: Prologue ExplainOpt ReportFormat ValuesClauseOpt { if($4) rq->bindings = $4; } ; /* LAQRS */ ExplainOpt: EXPLAIN { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(sparql->experimental) rq->explain = 1; else { sparql_syntax_error(rq, "EXPLAIN can only used with LAQRS"); YYERROR; } } | { /* nothing to do */ } ; /* NEW Grammar Term pulled out of Query */ ReportFormat: SelectQuery { raptor_sequence* seq; rasqal_graph_pattern* where_gp; /* Query graph pattern is first GP inside sequence of sub-GPs */ seq = rasqal_graph_pattern_get_sub_graph_pattern_sequence($1); where_gp = (rasqal_graph_pattern*)raptor_sequence_delete_at(seq, 0); rasqal_query_store_select_query(rq, $1->projection, $1->data_graphs, where_gp, $1->modifier); $1->projection = NULL; $1->data_graphs = NULL; $1->modifier = NULL; rasqal_free_graph_pattern($1); } | ConstructQuery { rq->constructs = $1; rq->verb = RASQAL_QUERY_VERB_CONSTRUCT; } | DescribeQuery { rq->describes = $1; rq->verb = RASQAL_QUERY_VERB_DESCRIBE; } | AskQuery { rq->verb = RASQAL_QUERY_VERB_ASK; } ; /* SPARQL Update 1.1 Grammar: Update */ Update: Prologue UpdateOperation UpdateTailOpt ; UpdateTailOpt: ';' Update | ';' | /* empty */ ; UpdateOperation: DeleteQuery { rq->verb = RASQAL_QUERY_VERB_DELETE; } | InsertQuery { rq->verb = RASQAL_QUERY_VERB_INSERT; } | UpdateQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | ClearQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | CreateQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | DropQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | LoadQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | AddQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | MoveQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } | CopyQuery { rq->verb = RASQAL_QUERY_VERB_UPDATE; } ; /* SPARQL Grammar: Prologue */ Prologue: BaseDeclOpt PrefixDeclListOpt { /* nothing to do */ } ; /* SPARQL Grammar: BaseDecl */ BaseDeclOpt: BASE URI_LITERAL { rasqal_query_set_base_uri(rq, $2); rasqal_evaluation_context_set_base_uri(rq->eval_context, $2); } | /* empty */ { /* nothing to do */ } ; /* SPARQL Grammar: PrefixDecl renamed to include optional list */ PrefixDeclListOpt: PrefixDeclListOpt PREFIX IDENTIFIER URI_LITERAL { raptor_sequence *seq = rq->prefixes; unsigned const char* prefix_string = $3; size_t prefix_length = 0; if(prefix_string) prefix_length = strlen(RASQAL_GOOD_CAST(const char*, prefix_string)); if(raptor_namespaces_find_namespace(rq->namespaces, prefix_string, RASQAL_BAD_CAST(int, prefix_length))) { /* A prefix may be defined only once */ sparql_syntax_warning(rq, "PREFIX %s can be defined only once.", prefix_string ? RASQAL_GOOD_CAST(const char*, prefix_string) : ":"); RASQAL_FREE(char*, prefix_string); raptor_free_uri($4); } else { rasqal_prefix *p; p = rasqal_new_prefix(rq->world, prefix_string, $4); if(!p) YYERROR_MSG("PrefixDeclOpt: failed to create new prefix"); if(raptor_sequence_push(seq, p)) YYERROR_MSG("PrefixDeclOpt: cannot push prefix to seq"); if(rasqal_query_declare_prefix(rq, p)) { YYERROR_MSG("PrefixDeclOpt: cannot declare prefix"); } } } | /* empty */ { /* nothing to do, rq->prefixes already initialised */ } ; /* SPARQL Grammar: SelectQuery */ SelectQuery: SelectClause DatasetClauseListOpt WhereClause SolutionModifier { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql_scda) { sparql_syntax_error(rq, "SELECT can only be used with a SPARQL query"); YYERROR; } else { $$ = rasqal_new_select_graph_pattern(rq, $1, $2, $3, $4, NULL); } } ; /* SPARQL Grammar: SubSelect */ SubSelect: SelectClause WhereClause SolutionModifier ValuesClauseOpt { if($1 && $2 && $3) { $$ = rasqal_new_select_graph_pattern(rq, $1, /* data graphs */ NULL, $2, $3, $4); } else $$ = NULL; } /* SPARQL Grammar: SelectClause */ SelectClause: SELECT DISTINCT SelectExpressionList { $$ = $3; $$->distinct = 1; } | SELECT REDUCED SelectExpressionList { $$ = $3; $$->distinct = 2; } | SELECT SelectExpressionList { $$ = $2; } ; /* NEW Grammar Term pulled out of SelectClause * A list of SelectTerm OR a NULL list and a wildcard */ SelectExpressionList: SelectExpressionListTail { $$ = rasqal_new_projection(rq, $1, 0, 0); } | '*' { $$ = rasqal_new_projection(rq, NULL, /* wildcard */ 1, 0); } ; /* NEW Grammar Term pulled out of SelectClause * Non-empty list of SelectTerm with optional commas */ SelectExpressionListTail: SelectExpressionListTail SelectTerm { $$ = $1; if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("SelectExpressionListTail 1: sequence push failed"); } } | SelectExpressionListTail ',' SelectTerm { $$ = $1; if(raptor_sequence_push($$, $3)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("SelectExpressionListTail 2: sequence push failed"); } } | SelectTerm { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!$$) YYERROR_MSG("SelectExpressionListTail 3: failed to create sequence"); if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("SelectExpressionListTail 3: sequence push failed"); } } ; /* NEW Grammar Term pulled out of SelectClause * A variable (?x) or a select expression assigned to a name (x) with AS */ SelectTerm: Var { $$ = $1; } | '(' Expression AS VarOrBadVarName ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "SELECT ( expression ) AS Variable can only be used with SPARQL 1.1"); YYERROR; } else if($2 && $4) { if(rasqal_expression_mentions_variable($2, $4)) { sparql_query_error_full(rq, "Expression in SELECT ( expression ) AS %s contains the variable name '%s'", $4->name, $4->name); YYERROR; } else { $$ = $4; $$->expression = $2; } } } ; /* SPARQL 1.1 Grammar: [107] Aggregate - renamed for clarity */ /* Original definition: ( 'COUNT' '(' 'DISTINCT'? ( '*' | Expression ) ')' | 'SUM' ExprAggArg | 'MIN' ExprAggArg | 'MAX' ExprAggArg | 'AVG' ExprAggArg | 'SAMPLE' ExprAggArg | 'GROUP_CONCAT' '(' 'DISTINCT'? Expression ( ',' Expression )* ( ';' 'SEPARATOR' '=' String )? ')' ) where ExprAggArg is '(' 'DISTINCT'? Expression ')' */ AggregateExpression: CountAggregateExpression { $$ = $1; } | SumAggregateExpression { $$ = $1; } | AvgAggregateExpression { $$ = $1; } | MinAggregateExpression { $$ = $1; } | MaxAggregateExpression { $$ = $1; } | GroupConcatAggregateExpression { $$ = $1; } | SampleAggregateExpression { $$ = $1; } ; DistinctOpt: DISTINCT { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_query) { sparql_syntax_error(rq, "functions with DISTINCT can only be used with SPARQL 1.1"); YYERROR; } $$ = RASQAL_EXPR_FLAG_DISTINCT; } | /* empty */ { $$ = 0; } ; ExpressionOrStar: Expression { $$ = $1; } | '*' { $$ = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_VARSTAR); } ; CountAggregateExpression: COUNT '(' DistinctOpt ExpressionOrStar ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "COUNT() can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_COUNT, $4, NULL /* params */, $3); if(!$$) YYERROR_MSG("CountAggregateExpression: cannot create expr"); } } ; SumAggregateExpression: SUM '(' DistinctOpt Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "SUM() can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_SUM, $4, NULL /* params */, $3); if(!$$) YYERROR_MSG("SumAggregateExpression: cannot create expr"); } } ; AvgAggregateExpression: AVG '(' DistinctOpt Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "AVG() can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_AVG, $4, NULL /* params */, $3); if(!$$) YYERROR_MSG("AvgAggregateExpression: cannot create expr"); } } ; MinAggregateExpression: MIN '(' DistinctOpt Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "MIN() can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_MIN, $4, NULL /* params */, $3); if(!$$) YYERROR_MSG("MinAggregateExpression: cannot create expr"); } } ; MaxAggregateExpression: MAX '(' DistinctOpt Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "MAX() can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_MAX, $4, NULL /* params */, $3); if(!$$) YYERROR_MSG("MaxAggregateExpression: cannot create expr"); } } ; SeparatorOpt: ';' SEPARATOR EQ STRING { $$ = rasqal_new_string_literal(rq->world, $4, NULL /* language */, NULL /* dt uri */, NULL /* dt_qname */); } | /* empty */ { $$ = NULL; } ; /* NEW Grammar Term pulled out of [107] Aggregate * A comma-separated non-empty list of Expression */ ExpressionList: ExpressionList ',' Expression { $$ = $1; if(raptor_sequence_push($$, $3)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("ExpressionList 1: sequence push failed"); } } | Expression { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$$) YYERROR_MSG("ExpressionList 2: failed to create sequence"); if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("ExpressionList 2: sequence push failed"); } } ; GroupConcatAggregateExpression: GROUP_CONCAT '(' DistinctOpt ExpressionList SeparatorOpt ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "GROUP_CONCAT() can only be used with SPARQL 1.1"); YYERROR; } else { int flags = 0; if($3) flags |= RASQAL_EXPR_FLAG_DISTINCT; $$ = rasqal_new_group_concat_expression(rq->world, flags /* flags */, $4 /* args */, $5 /* separator */); if(!$$) YYERROR_MSG("GroupConcatAggregateExpression: cannot create expr"); } } ; SampleAggregateExpression: SAMPLE '(' DistinctOpt Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "SAMPLE() can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_aggregate_function_expression(rq->world, RASQAL_EXPR_SAMPLE, $4, NULL /* params */, $3); if(!$$) YYERROR_MSG("SampleAggregateExpression: cannot create expr"); } } ; /* SPARQL Grammar: ConstructQuery */ ConstructQuery: CONSTRUCT ConstructTemplate DatasetClauseListOpt WhereClause SolutionModifier { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql_scda) { sparql_syntax_error(rq, "CONSTRUCT can only be used with a SPARQL query"); YYERROR; } $$ = $2; if($3) rasqal_query_add_data_graphs(rq, $3); rq->query_graph_pattern = $4; if($5) rq->modifier = $5; } | CONSTRUCT DatasetClauseListOpt WHERE '{' ConstructTriples '}' SolutionModifier { rasqal_sparql_query_language* sparql; rasqal_graph_pattern* where_gp; raptor_sequence* seq = NULL; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql_scda) { sparql_syntax_error(rq, "CONSTRUCT can only be used with a SPARQL query"); YYERROR; } if($5) { int i; int size = raptor_sequence_size($5); seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); for(i = 0; i < size; i++) { rasqal_triple* t = (rasqal_triple*)raptor_sequence_get_at($5, i); t = rasqal_new_triple_from_triple(t); raptor_sequence_push(seq, t); } } where_gp = rasqal_new_basic_graph_pattern_from_triples(rq, seq); seq = NULL; if(!where_gp) YYERROR_MSG("ConstructQuery: cannot create graph pattern"); $$ = $5; if($2) rasqal_query_add_data_graphs(rq, $2); rq->query_graph_pattern = where_gp; if($7) rq->modifier = $7; } ; /* SPARQL Grammar: DescribeQuery */ DescribeQuery: DESCRIBE VarOrIRIrefList DatasetClauseListOpt WhereClauseOpt SolutionModifier { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql_scda) { sparql_syntax_error(rq, "DESCRIBE can only be used with a SPARQL query"); YYERROR; } $$ = $2; if($3) rasqal_query_add_data_graphs(rq, $3); rq->query_graph_pattern = $4; if($5) rq->modifier = $5; } | DESCRIBE '*' DatasetClauseListOpt WhereClauseOpt SolutionModifier { $$ = NULL; if($3) rasqal_query_add_data_graphs(rq, $3); rq->query_graph_pattern = $4; if($5) rq->modifier = $5; } ; /* NEW Grammar Term pulled out of [7] DescribeQuery */ VarOrIRIrefList: VarOrIRIrefList VarOrIRIref { $$ = $1; if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("VarOrIRIrefList 1: sequence push failed"); } } | VarOrIRIrefList ',' VarOrIRIref { $$ = $1; if(raptor_sequence_push($$, $3)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("VarOrIRIrefList 2: sequence push failed"); } } | VarOrIRIref { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); if(!$$) YYERROR_MSG("VarOrIRIrefList 3: cannot create seq"); if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("VarOrIRIrefList 3: sequence push failed"); } } ; /* SPARQL Grammar: AskQuery */ AskQuery: ASK DatasetClauseListOpt WhereClause { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql_scda) { sparql_syntax_error(rq, "ASK can only be used with a SPARQL query"); YYERROR; } if($2) rasqal_query_add_data_graphs(rq, $2); rq->query_graph_pattern = $3; } ; /* SPARQL Grammar: DatasetClause */ DatasetClause: FROM DefaultGraphClause { $$ = $2; } | FROM NamedGraphClause { $$ = $2; } ; /* SPARQL 1.1 Update (draft) */ GraphRef: GRAPH URI_LITERAL { $$ = $2; } ; /* LAQRS */ DeleteQuery: DELETE DatasetClauseList WhereClauseOpt { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE can only be used with a SPARQL 1.1 Update"); YYERROR; } /* LAQRS: experimental syntax */ sparql_syntax_warning(rq, "DELETE FROM ... WHERE ... is deprecated LAQRS syntax."); if($2) rasqal_query_add_data_graphs(rq, $2); rq->query_graph_pattern = $3; } | DELETE '{' ModifyTemplateList '}' WhereClause { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE can only be used with a SPARQL 1.1 Update"); YYERROR; } /* SPARQL 1.1 (Draft) update: * deleting via template + query - not inline atomic triples */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph_uri */, NULL /* document_uri */, NULL /* insert templates */, $3 /* delete templates */, $5 /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("DeleteQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("DeleteQuery: rasqal_query_add_update_operation failed"); } } | DELETE DATA '{' GraphTriples '}' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE can only be used with a SPARQL 1.1 Update"); YYERROR; } /* SPARQL 1.1 (Draft) update: * deleting inline triples - not inserting from graph URIs */ $4->type = RASQAL_UPDATE_TYPE_UPDATE; $4->delete_templates = $4->insert_templates; $4->insert_templates = NULL; $4->flags |= RASQAL_UPDATE_FLAGS_DATA; rasqal_query_add_update_operation(rq, $4); } | DELETE WHERE GroupGraphPattern { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; raptor_sequence* delete_templates = NULL; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DELETE WHERE { } can only be used with a SPARQL 1.1 Update"); YYERROR; } /* SPARQL 1.1 (Draft) update: * deleting via template - not inline atomic triples */ /* Turn GP into flattened triples */ if($3) { delete_templates = rasqal_graph_pattern_get_flattened_triples(rq, $3); rasqal_free_graph_pattern($3); $3 = NULL; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph_uri */, NULL /* document_uri */, NULL /* insert templates */, delete_templates /* delete templates */, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("DeleteQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("DeleteQuery: rasqal_query_add_update_operation failed"); } } ; /* SPARQL 1.1 Update (draft) */ GraphTriples: TriplesBlock { $$ = NULL; if($1) { $$ = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UNKNOWN, NULL /* graph_uri */, NULL /* document_uri */, $1->triples /* insert templates */, NULL /* delete templates */, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); $1->triples = NULL; rasqal_free_formula($1); } } | GRAPH URI_LITERAL '{' TriplesBlock '}' { $$ = NULL; if($4) { raptor_sequence* seq; seq = $4->triples; if($2) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, $2); $2 = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, seq, origin_literal); rasqal_free_literal(origin_literal); } $$ = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UNKNOWN, NULL /* graph uri */, NULL /* document uri */, seq /* insert templates */, NULL /* delete templates */, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); $4->triples = NULL; rasqal_free_formula($4); } } ; /* SPARQL 1.1 Update (draft) SS 4.1.3 */ GraphTemplate: GRAPH VarOrIRIref '{' ConstructTriples '}' { $$ = $4; if($2) { rasqal_triples_sequence_set_origin(NULL, $$, $2); rasqal_free_literal($2); $2 = NULL; } } ; /* SPARQL 1.1 Update (draft) SS 4.1.3 */ ModifyTemplate: ConstructTriples { $$ = $1; } | GraphTemplate { $$ = $1; } ; /* SPARQL 1.1 Update (draft) */ ModifyTemplateList: ModifyTemplateList ModifyTemplate { $$ = $1; if($2) { if(raptor_sequence_join($$, $2)) { raptor_free_sequence($2); raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("ModifyTemplateList: sequence join failed"); } raptor_free_sequence($2); } } | ModifyTemplate { $$ = $1; } ; /* SPARQL 1.1 Update (draft) / LAQRS */ InsertQuery: INSERT DatasetClauseList WhereClauseOpt { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "INSERT can only be used with a SPARQL 1.1 Update"); YYERROR; } /* LAQRS: experimental syntax */ sparql_syntax_warning(rq, "INSERT FROM ... WHERE ... is deprecated LAQRS syntax."); if($2) rasqal_query_add_data_graphs(rq, $2); rq->query_graph_pattern = $3; } | INSERT '{' ModifyTemplateList '}' WhereClauseOpt { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "INSERT can only be used with a SPARQL 1.1 Update"); YYERROR; } /* inserting via template + query - not inline atomic triples */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph_uri */, NULL /* document_uri */, $3 /* insert templates */, NULL /* delete templates */, $5 /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("InsertQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("InsertQuery: rasqal_query_add_update_operation failed"); } } | INSERT DATA '{' GraphTriples '}' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "INSERT DATA can only be used with a SPARQL 1.1 Update"); YYERROR; } /* inserting inline atomic triples (no variables) - not via template */ $4->type = RASQAL_UPDATE_TYPE_UPDATE; $4->flags |= RASQAL_UPDATE_FLAGS_DATA; rasqal_query_add_update_operation(rq, $4); } ; UpdateQuery: WITH URI_LITERAL DELETE '{' ModifyTemplateList '}' INSERT '{' ModifyTemplateList '}' WhereClauseOpt { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } if($2) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, $2); $2 = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, $9, origin_literal); rasqal_triples_sequence_set_origin(/* dest */ NULL, $5, origin_literal); rasqal_free_literal(origin_literal); } /* after this $5, $9 and $12 are owned by update */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph uri */, NULL /* document uri */, $9 /* insert templates */, $5 /* delete templates */, $11 /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("UpdateQuery 1: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("UpdateQuery 1: rasqal_query_add_update_operation failed"); } } | WITH URI_LITERAL DELETE '{' ModifyTemplateList '}' WhereClauseOpt { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } if($2) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, $2); $2 = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, $5, origin_literal); rasqal_free_literal(origin_literal); } /* after this $5 and $7 are owned by update */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph uri */, NULL /* document uri */, NULL /* insert templates */, $5 /* delete templates */, $7 /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("UpdateQuery 2: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("UpdateQuery 2: rasqal_query_add_update_operation failed"); } } | WITH URI_LITERAL INSERT '{' ModifyTemplateList '}' WhereClauseOpt { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } if($2) { rasqal_literal* origin_literal; origin_literal = rasqal_new_uri_literal(rq->world, $2); $2 = NULL; rasqal_triples_sequence_set_origin(/* dest */ NULL, $5, origin_literal); rasqal_free_literal(origin_literal); } /* after this $5 and $7 are owned by update */ update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_UPDATE, NULL /* graph uri */, NULL /* document uri */, $5 /* insert templates */, NULL /* delete templates */, $7 /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("UpdateQuery 3: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("UpdateQuery 3: rasqal_query_add_update_operation failed"); } } | WITH URI_LITERAL INSERT DATA '{' GraphTriples '}' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "WITH can only be used with a SPARQL 1.1 Update"); YYERROR; } /* inserting inline atomic triples (no variables) - not via template */ $6->graph_uri = $2; /* graph uri */ $6->type = RASQAL_UPDATE_TYPE_UPDATE; $6->flags |= RASQAL_UPDATE_FLAGS_DATA; rasqal_query_add_update_operation(rq, $6); } ; /* SPARQL 1.1 Update token */ GraphRefAll: GraphRef { $$ = new_uri_applies($1, RASQAL_UPDATE_GRAPH_ONE); } | DEFAULT { $$ = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_DEFAULT); } | NAMED { $$ = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_NAMED); } | ALL { $$ = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_ALL); } | GRAPH DEFAULT { /* Early draft syntax - deprecated */ sparql_syntax_warning(rq, "CLEAR GRAPH DEFAULT is replaced by CLEAR DEFAULT in later SPARQL 1.1 drafts"); $$ = new_uri_applies(NULL, RASQAL_UPDATE_GRAPH_DEFAULT); } ; /* SPARQL 1.1 Update (draft) / LAQRS */ ClearQuery: CLEAR SilentOpt GraphRefAll { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CLEAR (SILENT) DEFAULT | NAMED | ALL can only be used with a SPARQL 1.1 Update"); YYERROR; } if($3) { update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CLEAR, $3->uri ? raptor_uri_copy($3->uri) : NULL /* graph uri or NULL */, NULL /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, $3->applies /* applies */); free_uri_applies($3); $3 = NULL; if(!update) { YYERROR_MSG("ClearQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("ClearQuery: rasqal_query_add_update_operation failed"); } } } | CLEAR { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CLEAR can only be used with a SPARQL 1.1 Update"); YYERROR; } /* Early draft syntax - deprecated */ sparql_syntax_warning(rq, "CLEAR is replaced by CLEAR DEFAULT in later SPARQL 1.1 drafts"); update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CLEAR, NULL /* graph uri */, NULL /* document uri */, NULL, NULL, NULL /* where */, 0 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("ClearQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("ClearQuery: rasqal_query_add_update_operation failed"); } } ; /* Optional SILENT flag pulled out of SPARQL 1.1 Load ... Copy */ SilentOpt: SILENT { $$ = RASQAL_UPDATE_FLAGS_SILENT; } | /* empty */ { $$ = 0; } ; /* SPARQL 1.1 Update (draft) / LAQRS */ CreateQuery: CREATE SilentOpt URI_LITERAL { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CREATE (SILENT) can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CREATE, $3 /* graph uri */, NULL /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("CreateQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("CreateQuery: rasqal_query_add_update_operation failed"); } } | CREATE SilentOpt GraphRef { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "CREATE (SILENT) GRAPH can only be used with a SPARQL 1.1 Update"); YYERROR; } /* Early draft syntax - deprecated */ sparql_syntax_warning(rq, "CREATE (SILENT) GRAPH is replaced by CREATE (SILENT) in later SPARQL 1.1 drafts"); update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_CREATE, $3 /* graph uri */, NULL /* document uri */, NULL, NULL, NULL /*where */, RASQAL_UPDATE_FLAGS_SILENT /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("CreateQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("CreateQuery: rasqal_query_add_update_operation failed"); } } ; /* SPARQL 1.1 Update (draft) / LAQRS */ DropQuery: DROP SilentOpt GraphRefAll { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "DROP (SILENT) DEFAULT | NAMED | ALL can only be used with a SPARQL 1.1 Update"); YYERROR; } if($3) { update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_DROP, $3->uri ? raptor_uri_copy($3->uri) : NULL /* graph uri or NULL */, NULL /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, $3->applies /* applies */); free_uri_applies($3); $3 = NULL; if(!update) { YYERROR_MSG("DropQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("DropQuery: rasqal_query_add_update_operation failed"); } } } ; /* NEW Grammar Term pulled out of SPARQL 1.1 draft [x] Load */ IriRefList: IriRefList URI_LITERAL { $$ = $1; if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("IriRefList 1: sequence push failed"); } } | URI_LITERAL { $$ = raptor_new_sequence((raptor_data_free_handler)raptor_free_uri, (raptor_data_print_handler)raptor_uri_print); if(!$$) { if($1) raptor_free_uri($1); YYERROR_MSG("IriRefList 2: cannot create sequence"); } if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("IriRefList 2: sequence push failed"); } } ; /* SPARQL 1.1 token GraphOrDefault */ GraphOrDefault: DEFAULT { $$ = NULL; } | URI_LITERAL { $$ = $1; } ; OldGraphRef: GraphRef { $$ = $1; } | URI_LITERAL { /* Early draft syntax allowed a list of URIs - deprecated */ sparql_syntax_warning(rq, "LOAD INTO is replaced by LOAD INTO GRAPH in later SPARQL 1.1 drafts"); $$ = $1; } | DEFAULT { /* Early draft syntax allowed a list of URIs - deprecated */ sparql_syntax_warning(rq, "LOAD INTO DEFAULT is replaced by LOAD in later SPARQL 1.1 drafts"); $$ = NULL; } ; /* SPARQL 1.1 Update (draft) */ LoadQuery: LOAD SilentOpt URI_LITERAL { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "LOAD can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_LOAD, NULL /* graph uri */, $3 /* document uri */, NULL, NULL, NULL /* where */, $2 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("LoadQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("LoadQuery: rasqal_query_add_update_operation failed"); } } | LOAD SilentOpt IriRefList INTO OldGraphRef { rasqal_sparql_query_language* sparql; int i; raptor_uri* doc_uri; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "LOAD INTO GRAPH / DEFAULT can only be used with a SPARQL 1.1 Update"); YYERROR; } for(i = 0; (doc_uri = (raptor_uri*)raptor_sequence_get_at($3, i)); i++) { rasqal_update_operation* update; update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_LOAD, $5 ? raptor_uri_copy($5) : NULL /* graph uri */, raptor_uri_copy(doc_uri) /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("LoadQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("LoadQuery: rasqal_query_add_update_operation failed"); } if(i == 1) /* Early draft syntax allowed a list of URIs - deprecated */ sparql_syntax_warning(rq, "LOAD INTO / DEFAULT is replaced by LOAD INTO GRAPH or LOAD in later SPARQL 1.1 drafts"); } raptor_free_sequence($3); if($5) raptor_free_uri($5); } ; /* SPARQL 1.1 Update (draft) */ AddQuery: ADD SilentOpt GraphOrDefault TO GraphOrDefault { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "ADD (SILENT) TO can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_ADD, $3 /* graph uri or NULL */, $5 /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("AddQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("AddQuery: rasqal_query_add_update_operation failed"); } } ; /* SPARQL 1.1 Update (draft) */ MoveQuery: MOVE SilentOpt GraphOrDefault TO GraphOrDefault { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "MOVE (SILENT) TO can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_MOVE, $3 /* graph uri or NULL */, $5 /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("MoveQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("MoveQuery: rasqal_query_add_update_operation failed"); } } ; /* SPARQL 1.1 Update (draft) */ CopyQuery: COPY SilentOpt GraphOrDefault TO GraphOrDefault { rasqal_sparql_query_language* sparql; rasqal_update_operation* update; sparql = (rasqal_sparql_query_language*)(rq->context); if(!sparql->sparql11_update) { sparql_syntax_error(rq, "COPY (SILENT) TO can only be used with a SPARQL 1.1 Update"); YYERROR; } update = rasqal_new_update_operation(RASQAL_UPDATE_TYPE_COPY, $3 /* graph uri or NULL */, $5 /* document uri */, NULL, NULL, NULL /*where */, $2 /* flags */, RASQAL_UPDATE_GRAPH_ONE /* applies */); if(!update) { YYERROR_MSG("CopyQuery: rasqal_new_update_operation failed"); } else { if(rasqal_query_add_update_operation(rq, update)) YYERROR_MSG("CopyQuery: rasqal_query_add_update_operation failed"); } } ; /* SPARQL Grammar: DatasetClause */ DatasetClauseList: DatasetClauseList DatasetClause { $$ = $1; if($1 && $2) raptor_sequence_push($1, $2); } | DatasetClause { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, (raptor_data_print_handler)rasqal_data_graph_print); if($$ && $1) raptor_sequence_push($$, $1); } ; DatasetClauseListOpt: DatasetClauseList { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* SPARQL Grammar: DefaultGraphClause */ DefaultGraphClause: SourceSelector { if($1) { raptor_uri* uri = rasqal_literal_as_uri($1); rasqal_data_graph* dg; dg = rasqal_new_data_graph_from_uri(rq->world, uri, NULL, RASQAL_DATA_GRAPH_BACKGROUND, NULL, NULL, NULL); if(!dg) { rasqal_free_literal($1); YYERROR_MSG("DefaultGraphClause: rasqal_query_new_data_graph_from_uri() failed"); } rasqal_free_literal($1); $$ = dg; } else $$ = NULL; } ; /* SPARQL Grammar: NamedGraphClause */ NamedGraphClause: NAMED SourceSelector { if($2) { raptor_uri* uri = rasqal_literal_as_uri($2); rasqal_data_graph* dg; dg = rasqal_new_data_graph_from_uri(rq->world, uri, uri, RASQAL_DATA_GRAPH_NAMED, NULL, NULL, NULL); if(!dg) { rasqal_free_literal($2); YYERROR_MSG("NamedGraphClause: rasqal_query_new_data_graph_from_uri() failed"); } rasqal_free_literal($2); $$ = dg; } else $$ = NULL; } ; /* SPARQL Grammar: SourceSelector */ SourceSelector: IRIref { $$ = $1; } ; /* SPARQL 1.1 Grammar: WhereClause */ WhereClause: WHERE GroupGraphPattern { $$ = $2; } | GroupGraphPattern { $$ = $1; } ; /* NEW Grammar Term pulled out of DescribeQuery */ WhereClauseOpt: WhereClause { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* SPARQL 1.1 Grammar: [18] SolutionModifier */ SolutionModifier: GroupClauseOpt HavingClauseOpt OrderClauseOpt LimitOffsetClausesOpt { $$ = rasqal_new_solution_modifier(rq, /* order_conditions */ $3, /* group_conditions */ $1, /* having_conditions */ $2, /* limit */ $4[0], /* offset */ $4[1]); } ; /* NEW Grammar Term pulled out of SPARQL 1.1 [19] GroupClauseOpt */ GroupConditionList: GroupConditionList GroupCondition { $$ = $1; if($2) if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("GroupConditionList 1: sequence push failed"); } } | GroupCondition { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$$) { if($1) rasqal_free_expression($1); YYERROR_MSG("GroupConditionList 2: cannot create sequence"); } if($1) if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("GroupConditionList 2: sequence push failed"); } } ; /* NEW Grammar Term pulled out of SPARQL 1.1 Grammar: [] GroupCondition */ AsVarOpt: AS Var { $$ = $2; } | /* empty */ { $$ = NULL; } ; /* SPARQL 1.1 Grammar: [] GroupCondition */ GroupCondition: BuiltInCall { $$ = $1; } | FunctionCall { $$ = $1; } | '(' Expression AsVarOpt ')' { rasqal_literal* l; $$ = $2; if($3) { if(rasqal_expression_mentions_variable($$, $3)) { sparql_query_error_full(rq, "Expression in GROUP BY ( expression ) AS %s contains the variable name '%s'", $3->name, $3->name); } else { /* Expression AS Variable */ $3->expression = $$; $$ = NULL; l = rasqal_new_variable_literal(rq->world, $3); if(!l) YYERROR_MSG("GroupCondition 4: cannot create variable literal"); $3 = NULL; $$ = rasqal_new_literal_expression(rq->world, l); if(!$$) YYERROR_MSG("GroupCondition 4: cannot create variable literal expression"); } } } | Var { rasqal_literal* l; l = rasqal_new_variable_literal(rq->world, $1); if(!l) YYERROR_MSG("GroupCondition 5: cannot create lit"); $$ = rasqal_new_literal_expression(rq->world, l); if(!$$) YYERROR_MSG("GroupCondition 5: cannot create lit expr"); } ; /* SPARQL 1.1 Grammar: [19] GroupClause renamed for clarity */ GroupClauseOpt: GROUP BY GroupConditionList { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "GROUP BY can only be used with SPARQL 1.1"); YYERROR; } else $$ = $3; } | /* empty */ { $$ = NULL; } ; /* SPARQL 1.1 [22] HavingCondition */ HavingCondition: Constraint { $$ = $1; } ; /* NEW Grammar Term pulled out of SPARQL 1.1 [19] HavingClauseOpt */ HavingConditionList: HavingConditionList HavingCondition { $$ = $1; if($2) if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("HavingConditionList 1: sequence push failed"); } } | HavingCondition { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$$) { if($1) rasqal_free_expression($1); YYERROR_MSG("HavingConditionList 2: cannot create sequence"); } if($1) if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("HavingConditionList 2: sequence push failed"); } } ; /* SPARQL 1.1 Grammar: [19] HavingClause renamed for clarity */ HavingClauseOpt: HAVING HavingConditionList { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "HAVING can only be used with SPARQL 1.1"); YYERROR; } else $$ = $2; } | /* empty */ { $$ = NULL; } ; /* SPARQL Grammar: LimitOffsetClauses */ LimitOffsetClausesOpt: LimitClause OffsetClause { $$[0] = $1; $$[1] = $2; } | OffsetClause LimitClause { $$[0] = $2; $$[1] = $1; } | LimitClause { $$[0] = $1; $$[1] = -1; } | OffsetClause { $$[0] = -1; $$[1] = $1; } | /* empty */ { $$[0] = -1; $$[1] = -1; } ; /* SPARQL Grammar: OrderClause - remained for clarity */ OrderClauseOpt: ORDER BY OrderConditionList { $$ = $3; } | /* empty */ { $$ = NULL; } ; /* NEW Grammar Term pulled out of [16] OrderClauseOpt */ OrderConditionList: OrderConditionList OrderCondition { $$ = $1; if($2) if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("OrderConditionList 1: sequence push failed"); } } | OrderCondition { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$$) { if($1) rasqal_free_expression($1); YYERROR_MSG("OrderConditionList 2: cannot create sequence"); } if($1) if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("OrderConditionList 2: sequence push failed"); } } ; /* SPARQL Grammar: OrderCondition */ OrderCondition: ASC BrackettedExpression { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, $2); if(!$$) YYERROR_MSG("OrderCondition 1: cannot create expr"); } | DESC BrackettedExpression { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_DESC, $2); if(!$$) YYERROR_MSG("OrderCondition 2: cannot create expr"); } | FunctionCall { /* The direction of ordering is ascending by default */ $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, $1); if(!$$) YYERROR_MSG("OrderCondition 3: cannot create expr"); } | Var { rasqal_literal* l; rasqal_expression *e; l = rasqal_new_variable_literal(rq->world, $1); if(!l) YYERROR_MSG("OrderCondition 4: cannot create lit"); e = rasqal_new_literal_expression(rq->world, l); if(!e) YYERROR_MSG("OrderCondition 4: cannot create lit expr"); /* The direction of ordering is ascending by default */ $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, e); if(!$$) YYERROR_MSG("OrderCondition 1: cannot create expr"); } | BrackettedExpression { /* The direction of ordering is ascending by default */ $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, $1); if(!$$) YYERROR_MSG("OrderCondition 5: cannot create expr"); } | BuiltInCall { /* The direction of ordering is ascending by default */ $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ORDER_COND_ASC, $1); if(!$$) YYERROR_MSG("OrderCondition 6: cannot create expr"); } ; /* SPARQL Grammar: LimitClause - remained for clarity */ LimitClause: LIMIT INTEGER_LITERAL { $$ = -1; if($2 != NULL) { $$ = $2->value.integer; rasqal_free_literal($2); } } ; /* SPARQL Grammar: OffsetClause - remained for clarity */ OffsetClause: OFFSET INTEGER_LITERAL { $$ = -1; if($2 != NULL) { $$ = $2->value.integer; rasqal_free_literal($2); } } ; /* SPARQL Grammar: ValuesClause renamed for clarity */ ValuesClauseOpt: VALUES DataBlock { $$ = $2; } | /* empty */ { $$ = NULL; } ; /* NEW Grammar Term pulled out of InlineDataFull */ VarListOpt: VarList { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* NEW Grammar Term pulled out of InlineDataFull */ VarList: VarList Var { $$ = $1; if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("VarList 1: sequence push failed"); } } | Var { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!$$) YYERROR_MSG("VarList 2: cannot create seq"); if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("VarList 3: sequence push failed"); } } ; /* NEW Grammar Term pulled out of InlineDataFull * Maybe empty list of rows of '(' DataBlockValue* ')' */ DataBlockRowListOpt: DataBlockRowList { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* NEW Grammar Term pulled out of InlineDataFull * Non-empty list of rows of '(' DataBlockValue* ')' */ DataBlockRowList: DataBlockRowList DataBlockRow { $$ = $1; if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("DataBlockRowList 1: sequence push failed"); } else { int size = raptor_sequence_size($$); $2->offset = size-1; } } | DataBlockRow { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(!$$) { if($1) rasqal_free_row($1); YYERROR_MSG("DataBlockRowList 2: cannot create sequence"); } if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("DataBlockRowList 2: sequence push failed"); } } ; /* NEW Grammar Term pulled out of BindingsClause * Row of '(' DataBlockValue* ')' */ DataBlockRow: '(' DataBlockValueList ')' { $$ = NULL; if($2) { int size; rasqal_row* row; int i; size = raptor_sequence_size($2); row = rasqal_new_row_for_size(rq->world, size); if(!row) { YYERROR_MSG("DataBlockRow: cannot create row"); } else { for(i = 0; i < size; i++) { rasqal_literal* value = (rasqal_literal*)raptor_sequence_get_at($2, i); rasqal_row_set_value_at(row, i, value); } } raptor_free_sequence($2); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("DataBlockRow returned: "); rasqal_row_print(row, stderr); fputc('\n', stderr); #endif $$ = row; } } | '(' ')' { $$ = NULL; } ; /* NEW Grammar Term pulled out of InlineDataFull */ DataBlockValueList: DataBlockValueList DataBlockValue { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("DataBlockValue 1 value: "); rasqal_literal_print($2, stderr); fputc('\n', stderr); #endif $$ = $1; if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("IriRefList 1: sequence push failed"); } } | DataBlockValue { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("DataBlockValue 2 value: "); rasqal_literal_print($1, stderr); fputc('\n', stderr); #endif $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_literal, (raptor_data_print_handler)rasqal_literal_print); if(!$$) { if($1) rasqal_free_literal($1); YYERROR_MSG("IriRefList 2: cannot create sequence"); } if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("IriRefList 2: sequence push failed"); } } ; RDFLiteral: STRING { $$ = rasqal_new_string_literal(rq->world, $1, NULL /* language */, NULL /* dt uri */, NULL /* dt_qname */); } | STRING LANGTAG { $$ = rasqal_new_string_literal(rq->world, $1, RASQAL_GOOD_CAST(const char*, $2), NULL /* dt uri */, NULL /* dt_qname */); } | STRING HATHAT IRIref { raptor_uri* dt_uri = raptor_uri_copy(rasqal_literal_as_uri($3)); $$ = rasqal_new_string_literal(rq->world, $1, NULL /* language */, dt_uri, NULL /* dt_qname */); rasqal_free_literal($3); } | NumericLiteral HATHAT IRIref { if($1) { raptor_uri* dt_uri = raptor_uri_copy(rasqal_literal_as_uri($3)); const unsigned char *str = $1->string; $1->string = NULL; $$ = rasqal_new_string_literal(rq->world, str, NULL /* language */, dt_uri, NULL /* dt_qname */); } rasqal_free_literal($3); rasqal_free_literal($1); } ; /* SPARQL Grammar: DataBlockValue */ DataBlockValue: IRIref { $$ = $1; } | RDFLiteral { $$ = $1; } | NumericLiteral { $$ = $1; } | BOOLEAN_LITERAL { $$ = $1; } | UNDEF { $$ = NULL; } ; /* SPARQL Grammar: GroupGraphPattern * TriplesBlockOpt: formula or NULL (on success or error) * GraphPatternListOpt: always 1 Group GP or NULL (on error) */ GroupGraphPattern: '{' SubSelect '}' { $$ = $2; } | '{' GroupGraphPatternSub '}' { $$ = $2; } ; /* SPARQL Grammar: GroupGraphPatternSub * TriplesBlockOpt: formula or NULL (on success or error) * GraphPatternListOpt: always 1 Group GP or NULL (on error) */ GroupGraphPatternSub: TriplesBlockOpt GraphPatternListOpt { rasqal_graph_pattern *formula_gp = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GroupGraphPattern\n TriplesBlockOpt="); if($2) rasqal_formula_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", GraphpatternListOpt="); if($2) rasqal_graph_pattern_print($2, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif if(!$1 && !$2) { $$ = rasqal_new_2_group_graph_pattern(rq, NULL, NULL); if(!$$) YYERROR_MSG("GroupGraphPattern: cannot create group gp"); } else { if($1) { formula_gp = rasqal_new_basic_graph_pattern_from_formula(rq, $1); if(!formula_gp) { if($2) rasqal_free_graph_pattern($2); YYERROR_MSG("GroupGraphPattern: cannot create formula_gp"); } } if($2) { $$ = $2; if(formula_gp && raptor_sequence_shift($$->graph_patterns, formula_gp)) { rasqal_free_graph_pattern($$); $$ = NULL; YYERROR_MSG("GroupGraphPattern: sequence push failed"); } } else $$ = formula_gp; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after graph pattern="); if($$) rasqal_graph_pattern_print($$, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } ; /* Pulled out of SPARQL Grammar: GroupGraphPattern */ TriplesBlockOpt: TriplesBlock { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesBlockOpt 1\n TriplesBlock="); if($1) rasqal_formula_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif $$ = $1; } | /* empty */ { $$ = NULL; } ; /* Pulled out of SPARQL Grammar: GroupGraphPattern * GraphPatternListOpt: always 1 Group GP or NULL * GraphPatternList: always 1 Group GP or NULL (on error) * * Result: always 1 Group GP or NULL (on error) */ GraphPatternListOpt: GraphPatternListOpt GraphPatternList { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternListOpt\n GraphPatternListOpt="); if($1) rasqal_graph_pattern_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", GraphPatternList="); if($2) rasqal_graph_pattern_print($2, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif $$ = ($1 ? $1 : $2); if($1 && $2) { $$ = $1; if(rasqal_graph_patterns_join($$, $2)) { rasqal_free_graph_pattern($$); rasqal_free_graph_pattern($2); $$ = NULL; YYERROR_MSG("GraphPatternListOpt: sequence join failed"); } rasqal_free_graph_pattern($2); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after grouping graph pattern="); if($$) rasqal_graph_pattern_print($$, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } | GraphPatternList { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* Pulled out of SPARQL Grammar: GroupGraphPattern * GraphPatternListFilter: always 1 GP or NULL (on error) * TriplesBlockOpt: formula or NULL (on success or error) * * Result: always 1 Group GP or NULL (on success or error) */ GraphPatternList: GraphPatternListFilter DotOptional TriplesBlockOpt { rasqal_graph_pattern *formula_gp = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternList\n GraphPatternListFilter="); if($1) rasqal_graph_pattern_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", TriplesBlockOpt="); if($3) rasqal_formula_print($3, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif if($3) { formula_gp = rasqal_new_basic_graph_pattern_from_formula(rq, $3); if(!formula_gp) { if($1) rasqal_free_graph_pattern($1); YYERROR_MSG("GraphPatternList: cannot create formula_gp"); } } $$ = rasqal_new_2_group_graph_pattern(rq, $1, formula_gp); if(!$$) YYERROR_MSG("GraphPatternList: cannot create sequence"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after graph pattern="); if($$) rasqal_graph_pattern_print($$, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } ; /* Pulled out of SPARQL Grammar: GroupGraphPattern * GraphPatternNotTriples: always 1 GP or NULL (on error) * * Result: always 1 GP or NULL (on error) */ GraphPatternListFilter: GraphPatternNotTriples { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternListFilter 1\n GraphPatternNotTriples="); if($1) rasqal_graph_pattern_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif $$ = $1; } | Filter { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphPatternListFilter 2\n Filter="); if($1) rasqal_expression_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif $$ = rasqal_new_filter_graph_pattern(rq, $1); if(!$$) YYERROR_MSG("GraphPatternListFilter 2: cannot create graph pattern"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after graph pattern="); if($$) rasqal_graph_pattern_print($$, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } ; /* NEW Grammar Term */ DotOptional: '.' | /* empty */ ; /* SPARQL Grammar: TriplesBlock */ TriplesBlock: TriplesSameSubject '.' TriplesBlockOpt { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesBlock\n TriplesSameSubject="); if($1) rasqal_formula_print($1, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, ", TriplesBlockOpt="); if($3) rasqal_formula_print($3, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n", DEBUG_FH); #endif $$ = ($1 ? $1 : $3); if($1 && $3) { /* $1 and $3 are freed as necessary */ $$ = rasqal_formula_join($1, $3); if(!$1) YYERROR_MSG("TriplesBlock: formula join failed"); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after joining formula="); rasqal_formula_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } | TriplesSameSubject { $$ = $1; } ; /* SPARQL Grammar: GraphPatternNotTriples */ GraphPatternNotTriples: GroupOrUnionGraphPattern { $$ = $1; } | OptionalGraphPattern { $$ = $1; } | MinusGraphPattern { $$ = $1; } | GraphGraphPattern { $$ = $1; } | ServiceGraphPattern { $$ = $1; } | LetGraphPattern { $$ = $1; } | Bind { $$ = $1; } | InlineDataGraphPattern { $$ = $1; } ; /* SPARQL Grammar: OptionalGraphPattern */ OptionalGraphPattern: OPTIONAL GroupGraphPattern { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "PatternElementForms 4\n graphpattern="); if($2) rasqal_graph_pattern_print($2, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif $$ = NULL; if($2) { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { rasqal_free_graph_pattern($2); YYERROR_MSG("OptionalGraphPattern 1: cannot create sequence"); } else { if(raptor_sequence_push(seq, $2)) { raptor_free_sequence(seq); YYERROR_MSG("OptionalGraphPattern 2: sequence push failed"); } else { $$ = rasqal_new_graph_pattern_from_sequence(rq, seq, RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL); if(!$$) YYERROR_MSG("OptionalGraphPattern: cannot create graph pattern"); } } } } ; /* SPARQL Grammar: GraphGraphPattern */ GraphGraphPattern: GRAPH VarOrIRIref GroupGraphPattern { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphGraphPattern 2\n varoruri="); rasqal_literal_print($2, DEBUG_FH); fprintf(DEBUG_FH, ", graphpattern="); if($3) rasqal_graph_pattern_print($3, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif if($3) { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { rasqal_free_graph_pattern($3); YYERROR_MSG("GraphGraphPattern 1: cannot create sequence"); } else { if(raptor_sequence_push(seq, $3)) { raptor_free_sequence(seq); YYERROR_MSG("GraphGraphPattern 2: sequence push failed"); } else { $$ = rasqal_new_graph_pattern_from_sequence(rq, seq, RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH); if(!$$) YYERROR_MSG("GraphGraphPattern: cannot create graph pattern"); else rasqal_graph_pattern_set_origin($$, $2); } } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphGraphPattern\n graphpattern="); rasqal_graph_pattern_print($$, DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif rasqal_free_literal($2); } ; /* SPARQL Grammar: ServiceGraphPattern */ ServiceGraphPattern: SERVICE SilentOpt VarOrIRIref GroupGraphPattern { $$ = rasqal_new_single_graph_pattern(rq, RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE, $4); if($$) { $$->silent = ($2 & RASQAL_UPDATE_FLAGS_SILENT) ? 1 : 0; $$->origin = $3; $3 = NULL; } else if($3) rasqal_free_literal($3); } ; /* SPARQL 1.1: BIND (expression AS ?Var ) . */ Bind: BIND '(' Expression AS Var ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if($3 && $5) { if(!sparql->sparql11_query) { sparql_syntax_error(rq, "BIND can only be used with SPARQL 1.1"); YYERROR; } else { $$ = rasqal_new_let_graph_pattern(rq, $5, $3); } } else $$ = NULL; } ; /* SPARQL 1.1: InlineData */ InlineData: VALUES DataBlock { $$ = $2; } ; /* SPARQL 1.1: InlineData merged with InlineDataOneVar and InlineDataFull */ DataBlock: InlineDataOneVar { $$ = $1; } | InlineDataFull { $$ = $1; } ; /* SPARQL 1.1: InlineDataOneVar */ InlineDataOneVar: Var '{' DataBlockValueListOpt '}' { $$ = rasqal_new_bindings_from_var_values(rq, $1, $3); } ; /* Pulled out of InlineDataOneVar */ DataBlockValueListOpt: DataBlockValueList { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* SPARQL 1.1: InlineDataFull * ( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | NIL )* '}' * and since NIL = '(' ')' with whitespace and VarList handles Vars* etc. * = '(' Var* ')' '{' ( '(' DataBlockValue* ')')* '}' * = '(' VarListOpt ')' '{' DataBlockRowListOpt '}' * * DataBlockRowListOpt: ( '(' DataBlockValue* ')')* * */ InlineDataFull: '(' VarListOpt ')' '{' DataBlockRowListOpt '}' { if($2) { $$ = rasqal_new_bindings(rq, $2, $5); if(!$$) YYERROR_MSG("InlineDataFull: cannot create bindings"); } else { if($5) raptor_free_sequence($5); $$ = NULL; } } ; InlineDataGraphPattern: InlineData { $$ = rasqal_new_values_graph_pattern(rq, $1); if(!$$) YYERROR_MSG("InlineDataGraphPattern: cannot create gp"); } ; /* SPARQL Grammar: MinusGraphPattern */ MinusGraphPattern: MINUS GroupGraphPattern { $$ = rasqal_new_single_graph_pattern(rq, RASQAL_GRAPH_PATTERN_OPERATOR_MINUS, $2); } ; /* SPARQL Grammar: GroupOrUnionGraphPattern */ GroupOrUnionGraphPattern: GroupGraphPattern UNION GroupOrUnionGraphPatternList { $$ = $3; if(raptor_sequence_shift($$->graph_patterns, $1)) { rasqal_free_graph_pattern($$); $$ = NULL; YYERROR_MSG("GroupOrUnionGraphPattern: sequence push failed"); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "UnionGraphPattern\n graphpattern="); rasqal_graph_pattern_print($$, DEBUG_FH); fputs("\n\n", DEBUG_FH); #endif } | GroupGraphPattern { $$ = $1; } ; /* NEW Grammar Term pulled out of [25] GroupOrUnionGraphPattern */ GroupOrUnionGraphPatternList: GroupOrUnionGraphPatternList UNION GroupGraphPattern { $$ = $1; if($3) if(raptor_sequence_push($$->graph_patterns, $3)) { rasqal_free_graph_pattern($$); $$ = NULL; YYERROR_MSG("GroupOrUnionGraphPatternList 1: sequence push failed"); } } | GroupGraphPattern { raptor_sequence *seq; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_graph_pattern, (raptor_data_print_handler)rasqal_graph_pattern_print); if(!seq) { if($1) rasqal_free_graph_pattern($1); YYERROR_MSG("GroupOrUnionGraphPatternList 2: cannot create sequence"); } if($1) if(raptor_sequence_push(seq, $1)) { raptor_free_sequence(seq); YYERROR_MSG("GroupOrUnionGraphPatternList 2: sequence push failed"); } $$ = rasqal_new_graph_pattern_from_sequence(rq, seq, RASQAL_GRAPH_PATTERN_OPERATOR_UNION); if(!$$) YYERROR_MSG("GroupOrUnionGraphPatternList 1: cannot create gp"); } ; /* LAQRS: LET (?var := expression) . */ LetGraphPattern: LET '(' Var ASSIGN Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if($3 && $5) { if(sparql->experimental) $$ = rasqal_new_let_graph_pattern(rq, $3, $5); else { sparql_syntax_error(rq, "LET can only be used with LAQRS"); YYERROR; } } else $$ = NULL; } ; /* SPARQL Grammar: Filter */ Filter: FILTER Constraint { $$ = $2; } ; /* SPARQL Grammar: Constraint */ Constraint: BrackettedExpression { $$ = $1; } | BuiltInCall { $$ = $1; } | FunctionCall { $$ = $1; } ; ParamsOpt: ';' { $$ = NULL; } | /* empty */ { $$ = NULL; } ; /* SPARQL Grammar: FunctionCall */ FunctionCall: IRIref '(' DistinctOpt ArgListNoBraces ParamsOpt ')' { raptor_uri* uri = rasqal_literal_as_uri($1); if(!$4) { $4 = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$4) { rasqal_free_literal($1); YYERROR_MSG("FunctionCall: cannot create sequence"); } } uri = raptor_uri_copy(uri); if(raptor_sequence_size($4) == 1 && rasqal_xsd_is_datatype_uri(rq->world, uri)) { rasqal_expression* e = (rasqal_expression*)raptor_sequence_pop($4); $$ = rasqal_new_cast_expression(rq->world, uri, e); if($$) $$->flags |= $3; raptor_free_sequence($4); } else { unsigned int flags = 0; if($3) flags |= 1; $$ = rasqal_new_function_expression(rq->world, uri, $4, $5 /* params */, flags); if($$) $$->flags |= $3; } rasqal_free_literal($1); if(!$$) YYERROR_MSG("FunctionCall: cannot create expr"); } | IRIrefBrace ArgListNoBraces ')' { raptor_uri* uri = rasqal_literal_as_uri($1); if(!$2) { $2 = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$2) { rasqal_free_literal($1); YYERROR_MSG("FunctionCall: cannot create sequence"); } } uri = raptor_uri_copy(uri); if(raptor_sequence_size($2) == 1 && rasqal_xsd_is_datatype_uri(rq->world, uri)) { rasqal_expression* e = (rasqal_expression*)raptor_sequence_pop($2); $$ = rasqal_new_cast_expression(rq->world, uri, e); raptor_free_sequence($2); } else { $$ = rasqal_new_function_expression(rq->world, uri, $2, NULL /* params */, 0 /* flags */); } rasqal_free_literal($1); if(!$$) YYERROR_MSG("FunctionCall: cannot create expr"); } ; /* SPARQL 1.1 */ CoalesceExpression: COALESCE ArgList { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "COALESCE can only be used with SPARQL 1.1"); YYERROR; } if(!$2) { $2 = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$2) YYERROR_MSG("FunctionCall: cannot create sequence"); } $$ = rasqal_new_expr_seq_expression(rq->world, RASQAL_EXPR_COALESCE, $2); if(!$$) YYERROR_MSG("Coalesce: cannot create expr"); } ; /* SPARQL Grammar: ArgList - FIXME: add optional DISTINCT */ ArgList: '(' ArgListNoBraces ')' { $$ = $2; } /* SPARQL Grammar: ArgList modified to not have '(' and ')' */ ArgListNoBraces: ArgListNoBraces ',' Expression { $$ = $1; if($3) if(raptor_sequence_push($$, $3)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("ArgListNoBraces 1: sequence push failed"); } } | Expression { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); if(!$$) { if($1) rasqal_free_expression($1); YYERROR_MSG("ArgListNoBraces 2: cannot create sequence"); } if($1) if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("ArgListNoBraces 2: sequence push failed"); } } | /* empty */ { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_expression, (raptor_data_print_handler)rasqal_expression_print); } ; /* SPARQL Grammar: ConstructTemplate */ ConstructTemplate: '{' ConstructTriplesOpt '}' { $$ = $2; } ; /* Pulled out of SPARQL Grammar: ConstructTriples */ ConstructTriplesOpt: ConstructTriples { $$ = $1; } | /* empty */ { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!$$) { YYERROR_MSG("ConstructTriplesOpt: cannot create sequence"); } } ; /* SPARQL Grammar: ConstructTriples */ ConstructTriples: TriplesSameSubject '.' ConstructTriplesOpt { $$ = NULL; if($1) { $$ = $1->triples; $1->triples = NULL; rasqal_free_formula($1); } if($3) { if(!$$) { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!$$) { raptor_free_sequence($3); YYERROR_MSG("ConstructTriples: cannot create sequence"); } } if(raptor_sequence_join($$, $3)) { raptor_free_sequence($3); raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("ConstructTriples: sequence join failed"); } raptor_free_sequence($3); } } | TriplesSameSubject { $$ = NULL; if($1) { $$ = $1->triples; $1->triples = NULL; rasqal_free_formula($1); } } ; /* SPARQL Grammar: TriplesSameSubject */ TriplesSameSubject: VarOrTerm PropertyListNotEmpty { int i; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesSameSubject 1\n subject="); rasqal_formula_print($1, DEBUG_FH); if($2) { fprintf(DEBUG_FH, "\n propertyList="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, "\n and empty propertyList\n"); #endif if($2) { raptor_sequence *seq = $2->triples; rasqal_literal *subject = $1->value; int size = raptor_sequence_size(seq); /* non-empty property list, handle it */ for(i = 0; i < size; i++) { rasqal_triple* t2 = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(t2->subject) continue; t2->subject = rasqal_new_literal_from_literal(subject); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution propertyList="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif } $$ = rasqal_formula_join($1, $2); if(!$$) YYERROR_MSG("TriplesSameSubject 1: formula join failed"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after joining formula="); rasqal_formula_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } | TriplesNode PropertyList { int i; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesSameSubject 2\n TriplesNode="); rasqal_formula_print($1, DEBUG_FH); if($2) { fprintf(DEBUG_FH, "\n propertyList="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, "\n and empty propertyList\n"); #endif if($2) { raptor_sequence *seq = $2->triples; rasqal_literal *subject = $1->value; int size = raptor_sequence_size(seq); /* non-empty property list, handle it */ for(i = 0; i < size; i++) { rasqal_triple* t2 = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(t2->subject) continue; t2->subject = rasqal_new_literal_from_literal(subject); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution propertyList="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif } $$ = rasqal_formula_join($1, $2); if(!$$) YYERROR_MSG("TriplesSameSubject 2: formula join failed"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after joining formula="); rasqal_formula_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } ; /* SPARQL Grammar: PropertyListNotEmpty */ PropertyListNotEmpty: Verb ObjectList PropertyListTailOpt { int i; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "PropertyList 1\n Verb="); rasqal_formula_print($1, DEBUG_FH); fprintf(DEBUG_FH, "\n ObjectList="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n PropertyListTail="); if($3 != NULL) rasqal_formula_print($3, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif if($2 == NULL) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " empty ObjectList not processed\n"); #endif } else if($1 && $2) { raptor_sequence *seq = $2->triples; rasqal_literal *predicate = $1->value; rasqal_formula *formula; rasqal_triple *t2; int size; formula = rasqal_new_formula(rq->world); if(!formula) { rasqal_free_formula($1); rasqal_free_formula($2); if($3) rasqal_free_formula($3); YYERROR_MSG("PropertyList 1: cannot create formula"); } formula->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!formula->triples) { rasqal_free_formula(formula); rasqal_free_formula($1); rasqal_free_formula($2); if($3) rasqal_free_formula($3); YYERROR_MSG("PropertyList 1: cannot create sequence"); } /* non-empty property list, handle it */ size = raptor_sequence_size(seq); for(i = 0; i < size; i++) { t2 = (rasqal_triple*)raptor_sequence_get_at(seq, i); if(!t2->predicate) t2->predicate = (rasqal_literal*)rasqal_new_literal_from_literal(predicate); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution ObjectList="); raptor_sequence_print(seq, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif while(raptor_sequence_size(seq)) { t2 = (rasqal_triple*)raptor_sequence_unshift(seq); if(raptor_sequence_push(formula->triples, t2)) { rasqal_free_formula(formula); rasqal_free_formula($1); rasqal_free_formula($2); if($3) rasqal_free_formula($3); YYERROR_MSG("PropertyList 1: sequence push failed"); } } $3 = rasqal_formula_join(formula, $3); if(!$3) { rasqal_free_formula($1); rasqal_free_formula($2); YYERROR_MSG("PropertyList 1: formula join failed"); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after appending ObjectList="); rasqal_formula_print($3, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif rasqal_free_formula($2); } if($1) rasqal_free_formula($1); $$ = $3; } ; /* NEW Grammar Term pulled out of [33] PropertyListNotEmpty */ PropertyListTailOpt: ';' PropertyList { $$ = $2; } | /* empty */ { $$ = NULL; } ; /* SPARQL Grammar: PropertyList */ PropertyList: PropertyListNotEmpty { $$ = $1; } | /* empty */ { $$ = NULL; } ; /* SPARQL Grammar: ObjectList */ ObjectList: Object ObjectTail { rasqal_formula *formula; rasqal_triple *triple; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "ObjectList 1\n"); fprintf(DEBUG_FH, " Object=\n"); rasqal_formula_print($1, DEBUG_FH); fprintf(DEBUG_FH, "\n"); if($2) { fprintf(DEBUG_FH, " ObjectTail="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty ObjectTail\n"); #endif formula = rasqal_new_formula(rq->world); if(!formula) { rasqal_free_formula($1); if($2) rasqal_free_formula($2); YYERROR_MSG("ObjectList: cannot create formula"); } formula->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!formula->triples) { rasqal_free_formula(formula); rasqal_free_formula($1); if($2) rasqal_free_formula($2); YYERROR_MSG("ObjectList: cannot create sequence"); } triple = rasqal_new_triple(NULL, NULL, $1->value); $1->value = NULL; /* value now owned by triple */ if(!triple) { rasqal_free_formula(formula); rasqal_free_formula($1); if($2) rasqal_free_formula($2); YYERROR_MSG("ObjectList: cannot create triple"); } if(raptor_sequence_push(formula->triples, triple)) { rasqal_free_formula(formula); rasqal_free_formula($1); if($2) rasqal_free_formula($2); YYERROR_MSG("ObjectList: sequence push failed"); } $$ = rasqal_formula_join(formula, $1); if(!$$) { if($2) rasqal_free_formula($2); YYERROR_MSG("ObjectList: formula join $1 failed"); } $$ = rasqal_formula_join($$, $2); if(!$$) YYERROR_MSG("ObjectList: formula join $2 failed"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " objectList is now "); if($$) raptor_sequence_print($$->triples, DEBUG_FH); else fputs("NULL", DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } ; /* NEW Grammar Term pulled out of [35] ObjectList */ ObjectTail: ',' ObjectList { $$ = $2; } | /* empty */ { $$ = NULL; } ; /* SPARQL Grammar: Object */ Object: GraphNode { $$ = $1; } ; /* SPARQL Grammar: Verb */ Verb: VarOrIRIref { $$ = rasqal_new_formula(rq->world); if(!$$) { if($1) rasqal_free_literal($1); YYERROR_MSG("Verb 1: cannot create formula"); } $$->value = $1; } | A { raptor_uri *uri; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "verb Verb=rdf:type (a)\n"); #endif uri = raptor_new_uri_for_rdf_concept(rq->world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, "type")); if(!uri) YYERROR_MSG("Verb 2: uri for rdf concept type failed"); $$ = rasqal_new_formula(rq->world); if(!$$) { raptor_free_uri(uri); YYERROR_MSG("Verb 2: cannot create formula"); } $$->value = rasqal_new_uri_literal(rq->world, uri); if(!$$->value) { rasqal_free_formula($$); $$ = NULL; YYERROR_MSG("Verb 2: cannot create uri literal"); } } ; /* SPARQL Grammar: TriplesNode */ TriplesNode: Collection { $$ = $1; } | BlankNodePropertyList { $$ = $1; } ; /* SPARQL Grammar: BlankNodePropertyList */ BlankNodePropertyList: '[' PropertyListNotEmpty ']' { int i; const unsigned char *id; if($2 == NULL) { $$ = rasqal_new_formula(rq->world); if(!$$) YYERROR_MSG("BlankNodePropertyList: cannot create formula"); } else { $$ = $2; if($$->value) { rasqal_free_literal($$->value); $$->value = NULL; } } id = rasqal_query_generate_bnodeid(rq, NULL); if(!id) { rasqal_free_formula($$); $$ = NULL; YYERROR_MSG("BlankNodeProperyList: cannot create bnodeid"); } $$->value = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, id); if(!$$->value) { rasqal_free_formula($$); $$ = NULL; YYERROR_MSG("BlankNodePropertyList: cannot create literal"); } if($2 == NULL) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesNode\n PropertyList="); rasqal_formula_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif } else { raptor_sequence *seq = $2->triples; /* non-empty property list, handle it */ #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "TriplesNode\n PropertyList="); raptor_sequence_print(seq, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif for(i = 0; isubject) continue; t2->subject = (rasqal_literal*)rasqal_new_literal_from_literal($$->value); } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution formula="); rasqal_formula_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } } ; /* SPARQL Grammar: Collection (allowing empty case) */ Collection: '(' GraphNodeListNotEmpty ')' { int i; rasqal_literal* first_identifier = NULL; rasqal_literal* rest_identifier = NULL; rasqal_literal* object = NULL; rasqal_literal* blank = NULL; char const *errmsg = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "Collection\n GraphNodeListNotEmpty="); raptor_sequence_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); #endif $$ = rasqal_new_formula(rq->world); if(!$$) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create formula"); $$->triples = raptor_new_sequence((raptor_data_free_handler)rasqal_free_triple, (raptor_data_print_handler)rasqal_triple_print); if(!$$->triples) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create sequence"); first_identifier = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_first_uri)); if(!first_identifier) YYERR_MSG_GOTO(err_Collection, "Collection: cannot first_identifier"); rest_identifier = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_rest_uri)); if(!rest_identifier) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create rest_identifier"); object = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_nil_uri)); if(!object) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create nil object"); for(i = raptor_sequence_size($2)-1; i >= 0; i--) { rasqal_formula* f = (rasqal_formula*)raptor_sequence_get_at($2, i); rasqal_triple *t2; const unsigned char *blank_id = NULL; blank_id = rasqal_query_generate_bnodeid(rq, NULL); if(!blank_id) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create bnodeid"); blank = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, blank_id); if(!blank) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create bnode"); /* Move existing formula triples */ if(f->triples) if(raptor_sequence_join($$->triples, f->triples)) YYERR_MSG_GOTO(err_Collection, "Collection: sequence join failed"); /* add new triples we needed */ t2 = rasqal_new_triple(rasqal_new_literal_from_literal(blank), rasqal_new_literal_from_literal(first_identifier), rasqal_new_literal_from_literal(f->value)); if(!t2) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create triple"); if(raptor_sequence_push($$->triples, t2)) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create triple"); t2 = rasqal_new_triple(rasqal_new_literal_from_literal(blank), rasqal_new_literal_from_literal(rest_identifier), rasqal_new_literal_from_literal(object)); if(!t2) YYERR_MSG_GOTO(err_Collection, "Collection: cannot create triple 2"); if(raptor_sequence_push($$->triples, t2)) YYERR_MSG_GOTO(err_Collection, "Collection: sequence push 2 failed"); rasqal_free_literal(object); object=blank; blank = NULL; } /* free sequence of formulas just processed */ raptor_free_sequence($2); $$->value=object; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " after substitution collection="); rasqal_formula_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif rasqal_free_literal(first_identifier); rasqal_free_literal(rest_identifier); err_Collection: if(errmsg) { if(blank) rasqal_free_literal(blank); if(object) rasqal_free_literal(object); if(rest_identifier) rasqal_free_literal(rest_identifier); if(first_identifier) rasqal_free_literal(first_identifier); if($2) raptor_free_sequence($2); if($$) { rasqal_free_formula($$); $$ = NULL; } YYERROR_MSG(errmsg); } } ; /* NEW Grammar Term pulled out of [40] Collection */ /* Sequence of formula */ GraphNodeListNotEmpty: GraphNodeListNotEmpty GraphNode { char const *errmsg = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphNodeListNotEmpty 1\n"); if($2) { fprintf(DEBUG_FH, " GraphNode="); rasqal_formula_print($2, DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty GraphNode\n"); if($1) { fprintf(DEBUG_FH, " GraphNodeListNotEmpty="); raptor_sequence_print($1, DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty GraphNodeListNotEmpty\n"); #endif $$ = $1; if(!$$) { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_formula, (raptor_data_print_handler)rasqal_formula_print); if(!$$) YYERR_MSG_GOTO(err_GraphNodeListNotEmpty, "GraphNodeListNotEmpty: cannot create formula"); } if($2) { if(raptor_sequence_push($$, $2)) { YYERR_MSG_GOTO(err_GraphNodeListNotEmpty, "GraphNodeListNotEmpty 1: sequence push failed"); } $2 = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " itemList is now "); raptor_sequence_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } err_GraphNodeListNotEmpty: if(errmsg) { if($2) rasqal_free_formula($2); if($$) { raptor_free_sequence($$); $$ = NULL; } YYERROR_MSG(errmsg); } } | GraphNode { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, "GraphNodeListNotEmpty 2\n"); if($1) { fprintf(DEBUG_FH, " GraphNode="); rasqal_formula_print($1, DEBUG_FH); fprintf(DEBUG_FH, "\n"); } else fprintf(DEBUG_FH, " and empty GraphNode\n"); #endif if(!$1) $$ = NULL; else { $$ = raptor_new_sequence((raptor_data_free_handler)rasqal_free_formula, (raptor_data_print_handler)rasqal_formula_print); if(!$$) { rasqal_free_formula($1); YYERROR_MSG("GraphNodeListNotEmpty 2: cannot create sequence"); } if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("GraphNodeListNotEmpty 2: sequence push failed"); } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(DEBUG_FH, " GraphNodeListNotEmpty is now "); raptor_sequence_print($$, DEBUG_FH); fprintf(DEBUG_FH, "\n\n"); #endif } ; /* SPARQL Grammar: GraphNode */ GraphNode: VarOrTerm { $$ = $1; } | TriplesNode { $$ = $1; } ; /* SPARQL Grammar Term: [42] VarOrTerm */ VarOrTerm: Var { $$ = rasqal_new_formula(rq->world); if(!$$) YYERROR_MSG("VarOrTerm 1: cannot create formula"); $$->value = rasqal_new_variable_literal(rq->world, $1); if(!$$->value) { rasqal_free_formula($$); $$ = NULL; YYERROR_MSG("VarOrTerm 1: cannot create literal"); } } | GraphTerm { $$ = rasqal_new_formula(rq->world); if(!$$) { if($1) rasqal_free_literal($1); YYERROR_MSG("VarOrTerm 2: cannot create formula"); } $$->value = $1; } ; /* SPARQL Grammar: VarOrIRIref */ VarOrIRIref: Var { $$ = rasqal_new_variable_literal(rq->world, $1); if(!$$) YYERROR_MSG("VarOrIRIref: cannot create literal"); } | IRIref { $$ = $1; } ; /* SPARQL Grammar: Var */ Var: '?' VarName { $$ = $2; } | '$' VarName { $$ = $2; } ; /* NEW Grammar Term made from SPARQL Grammar: Var */ VarName: IDENTIFIER { $$ = rasqal_variables_table_add2(rq->vars_table, RASQAL_VARIABLE_TYPE_NORMAL, $1, 0, NULL); if(!$$) YYERROR_MSG("VarName: cannot create var"); RASQAL_FREE(char*, $1); } ; /* LAQRS legacy */ VarOrBadVarName: '?' VarName { $$ = $2; } | '$' VarName { $$ = $2; } | VarName { $$ = $1; sparql_syntax_warning(rq, "... AS varname is deprecated LAQRS syntax, use ... AS ?varname"); } ; /* SPARQL Grammar: GraphTerm */ GraphTerm: IRIref { $$ = $1; } | RDFLiteral { $$ = $1; } | NumericLiteral { $$ = $1; } | BOOLEAN_LITERAL { $$ = $1; } | BlankNode { $$ = $1; } | '(' ')' { $$ = rasqal_new_uri_literal(rq->world, raptor_uri_copy(rq->world->rdf_nil_uri)); if(!$$) YYERROR_MSG("GraphTerm: cannot create literal"); } ; /* SPARQL Grammar: Expression */ Expression: ConditionalOrExpression { $$ = $1; } ; /* SPARQL Grammar: ConditionalOrExpression */ ConditionalOrExpression: ConditionalOrExpression SC_OR ConditionalAndExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_OR, $1, $3); if(!$$) YYERROR_MSG("ConditionalOrExpression: cannot create expr"); } | ConditionalAndExpression { $$ = $1; } ; /* SPARQL Grammar: ConditionalAndExpression */ ConditionalAndExpression: ConditionalAndExpression SC_AND RelationalExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_AND, $1, $3); if(!$$) YYERROR_MSG("ConditionalAndExpression: cannot create expr"); ; } | RelationalExpression { $$ = $1; } ; /* SPARQL Grammar: ValueLogical - merged into RelationalExpression */ /* SPARQL Grammar: RelationalExpression */ RelationalExpression: AdditiveExpression EQ AdditiveExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_EQ, $1, $3); if(!$$) YYERROR_MSG("RelationalExpression 1: cannot create expr"); } | AdditiveExpression NEQ AdditiveExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_NEQ, $1, $3); if(!$$) YYERROR_MSG("RelationalExpression 2: cannot create expr"); } | AdditiveExpression LT AdditiveExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_LT, $1, $3); if(!$$) YYERROR_MSG("RelationalExpression 3: cannot create expr"); } | AdditiveExpression GT AdditiveExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_GT, $1, $3); if(!$$) YYERROR_MSG("RelationalExpression 4: cannot create expr"); } | AdditiveExpression LE AdditiveExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_LE, $1, $3); if(!$$) YYERROR_MSG("RelationalExpression 5: cannot create expr"); } | AdditiveExpression GE AdditiveExpression { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_GE, $1, $3); if(!$$) YYERROR_MSG("RelationalExpression 6: cannot create expr"); } | AdditiveExpression IN ArgList { $$ = rasqal_new_set_expression(rq->world, RASQAL_EXPR_IN, $1, $3); } | AdditiveExpression NOT IN ArgList { $$ = rasqal_new_set_expression(rq->world, RASQAL_EXPR_NOT_IN, $1, $4); } | AdditiveExpression { $$ = $1; } ; /* SPARQL Grammar: NumericExpression - merged into AdditiveExpression */ /* SPARQL Grammar: AdditiveExpression AdditiveExpression := MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* Expanded: AdditiveExpression: MultiplicativeExpression AdExOpExpressionListOuter | MultiplicativeExpression AdExOpExpressionListOuter: AdExOpExpressionListOuter AdExOpExpressionListInner | AdExOpExpressionListInner AdExOpExpressionListInner: '+' MultiplicativeExpression | '-' MultiplicativeExpression | NumericLiteralPositive AdExOpUnaryExpressionListOpt | NumericLiteralNegative AdExOpUnaryExpressionListOpt AdExOpUnaryExpressionListOpt: AdExOpUnaryExpressionList | empty AdExOpUnaryExpressionList: AdExOpUnaryExpressionList AdExOpUnaryExpression | AdExOpUnaryExpression AdExOpUnaryExpression: '*' UnaryExpression | '/' UnaryExpression */ AdditiveExpression: MultiplicativeExpression AdExOpExpressionListOuter { $$ = $1; if($2) { int i; int size = raptor_sequence_size($2); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AdExOpExpressionListOuter sequence: "); if($2) raptor_sequence_print($2, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* Walk sequence forming tree of exprs in $$ */ for(i = 0; i < size; i++) { sparql_op_expr* op_expr = (sparql_op_expr*)raptor_sequence_get_at($2, i); $$ = rasqal_new_2op_expression(rq->world, op_expr->op, $$, op_expr->expr); op_expr->expr = NULL; } raptor_free_sequence($2); } } | MultiplicativeExpression { $$ = $1; } ; AdExOpExpressionListOuter: AdExOpExpressionListOuter AdExOpExpressionListInner { $$ = $1; if($2) { if(raptor_sequence_join($$, $2)) { raptor_free_sequence($2); raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("AdExOpExpressionListOuter: sequence join failed"); } raptor_free_sequence($2); } } | AdExOpExpressionListInner { $$ = $1; } ; AdExOpExpressionListInner: '+' MultiplicativeExpression { sparql_op_expr* oe; $$ = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!$$) YYERROR_MSG("AdExOpExpressionListInner 1: failed to create sequence"); oe = new_op_expr(RASQAL_EXPR_PLUS, $2); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 1: cannot create plus expr"); if(raptor_sequence_push($$, oe)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("AdExOpExpressionListInner 1: sequence push failed"); } } | '-' MultiplicativeExpression { sparql_op_expr* oe; $$ = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!$$) YYERROR_MSG("AdExOpExpressionListInner 2: failed to create sequence"); oe = new_op_expr(RASQAL_EXPR_MINUS, $2); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 2: cannot create minus expr"); if(raptor_sequence_push($$, oe)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("AdExOpExpressionListInner 2: sequence push failed"); } } | NumericLiteralPositive AdExOpUnaryExpressionListOpt { rasqal_expression *e; sparql_op_expr* oe; $$ = $2; if(!$$) { $$ = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!$$) YYERROR_MSG("AdExOpExpressionListInner 2: failed to create sequence"); } e = rasqal_new_literal_expression(rq->world, $1); if(!e) YYERROR_MSG("AdExOpExpressionListInner 2: cannot create NumericLiteralPositive literal expression"); oe = new_op_expr(RASQAL_EXPR_PLUS, e); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 2: cannot create plus expr"); raptor_sequence_shift($$, oe); } | NumericLiteralNegative AdExOpUnaryExpressionListOpt { rasqal_expression *e; sparql_op_expr* oe; $$ = $2; if(!$$) { $$ = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!$$) YYERROR_MSG("AdExOpExpressionListInner 3: failed to create sequence"); } e = rasqal_new_literal_expression(rq->world, $1); if(!e) YYERROR_MSG("AdExOpExpressionListInner 3: cannot create NumericLiteralNegative literal expression"); oe = new_op_expr(RASQAL_EXPR_MINUS, e); if(!oe) YYERROR_MSG("AdExOpExpressionListInner 3: cannot create minus expr"); raptor_sequence_shift($$, oe); } ; AdExOpUnaryExpressionListOpt: AdExOpUnaryExpressionList { $$ = $1; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AEListOpt sequence: "); if($$) raptor_sequence_print($$, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputc('\n', DEBUG_FH); #endif } | /* empty */ { $$ = NULL; } ; AdExOpUnaryExpressionList: AdExOpUnaryExpressionList AdExOpUnaryExpression { $$ = $1; if($$ && $2) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AdExOpUnaryExpressionList adding AdExOpUnaryExpression: "); print_op_expr($2, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("AdExOpUnaryExpressionListOpt 1: sequence push failed"); } } } | AdExOpUnaryExpression { $$ = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!$$) YYERROR_MSG("AdExOpUnaryExpressionListOpt 2: failed to create sequence"); if($1) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("AdExOpUnaryExpressionList adding AdExOpUnaryExpression: "); print_op_expr($1, DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("AdExOpUnaryExpressionListOpt 2: sequence push failed"); } } } ; AdExOpUnaryExpression: '*' UnaryExpression { $$ = new_op_expr(RASQAL_EXPR_STAR, $2); if(!$$) YYERROR_MSG("AdExOpUnaryExpression 1: cannot create star expr"); } | '/' UnaryExpression { $$ = new_op_expr(RASQAL_EXPR_SLASH, $2); if(!$$) YYERROR_MSG("AdExOpUnaryExpression 2: cannot create slash expr"); } ; /* SPARQL Grammar: MultiplicativeExpression MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* Expanded: MultiplicativeExpression: UnaryExpression MuExOpUnaryExpressionList | UnaryExpression MuExOpUnaryExpressionList: MuExOpUnaryExpressionList MuExOpUnaryExpression | MuExOpUnaryExpression MuExOpUnaryExpression: '*' UnaryExpression | '/' UnaryExpression */ MultiplicativeExpression: UnaryExpression MuExOpUnaryExpressionList { $$ = $1; if($2) { int i; int size = raptor_sequence_size($2); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("MuExOpUnaryExpressionList sequence: "); raptor_sequence_print($2, DEBUG_FH); fputc('\n', DEBUG_FH); #endif /* Walk sequence forming tree of exprs in $$ */ for(i = 0; i < size; i++) { sparql_op_expr* op_expr = (sparql_op_expr*)raptor_sequence_get_at($2, i); $$ = rasqal_new_2op_expression(rq->world, op_expr->op, $$, op_expr->expr); op_expr->expr = NULL; } raptor_free_sequence($2); } } | UnaryExpression { $$ = $1; } ; MuExOpUnaryExpressionList: MuExOpUnaryExpressionList MuExOpUnaryExpression { $$ = $1; if($$ && $2) { if(raptor_sequence_push($$, $2)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("MuExOpUnaryExpressionListOpt 1: sequence push failed"); } } } | MuExOpUnaryExpression { $$ = raptor_new_sequence((raptor_data_free_handler)free_op_expr, (raptor_data_print_handler)print_op_expr); if(!$$) YYERROR_MSG("MuExOpUnaryExpressionListOpt 2: failed to create sequence"); if(raptor_sequence_push($$, $1)) { raptor_free_sequence($$); $$ = NULL; YYERROR_MSG("MuExOpUnaryExpressionListOpt 2: sequence push failed"); } } ; MuExOpUnaryExpression: '*' UnaryExpression { $$ = new_op_expr(RASQAL_EXPR_STAR, $2); if(!$$) YYERROR_MSG("MuExOpUnaryExpression 1: cannot create star expr"); } | '/' UnaryExpression { $$ = new_op_expr(RASQAL_EXPR_SLASH, $2); if(!$$) YYERROR_MSG("MuExOpUnaryExpression 2: cannot create slash expr"); } ; /* SPARQL Grammar: UnaryExpression */ UnaryExpression: '!' PrimaryExpression { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BANG, $2); if(!$$) YYERROR_MSG("UnaryExpression 1: cannot create expr"); } | '+' PrimaryExpression { $$ = $2; } | '-' PrimaryExpression { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_UMINUS, $2); if(!$$) YYERROR_MSG("UnaryExpression 3: cannot create expr"); } | PrimaryExpression { $$ = $1; } ; /* SPARQL Grammar: PrimaryExpression * == BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | Aggregate * == BrackettedExpression | BuiltInCall | IRIref ArgList? | RDFLiteral | NumericLiteral | BooleanLiteral | Var | Aggregate * == BrackettedExpression | BuiltInCall | FunctionCall | * approximately GraphTerm | Var | Aggregate * */ PrimaryExpression: BrackettedExpression { $$ = $1; } | BuiltInCall { $$ = $1; } | FunctionCall { /* Grammar has IRIrefOrFunction here which is "IRIref ArgList?" * and essentially shorthand for FunctionCall | IRIref. The Rasqal * SPARQL lexer distinguishes these for us with IRIrefBrace. * IRIref is covered below by GraphTerm. */ $$ = $1; } | GraphTerm { $$ = rasqal_new_literal_expression(rq->world, $1); if(!$$) YYERROR_MSG("PrimaryExpression 4: cannot create expr"); } | Var { rasqal_literal *l; l = rasqal_new_variable_literal(rq->world, $1); if(!l) YYERROR_MSG("PrimaryExpression 5: cannot create literal"); $$ = rasqal_new_literal_expression(rq->world, l); if(!$$) YYERROR_MSG("PrimaryExpression 5: cannot create expr"); } | AggregateExpression { $$ = $1; } ; /* SPARQL Grammar: BrackettedExpression */ BrackettedExpression: '(' Expression ')' { $$ = $2; } ; /* SPARQL Grammar: BuiltInCall */ BuiltInCall: STR '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_STR, $3); if(!$$) YYERROR_MSG("BuiltInCall 1: cannot create expr"); } | LANG '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_LANG, $3); if(!$$) YYERROR_MSG("BuiltInCall 2: cannot create expr"); } | LANGMATCHES '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_LANGMATCHES, $3, $5); if(!$$) YYERROR_MSG("BuiltInCall 3: cannot create expr"); } | DATATYPE '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_DATATYPE, $3); if(!$$) YYERROR_MSG("BuiltInCall 4: cannot create expr"); } | BOUND '(' Var ')' { rasqal_literal *l; rasqal_expression *e; l = rasqal_new_variable_literal(rq->world, $3); if(!l) YYERROR_MSG("BuiltInCall 5: cannot create literal"); e = rasqal_new_literal_expression(rq->world, l); if(!e) YYERROR_MSG("BuiltInCall 6: cannot create literal expr"); $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BOUND, e); if(!$$) YYERROR_MSG("BuiltInCall 7: cannot create expr"); } | IRI '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_IRI, $3); if(!$$) YYERROR_MSG("BuiltInCall 7a: cannot create expr"); } | URI '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_IRI, $3); if(!$$) YYERROR_MSG("BuiltInCall 7b: cannot create expr"); } | BNODE '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BNODE, $3); if(!$$) YYERROR_MSG("BuiltInCall 7c: cannot create expr"); } | BNODE '(' ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_BNODE, NULL); if(!$$) YYERROR_MSG("BuiltInCall 7d: cannot create expr"); } | RAND '(' ')' { $$ = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_RAND); if(!$$) YYERROR_MSG("BuiltInCall 7e: cannot create expr"); } | ABS '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ABS, $3); if(!$$) YYERROR_MSG("BuiltInCall 7f: cannot create expr"); } | CEIL '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_CEIL, $3); if(!$$) YYERROR_MSG("BuiltInCall 7g: cannot create expr"); } | FLOOR '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_FLOOR, $3); if(!$$) YYERROR_MSG("BuiltInCall 7h: cannot create expr"); } | ROUND '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ROUND, $3); if(!$$) YYERROR_MSG("BuiltInCall 7i: cannot create expr"); } | MD5 '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_MD5, $3); if(!$$) YYERROR_MSG("BuiltInCall 7j: cannot create expr"); } | SHA1 '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA1, $3); if(!$$) YYERROR_MSG("BuiltInCall 7k: cannot create expr"); } | SHA224 '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA224, $3); if(!$$) YYERROR_MSG("BuiltInCall 7l: cannot create expr"); } | SHA256 '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA256, $3); if(!$$) YYERROR_MSG("BuiltInCall 7m: cannot create expr"); } | SHA384 '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA384, $3); if(!$$) YYERROR_MSG("BuiltInCall 7n: cannot create expr"); } | SHA512 '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SHA512, $3); if(!$$) YYERROR_MSG("BuiltInCall 7o: cannot create expr"); } | UUID '(' ')' { $$ = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_UUID); if(!$$) YYERROR_MSG("BuiltInCall 7p: cannot create expr"); } | STRUUID '(' ')' { $$ = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_STRUUID); if(!$$) YYERROR_MSG("BuiltInCall 7q: cannot create expr"); } | StringExpression { $$ = $1; } | CoalesceExpression { $$ = $1; } | IF '(' Expression ',' Expression ',' Expression ')' { $$ = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_IF, $3, $5, $7); if(!$$) YYERROR_MSG("BuiltInCall 7e: cannot create expr"); } | STRLANG '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRLANG, $3, $5); if(!$$) YYERROR_MSG("BuiltInCall 7f: cannot create expr"); } | STRDT '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRDT, $3, $5); if(!$$) YYERROR_MSG("BuiltInCall 7g: cannot create expr"); } | SAMETERM '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_SAMETERM, $3, $5); if(!$$) YYERROR_MSG("BuiltInCall 8: cannot create expr"); } | ISURI '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISURI, $3); if(!$$) YYERROR_MSG("BuiltInCall 9: cannot create expr"); } | ISBLANK '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISBLANK, $3); if(!$$) YYERROR_MSG("BuiltInCall 10: cannot create expr"); } | ISLITERAL '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISLITERAL, $3); if(!$$) YYERROR_MSG("BuiltInCall 11: cannot create expr"); } | ISNUMERIC '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ISNUMERIC, $3); if(!$$) YYERROR_MSG("BuiltInCall 12: cannot create expr"); } | RegexExpression { $$ = $1; } | DatetimeBuiltinAccessors { $$ = $1; } | DatetimeExtensions { $$ = $1; } ; StringExpression: STRLEN '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_STRLEN, $3); if(!$$) YYERROR_MSG("StringExpression: cannot create STRLEN() expr"); } | SUBSTR '(' Expression ',' Expression ')' { $$ = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_SUBSTR, $3, $5, NULL); if(!$$) YYERROR_MSG("StringExpression: cannot create SUBSTR() expr"); } | SUBSTR '(' Expression ',' Expression ',' Expression ')' { $$ = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_SUBSTR, $3, $5, $7); if(!$$) YYERROR_MSG("StringExpression: cannot create SUBSTR() expr"); } | UCASE '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_UCASE, $3); if(!$$) YYERROR_MSG("StringExpression: cannot create UCASE() expr"); } | LCASE '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_LCASE, $3); if(!$$) YYERROR_MSG("StringExpression: cannot create LCASE() expr"); } | STRSTARTS '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRSTARTS, $3, $5); if(!$$) YYERROR_MSG("StringExpression: cannot create STRSTARTS() expr"); } | STRENDS '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRENDS, $3, $5); if(!$$) YYERROR_MSG("StringExpression: cannot create STRENDS() expr"); } | CONTAINS '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_CONTAINS, $3, $5); if(!$$) YYERROR_MSG("StringExpression: cannot create YEAR expr"); } | ENCODE_FOR_URI '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_ENCODE_FOR_URI, $3); if(!$$) YYERROR_MSG("StringExpression: cannot create ENCODE_FOR_URI() expr"); } | CONCAT '(' ExpressionList ')' { $$ = rasqal_new_expr_seq_expression(rq->world, RASQAL_EXPR_CONCAT, $3); if(!$$) YYERROR_MSG("StringExpression: cannot create CONCAT() expr"); } | STRBEFORE '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRBEFORE, $3, $5); if(!$$) YYERROR_MSG("StringExpression: cannot create STRBEFORE() expr"); } | STRAFTER '(' Expression ',' Expression ')' { $$ = rasqal_new_2op_expression(rq->world, RASQAL_EXPR_STRAFTER, $3, $5); if(!$$) YYERROR_MSG("StringExpression: cannot create STRAFTER() expr"); } | REPLACE '(' Expression ',' Expression ',' Expression ')' { $$ = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_REPLACE, $3, $5, $7); if(!$$) YYERROR_MSG("StringExpression: cannot create REPLACE() expr"); } | REPLACE '(' Expression ',' Expression ',' Expression ',' Expression ')' { $$ = rasqal_new_4op_expression(rq->world, RASQAL_EXPR_REPLACE, $3, $5, $7, $9); if(!$$) YYERROR_MSG("StringExpression: cannot create REPLACE() expr"); } ; /* SPARQL Grammar: RegexExpression */ RegexExpression: REGEX '(' Expression ',' Expression ')' { $$ = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_REGEX, $3, $5, NULL); if(!$$) YYERROR_MSG("RegexExpression 1: cannot create expr"); } | REGEX '(' Expression ',' Expression ',' Expression ')' { $$ = rasqal_new_3op_expression(rq->world, RASQAL_EXPR_REGEX, $3, $5, $7); if(!$$) YYERROR_MSG("RegexExpression 2: cannot create expr"); } ; /* SPARQL 1.1 pre-draft */ DatetimeBuiltinAccessors: YEAR '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_YEAR, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create YEAR expr"); } | MONTH '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_MONTH, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create MONTH expr"); } | DAY '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_DAY, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create DAY expr"); } | HOURS '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_HOURS, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create HOURS expr"); } | MINUTES '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_MINUTES, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create MINUTES expr"); } | SECONDS '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_SECONDS, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create SECONDS expr"); } | TIMEZONE '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_TIMEZONE, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create TIMEZONE expr"); } | TZ '(' Expression ')' { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_TZ, $3); if(!$$) YYERROR_MSG("DatetimeBuiltinAccessors: cannot create TZ expr"); } ; /* LAQRS */ DatetimeExtensions: CURRENT_DATETIME '(' ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(sparql->experimental) { $$ = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_CURRENT_DATETIME); if(!$$) YYERROR_MSG("DatetimeExtensions: cannot create CURRENT_DATETIME() expr"); } else { sparql_syntax_error(rq, "CURRENT_DATETIME() can only used with LAQRS"); YYERROR; } } | NOW '(' ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(!sparql->sparql11_query) { sparql_syntax_error(rq, "NOW() can only be used with SPARQL 1.1"); YYERROR; } $$ = rasqal_new_0op_expression(rq->world, RASQAL_EXPR_NOW); if(!$$) YYERROR_MSG("DatetimeExtensions: cannot create NOW()"); } | FROM_UNIXTIME '(' Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(sparql->experimental) { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_FROM_UNIXTIME, $3); if(!$$) YYERROR_MSG("DatetimeExtensions: cannot create FROM_UNIXTIME() expr"); } else { sparql_syntax_error(rq, "FROM_UNIXTIME() can only used with LAQRS"); YYERROR; } } | TO_UNIXTIME '(' Expression ')' { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)(rq->context); $$ = NULL; if(sparql->experimental) { $$ = rasqal_new_1op_expression(rq->world, RASQAL_EXPR_TO_UNIXTIME, $3); if(!$$) YYERROR_MSG("DatetimeExtensions: cannot create TO_UNIXTIME() expr"); } else { sparql_syntax_error(rq, "TO_UNIXTIME() can only used with LAQRS"); YYERROR; } } ; /* SPARQL Grammar: IRIrefOrFunction - not necessary in this grammar as the IRIref ambiguity is determined in lexer with the help of the IRIrefBrace token below */ /* NEW Grammar Term made from SPARQL Grammar: IRIref + '(' expanded */ IRIrefBrace: URI_LITERAL_BRACE { $$ = rasqal_new_uri_literal(rq->world, $1); if(!$$) YYERROR_MSG("IRIrefBrace 1: cannot create literal"); } | QNAME_LITERAL_BRACE { $$ = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_QNAME, $1); if(!$$) YYERROR_MSG("IRIrefBrace 2: cannot create literal"); if(rasqal_literal_expand_qname(rq, $$)) { sparql_query_error_full(rq, "QName %s cannot be expanded", $1); rasqal_free_literal($$); $$ = NULL; YYERROR_MSG("IRIrefBrace 2: cannot expand qname"); } } ; /* SPARQL Grammar: RDFLiteral - merged into GraphTerm */ /* SPARQL Grammar: NumericLiteral */ NumericLiteral: NumericLiteralUnsigned { $$ = $1; } | NumericLiteralPositive { $$ = $1; } | NumericLiteralNegative { $$ = $1; } ; /* SPARQL Grammer: [62] NumericLiteralUnsigned */ NumericLiteralUnsigned: INTEGER_LITERAL { $$ = $1; } | DECIMAL_LITERAL { $$ = $1; } | DOUBLE_LITERAL { $$ = $1; } ; /* SPARQL Grammer: [63] NumericLiteralPositive */ NumericLiteralPositive: INTEGER_POSITIVE_LITERAL { $$ = $1; } | DECIMAL_POSITIVE_LITERAL { $$ = $1; } | DOUBLE_POSITIVE_LITERAL { $$ = $1; } ; /* SPARQL Grammar: NumericLiteralNegative */ NumericLiteralNegative: INTEGER_NEGATIVE_LITERAL { $$ = $1; } | DECIMAL_NEGATIVE_LITERAL { $$ = $1; } | DOUBLE_NEGATIVE_LITERAL { $$ = $1; } ; /* SPARQL Grammar: BooleanLiteral - merged into GraphTerm */ /* SPARQL Grammar: String - merged into GraphTerm */ /* SPARQL Grammar: IRIref */ IRIref: URI_LITERAL { $$ = rasqal_new_uri_literal(rq->world, $1); if(!$$) YYERROR_MSG("IRIref 1: cannot create literal"); } | QNAME_LITERAL { $$ = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_QNAME, $1); if(!$$) YYERROR_MSG("IRIref 2: cannot create literal"); if(rasqal_literal_expand_qname(rq, $$)) { sparql_query_error_full(rq, "QName %s cannot be expanded", $1); rasqal_free_literal($$); $$ = NULL; YYERROR_MSG("IRIrefBrace 2: cannot expand qname"); } } ; /* SPARQL Grammar: QName - made into terminal QNAME_LITERAL */ /* SPARQL Grammar: BlankNode */ BlankNode: BLANK_LITERAL { $$ = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, $1); if(!$$) YYERROR_MSG("BlankNode 1: cannot create literal"); } | '[' ']' { const unsigned char *id; id = rasqal_query_generate_bnodeid(rq, NULL); if(!id) YYERROR_MSG("BlankNode 2: cannot create bnodeid"); $$ = rasqal_new_simple_literal(rq->world, RASQAL_LITERAL_BLANK, id); if(!$$) YYERROR_MSG("BlankNode 2: cannot create literal"); } ; /* SPARQL Grammar: Q_IRI_REF onwards are all lexer items * with similar names or are inlined. */ %% /* Support functions */ /* This is declared in sparql_lexer.h but never used, so we always get * a warning unless this dummy code is here. Used once below in an error case. */ static int yy_init_globals (yyscan_t yyscanner ) { return 0; }; /* * rasqal_sparql_query_language_init: * @rdf_query: query * @name: language name (or NULL) * * Internal: Initialise the SPARQL query language parser * * Return value: non 0 on failure **/ static int rasqal_sparql_query_language_init(rasqal_query* rdf_query, const char *name) { rasqal_sparql_query_language* rqe; rqe = (rasqal_sparql_query_language*)rdf_query->context; rdf_query->compare_flags = RASQAL_COMPARE_XQUERY; /* All the sparql query families support this */ rqe->sparql_scda = 1; /* SELECT CONSTRUCT DESCRIBE ASK */ /* SPARQL 1.1 Query + Update is the default */ rqe->sparql_scda = 1; /* SELECT CONSTRUCT DESCRIBE ASK */ rqe->sparql11_query = 1; rqe->sparql11_property_paths = 1; rqe->sparql11_update = 1; if(name) { /* SPARQL 1.0 disables SPARQL 1.1 features */ if(!strncmp(name, "sparql10", 8)) { rqe->sparql11_query = 0; rqe->sparql11_property_paths = 0; rqe->sparql11_update = 0; } if(!strcmp(name, "sparql11-query")) { /* No update if SPARQL 1.1 query */ rqe->sparql11_update = 0; } if(!strcmp(name, "sparql11-update")) { /* No query (SELECT, CONSTRUCT, DESCRIBE, ASK) if SPARQL 1.1 update */ rqe->sparql_scda = 0; } /* LAQRS for experiments */ if(!strcmp(name, "laqrs")) rqe->experimental = 1; } return 0; } /** * rasqal_sparql_query_language_terminate - Free the SPARQL query language parser * * Return value: non 0 on failure **/ static void rasqal_sparql_query_language_terminate(rasqal_query* rdf_query) { rasqal_sparql_query_language* sparql; sparql = (rasqal_sparql_query_language*)rdf_query->context; if(sparql && sparql->scanner_set) { sparql_lexer_lex_destroy(sparql->scanner); sparql->scanner_set = 0; } } static int rasqal_sparql_query_language_prepare(rasqal_query* rdf_query) { /* rasqal_sparql_query_language* sparql = (rasqal_sparql_query_language*)rdf_query->context; */ int rc; if(!rdf_query->query_string) return 1; rc = rasqal_query_reset_select_query(rdf_query); if(rc) return 1; rc = sparql_parse(rdf_query); if(rc) return rc; /* FIXME - should check remaining query parts */ if(rasqal_sequence_has_qname(rdf_query->triples) || rasqal_sequence_has_qname(rdf_query->constructs) || rasqal_query_constraints_has_qname(rdf_query)) { sparql_query_error(rdf_query, "SPARQL query has unexpanded QNames"); return 1; } /* SPARQL: Turn [] into anonymous variables */ if(rasqal_query_build_anonymous_variables(rdf_query)) return 1; /* SPARQL: Expand 'SELECT *' */ if(rasqal_query_expand_wildcards(rdf_query, rasqal_query_get_projection(rdf_query))) return 1; return 0; } static int sparql_parse(rasqal_query* rq) { rasqal_sparql_query_language* rqe; raptor_locator *locator=&rq->locator; rqe = (rasqal_sparql_query_language*)rq->context; if(!rq->query_string) return yy_init_globals(NULL); /* 0 but a way to use yy_init_globals */ locator->line = 1; locator->column = -1; /* No column info */ locator->byte = -1; /* No bytes info */ rqe->lineno = 1; if(sparql_lexer_lex_init(&rqe->scanner)) return 1; rqe->scanner_set = 1; #if defined(YYDEBUG) && YYDEBUG > 0 sparql_lexer_set_debug(1 ,&rqe->scanner); sparql_parser_debug = 1; #endif sparql_lexer_set_extra(rq, rqe->scanner); (void)sparql_lexer__scan_buffer(RASQAL_GOOD_CAST(char*, rq->query_string), rq->query_string_length, rqe->scanner); rqe->error_count = 0; sparql_parser_parse(rq, rqe->scanner); sparql_lexer_lex_destroy(rqe->scanner); rqe->scanner_set = 0; /* Parsing failed */ if(rq->failed) return 1; return 0; } static void sparql_query_error(rasqal_query *rq, const char *msg) { rasqal_sparql_query_language* rqe; rqe = (rasqal_sparql_query_language*)rq->context; if(rqe->error_count++) return; rq->locator.line = rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rq->locator.column = sparql_lexer_get_column(yyscanner);*/ #endif rq->failed = 1; rasqal_log_error_simple(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_ERROR, &rq->locator, "%s", msg); } static void sparql_query_error_full(rasqal_query *rq, const char *message, ...) { va_list arguments; rasqal_sparql_query_language* rqe; rqe = (rasqal_sparql_query_language*)rq->context; if(rqe->error_count++) return; rq->locator.line = rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rq->locator.column = sparql_lexer_get_column(yyscanner);*/ #endif va_start(arguments, message); rq->failed = 1; rasqal_log_error_varargs(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_ERROR, &rq->locator, message, arguments); va_end(arguments); } int sparql_syntax_error(rasqal_query *rq, const char *message, ...) { rasqal_sparql_query_language *rqe; va_list arguments; rqe = (rasqal_sparql_query_language*)rq->context; if(rqe->error_count++) return 0; rq->locator.line=rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rp->locator.column=sparql_lexer_get_column(yyscanner);*/ #endif va_start(arguments, message); rq->failed = 1; rasqal_log_error_varargs(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_ERROR, &rq->locator, message, arguments); va_end(arguments); return 0; } int sparql_syntax_warning(rasqal_query *rq, const char *message, ...) { rasqal_sparql_query_language *rqe; va_list arguments; if(RASQAL_WARNING_LEVEL_QUERY_SYNTAX < rq->world->warning_level) return 0; rqe = (rasqal_sparql_query_language*)rq->context; rq->locator.line = rqe->lineno; #ifdef RASQAL_SPARQL_USE_ERROR_COLUMNS /* rq->locator.column=sparql_lexer_get_column(yyscanner);*/ #endif va_start(arguments, message); rasqal_log_error_varargs(((rasqal_query*)rq)->world, RAPTOR_LOG_LEVEL_WARN, &rq->locator, message, arguments); va_end(arguments); return 0; } static int rasqal_sparql_query_language_iostream_write_escaped_counted_string(rasqal_query* query, raptor_iostream* iostr, const unsigned char* string, size_t len) { const char delim = '"'; raptor_iostream_write_byte(delim, iostr); if(raptor_string_ntriples_write(string, len, delim, iostr)) return 1; raptor_iostream_write_byte(delim, iostr); return 0; } static const char* const sparql_names[] = { "sparql10", NULL}; static const raptor_type_q sparql_types[] = { { NULL, 0, 0} }; static int rasqal_sparql_query_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql_names; factory->desc.mime_types = sparql_types; factory->desc.label = "SPARQL 1.0 W3C RDF Query Language"; factory->desc.uri_strings = NULL; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } int rasqal_init_query_language_sparql(rasqal_world* world) { return !rasqal_query_language_register_factory(world, &rasqal_sparql_query_language_register_factory); } static const char* const sparql11_names[] = { "sparql", "sparql11", NULL }; static const char* const sparql11_uri_strings[] = { "http://www.w3.org/TR/rdf-sparql-query/", NULL }; static const raptor_type_q sparql11_types[] = { { "application/sparql", 18, 10}, { NULL, 0, 0} }; static int rasqal_sparql11_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql11_names; factory->desc.mime_types = sparql11_types; factory->desc.label = "SPARQL 1.1 (DRAFT) Query and Update Languages"; /* What URI describes Query and Update languages? */ factory->desc.uri_strings = sparql11_uri_strings; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } static const char* const sparql11_query_names[] = { "sparql11-query", NULL }; static const char* const sparql11_query_uri_strings[] = { "http://www.w3.org/TR/2010/WD-sparql11-query-20101014/", NULL }; static const raptor_type_q sparql11_query_types[] = { { NULL, 0, 0} }; static int rasqal_sparql11_query_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql11_query_names; factory->desc.mime_types = sparql11_query_types; factory->desc.label = "SPARQL 1.1 (DRAFT) Query Language"; factory->desc.uri_strings = sparql11_query_uri_strings; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } static const char* const sparql11_update_names[] = { "sparql11-update", NULL }; static const char* const sparql11_update_uri_strings[] = { "http://www.w3.org/TR/2010/WD-sparql11-update-20101014/", NULL }; static const raptor_type_q sparql11_update_types[] = { { NULL, 0, 0} }; static int rasqal_sparql11_update_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = sparql11_update_names; factory->desc.mime_types = sparql11_update_types; factory->desc.label = "SPARQL 1.1 (DRAFT) Update Language"; factory->desc.uri_strings = sparql11_update_uri_strings; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } int rasqal_init_query_language_sparql11(rasqal_world* world) { if(!rasqal_query_language_register_factory(world, &rasqal_sparql11_language_register_factory)) return 1; if(!rasqal_query_language_register_factory(world, &rasqal_sparql11_query_language_register_factory)) return 1; if(!rasqal_query_language_register_factory(world, &rasqal_sparql11_update_language_register_factory)) return 1; return 0; } static const char* const laqrs_names[] = { "laqrs", NULL}; static const raptor_type_q laqrs_types[] = { { NULL, 0, 0} }; static int rasqal_laqrs_query_language_register_factory(rasqal_query_language_factory *factory) { int rc = 0; factory->desc.names = laqrs_names; factory->desc.mime_types = laqrs_types; factory->desc.label = "LAQRS adds to Querying RDF in SPARQL"; factory->desc.uri_strings = NULL; factory->context_length = sizeof(rasqal_sparql_query_language); factory->init = rasqal_sparql_query_language_init; factory->terminate = rasqal_sparql_query_language_terminate; factory->prepare = rasqal_sparql_query_language_prepare; factory->iostream_write_escaped_counted_string = rasqal_sparql_query_language_iostream_write_escaped_counted_string; return rc; } int rasqal_init_query_language_laqrs(rasqal_world* world) { return !rasqal_query_language_register_factory(world, &rasqal_laqrs_query_language_register_factory); } #ifdef STANDALONE #include #include #ifdef HAVE_GETOPT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifndef HAVE_GETOPT #include #endif #ifdef NEED_OPTIND_DECLARATION extern int optind; extern char *optarg; #endif #define GETOPT_STRING "di:" #define SPARQL_FILE_BUF_SIZE 4096 static char query_string[SPARQL_FILE_BUF_SIZE]; int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_query *query = NULL; FILE *fh; int rc; const char *filename = NULL; raptor_uri* base_uri = NULL; unsigned char *uri_string = NULL; const char* query_language = "sparql"; int usage = 0; rasqal_world *world; size_t read_len; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) exit(1); filename = getenv("SPARQL_QUERY_FILE"); while(!usage) { int c = getopt (argc, argv, GETOPT_STRING); if (c == -1) break; switch (c) { case 0: case '?': /* getopt() - unknown option */ usage = 1; break; case 'd': #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 sparql_parser_debug = 1; #endif break; case 'i': if(optarg) { if(rasqal_language_name_check(world, optarg)) { query_language = optarg; } else { fprintf(stderr, "%s: Unknown query language '%s'\n", program, optarg); usage = 1; } } break; } } if(!filename) { if((argc-optind) != 1) { fprintf(stderr, "%s: Too many arguments.\n", program); usage = 1; } else filename = argv[optind]; } if(usage) { fprintf(stderr, "SPARQL/LAQRS parser test for Rasqal %s\n", rasqal_version_string); fprintf(stderr, "USAGE: %s [OPTIONS] SPARQL-QUERY-FILE\n", program); fprintf(stderr, "OPTIONS:\n"); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 fprintf(stderr, " -d Bison parser debugging\n"); #endif fprintf(stderr, " -i LANGUAGE Set query language\n"); rc = 1; goto tidy; } fh = fopen(filename, "r"); if(!fh) { fprintf(stderr, "%s: Cannot open file %s - %s\n", program, filename, strerror(errno)); rc = 1; goto tidy; } memset(query_string, 0, SPARQL_FILE_BUF_SIZE); read_len = fread(query_string, SPARQL_FILE_BUF_SIZE, 1, fh); if(read_len < SPARQL_FILE_BUF_SIZE) { if(ferror(fh)) { fprintf(stderr, "%s: file '%s' read failed - %s\n", program, filename, strerror(errno)); fclose(fh); rc = 1; goto tidy; } } fclose(fh); query = rasqal_new_query(world, query_language, NULL); rc = 1; if(query) { uri_string = raptor_uri_filename_to_uri_string(filename); if(uri_string) { base_uri = raptor_new_uri(world->raptor_world_ptr, uri_string); if(base_uri) { rc = rasqal_query_prepare(query, RASQAL_GOOD_CAST(const unsigned char*, query_string), base_uri); if(!rc) rasqal_query_print(query, stdout); } } } tidy: if(query) rasqal_free_query(query); if(base_uri) raptor_free_uri(base_uri); if(uri_string) raptor_free_memory(uri_string); if(world) rasqal_free_world(world); return rc; } #endif /* STANDALONE */ rasqal-0.9.33/src/timegm.c0000644000175000017500000000235311624370710012233 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * timegm.c - timegm compatibility * * This file is in the public domain. * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_TIME_H #include #endif #include "rasqal.h" #include "rasqal_internal.h" #ifdef WIN32 time_t rasqal_timegm(struct tm *tm) { struct tm my_tm; memcpy(&my_tm, tm, sizeof(struct tm)); /* _mkgmtime() changes the value of the struct tm* you pass in, so * use a copy */ return _mkgmtime(&my_tm); } #else time_t rasqal_timegm(struct tm *tm) { time_t result; char *zone; zone = getenv("TZ"); if(zone) { /* save it so that setenv() does not destroy shared value */ size_t zone_len = strlen(zone); char *zone_copy = RASQAL_MALLOC(char*, zone_len + 1); if(!zone_copy) return -1; memcpy(zone_copy, zone, zone_len + 1); /* Copy NUL */ zone = zone_copy; } setenv("TZ", "UTC", 1); tzset(); result = mktime(tm); if(zone) setenv("TZ", zone, 1); else unsetenv("TZ"); tzset(); if(zone) RASQAL_FREE(char*, zone); return result; } #endif rasqal-0.9.33/src/rasqal_format_sparql_xml.c0000644000175000017500000011102412435675630016054 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_format_sparql_xml.c - Read and write formats in SPARQL XML * * Copyright (C) 2007-2014, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #include static int rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri); static rasqal_rowsource* rasqal_query_results_get_rowsource_sparql_xml(rasqal_query_results_formatter* formatter, rasqal_world *world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 #define TRACE_XML 1 #else #undef TRACE_XML #endif #ifndef FILE_READ_BUF_SIZE #ifdef BUFSIZ #define FILE_READ_BUF_SIZE BUFSIZ #else #define FILE_READ_BUF_SIZE 1024 #endif #endif /* * rasqal_query_results_write_sparql_xml: * @iostr: #raptor_iostream to write the query results to * @results: #rasqal_query_results query results input * @base_uri: #raptor_uri base URI of the output format * * Write the fourth version of the SPARQL XML query results format to an * iostream in a format - INTERNAL. * * If the writing succeeds, the query results will be exhausted. * * Return value: non-0 on failure **/ static int rasqal_query_results_write_sparql_xml(rasqal_query_results_formatter* formatter, raptor_iostream *iostr, rasqal_query_results* results, raptor_uri *base_uri) { int rc=1; rasqal_world* world = rasqal_query_results_get_world(results); raptor_xml_writer* xml_writer=NULL; raptor_namespace *res_ns=NULL; raptor_namespace_stack *nstack=NULL; raptor_xml_element *sparql_element=NULL; raptor_xml_element *results_element=NULL; raptor_xml_element *result_element=NULL; raptor_xml_element *element1=NULL; raptor_xml_element *binding_element=NULL; raptor_xml_element *variable_element=NULL; raptor_qname **attrs=NULL; int i; rasqal_query_results_type type; type = rasqal_query_results_get_type(results); if(type != RASQAL_QUERY_RESULTS_BINDINGS && type != RASQAL_QUERY_RESULTS_BOOLEAN) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot write XML format v3 for %s query result format", rasqal_query_results_type_label(type)); return 1; } nstack = raptor_new_namespaces(world->raptor_world_ptr, 1); if(!nstack) return 1; xml_writer = raptor_new_xml_writer(world->raptor_world_ptr, nstack, iostr); if(!xml_writer) goto tidy; res_ns=raptor_new_namespace(nstack, NULL, RASQAL_GOOD_CAST(const unsigned char*, "http://www.w3.org/2005/sparql-results#"), 0); if(!res_ns) goto tidy; sparql_element=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "sparql"), NULL, base_uri); if(!sparql_element) goto tidy; raptor_xml_writer_start_element(xml_writer, sparql_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); /* */ element1=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "head"), NULL, base_uri); if(!element1) goto tidy; raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 2); raptor_xml_writer_start_element(xml_writer, element1); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); if(rasqal_query_results_is_bindings(results)) { for(i=0; 1; i++) { const unsigned char *name; name=rasqal_query_results_get_binding_name(results, i); if(!name) break; /* */ variable_element=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*,"variable"), NULL, base_uri); if(!variable_element) goto tidy; attrs=(raptor_qname **)raptor_alloc_memory(sizeof(raptor_qname*)); if(!attrs) goto tidy; attrs[0] = raptor_new_qname_from_namespace_local_name(world->raptor_world_ptr, res_ns, RASQAL_GOOD_CAST(const unsigned char*,"name"), RASQAL_GOOD_CAST(const unsigned char*, name)); /* attribute value */ if(!attrs[0]) { raptor_free_memory((void*)attrs); goto tidy; } raptor_xml_element_set_attributes(variable_element, attrs, 1); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 4); raptor_xml_writer_empty_element(xml_writer, variable_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); raptor_free_xml_element(variable_element); variable_element=NULL; } } /* FIXME - could add inside */ /* */ raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 2); raptor_xml_writer_end_element(xml_writer, element1); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); raptor_free_xml_element(element1); element1=NULL; /* Boolean Results */ if(rasqal_query_results_is_boolean(results)) { result_element=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "boolean"), NULL, base_uri); if(!result_element) goto tidy; raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 2); raptor_xml_writer_start_element(xml_writer, result_element); if(rasqal_query_results_get_boolean(results)) raptor_xml_writer_raw(xml_writer, rasqal_xsd_boolean_true); else raptor_xml_writer_raw(xml_writer, rasqal_xsd_boolean_false); raptor_xml_writer_end_element(xml_writer, result_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); goto results3done; } /* Variable Binding Results */ /* */ results_element=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "results"), NULL, base_uri); if(!results_element) goto tidy; raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 2); raptor_xml_writer_start_element(xml_writer, results_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); /* declare result element for later multiple use */ result_element=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "result"), NULL, base_uri); if(!result_element) goto tidy; while(!rasqal_query_results_finished(results)) { /* */ raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 4); raptor_xml_writer_start_element(xml_writer, result_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); for(i=0; i */ binding_element=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "binding"), NULL, base_uri); if(!binding_element) goto tidy; attrs=(raptor_qname **)raptor_alloc_memory(sizeof(raptor_qname*)); if(!attrs) goto tidy; attrs[0] = raptor_new_qname_from_namespace_local_name(world->raptor_world_ptr, res_ns, RASQAL_GOOD_CAST(const unsigned char*, "name"), name); if(!attrs[0]) { raptor_free_memory((void*)attrs); goto tidy; } raptor_xml_element_set_attributes(binding_element, attrs, 1); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 6); raptor_xml_writer_start_element(xml_writer, binding_element); if(!l) { element1=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "unbound"), NULL, base_uri); if(!element1) goto tidy; raptor_xml_writer_empty_element(xml_writer, element1); } else switch(l->type) { case RASQAL_LITERAL_URI: element1=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "uri"), NULL, base_uri); if(!element1) goto tidy; raptor_xml_writer_start_element(xml_writer, element1); raptor_xml_writer_cdata(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_string(l->value.uri))); raptor_xml_writer_end_element(xml_writer, element1); break; case RASQAL_LITERAL_BLANK: element1=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "bnode"), NULL, base_uri); if(!element1) goto tidy; raptor_xml_writer_start_element(xml_writer, element1); raptor_xml_writer_cdata(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, l->string)); raptor_xml_writer_end_element(xml_writer, element1); break; case RASQAL_LITERAL_STRING: case RASQAL_LITERAL_UDT: element1=raptor_new_xml_element_from_namespace_local_name(res_ns, RASQAL_GOOD_CAST(const unsigned char*, "literal"), NULL, base_uri); if(!element1) goto tidy; if(l->language || l->datatype) { attrs=(raptor_qname **)raptor_alloc_memory(sizeof(raptor_qname*)); if(!attrs) goto tidy; if(l->language) attrs[0]=raptor_new_qname(nstack, RASQAL_GOOD_CAST(const unsigned char*, "xml:lang"), RASQAL_GOOD_CAST(const unsigned char*, l->language)); else attrs[0] = raptor_new_qname_from_namespace_local_name(world->raptor_world_ptr, res_ns, RASQAL_GOOD_CAST(const unsigned char*, "datatype"), RASQAL_GOOD_CAST(const unsigned char*, raptor_uri_as_string(l->datatype))); if(!attrs[0]) { raptor_free_memory((void*)attrs); goto tidy; } raptor_xml_element_set_attributes(element1, attrs, 1); } raptor_xml_writer_start_element(xml_writer, element1); raptor_xml_writer_cdata_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, l->string), l->string_len); raptor_xml_writer_end_element(xml_writer, element1); break; case RASQAL_LITERAL_PATTERN: case RASQAL_LITERAL_QNAME: case RASQAL_LITERAL_INTEGER: case RASQAL_LITERAL_XSD_STRING: case RASQAL_LITERAL_BOOLEAN: case RASQAL_LITERAL_DOUBLE: case RASQAL_LITERAL_FLOAT: case RASQAL_LITERAL_VARIABLE: case RASQAL_LITERAL_DECIMAL: case RASQAL_LITERAL_DATE: case RASQAL_LITERAL_DATETIME: case RASQAL_LITERAL_INTEGER_SUBTYPE: case RASQAL_LITERAL_UNKNOWN: default: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Cannot turn literal type %u into XML", l->type); goto tidy; } if(element1) { raptor_free_xml_element(element1); element1=NULL; } /*
*/ raptor_xml_writer_end_element(xml_writer, binding_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); raptor_free_xml_element(binding_element); binding_element=NULL; } raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 4); raptor_xml_writer_end_element(xml_writer, result_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); rasqal_query_results_next(results); } raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, " "), 2); raptor_xml_writer_end_element(xml_writer, results_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); results3done: rc=0; raptor_xml_writer_end_element(xml_writer, sparql_element); raptor_xml_writer_raw_counted(xml_writer, RASQAL_GOOD_CAST(const unsigned char*, "\n"), 1); tidy: if(element1) raptor_free_xml_element(element1); if(variable_element) raptor_free_xml_element(variable_element); if(binding_element) raptor_free_xml_element(binding_element); if(result_element) raptor_free_xml_element(result_element); if(results_element) raptor_free_xml_element(results_element); if(sparql_element) raptor_free_xml_element(sparql_element); if(res_ns) raptor_free_namespace(res_ns); if(xml_writer) raptor_free_xml_writer(xml_writer); if(nstack) raptor_free_namespaces(nstack); return rc; } const char* const sparql_xml_element_names[]= { "!", /* In rough order they appear */ "sparql", "head", "boolean", "binding", "variable", "results", "result", "bnode", "literal", "uri", NULL }; typedef enum { STATE_unknown, /* In same order as above */ STATE_sparql, STATE_head, STATE_boolean, STATE_binding, STATE_variable, STATE_results, STATE_result, STATE_bnode, STATE_literal, STATE_uri, STATE_first = STATE_sparql, STATE_last = STATE_uri } rasqal_sparql_xml_read_state; typedef struct { rasqal_world* world; rasqal_rowsource* rowsource; int failed; #ifdef TRACE_XML int trace; #endif /* Input fields */ raptor_uri* base_uri; raptor_iostream* iostr; /* SAX2 fields */ raptor_sax2* sax2; raptor_locator locator; int depth; /* element depth */ /* SPARQL XML Results parsing */ rasqal_sparql_xml_read_state state; /* state */ /* state-based fields for turning XML into rasqal literals, rows */ const char* name; /* variable name (from binding/@name) */ size_t name_length; raptor_stringbuffer *sb; /* URI string, literal string or blank node ID */ const char* datatype; /* literal datatype URI string from literal/@datatype */ const char* language; /* literal language from literal/@xml:lang */ rasqal_row* row; /* current result row */ int offset; /* current result row number */ int result_offset; /* current column number */ unsigned char buffer[FILE_READ_BUF_SIZE]; /* iostream read buffer */ /* Output fields */ raptor_sequence* results_sequence; /* saved result rows */ /* Variables table allocated for variables in the result set */ rasqal_variables_table* vars_table; int variables_count; unsigned int flags; int boolean_value; } rasqal_rowsource_sparql_xml_context; static void rasqal_sparql_xml_free_context(rasqal_rowsource_sparql_xml_context* con); #ifdef TRACE_XML static void pad(FILE* fh, int depth) { int i; for(i=0; i< depth; i++) fputs(" ", fh); } #endif static int rasqal_sparql_xml_start(rasqal_rowsource_sparql_xml_context* con) { con->state = STATE_unknown; #ifdef TRACE_XML con->trace = 1; #endif con->depth = 0; raptor_sax2_parse_start(con->sax2, con->base_uri); return 0; } static void rasqal_sparql_xml_sax2_start_element_handler(void *user_data, raptor_xml_element *xml_element) { rasqal_rowsource_sparql_xml_context* con; int i; raptor_qname* name; rasqal_sparql_xml_read_state state=STATE_unknown; int attr_count; con=(rasqal_rowsource_sparql_xml_context*)user_data; name=raptor_xml_element_get_name(xml_element); for(i=STATE_first; i <= STATE_last; i++) { if(!strcmp(RASQAL_GOOD_CAST(const char*, raptor_qname_get_local_name(name)), sparql_xml_element_names[i])) { state=(rasqal_sparql_xml_read_state)i; con->state=state; } } if(state == STATE_unknown) { fprintf(stderr, "UNKNOWN element %s\n", raptor_qname_get_local_name(name)); con->failed++; } #ifdef TRACE_XML if(con->trace) { pad(stderr, con->depth); fprintf(stderr, "Element %s (%d)\n", raptor_qname_get_local_name(name), state); } #endif attr_count=raptor_xml_element_get_attributes_count(xml_element); con->name=NULL; con->sb = raptor_new_stringbuffer(); con->datatype=NULL; con->language=NULL; if(attr_count > 0) { raptor_qname** attrs=raptor_xml_element_get_attributes(xml_element); for(i = 0; i < attr_count; i++) { const char* local_name = RASQAL_GOOD_CAST(const char*, raptor_qname_get_local_name(attrs[i])); #ifdef TRACE_XML if(con->trace) { pad(stderr, con->depth+1); fprintf(stderr, "Attribute %s='%s'\n", local_name, raptor_qname_get_value(attrs[i])); } #endif if(!strcmp(local_name, "name")) con->name = RASQAL_GOOD_CAST(const char*, raptor_qname_get_counted_value(attrs[i], &con->name_length)); else if(!strcmp(local_name, "datatype")) con->datatype = RASQAL_GOOD_CAST(const char*, raptor_qname_get_value(attrs[i])); } } if(raptor_xml_element_get_language(xml_element)) { con->language = RASQAL_GOOD_CAST(const char*, raptor_xml_element_get_language(xml_element)); #ifdef TRACE_XML if(con->trace) { pad(stderr, con->depth+1); fprintf(stderr, "xml:lang '%s'\n", con->language); } #endif } switch(state) { case STATE_variable: if(con->name) { rasqal_variable *v; v = rasqal_variables_table_add2(con->vars_table, RASQAL_VARIABLE_TYPE_NORMAL, RASQAL_GOOD_CAST(const unsigned char*, con->name), con->name_length, NULL); if(v) { rasqal_rowsource_add_variable(con->rowsource, v); /* above function takes a reference to v */ rasqal_free_variable(v); } } break; case STATE_result: if(1) { con->row = rasqal_new_row(con->rowsource); RASQAL_DEBUG2("Made new row %d\n", con->offset); con->offset++; } break; case STATE_binding: con->result_offset = rasqal_rowsource_get_variable_offset_by_name(con->rowsource, RASQAL_GOOD_CAST(const unsigned char*, con->name)); break; case STATE_sparql: case STATE_head: case STATE_boolean: case STATE_results: case STATE_literal: case STATE_bnode: case STATE_uri: case STATE_unknown: default: break; } con->depth++; } static void rasqal_sparql_xml_sax2_characters_handler(void *user_data, raptor_xml_element* xml_element, const unsigned char *s, int len) { rasqal_rowsource_sparql_xml_context* con; con=(rasqal_rowsource_sparql_xml_context*)user_data; #ifdef TRACE_XML if(con->trace) { pad(stderr, con->depth); fputs("Text '", stderr); fwrite(s, sizeof(char), len, stderr); fprintf(stderr, "' (%d bytes)\n", len); } #endif if(con->state == STATE_literal || con->state == STATE_uri || con->state == STATE_bnode || con->state == STATE_boolean ) { raptor_stringbuffer_append_counted_string(con->sb, s, RASQAL_BAD_CAST(size_t, len), 1); } } static void rasqal_sparql_xml_sax2_end_element_handler(void *user_data, raptor_xml_element* xml_element) { rasqal_rowsource_sparql_xml_context* con; raptor_qname* name; int i; rasqal_sparql_xml_read_state state=STATE_unknown; const char* value = NULL; size_t value_len = 0; con=(rasqal_rowsource_sparql_xml_context*)user_data; name=raptor_xml_element_get_name(xml_element); if(con->sb) { value_len = raptor_stringbuffer_length(con->sb); value = RASQAL_GOOD_CAST(const char*, raptor_stringbuffer_as_string(con->sb)); } for(i=STATE_first; i <= STATE_last; i++) { if(!strcmp(RASQAL_GOOD_CAST(const char*, raptor_qname_get_local_name(name)), sparql_xml_element_names[i])) { state=(rasqal_sparql_xml_read_state)i; con->state=state; } } if(state == STATE_unknown) { fprintf(stderr, "UNKNOWN element %s\n", raptor_qname_get_local_name(name)); con->failed++; } con->depth--; #ifdef TRACE_XML if(con->trace) { pad(stderr, con->depth); fprintf(stderr, "End Element %s (%d)\n", raptor_qname_get_local_name(name), con->state); } #endif switch(con->state) { case STATE_head: if(con->vars_table) { /* Only now is the full number of variables correct in * con->rowsource->size */ con->variables_count = con->rowsource->size; } break; case STATE_boolean: if(1) { con->boolean_value = -1; if(value_len == 4 && !strncmp(value, "true", value_len)) con->boolean_value = 1; else if(value_len == 5 && !strncmp(value, "false", value_len)) con->boolean_value = 0; RASQAL_DEBUG3("boolean result string '%s' value %d\n", value, con->boolean_value); } break; case STATE_literal: if(1) { rasqal_literal* l; unsigned char* lvalue; raptor_uri* datatype_uri=NULL; char* language_str=NULL; lvalue = RASQAL_MALLOC(unsigned char*, value_len + 1); if(!value_len) *lvalue = '\0'; else memcpy(lvalue, value, value_len + 1); if(con->datatype) datatype_uri = raptor_new_uri(con->world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, con->datatype)); if(con->language) { size_t language_len = strlen(con->language); language_str = RASQAL_MALLOC(char*, language_len + 1); memcpy(language_str, con->language, language_len + 1); } l = rasqal_new_string_literal_node(con->world, lvalue, language_str, datatype_uri); rasqal_row_set_value_at(con->row, con->result_offset, l); rasqal_free_literal(l); RASQAL_DEBUG3("Saving row result %d string value at offset %d\n", con->offset, con->result_offset); } break; case STATE_bnode: if(1) { rasqal_literal* l; unsigned char* lvalue; lvalue = RASQAL_MALLOC(unsigned char*, value_len + 1); memcpy(lvalue, value, value_len + 1); l = rasqal_new_simple_literal(con->world, RASQAL_LITERAL_BLANK, lvalue); rasqal_row_set_value_at(con->row, con->result_offset, l); rasqal_free_literal(l); RASQAL_DEBUG3("Saving row result %d bnode value at offset %d\n", con->offset, con->result_offset); } break; case STATE_uri: if(1) { raptor_uri* uri; rasqal_literal* l; uri = raptor_new_uri(con->world->raptor_world_ptr, RASQAL_GOOD_CAST(const unsigned char*, value)); l = rasqal_new_uri_literal(con->world, uri); rasqal_row_set_value_at(con->row, con->result_offset, l); rasqal_free_literal(l); RASQAL_DEBUG3("Saving row result %d uri value at offset %d\n", con->offset, con->result_offset); } break; case STATE_result: if(con->row) { RASQAL_DEBUG2("Saving row result %d\n", con->offset); con->row->offset = con->offset - 1; raptor_sequence_push(con->results_sequence, con->row); } con->row = NULL; break; case STATE_unknown: case STATE_sparql: case STATE_variable: case STATE_results: case STATE_binding: default: break; } if(con->sb) { raptor_free_stringbuffer(con->sb); con->sb = raptor_new_stringbuffer(); } } /* Local handlers for turning sparql XML read from an iostream into rows */ static int rasqal_rowsource_sparql_xml_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sparql_xml_context* con; con = (rasqal_rowsource_sparql_xml_context*)user_data; con->rowsource = rowsource; return rasqal_sparql_xml_start(con); } static int rasqal_rowsource_sparql_xml_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sparql_xml_context* con; con = (rasqal_rowsource_sparql_xml_context*)user_data; rasqal_sparql_xml_free_context(con); return 0; } static void rasqal_rowsource_sparql_xml_process(rasqal_rowsource_sparql_xml_context* con) { if(raptor_sequence_size(con->results_sequence) && con->variables_count > 0) return; /* do some parsing - need some results */ while(!raptor_iostream_read_eof(con->iostr)) { size_t read_len; read_len = RASQAL_BAD_CAST(size_t, raptor_iostream_read_bytes(RASQAL_GOOD_CAST(char*, con->buffer), 1, FILE_READ_BUF_SIZE, con->iostr)); if(read_len > 0) { #ifdef TRACE_XML RASQAL_DEBUG2("processing %d bytes\n", RASQAL_GOOD_CAST(int, read_len)); #endif raptor_sax2_parse_chunk(con->sax2, con->buffer, read_len, 0); } if(read_len < FILE_READ_BUF_SIZE) { /* finished */ raptor_sax2_parse_chunk(con->sax2, NULL, 0, 1); break; } /* end with variables sequence done AND at least one row */ if(con->variables_count > 0 && raptor_sequence_size(con->results_sequence) > 0) break; } } static int rasqal_rowsource_sparql_xml_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sparql_xml_context* con; con = (rasqal_rowsource_sparql_xml_context*)user_data; rasqal_rowsource_sparql_xml_process(con); return con->failed; } static rasqal_row* rasqal_rowsource_sparql_xml_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsource_sparql_xml_context* con; rasqal_row* row=NULL; con=(rasqal_rowsource_sparql_xml_context*)user_data; rasqal_rowsource_sparql_xml_process(con); if(!con->failed && raptor_sequence_size(con->results_sequence) > 0) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 RASQAL_DEBUG1("getting row from stored sequence\n"); #endif row=(rasqal_row*)raptor_sequence_unshift(con->results_sequence); } return row; } /* * rasqal_sparql_xml_init_context: * @world: rasqal world object * @iostr: #raptor_iostream to read the query results from * @base_uri: #raptor_uri base URI of the input format * @flags: flags * * INTERNAL - Initialise the SPARQL XML context * * Return value: context or NULL on failure **/ static rasqal_rowsource_sparql_xml_context* rasqal_sparql_xml_init_context(rasqal_world *world, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_sparql_xml_context* con; con = RASQAL_CALLOC(rasqal_rowsource_sparql_xml_context*, 1, sizeof(*con)); if(!con) return NULL; con->world = world; con->base_uri = base_uri ? raptor_uri_copy(base_uri) : NULL; con->iostr = iostr; con->locator.uri = base_uri; con->sax2 = raptor_new_sax2(world->raptor_world_ptr, &con->locator, con); if(!con->sax2) return NULL; con->flags = flags; raptor_sax2_set_start_element_handler(con->sax2, rasqal_sparql_xml_sax2_start_element_handler); raptor_sax2_set_characters_handler(con->sax2, rasqal_sparql_xml_sax2_characters_handler); raptor_sax2_set_end_element_handler(con->sax2, rasqal_sparql_xml_sax2_end_element_handler); return con; } /* * rasqal_sparql_xml_free_context: * @con: SPARQL xml context * * INTERNAL - Free the SPARQL XML context **/ static void rasqal_sparql_xml_free_context(rasqal_rowsource_sparql_xml_context* con) { if(con->base_uri) raptor_free_uri(con->base_uri); if(con->sax2) raptor_free_sax2(con->sax2); if(con->results_sequence) raptor_free_sequence(con->results_sequence); if(con->vars_table) rasqal_free_variables_table(con->vars_table); if(con->flags) { if(con->iostr) raptor_free_iostream(con->iostr); } if(con->sb) raptor_free_stringbuffer(con->sb); RASQAL_FREE(rasqal_rowsource_sparql_xml_context, con); } static int rasqal_rowsource_sparql_xml_get_boolean(rasqal_query_results_formatter *formatter, rasqal_world* world, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_sparql_xml_context* con; int bv; con = rasqal_sparql_xml_init_context(world, iostr, base_uri, flags); if(!con) return -1; rasqal_sparql_xml_start(con); /* do some parsing - until we get the boolean value */ while(!raptor_iostream_read_eof(con->iostr)) { size_t read_len; read_len = RASQAL_BAD_CAST(size_t, raptor_iostream_read_bytes(RASQAL_GOOD_CAST(char*, con->buffer), 1, FILE_READ_BUF_SIZE, con->iostr)); if(read_len > 0) { #ifdef TRACE_XML RASQAL_DEBUG2("processing %d bytes\n", RASQAL_GOOD_CAST(int, read_len)); #endif raptor_sax2_parse_chunk(con->sax2, con->buffer, read_len, 0); } if(read_len < FILE_READ_BUF_SIZE) { /* finished */ raptor_sax2_parse_chunk(con->sax2, NULL, 0, 1); break; } /* end with any boolean value */ if(con->boolean_value >= 0) break; } bv = con->boolean_value; rasqal_sparql_xml_free_context(con); return bv; } static const rasqal_rowsource_handler rasqal_rowsource_sparql_xml_handler={ /* .version = */ 1, "SPARQL XML", /* .init = */ rasqal_rowsource_sparql_xml_init, /* .finish = */ rasqal_rowsource_sparql_xml_finish, /* .ensure_variables = */ rasqal_rowsource_sparql_xml_ensure_variables, /* .read_row = */ rasqal_rowsource_sparql_xml_read_row, /* .read_all_rows = */ NULL, /* .reset = */ NULL, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /* * rasqal_query_results_getrowsource_sparql_xml: * @world: rasqal world object * @iostr: #raptor_iostream to read the query results from * @base_uri: #raptor_uri base URI of the input format * * INTERNAL - Read the fourth version of the SPARQL XML query results * format from an iostream in a format returning a rowsource. * * Return value: a new rasqal_rowsource or NULL on failure **/ static rasqal_rowsource* rasqal_query_results_get_rowsource_sparql_xml(rasqal_query_results_formatter* formatter, rasqal_world *world, rasqal_variables_table* vars_table, raptor_iostream *iostr, raptor_uri *base_uri, unsigned int flags) { rasqal_rowsource_sparql_xml_context* con; con = rasqal_sparql_xml_init_context(world, iostr, base_uri, flags); if(!con) return NULL; con->results_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); con->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); return rasqal_new_rowsource_from_handler(world, NULL, con, &rasqal_rowsource_sparql_xml_handler, con->vars_table, 0); } static int rasqal_query_results_xml_recognise_syntax(rasqal_query_results_format_factory* factory, const unsigned char *buffer, size_t len, const unsigned char *identifier, const unsigned char *suffix, const char *mime_type) { if(suffix && !strcmp(RASQAL_GOOD_CAST(const char*, suffix), "srx")) return 8; return 0; } static const char* const sparql_xml_names[] = { "xml", NULL}; static const char* const sparql_xml_uri_strings[] = { "http://www.w3.org/ns/formats/SPARQL_Results_XML", "http://www.w3.org/TR/rdf-sparql-XMLres/", "http://www.w3.org/TR/2008/REC-rdf-sparql-XMLres-20080115/", "http://www.w3.org/2005/sparql-results#", NULL }; static const raptor_type_q sparql_xml_types[] = { { "application/sparql-results+xml", 30, 10}, { NULL, 0, 0} }; static int rasqal_query_results_sparql_xml_register_factory(rasqal_query_results_format_factory *factory) { int rc = 0; factory->desc.names = sparql_xml_names; factory->desc.mime_types = sparql_xml_types; factory->desc.label = "SPARQL XML Query Results"; factory->desc.uri_strings = sparql_xml_uri_strings; factory->desc.flags = 0; factory->write = rasqal_query_results_write_sparql_xml; factory->get_rowsource = rasqal_query_results_get_rowsource_sparql_xml; factory->recognise_syntax = rasqal_query_results_xml_recognise_syntax; factory->get_boolean = rasqal_rowsource_sparql_xml_get_boolean; return rc; } int rasqal_init_result_format_sparql_xml(rasqal_world* world) { return !rasqal_world_register_query_results_format_factory(world, &rasqal_query_results_sparql_xml_register_factory); } rasqal-0.9.33/src/rasqal_variable.c0000644000175000017500000005315612435141254014110 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_variable.c - Rasqal variable support * * 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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #if 0 #define RASQAL_DEBUG_VARIABLE_USAGE #endif #ifndef STANDALONE /** * rasqal_new_variable_from_variable: * @v: #rasqal_variable to copy * * Copy Constructor - Create a new Rasqal variable from an existing one * * This adds a new reference to the variable, it does not do a deep copy * * Return value: a new #rasqal_variable or NULL on failure. **/ rasqal_variable* rasqal_new_variable_from_variable(rasqal_variable* v) { if(!v) return NULL; v->usage++; #ifdef RASQAL_DEBUG_VARIABLE_USAGE RASQAL_DEBUG3("Variable %s usage increased to %d\n", v->name, v->usage); #endif return v; } /** * rasqal_free_variable: * @v: #rasqal_variable object * * Destructor - Destroy a Rasqal variable object. * **/ void rasqal_free_variable(rasqal_variable* v) { if(!v) return; #ifdef RASQAL_DEBUG_VARIABLE_USAGE v->usage--; RASQAL_DEBUG3("Variable %s usage decreased to %d\n", v->name, v->usage); if(v->usage) return; #else if(--v->usage) return; #endif if(v->name) RASQAL_FREE(char*, v->name); if(v->value) rasqal_free_literal(v->value); if(v->expression) rasqal_free_expression(v->expression); RASQAL_FREE(rasqal_variable, v); } /** * rasqal_variable_write: * @v: the #rasqal_variable object * @iostr: the #raptor_iostream handle to write to * * Write a Rasqal variable to an iostream in a debug format. * * The write debug format may change in any release. * **/ void rasqal_variable_write(rasqal_variable* v, raptor_iostream* iostr) { if(!v || !iostr) return; if(v->type == RASQAL_VARIABLE_TYPE_ANONYMOUS) raptor_iostream_counted_string_write("anon-variable(", 14, iostr); else raptor_iostream_counted_string_write("variable(", 9, iostr); raptor_iostream_string_write(v->name, iostr); if(v->expression) { raptor_iostream_write_byte('=', iostr); rasqal_expression_write(v->expression, iostr); } if(v->value) { raptor_iostream_write_byte('=', iostr); rasqal_literal_write(v->value, iostr); } #ifdef RASQAL_DEBUG_VARIABLE_USAGE raptor_iostream_write_byte('[', iostr); raptor_iostream_decimal_write(v->usage, iostr); raptor_iostream_write_byte(']', iostr); #endif raptor_iostream_write_byte(')', iostr); } /* * rasqal_variables_write: * @seq: sequence of #rasqal_variable to write * @iostr: the #raptor_iostream handle to write to * * INTERNAL - Write a sequence of Rasqal variable to an iostream in a debug format. * * The write debug format may change in any release. * **/ int rasqal_variables_write(raptor_sequence* seq, raptor_iostream* iostr) { int vars_size; int i; if(!seq || !iostr) return 1; vars_size = raptor_sequence_size(seq); for(i = 0; i < vars_size; i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(seq, i); if(i > 0) raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_variable_write(v, iostr); } return 0; } /** * rasqal_variable_print: * @v: the #rasqal_variable object * @fh: the FILE* handle to print to * * Print a Rasqal variable in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_variable_print(rasqal_variable* v, FILE* fh) { if(v->type == RASQAL_VARIABLE_TYPE_ANONYMOUS) fprintf(fh, "anon-variable(%s", v->name); else fprintf(fh, "variable(%s", v->name); if(v->expression) { fputc('=', fh); rasqal_expression_print(v->expression, fh); } if(v->value) { fputc('=', fh); rasqal_literal_print(v->value, fh); } #ifdef RASQAL_DEBUG_VARIABLE_USAGE fprintf(fh, "[%d]", v->usage); #endif fputc(')', fh); return 0; } /** * rasqal_variable_set_value: * @v: the #rasqal_variable object * @l: the #rasqal_literal value to set (or NULL) * * Set the value of a Rasqal variable. * * The variable value is an input parameter and is copied in, not shared. * If the variable value is NULL, any existing value is deleted. * **/ void rasqal_variable_set_value(rasqal_variable* v, rasqal_literal* l) { if(v->value) rasqal_free_literal(v->value); v->value = l; #ifdef RASQAL_DEBUG if(!v->name) RASQAL_FATAL1("variable has no name"); RASQAL_DEBUG2("setting variable %s to value ", v->name); rasqal_literal_print(v->value, stderr); fputc('\n', stderr); #endif } /* * A table of variables with optional binding values * * variables are named or anonymous (cannot be selected). */ struct rasqal_variables_table_s { rasqal_world* world; /* usage/reference count */ int usage; /* The variables of size @variables_count + @anon_variables_count * shared pointers into @variables_sequence and @anon_variables_sequence */ rasqal_variable** variables; /* Named variables (owner) */ raptor_sequence* variables_sequence; int variables_count; /* Anonymous variables (owner) */ raptor_sequence* anon_variables_sequence; int anon_variables_count; /* array of variable names. The array is allocated here but the * pointers are into the #variables_sequence above. It is only * allocated if rasqal_variables_table_get_names() is called * on demand, otherwise is NULL. */ const unsigned char** variable_names; }; /** * rasqal_new_variables_table: * @world: rasqal world * * Constructor - create a new variables table * * Return value: new variables table or NULL On failure */ rasqal_variables_table* rasqal_new_variables_table(rasqal_world* world) { rasqal_variables_table* vt; vt = RASQAL_CALLOC(rasqal_variables_table*, 1, sizeof(*vt)); if(!vt) return NULL; vt->usage = 1; vt->world = world; vt->variables_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!vt->variables_sequence) goto tidy; vt->anon_variables_sequence = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!vt->anon_variables_sequence) goto tidy; vt->variable_names = NULL; return vt; tidy: rasqal_free_variables_table(vt); vt = NULL; return vt; } rasqal_variables_table* rasqal_new_variables_table_from_variables_table(rasqal_variables_table* vt) { vt->usage++; return vt; } /** * rasqal_free_variables_table: * @vt: rasqal variables table * * Destructor - destroy a new variables table */ void rasqal_free_variables_table(rasqal_variables_table* vt) { if(!vt) return; if(--vt->usage) return; if(vt->variables) RASQAL_FREE(vararray, vt->variables); if(vt->anon_variables_sequence) raptor_free_sequence(vt->anon_variables_sequence); if(vt->variables_sequence) raptor_free_sequence(vt->variables_sequence); if(vt->variable_names) RASQAL_FREE(cstrings, vt->variable_names); RASQAL_FREE(rasqal_variables_table, vt); } /** * rasqal_variables_table_add_variable: * @vt: #rasqal_variables_table to associate the variable with * @variable: existing variable to add * * Constructor - Add an existing variable to the variables table * * The variables table @vt takes a reference to @variable. This * function will fail if the variable is already in the table. Use * rasqal_variables_table_contains() to check before calling. * * Return value: non-0 on failure (such as name already exists) **/ int rasqal_variables_table_add_variable(rasqal_variables_table* vt, rasqal_variable* variable) { raptor_sequence* seq = NULL; int* count_p = NULL; if(!vt) return 1; switch(variable->type) { case RASQAL_VARIABLE_TYPE_ANONYMOUS: seq = vt->anon_variables_sequence; count_p = &vt->anon_variables_count; break; case RASQAL_VARIABLE_TYPE_NORMAL: seq = vt->variables_sequence; count_p = &vt->variables_count; break; case RASQAL_VARIABLE_TYPE_UNKNOWN: default: RASQAL_DEBUG2("Unknown variable type %u", variable->type); return 1; } if(rasqal_variables_table_contains(vt, variable->type, variable->name)) /* variable with this name already present - error */ return 1; /* add a new v reference for the variables table's sequence */ variable = rasqal_new_variable_from_variable(variable); if(raptor_sequence_push(seq, variable)) return 1; variable->offset = (*count_p); (*count_p)++; if(variable->type == RASQAL_VARIABLE_TYPE_ANONYMOUS) { /* new anon variable: add base offset */ variable->offset += vt->variables_count; } else { int i; /* new normal variable: move all anon variable offsets up 1 */ for(i = 0; i < vt->anon_variables_count; i++) { rasqal_variable* anon_v; anon_v = (rasqal_variable*)raptor_sequence_get_at(vt->anon_variables_sequence, i); anon_v->offset++; } } if(vt->variable_names) { RASQAL_FREE(cstrings, vt->variable_names); vt->variable_names = NULL; } return 0; } /** * rasqal_variables_table_add2: * @vt: #rasqal_variables_table to associate the variable with * @type: variable type defined by enumeration rasqal_variable_type * @name: variable name * @name_len: length of @name (or 0) * @value: variable #rasqal_literal value (or NULL) * * Constructor - Create a new variable and add it to the variables table * * The @name and @value fields are copied. If a variable with the * name already exists, that is returned and the new @value is * ignored. * * Return value: a new #rasqal_variable or NULL on failure. **/ rasqal_variable* rasqal_variables_table_add2(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, size_t name_len, rasqal_literal *value) { rasqal_variable* v = NULL; if(!vt || !name) goto failed; if(!name_len) name_len = strlen(RASQAL_GOOD_CAST(const char*, name)); if(!name_len) goto failed; /* If already present, just return a new reference to it */ v = rasqal_variables_table_get_by_name(vt, type, name); if(v) return rasqal_new_variable_from_variable(v); v = RASQAL_CALLOC(rasqal_variable*, 1, sizeof(*v)); if(!v) goto failed; v->offset = -1; v->usage = 1; v->vars_table = vt; v->type = type; v->name = RASQAL_MALLOC(unsigned char*, name_len + 1); memcpy(RASQAL_GOOD_CAST(char*, v->name), name, name_len + 1); v->value = rasqal_new_literal_from_literal(value); if(rasqal_variables_table_add_variable(vt, v)) goto failed; return v; failed: if(v) RASQAL_FREE(rasqal_variable*, v); return NULL; } /** * rasqal_variables_table_add: * @vt: #rasqal_variables_table to associate the variable with * @type: variable type defined by enumeration rasqal_variable_type * @name: variable name * @value: variable #rasqal_literal value (or NULL) * * Constructor - Create a new variable and add it to the variables table * * @Deprecated: for rasqal_variables_table_add2() which copies the @name * and @value * * The @name and @value become owned by the rasqal_variable * structure. If a variable with the name already exists, that is * returned and the new @value is ignored. * * Return value: a new #rasqal_variable or NULL on failure. **/ rasqal_variable* rasqal_variables_table_add(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, rasqal_literal *value) { rasqal_variable* v; if(!vt || !name) return NULL; v = rasqal_variables_table_add2(vt, type, name, 0, value); RASQAL_FREE(char*, name); if(value) rasqal_free_literal(value); return v; } rasqal_variable* rasqal_variables_table_get(rasqal_variables_table* vt, int idx) { raptor_sequence* seq = NULL; if(idx < 0) return NULL; if(idx < vt->variables_count) seq = vt->variables_sequence; else { idx -= vt->variables_count; seq = vt->anon_variables_sequence; } return (rasqal_variable*)raptor_sequence_get_at(seq, idx); } rasqal_literal* rasqal_variables_table_get_value(rasqal_variables_table* vt, int idx) { rasqal_variable* v; v = rasqal_variables_table_get(vt, idx); if(!v) return NULL; return v->value; } /** * rasqal_variables_table_get_by_name: * @vt: the variables table * @type: the variable type to match or #RASQAL_VARIABLE_TYPE_UNKNOWN for any. * @name: the variable type * * Lookup a variable by type and name in the variables table. * * Note that looking up for any type #RASQAL_VARIABLE_TYPE_UNKNOWN * may a name match but for any type so in cases where the query has * both a named and anonymous (extensional) variable, an arbitrary one * will be returned. * * Return value: a shared pointer to the #rasqal_variable or NULL if not found **/ rasqal_variable* rasqal_variables_table_get_by_name(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name) { int i; rasqal_variable* v; for(i = 0; (v = rasqal_variables_table_get(vt, i)); i++) { if(((type != RASQAL_VARIABLE_TYPE_UNKNOWN) && v->type == type) && !strcmp(RASQAL_GOOD_CAST(const char*, v->name), RASQAL_GOOD_CAST(const char*, name))) return v; } return NULL; } /** * rasqal_variables_table_contains: * @vt: #rasqal_variables_table to lookup * @type: variable type * @name: variable name * * Check if there is a variable with the given type and name in the variables table * * Return value: non-0 if the variable is present */ int rasqal_variables_table_contains(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name) { return (rasqal_variables_table_get_by_name(vt, type, name) != NULL); } int rasqal_variables_table_set(rasqal_variables_table* vt, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value) { rasqal_variable* v; v = rasqal_variables_table_get_by_name(vt, type, name); if(!v) return 1; rasqal_variable_set_value(v, value); return 0; } int rasqal_variables_table_get_named_variables_count(rasqal_variables_table* vt) { return vt->variables_count; } int rasqal_variables_table_get_anonymous_variables_count(rasqal_variables_table* vt) { return vt->anon_variables_count; } int rasqal_variables_table_get_total_variables_count(rasqal_variables_table* vt) { return vt->variables_count + vt->anon_variables_count; } raptor_sequence* rasqal_variables_table_get_named_variables_sequence(rasqal_variables_table* vt) { return vt->variables_sequence; } raptor_sequence* rasqal_variables_table_get_anonymous_variables_sequence(rasqal_variables_table* vt) { return vt->anon_variables_sequence; } const unsigned char** rasqal_variables_table_get_names(rasqal_variables_table* vt) { int size = vt->variables_count; if(!vt->variable_names && size) { int i; vt->variable_names = RASQAL_CALLOC(const unsigned char**, RASQAL_GOOD_CAST(size_t, (size + 1)), sizeof(unsigned char*)); if(!vt->variable_names) return NULL; for(i = 0; i < size; i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(vt->variables_sequence, i); vt->variable_names[i] = v->name; } } return vt->variable_names; } /* * Deep copy a sequence of rasqal_variable to a new one. */ raptor_sequence* rasqal_variable_copy_variable_sequence(raptor_sequence* vars_seq) { raptor_sequence* nvars_seq = NULL; int size; int i; if(!vars_seq) return NULL; nvars_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); if(!nvars_seq) return NULL; size = raptor_sequence_size(vars_seq); for(i = 0; i < size; i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(vars_seq, i); v = rasqal_new_variable_from_variable(v); raptor_sequence_set_at(nvars_seq, i, v); } return nvars_seq; } #if RAPTOR_VERSION < 20015 /* pointers are rasqal_variable** */ static int rasqal_variable_compare_by_name_arg(const void *a, const void *b, void *arg) { rasqal_variable *var_a; rasqal_variable *var_b; var_a = *(rasqal_variable**)a; var_b = *(rasqal_variable**)b; return strcmp(RASQAL_GOOD_CAST(const char*, var_a->name), RASQAL_GOOD_CAST(const char*, var_b->name)); } #else /* pointers are int* */ static int rasqal_order_compare_by_name_arg(const void *a, const void *b, void *arg) { int offset_a; int offset_b; rasqal_variables_table* vt; const unsigned char* name_a; const unsigned char* name_b; offset_a = *(int*)a; offset_b = *(int*)b; vt = (rasqal_variables_table*)arg; name_a = rasqal_variables_table_get(vt, offset_a)->name; name_b = rasqal_variables_table_get(vt, offset_b)->name; return strcmp(RASQAL_GOOD_CAST(const char*, name_a), RASQAL_GOOD_CAST(const char*, name_b)); } #endif /* * rasqal_variables_table_get_order: * @vt: variables table * * INTERNAL - Get the order of the variables in sort order * * Return value: array of integers of order variables (terminated by integer < 0) or NULL on failure */ int* rasqal_variables_table_get_order(rasqal_variables_table* vt) { raptor_sequence* seq; int size; int* order; int i; #if RAPTOR_VERSION < 20015 void** array; #endif seq = rasqal_variables_table_get_named_variables_sequence(vt); if(!seq) return NULL; size = raptor_sequence_size(seq); if(!size) return NULL; order = RASQAL_CALLOC(int*, RASQAL_GOOD_CAST(size_t, size + 1), sizeof(int)); if(!order) return NULL; #if RAPTOR_VERSION < 20015 array = rasqal_sequence_as_sorted(seq, rasqal_variable_compare_by_name_arg, vt); if(!array) return NULL; for(i = 0; i < size; i++) order[i] = (RASQAL_GOOD_CAST(rasqal_variable*, array[i]))->offset; RASQAL_FREE(void*, array); #else for(i = 0; i < size; i++) order[i] = i; raptor_sort_r(order, size, sizeof(int), rasqal_order_compare_by_name_arg, vt); #endif order[size] = -1; return order; } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_world* world = NULL; rasqal_variables_table* vt = NULL; #define NUM_VARS 3 const char* var_names[NUM_VARS] = {"normal-null", "normal-value", "anon"}; rasqal_variable* vars[NUM_VARS]; rasqal_literal *value = NULL; int i; int rc = 0; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); rc = 1; goto tidy; } vt = rasqal_new_variables_table(world); if(!vt) { fprintf(stderr, "%s: Failed to make variables table\n", program); rc = 1; goto tidy; } vars[0] = rasqal_variables_table_add2(vt, RASQAL_VARIABLE_TYPE_NORMAL, RASQAL_GOOD_CAST(const unsigned char*, var_names[0]), 0, NULL); if(!vars[0]) { fprintf(stderr, "%s: Failed to make normal variable with NULL value\n", program); rc = 1; goto tidy; } /* vars[0] now owned by vt */ value = rasqal_new_double_literal(world, 42.0); if(!value) { fprintf(stderr, "%s: Failed to make double literal\n", program); rc = 1; goto tidy; } vars[1] = rasqal_variables_table_add2(vt, RASQAL_VARIABLE_TYPE_NORMAL, RASQAL_GOOD_CAST(const unsigned char*, var_names[1]), 0, value); if(!vars[1]) { fprintf(stderr, "%s: Failed to make normal variable with literal value\n", program); rc = 1; goto tidy; } /* vars[1] now owned by vt */ vars[2] = rasqal_variables_table_add2(vt, RASQAL_VARIABLE_TYPE_ANONYMOUS, RASQAL_GOOD_CAST(const unsigned char*, var_names[2]), 0, NULL); if(!vars[2]) { fprintf(stderr, "%s: Failed to make anonymous variable with NULL value\n", program); rc = 1; goto tidy; } /* vars[2] now owned by vt */ tidy: for(i = 0; i < NUM_VARS; i++) { if(vars[i]) rasqal_free_variable(vars[i]); } if(value) rasqal_free_literal(value); if(vt) rasqal_free_variables_table(vt); if(world) rasqal_free_world(world); return rc; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_rowsource_slice.c0000644000175000017500000001353711720533442015531 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_slice.c - Rasqal slice rows rowsource class * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { /* inner rowsource to slice */ rasqal_rowsource *rowsource; int row_limit; int row_offset; /* offset for input row */ int input_offset; /* offset for output row */ int output_offset; } rasqal_slice_rowsource_context; static int rasqal_slice_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_slice_rowsource_context* con; con = (rasqal_slice_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; if(rasqal_rowsource_copy_variables(rowsource, con->rowsource)) return 1; return 0; } static int rasqal_slice_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_slice_rowsource_context *con; con = (rasqal_slice_rowsource_context*)user_data; con->input_offset = 1; con->output_offset = 1; return 0; } static int rasqal_slice_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_slice_rowsource_context *con; con = (rasqal_slice_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); RASQAL_FREE(rasqal_slice_rowsource_context, con); return 0; } static rasqal_row* rasqal_slice_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_slice_rowsource_context *con; rasqal_row *row = NULL; con = (rasqal_slice_rowsource_context*)user_data; while(1) { int check; row = rasqal_rowsource_read_row(con->rowsource); if(!row) break; check = rasqal_query_check_limit_offset_core(con->input_offset, con->row_limit, con->row_offset); RASQAL_DEBUG4("slice rowsource %p found row #%d %s\n", rowsource, con->input_offset, (check > 0) ? "beyond range" : (!check ? "in range" : "before range")); con->input_offset++; /* finished if beyond result range */ if(check > 0) { rasqal_free_row(row); row = NULL; break; } /* in range, return row */ if(!check) break; /* otherwise before the start of result range so continue */ rasqal_free_row(row); row = NULL; } if(row) row->offset = con->output_offset++; return row; } static int rasqal_slice_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_slice_rowsource_context *con; con = (rasqal_slice_rowsource_context*)user_data; con->input_offset = 1; con->output_offset = 1; return rasqal_rowsource_reset(con->rowsource); } static rasqal_rowsource* rasqal_slice_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_slice_rowsource_context *con; con = (rasqal_slice_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_slice_rowsource_handler = { /* .version = */ 1, "slice", /* .init = */ rasqal_slice_rowsource_init, /* .finish = */ rasqal_slice_rowsource_finish, /* .ensure_variables = */ rasqal_slice_rowsource_ensure_variables, /* .read_row = */ rasqal_slice_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_slice_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_slice_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_slice_rowsource: * @world: world object * @query: query object * @rowsource: input rowsource * @limit: max rows limit (or <0 for no limit) * @offset: start row offset (or <0 for no offset) * * INTERNAL - create a new slice (LIMIT, OFFSET) rowsource * * The @rowsource becomes owned by the new rowsource * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_slice_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, int limit, int offset) { rasqal_slice_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource) goto fail; con = RASQAL_CALLOC(rasqal_slice_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; con->row_limit = limit; con->row_offset = offset; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_slice_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); return NULL; } rasqal-0.9.33/src/rasqal_decimal.c0000644000175000017500000005444412435141254013722 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_decimal.c - Rasqal XSD Decimal * * Copyright (C) 2007-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif /* for round() prototype */ #define _ISOC99_SOURCE 1 #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_MATH_H #include #endif #include #ifdef HAVE_FLOAT_H #include #endif #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE /* prototypes */ static void rasqal_xsd_decimal_init(rasqal_xsd_decimal* dec); static void rasqal_xsd_decimal_clear(rasqal_xsd_decimal* dec); #endif /* not STANDALONE */ #ifdef RASQAL_DECIMAL_C99 /* C99 Decimal * Based on http://www2.hursley.ibm.com/decimal/ */ #define RASQAL_DECIMAL_RAW _Decimal64 #define RASQAL_DECIMAL_ROUNDING int #else #ifdef RASQAL_DECIMAL_MPFR /* MPFR multiple-precision floating-point computations with correct rounding * http://www.mpfr.org/ */ #ifdef HAVE_MPFR_H #include #endif #define RASQAL_DECIMAL_RAW mpfr_t #define RASQAL_DECIMAL_ROUNDING mp_rnd_t #else #ifdef RASQAL_DECIMAL_GMP /* GNU MP - GNU Multiple Precision Arithmetic Library * http://gmplib.org/ */ #ifdef HAVE_GMP_H #include #endif #define RASQAL_DECIMAL_RAW mpf_t #define RASQAL_DECIMAL_ROUNDING int #else /* No implementation - use double. */ #define RASQAL_DECIMAL_RAW double #define RASQAL_DECIMAL_ROUNDING int #include #endif #endif #endif struct rasqal_xsd_decimal_s { unsigned int precision_digits; unsigned int precision_bits; RASQAL_DECIMAL_RAW raw; RASQAL_DECIMAL_ROUNDING rounding; char* string; size_t string_len; }; #ifndef STANDALONE /** * rasqal_new_xsd_decimal: * @world: rasqal world object * * Create a new XSD Decimal object. * * Return value: new xsd:decimal object or NULL on failure. **/ rasqal_xsd_decimal* rasqal_new_xsd_decimal(rasqal_world* world) { rasqal_xsd_decimal* dec; dec = RASQAL_MALLOC(rasqal_xsd_decimal*, sizeof(*dec)); if(dec) rasqal_xsd_decimal_init(dec); return dec; } /** * rasqal_free_xsd_decimal: * @dec: Decimal object * * Destroy XSD Decimal object. **/ void rasqal_free_xsd_decimal(rasqal_xsd_decimal* dec) { if(!dec) return; rasqal_xsd_decimal_clear(dec); RASQAL_FREE(decimal, dec); } static void rasqal_xsd_decimal_init(rasqal_xsd_decimal* dec) { /* XSD wants min of 18 decimal (base 10) digits * http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#decimal */ #ifdef RASQAL_DECIMAL_NONE /* double has a restricted range */ dec->precision_digits = DBL_DIG; #else dec->precision_digits = 18; #endif /* over-estimate bits since log(10)/log(2) = 3.32192809488736234789 < 4 */ dec->precision_bits = dec->precision_digits*4; #ifdef RASQAL_DECIMAL_C99 dec->raw = 0DD; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_init2(dec->raw, dec->precision_bits); /* GMP_RNDD, GMP_RNDU, GMP_RNDN, GMP_RNDZ */ dec->rounding = mpfr_get_default_rounding_mode(); #endif #ifdef RASQAL_DECIMAL_GMP mpf_init2(dec->raw, dec->precision_bits); #endif #ifdef RASQAL_DECIMAL_NONE dec->raw = 0e0; #endif dec->string = NULL; dec->string_len = 0; } static void rasqal_xsd_decimal_clear_string(rasqal_xsd_decimal* dec) { if(dec->string) { RASQAL_FREE(char*, dec->string); dec->string=NULL; } dec->string_len=0; } static void rasqal_xsd_decimal_clear(rasqal_xsd_decimal* dec) { rasqal_xsd_decimal_clear_string(dec); #ifdef RASQAL_DECIMAL_C99 #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_clear(dec->raw); #endif #ifdef RASQAL_DECIMAL_GMP mpf_clear(dec->raw); #endif #ifdef RASQAL_DECIMAL_NONE dec->raw= 0e0; #endif } /** * rasqal_xsd_decimal_set_string: * @dec: XSD Decimal * @string: lexical form * * Set an XSD Decimal value from a string lexical form * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_set_string(rasqal_xsd_decimal* dec, const char* string) { int rc=0; size_t len; if(!string) return 1; rasqal_xsd_decimal_clear_string(dec); len = strlen(string); dec->string = RASQAL_MALLOC(char*, len + 1); if(!dec->string) return 1; memcpy(dec->string, string, len + 1); dec->string_len = len; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) dec->raw = strtod(string, NULL); #endif #ifdef RASQAL_DECIMAL_MPFR if(*string == '+') string++; rc = mpfr_set_str(dec->raw, string, 10, dec->rounding); #endif #ifdef RASQAL_DECIMAL_GMP if(*string == '+') string++; rc = mpf_set_str(dec->raw, string, 10); #endif return rc; } /** * rasqal_xsd_decimal_set_long: * @dec: XSD Decimal * @l: long * * Set an XSD Decimal value from a long. * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_set_long(rasqal_xsd_decimal* dec, long l) { int rc=0; rasqal_xsd_decimal_clear_string(dec); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) dec->raw=l; #endif #ifdef RASQAL_DECIMAL_MPFR rc = mpfr_set_si(dec->raw, l, dec->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_set_si(dec->raw, l); #endif return rc; } /** * rasqal_xsd_decimal_set_double: * @dec: XSD Decimal * @d: double * * Set an XSD Decimal value from a double. * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_set_double(rasqal_xsd_decimal* dec, double d) { int rc=0; rasqal_xsd_decimal_clear_string(dec); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) dec->raw=d; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_set_d(dec->raw, d, dec->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_set_d(dec->raw, d); #endif return rc; } /** * rasqal_xsd_decimal_get_double: * @dec: XSD Decimal * * Get an XSD Decimal as a double (may lose precision) * * Return value: double value. **/ double rasqal_xsd_decimal_get_double(rasqal_xsd_decimal* dec) { double result=0e0; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result=(double)dec->raw; #endif #ifdef RASQAL_DECIMAL_MPFR result = mpfr_get_d(dec->raw, dec->rounding); #endif #ifdef RASQAL_DECIMAL_GMP result=mpf_get_d(dec->raw); #endif return result; } /** * rasqal_xsd_decimal_get_long: * @dec: XSD Decimal * @error_p: pointer to error flag * * Get an XSD Decimal as a long (may lose precision) * * Return value: long value or 0 on failure and *error_p is non-0 **/ long rasqal_xsd_decimal_get_long(rasqal_xsd_decimal* dec, int* error_p) { long result = 0; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result=(long)dec->raw; #endif #ifdef RASQAL_DECIMAL_MPFR if(!mpfr_fits_slong_p(dec->raw, dec->rounding)) { if(error_p) *error_p = 1; } else result = mpfr_get_si(dec->raw, dec->rounding); #endif #ifdef RASQAL_DECIMAL_GMP if(!mpf_fits_slong_p(dec->raw)) { if(error_p) *error_p = 1; } else result = mpf_get_si(dec->raw); #endif return result; } #ifdef RASQAL_DECIMAL_C99 #define DECIMAL_SNPRINTF snprintf #define DECIMAL_FMT "%DDf" #endif #ifdef RASQAL_DECIMAL_MPFR #define DECIMAL_SNPRINTF mpfr_snprintf #define DECIMAL_FMT "%%.%uRf" #endif #ifdef RASQAL_DECIMAL_GMP #define DECIMAL_SNPRINTF gmp_snprintf #define DECIMAL_FMT "%%.%uFf" #endif #ifdef RASQAL_DECIMAL_NONE #define DECIMAL_SNPRINTF snprintf #define DECIMAL_FMT "%%.%uf" #endif /** * rasqal_xsd_decimal_as_string: * @dec: XSD Decimal * * Get an XSD Decimal as a string lexical form. * * The returned string is shared and owned by the @dec object and * must be copied. * * Return value: lexical form string or NULL on failure. **/ char* rasqal_xsd_decimal_as_string(rasqal_xsd_decimal* dec) { char *s=NULL; size_t len=0; #ifdef RASQAL_DECIMAL_C99 #else char fmt[18]; size_t e_index = 0; size_t trailing_zero_start = 0; #endif if(dec->string) return dec->string; #ifdef RASQAL_DECIMAL_C99 len = dec->precision_digits; s = RASQAL_MALLOC(cstring, len + 1); if(!s) return NULL; /* NOTE: Never seen a sprintf that supports _Decimal yet */ snprintf(s, len, "%DDf", dec->raw); len = strlen(s); #else /* construct a format string */ snprintf(fmt, sizeof(fmt), DECIMAL_FMT, dec->precision_digits); /* decimal snprintf with no buffer to get buffer length */ len = RASQAL_GOOD_CAST(size_t, DECIMAL_SNPRINTF(NULL, 0, fmt, dec->raw)); s = RASQAL_MALLOC(char*, len + 1); if(!s) return NULL; /* format into allocated buffer */ DECIMAL_SNPRINTF(s, len, fmt, dec->raw); len = strlen(s); /* find trailing zeros */ for(e_index = len - 1; e_index > 0 && s[e_index] == '0'; e_index--) { trailing_zero_start = e_index; } /* Stop string where the trailing zeros started */ if(trailing_zero_start) { s[trailing_zero_start] = '\0'; len = trailing_zero_start; } if(s[len - 1] == '.') { /* Ends in . so add 0 for canonical format */ s[len++] = '0'; s[len] = '\0'; } #endif dec->string = s; dec->string_len = len; return s; } /** * rasqal_xsd_decimal_as_counted_string: * @dec: XSD Decimal * @len_p: pointer to length variable (or NULL) * * Get an XSD Decimal as a string lexical form with optional length. * * The returned string is shared and owned by the @dec object and * must be copied. If @len_p is not NULL, the length of the returned * string is stored. * * Return value: lexical form string or NULL on failure. **/ char* rasqal_xsd_decimal_as_counted_string(rasqal_xsd_decimal* dec, size_t* len_p) { char* s=rasqal_xsd_decimal_as_string(dec); if(s && len_p) *len_p=dec->string_len; return s; } /** * rasqal_xsd_decimal_print: * @dec: XSD Decimal object * @stream: FILE* handle to print to * * Print an XSD Decimal to a stream * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_print(rasqal_xsd_decimal* dec, FILE* stream) { char* s=NULL; size_t len=0; s=rasqal_xsd_decimal_as_counted_string(dec, &len); if(!s) return 1; fwrite(s, 1, len, stream); return 0; } /** * rasqal_xsd_decimal_add: * @result: result variable * @a: argment decimal 1 * @b: argument decimal 2 * * Add two XSD Decimals and store in result XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_add(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) { int rc=0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = a->raw + b->raw; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_add(result->raw, a->raw, b->raw, result->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_add(result->raw, a->raw, b->raw); #endif return rc; } /** * rasqal_xsd_decimal_subtract: * @result: result variable * @a: argment decimal 1 * @b: argument decimal 2 * * Subtract two XSD Decimals and store in result XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_subtract(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) { int rc=0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = a->raw - b->raw; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_sub(result->raw, a->raw, b->raw, result->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_sub(result->raw, a->raw, b->raw); #endif return rc; } /** * rasqal_xsd_decimal_multiply: * @result: result variable * @a: argment decimal 1 * @b: argument decimal 2 * * Multiply two XSD Decimals and store in result XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_multiply(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) { int rc=0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = a->raw * b->raw; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_mul(result->raw, a->raw, b->raw, result->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_mul(result->raw, a->raw, b->raw); #endif return rc; } /** * rasqal_xsd_decimal_is_zero: * @d: decimal * * Test if an XSD decimal is zero. * * Return value: non-0 if decimal is zero **/ int rasqal_xsd_decimal_is_zero(rasqal_xsd_decimal* d) { int rc = 0; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) rc = fabs(d->raw) < RASQAL_DOUBLE_EPSILON; #endif #ifdef RASQAL_DECIMAL_MPFR rc = mpfr_zero_p(d->raw); #endif #ifdef RASQAL_DECIMAL_GMP rc = !mpf_sgn(d->raw); #endif return rc; } /** * rasqal_xsd_decimal_divide: * @result: result variable * @a: argment decimal 1 * @b: argument decimal 2 * * Divide two XSD Decimals and store in result XSD Decimal * * If the divisor @b is 0, failure is returned * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_divide(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) { int rc=0; rasqal_xsd_decimal_clear_string(result); if(rasqal_xsd_decimal_is_zero(b)) return 1; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = a->raw / b->raw; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_div(result->raw, a->raw, b->raw, result->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_div(result->raw, a->raw, b->raw); #endif return rc; } /** * rasqal_xsd_decimal_negate: * @result: result variable * @a: argment decimal * * Negate an XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_negate(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) { int rc=0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = -a->raw; #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_neg(result->raw, a->raw, result->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_neg(result->raw, a->raw); #endif return rc; } /** * rasqal_xsd_decimal_abs: * @result: result variable * @a: argment decimal * * Return the absolute value of an XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_abs(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) { int rc = 0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = fabs(a->raw); #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_abs(result->raw, a->raw, result->rounding); #endif #ifdef RASQAL_DECIMAL_GMP mpf_abs(result->raw, a->raw); #endif return rc; } /** * rasqal_xsd_decimal_round: * @result: result variable * @a: argment decimal * * Return the number with no fractional part closes to argument for an XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_round(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) { int rc = 0; #ifdef RASQAL_DECIMAL_GMP mpf_t b; mpf_t c; #endif rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = round(a->raw); #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_round(result->raw, a->raw); #endif #ifdef RASQAL_DECIMAL_GMP /* GMP has no mpf_round so use result := floor(a + 0.5) */ mpf_init2(b, a->precision_bits); mpf_init2(c, a->precision_bits); mpf_set_d(b, 0.5); mpf_add(c, a->raw, b); mpf_floor(result->raw, c); mpf_clear(b); mpf_clear(c); #endif return rc; } /** * rasqal_xsd_decimal_ceil: * @result: result variable * @a: argment decimal * * Return the number with no fractional part closes to argument for an XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_ceil(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) { int rc = 0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = ceil(a->raw); #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_ceil(result->raw, a->raw); #endif #ifdef RASQAL_DECIMAL_GMP mpf_ceil(result->raw, a->raw); #endif return rc; } /** * rasqal_xsd_decimal_floor: * @result: result variable * @a: argment decimal * * Return the number with no fractional part closes to argument for an XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_floor(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) { int rc = 0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = floor(a->raw); #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_floor(result->raw, a->raw); #endif #ifdef RASQAL_DECIMAL_GMP mpf_floor(result->raw, a->raw); #endif return rc; } /** * rasqal_xsd_decimal_compare: * @a: first XSD decimal * @b: second XSD decimal * * Compare two XSD Decimals * * Return value: <0 if @a is less than @b, 0 if equal, >1 otherwise **/ int rasqal_xsd_decimal_compare(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) { int rc = 0; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) rc = rasqal_double_approximately_compare(a->raw, b->raw); #endif #ifdef RASQAL_DECIMAL_MPFR rc = mpfr_cmp(a->raw, b->raw); #endif #ifdef RASQAL_DECIMAL_GMP rc=mpf_cmp(a->raw, b->raw); #endif return rc; } /** * rasqal_xsd_decimal_equals: * @a: first XSD Decimal * @b: second XSD Decimal * * Compare two XSD Decimals for equality. * * Return value: non-0 if equal. **/ int rasqal_xsd_decimal_equals(rasqal_xsd_decimal* a, rasqal_xsd_decimal* b) { int rc; #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) rc = rasqal_double_approximately_equal(b->raw, a->raw); #elif defined(RASQAL_DECIMAL_MPFR) rc = mpfr_equal_p(a->raw, b->raw); #elif defined(RASQAL_DECIMAL_GMP) /* NOTE: Not using mpf_eq() but could do, with sufficient bits */ rc=!mpf_cmp(a->raw, b->raw); #else #error RASQAL_DECIMAL flagging error #endif return rc; } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); int main(int argc, char *argv[]) { char const *program=rasqal_basename(*argv); int failures=0; rasqal_xsd_decimal *a; rasqal_xsd_decimal *b; rasqal_xsd_decimal *result; rasqal_xsd_decimal *result2; double result_d; char *result_s; int result_i; const long a_long = 1234567890L; const double a_double = 1234567890e0; const char* b_string = "123456789012345678"; const char* expected_a_plus_b = "123456790246913568.0"; const char* expected_a_plus_b_minus_b = "1234567890.0"; const char* expected_a_plus_b_minus_b_minus_a = "0.0"; const char* expected_negative_b = "-123456789012345678.0"; int expected_a_compare_b= -1; int expected_a_equals_b= 0; rasqal_world *world; world = rasqal_new_world(); #ifdef RASQAL_DECIMAL_MPFR fprintf(stderr, "%s: Using MPFR %s\n", program, mpfr_get_version()); #endif #ifdef RASQAL_DECIMAL_GMP #ifdef HAVE_GMP_VERSION fprintf(stderr, "%s: Using GMP %s\n", program, gmp_version); #else fprintf(stderr, "%s: Using GMP version unknown\n", program); #endif #endif #ifdef RASQAL_DECIMAL_NONE fprintf(stderr, "%s: Using double\n", program); #endif #ifdef RASQAL_DECIMAL_NONE #define FAIL_LABEL #define FAIL failures++ #else #define FAIL_LABEL tidy: #define FAIL failures++; goto tidy #endif a = rasqal_new_xsd_decimal(world); b = rasqal_new_xsd_decimal(world); result = rasqal_new_xsd_decimal(world); result2 = rasqal_new_xsd_decimal(world); if(!result || !result2) { fprintf(stderr, "%s: rasqal_new_xsd_decimal() failed\n", program); FAIL; } rasqal_xsd_decimal_set_long(a, a_long); rasqal_xsd_decimal_set_string(b, b_string); result_d=rasqal_xsd_decimal_get_double(a); if(!rasqal_double_approximately_equal(result_d, a_double)) { fprintf(stderr, "FAILED: a=%f expected %f\n", result_d, a_double); FAIL; } result_s=rasqal_xsd_decimal_as_string(b); if(strcmp(result_s, b_string)) { fprintf(stderr, "FAILED: b=%s expected %s\n", result_s, b_string); FAIL; } /* result = a+b */ rasqal_xsd_decimal_add(result, a, b); result_s=rasqal_xsd_decimal_as_string(result); if(strcmp(result_s, expected_a_plus_b)) { fprintf(stderr, "FAILED: a+b=%s expected %s\n", result_s, expected_a_plus_b); FAIL; } /* result2 = result-b */ rasqal_xsd_decimal_subtract(result2, result, b); result_s=rasqal_xsd_decimal_as_string(result2); if(strcmp(result_s, expected_a_plus_b_minus_b)) { fprintf(stderr, "FAILED: (a+b)-b=%s expected %s\n", result_s, expected_a_plus_b_minus_b); FAIL; } /* result = result2-a */ rasqal_xsd_decimal_subtract(result, result2, a); result_s=rasqal_xsd_decimal_as_string(result); if(strcmp(result_s, expected_a_plus_b_minus_b_minus_a)) { fprintf(stderr, "FAILED: (a+b)-b-a=%s expected %s\n", result_s, expected_a_plus_b_minus_b_minus_a); FAIL; } result_i=rasqal_xsd_decimal_compare(a, b); if((expected_a_compare_b < 0 && result_i >= 0) || (expected_a_compare_b > 0 && result_i <= 0) || (expected_a_compare_b == 0 && result_i != 0)) { fprintf(stderr, "FAILED: a compare b = %d expected %d\n", result_i, expected_a_compare_b); FAIL; } result_i=rasqal_xsd_decimal_equals(a, b); if(result_i != expected_a_equals_b) { fprintf(stderr, "FAILED: a equals b = %d expected %d\n", result_i, expected_a_equals_b); FAIL; } /* result2 = -b */ rasqal_xsd_decimal_negate(result, b); result_s=rasqal_xsd_decimal_as_string(result); if(strcmp(result_s, expected_negative_b)) { fprintf(stderr, "FAILED: -b=%s expected %s\n", result_s, expected_negative_b); FAIL; } FAIL_LABEL if(a) rasqal_free_xsd_decimal(a); if(b) rasqal_free_xsd_decimal(b); if(result) rasqal_free_xsd_decimal(result); if(result2) rasqal_free_xsd_decimal(result2); rasqal_free_world(world); #ifdef RASQAL_DECIMAL_NONE if(failures) fprintf(stderr, "%s: ignoring %d failures as RASQAL_DECIMAL_NONE specified\n", program, failures); return 0; #else return failures; #endif } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_rowsource_project.c0000644000175000017500000002752612434455625016114 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_project.c - Rasqal variables projection rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE typedef struct { /* inner rowsource to project */ rasqal_rowsource *rowsource; /* variable names to project input rows to */ raptor_sequence* projection_variables; /* variables projection array: [output row var index]=input row var index */ int* projection; } rasqal_project_rowsource_context; static int rasqal_project_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { return 0; } static int rasqal_project_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_project_rowsource_context* con; int size; int i; con = (rasqal_project_rowsource_context*)user_data; if(rasqal_rowsource_ensure_variables(con->rowsource)) return 1; rowsource->size = 0; size = raptor_sequence_size(con->projection_variables); con->projection = RASQAL_MALLOC(int*, RASQAL_GOOD_CAST(size_t, sizeof(int) * RASQAL_GOOD_CAST(size_t, size))); if(!con->projection) return 1; for(i = 0; i < size; i++) { rasqal_variable* v; int offset; v = (rasqal_variable*)raptor_sequence_get_at(con->projection_variables, i); if(!v) break; offset = rasqal_rowsource_get_variable_offset_by_name(con->rowsource, v->name); #ifdef RASQAL_DEBUG if(offset < 0) RASQAL_DEBUG2("Variable %s is in projection but not in input rowsource\n", v->name); #endif rasqal_rowsource_add_variable(rowsource, v); con->projection[i] = offset; } return 0; } static int rasqal_project_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_project_rowsource_context *con; con = (rasqal_project_rowsource_context*)user_data; if(con->rowsource) rasqal_free_rowsource(con->rowsource); if(con->projection_variables) raptor_free_sequence(con->projection_variables); if(con->projection) RASQAL_FREE(int*, con->projection); RASQAL_FREE(rasqal_project_rowsource_context, con); return 0; } static rasqal_row* rasqal_project_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_project_rowsource_context *con; rasqal_row *row = NULL; rasqal_row* nrow = NULL; con = (rasqal_project_rowsource_context*)user_data; row = rasqal_rowsource_read_row(con->rowsource); if(row) { int i; nrow = rasqal_new_row_for_size(rowsource->world, rowsource->size); if(!nrow) goto failed; rasqal_row_set_rowsource(nrow, rowsource); nrow->offset = row->offset; for(i = 0; i < rowsource->size; i++) { int offset = con->projection[i]; if(offset >= 0) nrow->values[i] = rasqal_new_literal_from_literal(row->values[offset]); else { rasqal_variable* v; rasqal_query *query = rowsource->query; v = (rasqal_variable*)raptor_sequence_get_at(con->projection_variables, i); if(v && v->expression) { int error = 0; if(v->value) rasqal_free_literal(v->value); v->value = rasqal_expression_evaluate2(v->expression, query->eval_context, &error); if(error) { /* FIXME: Errors are ignored - check this */ #if 0 goto failed; #endif } else nrow->values[i] = rasqal_new_literal_from_literal(v->value); } } } rasqal_free_row(row); row = nrow; } return row; failed: if(row) rasqal_free_row(row); return NULL; } static int rasqal_project_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_project_rowsource_context *con; con = (rasqal_project_rowsource_context*)user_data; return rasqal_rowsource_reset(con->rowsource); } static rasqal_rowsource* rasqal_project_rowsource_get_inner_rowsource(rasqal_rowsource* rowsource, void *user_data, int offset) { rasqal_project_rowsource_context *con; con = (rasqal_project_rowsource_context*)user_data; if(offset == 0) return con->rowsource; return NULL; } static const rasqal_rowsource_handler rasqal_project_rowsource_handler = { /* .version = */ 1, "project", /* .init = */ rasqal_project_rowsource_init, /* .finish = */ rasqal_project_rowsource_finish, /* .ensure_variables = */ rasqal_project_rowsource_ensure_variables, /* .read_row = */ rasqal_project_rowsource_read_row, /* .read_all_rows = */ NULL, /* .reset = */ rasqal_project_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ rasqal_project_rowsource_get_inner_rowsource, /* .set_origin = */ NULL, }; /** * rasqal_new_project_rowsource: * @world: query world * @query: query results object * @rowsource: input rowsource * @projection_variables: input sequence of #rasqal_variable * * INTERNAL - create a PROJECTion over input rowsource * * The @rowsource becomes owned by the new rowsource. * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_project_rowsource(rasqal_world *world, rasqal_query *query, rasqal_rowsource* rowsource, raptor_sequence* projection_variables) { rasqal_project_rowsource_context *con; int flags = 0; if(!world || !query || !rowsource || !projection_variables) goto fail; con = RASQAL_CALLOC(rasqal_project_rowsource_context*, 1, sizeof(*con)); if(!con) goto fail; con->rowsource = rowsource; con->projection_variables = rasqal_variable_copy_variable_sequence(projection_variables); return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_project_rowsource_handler, query->vars_table, flags); fail: if(rowsource) rasqal_free_rowsource(rowsource); return NULL; } #endif /* not STANDALONE */ #ifdef STANDALONE /* one more prototype */ int main(int argc, char *argv[]); const char* const project_1_data_4x2_rows[] = { /* 4 variable names and 2 rows */ "a", NULL, "b", NULL, "c", NULL, "d", NULL, /* row 1 data */ "foo", NULL, "bar", NULL, "baz", NULL, "fez", NULL, /* row 2 data */ "bob", NULL, "sue", NULL, "kit", NULL, "kat", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; const char* const project_1_var_names[] = { "c", "b" }; #define EXPECTED_ROWS_COUNT 2 #define EXPECTED_COLUMNS_COUNT 2 int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; rasqal_rowsource *input_rs = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; int count; raptor_sequence* seq = NULL; int failures = 0; int vars_count; rasqal_variables_table* vt; int size; int expected_count = EXPECTED_ROWS_COUNT; int expected_size = EXPECTED_COLUMNS_COUNT; int i; raptor_sequence* vars_seq = NULL; raptor_sequence* projection_seq = NULL; world = rasqal_new_world(); rasqal_world_open(world); query = rasqal_new_query(world, "sparql", NULL); vt = query->vars_table; /* 4 variables and 2 rows */ vars_count = 4; seq = rasqal_new_row_sequence(world, vt, project_1_data_4x2_rows, vars_count, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create left sequence of %d vars\n", program, vars_count); failures++; goto tidy; } input_rs = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!input_rs) { fprintf(stderr, "%s: failed to create left rowsource\n", program); failures++; goto tidy; } /* vars_seq and seq are now owned by input_rs */ vars_seq = seq = NULL; projection_seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_variable, (raptor_data_print_handler)rasqal_variable_print); for(i = 0 ; i < EXPECTED_COLUMNS_COUNT; i++) { rasqal_variable* v; unsigned const char* name = (unsigned const char*)project_1_var_names[i]; v = rasqal_variables_table_get_by_name(vt, RASQAL_VARIABLE_TYPE_NORMAL, name); /* returns SHARED pointer to variable */ if(v) { v = rasqal_new_variable_from_variable(v); raptor_sequence_push(projection_seq, v); } } rowsource = rasqal_new_project_rowsource(world, query, input_rs, projection_seq); if(!rowsource) { fprintf(stderr, "%s: failed to create project rowsource\n", program); failures++; goto tidy; } /* input_rs and right_rs are now owned by rowsource */ input_rs = NULL; seq = rasqal_rowsource_read_all_rows(rowsource); if(!seq) { fprintf(stderr, "%s: read_rows returned a NULL seq for a project rowsource\n", program); failures++; goto tidy; } count = raptor_sequence_size(seq); if(count != expected_count) { fprintf(stderr, "%s: read_rows returned %d rows for a project rowsource, expected %d\n", program, count, expected_count); failures++; goto tidy; } size = rasqal_rowsource_get_size(rowsource); if(size != expected_size) { fprintf(stderr, "%s: read_rows returned %d columns (variables) for a project rowsource, expected %d\n", program, size, expected_size); failures++; goto tidy; } for(i = 0; i < expected_size; i++) { rasqal_variable* v; const char* name = NULL; const char *expected_name = project_1_var_names[i]; v = rasqal_rowsource_get_variable_by_offset(rowsource, i); if(!v) { fprintf(stderr, "%s: read_rows had NULL column (variable) #%d expected %s\n", program, i, expected_name); failures++; goto tidy; } name = RASQAL_GOOD_CAST(const char*, v->name); if(strcmp(name, expected_name)) { fprintf(stderr, "%s: read_rows returned column (variable) #%d %s but expected %s\n", program, i, name, expected_name); failures++; goto tidy; } } #ifdef RASQAL_DEBUG fprintf(DEBUG_FH, "result of projection:\n"); rasqal_rowsource_print_row_sequence(rowsource, seq, DEBUG_FH); #endif tidy: if(seq) raptor_free_sequence(seq); if(projection_seq) raptor_free_sequence(projection_seq); if(input_rs) rasqal_free_rowsource(input_rs); if(rowsource) rasqal_free_rowsource(rowsource); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_engine_algebra.c0000644000175000017500000006023512327014627015244 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_engine_algebra.c - Rasqal query engine over query algebra * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr typedef struct { rasqal_query* query; rasqal_query_results* query_results; /* query algebra representation of query */ rasqal_algebra_node* algebra_node; /* number of nodes in #algebra_node tree */ int nodes_count; /* rowsource that provides the result rows */ rasqal_rowsource* rowsource; rasqal_triples_source* triples_source; } rasqal_engine_algebra_data; static rasqal_rowsource* rasqal_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p); static int rasqal_engine_algebra_count_nodes(rasqal_query* query, rasqal_algebra_node* node, void* data) { int *count_p = (int*)data; (*count_p)++; return 0; } static rasqal_rowsource* rasqal_algebra_basic_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; return rasqal_new_triples_rowsource(query->world, query, execution_data->triples_source, node->triples, node->start_column, node->end_column); } static rasqal_rowsource* rasqal_algebra_filter_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; if(node->node1) { rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); } else { rs = rasqal_new_empty_rowsource(query->world, query); } if((error_p && *error_p) && rs) { rasqal_free_rowsource(rs); rs = NULL; } if(!rs) return NULL; return rasqal_new_filter_rowsource(query->world, query, rs, node->expr); } static rasqal_rowsource* rasqal_algebra_orderby_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_sort_rowsource(query->world, query, rs, node->seq, node->distinct); } static rasqal_rowsource* rasqal_algebra_union_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *left_rs; rasqal_rowsource *right_rs; left_rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !left_rs) return NULL; right_rs = rasqal_algebra_node_to_rowsource(execution_data, node->node2, error_p); if((error_p && *error_p) || !right_rs) { rasqal_free_rowsource(left_rs); return NULL; } return rasqal_new_union_rowsource(query->world, query, left_rs, right_rs); } static rasqal_rowsource* rasqal_algebra_project_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_project_rowsource(query->world, query, rs, node->vars_seq); } static rasqal_rowsource* rasqal_algebra_leftjoin_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *left_rs; rasqal_rowsource *right_rs; left_rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !left_rs) return NULL; right_rs = rasqal_algebra_node_to_rowsource(execution_data, node->node2, error_p); if((error_p && *error_p) || !right_rs) { rasqal_free_rowsource(left_rs); return NULL; } return rasqal_new_join_rowsource(query->world, query, left_rs, right_rs, RASQAL_JOIN_TYPE_LEFT, node->expr); } static rasqal_rowsource* rasqal_algebra_join_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *left_rs; rasqal_rowsource *right_rs; left_rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !left_rs) return NULL; right_rs = rasqal_algebra_node_to_rowsource(execution_data, node->node2, error_p); if((error_p && *error_p) || !right_rs) { rasqal_free_rowsource(left_rs); return NULL; } return rasqal_new_join_rowsource(query->world, query, left_rs, right_rs, RASQAL_JOIN_TYPE_NATURAL, node->expr); } static rasqal_rowsource* rasqal_algebra_assignment_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; return rasqal_new_assignment_rowsource(query->world, query, node->var, node->expr); } static int rasqal_algebra_visitor_set_origin(rasqal_query* query, rasqal_algebra_node* node, void *user_data) { rasqal_literal *origin = (rasqal_literal*)user_data; int i; if(node->op != RASQAL_ALGEBRA_OPERATOR_BGP) return 0; for(i = node->start_column; i <= node->end_column; i++) { rasqal_triple *t; rasqal_literal *o = NULL; t = (rasqal_triple*)raptor_sequence_get_at(node->triples, i); if(origin) o = rasqal_new_literal_from_literal(origin); rasqal_triple_set_origin(t, o); } return 0; } static void rasqal_algebra_node_set_origin(rasqal_query *query, rasqal_algebra_node* node, rasqal_literal *origin) { rasqal_algebra_node_visit(query, node, rasqal_algebra_visitor_set_origin, origin); } static rasqal_rowsource* rasqal_algebra_graph_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rasqal_literal *graph = node->graph; rasqal_variable* v; if(!graph) { RASQAL_DEBUG1("graph algebra node has NULL graph\n"); return NULL; } /* This code checks that #1-#3 below are present and then executes parts #1 and #2 here. The graph rowsource created by rasqal_new_graph_rowsource() executes #3 http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#sparqlAlgebraEval SPARQL Query Language for RDF - Evaluation of a Graph Pattern #1 if IRI is a graph name in D eval(D(G), Graph(IRI,P)) = eval(D(D[IRI]), P) #2 if IRI is not a graph name in D eval(D(G), Graph(IRI,P)) = the empty multiset #3 eval(D(G), Graph(var,P)) = Let R be the empty multiset foreach IRI i in D R := Union(R, Join( eval(D(D[i]), P) , Omega(?var->i) ) the result is R */ v = rasqal_literal_as_variable(graph); if(!v && graph->type != RASQAL_LITERAL_URI) { /* value is neither a variable or URI literal - error */ RASQAL_DEBUG1("graph algebra node is neither variable or URI\n"); return NULL; } if(!v && graph->type == RASQAL_LITERAL_URI) { if(rasqal_query_dataset_contains_named_graph(query, graph->value.uri)) { /* case #1 - IRI is a graph name in D */ /* Set the origin of all triple patterns inside node->node1 to * URI graph->value.uri * * FIXME - this is a hack. The graph URI should be a parameter * to all rowsource constructors. */ rasqal_algebra_node_set_origin(query, node->node1, graph); rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); } else { /* case #2 - IRI is not a graph name in D - return empty rowsource */ rasqal_free_algebra_node(node->node1); node->node1 = NULL; rs = rasqal_new_empty_rowsource(query->world, query); } if((error_p && *error_p) && rs) { rasqal_free_rowsource(rs); rs = NULL; } return rs; } /* case #3 - a variable */ rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_graph_rowsource(query->world, query, rs, v); } static rasqal_rowsource* rasqal_algebra_distinct_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_distinct_rowsource(query->world, query, rs); } static rasqal_rowsource* rasqal_algebra_group_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_groupby_rowsource(query->world, query, rs, node->seq); } static rasqal_rowsource* rasqal_algebra_aggregation_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_aggregation_rowsource(query->world, query, rs, node->seq, node->vars_seq); } static rasqal_rowsource* rasqal_algebra_having_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_having_rowsource(query->world, query, rs, node->seq); } static rasqal_rowsource* rasqal_algebra_slice_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_rowsource *rs; rs = rasqal_algebra_node_to_rowsource(execution_data, node->node1, error_p); if((error_p && *error_p) || !rs) return NULL; return rasqal_new_slice_rowsource(query->world, query, rs, node->limit, node->offset); } static rasqal_rowsource* rasqal_algebra_values_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; rasqal_bindings* bindings = rasqal_new_bindings_from_bindings(node->bindings); return rasqal_new_bindings_rowsource(query->world, query, bindings); } static rasqal_rowsource* rasqal_algebra_service_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_query *query = execution_data->query; unsigned int flags = (node->flags & RASQAL_ENGINE_BITFLAG_SILENT); return rasqal_new_service_rowsource(query->world, query, node->service_uri, node->query_string, node->data_graphs, flags); } static rasqal_rowsource* rasqal_algebra_node_to_rowsource(rasqal_engine_algebra_data* execution_data, rasqal_algebra_node* node, rasqal_engine_error *error_p) { rasqal_rowsource* rs = NULL; switch(node->op) { case RASQAL_ALGEBRA_OPERATOR_BGP: rs = rasqal_algebra_basic_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_FILTER: rs = rasqal_algebra_filter_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_ORDERBY: rs = rasqal_algebra_orderby_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_UNION: rs = rasqal_algebra_union_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_PROJECT: rs = rasqal_algebra_project_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_LEFTJOIN: rs = rasqal_algebra_leftjoin_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_GRAPH: rs = rasqal_algebra_graph_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_DISTINCT: rs = rasqal_algebra_distinct_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_JOIN: rs = rasqal_algebra_join_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_ASSIGN: rs = rasqal_algebra_assignment_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_GROUP: rs = rasqal_algebra_group_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_AGGREGATION: rs = rasqal_algebra_aggregation_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_HAVING: rs = rasqal_algebra_having_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_SLICE: rs = rasqal_algebra_slice_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_VALUES: rs = rasqal_algebra_values_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_SERVICE: rs = rasqal_algebra_service_algebra_node_to_rowsource(execution_data, node, error_p); break; case RASQAL_ALGEBRA_OPERATOR_UNKNOWN: case RASQAL_ALGEBRA_OPERATOR_DIFF: case RASQAL_ALGEBRA_OPERATOR_TOLIST: case RASQAL_ALGEBRA_OPERATOR_REDUCED: default: RASQAL_DEBUG2("Unsupported algebra node operator %s\n", rasqal_algebra_node_operator_as_counted_string(node->op, NULL)); break; } if(!rs) *error_p = RASQAL_ENGINE_FAILED; return rs; } static int rasqal_query_engine_algebra_execute_init(void* ex_data, rasqal_query* query, rasqal_query_results* query_results, int flags, rasqal_engine_error *error_p) { rasqal_engine_algebra_data* execution_data; rasqal_engine_error error; int rc = 0; rasqal_projection* projection; rasqal_solution_modifier* modifier; rasqal_algebra_node* node; rasqal_algebra_aggregate* ae; execution_data = (rasqal_engine_algebra_data*)ex_data; /* initialise the execution_data fields */ execution_data->query = query; execution_data->query_results = query_results; if(!execution_data->triples_source) { execution_data->triples_source = rasqal_new_triples_source(execution_data->query); if(!execution_data->triples_source) { *error_p = RASQAL_ENGINE_FAILED; return 1; } } projection = rasqal_query_get_projection(query); modifier = query->modifier; node = rasqal_algebra_query_to_algebra(query); if(!node) return 1; node = rasqal_algebra_query_add_group_by(query, node, modifier); if(!node) return 1; ae = rasqal_algebra_query_prepare_aggregates(query, node, projection, modifier); if(!ae) return 1; if(ae) { node = rasqal_algebra_query_add_aggregation(query, ae, node); ae = NULL; if(!node) return 1; } node = rasqal_algebra_query_add_having(query, node, modifier); if(!node) return 1; if(query->verb == RASQAL_QUERY_VERB_SELECT) { node = rasqal_algebra_query_add_projection(query, node, projection); if(!node) return 1; } else if(query->verb == RASQAL_QUERY_VERB_CONSTRUCT) { node = rasqal_algebra_query_add_construct_projection(query, node); if(!node) return 1; } node = rasqal_algebra_query_add_orderby(query, node, projection, modifier); if(!node) return 1; node = rasqal_algebra_query_add_distinct(query, node, projection); if(!node) return 1; execution_data->algebra_node = node; /* count final number of nodes */ execution_data->nodes_count = 0; rasqal_algebra_node_visit(query, execution_data->algebra_node, rasqal_engine_algebra_count_nodes, &execution_data->nodes_count); #ifdef RASQAL_DEBUG RASQAL_DEBUG1("algebra result: \n"); rasqal_algebra_node_print(node, DEBUG_FH); fputc('\n', DEBUG_FH); #endif RASQAL_DEBUG2("algebra nodes: %d\n", execution_data->nodes_count); error = RASQAL_ENGINE_OK; execution_data->rowsource = rasqal_algebra_node_to_rowsource(execution_data, node, &error); #ifdef RASQAL_DEBUG RASQAL_DEBUG1("rowsource (query plan) result: \n"); if(execution_data->rowsource) rasqal_rowsource_print(execution_data->rowsource, DEBUG_FH); else fputs("NULL", DEBUG_FH); fputc('\n', DEBUG_FH); #endif if(error != RASQAL_ENGINE_OK) rc = 1; return rc; } static raptor_sequence* rasqal_query_engine_algebra_get_all_rows(void* ex_data, rasqal_engine_error *error_p) { rasqal_engine_algebra_data* execution_data; raptor_sequence *seq = NULL; execution_data = (rasqal_engine_algebra_data*)ex_data; if(execution_data->rowsource) { seq = rasqal_rowsource_read_all_rows(execution_data->rowsource); if(!seq) *error_p = RASQAL_ENGINE_FAILED; } else *error_p = RASQAL_ENGINE_FAILED; return seq; } static rasqal_row* rasqal_query_engine_algebra_get_row(void* ex_data, rasqal_engine_error *error_p) { rasqal_engine_algebra_data* execution_data; rasqal_row *row = NULL; execution_data = (rasqal_engine_algebra_data*)ex_data; if(execution_data->rowsource) { row = rasqal_rowsource_read_row(execution_data->rowsource); if(!row) *error_p = RASQAL_ENGINE_FINISHED; } else *error_p = RASQAL_ENGINE_FAILED; return row; } static int rasqal_query_engine_algebra_execute_finish(void* ex_data, rasqal_engine_error *error_p) { rasqal_engine_algebra_data* execution_data; execution_data = (rasqal_engine_algebra_data*)ex_data; if(execution_data) { if(execution_data->algebra_node) rasqal_free_algebra_node(execution_data->algebra_node); if(execution_data->triples_source) { rasqal_free_triples_source(execution_data->triples_source); execution_data->triples_source = NULL; } if(execution_data->rowsource) rasqal_free_rowsource(execution_data->rowsource); } return 0; } static void rasqal_query_engine_algebra_finish_factory(rasqal_query_execution_factory* factory) { return; } const rasqal_query_execution_factory rasqal_query_engine_algebra = { /* .name= */ "rasqal query algebra query engine", /* .execution_data_size= */ sizeof(rasqal_engine_algebra_data), /* .execute_init= */ rasqal_query_engine_algebra_execute_init, /* .get_all_rows= */ rasqal_query_engine_algebra_get_all_rows, /* .get_row= */ rasqal_query_engine_algebra_get_row, /* .execute_finish= */ rasqal_query_engine_algebra_execute_finish, /* .finish_factory= */ rasqal_query_engine_algebra_finish_factory }; rasqal-0.9.33/src/rasqal_triple.c0000644000175000017500000001414011615331730013607 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_triple.c - Rasqal triple class * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" /** * rasqal_new_triple: * @subject: Triple subject. * @predicate: Triple predicate. * @object: Triple object. * * Constructor - create a new #rasqal_triple triple or triple pattern. * Takes ownership of the literals passed in. * * The triple origin can be set with rasqal_triple_set_origin(). * * Return value: a new #rasqal_triple or NULL on failure. **/ rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal_literal* predicate, rasqal_literal* object) { rasqal_triple* t; t = RASQAL_CALLOC(rasqal_triple*, 1, sizeof(*t)); if(t) { t->subject = subject; t->predicate = predicate; t->object = object; } else { if(subject) rasqal_free_literal(subject); if(predicate) rasqal_free_literal(predicate); if(object) rasqal_free_literal(object); } return t; } /** * rasqal_new_triple_from_triple: * @t: Triple to copy. * * Copy constructor - create a new #rasqal_triple from an existing one. * * Return value: a new #rasqal_triple or NULL on failure. **/ rasqal_triple* rasqal_new_triple_from_triple(rasqal_triple* t) { rasqal_triple* newt; newt = RASQAL_CALLOC(rasqal_triple*, 1, sizeof(*newt)); if(newt) { newt->subject = rasqal_new_literal_from_literal(t->subject); newt->predicate = rasqal_new_literal_from_literal(t->predicate); newt->object = rasqal_new_literal_from_literal(t->object); } return newt; } /** * rasqal_free_triple: * @t: #rasqal_triple object. * * Destructor - destroy a #rasqal_triple object. **/ void rasqal_free_triple(rasqal_triple* t) { if(!t) return; if(t->subject) rasqal_free_literal(t->subject); if(t->predicate) rasqal_free_literal(t->predicate); if(t->object) rasqal_free_literal(t->object); if(t->origin) rasqal_free_literal(t->origin); RASQAL_FREE(rasqal_triple, t); } /** * rasqal_triple_write: * @t: #rasqal_triple object. * @iostr: The #raptor_iostream handle to write to. * * Write a Rasqal triple to an iostream in a debug format. * * The print debug format may change in any release. **/ void rasqal_triple_write(rasqal_triple* t, raptor_iostream* iostr) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(t, rasqal_triple); RASQAL_ASSERT_OBJECT_POINTER_RETURN(iostr, raptor_iostream); raptor_iostream_counted_string_write("triple(", 7, iostr); rasqal_literal_write(t->subject, iostr); raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_literal_write(t->predicate, iostr); raptor_iostream_counted_string_write(", ", 2, iostr); rasqal_literal_write(t->object, iostr); raptor_iostream_write_byte(')', iostr); if(t->origin) { raptor_iostream_counted_string_write(" with origin(", 13, iostr); rasqal_literal_write(t->origin, iostr); raptor_iostream_write_byte(')', iostr); } } /** * rasqal_triple_print: * @t: #rasqal_triple object. * @fh: The FILE* handle to print to. * * Print a Rasqal triple in a debug format. * * The print debug format may change in any release. * * Return value: non-0 on failure **/ int rasqal_triple_print(rasqal_triple* t, FILE* fh) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(t, rasqal_triple, 1); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(fh, FILE*, 1); fputs("triple(", fh); rasqal_literal_print(t->subject, fh); fputs(", ", fh); rasqal_literal_print(t->predicate, fh); fputs(", ", fh); rasqal_literal_print(t->object, fh); fputc(')', fh); if(t->origin) { fputs(" with origin(", fh); rasqal_literal_print(t->origin, fh); fputc(')', fh); } return 0; } /** * rasqal_triple_set_origin: * @t: The triple object. * @l: The #rasqal_literal object to set as origin. * * Set the origin field of a #rasqal_triple. **/ void rasqal_triple_set_origin(rasqal_triple* t, rasqal_literal* l) { RASQAL_ASSERT_OBJECT_POINTER_RETURN(t, rasqal_triple); t->origin = l; } /** * rasqal_triple_get_origin: * @t: The triple object. * * Get the origin field of a #rasqal_triple. * * Return value: The triple origin or NULL. **/ rasqal_literal* rasqal_triple_get_origin(rasqal_triple* t) { RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(t, rasqal_triple, NULL); return t->origin; } int rasqal_triples_sequence_set_origin(raptor_sequence* dest_seq, raptor_sequence* src_seq, rasqal_literal* origin) { int i; int size; if(!src_seq) return 1; size = raptor_sequence_size(src_seq); for(i = 0; i < size; i++) { rasqal_triple *t; t = (rasqal_triple*)raptor_sequence_get_at(src_seq, i); if(dest_seq) { /* altern copied triple; this is a deep copy */ t = rasqal_new_triple_from_triple(t); if(!t) return 1; if(t->origin) rasqal_free_literal(t->origin); t->origin = rasqal_new_literal_from_literal(origin); raptor_sequence_push(dest_seq, t); } else { /* alter sequence in-place */ if(t->origin) rasqal_free_literal(t->origin); t->origin = rasqal_new_literal_from_literal(origin); } } return 0; } rasqal-0.9.33/src/snprintf.c0000644000175000017500000000514312434455625012625 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * snprintf.c - Rasqal formatted numbers utilities * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; /** * rasqal_format_integer: * @buffer: buffer (or NULL) * @bufsize: size of above (or 0) * @integer: integer value to format * * INTERNAL - Format an integer as a decimal into a buffer or * calculate the size needed. * * Works Like the C99 snprintf() but just for integers. * * If @buffer is NULL or the @bufsize is too small, the number of * bytes needed (excluding NUL) is returned and no formatting is done. * * Return value: number of bytes needed or written (excluding NUL) or 0 on failure */ size_t rasqal_format_integer(char* buffer, size_t bufsize, int integer, int width, char padding) { size_t len = 1; char *p; unsigned int value; unsigned int base = 10; if(integer < 0) { value = RASQAL_GOOD_CAST(unsigned int, -integer); len++; width++; } else value = RASQAL_GOOD_CAST(unsigned int, integer); while(value /= base) len++; if(width > 0) { size_t width_l = RASQAL_GOOD_CAST(size_t, width); if(width_l > len) len = width_l; } if(!buffer || bufsize < (len + 1)) /* +1 for NUL */ return len; if(!padding) padding = ' '; if(integer < 0) value = RASQAL_GOOD_CAST(unsigned int, -integer); else value = RASQAL_GOOD_CAST(unsigned int, integer); p = &buffer[len]; *p-- = '\0'; while(value > 0 && p >= buffer) { *p-- = digits[value % base]; value /= base; } while(p >= buffer) *p-- = padding; if(integer < 0) *buffer = '-'; return len; } rasqal-0.9.33/src/sparql_parser.h0000644000175000017500000001257312434455661013652 00000000000000/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_SPARQL_PARSER_SPARQL_PARSER_TAB_H_INCLUDED # define YY_SPARQL_PARSER_SPARQL_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int sparql_parser_debug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { SELECT = 258, FROM = 259, WHERE = 260, OPTIONAL = 261, DESCRIBE = 262, CONSTRUCT = 263, ASK = 264, DISTINCT = 265, REDUCED = 266, LIMIT = 267, UNION = 268, PREFIX = 269, BASE = 270, BOUND = 271, GRAPH = 272, NAMED = 273, FILTER = 274, OFFSET = 275, ORDER = 276, BY = 277, REGEX = 278, ASC = 279, DESC = 280, LANGMATCHES = 281, A = 282, STRLANG = 283, STRDT = 284, STR = 285, IRI = 286, URI = 287, BNODE = 288, LANG = 289, DATATYPE = 290, ISURI = 291, ISBLANK = 292, ISLITERAL = 293, ISNUMERIC = 294, SAMETERM = 295, GROUP = 296, HAVING = 297, COUNT = 298, SUM = 299, AVG = 300, MIN = 301, MAX = 302, GROUP_CONCAT = 303, SAMPLE = 304, SEPARATOR = 305, DELETE = 306, INSERT = 307, WITH = 308, CLEAR = 309, CREATE = 310, SILENT = 311, DATA = 312, DROP = 313, LOAD = 314, INTO = 315, DEFAULT = 316, TO = 317, ADD = 318, MOVE = 319, COPY = 320, ALL = 321, COALESCE = 322, AS = 323, IF = 324, NOT = 325, IN = 326, BINDINGS = 327, UNDEF = 328, SERVICE = 329, MINUS = 330, YEAR = 331, MONTH = 332, DAY = 333, HOURS = 334, MINUTES = 335, SECONDS = 336, TIMEZONE = 337, TZ = 338, STRLEN = 339, SUBSTR = 340, UCASE = 341, LCASE = 342, STRSTARTS = 343, STRENDS = 344, CONTAINS = 345, ENCODE_FOR_URI = 346, CONCAT = 347, STRBEFORE = 348, STRAFTER = 349, REPLACE = 350, BIND = 351, ABS = 352, ROUND = 353, CEIL = 354, FLOOR = 355, RAND = 356, MD5 = 357, SHA1 = 358, SHA224 = 359, SHA256 = 360, SHA384 = 361, SHA512 = 362, UUID = 363, STRUUID = 364, VALUES = 365, EXPLAIN = 366, LET = 367, CURRENT_DATETIME = 368, NOW = 369, FROM_UNIXTIME = 370, TO_UNIXTIME = 371, HATHAT = 372, SC_OR = 373, SC_AND = 374, EQ = 375, NEQ = 376, LT = 377, GT = 378, LE = 379, GE = 380, ASSIGN = 381, STRING = 382, LANGTAG = 383, DOUBLE_LITERAL = 384, DOUBLE_POSITIVE_LITERAL = 385, DOUBLE_NEGATIVE_LITERAL = 386, INTEGER_LITERAL = 387, INTEGER_POSITIVE_LITERAL = 388, INTEGER_NEGATIVE_LITERAL = 389, DECIMAL_LITERAL = 390, DECIMAL_POSITIVE_LITERAL = 391, DECIMAL_NEGATIVE_LITERAL = 392, BOOLEAN_LITERAL = 393, URI_LITERAL = 394, URI_LITERAL_BRACE = 395, QNAME_LITERAL = 396, QNAME_LITERAL_BRACE = 397, BLANK_LITERAL = 398, IDENTIFIER = 399 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE YYSTYPE; union YYSTYPE { #line 196 "./sparql_parser.y" /* yacc.c:1909 */ raptor_sequence *seq; rasqal_variable *variable; rasqal_literal *literal; rasqal_triple *triple; rasqal_expression *expr; rasqal_graph_pattern *graph_pattern; double floating; raptor_uri *uri; unsigned char *name; rasqal_formula *formula; rasqal_update_operation *update; unsigned int uinteger; rasqal_data_graph* data_graph; rasqal_row* row; rasqal_solution_modifier* modifier; int limit_offset[2]; int integer; rasqal_projection* projection; rasqal_bindings* bindings; sparql_uri_applies* uri_applies; sparql_op_expr* op_expr; #line 223 "sparql_parser.tab.h" /* yacc.c:1909 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int sparql_parser_parse (rasqal_query* rq, void* yyscanner); #endif /* !YY_SPARQL_PARSER_SPARQL_PARSER_TAB_H_INCLUDED */ rasqal-0.9.33/src/rasqal_rowsource_rowsequence.c0000644000175000017500000002774412340216071016772 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_rowsource_rowsequence.c - Rasqal rowsequence rowsource class * * Copyright (C) 2008-2009, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqal.h" #include "rasqal_internal.h" #ifndef STANDALONE typedef struct { raptor_sequence* seq; /* variables for this rowsource */ raptor_sequence* vars_seq; /* index into seq or <0 when finished */ int offset; int failed; } rasqal_rowsequence_rowsource_context; static int rasqal_rowsequence_rowsource_init(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsequence_rowsource_context* con; int rows_count; int i; con = (rasqal_rowsequence_rowsource_context*)user_data; con->offset = 0; con->failed = 0; /* adjust offset of every row */ rows_count = raptor_sequence_size(con->seq); for(i = 0; i < rows_count; i++) { rasqal_row* row; row = (rasqal_row*)raptor_sequence_get_at(con->seq, i); rasqal_row_set_weak_rowsource(row, rowsource); row->offset = i; } return 0; } static int rasqal_rowsequence_rowsource_finish(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsequence_rowsource_context* con; con = (rasqal_rowsequence_rowsource_context*)user_data; if(con->seq) { int rows_count; int i; rows_count = raptor_sequence_size(con->seq); for(i = 0; i < rows_count; i++) { rasqal_row* row; row = (rasqal_row*)raptor_sequence_get_at(con->seq, i); rasqal_row_set_weak_rowsource(row, NULL); } raptor_free_sequence(con->seq); } if(con->vars_seq) raptor_free_sequence(con->vars_seq); RASQAL_FREE(rasqal_rowsequence_rowsource_context, con); return 0; } static int rasqal_rowsequence_rowsource_ensure_variables(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsequence_rowsource_context* con; int i; con = (rasqal_rowsequence_rowsource_context*)user_data; rowsource->size = 0; for(i = 0; i < raptor_sequence_size(con->vars_seq); i++) { rasqal_variable* v; v = (rasqal_variable*)raptor_sequence_get_at(con->vars_seq, i); rasqal_rowsource_add_variable(rowsource, v); } raptor_free_sequence(con->vars_seq); con->vars_seq = NULL; return 0; } static rasqal_row* rasqal_rowsequence_rowsource_read_row(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsequence_rowsource_context* con; rasqal_row* row = NULL; con = (rasqal_rowsequence_rowsource_context*)user_data; if(con->failed || con->offset < 0) return NULL; row = (rasqal_row*)raptor_sequence_get_at(con->seq, con->offset); if(!row) { /* finished */ con->offset = -1; } else { row = rasqal_new_row_from_row(row); con->offset++; } return row; } static raptor_sequence* rasqal_rowsequence_rowsource_read_all_rows(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsequence_rowsource_context* con; raptor_sequence* seq; con = (rasqal_rowsequence_rowsource_context*)user_data; if(con->offset < 0) return NULL; seq = raptor_new_sequence((raptor_data_free_handler)rasqal_free_row, (raptor_data_print_handler)rasqal_row_print); if(seq) { int i; int size = raptor_sequence_size(con->seq); for(i = 0; i < size; i++) { rasqal_row *row = (rasqal_row*)raptor_sequence_get_at(con->seq, i); raptor_sequence_push(seq, rasqal_new_row_from_row(row)); } } return seq; } static int rasqal_rowsequence_rowsource_reset(rasqal_rowsource* rowsource, void *user_data) { rasqal_rowsequence_rowsource_context* con; con = (rasqal_rowsequence_rowsource_context*)user_data; con->offset = 0; return 0; } static const rasqal_rowsource_handler rasqal_rowsequence_rowsource_handler = { /* .version = */ 1, "rowsequence", /* .init = */ rasqal_rowsequence_rowsource_init, /* .finish = */ rasqal_rowsequence_rowsource_finish, /* .ensure_variables = */ rasqal_rowsequence_rowsource_ensure_variables, /* .read_row = */ rasqal_rowsequence_rowsource_read_row, /* .read_all_rows = */ rasqal_rowsequence_rowsource_read_all_rows, /* .reset = */ rasqal_rowsequence_rowsource_reset, /* .set_requirements = */ NULL, /* .get_inner_rowsource = */ NULL, /* .set_origin = */ NULL, }; /** * rasqal_new_rowsequence_rowsource: * @world: world object * @query: query object * @vt: variables table * @rows_seq: input sequence of #rasqal_row * @vars_seq: input sequence of #rasqal_variable for all rows in @rows_seq * * INTERNAL - create a new rowsource over a sequence of rows with given variables * * This uses the number of variables in @vt to set the rowsource size * (order size is always 0) and then checks that all the rows in the * sequence are the same. If not, construction fails and NULL is * returned. * * The @rows_seq and @vars_seq become owned by the new rowsource. * * Return value: new rowsource or NULL on failure */ rasqal_rowsource* rasqal_new_rowsequence_rowsource(rasqal_world *world, rasqal_query* query, rasqal_variables_table* vt, raptor_sequence* rows_seq, raptor_sequence* vars_seq) { rasqal_rowsequence_rowsource_context* con; int flags = 0; if(!world || !query || !vt || !vars_seq) return NULL; if(!raptor_sequence_size(vars_seq)) return NULL; con = RASQAL_CALLOC(rasqal_rowsequence_rowsource_context*, 1, sizeof(*con)); if(!con) return NULL; con->seq = rows_seq; con->vars_seq = vars_seq; return rasqal_new_rowsource_from_handler(world, query, con, &rasqal_rowsequence_rowsource_handler, vt, flags); } #endif /* not STANDALONE */ #ifdef STANDALONE const char* const test_1_rows[] = { /* 2 variable names */ "a", NULL, "b", NULL, /* row 1 data */ "foo", NULL, "bar", NULL, /* end of data */ NULL, NULL, NULL, NULL }; const char* const test_3_rows[] = { /* 4 variable names */ "c1", NULL, "c2", NULL, "c3", NULL, "c4", NULL, /* row 1 data */ "red", NULL, "orange", NULL, "yellow", NULL, "green", NULL, /* row 2 data */ "blue", NULL, "indigo", NULL, "violet", NULL, "white", NULL, /* row 3 data */ "black", NULL, "silver", NULL, "gold", NULL, "platinum", NULL, /* end of data */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; /* one more prototype */ int main(int argc, char *argv[]); int main(int argc, char *argv[]) { const char *program = rasqal_basename(argv[0]); rasqal_rowsource *rowsource = NULL; raptor_sequence *seq = NULL; rasqal_world* world = NULL; rasqal_query* query = NULL; rasqal_row* row = NULL; int count; int failures = 0; rasqal_variables_table* vt; int rows_count; int i; raptor_sequence* vars_seq = NULL; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } query = rasqal_new_query(world, "sparql", NULL); /* test 1-row rowsource (2 variables) */ rows_count = 1; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("Testing %d-row rowsource\n", rows_count); #endif vt = rasqal_new_variables_table(world); /* add 2 variables to table and 1 row sequence */ seq = rasqal_new_row_sequence(world, vt, test_1_rows, 2, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create sequence of %d rows\n", program, rows_count); failures++; goto tidy; } rowsource = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!rowsource) { fprintf(stderr, "%s: failed to create %d-row sequence rowsource\n", program, rows_count); failures++; goto tidy; } /* vars_seq and seq are now owned by rowsource */ vars_seq = seq = NULL; row = rasqal_rowsource_read_row(rowsource); if(!row) { fprintf(stderr, "%s: read_row returned no row for a %d-row sequence rowsource\n", program, rows_count); failures++; goto tidy; } #ifdef RASQAL_DEBUG RASQAL_DEBUG1("Result Row:\n "); rasqal_row_print(row, stderr); fputc('\n', stderr); #endif rasqal_free_row(row); row = NULL; count = rasqal_rowsource_get_rows_count(rowsource); if(count != rows_count) { fprintf(stderr, "%s: read_rows returned count %d instead of %d for a %d-row sequence rowsource\n", program, count, rows_count, rows_count); failures++; goto tidy; } row = rasqal_rowsource_read_row(rowsource); if(row) { fprintf(stderr, "%s: read_row returned > %d rows for a %d-row sequence rowsource\n", program, rows_count, rows_count); failures++; goto tidy; } rasqal_free_rowsource(rowsource); rowsource = NULL; rasqal_free_variables_table(vt); vt = NULL; /* test 3-row rowsource */ rows_count = 3; #ifdef RASQAL_DEBUG RASQAL_DEBUG2("Testing %d-row rowsource\n", rows_count); #endif vt = rasqal_new_variables_table(world); /* add 4 variables to table and 3 row sequence */ seq = rasqal_new_row_sequence(world, vt, test_3_rows, 4, &vars_seq); if(!seq) { fprintf(stderr, "%s: failed to create sequence of %d rows\n", program, rows_count); failures++; goto tidy; } rowsource = rasqal_new_rowsequence_rowsource(world, query, vt, seq, vars_seq); if(!rowsource) { fprintf(stderr, "%s: failed to create %d-row sequence rowsource\n", program, rows_count); failures++; goto tidy; } /* vars_seq and seq are now owned by rowsource */ vars_seq = seq = NULL; for(i = 0; i < rows_count; i++) { row = rasqal_rowsource_read_row(rowsource); if(!row) { fprintf(stderr, "%s: read_row returned no row for row %d in a %d-row sequence rowsource\n", program, i, rows_count); failures++; goto tidy; } #ifdef RASQAL_DEBUG RASQAL_DEBUG1("Result Row:\n "); rasqal_row_print(row, stderr); fputc('\n', stderr); #endif rasqal_free_row(row); row = NULL; } count = rasqal_rowsource_get_rows_count(rowsource); if(count != rows_count) { fprintf(stderr, "%s: read_rows returned count %d instead of %d for a %d-row sequence rowsource\n", program, count, rows_count, rows_count); failures++; goto tidy; } row = rasqal_rowsource_read_row(rowsource); if(row) { fprintf(stderr, "%s: read_row returned >%d rows for a %d-row sequence rowsource\n", program, rows_count, rows_count); failures++; goto tidy; } rasqal_free_rowsource(rowsource); rowsource = NULL; rasqal_free_variables_table(vt); vt = NULL; tidy: if(row) rasqal_free_row(row); if(seq) raptor_free_sequence(seq); if(rowsource) rasqal_free_rowsource(rowsource); if(vt) rasqal_free_variables_table(vt); if(query) rasqal_free_query(query); if(world) rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/src/rasqal_regex.c0000644000175000017500000005672412434455625013452 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_regex.c - Rasqal regex support * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef RASQAL_REGEX_PCRE #include #endif #ifdef RASQAL_REGEX_POSIX #include #include #endif #include "rasqal.h" #include "rasqal_internal.h" #define DEBUG_FH stderr #ifndef STANDALONE /* * rasqal_regex_match: * @world: world * @locator: locator * @pattern: regex pattern * @regex_flags: regex flags string * @subject: input string * @subject_len: input string length * * INTERNAL - Test if a string matches a regex pattern. * * Intended to be used for executing #RASQAL_EXPR_STR_MATCH and * #RASQAL_EXPR_STR_NMATCH operations (unused: formerly RDQL) * * Return value: <0 on error, 0 for no match, >0 for match * */ int rasqal_regex_match(rasqal_world* world, raptor_locator* locator, const char* pattern, const char* regex_flags, const char* subject, size_t subject_len) { int flag_i = 0; /* regex_flags contains i */ const char *p; #ifdef RASQAL_REGEX_PCRE pcre* re; int compile_options = PCRE_UTF8; int exec_options = 0; const char *re_error = NULL; int erroffset = 0; #endif #ifdef RASQAL_REGEX_POSIX regex_t reg; int compile_options = REG_EXTENDED; int exec_options = 0; #endif int rc = 0; for(p = regex_flags; p && *p; p++) if(*p == 'i') flag_i++; #ifdef RASQAL_REGEX_PCRE if(flag_i) compile_options |= PCRE_CASELESS; re = pcre_compile(RASQAL_GOOD_CAST(const char*, pattern), compile_options, &re_error, &erroffset, NULL); if(!re) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex compile of '%s' failed - %s", pattern, re_error); rc = -1; } else { rc = pcre_exec(re, NULL, /* no study */ subject, RASQAL_BAD_CAST(int, subject_len), /* PCRE API is an int */ 0 /* startoffset */, exec_options /* options */, NULL, 0 /* ovector, ovecsize - no matches wanted */ ); if(rc >= 0) rc = 1; else if(rc != PCRE_ERROR_NOMATCH) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex match failed - returned code %d", rc); rc= -1; } else rc = 0; } pcre_free(re); #endif #ifdef RASQAL_REGEX_POSIX if(flag_i) compile_options |= REG_ICASE; rc = regcomp(®, RASQAL_GOOD_CAST(const char*, pattern), compile_options); if(rc) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex compile of '%s' failed", pattern); rc = -1; } else { rc = regexec(®, RASQAL_GOOD_CAST(const char*, subject), 0, NULL, /* nmatch, regmatch_t pmatch[] - no matches wanted */ exec_options /* eflags */ ); if(!rc) rc = 1; else if (rc != REG_NOMATCH) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex match failed - returned code %d", rc); rc = -1; } else rc = 0; } regfree(®); #endif #ifdef RASQAL_REGEX_NONE rasqal_log_warning_simple(world, RASQAL_WARNING_LEVEL_MISSING_SUPPORT, locator, "Regex support missing, cannot compare '%s' to '%s'", match_string, pattern); rc = -1; #endif return rc; } /* * rasqal_regex_get_ref_number: * @str: pointer to pointer to buffer at '$' symbol * * INTERNAL - Decode a $N or $NN reference at *str and move *str past it * * Return value: reference number or <0 if none found */ static int rasqal_regex_get_ref_number(const char **str) { const char *p = *str; int ref_number = 0; if(!p[1]) return -1; /* skip $ */ p++; if(*p >= '0' && *p <= '9') { ref_number = (*p - '0'); p++; } else return -1; if(*p && *p >= '0' && *p <= '9') { ref_number = ref_number * 10 + (*p - '0'); p++; } *str = p; return ref_number; } #ifdef RASQAL_REGEX_PCRE static char* rasqal_regex_replace_pcre(rasqal_world* world, raptor_locator* locator, pcre* re, int options, const char *subject, size_t subject_len, const char *replace, size_t replace_len, size_t *result_len_p) { int capture_count; int *ovector = NULL; int ovecsize; size_t startoffset; int matched_empty_options; char *result = NULL; size_t result_size; /* allocated size of result (excluding NUL) */ size_t result_len; /* used size of result */ const char *replace_end = replace + replace_len; if(pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT, &capture_count) < 0) goto failed; ovecsize = (capture_count + 1) * 3; /* +1 for whole pattern match pair */ ovector = RASQAL_CALLOC(int *, RASQAL_GOOD_CAST(size_t, ovecsize), sizeof(int)); if(!ovector) goto failed; result_size = subject_len << 1; result = RASQAL_MALLOC(char*, result_size + 1); if(!result) goto failed; result_len = 0; /* Match and replace loop; adjusting startoffset each time */ startoffset = 0; matched_empty_options = 0; while(1) { int stringcount; const char *subject_piece = subject + startoffset; stringcount = pcre_exec(re, NULL, /* no study */ subject, RASQAL_BAD_CAST(int, subject_len), /* PCRE API is an int */ RASQAL_BAD_CAST(int, startoffset), options | matched_empty_options, ovector, ovecsize); /* "The value returned by pcre_exec() is one more than the * highest numbered pair that has been set. ... If there are no * capturing subpatterns, the return value from a successful * match is 1, indicating that just the first pair of offsets has * been set." - pcreapi */ if(!stringcount) /* ovector was too small - how can this happen?. Use all * the variables available. Should return an warning? FIXME */ stringcount = ovecsize / 3; if(stringcount > 0) { /* matches have been found */ const char *subject_match; size_t piece_len; size_t new_result_len; const char *replace_p; char last_char; char *result_p; subject_match = subject + ovector[0]; /* compute new length of replacement with expanded variables */ new_result_len = result_len; /* compute size of piece before the match */ piece_len = RASQAL_GOOD_CAST(size_t, subject_match - subject_piece); new_result_len += piece_len; /* compute size of matched piece */ replace_p = replace; last_char = '\0'; while(replace_p < replace_end) { if(*replace_p == '\\' || *replace_p == '$') { int ref_number; if(last_char == '\\') { /* Allow \\ and \$ */ replace_p++; last_char = '\0'; continue; } ref_number = rasqal_regex_get_ref_number(&replace_p); if(ref_number >= 0) { if(ref_number < stringcount) new_result_len = new_result_len + RASQAL_GOOD_CAST(size_t, ovector[(ref_number << 1) + 1] - ovector[ref_number << 1]); continue; } } new_result_len++; last_char = *replace_p; replace_p++; } /* need to expand result buffer? */ if(new_result_len > result_size) { char* new_result; result_size += new_result_len << 1; new_result = RASQAL_MALLOC(char*, result_size + 1); if(!new_result) goto failed; memcpy(new_result, result, result_len); RASQAL_FREE(char*, result); result = new_result; } /* copy the piece of the input before the match */ piece_len = RASQAL_GOOD_CAST(size_t, subject_match - subject_piece); memcpy(&result[result_len], subject_piece, piece_len); result_len += piece_len; /* copy replacement into result inserting matched references */ result_p = result + result_len; replace_p = replace; last_char = '\0'; while(replace_p < replace_end) { if(*replace_p == '\\' || *replace_p == '$') { int ref_number; if(last_char == '\\') { /* Allow \\ and \$ */ *(result_p - 1) = *replace_p++; last_char = '\0'; continue; } ref_number = rasqal_regex_get_ref_number(&replace_p); if(ref_number >= 0) { if(ref_number < stringcount) { size_t match_len; int match_start_offset = ovector[ref_number << 1]; match_len = RASQAL_BAD_CAST(size_t, ovector[(ref_number << 1) + 1] - match_start_offset); memcpy(result_p, subject + match_start_offset, match_len); result_p += match_len; result_len += match_len; } continue; } } *result_p++ = *replace_p; result_len++; last_char = *replace_p; replace_p++; } *result_p = '\0'; /* continue at offset after all matches */ startoffset = RASQAL_BAD_CAST(size_t, ovector[1]); /* * "It is possible to emulate Perl's behaviour after matching a * null string by first trying the match again at the same * offset with PCRE_NOTEMPTY and PCRE_ANCHORED, and then if * that fails by advancing the starting offset ... and trying * an ordinary match again." - pcreapi * * The 'and then if' part is implemented by the if() inside * the if(stringcount == PCRE_ERROR_NOMATCH) below. * */ matched_empty_options = (ovector[0] == ovector[1]) ? (PCRE_NOTEMPTY | PCRE_ANCHORED) : 0; } else if(stringcount == PCRE_ERROR_NOMATCH) { /* No match */ size_t piece_len; size_t new_result_len; if(matched_empty_options && (size_t)startoffset < subject_len) { /* If the previous match was an empty string and there is * still some input to try, move on one char and continue * ordinary matches. */ result[result_len++] = *subject_piece; startoffset++; matched_empty_options = 0; continue; } /* otherwise we are finished - copy the remaining input */ piece_len = subject_len - startoffset; new_result_len = result_len + piece_len; if(new_result_len > result_size) { char* new_result; result_size = new_result_len; new_result = RASQAL_MALLOC(char*, result_size + 1); if(!new_result) goto failed; memcpy(new_result, result, result_len); RASQAL_FREE(char*, result); result = new_result; } memcpy(&result[result_len], subject_piece, piece_len); result_len += piece_len; /* NUL terminate the result and end */ result[result_len] = '\0'; break; } else { /* stringcount < 0 : other failures */ RASQAL_DEBUG2("pcre_exec() failed with code %d\n", stringcount); goto failed; } } RASQAL_FREE(int*, ovector); if(result_len_p) *result_len_p = result_len; return result; failed: if(result) RASQAL_FREE(char*, result); if(ovector) RASQAL_FREE(int*, ovector); return NULL; } #endif #ifdef RASQAL_REGEX_POSIX static char* rasqal_regex_replace_posix(rasqal_world* world, raptor_locator* locator, regex_t reg, int options, const char *subject, size_t subject_len, const char *replace, size_t replace_len, size_t *result_len_p) { size_t capture_count; regmatch_t* pmatch; off_t startoffset; int matched_empty; char *result = NULL; size_t result_size; /* allocated size of result (excluding NUL) */ size_t result_len; /* used size of result */ const char *replace_end = replace + replace_len; capture_count = reg.re_nsub; pmatch = RASQAL_CALLOC(regmatch_t*, capture_count + 1, sizeof(regmatch_t)); if(!pmatch) return NULL; result_size = subject_len << 1; result = RASQAL_MALLOC(char*, result_size + 1); if(!result) goto failed; result_len = 0; /* Match and replace loop; adjusting startoffset each time */ startoffset = 0; matched_empty = 0; while(1) { int rc; const char *subject_piece = subject + startoffset; rc = regexec(®, RASQAL_GOOD_CAST(const char*, subject_piece), capture_count, pmatch, options /* eflags */ ); if(!rc) { /* matches have been found */ const char *subject_match; size_t piece_len; size_t new_result_len; const char *replace_p; char last_char; char *result_p; subject_match = subject_piece + pmatch[0].rm_so; /* compute new length of replacement with expanded variables */ new_result_len = result_len; /* compute size of piece before the match */ piece_len = subject_match - subject_piece; new_result_len += piece_len; /* compute size of matched piece */ replace_p = replace; last_char = '\0'; while(replace_p < replace_end) { if(*replace_p == '\\' || *replace_p == '$') { int ref_number; if(last_char == '\\') { /* Allow \\ and \$ */ replace_p++; last_char = '\0'; continue; } ref_number = rasqal_regex_get_ref_number(&replace_p); if(ref_number >= 0) { regmatch_t rm; size_t copy_len; rm = pmatch[ref_number]; copy_len = rm.rm_eo - rm.rm_so + 1; if((size_t)ref_number < capture_count) new_result_len += copy_len; continue; } } new_result_len++; last_char = *replace_p; replace_p++; } /* need to expand result buffer? */ if(new_result_len > result_size) { char* new_result; result_size += new_result_len << 1; new_result = RASQAL_MALLOC(char*, result_size + 1); if(!new_result) goto failed; memcpy(new_result, result, result_len); RASQAL_FREE(char*, result); result = new_result; } /* copy the piece of the input before the match */ piece_len = subject_match - subject_piece; if(piece_len) memcpy(&result[result_len], subject_piece, piece_len); result_len += piece_len; /* copy replacement into result inserting matched references */ result_p = result + result_len; replace_p = replace; last_char = '\0'; while(replace_p < replace_end) { if(*replace_p == '\\' || *replace_p == '$') { int ref_number; if(last_char == '\\') { /* Allow \\ and \$ */ *(result_p - 1) = *replace_p++; last_char = '\0'; continue; } ref_number = rasqal_regex_get_ref_number(&replace_p); if(ref_number >= 0) { if((size_t)ref_number < capture_count) { regmatch_t rm; size_t match_len; rm = pmatch[ref_number]; match_len = rm.rm_eo - rm.rm_so + 1; memcpy(result_p, subject + rm.rm_so, match_len); result_p += match_len; result_len += match_len; } continue; } } *result_p++ = *replace_p; result_len++; last_char = *replace_p; replace_p++; } *result_p = '\0'; /* continue at offset after all matches */ startoffset += pmatch[0].rm_eo; matched_empty = (pmatch[0].rm_so == pmatch[0].rm_eo); } else if (rc == REG_NOMATCH) { /* No match */ size_t piece_len; size_t new_result_len; if(matched_empty && (size_t)startoffset < subject_len) { /* If the previous match was an empty string and there is * still some input to try, move on one char and continue * ordinary matches. */ result[result_len++] = *subject_piece; startoffset++; matched_empty = 0; continue; } /* otherwise we are finished - copy the remaining input */ piece_len = subject_len - startoffset; new_result_len = result_len + piece_len; if(new_result_len > result_size) { char* new_result; result_size = new_result_len; new_result = RASQAL_MALLOC(char*, result_size + 1); if(!new_result) goto failed; memcpy(new_result, result, result_len); RASQAL_FREE(char*, result); result = new_result; } memcpy(&result[result_len], subject_piece, piece_len); result_len += piece_len; /* NUL terminate the result and end */ result[result_len] = '\0'; break; } else { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex match failed - returned code %d", rc); goto failed; } } RASQAL_FREE(regmatch_t*, pmatch); return result; failed: if(result) RASQAL_FREE(char*, result); RASQAL_FREE(regmatch_t*, pmatch); return NULL; } #endif /** * rasqal_regex_replace: * @world: world * @locator: locator * @pattern: regex pattern * @regex_flags: regex flags string * @subject: input string * @subject_len: input string length * @replace: replacement string * @replace_len: Length of replacement string * @result_len_p: pointer to store result length (output) * * Replace all copies of matches to a pattern with a replacement with subsitution * * Intended to be used for SPARQL 1.1 REPLACE() implementation. * * Return value: result string or NULL on failure * */ char* rasqal_regex_replace(rasqal_world* world, raptor_locator* locator, const char* pattern, const char* regex_flags, const char* subject, size_t subject_len, const char* replace, size_t replace_len, size_t* result_len_p) { const char *p; #ifdef RASQAL_REGEX_PCRE pcre* re; int compile_options = PCRE_UTF8; int exec_options = 0; const char *re_error = NULL; int erroffset = 0; #endif #ifdef RASQAL_REGEX_POSIX regex_t reg; int compile_options = REG_EXTENDED; int exec_options = 0; int rc = 0; size_t pattern_len; char* pattern2; #endif char *result_s = NULL; #ifdef RASQAL_REGEX_PCRE for(p = regex_flags; p && *p; p++) { if(*p == 'i') exec_options |= PCRE_CASELESS; } re = pcre_compile(pattern, compile_options, &re_error, &erroffset, NULL); if(!re) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex compile of '%s' failed - %s", pattern, re_error); } else result_s = rasqal_regex_replace_pcre(world, locator, re, exec_options, subject, subject_len, replace, replace_len, result_len_p); pcre_free(re); #endif #ifdef RASQAL_REGEX_POSIX /* Add an outer capture so we can always find what was matched */ pattern_len = strlen(pattern); pattern2 = RASQAL_MALLOC(char*, pattern_len + 3); if(!pattern2) return NULL; pattern2[0] = '('; memcpy(pattern2 + 1, pattern, pattern_len); pattern2[pattern_len + 1]=')'; pattern2[pattern_len + 2]='\0'; for(p = regex_flags; p && *p; p++) { if(*p == 'i') compile_options |= REG_ICASE; } rc = regcomp(®, pattern2, compile_options); if(rc) { RASQAL_FREE(char*, pattern2); rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Regex compile of '%s' failed - %d", pattern, rc); } else { RASQAL_FREE(char*, pattern2); result_s = rasqal_regex_replace_posix(world, locator, reg, exec_options, subject, subject_len, replace, replace_len, result_len_p); } regfree(®); #endif #ifdef RASQAL_REGEX_NONE rasqal_log_warning_simple(world, RASQAL_WARNING_LEVEL_MISSING_SUPPORT, locator, "Regex support missing, cannot replace '%s' from '%s' to '%s'", subject, pattern, replace); #endif return result_s; } #endif /* not STANDALONE */ #ifdef STANDALONE #include int main(int argc, char *argv[]); #define NTESTS 1 int main(int argc, char *argv[]) { rasqal_world* world; const char *program = rasqal_basename(argv[0]); #ifdef RASQAL_REGEX_PCRE raptor_locator* locator = NULL; int test = 0; #endif int failures = 0; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); failures++; goto tidy; } #if defined(RASQAL_REGEX_POSIX) || defined(RASQAL_REGEX_NONE) fprintf(stderr, "%s: WARNING: Cannot only run regex tests with PCRE regexes\n", program); #endif #ifdef RASQAL_REGEX_PCRE for(test = 0; test < NTESTS; test++) { const char* regex_flags = ""; const char* subject = "abcd1234-^"; const char* pattern = "[^a-z0-9]"; const char* replace = "-"; const char* expected_result = "abcd1234--"; size_t subject_len = strlen(RASQAL_GOOD_CAST(const char*, subject)); size_t replace_len = strlen(RASQAL_GOOD_CAST(const char*, replace)); char* result; size_t result_len = 0; fprintf(stderr, "%s: Test %d pattern: '%s' subject '%s'\n", program, test, pattern, subject); result = rasqal_regex_replace(world, locator, pattern, regex_flags, subject, subject_len, replace, replace_len, &result_len); if(result) { if(strcmp(result, expected_result)) { fprintf(stderr, "%s: Test %d failed - expected '%s' but got '%s'\n", program, test, expected_result, result); failures++; } RASQAL_FREE(char*, result); } else { fprintf(stderr, "%s: Test %d failed - result was NULL\n", program, test); failures++; } } #endif tidy: rasqal_free_world(world); return failures; } #endif /* STANDALONE */ rasqal-0.9.33/autogen.sh0000755000175000017500000002453012265531631012023 00000000000000#!/bin/sh # # autogen.sh - Generates initial makefiles from a pristine source tree # # USAGE: # autogen.sh [configure options] # # Configuration is affected by environment variables as follows: # # DRYRUN # If set to any value it will do no configuring but will emit the # programs that would be run. # e.g. DRYRUN=1 ./autogen.sh # # NOCONFIGURE # If set to any value it will generate all files but not invoke the # generated configure script. # e.g. NOCONFIGURE=1 ./autogen.sh # # AUTOMAKE ACLOCAL AUTOCONF AUTOHEADER LIBTOOLIZE GTKDOCIZE # If set (named after program) then this overrides any searching for # the programs on the current PATH. # e.g. AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ./autogen.sh # # CONFIG_DIR (default ../config) # The directory where fresh GNU config.guess and config.sub can be # found for automatic copying in-place. # # PATH # Where the programs are searched for # # SRCDIR (default .) # Source directory # # This script is based on similar scripts used in various tools # commonly made available via CVS and used with GNU automake. # Try 'locate autogen.sh' on your system and see what you get. # # This script is in the public domain # # Directory for the sources SRCDIR=${SRCDIR-.} # Where the GNU config.sub, config.guess might be found CONFIG_DIR=${CONFIG_DIR-../config} # GIT sub modules file GITMODULES='.gitmodules' # The programs required for configuring which will be searched for # in the current PATH. # Set an envariable of the same name in uppercase, to override scan # programs="automake aclocal autoconf autoheader libtoolize" confs=`find . -name configure.ac -print | grep -v /releases/` gtkdoc_args= if grep "^GTK_DOC_CHECK" $confs >/dev/null; then programs="$programs gtkdocize" gtkdoc_args="--enable-gtk-doc" fi if grep "^AC_CHECK_PROGS.SWIG" $confs >/dev/null; then programs="$programs swig" fi ltdl_args= if grep "^AC_LIBLTDL_" $confs >/dev/null; then ltdl_args="--ltdl" fi silent_args= if grep "^AM_SILENT_RULES" $confs >/dev/null; then silent_args="--enable-silent-rules" fi # Some dependencies for autotools: # automake 1.13 requires autoconf 2.65 # automake 1.12 requires autoconf 2.62 # automake 1.11 requires autoconf 2.62 (needed for AM_SILENT_RULES) automake_min_vers=011102 aclocal_min_vers=$automake_min_vers autoconf_min_vers=026200 autoheader_min_vers=$autoconf_min_vers # libtool 2.2 required for LT_INIT language fix libtoolize_min_vers=020200 gtkdocize_min_vers=010300 swig_min_vers=010324 # Default program arguments automake_args="--gnu --add-missing --force --copy -Wall" aclocal_args="-Wall" autoconf_args="-Wall" libtoolize_args="--force --copy --automake $ltdl_args" gtkdocize_args="--copy" # --enable-gtk-doc does no harm if it's not available configure_args="--enable-maintainer-mode $gtkdoc_args $silent_args" # You should not need to edit below here ###################################################################### # number comparisons may need a C locale LANG=C LC_NUMERIC=C program=`basename $0` if test "X$DRYRUN" != X; then DRYRUN=echo fi cat > autogen-get-version.pl <&1 |") || next; while() { chomp; next if @vnums; # drain pipe if we got a vnums next unless /^\$mname/i; my(\$v)=/(\S+)\$/i; \$v =~ s/-.*\$//; @vnums=grep { defined \$_ && !/^\s*\$/} map { s/\D//g; \$_; } split(/\./, \$v); } close(PIPE); last if @vnums; } @vnums=(@vnums, 0, 0, 0)[0..2]; \$vn=join('', map { sprintf('%02d', \$_) } @vnums); print "\$vn\n"; exit 0; EOF autogen_get_version="`pwd`/autogen-get-version.pl" trap "rm -f $autogen_get_version" 0 1 9 15 update_prog_version() { dir=$1 prog=$2 # If there exists an envariable PROG in uppercase, use that and do not scan ucprog=`echo $prog | tr 'a-z' 'A-Z' ` eval env=\$${ucprog} if test X$env != X; then prog_name=$env prog_vers=`perl $autogen_get_version $prog_name $prog` if test X$prog_vers = X; then prog_vers=0 fi eval ${prog}_name=${prog_name} eval ${prog}_vers=${prog_vers} eval ${prog}_dir=environment return fi eval prog_name=\$${prog}_name eval prog_vers=\$${prog}_vers eval prog_dir=\$${prog}_dir if test X$prog_vers = X; then prog_vers=0 fi save_PATH="$PATH" cd "$dir" PATH=".:$PATH" nameglob="$prog*" if [ -x /usr/bin/uname ]; then if [ `/usr/bin/uname` = 'Darwin' -a $prog = 'libtoolize' ] ; then nameglob="g$nameglob" fi fi names=`ls $nameglob 2>/dev/null` if [ "X$names" != "X" ]; then for name in $names; do vers=`perl $autogen_get_version $dir/$name $prog` if [ "X$vers" = "X" ]; then continue fi if expr $vers '>' $prog_vers >/dev/null; then prog_name=$name prog_vers=$vers prog_dir="$dir" fi done fi eval ${prog}_name=${prog_name} eval ${prog}_vers=${prog_vers} eval ${prog}_dir=${prog_dir} PATH="$save_PATH" } check_prog_version() { prog=$1 eval min=\$${prog}_min_vers eval prog_name=\$${prog}_name eval prog_vers=\$${prog}_vers eval prog_dir=\$${prog}_dir echo "$program: $prog program '$prog_name' V $prog_vers (min $min) in $prog_dir" 1>&2 rc=1 if test $prog_vers != 0; then if expr $prog_vers '<' $min >/dev/null; then echo "$program: ERROR: \`$prog' version $prog_vers in $prog_dir is too old." echo " (version $min or newer is required)" rc=0 else # Things are ok, so set the ${prog} name eval ${prog}=${prog_name} fi else echo "$program: ERROR: You must have \`$prog' installed to compile this package." echo " (version $min or newer is required)" rc=0 fi return $rc } # Find newest version of programs in the current PATH save_args=${1+"$*"} save_ifs="$IFS" IFS=":" set - $PATH IFS="$save_ifs" echo "$program: Looking for programs: $programs" here=`pwd` while [ $# -ne 0 ] ; do dir=$1 shift if [ ! -d "$dir" ]; then continue fi for prog in $programs; do update_prog_version "$dir" $prog done done cd $here set - $save_args # END Find programs # Check the versions meet the requirements for prog in $programs; do if check_prog_version $prog; then exit 1 fi done echo "$program: Dependencies satisfied" if test -d $SRCDIR/libltdl; then touch $SRCDIR/libltdl/NO-AUTO-GEN fi config_dir= if test -d $CONFIG_DIR; then config_dir=`cd $CONFIG_DIR; pwd` fi # Initialise and/or update GIT submodules if test -f $GITMODULES ; then echo " " modules=`sed -n -e 's/^.*path = \(.*\)/\1/p' $GITMODULES` for module in $modules; do if test `ls -1 $module | wc -l` -eq 0; then echo "$program: Initializing git submodule in $module" $DRYRUN git submodule init $module fi done echo "$program: Updating git submodules: $modules" $DRYRUN git submodule update fi for coin in `find $SRCDIR -name configure.ac -print | grep -v /releases/` do status=0 dir=`dirname $coin` if test -f "$dir/NO-AUTO-GEN"; then echo "$program: Skipping $dir -- flagged as no auto-generation" else echo " " echo $program: Processing directory $dir ( cd "$dir" # Ensure that these are created by the versions on this system # (indirectly via automake) $DRYRUN rm -f ltconfig ltmain.sh libtool stamp-h* # Made by automake $DRYRUN rm -f missing depcomp # automake junk $DRYRUN rm -rf autom4te*.cache config_macro_dir=`sed -ne 's/^AC_CONFIG_MACRO_DIR(\([^)]*\).*/\1/p' configure.ac` if test "X$config_macro_dir" = X; then config_macro_dir=. else aclocal_args="$aclocal_args -I $config_macro_dir " fi config_aux_dir=`sed -ne 's/^AC_CONFIG_AUX_DIR(\([^)]*\).*/\1/p' configure.ac` if test "X$config_aux_dir" = X; then config_aux_dir=. fi if test "X$config_dir" != X; then echo "$program: Updating config.guess and config.sub" for file in config.guess config.sub; do cfile=$config_dir/$file xfile=$config_aux_dir/$file if test -f $cfile; then $DRYRUN rm -f $xfile $DRYRUN cp -p $cfile $xfile fi done fi echo "$program: Running $libtoolize $libtoolize_args" $DRYRUN rm -f ltmain.sh libtool eval $DRYRUN $libtoolize $libtoolize_args status=$? if test $status != 0; then break fi if grep "^GTK_DOC_CHECK" configure.ac >/dev/null; then # gtkdocize junk $DRYRUN rm -rf gtk-doc.make echo "$program: Running $gtkdocize $gtkdocize_args" $DRYRUN $gtkdocize $gtkdocize_args status=$? if test $status != 0; then break fi fi for docs in NEWS README; do if test ! -f $docs; then echo "$program: Creating empty $docs file to allow configure to work" $DRYRUN touch -t 200001010000 $docs fi done echo "$program: Running $aclocal $aclocal_args" $DRYRUN $aclocal $aclocal_args if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then echo "$program: Running $autoheader" $DRYRUN $autoheader status=$? if test $status != 0; then break fi fi echo "$program: Running $automake $automake_args" $DRYRUN $automake $automake_args status=$? if test $status != 0; then break fi echo "$program: Running $autoconf $autoconf_args" $DRYRUN $autoconf $autoconf_args status=$? if test $status != 0; then break fi ) fi if test $status != 0; then echo "$program: FAILED to configure $dir" exit $status fi done rm -f config.cache AUTOMAKE=$automake AUTOCONF=$autoconf ACLOCAL=$aclocal export AUTOMAKE AUTOCONF ACLOCAL if test "X$NOCONFIGURE" = X; then echo " " if test -z "$*"; then echo "$program: WARNING: Running \`configure' with no arguments." echo "If you wish to pass any to it, please specify them on the" echo "\`$program' command line." fi echo "$program: Running ./configure $configure_args $@" if test "X$DRYRUN" = X; then $DRYRUN ./configure $configure_args "$@" \ && echo "$program: Now type \`make' to compile this package" || exit 1 else $DRYRUN ./configure $configure_args "$@" fi fi exit $status rasqal-0.9.33/ChangeLog.110000644000175000017500000006355012315200222012002 000000000000002013-12-21 Dave Beckett * configure.ac: Set RAPPER_PATH so rapper can be found from pkg-config Fixes Issue #0000561 http://bugs.librdf.org/mantis/view.php?id=561 * INSTALL.html: Mention libmtwist near --with-random-approach Suggested by Issue #0000560 * configure.ac: Make --with-libgcrypt-config work same way as --with-pcre-config * configure.ac: Make --with-pcre-config work Fixes Issue#0000560 http://bugs.librdf.org/mantis/view.php?id=560 2013-12-13 Dave Beckett * configure.ac: Fix noisy mhash_dir addition error. It always added the cflags and includes even when mhash_dir was blank. * RELEASE.html: word * NEWS.html, RELEASE.html, configure.ac: Bumped version to 0.9.32 * Snapshotted rasqal_0_9_31 for 0.9.31 release (GIT fbef8580f666de2cd99eed102fe21422773672a0) 2013-12-12 Dave Beckett * src/rasqal_ntriples.c: raptor_uri_uri_string_is_absolute appeared in 2.0.11 * utils/roqet.1: Update roqet man page 2013-12-09 Dave Beckett * configure.ac: Fix flex check further * configure.ac: Improve FLEX check - ok to be absent in non-maintainer mode 2013-12-08 Dave Beckett * configure.ac, src/rasqal_literal.c: Restore strings.h * configure.ac, src/rasqal.h.in, src/rasqal_literal.c, tests/sparql/examples/ex11.2.3.7_0.n3, tests/sparql/examples/ex11.2.3.7_0.rq: (rasqal_new_string_literal_common): Normalize language to lowercase * tests/sparql/check-sparql: Handle undefined test type * tests/sparql/aggregate/agg-2.ttl: agg-2 group by with no data expected result is 1 row with no bindings * src/rasqal_rowsource_groupby.c: GROUP BY generates 1 row with no bindings if it gets no data in (rasqal_groupby_rowsource_process): Do not set group_iterator unless there were inner rows. (rasqal_groupby_rowsource_read_row): Use group_iterator set/not to distinguish case where inner rowsource was empty. (main): Add test for new case - new test0 * src/rasqal_rowsource_rowsequence.c: (rasqal_new_rowsequence_rowsource): Allow an empty sequence of rows 2013-12-07 Dave Beckett * configure.ac, src/rasqal_internal.h: Add a configure test for __func__ since it's not always a macro * src/rasqal_ntriples.c: (rasqal_parse_turtle_term_internal): Allow 2.0E-1 2013-12-04 Dave Beckett * README.html: 0.9.31 * RELEASE.html: 0.9.31 * src/rasqal_ntriples.c: Do not add a static raptor_* function (rasqal_uri_uri_string_is_absolute): Renamed from raptor_uri_uri_string_is_absolute * src/rasqal_ntriples.c: Add a static raptor_uri_uri_string_is_absolute() for older raptors 2013-12-02 Dave Beckett * utils/check_query.c, utils/rasqalcmdline.h, utils/results.c, utils/roqet.c: Pull out shared code to print bindings results in a simple format (rasqal_cmdline_print_bindings_results_simple): Added * src/rasqal_digest.c: silence warnings caused by gcrypt.h including internal function prototypes. It marks them as deprecated if not _GCRYPT_IN_LIBGCRYPT 2013-12-01 Dave Beckett * RELEASE.html: example roqet -t * .gitmodules, RELEASE.html, libsv: Moved libtsv repo to libsv * RELEASE.html: 0.9.31 2013-11-30 Dave Beckett * tests/sparql/check-sparql: Import check-sparql from redland-testing * src/rasqal_format_sv.c: (rasqal_rowsource_sv_data_callback): do not guess URIs * src/rasqal_format_sv.c: (rasqal_rowsource_sv_data_callback): Handle NULL l in debug message * src/rasqal_ntriples.c: Port from raptor and correct things 2013-11-29 Dave Beckett * src/rasqal_general.c, src/rasqal_internal.h, src/rasqal_ntriples.c, src/sparql_lexer.l: Declare raptor_unichar rasqal_unicode_max_codepoint once * src/rasqal_format_sv.c: Parse TSV fields as N-Triples After http://www.w3.org/TR/2013/REC-sparql11-results-csv-tsv-20130321/#tsv (rasqal_rowsource_sv_data_callback): Use rasqal_new_literal_from_ntriples_counted_string to parse the fields NOTE: This is not totally correct since it does not handle turtle abbreviated forms such as integers, booleans. * src/rasqal_format_sv.c: For TSV parsing set option on libsv to not parse quoted fields. * libsv: update libsv * src/rasqal_internal.h, src/rasqal_ntriples.c: Use internal n-triples string parsing to get a literal (rasqal_new_literal_from_ntriples_counted_string): Added * src/rasqal_internal.h, src/rasqal_literal.c, src/rasqal_raptor.c: Added rasqal_new_literal_from_term to hold term->literal code (rasqal_new_literal_from_term): Added with proper error handling (raptor_statement_as_rasqal_triple): Use above and now is trivial. 2013-11-28 Dave Beckett * src/Makefile.am, src/rasqal_ntriples.c: Import raptor_ntriples.c (rasqal_new_term_from_counted_string): Internal version of GIT head raptor_new_term_from_counted_string taking a rasqal_world instead. * src/rasqal_format_sv.c: (rasqal_rowsource_sv_header_callback): Strip ? from varname 2013-11-27 Dave Beckett * src/sv_config.h: boilerplate * src/rasqal_format_sv.c: (rasqal_rowsource_sv_data_callback): Fail on NULL l * tests/sparql/check-sparql: Merge in changes from redland-testing * docs/tmpl/section-query_results.sgml: tmpls * src/Makefile.am: Add sv_config.h to dist * Makefile.am: Add libsv to DIST_SUBDIRS too * Makefile.am: Add libsv to SUBDIRS * libsv: update libsv * src/rasqal_format_sv.c: (rasqal_rowsource_sv_process): C90 fix 2013-11-26 Dave Beckett * libsv: update * src/rasqal_format_sv.c: Added reading CSV/TSV results Uses libsv * src/rasqal_format_sparql_xml.c: docs * src/sv_config.h: redefine sv_set_option 2013-11-25 Dave Beckett * src/sv_config.h: Set SV_DEBUG * libsv: update 2013-11-24 Dave Beckett * .gitmodules: fix libsv url * .gitmodules, configure.ac, libsv, src/Makefile.am, src/sv_config.h: libsv * tests/sparql/check-sparql: Remove unused read_rdf_results_file * tests/sparql/check-sparql: Switch to use roqet -t for reading rdf and turtle results (read_query_results_file): Renamed from read_srx_results_file Allow empty rows. Anonymize blanks (run_test): Use read_query_results_file to read rdf/xml and turtle results. * tests/sparql/check-sparql: Fix pipe from results Don't lose first row Ignore []s * tests/sparql/check-sparql: Remove XML::DOM perl and use roqet -t FILE Seems to increase test running time dramatically as well as remove an annoying build-time dependency. * docs/rasqal-changes.tsv, docs/rasqal-sections.txt: Add rasqal_query_results_type_label to docs * README.html, utils/roqet.1: Docs for roqet args and SPARQL 1.1 references * utils/roqet.c: -t is --results-input * src/rasqal_query_results.c: (rasqal_query_results_type_label): unsigned/signed check * utils/roqet.c: help words * utils/roqet.c: help message improvements * utils/results.c, utils/roqet.c: Use rasqal_query_results_formats_check to check -r/-R arguments * utils/results.c: Use rasqal_query_results_formats_check to check valid result format * utils/roqet.c: code style - declare at start of block * utils/roqet.c: Use mode to wrap info and execution code * utils/roqet.c: mode switch around quiet block * utils/rasqalcmdline.h, utils/read_files.c, utils/roqet.c: (rasqal_cmdline_read_uri_file_stdin_contents): Added and used * utils/roqet.c: Use mode to wrap stdin/file/uri reading for query uri mode * utils/roqet.c: Add roqet_mode for 4 main program modes * utils/roqet.c: docs words * utils/roqet.c: Make result reading work * src/rasqal_result_formats.c: Tidy error message * utils/roqet.c: Added new major mode for reading bindings results from a file (-t) Added -t for new mode: read from results bindings file Added -R for above: set the input result format Renamed result_format to result_format_name 2013-11-23 Dave Beckett * utils/roqet.c: Tidied help messages * utils/check_query.c: Use rasqal_query_results_type_label() for better error messages * src/rasqal_format_html.c, src/rasqal_format_json.c, src/rasqal_format_sparql_xml.c, src/rasqal_format_table.c, src/rasqal_result_formats.c: Use rasqal_query_results_type_label() for better error messages * src/rasqal.h.in, src/rasqal_query_results.c: (rasqal_query_results_type_label): Added * src/rasqal_result_formats.c: Only allow reading into query results of type bindings (rasqal_query_results_formatter_read): Enforce that currently this can ony read into bindings query results. * utils/rasqalcmdline.h: Add rasqal_cmdline_read_results * utils/check_query.c: Rename DEFAULT_RESULT_FORMAT_NAME_GRAPH to DEFAULT_RESULT_FORMAT_NAME * utils/check_query.c: Use rasqal_cmdline_read_results * utils/Makefile.am, utils/results.c: (rasqal_cmdline_read_results): Added * utils/read_files.c: (rasqal_cmdline_read_file_fh): Do not close fh 2013-11-16 Dave Beckett * utils/check_query.c: more implementation notes * utils/check_query.c: implementation note * src/rasqal_graph.c: init factory [clang] * utils/check_query.c: docs * utils/read_files.c: -caveat * utils/.gitignore, utils/Makefile.am, utils/check_query.c, utils/rasqalcmdline.h, utils/read_files.c, utils/roqet.c: Add convienience library librasqalcmdline to share cmdline tool code * libmtwist: bump libmtwist * src/rasqal_rowsource.c: (rasqal_new_rowsource_from_handler): Allow NULL query Used when making a rowsource for reading from a file with no query present. * utils/check_query.c: Fail if results file cannot be read * Makefile.am: Adjust DIST_SUBDIRS to be constant so we don't include libmtwist and getopt twice (breaks make distcheck) * libmtwist: Update libmtwist * src/Makefile.am: Add mtwist_config.h to dist * Makefile.am, configure.ac, getopt/.gitignore, getopt/Makefile.am, getopt/getopt.c, getopt/rasqal_getopt.h, src/Makefile.am, utils/Makefile.am, utils/getopt.c, utils/rasqal_getopt.h: Add libgetopt convienience library To stop automake warnings Also make libmtwist and getopt dirs optional; do not compile in them if they are not needed. * src/Makefile.am: Add extra rules to build libmtwist.la if it wasn't built first * src/rasqal_datetime.c, src/rasqal_row_compatible.c, src/rasqal_rowsource_aggregation.c, src/rasqal_rowsource_groupby.c, src/rasqal_rowsource_triples.c, src/sparql_parser.y: Clang test code fixes - Initialise test vars to NULL to allow checks on error paths - Remove extra consts around int/double const arrays 2013-11-08 Dave Beckett * src/.gitignore: no more rdql * src/rasqal_random.c: (rasqal_random_drand): For mtwist do not calculate unused d [clang] * Makefile.am, configure.ac, src/Makefile.am: Make libmtwist a convienience library * libmtwist: Update libmtwist submodule * libmtwist: Update submodule libmtwist * utils/Makefile.am: clean plist * utils/.gitignore: ignore plist * utils/roqet.c: check for flag when optarg is not NULL [clang] * utils/Makefile.am: Add analyze target 2013-11-07 Dave Beckett * src/rasqal_digest_md5.c: Use unions to align unsigned char and u32 [clang] * src/rasqal_bindings.c: (rasqal_new_bindings_from_var_values): Init bindings for error path [clang] * src/rasqal_expr_numerics.c: (rasqal_expression_evaluate_digest): Init l1 for error path [clang] 2013-11-02 Dave Beckett * configure.ac: Check for clang to enable correct discovery of supported warnings 2013-08-25 Dave Beckett * tests/engine/rasqal_construct_test.c, tests/engine/rasqal_limit_test.c: Conditionalize RASQAL_DEBUG check * tests/sparql/check-sparql: update compare_rdf_graphs for newer jena 2013-07-14 Dave Beckett * src/Makefile.am, src/rasqal_xsd_datatypes.c: Check XSD double format and add tests. (rasqal_xsd_check_double_format): Validate according to http://www.w3.org/TR/xmlschema-2/#double which also refers to #decimal and #integer. (rasqal_xsd_check_float_format): Use rasqal_xsd_check_double_format() which is the same. (main): Add positive and negative tests for rasqal_xsd_check_double_format * src/rasqal_xsd_datatypes.c: sparql_xsd_checkfns - fix order so double and float are correct * src/rasqal_xsd_datatypes.c: (rasqal_xsd_format_double): Removed bogus zero check * src/rasqal_query_transform.c: Mark GROUP BY ... AS ?var as binding ?var (rasqal_query_build_variables_use_map_binds): Add scan for group by and mark variables there as bound 2013-07-12 Dave Beckett * src/sparql_lexer.l, src/sparql_parser.y: Switch LANGUAGETOKEN to LANGTAG to match SPARQL grammar * src/sparql_parser.y: Set sparql_parser_debug to 1 when YYDEBUG 2013-07-08 Dave Beckett * src/rasqal_expr_numerics.c: (rasqal_expression_evaluate_digest): Return failure in error_p NULL is failure but error_p should also be set * src/sparql_parser.y: Fix VALUES () 2013-07-06 Dave Beckett * utils/roqet.c: Really support -r simple / --results simple 2013-07-04 Dave Beckett * configure.ac: Ensure CPPFLAGS can be passed through without destruction. This helps Debian hardening https://wiki.debian.org/Hardening 2013-06-22 Dave Beckett * NEWS.html, RELEASE.html: 0.9.31 2013-06-19 Dave Beckett * tests/sparql/Expr1/Makefile.am, tests/sparql/Expr2/Makefile.am, tests/sparql/ExprBuiltins/Makefile.am, tests/sparql/ExprEquals/Makefile.am, tests/sparql/SyntaxFull/Makefile.am, tests/sparql/ValueTesting/Makefile.am, tests/sparql/bound/Makefile.am, tests/sparql/bugs/Makefile.am, tests/sparql/examples/Makefile.am, tests/sparql/part1/Makefile.am, tests/sparql/regex/Makefile.am, tests/sparql/simple/Makefile.am, tests/sparql/sort/Makefile.am, tests/sparql/survey/Makefile.am, tests/sparql/syntax/Makefile.am, tests/sparql/warnings/Makefile.am: Support parallel make better Altering build rules to require building library first before roqet or lexer / parser test programs. Make the targets PHONY so that dependencies of these need not be calculated. * src/Makefile.am: Make check-version work in a parallel make by using a distinct tmpfile * utils/roqet.c: Support -r simple / --results simple * src/Makefile.am: Add BROKEN_TESTS to disable rasqal_rowsource_service_test for now 2013-04-27 Dave Beckett * src/Makefile.am, src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_service.c: Delay creating rasqal_service until rowsource runs * scripts/fix-flex: Fix declaration of 'i' in generated flex __scan_bytes function * configure.ac, src/sparql_lexer.l: Recommend flex 2.5.36 Remove prototypes for column methods that flex 2.5.36+ provides now. 2013-04-24 Dave Beckett * src/rasqal_service.c: Return some more info in SERVICE failure error messages 2013-04-22 Dave Beckett * src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_service.c: Service rasqal_algebra_node and rowsource now take bitflags * src/rasqal_internal.h: Add bitflags to rasqal_algebra_node_s * src/rasqal_internal.h: Add rasqal_engine_bitflags for algebra and engine bitflags * src/rasqal_query_write.c: (rasqal_query_write_sparql_graph_pattern): Write SILENT for SERVICE 2013-04-21 Dave Beckett * src/rasqal_algebra.c: Create service algebra node (rasqal_algebra_service_graph_pattern_to_algebra): Use rasqal_query_write_sparql_20060406_graph_pattern to write the query to send to SERVICE * src/rasqal_engine_algebra.c: (rasqal_algebra_service_algebra_node_to_rowsource): Fix * src/rasqal_internal.h, src/rasqal_service.c: Add reference counting to rasqal_service (internal) (rasqal_new_service_from_service): Added * src/rasqal_internal.h, src/rasqal_query_write.c: (rasqal_query_write_sparql_20060406_graph_pattern): Added to format a GP. Used for SERVICE to turn data structure into a SPARQL SELECT query to send to a service * src/rasqal_query_write.c: (rasqal_query_write_sparql_20060406): Reset wc * src/rasqal_query_write.c: (rasqal_query_write_sparql_graph_pattern): VALUES output tweak * src/rasqal_query_write.c: VALUES write space * src/rasqal_query_transform.c: (rasqal_graph_patterns_join): Move bindings in GP join * src/rasqal_query_write.c: (rasqal_query_write_sparql_graph_pattern): Init size. Code style. * src/rasqal_query_write.c: SPARQL formatting fixes for VALUES (rasqal_query_write_sparql_row): Add write_braces boolean arg to control ()s in output (rasqal_query_write_sparql_values): Write short form of VALUES when there is 1 var using above. * src/rasqal_general.c: 2013 * src/rasqal_algebra.c: (rasqal_algebra_query_add_aggregation): Mark ae as freed [clang] * src/rasqal_algebra.c: (rasqal_algebra_remove_znodes): Do nothing if node is NULL [clang] * src/rasqal_query_write.c: Use var size for holding raptor_sequence_size values * src/rasqal_query_write.c: Make writing sparql seq of var, expr work in same way (rasqal_query_write_sparql_variables_sequence): Write space between items only. (rasqal_query_write_sparql_expression_sequence): Renamed from rasqal_query_write_expression_sequence. Use count. Updated callers of above * src/rasqal_query_write.c: (rasqal_query_write_sparql_variables_sequence): Renamed from rasqal_query_write_sparql_select * src/rasqal_query_write.c: Add indent to rasqal_query_write_sparql_values (rasqal_query_write_sparql_values): Add indent arg and use it to indent the values rows (rasqal_query_write_sparql_graph_pattern) (rasqal_query_write_sparql_20060406): Update callers of above. * src/rasqal_query_write.c: Write modifiers to sub-SELECT and write VALUES graph patterns 2013-04-20 Dave Beckett * src/rasqal_algebra.c: (rasqal_algebra_query_to_algebra): Execute top level select VALUES * src/rasqal_engine_algebra.c: (rasqal_algebra_values_algebra_node_to_rowsource): Add a bindings ref. * src/rasqal_query_transform.c: Bind variables for VALUES graph patterns (rasqal_query_values_build_variables_use_map_binds): Added (rasqal_query_graph_pattern_build_variables_use_map_binds): Call above for VALUES graph patterns * src/rasqal_algebra.c: (rasqal_algebra_bindings_to_algebra): Take a reference to bindings * src/rasqal_bindings.c, src/rasqal_internal.h: Add reference count model to rasqal_bindings (rasqal_new_bindings_from_bindings): Added * src/rasqal_algebra.c: Convert VALUES graph pattern to a bindings algebra node (rasqal_algebra_bindings_to_algebra): Added to get the node from a bindings (rasqal_algebra_values_graph_pattern_to_algebra): Added to get the node from a VALUES graph pattern (rasqal_algebra_select_graph_pattern_to_algebra): Use rasqal_algebra_bindings_to_algebra() to add a join above the final sub-SELECT over the bindings algebra node * src/rasqal_engine_algebra.c: Convert values algebra node to a bindings rowsource (rasqal_algebra_values_algebra_node_to_rowsource): Added (rasqal_algebra_node_to_rowsource): Use above to do the conversion * src/Makefile.am, src/rasqal_internal.h, src/rasqal_rowsource_bindings.c: Added bindings rowsource (rasqal_new_bindings_rowsource): Added new constructor for a rowsource over a rasqal_bindings * src/rasqal_algebra.c, src/rasqal_internal.h: (rasqal_new_values_algebra_node): Added * src/rasqal_algebra.c, src/rasqal_internal.h: Add RASQAL_ALGEBRA_OPERATOR_VALUES for VALUES algebra node type * src/rasqal_query_transform.c: Allow rasqal_query_build_variables_sequence_use_map_row to bind VALUES (rasqal_query_build_variables_sequence_use_map_row): Add bind arg to allow forcing binding variables in a variables sequence. (rasqal_query_build_variables_use_map): Process a query->bindings and bind the variables seen (rasqal_query_select_build_variables_use_map): Bind variables in a sub-SELECT VALUES list * src/rasqal_internal.h, src/rasqal_query_transform.c: Added RASQAL_VAR_USE_MAP_OFFSET_VALUES and label for VALUES in SELECT * src/rasqal_bindings.c, src/rasqal_internal.h: (rasqal_bindings_write): Removed * src/rasqal_bindings.c, src/rasqal_internal.h: (rasqal_bindings_get_row): Added to get a row from a binding * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_write_internal): Do writing here for bindings Using rasqal_bindings_write() failed to do indenting. * src/rasqal_bindings.c: (rasqal_new_bindings_from_var_values): Debug prints * docs/tmpl/section-graph_pattern.sgml: update tmpls * src/rasqal_query_results.c: (rasqal_prefix_id): Use q rather than _ to help raptor N-Triples 2008 * src/Makefile.am, src/rasqal_algebra.c, src/rasqal_engine_algebra.c, src/rasqal_internal.h, src/rasqal_rowsource_service.c: merge * tests/sparql/federated/bindings-1.rq, tests/sparql/federated/bindings-2.rq, tests/sparql/federated/bindings-3.rq: Change BINDINGS test to new VALUES syntax with ()s around vars * src/rasqal_expr_numerics.c: Use ossp/uuid.h as include header for ossp version of libuuid * configure.ac: Make sure libuuid test with pkg-config does not accept OSSP libuuid * configure.ac: Reset CPPFLAGS properly after a test * tests/sparql/bugs/352-result.ttl, tests/sparql/bugs/353-result.ttl: Use rq rather than _ which ntriples 2008 forbids * tests/sparql/check-sparql: Read "row:" or "result:" write "row:" * src/sparql_parser.y: Add parsing for SPARQL 1.1 VALUES block formats Handles VALUE single var + values list; VALUES with list of vars and large block. On the outer GP it gets adds to the query, otherwise gets added to the sub-SELECT GP, or as a VALUES GP. * utils/roqet.c: Print "row:" in debug output and use rasqal_literal_print for nulls * src/rasqal_row.c: (rasqal_row_print): Print "row:"... * src/rasqal_literal.c: (rasqal_literal_print): Print NULL * src/rasqal_graph_pattern.c: (rasqal_graph_pattern_write_internal): Write bindings * src/rasqal_bindings.c, src/rasqal_internal.h: (rasqal_bindings_write): Added * src/rasqal_internal.h, src/rasqal_row.c: (rasqal_row_write): Added * src/rasqal_graph_pattern.c, src/rasqal_internal.h, src/sparql_parser.y: (rasqal_new_select_graph_pattern): Add optional bindings arg * src/rasqal_algebra.c: (rasqal_algebra_algebra_node_write_internal): Use rasqal_variables_write * src/rasqal_bindings.c: docs * src/rasqal_formula.c, src/rasqal_literal.c, src/rasqal_row.c, src/rasqal_rowsource_aggregation.c, src/rasqal_variable.c: rasqal_literal_print will print 'null'; so do not conditionally call it * src/rasqal_internal.h: docs * src/rasqal_internal.h, src/rasqal_variable.c: (rasqal_variables_write): Added to write a vars sequence with commas * src/rasqal_variable.c: (rasqal_variable_write): Check args * src/rasqal_bindings.c, src/rasqal_internal.h: (rasqal_new_bindings_from_var_values): Added Builds a bindings from a single variable and a sequence of values each of which turns into a row of 1 value to match the SPARQL 1.1 short form * src/rasqal_graph_pattern.c, src/rasqal_internal.h: (rasqal_new_values_graph_pattern): Added to make a VALUES GP * src/rasqal_graph_pattern.c, src/rasqal_internal.h: rasqal_graph_pattern_s gains bindings field (rasqal_free_graph_pattern): Free new field if present. * src/rasqal.h.in, src/rasqal_algebra.c, src/rasqal_graph_pattern.c, src/rasqal_query_transform.c: Add RASQAL_GRAPH_PATTERN_OPERATOR_VALUES for SPARQL 1.1 VALUES 2013-04-14 Dave Beckett * src/sparql_lexer.l, src/sparql_parser.y: Add VALUES lexer token 2013-04-08 Dave Beckett * src/rasqal_digest_md5.c: Do not destroy MD5 digest 2013-04-07 Dave Beckett * src/rasqal_digest_md5.c: memset fixes [gcc 4.8] 2013-04-05 Dave Beckett * src/win32_rasqal_config.h.in: Make win32_rasqal_config.h work on MSVC2008 Patch from Michael Stahl Fixes Issue #0000539 http://bugs.librdf.org/mantis/view.php?id=539 * src/rasqal_digest_md5.c, src/rasqal_digest_sha1.c, src/rasqal_internal.h: work around MSVC 2008's inexcusable lack of stdint.h header Patch from Michael Stahl Fixes Issue #0000538 http://bugs.librdf.org/mantis/view.php?id=538 * configure.ac, utils/Makefile.am: Use PKG_CHECK_MODULES() for calling and overriding pkg-config - macro is in build/pkg.m4 from pkg-config 0.28 - Use _CFLAGS and _LIBS envars. - Enables overriding of pkg-config if needed. - Used for raptor 2 and libuuid Fixes Issue #0000537 http://bugs.librdf.org/mantis/view.php?id=537 * build/pkg.m4: Add pkg.m4 from pkg-config 0.28 to prevent more autogen.sh work * configure.ac: Modernize LT_INIT call for libtool 2.2+ * configure.ac: Die if xml2-config points at a non executable file Patch from Michael Stahl - thanks Fixes Issue #0000536 http://bugs.librdf.org/mantis/view.php?id=536 2013-03-12 Dave Beckett * build/.gitignore: Ignore test-driver * autogen.sh: Handle variations of header macro * .gitignore: Ignore .trs 2013-01-28 Dave Beckett * src/rasqal_rowsource.c, src/rasqal_service.c: Fix crash when a SERVICE returns no rowsource Update other public rowsource methods to fail if given NULL args. Fixes Issue #0000527 http://bugs.librdf.org/mantis/view.php?id=527 2013-01-24 Dave Beckett * ChangeLog, ChangeLog.10, Makefile.am: ChangeLog.10 for 2012 2013-01-22 Dave Beckett * Bumped version to 0.9.31 * Snapshotted rasqal_0_9_30 for 0.9.30 release (GIT f5d0537a0ab15b70d24813b2d6d7ceb922a1356c) * configure.ac: Report UUID library version in status * configure.ac: Initialize have_uuid_ossp=no * configure.ac, src/rasqal_expr_numerics.c: Add support for OSSP libuuid Library is from http://www.ossp.org/pkg/lib/uuid/ Fixes Issue #0000511 http://bugs.librdf.org/mantis/view.php?id=511 * configure.ac: When cross compiling, assume ceil, floor and round are in default libs Fixes Issue #0000517 http://bugs.librdf.org/mantis/view.php?id=517 rasqal-0.9.33/NOTICE0000644000175000017500000000026410362621550010720 00000000000000This product includes Redland software (http://librdf.org/) developed at the Institute for Learning and Research Technology, University of Bristol, UK (http://www.bristol.ac.uk/). rasqal-0.9.33/INSTALL0000644000175000017500000003660012311460150011041 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. rasqal-0.9.33/NEWS.html0000644000175000017500000007217312443715133011471 00000000000000 Rasqal RDF Query Library - News

Rasqal RDF Query Library - News

2014-12-15 Rasqal Version 0.9.33 Released

Added support for reading and writing boolean result formats.
Fixed several query engine operator evaluations (AVG, STRBEFORE, STRAFTER, CONCAT)
Updated query results class constructor and methods, deprecating older.
Portability fixes for ICC, clang and GCC 5.
New internal test runner utility
Variable bindings query results can be formatted in mKR CSV format.
Multiple other fixes and improvements including fixing reported issues: 0000546, 0000568, 0000583 and 0000588.

See the Rasqal 0.9.33 Release Notes for the full details of the changes.

2014-02-23 Rasqal Version 0.9.32 Released

SPARQL parser now uses and requires Bison 3.0 (for maintainer)
Fixed SPARQL 1.0 vs SPARQL 1.1 syntax feature checking
Make ossp work as a UUID library option.
Fixed configure searching for libgcrypt-config and pcre-config.
Made --with-libgcrypt-config and --with-pcre-config work again.
Made other fixes and improvements including fixing reported issues: 0000558, 0000560, 0000561, 0000564 and 0000567.

See the Rasqal 0.9.32 Release Notes for the full details of the changes.

2013-12-13 Rasqal Version 0.9.31 Released

roqet with new -t mode can now read query results formats and act as a results format converter
Added read support for SPARQL 1.1 Query Results CSV and TSV Formats
Query engine can execute VALUES
Multiple configuration and build improvements
Several query engine bug fixes
Made other fixes and improvements including fixing reported issues: 0000527, 0000536, 0000537, 0000538 and 0000539

See the Rasqal 0.9.31 Release Notes for the full details of the changes.

2013-01-22 Rasqal Version 0.9.30 Released

Removed RDQL support as promised. So long and thanks for all the queries. Use SPARQL instead.
Improved floating equality, comparison and promotion rules
Made other fixes and improvements including fixing reported issues: 0000506, 0000511, 0000517 and 0000523.

See the Rasqal 0.9.30 Release Notes for the full details of the changes.

2012-05-13 Rasqal Version 0.9.29 Released

Supports all of SPARQL 1.0 by passing 100% of the approved tests
Added support for XSD date
Made XSD dateTime and XSD date equality and comparison work
Make limit and offset check work properly in a subquery
Correctly handle errors during aggregation expressions evaluation
Fix blank node generation when made in a CONSTRUCT to match SPARQL
Added SPARQL 1.1 draft UUID() and STRUUID() support
Requires Raptor 2.0.7+
RDQL support will be removed in the next release (0.9.30)
Made other fixes and improvements including fixing reported issues: 0000493, 0000494 0000504

See the Rasqal 0.9.29 Release Notes for the full details of the changes.

2011-11-17 Rasqal Version 0.9.28 Released

Added full support for SPARQL 1.1 draft STRBEFORE, STRAFTER and REPLACE.
Add internal Mersenne Twister PRNG or choose others via configure
Language name 'sparql' is now SPARQL 1.1
The query result formats now all use the W3C Format URIs as their primary URI
Improved configure check for for ceil(), floor() and round() to prevent GCC optimizing the test away and getting the wrong answer
Made other fixes and improvements including fixing reported Issues: 0000466, 0000467, 0000470, 0000471 and 0000474.

See the Rasqal 0.9.28 Release Notes for the full details of the changes.

2011-08-23 Rasqal Version 0.9.27 Released

sub-SELECTs can now be executed
OPTIONAL and UNION fully execute correctly
Grouping over sub-graph patterns fully executes correctly
CONSTRUCT WHERE abbreviation is supported and executes
CONSTRUCT works when working over a query with optionals
Updated the CSV and TSV outputs to match the editor's draft SPARQL 1.1 Query Results CSV and TSV Formats
Made other fixes and improvements including fixing reported Issues: 0000127, 0000423, 0000434, 0000454 and 0000459.

See the Rasqal 0.9.27 Release Notes for the full details of the changes.

2011-06-27 Rasqal Version 0.9.26 Released

Query engine improved with new variable scoping approach that makes UNION work better
Added SPARQL 1.1 query draft support for MD5(), SHA1(), SHA224(), SHA256(), SHA384() and SHA512()
Removed old query engine 1
Added a method to set the query warning level
Made other fixes and improvements including fixing reported Issues: #0000430, #0000431, #0000436, #0000438, #0000439 and #0000446.

See the Rasqal 0.9.26 Release Notes for the full details of the changes.

2011-02-22 Rasqal Version 0.9.25 Released

Added SPARQL 1.1 query draft support for ABS(), CEIL(), FLOOR(), RAND(), ROUND() and TZ()
Added SPARQL 1.1 query draft support for BIND(expr AS ?var)
Fixed SPARQL 1.1 update draft SILENT with DROP and CLEAR
Fixed SPARQL 1.1 query draft ENCODE_FOR_URI() to not preserve language and datatype of argumnet
Fixed SPARQL 1.1 query draft GROUP BY to allow an optional AS ?var
Added an expression evaluation context class to store state for use with evaluating expressions
Fixed triple-quoted literals over-quoting and their use with language and datatypes
Added support for initialising the random seed from system sources or a user value via the API
Fixed several query execution cases
Query engine now handles NULL as a valid value separate from an error
Made rasqal_query_set_store_results() actually work
Fixed Issues #0000421, #0000427 and #0000428.

See the Rasqal 0.9.25 Release Notes for the full details of the changes.

2011-01-30 Rasqal Version 0.9.24 Released

Fixed some memory leaks with variables and literals during parsing
Added SPARQL 1.1 update draft support for: ADD, MOVE and COPY; DELETE WHERE { }; CLEAR and DROP with graph application qualifiers; SILENT qualifier and using ; to separate multiple operations.

See the Rasqal 0.9.24 Release Notes for the full details of the changes.

2011-01-27 Rasqal Version 0.9.23 Released

Fixed parsing of SPARQL 1.1 Update draft INSERT and DELETE to return sequences of triples
Fixed cleanup for syntax errors due to disabled query language features
Fixed Issues: 0000407 and 0000414, 0000415 and 0000417.

See the Rasqal 0.9.23 Release Notes for the full details of the changes.

2011-01-12 Rasqal Version 0.9.22 Released

WARNING: ABI AND API CHANGED in this release. Rasqal 0.9.22 is binary incompatible with 0.9.21 or earlier.

Builds only against Raptor V2 (2.0.0+) from this release
Added SPARQL 1.1 editor's draft datetime builtins: DAY, HOURS, MINUTES, MONTH, SECONDS, TIMEZONE and YEAR
Added SPARQL 1.1 editor's draft string builtins: CONCAT, CONTAINS, ENCODE_FOR_URI, LCASE, STRENDS, STRLEN, STRSTARTS, SUBSTR and UCASE
Added LAQRS datetime extension builtins: NOW / CURRENT_DATETIME, FROM_UNIXTIME and TO_UNIXTIME
Added query language names for SPARQL 1.0, 1.1 Query and Update, 1.1 Query, 1.1 Update and LAQRS
Added expression evaluation support for new builtins
Added an XSD dateTime class and public API
Added support for reading and writing RDF-encoded query result formats in RDF/XML and Turtle / N3
Many other API additions, removals and changes all described in the Rasqal reference manual

See the Rasqal 0.9.22 Release Notes for the full details of the changes.

2010-12-04 Rasqal Version 0.9.21 Released

Updated to handle aggregate expression execution as defined by the SPARQL 1.1 Query W3C working draft of 14 October 2010
Executes grouping of results: GROUP BY
Executes aggregate expressions: AVG, COUNT, GROUP_CONCAT, MAX, MIN, SAMPLE, SUM
Executes filtering of aggregate expressions: HAVING
Parses new syntax: BINDINGS, isNUMERIC(), MINUS, sub SELECT and SERVICE.
The syntax format for parsing data graphs at URIs can be explictly declared.
The roqet utility can execute queries over SPARQL HTTP Protocol and operate over data from stdin.
Added several new APIs
Fixed Issue: #0000388

See the Rasqal 0.9.21 Release Notes for the full details of the changes.

2010-08-22 Rasqal Version 0.9.20 Released

Updated to handle more of the new syntax defined by the SPARQL 1.1 Query and SPARQL 1.1 Update W3C working drafts of 1 June 2010
Added execution support for new SPARQL 1.1 query built-in expressions IF, URI, STRLANG, STRDT, BNODE, IN and NOT IN.
Added an 'html' query result table format from patch by Nicholas J Humfrey
Added API support for group by HAVING expressions
Added XSD Date comparison support
Support building with Raptor V2 API if configured with --with-raptor2.
Many other bug fixes and improvements were made.
Fixed Issues: #0000352, #0000353, #0000354, #0000360, #0000374, #0000377 and #0000378

See the Rasqal 0.9.20 Release Notes for the full details of the changes.

2010-02-15 Rasqal Version 0.9.19 Released

The only change to this release is to fix the pkg-config rasqal.pc file to to restore the dependency on raptor which was accidently deleted. Lesson learnt: do not commit code after midnight local time.

2010-02-14 Rasqal Version 0.9.18 Released

Add initial draft parsing and API (NOT execution) support for SPARQL 1.1 Update W3C Working Draft of 2010-01-26.
Add public APIs (row, results, result formatter, variables table) so that query results can be built, read and written without a query.
Add API resilience checks for invalid NULL pointer arguments.
Many other bug fixes and improvements were made.
Fixed Issues: #0000320, #0000323 #0000343, #0000345 and #0000347

See the Rasqal 0.9.18 Release Notes for the full details of the changes.

2009-12-16 Rasqal Version 0.9.17 Released

WARNING: ABI AND API CHANGED in this release. Rasqal 0.9.17 is binary incompatible with 0.9.16 or earlier.

Added a new query engine that implements the SPARQL algebra better
All constructors now take a rasqal_world argument
Added LAQRS syntax support for SUM, AVG, MIN, MAX, COALESCE() experimental syntax
Added query result formatters for CSV, TSV and ASCII tables
Prefer pkg-config for configuring
Many resilience and resource failure fixes by Lauri Aalto
Many other bug fixes and improvements were made
Fixed Issues: #0000077, #0000128, #0000168, #0000258, #0000261, #0000271, #0000279 and #0000305

See the Rasqal 0.9.17 Release Notes for the full details of the changes.

2008-07-05 Rasqal Version 0.9.16 Released

WARNING: ABI AND API CHANGED in this release. Rasqal 0.9.16 is incompatible with 0.9.15 or earlier.

Added a rasqal_world object used for all constructor functions
Removed deprecated functions and macros
Fixed some memory leaks and made some low-memory resiliance fixes
Query result sets can be read/written from sparql XML results format
Improved error syntax error reporting

See the Rasqal 0.9.16 Release Notes for the full details of the changes.

2007-11-17 Rasqal Version 0.9.15 Released

Many updates for supporting W3C SPARQL Proposed Recommendation. Passes over 92% of the DAWG SPARQL Test Suite.
Many query engine improvements.
Substantial improvements to datatypes support and evaluation.
Many improvements and fixes for use in low-memory situations
Several new APIs were added including a new XSD decimal class
Fixed issues: #0000190, #0000191, #0000193, #0000196, #0000197, #0000198, #0000199, #0000200, #0000201, #0000203, #0000204, #0000219, #0000220, #0000221, #0000225, #0000234, #0000235 and #0000236

WARNING: ABI AND API CHANGE in Rasqal 0.9.16 which will be incompatible with 0.9.15.

See the Rasqal 0.9.15 Release Notes for the full details of the changes.

2007-04-22 Rasqal Version 0.9.14 Released

Added syntax and API support but no query engine support for an experimental extension to SPARQL: LAQRS: LAQRS Adds to Querying RDF in SPARQL
Updated the query results formatter to allow better introspection of formats
Updated SPARQL parser for SPARQL Working Draft 2007-03-26 additions.
Fixed issues: #0000152, #0000156, #0000160, #0000167 and #0000182

See the Rasqal 0.9.14 Release Notes for the full details of the changes.

2006-10-30 Rasqal Version 0.9.13 Released

Added a new rasqal_query_results_formatter class
Query engine now implements SPARQL GRAPH
Added query features system to set parameters
Many internal query engine changes (code reorganisation)
Many bug fixes addressing Issues #0000080, #0000094, #0000095, #0000098, #0000100, #0000111, #0000113, #0000118, #0000129, #0000131 and #0000133.

See the 0.9.13 Release Notes for the full details of the changes.

2006-04-30 Rasqal Version 0.9.12 Released

Added JSON output based on the Serializing SPARQL Query Results in JSON draft
Added query writer so you can use rasqal to turn RDQL into SPARQL
Updated to SPARQL Query Language for RDF W3C Candidate Rec, 6 April 2006 now accepting all SPARQL syntax
Requires raptor 1.4.9 or newer.
Win32 build fixes (John Barstow)
Many internal code re-organisations

See the 0.9.12 Release Notes for the full details of the changes.

2006-01-15 Rasqal Version 0.9.11 Released

Updated to SPARQL Query Language for RDF W3C Working Draft, 23 November 2005 making several additions and changes to the syntax and functionality.
Using ordering, distinct and limit with query results now works
Created an enhanced API reference manual with gtk-doc
Requires Raptor 1.4.8
Many updates to the literal and expression handling
Major internal source code re-organisation
Many other changes, fixes and improvements.

See the 0.9.11 Release Notes for the full details of the changes.

2005-06-09 Rasqal Version 0.9.10 Released

The query engine now supports sorting query results implementing SPARQL ORDER BY (NOTE: duplicate query results are not yet removed)
SPARQL query language support updated for some recent changes

See the 0.9.10 Release Notes for the full details of the changes.

2005-05-19 Rasqal Version 0.9.9 Released

Updated to SPARQL Query Language for RDF, W3C Working Draft, 19 April 2005 making widespread changes the syntax.
Query API extensively added to access more query structure
Query engine updated including query results limit and offsets
Updated to the revised SPARQL Query Results XML Format (not yet published)
Many other bug fixes and improvements

See the 0.9.9 Release Notes for the full details of the changes.

2005-04-10 Rasqal Version 0.9.8 Released

Updated to SPARQL Query Language for RDF W3C Working Draft of 17 February 2005
Added casting to the engine and in SPARQL
Restructured query engine to be based on a tree of graph patterns
Constraints now work per-graph pattern
Added a Data Graph API
Query engine uses and binds graph names in queries (SPARQL LOAD, FROM and GRAPH)
Expanded the Graph Pattern API

See the 0.9.8 Release Notes for the full details of the changes.

2005-02-27 Rasqal Version 0.9.7 Released

Fix a resource cleanup problem when query results were not fully read
Fixed some crashes in expression evaluation with invalid types
Added a graph pattern API to provide full access to the query structures
Added query methods to return just bound or all variables
Some updates for syntax changes of SPARQL Query Language for RDF W3C Working Draft of 17 February 2005
Portability fixes for win32 (Dave Viner)

See the 0.9.7 Release Notes for the full details of the changes.

2005-02-06 Rasqal Version 0.9.6 Released

Added support and API calls for new query result forms graph and boolean
Added SPARQL CONSTRUCT, ASK result forms
Added 7 new SPARQL built-in functions
Allow UTF-8 and Unicode in prefixes and QNames in queries
Several other changes and bug fixes.

See the 0.9.6 Release Notes for the full details of the changes.

2005-01-16 Rasqal Version 0.9.5 Released

Query engine refactored to execute over graph patterns
Added support for SPARQL optionals
Added formatting of query results according to the SPARQL Variable Binding Results XML Format, W3C Working Draft, 21 December 2004
Updated SPARQL to handle syntax changes
Many other improvements and fixes

See the 0.9.5 Release Notes for the full details of the changes.

2004-10-29 Rasqal Version 0.9.4 Released

Fixed several crashes during query execution
Fixed some memory leaks when a query failed
Pass on internal raptor errors to rasqal users.

See the 0.9.4 Release Notes for the full details of the changes.

2004-10-25 Rasqal Version 0.9.3 Released

License changed to LGPL 2.1/Apache 2
Added initial support for the W3C SPARQL Query Language for RDF, 2004-10-12 working draft
Queries can now be executed multiple times
Portability fixes for building on win32 (Chris Pointon)
Various roqet utility improvements

See the 0.9.3 Release Notes for the full details of the changes.

2004-08-03 Rasqal Version 0.9.2 Released

Fix casts for C++
Add win32 skeleton header file
Fix a memory leak when using redland inside rasqal

See the 0.9.2 Release Notes for the full details of the changes.

2004-06-13 Rasqal Version 0.9.1 Released

Added a query results class separate from the query class and moved all the results methods to the new class.
Made portability fixes for the generated RDQL lexer files

See the 0.9.1 Release Notes for the full details of the changes.

2004-05-15 Rasqal Version 0.9.0 Released

First public release.

2003-08-12 Rasqal Version 0.1.0 Released

Initial web site created. Nothing actually released.


Copyright (C) 2003-2014 Dave Beckett
Copyright (C) 2003-2005 University of Bristol

rasqal-0.9.33/configure0000755000175000017500000205737712434455634011760 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for Rasqal RDF Query Library 0.9.33. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: http://bugs.librdf.org/ about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} as_awk_strverscmp=' # Use only awk features that work with 7th edition Unix awk (1978). # My, what an old awk you have, Mr. Solaris! END { while (length(v1) && length(v2)) { # Set d1 to be the next thing to compare from v1, and likewise for d2. # Normally this is a single character, but if v1 and v2 contain digits, # compare them as integers and fractions as strverscmp does. if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { # Split v1 and v2 into their leading digit string components d1 and d2, # and advance v1 and v2 past the leading digit strings. for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) if (d1 ~ /^0/) { if (d2 ~ /^0/) { # Compare two fractions. while (d1 ~ /^0/ && d2 ~ /^0/) { d1 = substr(d1, 2); len1-- d2 = substr(d2, 2); len2-- } if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { # The two components differ in length, and the common prefix # contains only leading zeros. Consider the longer to be less. d1 = -len1 d2 = -len2 } else { # Otherwise, compare as strings. d1 = "x" d1 d2 = "x" d2 } } else { # A fraction is less than an integer. exit 1 } } else { if (d2 ~ /^0/) { # An integer is greater than a fraction. exit 2 } else { # Compare two integers. d1 += 0 d2 += 0 } } } else { # The normal case, without worrying about digits. d1 = substr(v1, 1, 1); v1 = substr(v1, 2) d2 = substr(v2, 1, 1); v2 = substr(v2, 2) } if (d1 < d2) exit 1 if (d1 > d2) exit 2 } # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), # which mishandles some comparisons of empty strings to integers. if (length(v2)) exit 1 if (length(v1)) exit 2 } ' test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Rasqal RDF Query Library' PACKAGE_TARNAME='rasqal' PACKAGE_VERSION='0.9.33' PACKAGE_STRING='Rasqal RDF Query Library 0.9.33' PACKAGE_BUGREPORT='http://bugs.librdf.org/' PACKAGE_URL='' ac_unique_file="src/rasqal_general.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_c_werror_flag= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS GTK_DOC_USE_REBASE_FALSE GTK_DOC_USE_REBASE_TRUE GTK_DOC_USE_LIBTOOL_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_BUILD_PDF_FALSE GTK_DOC_BUILD_PDF_TRUE GTK_DOC_BUILD_HTML_FALSE GTK_DOC_BUILD_HTML_TRUE ENABLE_GTK_DOC_FALSE ENABLE_GTK_DOC_TRUE GTKDOC_DEPS_LIBS GTKDOC_DEPS_CFLAGS HTML_DIR GTKDOC_MKPDF GTKDOC_REBASE GTKDOC_CHECK AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V abs_top_builddir abs_top_srcdir PKGCONFIG_CFLAGS PKGCONFIG_LIBS PKGCONFIG_REQUIRES RASQAL_LIBTOOLLIBS RECHO_C RECHO_N STANDARD_CFLAGS MEM_LIBS MEM RASQAL_INTERNAL_LIBS RASQAL_INTERNAL_CPPFLAGS RASQAL_EXTERNAL_LIBS RASQAL_MTWIST_FALSE RASQAL_MTWIST_TRUE RASQAL_QUERY_SPARQL_FALSE RASQAL_QUERY_SPARQL_TRUE RASQAL_QUERY_LAQRS_FALSE RASQAL_QUERY_LAQRS_TRUE XML_CONFIG UUID_CONFIG UUID_LIBS UUID_CFLAGS RASQAL_DIGEST_INTERNAL_FALSE RASQAL_DIGEST_INTERNAL_TRUE LIBGCRYPT_CONFIG PCRE_CONFIG RASQAL_SORT_FALSE RASQAL_SORT_TRUE RAPTOR_MIN_VERSION RAPTOR_VERSION_DEC RAPTOR2_LIBS RAPTOR2_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG GETTIMEOFDAY_FALSE GETTIMEOFDAY_TRUE TIMEGM_FALSE TIMEGM_TRUE GETOPT_FALSE GETOPT_TRUE STRCASECMP_FALSE STRCASECMP_TRUE RASQAL_VERSION_DECIMAL RASQAL_VERSION_RELEASE RASQAL_VERSION_MINOR RASQAL_VERSION_MAJOR RASQAL_VERSION RASQAL_LIBTOOL_VERSION HAVE_TIME_H HAVE_SYS_TIME_H RECHO PERL TAR BISON LEXLIB LEX_OUTPUT_ROOT LEX CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC ac_ct_AR AR host_os host_vendor host_cpu host build_os build_vendor build_cpu build MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_release enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_pcre with_pcre_config with_regex_library with_mhash with_libgcrypt_config with_digest_library with_uuid_library enable_xml2 with_xml2_config enable_query_languages with_gmp with_mpfr with_decimal with_random_approach enable_debug with_memory_signing enable_silent_rules with_html_dir enable_gtk_doc enable_gtk_doc_html enable_gtk_doc_pdf ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR RAPTOR2_CFLAGS RAPTOR2_LIBS UUID_CFLAGS UUID_LIBS GTKDOC_DEPS_CFLAGS GTKDOC_DEPS_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Rasqal RDF Query Library 0.9.33 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/rasqal] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Rasqal RDF Query Library 0.9.33:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-release Turn on optimizations (for maintainer). --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-pcre Disable PCRE support (default auto) --disable-xml2 Disable XML2 support (default auto) --enable-query-languages=LIST Enable query languages (default=all) --enable-debug Enable debug messages (default no). --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --enable-gtk-doc use gtk-doc to build documentation [[default=no]] --enable-gtk-doc-html build documentation in html format [[default=yes]] --enable-gtk-doc-pdf build documentation in pdf format [[default=no]] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-pcre-config=PATH Location of PCRE pcre-config (auto) --with-regex-library=NAME Use regex library - posix, pcre (auto) --with-mhash=DIR mhash installation prefix (no default) --with-libgcrypt-config=PATH Location of GCRYPT libgcrypt-config (auto) --with-digest-library=NAME Use message digest library - mhash, gcrypt, internal (auto) --with-uuid-library=NAME Use UUID library - libuuid, libc (auto) --with-xml2-config=PATH Location of libxml xml2-config () --with-gmp=DIR GMP install area --with-mpfr=DIR MPFR install area --with-decimal=NAME Use decimal library - mpfr (default), gmp, none --with-random-approach=NAME Use random approach - mtwist, random_r, rand_r, random, rand (auto) --with-memory-signing Sign allocated memory (default=no) --with-html-dir=PATH path to installed docs Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path RAPTOR2_CFLAGS C compiler flags for RAPTOR2, overriding pkg-config RAPTOR2_LIBS linker flags for RAPTOR2, overriding pkg-config UUID_CFLAGS C compiler flags for UUID, overriding pkg-config UUID_LIBS linker flags for UUID, overriding pkg-config GTKDOC_DEPS_CFLAGS C compiler flags for GTKDOC_DEPS, overriding pkg-config GTKDOC_DEPS_LIBS linker flags for GTKDOC_DEPS, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Rasqal RDF Query Library configure 0.9.33 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------- ## ## Report this to http://bugs.librdf.org/ ## ## -------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Rasqal RDF Query Library $as_me 0.9.33, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/rasqal_config.h" ac_aux_dir= for ac_dir in build "$srcdir"/build; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in build \"$srcdir\"/build" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='rasqal' VERSION='0.9.33' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE release_version=no # Check whether --enable-release was given. if test "${enable_release+set}" = set; then : enableval=$enable_release; \ if test "$enableval" = "yes"; then \ release_version=yes fi; fi if test "$USE_MAINTAINER_MODE" = yes -a $release_version = no; then CFLAGS=`echo $CFLAGS | sed -e "s/-OA-Za-z0-9*//"` CXXFLAGS=`echo $CXXFLAGS | sed -e "s/-OA-Za-z0-9*//"` CPPFLAGS=`echo $CPPFLAGS | sed -e "s/-OA-Za-z0-9*//"` fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} { $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 $as_echo_n "checking the archiver ($AR) interface... " >&6; } if ${am_cv_ar_interface+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_ar_interface=ar cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int some_variable = 0; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 $as_echo "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) as_fn_error $? "could not determine $AR interface" "$LINENO" 5 ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is clang" >&5 $as_echo_n "checking whether $CC is clang... " >&6; } case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi FLEX_MIN_VERSION=2.5.19 FLEX_REC_VERSION=2.5.36 # Do not want AM_PROG_LEX which adds 'missing' to LEX if it's not around for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking flex" >&5 $as_echo_n "checking flex... " >&6; } if test "$USE_MAINTAINER_MODE" = yes; then # maintainer mode - flex is required if test "X$LEX" = "X:" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present" >&5 $as_echo "not present" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please get flex from http://flex.sourceforge.net/" >&5 $as_echo "$as_me: WARNING: Please get flex from http://flex.sourceforge.net/" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)" >&5 $as_echo "$as_me: WARNING: version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)" >&2;} { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "flex not present See \`config.log' for more details" "$LINENO" 5; } fi # some kind of lexer is present if echo "$LEX" | grep flex >/dev/null 2>&1; then # flex is present FLEX_VERSION=`$LEX -V 2>&1 | $AWK '{print $2}'` FLEX_VERSION_DEC=`echo $FLEX_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` FLEX_MIN_VERSION_DEC=`echo $FLEX_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` if test $FLEX_VERSION_DEC -ge $FLEX_MIN_VERSION_DEC; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX_VERSION - OK" >&5 $as_echo "$FLEX_VERSION - OK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: version $FLEX_VERSION - too old" >&5 $as_echo "version $FLEX_VERSION - too old" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please get flex from http://flex.sourceforge.net/" >&5 $as_echo "$as_me: WARNING: Please get flex from http://flex.sourceforge.net/" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)" >&5 $as_echo "$as_me: WARNING: version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)" >&2;} { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "flex is too old See \`config.log' for more details" "$LINENO" 5; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: present - but is not flex" >&5 $as_echo "present - but is not flex" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please get flex from http://flex.sourceforge.net/" >&5 $as_echo "$as_me: WARNING: Please get flex from http://flex.sourceforge.net/" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)" >&5 $as_echo "$as_me: WARNING: version $FLEX_MIN_VERSION ($FLEX_REC_VERSION recommended)" >&2;} { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "$LEX is not not flex See \`config.log' for more details" "$LINENO" 5; } fi else # not maintainer mode; flex is not required { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present - not required for non maintainer builds" >&5 $as_echo "not present - not required for non maintainer builds" >&6; } LEX="$SHELL $missing_dir/missing flex" LEX_OUTPUT_ROOT=lex.yy LEXLIB='' FLEX_VERSION_DEC=00000 fi cat >>confdefs.h <<_ACEOF #define FLEX_VERSION_DECIMAL $FLEX_VERSION_DEC _ACEOF BISON_MIN_VERSION=3.0.0 for ac_prog in bison3 bison do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_BISON+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$BISON"; then ac_cv_prog_BISON="$BISON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_BISON="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi BISON=$ac_cv_prog_BISON if test -n "$BISON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5 $as_echo "$BISON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$BISON" && break done if test "$USE_MAINTAINER_MODE" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU bison" >&5 $as_echo_n "checking for GNU bison... " >&6; } # Match these styles of versions # GNU Bison version 1.28 # bison (GNU Bison) 1.875 BISON_VERSION=`$BISON --version 2>&1 | sed -ne 's/^.*GNU Bison[^0-9]*//p'` if test "X$BISON_VERSION" != X; then BISON_VERSION_DEC=`echo $BISON_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` BISON_MIN_VERSION_DEC=`echo $BISON_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` if test $BISON_VERSION_DEC -ge $BISON_MIN_VERSION_DEC; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON_VERSION - OK" >&5 $as_echo "$BISON_VERSION - OK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: version $BISON_VERSION is too old" >&5 $as_echo "version $BISON_VERSION is too old" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please get GNU Bison from http://www.gnu.org/software/bison/" >&5 $as_echo "$as_me: WARNING: Please get GNU Bison from http://www.gnu.org/software/bison/" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: version $BISON_MIN_VERSION or newer" >&5 $as_echo "$as_me: WARNING: version $BISON_MIN_VERSION or newer" >&2;} { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "GNU Bison too old See \`config.log' for more details" "$LINENO" 5; } fi else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "$BISON is not GNU bison See \`config.log' for more details" "$LINENO" 5; } fi fi for ac_prog in awk gawk nawk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done # Find a tar command for 'make dist' for ac_prog in gnutar gtar tar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_TAR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TAR"; then ac_cv_prog_TAR="$TAR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_TAR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi TAR=$ac_cv_prog_TAR if test -n "$TAR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5 $as_echo "$TAR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$TAR" && break done for ac_prog in perl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PERL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PERL"; then ac_cv_prog_PERL="$PERL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PERL="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PERL=$ac_cv_prog_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PERL" && break done ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} for ac_prog in echo do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RECHO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RECHO"; then ac_cv_prog_RECHO="$RECHO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RECHO="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RECHO=$ac_cv_prog_RECHO if test -n "$RECHO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RECHO" >&5 $as_echo "$RECHO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$RECHO" && break done RECHO_C= RECHO_N= case `$RECHO -n x` in -n*) case `$RECHO 'xy\c'` in *c*) ;; xy) RECHO_C='\c' ;; esac;; *) RECHO_N='-n' ;; esac # GCC warning options # http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html # # Too noisy: # # -Wconversion : cases that need RASQAL_GOOD/BAD_CAST etc. # -Wcast-qual : cases that need RASQAL_GOOD/BAD_CAST etc. # -Wswitch-default : noisy cases in flex output # -Wsystem-headers : not debugging system # -Wunused-parameter : variables can be marked __attribute__('unused') # # Apple gcc specific (probably): -Wshorten-64-to-32 possible_warnings="\ -Wall \ -Wc++-compat \ -Wextra \ -Wunused \ \ -Waggregate-return \ -Wbad-function-cast \ -Wcast-align \ -Wdeclaration-after-statement \ -Wdisabled-optimization \ -Wdiv-by-zero \ -Wendif-labels \ -Werror-implicit-function-declaration \ -Wfloat-equal \ -Wformat=2 \ -Wframe-larger-than=4096 \ -Winit-self \ -Winline \ -Wmissing-declarations \ -Wmissing-format-attribute \ -Wmissing-noreturn \ -Wmissing-prototypes \ -Wnested-externs \ -Wold-style-definition \ -Wpacked \ -Wpointer-arith \ -Wredundant-decls \ -Wshadow \ -Wsign-compare \ -Wstrict-prototypes \ -Wswitch-enum \ -Wundef \ -Wunreachable-code \ -Wunsafe-loop-optimizations \ -Wwrite-strings \ \ -Wshorten-64-to-32 \ -Wno-conversion \ -Wno-cast-qual \ -Wno-switch-default \ -Wno-system-headers \ -Wno-unused-parameter \ -Wc90-c99-compat \ -Wc99-c11-compat \ " warning_cflags= if test "$USE_MAINTAINER_MODE" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported $CC warning flags" >&5 $as_echo_n "checking for supported $CC warning flags... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $warning_cflags" >&5 $as_echo "$warning_cflags" >&6; } for warning in $possible_warnings; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $warning" >&5 $as_echo_n "checking whether $CC supports $warning... " >&6; } ## backup CFLAGS and werror status redland_save_CFLAGS="$CFLAGS" redland_save_ac_c_werror_flag="${ac_c_werror_flag}" ac_c_werror_flag=yes CFLAGS="$CFLAGS $warning" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : redland_cc_flag=yes else redland_cc_flag=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ## restore CFLAGS and werror status CFLAGS="$redland_save_CFLAGS" ac_c_werror_flag="${redland_save_ac_c_werror_flag}" if test "X$redland_cc_flag" = "Xyes"; then warning_cflags="$warning_cflags $warning" else : fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $redland_cc_flag" >&5 $as_echo "$redland_cc_flag" >&6; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking $CC supports warning flags" >&5 $as_echo_n "checking $CC supports warning flags... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $warning_cflags" >&5 $as_echo "$warning_cflags" >&6; } fi STANDARD_CFLAGS= MAINTAINER_CPPFLAGS="$warning_cflags" # Externally linked libraries - appear in rasqal-config # -Dfoo -Idir RASQAL_CPPFLAGS=$CPPFLAGS # -Ldir RASQAL_LDFLAGS=$LDFLAGS # -llib RASQAL_LIBS=$LIBS # Internally linked libraries - never given to users # -Dfoo -Idir RASQAL_INTERNAL_CPPFLAGS= # -Ldir -llib RASQAL_INTERNAL_LIBS= # Libraries linked externally also may be internal - just raptor # -Ldir -llib RASQAL_EXTERNAL_LIBS= # Extra pkgconfig requires PKGCONFIG_REQUIRES= PKGCONFIG_LIBS= PKGCONFIG_CFLAGS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in errno.h stddef.h stdlib.h stdint.h unistd.h string.h strings.h getopt.h regex.h sys/time.h time.h math.h limits.h errno.h float.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi if test "$ac_cv_header_sys_time_h" = "yes"; then HAVE_SYS_TIME_H=1 else HAVE_SYS_TIME_H=0 fi if test "$ac_cv_header_time_h" = "yes"; then HAVE_TIME_H=1 else HAVE_TIME_H=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __FUNCTION__ is available" >&5 $as_echo_n "checking whether __FUNCTION__ is available... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main() { printf(__FUNCTION__); } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE___FUNCTION__ 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Libtool versioning # # CURRENT # The most recent interface number that this library implements. # # REVISION # The implementation number of the CURRENT interface. # # AGE # The difference between the newest and oldest interfaces that this # library implements. In other words, the library implements all the # interface numbers in the range from number `CURRENT - AGE' to # `CURRENT'. # # Rules: # 1. Start with version information of `0:0:0' for each libtool library. # # 2. Update the version information only immediately before a public # release of your software. More frequent updates are unnecessary, # and only guarantee that the current interface number gets larger # faster. # # 3. If the library source code has changed at all since the last # update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). # # 4. If any interfaces have been added, removed, or changed since the # last update, increment CURRENT, and set REVISION to 0. # # 5. If any interfaces have been added since the last public release, # then increment AGE. # # 6. If any interfaces have been removed since the last public release, # then set AGE to 0. # # syntax: CURRENT[:REVISION[:AGE]] RASQAL_LIBTOOL_VERSION=3:0:0 version_major=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\1/'` version_minor=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\2/'` version_release=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\3/'` version_decimal=`expr $version_major \* 10000 + $version_minor \* 100 + $version_release` cat >>confdefs.h <<_ACEOF #define RASQAL_VERSION_MAJOR $version_major _ACEOF cat >>confdefs.h <<_ACEOF #define RASQAL_VERSION_MINOR $version_minor _ACEOF cat >>confdefs.h <<_ACEOF #define RASQAL_VERSION_RELEASE $version_release _ACEOF cat >>confdefs.h <<_ACEOF #define RASQAL_VERSION_DECIMAL $version_decimal _ACEOF # for rasqal-config.in RASQAL_VERSION_MAJOR=$version_major RASQAL_VERSION_MINOR=$version_minor RASQAL_VERSION_RELEASE=$version_release RASQAL_VERSION_DECIMAL=$version_decimal for ac_func in getopt getopt_long stricmp strcasecmp vsnprintf initstate_r initstate random_r random gmtime_r rand_r rand srand timegm gettimeofday do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test $ac_cv_func_stricmp = no -a $ac_cv_func_strcasecmp = no; then STRCASECMP_TRUE= STRCASECMP_FALSE='#' else STRCASECMP_TRUE='#' STRCASECMP_FALSE= fi if test $ac_cv_func_getopt = no -a $ac_cv_func_getopt_long = no; then GETOPT_TRUE= GETOPT_FALSE='#' else GETOPT_TRUE='#' GETOPT_FALSE= fi if test $ac_cv_func_timegm = no; then TIMEGM_TRUE= TIMEGM_FALSE='#' else TIMEGM_TRUE='#' TIMEGM_FALSE= fi if test $ac_cv_func_gettimeofday = no; then GETTIMEOFDAY_TRUE= GETTIMEOFDAY_FALSE='#' else GETTIMEOFDAY_TRUE='#' GETTIMEOFDAY_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether need to declare optind" >&5 $as_echo_n "checking whether need to declare optind... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_GETOPT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif int main () { int x=optind; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else $as_echo "#define NEED_OPTIND_DECLARATION 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm has tm_gmtoff field" >&5 $as_echo_n "checking whether struct tm has tm_gmtoff field... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif int main () { struct tm my_time; my_time.tm_gmtoff = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_tm_gmtoff="yes" else have_tm_gmtoff="no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_tm_gmtoff" >&5 $as_echo "$have_tm_gmtoff" >&6; } if test $have_tm_gmtoff = "yes" ; then $as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h fi # raptor V2 is REQUIRED; --enable-raptor2 option was removed RAPTOR_MIN_VERSION=2.0.7 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RAPTOR2" >&5 $as_echo_n "checking for RAPTOR2... " >&6; } if test -n "$RAPTOR2_CFLAGS"; then pkg_cv_RAPTOR2_CFLAGS="$RAPTOR2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"raptor2\""; } >&5 ($PKG_CONFIG --exists --print-errors "raptor2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_RAPTOR2_CFLAGS=`$PKG_CONFIG --cflags "raptor2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$RAPTOR2_LIBS"; then pkg_cv_RAPTOR2_LIBS="$RAPTOR2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"raptor2\""; } >&5 ($PKG_CONFIG --exists --print-errors "raptor2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_RAPTOR2_LIBS=`$PKG_CONFIG --libs "raptor2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then RAPTOR2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "raptor2" 2>&1` else RAPTOR2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "raptor2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$RAPTOR2_PKG_ERRORS" >&5 as_fn_error $? "Raptor is not installed - see http://librdf.org/raptor/ to get $RAPTOR_MIN_VERSION or newer" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "Raptor is not installed - see http://librdf.org/raptor/ to get $RAPTOR_MIN_VERSION or newer" "$LINENO" 5 else RAPTOR2_CFLAGS=$pkg_cv_RAPTOR2_CFLAGS RAPTOR2_LIBS=$pkg_cv_RAPTOR2_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } RAPTOR_VERSION=`$PKG_CONFIG raptor2 --modversion 2>/dev/null` raptor_too_old=0 as_arg_v1=$RAPTOR_VERSION as_arg_v2=$RAPTOR_MIN_VERSION awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null case $? in #( 1) : raptor_too_old="1" ;; #( 0) : ;; #( 2) : ;; #( *) : ;; esac if test $raptor_too_old = 1; then as_fn_error $? "Raptor $RAPTOR_VERSION is too old - see http://librdf.org/raptor/ to get a $RAPTOR_MIN_VERSION or newer" "$LINENO" 5 fi fi RAPTOR_VERSION_DEC=`echo $RAPTOR_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` if test $RAPTOR_VERSION_DEC '<' 20015; then RASQAL_SORT_TRUE= RASQAL_SORT_FALSE='#' else RASQAL_SORT_TRUE='#' RASQAL_SORT_FALSE= fi have_regex_pcre=0 have_regex_posix=0 need_regex_pcre=0 need_regex_posix=0 # Check whether --enable-pcre was given. if test "${enable_pcre+set}" = set; then : enableval=$enable_pcre; enable_pcre=$enableval else enable_pcre="auto" fi if test "x$enable_pcre" != "xno" ; then # Check whether --with-pcre-config was given. if test "${with_pcre_config+set}" = set; then : withval=$with_pcre_config; pcre_config="$withval" else pcre_config="" fi if test "X$pcre_config" != "Xno" ; then if test "X$pcre_config" != "X" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $pcre_config" >&5 $as_echo_n "checking for $pcre_config... " >&6; } if test -x $pcre_config ; then PCRE_CONFIG=$pcre_config { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "pcre-config not found at specified path $pcre_config" "$LINENO" 5 fi fi if test "X$PCRE_CONFIG" = "X" ; then for ac_prog in pcre-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PCRE_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PCRE_CONFIG"; then ac_cv_prog_PCRE_CONFIG="$PCRE_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PCRE_CONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PCRE_CONFIG=$ac_cv_prog_PCRE_CONFIG if test -n "$PCRE_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCRE_CONFIG" >&5 $as_echo "$PCRE_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PCRE_CONFIG" && break done fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre" >&5 $as_echo_n "checking for pcre... " >&6; } PCRE_VERSION=`$PCRE_CONFIG --version 2>/dev/null` PCRE_MIN_VERSION=3.9 PCRE_VERSION_DEC=`echo $PCRE_VERSION | $AWK -F. '{printf("%d\n", 100*$1 + $2)};'` PCRE_MIN_VERSION_DEC=`echo $PCRE_MIN_VERSION | $AWK -F. '{printf("%d\n", 100*$1 + $2)};'` if test "X$PCRE_VERSION" = X; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present" >&5 $as_echo "not present" >&6; } elif test "X$PCRE_VERSION" -a $PCRE_VERSION_DEC -ge $PCRE_MIN_VERSION_DEC; then have_regex_pcre=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCRE_VERSION" >&5 $as_echo "$PCRE_VERSION" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $PCRE_VERSION - too old - need $PCRE_MIN_VERSION" >&5 $as_echo "$as_me: WARNING: $PCRE_VERSION - too old - need $PCRE_MIN_VERSION" >&2;} fi if test $have_regex_pcre = 1; then $as_echo "#define HAVE_REGEX_PCRE 1" >>confdefs.h elif test "x$enable_pcre" = "xyes"; then as_fn_error $? "PCRE requested but not found" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix regex library" >&5 $as_echo_n "checking for posix regex library... " >&6; } oLIBS="$LIBS" if test $ac_cv_header_regex_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { regex_t reg; char *pat="abc"; regcomp(®, pat, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : worked=yes else worked=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $worked = yes; then have_regex_posix=1 fi fi LIBS="$oLIBS" if test $have_regex_posix = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_REGEX_POSIX 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check whether --with-regex-library was given. if test "${with_regex_library+set}" = set; then : withval=$with_regex_library; regex_library="$withval" else regex_library="" fi for regex_library_name in $regex_library pcre posix; do case $regex_library_name in pcre) if test $have_regex_pcre = 1; then need_regex_pcre=1 $as_echo "#define RASQAL_REGEX_PCRE 1" >>confdefs.h break fi ;; posix) if test $have_regex_posix = 1; then need_regex_posix=1 $as_echo "#define RASQAL_REGEX_POSIX 1" >>confdefs.h break fi ;; *) as_fn_error $? "No such regex library $regex_library_name" "$LINENO" 5 ;; esac done { $as_echo "$as_me:${as_lineno-$LINENO}: checking regex library to use" >&5 $as_echo_n "checking regex library to use... " >&6; } regex_library= if test $need_regex_pcre = 1; then regex_library=pcre elif test $need_regex_posix = 1; then regex_library=posix else regex_library=none $as_echo "#define RASQAL_REGEX_NONE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No regex library available - please install pcre or a POSIX regex library" >&5 $as_echo "$as_me: WARNING: No regex library available - please install pcre or a POSIX regex library" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $regex_library" >&5 $as_echo "$regex_library" >&6; } have_digest_mhash=no have_digest_gcrypt=no have_digest_internal=yes need_digest_mhash=no need_digest_gcrypt=no need_digest_internal=no # Check whether --with-mhash was given. if test "${with_mhash+set}" = set; then : withval=$with_mhash; mhash_dir=$withval else mhash_dir="" fi oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" if test "X$mhash_dir" != "X" ; then CPPFLAGS="$CPPFLAGS -I$mhash_dir/include" LIBS="$LIBS -L$mhash_dir/lib" fi LIBS="$LIBS -lmhash" for ac_header in mhash.h do : ac_fn_c_check_header_mongrel "$LINENO" "mhash.h" "ac_cv_header_mhash_h" "$ac_includes_default" if test "x$ac_cv_header_mhash_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MHASH_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mhash" >&5 $as_echo_n "checking for mhash... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #undef PACKAGE #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef VERSION #include int main () { MHASH m; mhash_init(MHASH_MD5); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_digest_mhash=yes else have_digest_mhash=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_digest_mhash" >&5 $as_echo "$have_digest_mhash" >&6; } CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" # Check whether --with-libgcrypt-config was given. if test "${with_libgcrypt_config+set}" = set; then : withval=$with_libgcrypt_config; libgcrypt_config="$withval" else libgcrypt_config="" fi if test "X$libgcrypt_config" != "Xno" ; then if test "X$libgcrypt_config" != "X" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $libgcrypt_config" >&5 $as_echo_n "checking for $libgcrypt_config... " >&6; } if test -x $libgcrypt_config ; then LIBGCRYPT_CONFIG=$libgcrypt_config { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "libgcrypt-config not found at specified path $libgcrypt_config" "$LINENO" 5 fi fi if test "X$LIBGCRYPT_CONFIG" = "X" ; then for ac_prog in libgcrypt-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIBGCRYPT_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIBGCRYPT_CONFIG"; then ac_cv_prog_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIBGCRYPT_CONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIBGCRYPT_CONFIG=$ac_cv_prog_LIBGCRYPT_CONFIG if test -n "$LIBGCRYPT_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5 $as_echo "$LIBGCRYPT_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LIBGCRYPT_CONFIG" && break done fi fi for ac_header in gcrypt.h do : ac_fn_c_check_header_mongrel "$LINENO" "gcrypt.h" "ac_cv_header_gcrypt_h" "$ac_includes_default" if test "x$ac_cv_header_gcrypt_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GCRYPT_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcrypt" >&5 $as_echo_n "checking for gcrypt... " >&6; } GCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version 2>/dev/null` if test "X$GCRYPT_VERSION" = X; then have_digest_gcrypt=no elif test "$ac_cv_header_gcrypt_h" = "yes"; then oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS `$LIBGCRYPT_CONFIG --cflags`" LIBS="$LIBS `$LIBGCRYPT_CONFIG --libs`" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { gcry_md_hd_t hash; gcry_md_open(hash, GCRY_MD_MD5, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_digest_gcrypt=yes else have_digest_gcrypt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" else have_digest_gcrypt=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_digest_gcrypt" >&5 $as_echo "$have_digest_gcrypt" >&6; } # Check whether --with-digest-library was given. if test "${with_digest_library+set}" = set; then : withval=$with_digest_library; digest_library="$withval" else digest_library="" fi for digest_library_name in $digest_library mhash gcrypt internal; do case $digest_library_name in mhash) if test $have_digest_mhash = yes; then need_digest_mhash=yes $as_echo "#define RASQAL_DIGEST_MHASH 1" >>confdefs.h break fi ;; gcrypt) if test $have_digest_gcrypt = yes; then need_digest_gcrypt=yes $as_echo "#define RASQAL_DIGEST_GCRYPT 1" >>confdefs.h break fi ;; internal) need_digest_internal=yes $as_echo "#define RASQAL_DIGEST_INTERNAL 1" >>confdefs.h break ;; *) as_fn_error $? "No such message digest library $digest_library_name" "$LINENO" 5 ;; esac done { $as_echo "$as_me:${as_lineno-$LINENO}: checking message digest library to use" >&5 $as_echo_n "checking message digest library to use... " >&6; } digest_library= if test $need_digest_mhash = yes; then digest_library=mhash elif test $need_digest_gcrypt = yes; then digest_library=gcrypt elif test $need_digest_internal = yes; then digest_library=internal else digest_library=none $as_echo "#define RASQAL_DIGEST_NONE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No message digest library selected - no message digest support will work" >&5 $as_echo "$as_me: WARNING: No message digest library selected - no message digest support will work" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $digest_library" >&5 $as_echo "$digest_library" >&6; } if test $digest_library = internal; then RASQAL_DIGEST_INTERNAL_TRUE= RASQAL_DIGEST_INTERNAL_FALSE='#' else RASQAL_DIGEST_INTERNAL_TRUE='#' RASQAL_DIGEST_INTERNAL_FALSE= fi have_uuid_libuuid=no have_uuid_libc=no have_uuid_ossp=no need_uuid_libuuid=no need_uuid_libc=no need_uuid_internal=no need_uuid_ossp=no pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UUID" >&5 $as_echo_n "checking for UUID... " >&6; } if test -n "$UUID_CFLAGS"; then pkg_cv_UUID_CFLAGS="$UUID_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"uuid\""; } >&5 ($PKG_CONFIG --exists --print-errors "uuid") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_UUID_CFLAGS=`$PKG_CONFIG --cflags "uuid" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$UUID_LIBS"; then pkg_cv_UUID_LIBS="$UUID_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"uuid\""; } >&5 ($PKG_CONFIG --exists --print-errors "uuid") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_UUID_LIBS=`$PKG_CONFIG --libs "uuid" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then UUID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "uuid" 2>&1` else UUID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "uuid" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$UUID_PKG_ERRORS" >&5 have_uuid_libuuid=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_uuid_libuuid=no else UUID_CFLAGS=$pkg_cv_UUID_CFLAGS UUID_LIBS=$pkg_cv_UUID_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } LIBUUID_VERSION=`$PKG_CONFIG uuid --modversion 2>/dev/null` oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS `$PKG_CONFIG uuid --cflags`" LIBS="$LIBS `$PKG_CONFIG uuid --libs`" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if defined(UUID_LEN_BIN) && defined(UUID_VERSION) FAIL #endif uuid_t data; uuid_clear(&data); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_uuid_libuuid=yes else have_uuid_libuuid=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libuuid" >&5 $as_echo_n "checking for libuuid... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_uuid_libuuid" >&5 $as_echo "$have_uuid_libuuid" >&6; } for ac_prog in uuid-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_UUID_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$UUID_CONFIG"; then ac_cv_prog_UUID_CONFIG="$UUID_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_UUID_CONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi UUID_CONFIG=$ac_cv_prog_UUID_CONFIG if test -n "$UUID_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UUID_CONFIG" >&5 $as_echo "$UUID_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$UUID_CONFIG" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ossp libuuid" >&5 $as_echo_n "checking for ossp libuuid... " >&6; } if test "X$UUID_CONFIG" != X; then OSSP_UUID_VERSION=`$UUID_CONFIG --version 2>/dev/null` oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS `$UUID_CONFIG --cflags`" LIBS="$LIBS `$UUID_CONFIG --ldflags --libs`" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uuid_t *data; uuid_create(&data); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_uuid_ossp=yes else have_uuid_ossp=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_uuid_ossp" >&5 $as_echo "$have_uuid_ossp" >&6; } for ac_header in uuid/uuid.h do : ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default" if test "x$ac_cv_header_uuid_uuid_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UUID_UUID_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UUID in libc" >&5 $as_echo_n "checking for UUID in libc... " >&6; } if test "$ac_cv_header_uuid_uuid_h" = "yes"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uuid_t data; uuid_clear(&data); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_uuid_libc=yes else have_uuid_libc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_uuid_libc" >&5 $as_echo "$have_uuid_libc" >&6; } # Check whether --with-uuid-library was given. if test "${with_uuid_library+set}" = set; then : withval=$with_uuid_library; uuid_library="$withval" else uuid_library="" fi for uuid_library_name in $uuid_library libuuid ossp libc internal; do case $uuid_library_name in libuuid) if test $have_uuid_libuuid = yes; then need_uuid_libuuid=yes $as_echo "#define RASQAL_UUID_LIBUUID 1" >>confdefs.h break fi ;; ossp) if test $have_uuid_ossp = yes; then need_uuid_ossp=yes $as_echo "#define RASQAL_UUID_OSSP 1" >>confdefs.h break fi ;; libc) if test $have_uuid_libc = yes; then need_uuid_libc=yes $as_echo "#define RASQAL_UUID_LIBC 1" >>confdefs.h break fi ;; internal) need_uuid_internal=yes $as_echo "#define RASQAL_UUID_INTERNAL 1" >>confdefs.h break ;; *) as_fn_error $? "No such UUID library $uuid_library_name" "$LINENO" 5 ;; esac done { $as_echo "$as_me:${as_lineno-$LINENO}: checking UUID library to use" >&5 $as_echo_n "checking UUID library to use... " >&6; } uuid_library= if test $need_uuid_libuuid = yes; then uuid_library="libuuid $LIBUUID_VERSION" elif test $need_uuid_ossp = yes; then uuid_library="ossp $OSSP_UUID_VERSION" elif test $need_uuid_libc = yes; then uuid_library=libc elif test $need_uuid_internal = yes; then uuid_library=internal else uuid_library=none $as_echo "#define RASQAL_UUID_NONE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No UUID library selected - no UUID support will work" >&5 $as_echo "$as_me: WARNING: No UUID library selected - no UUID support will work" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $uuid_library" >&5 $as_echo "$uuid_library" >&6; } have_libxml=0 need_libxml=0 # Check whether --enable-xml2 was given. if test "${enable_xml2+set}" = set; then : enableval=$enable_xml2; enable_xml2=$enableval else enable_xml2="auto" fi if test "x$enable_xml2" != "xno" ; then # Check whether --with-xml2-config was given. if test "${with_xml2_config+set}" = set; then : withval=$with_xml2_config; xml2_config="$withval" else xml2_config="" fi if test "X$xml2_config" != "X" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $xml2_config" >&5 $as_echo_n "checking for $xml2_config... " >&6; } if test -x $xml2_config ; then XML_CONFIG=$xml2_config { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "xml2-config not found at specified path $xml2_config" "$LINENO" 5 fi fi if test "X$XML_CONFIG" = "X"; then for ac_prog in xml2-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_XML_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$XML_CONFIG"; then ac_cv_prog_XML_CONFIG="$XML_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_XML_CONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi XML_CONFIG=$ac_cv_prog_XML_CONFIG if test -n "$XML_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML_CONFIG" >&5 $as_echo "$XML_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$XML_CONFIG" && break done fi LIBXML_MIN_VERSION=2.6.8 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml2 library" >&5 $as_echo_n "checking for libxml2 library... " >&6; } oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" if test "X$XML_CONFIG" != X; then LIBS="$LIBS `$XML_CONFIG --libs`" CPPFLAGS="`$XML_CONFIG --cflags` $CPPFLAGS" LIBXML_VERSION=`$XML_CONFIG --version` libxml_version_dec=`echo $LIBXML_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` LIBXML_MIN_VERSION_dec=`echo $LIBXML_MIN_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - version $LIBXML_VERSION" >&5 $as_echo "yes - version $LIBXML_VERSION" >&6; } if test $libxml_version_dec -lt $LIBXML_MIN_VERSION_dec; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Using libxml $LIBXML_VERSION is unsupported - $LIBXML_MIN_VERSION or newer required." >&5 $as_echo "$as_me: WARNING: Using libxml $LIBXML_VERSION is unsupported - $LIBXML_MIN_VERSION or newer required." >&2;} else for ac_header in libxml/xmlschemas.h libxml/xmlschemastypes.h libxml/schemasInternals.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_libxml_xmlschemas_h" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libxml library found but not xml schema headers - disabling" >&5 $as_echo "$as_me: WARNING: libxml library found but not xml schema headers - disabling" >&2;} else have_libxml=1 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" if test $have_libxml = 0 && test "x$enable_xml2" = "xyes" ; then as_fn_error $? "libxml2 requested but not found" "$LINENO" 5 fi fi sparql_query_language=no laqrs_query_language=no rdf_query_languages_available="sparql laqrs" rdf_query_languages_enabled= # This is needed because autoheader can't work out which computed # symbols must be pulled from acconfig.h into config.h.in if test "x" = "y"; then $as_echo "#define RASQAL_QUERY_LAQRS 1" >>confdefs.h $as_echo "#define RASQAL_QUERY_SPARQL 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking query languages required" >&5 $as_echo_n "checking query languages required... " >&6; } # Check whether --enable-query-languages was given. if test "${enable_query_languages+set}" = set; then : enableval=$enable_query_languages; query_languages="$enableval" fi if test "X$query_languages" = Xall -o "X$query_languages" = X; then query_languages="$rdf_query_languages_available" { $as_echo "$as_me:${as_lineno-$LINENO}: result: all" >&5 $as_echo "all" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $query_languages" >&5 $as_echo "$query_languages" >&6; } fi for query_language in $query_languages; do p=$query_language eval $p'_query_language=yes' NAME=`echo $p | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` n=RASQAL_QUERY_${NAME} cat >>confdefs.h <<_ACEOF #define $n 1 _ACEOF rdf_query_languages_enabled="$rdf_query_languages_enabled $query_language" done if test $laqrs_query_language = yes; then RASQAL_QUERY_LAQRS_TRUE= RASQAL_QUERY_LAQRS_FALSE='#' else RASQAL_QUERY_LAQRS_TRUE='#' RASQAL_QUERY_LAQRS_FALSE= fi if test $sparql_query_language = yes; then RASQAL_QUERY_SPARQL_TRUE= RASQAL_QUERY_SPARQL_FALSE='#' else RASQAL_QUERY_SPARQL_TRUE='#' RASQAL_QUERY_SPARQL_FALSE= fi RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $RAPTOR2_CFLAGS" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $RAPTOR2_LIBS" if test $need_regex_pcre = 1; then C=`$PCRE_CONFIG --cflags` L=`$PCRE_CONFIG --libs` RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" PKGCONFIG_CFLAGS="$PKGCONFIG_CFLAGS $C" PKGCONFIG_LIBS="$PKGCONFIG_LIBS $L" unset C unset L fi if test $need_digest_mhash = yes; then C="" L="-lmhash" if test "X$mhash_dir" != "X" ; then C="-I$mhash_dir/include" L="-L$mhash_dir/lib $L" fi RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" unset C unset L fi if test $need_digest_gcrypt = yes; then C=`$LIBGCRYPT_CONFIG --cflags` L=`$LIBGCRYPT_CONFIG --libs` RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" unset C unset L fi if test $need_uuid_libuuid = yes; then RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $UUID_CFLAGS" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $UUID_LIBS" PKGCONFIG_CFLAGS="$PKGCONFIG_CFLAGS $UUID_CFLAGS" PKGCONFIG_LIBS="$PKGCONFIG_LIBS $UUID_LIBS" fi if test $need_uuid_ossp = yes; then C=`$UUID_CONFIG --cflags` L=`$UUID_CONFIG --ldflags --libs` RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $C" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $L" unset C unset L fi gmp_lib_dir= gmp_include_dir= # Check whether --with-gmp was given. if test "${with_gmp+set}" = set; then : withval=$with_gmp; gmp_prefix="$withval" else gmp_prefix="none" fi if test "X$gmp_prefix" != "Xnone" ; then gmp_libs="-L$gmp_prefix/lib" gmp_includes="-I$gmp_prefix/include" fi mpfr_lib_dir= mpfr_include_dir= # Check whether --with-mpfr was given. if test "${with_mpfr+set}" = set; then : withval=$with_mpfr; mpfr_prefix="$withval" else mpfr_prefix="none" fi if test "X$mpfr_prefix" != "Xnone" ; then mpfr_libs="-L$mpfr_prefix/lib" mpfr_includes="-I$mpfr_prefix/include" fi oCPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $gmp_includes" for ac_header in gmp.h do : ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" if test "x$ac_cv_header_gmp_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GMP_H 1 _ACEOF fi done CPPFLAGS="$oCPPFLAGS" CPPFLAGS="$CPPFLAGS $mpfr_includes" for ac_header in mpfr.h do : ac_fn_c_check_header_compile "$LINENO" "mpfr.h" "ac_cv_header_mpfr_h" " #ifdef HAVE_GMP_H #include #endif " if test "x$ac_cv_header_mpfr_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MPFR_H 1 _ACEOF fi done CPPFLAGS="$oCPPFLAGS" have_mpfr=0 have_gmp=0 oCPPFLAGS="$CPPFLAGS" oLIBS="$LIBS" if test "$ac_cv_header_mpfr_h" = yes; then CPPFLAGS="$CPPFLAGS $mpfr_includes" LIBS="$LIBS $mpfr_libs -lmpfr" ac_fn_c_check_func "$LINENO" "mpfr_init" "ac_cv_func_mpfr_init" if test "x$ac_cv_func_mpfr_init" = xyes; then : have_mpfr_init=yes else have_mpfr_init=no fi # Several functions are used that are not in GMP version of MPFR: # mpfr_get_default_rounding_mode mpfr_equal_p mpfr_free_str # MPFR 2.1.0 released 3 Nov 2004 http://www.mpfr.org/mpfr-2.1.0/ # mpfr_snprintf # MPFR 2.4.0 released 26 January 2009 http://www.mpfr.org/mpfr-2.4.0/ # so just test for the latter. ac_fn_c_check_func "$LINENO" "mpfr_snprintf" "ac_cv_func_mpfr_snprintf" if test "x$ac_cv_func_mpfr_snprintf" = xyes; then : have_mpfr_snprintf=yes else have_mpfr_snprintf=no fi LIBS="$oLIBS" CPPFLAGS="$oCPPFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working MPFR library" >&5 $as_echo_n "checking for working MPFR library... " >&6; } if test $have_mpfr_init = yes -a $have_mpfr_snprintf = yes; then have_mpfr=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" have_gmp_version=0 have_gmp_random=no if test "$ac_cv_header_gmp_h" = yes; then CPPFLAGS="$CPPFLAGS $gmp_includes" LIBS="$LIBS $gmp_libs -lgmp" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU MP library" >&5 $as_echo_n "checking for working GNU MP library... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { mpz_t n; mpz_init(n); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_gmp=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU MP library random support" >&5 $as_echo_n "checking for GNU MP library random support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { gmp_randstate_t r; unsigned int ui = 12345; mpz_t iresult; mpz_t n; mpf_t fresult; gmp_randinit_default(r); gmp_randseed_ui(r, ui); mpz_init(iresult); mpz_init_set_ui(n, 12345); mpz_urandomm(iresult, r, n); mpz_clear(iresult); mpf_urandomb(fresult, r, 5); mpf_clear(fresult); mpz_clear(n); gmp_randclear(r); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_gmp_random=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp_version" >&5 $as_echo_n "checking for gmp_version... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { const char* v=gmp_version; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_gmp_version=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$oCPPFLAGS" LIBS="$oLIBS" if test $have_gmp_version = 1; then $as_echo "#define HAVE_GMP_VERSION 1" >>confdefs.h fi need_mpfr=0 need_gmp=0 # Check whether --with-decimal was given. if test "${with_decimal+set}" = set; then : withval=$with_decimal; decimal="$withval" else decimal="mpfr" fi for decimal_name in $decimal mpfr gmp none; do case $decimal_name in mpfr) if test $have_mpfr = 1; then need_mpfr=1 $as_echo "#define RASQAL_DECIMAL_MPFR 1" >>confdefs.h break fi ;; gmp) if test $have_gmp = 1; then need_gmp=1 $as_echo "#define RASQAL_DECIMAL_GMP 1" >>confdefs.h break fi ;; none) need_mpfr=0 need_gmp=0 $as_echo "#define RASQAL_DECIMAL_NONE 1" >>confdefs.h break ;; *) as_fn_error $? "No such decimal library $decimal_name" "$LINENO" 5 ;; esac done { $as_echo "$as_me:${as_lineno-$LINENO}: checking decimal libraries available" >&5 $as_echo_n "checking decimal libraries available... " >&6; } decimal_libraries_available= if test $have_mpfr = 1; then decimal_libraries_available="$decimal_libraries_available mpfr" fi if test $have_gmp = 1; then decimal_libraries_available="$decimal_libraries_available gmp" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $decimal_libraries_available" >&5 $as_echo "$decimal_libraries_available" >&6; } need_libm=0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking decimal library to use" >&5 $as_echo_n "checking decimal library to use... " >&6; } decimal_library= if test $need_mpfr = 1; then decimal_library="mpfr $MPFR_VERSION" elif test $need_gmp = 1; then decimal_library="gmp $GMP_VERSION" else decimal_library=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $decimal_library" >&5 $as_echo "$decimal_library" >&6; } random_approaches="mtwist" if test "$have_gmp_random" = yes; then random_approaches="$random_approaches gmp" fi random_approaches="$random_approaches random_r rand_r random rand" # Check whether --with-random-approach was given. if test "${with_random_approach+set}" = set; then : withval=$with_random_approach; random_with="$withval" else random_with="" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking random approach" >&5 $as_echo_n "checking random approach... " >&6; } random_approach=none need_mtwist=no for random_algo in $random_with $random_approaches; do case $random_algo in mtwist) random_approach="Internal Mersenne Twister" need_mtwist=yes $as_echo "#define RANDOM_ALGO_MTWIST 1" >>confdefs.h break ;; gmp) if test "$have_gmp_random" = yes; then random_approach="GMP gmp_randseed_ui and mpz_urandomm()" $as_echo "#define RANDOM_ALGO_GMP_RAND 1" >>confdefs.h break fi ;; random_r) if test "$ac_cv_func_initstate_r" = "yes" -a "$ac_cv_func_random_r" = "yes"; then random_approach="glibc initstate_r() and random_r()" $as_echo "#define RANDOM_ALGO_RANDOM_R 1" >>confdefs.h break fi ;; rand_r) if test "$ac_cv_func_rand_r" = "yes"; then random_approach="POSIX rand_r()" $as_echo "#define RANDOM_ALGO_RAND_R 1" >>confdefs.h break fi ;; random) if test "$ac_cv_func_initstate" = "yes" -a "$ac_cv_func_random" = "yes"; then random_approach="BSD initstate() and random()" $as_echo "#define RANDOM_ALGO_RANDOM 1" >>confdefs.h break fi ;; rand) if test "$ac_cv_func_srand" = "yes" -a "$ac_cv_func_rand" = "yes"; then random_approach="POSIX srand() and rand()" $as_echo "#define RANDOM_ALGO_RAND 1" >>confdefs.h break fi ;; *) ;; esac done if test "$random_approach" = none; then as_fn_error $? "No random number generator approach. POSIX rand should always be available" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $random_approach" >&5 $as_echo "$random_approach" >&6; } if test $need_mtwist = yes; then RASQAL_MTWIST_TRUE= RASQAL_MTWIST_FALSE='#' else RASQAL_MTWIST_TRUE='#' RASQAL_MTWIST_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil, floor and round in default libs" >&5 $as_echo_n "checking for ceil, floor and round in default libs... " >&6; } ceil_lib=none if test "$cross_compiling" = yes; then : ceil_lib=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_MATH_H #include #endif #ifdef HAVE_STDLIB_H #include #endif int main () { extern char **environ; double t = strtod(environ[0], NULL); return (int)(ceil(t) * floor(t) * round(t)); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } ceil_lib=libc else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ceil_lib = none; then LIBS="$LIBS -lm" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil, floor and round with -lm" >&5 $as_echo_n "checking for ceil, floor and round with -lm... " >&6; } if test "$cross_compiling" = yes; then : ceil_lib=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_MATH_H #include #endif #ifdef HAVE_STDLIB_H #include #endif int main () { extern char **environ; double t = strtod(environ[0], NULL); return (int)(ceil(t) * floor(t) * round(t)); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } need_libm=1 ceil_lib=libm else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi LIBS="$oLIBS" fi if test $ceil_lib = cross; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Assuming ceil, floor and round are in default libs for cross compiling" >&5 $as_echo "$as_me: WARNING: Assuming ceil, floor and round are in default libs for cross compiling" >&2;} ceil_lib=libc elif test $ceil_lib = none; then as_fn_error $? "Could not find ceil, floor, round in default libs or with -lm" "$LINENO" 5 fi if test $need_libm = 1; then RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS -lm" fi DECIMAL_INCLUDES= DECIMAL_LIBS= if test $need_mpfr = 1; then DECIMAL_INCLUDES="$mpfr_includes" DECIMAL_LIBS="$mpfr_libs -lmpfr" fi if test $need_gmp = 1; then DECIMAL_INCLUDES="$gmp_includes" DECIMAL_LIBS="$gmp_libs -lgmp" fi RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS $DECIMAL_INCLUDES" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS $DECIMAL_LIBS" if test $need_libxml = 1; then RASQAL_INTERNAL_CPPFLAGS="$RASQAL_INTERNAL_CPPFLAGS `$XML_CONFIG --cflags`" RASQAL_EXTERNAL_LIBS="$RASQAL_EXTERNAL_LIBS `$XML_CONFIG --libs`" if test "X$PKGCONFIG_REQUIRES" != X; then PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES," fi PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES libxml-2.0 >= $LIBXML_MIN_VERSION" fi # Make final changes to cflags MEM= MEM_LIBS= CPPFLAGS="-DRASQAL_INTERNAL=1 $CPPFLAGS" debug_messages=no # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; debug_messages=$enableval fi if test "$debug_messages" = "yes"; then CPPFLAGS="-g -DRASQAL_DEBUG=1 $CPPFLAGS" fi # Check whether --with-memory-signing was given. if test "${with_memory_signing+set}" = set; then : withval=$with_memory_signing; use_memory_signing="$withval" else use_memory_signing="no" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking using memory signing" >&5 $as_echo_n "checking using memory signing... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_memory_signing" >&5 $as_echo "$use_memory_signing" >&6; }; if test $use_memory_signing = yes; then MEM=-DRASQAL_MEMORY_SIGN=1 MEM_LIBS= fi STANDARD_CFLAGS="$STANDARD_CFLAGS $CFLAGS" if test "$USE_MAINTAINER_MODE" = yes; then CPPFLAGS="-DMAINTAINER_MODE $MAINTAINER_CPPFLAGS $CPPFLAGS" fi RASQAL_LIBTOOLLIBS=librasqal.la abs_top_srcdir=`cd $srcdir; pwd` abs_top_builddir=`pwd` # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' ac_config_files="$ac_config_files Makefile data/Makefile docs/Makefile docs/version.xml scripts/Makefile libsv/Makefile libmtwist/Makefile getopt/Makefile src/Makefile src/rasqal.h src/win32_rasqal_config.h tests/Makefile tests/algebra/Makefile tests/engine/Makefile tests/laqrs/Makefile tests/laqrs/syntax/Makefile tests/sparql/Makefile tests/sparql/bugs/Makefile tests/sparql/simple/Makefile tests/sparql/part1/Makefile tests/sparql/examples/Makefile tests/sparql/syntax/Makefile tests/sparql/bound/Makefile tests/sparql/survey/Makefile tests/sparql/SyntaxFull/Makefile tests/sparql/sort/Makefile tests/sparql/ValueTesting/Makefile tests/sparql/regex/Makefile tests/sparql/Expr1/Makefile tests/sparql/Expr2/Makefile tests/sparql/ExprBuiltins/Makefile tests/sparql/ExprEquals/Makefile tests/sparql/SyntaxDev/Makefile tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile tests/sparql/update/Makefile tests/sparql/aggregate/Makefile tests/sparql/sparql11/Makefile tests/sparql/federated/Makefile tests/sparql/warnings/Makefile utils/Makefile win32/Makefile rasqal.spec rasqal.rdf rasqal.pc" ac_config_files="$ac_config_files src/rasqal-config" ac_config_files="$ac_config_files rasqal-src-config" # Extract the first word of "gtkdoc-check", so it can be a program name with args. set dummy gtkdoc-check; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GTKDOC_CHECK+:} false; then : $as_echo_n "(cached) " >&6 else case $GTKDOC_CHECK in [\\/]* | ?:[\\/]*) ac_cv_path_GTKDOC_CHECK="$GTKDOC_CHECK" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTKDOC_CHECK="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GTKDOC_CHECK=$ac_cv_path_GTKDOC_CHECK if test -n "$GTKDOC_CHECK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_CHECK" >&5 $as_echo "$GTKDOC_CHECK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi for ac_prog in gtkdoc-rebase do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GTKDOC_REBASE+:} false; then : $as_echo_n "(cached) " >&6 else case $GTKDOC_REBASE in [\\/]* | ?:[\\/]*) ac_cv_path_GTKDOC_REBASE="$GTKDOC_REBASE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTKDOC_REBASE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GTKDOC_REBASE=$ac_cv_path_GTKDOC_REBASE if test -n "$GTKDOC_REBASE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_REBASE" >&5 $as_echo "$GTKDOC_REBASE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$GTKDOC_REBASE" && break done test -n "$GTKDOC_REBASE" || GTKDOC_REBASE="true" # Extract the first word of "gtkdoc-mkpdf", so it can be a program name with args. set dummy gtkdoc-mkpdf; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GTKDOC_MKPDF+:} false; then : $as_echo_n "(cached) " >&6 else case $GTKDOC_MKPDF in [\\/]* | ?:[\\/]*) ac_cv_path_GTKDOC_MKPDF="$GTKDOC_MKPDF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTKDOC_MKPDF="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GTKDOC_MKPDF=$ac_cv_path_GTKDOC_MKPDF if test -n "$GTKDOC_MKPDF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_MKPDF" >&5 $as_echo "$GTKDOC_MKPDF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check whether --with-html-dir was given. if test "${with_html_dir+set}" = set; then : withval=$with_html_dir; else with_html_dir='${datadir}/gtk-doc/html' fi HTML_DIR="$with_html_dir" # Check whether --enable-gtk-doc was given. if test "${enable_gtk_doc+set}" = set; then : enableval=$enable_gtk_doc; else enable_gtk_doc=no fi if test x$enable_gtk_doc = xyes; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-doc >= 1.3\""; } >&5 ($PKG_CONFIG --exists --print-errors "gtk-doc >= 1.3") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : else as_fn_error $? "You need to have gtk-doc >= 1.3 installed to build $PACKAGE_NAME" "$LINENO" 5 fi if test "x$PACKAGE_NAME" != "xglib"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTKDOC_DEPS" >&5 $as_echo_n "checking for GTKDOC_DEPS... " >&6; } if test -n "$GTKDOC_DEPS_CFLAGS"; then pkg_cv_GTKDOC_DEPS_CFLAGS="$GTKDOC_DEPS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTKDOC_DEPS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GTKDOC_DEPS_LIBS"; then pkg_cv_GTKDOC_DEPS_LIBS="$GTKDOC_DEPS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTKDOC_DEPS_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` else GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GTKDOC_DEPS_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0) were not met: $GTKDOC_DEPS_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GTKDOC_DEPS_CFLAGS and GTKDOC_DEPS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GTKDOC_DEPS_CFLAGS and GTKDOC_DEPS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else GTKDOC_DEPS_CFLAGS=$pkg_cv_GTKDOC_DEPS_CFLAGS GTKDOC_DEPS_LIBS=$pkg_cv_GTKDOC_DEPS_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build gtk-doc documentation" >&5 $as_echo_n "checking whether to build gtk-doc documentation... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gtk_doc" >&5 $as_echo "$enable_gtk_doc" >&6; } # Check whether --enable-gtk-doc-html was given. if test "${enable_gtk_doc_html+set}" = set; then : enableval=$enable_gtk_doc_html; else enable_gtk_doc_html=yes fi # Check whether --enable-gtk-doc-pdf was given. if test "${enable_gtk_doc_pdf+set}" = set; then : enableval=$enable_gtk_doc_pdf; else enable_gtk_doc_pdf=no fi if test -z "$GTKDOC_MKPDF"; then enable_gtk_doc_pdf=no fi if test x$enable_gtk_doc = xyes; then ENABLE_GTK_DOC_TRUE= ENABLE_GTK_DOC_FALSE='#' else ENABLE_GTK_DOC_TRUE='#' ENABLE_GTK_DOC_FALSE= fi if test x$enable_gtk_doc_html = xyes; then GTK_DOC_BUILD_HTML_TRUE= GTK_DOC_BUILD_HTML_FALSE='#' else GTK_DOC_BUILD_HTML_TRUE='#' GTK_DOC_BUILD_HTML_FALSE= fi if test x$enable_gtk_doc_pdf = xyes; then GTK_DOC_BUILD_PDF_TRUE= GTK_DOC_BUILD_PDF_FALSE='#' else GTK_DOC_BUILD_PDF_TRUE='#' GTK_DOC_BUILD_PDF_FALSE= fi if test -n "$LIBTOOL"; then GTK_DOC_USE_LIBTOOL_TRUE= GTK_DOC_USE_LIBTOOL_FALSE='#' else GTK_DOC_USE_LIBTOOL_TRUE='#' GTK_DOC_USE_LIBTOOL_FALSE= fi if test -n "$GTKDOC_REBASE"; then GTK_DOC_USE_REBASE_TRUE= GTK_DOC_USE_REBASE_FALSE='#' else GTK_DOC_USE_REBASE_TRUE='#' GTK_DOC_USE_REBASE_FALSE= fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${STRCASECMP_TRUE}" && test -z "${STRCASECMP_FALSE}"; then as_fn_error $? "conditional \"STRCASECMP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GETOPT_TRUE}" && test -z "${GETOPT_FALSE}"; then as_fn_error $? "conditional \"GETOPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TIMEGM_TRUE}" && test -z "${TIMEGM_FALSE}"; then as_fn_error $? "conditional \"TIMEGM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GETTIMEOFDAY_TRUE}" && test -z "${GETTIMEOFDAY_FALSE}"; then as_fn_error $? "conditional \"GETTIMEOFDAY\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${RASQAL_SORT_TRUE}" && test -z "${RASQAL_SORT_FALSE}"; then as_fn_error $? "conditional \"RASQAL_SORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${RASQAL_DIGEST_INTERNAL_TRUE}" && test -z "${RASQAL_DIGEST_INTERNAL_FALSE}"; then as_fn_error $? "conditional \"RASQAL_DIGEST_INTERNAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${RASQAL_QUERY_LAQRS_TRUE}" && test -z "${RASQAL_QUERY_LAQRS_FALSE}"; then as_fn_error $? "conditional \"RASQAL_QUERY_LAQRS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${RASQAL_QUERY_SPARQL_TRUE}" && test -z "${RASQAL_QUERY_SPARQL_FALSE}"; then as_fn_error $? "conditional \"RASQAL_QUERY_SPARQL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${RASQAL_MTWIST_TRUE}" && test -z "${RASQAL_MTWIST_FALSE}"; then as_fn_error $? "conditional \"RASQAL_MTWIST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then as_fn_error $? "conditional \"ENABLE_GTK_DOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GTK_DOC_BUILD_HTML_TRUE}" && test -z "${GTK_DOC_BUILD_HTML_FALSE}"; then as_fn_error $? "conditional \"GTK_DOC_BUILD_HTML\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GTK_DOC_BUILD_PDF_TRUE}" && test -z "${GTK_DOC_BUILD_PDF_FALSE}"; then as_fn_error $? "conditional \"GTK_DOC_BUILD_PDF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GTK_DOC_USE_LIBTOOL_TRUE}" && test -z "${GTK_DOC_USE_LIBTOOL_FALSE}"; then as_fn_error $? "conditional \"GTK_DOC_USE_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GTK_DOC_USE_REBASE_TRUE}" && test -z "${GTK_DOC_USE_REBASE_FALSE}"; then as_fn_error $? "conditional \"GTK_DOC_USE_REBASE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Rasqal RDF Query Library $as_me 0.9.33, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ Rasqal RDF Query Library config.status 0.9.33 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/rasqal_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/rasqal_config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "docs/version.xml") CONFIG_FILES="$CONFIG_FILES docs/version.xml" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "libsv/Makefile") CONFIG_FILES="$CONFIG_FILES libsv/Makefile" ;; "libmtwist/Makefile") CONFIG_FILES="$CONFIG_FILES libmtwist/Makefile" ;; "getopt/Makefile") CONFIG_FILES="$CONFIG_FILES getopt/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/rasqal.h") CONFIG_FILES="$CONFIG_FILES src/rasqal.h" ;; "src/win32_rasqal_config.h") CONFIG_FILES="$CONFIG_FILES src/win32_rasqal_config.h" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/algebra/Makefile") CONFIG_FILES="$CONFIG_FILES tests/algebra/Makefile" ;; "tests/engine/Makefile") CONFIG_FILES="$CONFIG_FILES tests/engine/Makefile" ;; "tests/laqrs/Makefile") CONFIG_FILES="$CONFIG_FILES tests/laqrs/Makefile" ;; "tests/laqrs/syntax/Makefile") CONFIG_FILES="$CONFIG_FILES tests/laqrs/syntax/Makefile" ;; "tests/sparql/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/Makefile" ;; "tests/sparql/bugs/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/bugs/Makefile" ;; "tests/sparql/simple/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/simple/Makefile" ;; "tests/sparql/part1/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/part1/Makefile" ;; "tests/sparql/examples/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/examples/Makefile" ;; "tests/sparql/syntax/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/syntax/Makefile" ;; "tests/sparql/bound/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/bound/Makefile" ;; "tests/sparql/survey/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/survey/Makefile" ;; "tests/sparql/SyntaxFull/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/SyntaxFull/Makefile" ;; "tests/sparql/sort/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/sort/Makefile" ;; "tests/sparql/ValueTesting/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/ValueTesting/Makefile" ;; "tests/sparql/regex/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/regex/Makefile" ;; "tests/sparql/Expr1/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/Expr1/Makefile" ;; "tests/sparql/Expr2/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/Expr2/Makefile" ;; "tests/sparql/ExprBuiltins/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/ExprBuiltins/Makefile" ;; "tests/sparql/ExprEquals/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/ExprEquals/Makefile" ;; "tests/sparql/SyntaxDev/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/SyntaxDev/Makefile" ;; "tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/SyntaxDev/Syntax-SPARQL/Makefile" ;; "tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/SyntaxDev/Syntax-SPARQL2/Makefile" ;; "tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/SyntaxDev/Syntax-SPARQL3/Makefile" ;; "tests/sparql/update/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/update/Makefile" ;; "tests/sparql/aggregate/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/aggregate/Makefile" ;; "tests/sparql/sparql11/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/sparql11/Makefile" ;; "tests/sparql/federated/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/federated/Makefile" ;; "tests/sparql/warnings/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sparql/warnings/Makefile" ;; "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "win32/Makefile") CONFIG_FILES="$CONFIG_FILES win32/Makefile" ;; "rasqal.spec") CONFIG_FILES="$CONFIG_FILES rasqal.spec" ;; "rasqal.rdf") CONFIG_FILES="$CONFIG_FILES rasqal.rdf" ;; "rasqal.pc") CONFIG_FILES="$CONFIG_FILES rasqal.pc" ;; "src/rasqal-config") CONFIG_FILES="$CONFIG_FILES src/rasqal-config" ;; "rasqal-src-config") CONFIG_FILES="$CONFIG_FILES rasqal-src-config" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "src/rasqal-config":F) chmod +x src/rasqal-config ;; "rasqal-src-config":F) chmod +x rasqal-src-config ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Rasqal build summary: RDF query languages available : $rdf_query_languages_available RDF query languages enabled :$rdf_query_languages_enabled Raptor version : $RAPTOR_VERSION Decimal library : $decimal_library Regex library : $regex_library Message digest library : $digest_library UUID library : $uuid_library Random approach : $random_approach ceil, floor, round source : $ceil_lib " >&5 $as_echo " Rasqal build summary: RDF query languages available : $rdf_query_languages_available RDF query languages enabled :$rdf_query_languages_enabled Raptor version : $RAPTOR_VERSION Decimal library : $decimal_library Regex library : $regex_library Message digest library : $digest_library UUID library : $uuid_library Random approach : $random_approach ceil, floor, round source : $ceil_lib " >&6; } rasqal-0.9.33/mkinstalldirs0000755000175000017500000000664711230141443012626 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2006-05-11.19 # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: rasqal-0.9.33/INSTALL.html0000644000175000017500000002742012414554773012027 00000000000000 Rasqal RDF Query Library - Building and Installing from Source

Rasqal RDF Query Library - Building and Installing from Source

1. Getting the sources

There are several ways to get the sources. The most stable and tested versions are the sources shipped with each release and these are recommended as the first place to start. If you want to get a newer set, then there are nightly snapshots made of the development sources, which may not yet be committed to GIT. For the latest developent sources, anonymous GIT access is available but this may require some configuring of developer tools that are not needed for the snapshot releases.

The source bundle and package files contain all the HTML files and documentation provided on the web site.

1.1 Getting the sources from releases

This is the recommended source to build and install Rasqal. It ensures that a tested and working set of files are used.

The sources are available from http://download.librdf.org/source/.

1.2 Getting the sources from GIT

This is the recommended source for developers. It provides the latest beta or unstable code. For a stable version, use a release as described above.

  git clone git://github.com/dajobe/rasqal.git
  cd rasqal

At this stage, or after a git pull you will need to create the automake and autoconf derived files, as described below in Create the configure program by using the autogen.sh script.

Building Rasqal in this way requires some particular development tools not needed when building from snapshot releases - automake, autoconf, libtool, gtk-doc and dependencies. The autogen.sh script looks for the newest versions of the auto* tools and checks that they meet the minimum versions.

Building from development sources rather than from a release also requires some additional development tools. Presently this includes the flex scanner generator version 2.5.31 or later and the GNU Bison parser generator. The configure script checks that the minimum versions are present. There are optional dependencies that will be used if present such as MPFR or GMP for decimal arithmetic and PCRE for regex support.

2. Configuring and building

Rasqal uses the GNU automake and autoconf to handle system dependency checking. It is developed and built on x86 Linux and x86 OSX but is also tested on other systems occasionally.

Required (Rasqal will not build without these):

  • The Raptor RDF Syntax Library version 2.0.4 or later for parsing RDF, retrieving WWW content from URIs and other utility classes.

Recommended (Optional):

If some of the recommended libraries are not present some of the tests will fail and the query engine will fail to handle regex matches or decimal arithmetic accurately.

2.1. Create configure program

If there is a configure program, skip to the next section.

If there is no configure program, you should create it using the autogen.sh script, as long as you have the automake and autoconf tools. This is done by:

  ./autogen.sh

and you can also pass along arguments intended for configure (see below for what these are):

  ./autogen.sh --prefix=/usr/local/somewhere

On OSX you may have to explicitly set the LIBTOOLIZE variable for the libtoolize utility since on OSX libtoolize is a different program:

  LIBTOOLIZE=glibtoolize ./autogen.sh

autogen.sh also checks out the libmtwist GIT submodule and/or updates it with the latest sources.

Alternatively you can run them by hand (not recommended) with:

  aclocal; autoheader; automake --add-missing; autoconf

however this will not do any of the GIT submodule checkout or updates that are needed for libmtwist.

The automake and autoconf tools have many different versions and at present development is being done with automake 1.11.1 (minimum version 1.11), autoconf 2.65 (minimum version 2.62) and libtool 2.2.10 (minimum version 2.2.0). These are only needed when compiling from GIT sources. autogen.sh enforces the requirements.

Rasqal also requires flex version 2.5.31 or newer (2.5.4 will not work) and GNU Bison to build lexers and parsers. These are only required when building from GIT.

2.2 Options for configure

Rasqal's configure supports the following options:

--enable-debug

Enable debugging statements for developing the code. Should NOT be used with any regular build that is installed since it slows the code and generates lots of extra output. This is a maintainer option.

--enable-query-languages=LANGUAGES

Select the RDF query languages to build from the list:
sparql laqrs
The default when this option is omitted is to enable all query languages except the experimental one, laqrs. LANGUAGES takes a space-separated value.

--enable-release

Enable configuration for building a release by not removing -O options for compiler flags. This is a maintainer option.

--with-digest-library=NAME

Pick the message digest library approach to use from the choices of mhash (the default when available), gcrypt (when libgcrypt is available) and internal (always available, providing only MD5 and SHA1).

--with-gmp=PATH

Set the installation path for the GNU Multiple Precision Arithmetic Library (GMP) if it is not in the standard lib/include prefix.

--with-libgcrypt-config=PATH

Set the path of the libgcrypt libgcrypt-config program that provides the compiling and linking flags. Enables libgcrypt for use as a message digest. See also --with-digest-library

--with-memory-signing

Enable signing of memory allocations so that when memory is allocated with malloc() and released free(), a check is made that the memory was allocated in the same library.

--with-mpfr=PATH

Set the installation path for the GNU multiple-precision floating-point library (MPFR) if it is not in the standard lib/include prefix.

--with-random-approach=ALGO

Pick the random number generator approach to use from the choices of mtwist (the default - this is bundled with rasqal and can be used without any additional installs), gmp (when GMP is available and used for decimals), random_r (glibc initstate_r and random_r), rand_r (POSIX rand_r), random (BSD initstate and random) and rand (POSIX srand and rand).

--with-regex-library=NAME

Pick a regex library to use - either pcre (default) for the PCRE or posix a POSIX regex implementation in the C library

--with-pcre-config=NAME

Set the path to the PCRE pcre-config program

2.3 Configuring

The default configuration will install into /usr/local:

   ./configure

To install into the standard Unix / Linux (and also Cygwin) system directory, use:

   ./configure --prefix=/usr

Append to the line any additional options you need like this:

   ./configure --prefix=/usr --enable-query-languages=sparql

The configure script uses pkg-config(1) to find an installed version of Raptor . If configure reports that it cannot find Raptor, try $ pkg-config raptor2 --modversion on the command line and if there is an error or nothing is shown, then pkg-config is not properly installed and configured. Use 'man pkg-config(1)' to read how to set PKG_CONFIG_PATH which should include a directory where raptor2.pc is installed. When it is correct, the above command will return the Raptor version.

2.4 Compiling

Compile the library and the roqet utility with:

   make

Note: GNU make is probably required which may be called gmake or gnumake if your system has a different make available too.

2.5 Testing

Rasqal has a built-in test suite that can be invoked with:

  make check

which should emit lots of exciting test messages to the screen but conclude with something like:
All n tests passed
if everything works correctly. There might be some regex or decimal tests that fail if no POSIX regex library or multiple precision numeric library was available when Rasqal was compiled.

2.6 Installing

Install the library and the roqet utility into the area configure with --prefix (or /usr/local if not given) with:

   make install

Note: This may require root access if the destination area is a system directory such as /usr. In that case you may have to do sudo make install.

3. Using the library

3.1 Documentation

Rasqal includes a reference manual for the library but no tutorial at this time. This is installed into PREFIX/share/gtk-doc/html/rasqal and is also available from the Rasqal web site.

3.2 Examples

At present, to get a good idea of how to use Rasqal in a program, check out the source for roqet in src/roqet.c which uses the library extensively with the recommended APIs.

3.3 roqet utility

Rasqal provides an RDF query utility program called roqet which can do a variety of query operations on local and remote data, local and remote queries and running queries on SPARQL protocol services.

See the roqet manual page for full details using 'man roqet' or read the HTML version in docs/roqet.html or on the Rasqal website.


Copyright (C) 2003-2014 Dave Beckett
Copyright (C) 2003-2005 University of Bristol

rasqal-0.9.33/data/0000755000175000017500000000000012443715253011011 500000000000000rasqal-0.9.33/data/Makefile.am0000644000175000017500000000014611256510332012756 00000000000000EXTRA_DIST=dc.rdf \ animals.nt letters.nt one.nt \ graph-a.ttl graph-b.ttl graph-c.ttl \ triples.ttl rasqal-0.9.33/data/Makefile.in0000644000175000017500000002773712434455632013020 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ subdir = data DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ EXTRA_DIST = dc.rdf \ animals.nt letters.nt one.nt \ graph-a.ttl graph-b.ttl graph-c.ttl \ triples.ttl all: all-am .SUFFIXES: $(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 data/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu data/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(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: 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 Makefile distclean-am: clean-am distclean-generic 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: rasqal-0.9.33/data/letters.nt0000644000175000017500000000257410663751704012771 00000000000000 "j" . "c" . "t" . "h" . "z" . "g" . "u" . "x" . "w" . "p" . "n" . "e" . "f" . "b" . "i" . "o" . "q" . "a" . "d" . "m" . "r" . "v" . "y" . "k" . "l" . "s" . rasqal-0.9.33/data/triples.ttl0000644000175000017500000000120711256510332013130 00000000000000# DAWG test data basic/data-2.ttl with collections flattened to # triples and more readable named bnodes # @prefix : . @prefix rdf: . # :x :list0 () . :x :list0 rdf:nil . # :x :list1 (1) . :x :list1 _:a1 . _:a1 rdf:first 1 . _:a1 rdf:rest rdf:nil . # :x :list2 (11 22) . :x :list2 _:b1 . _:b1 rdf:first 11 . _:b1 rdf:rest _:b2 . _:b2 rdf:first 22 . _:b2 rdf:rest rdf:nil . # :x :list3 (111 222 333) . :x :list3 _:c1 . _:c1 rdf:first 111 . _:c1 rdf:rest _:c2 . _:c2 rdf:first 222 . _:c2 rdf:rest _:c3 . _:c3 rdf:first 333 . _:c3 rdf:rest rdf:nil . rasqal-0.9.33/data/dc.rdf0000644000175000017500000000050310362621550012004 00000000000000 Dave Beckett rasqal-0.9.33/data/graph-b.ttl0000644000175000017500000000012310506410107012756 00000000000000@prefix : . :w :a "apple" . :x :b "orange" . :y :c "grape" . rasqal-0.9.33/data/one.nt0000644000175000017500000000010711074477000012045 00000000000000 "object" . rasqal-0.9.33/data/animals.nt0000644000175000017500000000343210477165442012726 00000000000000 "jackal" . "cow" . "tiger" . "horse" . "zebra" . "goat" . "uakari" . "xantus" . "whale" . "penguin" . "newt" . "elephant" . "fox" . "badger" . "iguana" . "owl" . "quail" . "aardvark" . "dog" . "mouse" . "rat" . "vole" . "yak" . "koala" . "lemur" . "snake" . rasqal-0.9.33/data/graph-c.ttl0000644000175000017500000000011710507126044012767 00000000000000@prefix : . :d :a "red" . :e :b "green" . :f :c "blue" . rasqal-0.9.33/data/graph-a.ttl0000644000175000017500000000012310506410130012751 00000000000000@prefix : . :x :b "mercury" . :y :a "venus" . :z :c "mars" . rasqal-0.9.33/utils/0000755000175000017500000000000012443715251011236 500000000000000rasqal-0.9.33/utils/Makefile.am0000644000175000017500000001022412421006603013177 00000000000000# -*- Mode: Makefile -*- # # Makefile.am - automake file for Rasqal utilities # # Copyright (C) 2005-2011, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # bin_PROGRAMS = roqet noinst_PROGRAMS = check-query to-ntriples EXTRA_PROGRAMS = srxread srxwrite testrunner CLEANFILES = $(EXTRA_PROGRAMS) *.plist man_MANS = roqet.1 AM_CPPFLAGS= @RASQAL_INTERNAL_CPPFLAGS@ -I$(top_srcdir)/src AM_CFLAGS = $(MEM) STANDARD_CFLAGS= @STANDARD_CFLAGS@ $(MEM) LIBS= @RASQAL_INTERNAL_LIBS@ $(MEM_LIBS) ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = librasqalcmdline.la librasqalcmdline_la_SOURCES = \ read_files.c \ results.c \ rasqalcmdline.h roqet_SOURCES = roqet.c roqet_CPPFLAGS = $(AM_CPPFLAGS) roqet_LDADD = $(top_builddir)/src/librasqal.la librasqalcmdline.la roqet_DEPENDENCIES = $(top_builddir)/src/librasqal.la librasqalcmdline.la roqet_LDFLAGS = @RAPTOR2_LIBS@ if GETOPT roqet_CPPFLAGS += -I$(top_srcdir)/getopt roqet_LDADD += $(top_builddir)/getopt/libgetopt.la roqet_DEPENDENCIES += $(top_builddir)/libgetopt/libgetopt.la endif check_query_SOURCES = check_query.c check_query_CPPFLAGS = $(AM_CPPFLAGS) check_query_LDADD = $(top_builddir)/src/librasqal.la librasqalcmdline.la check_query_DEPENDENCIES = $(top_builddir)/src/librasqal.la librasqalcmdline.la check_query_LDFLAGS = @RAPTOR2_LIBS@ if GETOPT check_query_CPPFLAGS += -I$(top_srcdir)/getopt check_query_LDADD += $(top_builddir)/getopt/libgetopt.la check_query_DEPENDENCIES += $(top_builddir)/libgetopt/libgetopt.la endif testrunner_SOURCES = testrunner.c manifest.c manifest.h testrunner_CPPFLAGS = $(AM_CPPFLAGS) testrunner_LDADD = $(top_builddir)/src/librasqal.la librasqalcmdline.la testrunner_DEPENDENCIES = $(top_builddir)/src/librasqal.la librasqalcmdline.la testrunner_LDFLAGS = @RAPTOR2_LIBS@ if GETOPT testrunner_CPPFLAGS += -I$(top_srcdir)/getopt testrunner_LDADD += $(top_builddir)/getopt/libgetopt.la testrunner_DEPENDENCIES += $(top_builddir)/libgetopt/libgetopt.la endif to_ntriples_SOURCES = to-ntriples.c to_ntriples_CPPFLAGS = $(AM_CPPFLAGS) to_ntriples_LDFLAGS = @RAPTOR2_LIBS@ srxread_SOURCES = srxread.c srxread_LDADD = $(top_builddir)/src/librasqal.la srxread_DEPENDENCIES = $(top_builddir)/src/librasqal.la srxread_LDFLAGS = @RAPTOR2_LIBS@ srxwrite_SOURCES = srxwrite.c srxwrite_LDADD = $(top_builddir)/src/librasqal.la srxwrite_DEPENDENCIES = $(top_builddir)/src/librasqal.la srxwrite_LDFLAGS = @RAPTOR2_LIBS@ EXTRA_DIST= \ $(man_MANS) \ roqet.html if MAINTAINER_MODE roqet.html: $(srcdir)/roqet.1 $(srcdir)/../scripts/fix-groff-xhtml.pl -groff -man -Thtml -P-l $< | tidy -asxml -wrap 1000 2>/dev/null | $(PERL) $(srcdir)/../scripts/fix-groff-xhtml.pl $@ endif $(top_builddir)/src/librasqal.la: cd $(top_builddir)/src && $(MAKE) librasqal.la $(top_builddir)/libgetopt/libgetopt.la: cd $(top_builddir)/libgetopt && $(MAKE) libgetopt.la examples: srxread$(EXTEXE) srxwrite$(EXTEXE) if MAINTAINER_MODE # Run Clang static analyzer over sources. analyze: $(SOURCES) @list='$(SOURCES)'; \ result=0; \ for file in $$list; do \ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ $(RECHO) "Analyzing $$file"; \ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ status=$$?; \ if test $$status != 0; then \ result=1; \ fi; \ fi; \ done; \ set -e; exit $$result endif all-programs: $(PROGRAMS) $(EXTRA_PROGRAMS) rasqal-0.9.33/utils/to-ntriples.c0000644000175000017500000001046212441120534013575 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * to-ntriples.c - Test support: parse RDF into N-Triples using raptor * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * 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. * * USAGE: * to_ntriples RDF-FILE [BASE-URI] * * To parse an RDF syntax in RDF-FILE using the 'guess' parser, * emitting the result as N-Triples with optional BASE-URI. * * NOTE: This is not a supported utility. It is only used for testing * invoked by 'improve' and 'check-sparql' and may be replaced. * */ #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include int main(int argc, char *argv[]); static const char *program = "to-ntriples"; static raptor_serializer* rdf_serializer; static int error_count = 0; static int warning_count = 0; static void to_ntriples_write_triple(void* user_data, raptor_statement* triple) { raptor_serializer_serialize_statement(rdf_serializer, triple); } static void to_ntriples_log_handler(void *data, raptor_log_message *message) { raptor_parser *parser = (raptor_parser*)data; switch(message->level) { case RAPTOR_LOG_LEVEL_FATAL: case RAPTOR_LOG_LEVEL_ERROR: fprintf(stderr, "%s: Error - ", program); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); raptor_parser_parse_abort(parser); error_count++; break; case RAPTOR_LOG_LEVEL_WARN: fprintf(stderr, "%s: Warning - ", program); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); warning_count++; break; case RAPTOR_LOG_LEVEL_NONE: case RAPTOR_LOG_LEVEL_TRACE: case RAPTOR_LOG_LEVEL_DEBUG: case RAPTOR_LOG_LEVEL_INFO: fprintf(stderr, "%s: Unexpected %s message - ", program, raptor_log_level_get_label(message->level)); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); break; } } int main(int argc, char *argv[]) { raptor_world *world = NULL; raptor_parser* rdf_parser = NULL; unsigned char *uri_string; raptor_uri *uri; raptor_uri *base_uri; int rc = 0; int free_uri_string = 0; rdf_serializer = NULL; if(argc < 2 || argc > 3) { fprintf(stderr, "USAGE: %s RDF-FILE [BASE-URI]\n", program); rc = 1; goto tidy; } world = raptor_new_world(); uri_string = (unsigned char*)argv[1]; if(!access((const char*)uri_string, R_OK)) { uri_string = raptor_uri_filename_to_uri_string((char*)uri_string); uri = raptor_new_uri(world, uri_string); free_uri_string = 1; } else { uri = raptor_new_uri(world, (const unsigned char*)uri_string); } if(argc == 3) { char* base_uri_string = argv[2]; base_uri = raptor_new_uri(world, (unsigned char*)(base_uri_string)); } else { base_uri = raptor_uri_copy(uri); } rdf_parser = raptor_new_parser(world, "guess"); raptor_world_set_log_handler(world, rdf_parser, to_ntriples_log_handler); raptor_parser_set_statement_handler(rdf_parser, NULL, to_ntriples_write_triple); rdf_serializer = raptor_new_serializer(world, "ntriples"); 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); if(free_uri_string) raptor_free_memory(uri_string); raptor_free_world(world); tidy: if(warning_count) rc = 2; else if(error_count) rc = 1; return rc; } rasqal-0.9.33/utils/Makefile.in0000644000175000017500000012241412434455633013234 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 Rasqal utilities # # Copyright (C) 2005-2011, David Beckett http://www.dajobe.org/ # Copyright (C) 2005-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. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ bin_PROGRAMS = roqet$(EXEEXT) noinst_PROGRAMS = check-query$(EXEEXT) to-ntriples$(EXEEXT) EXTRA_PROGRAMS = srxread$(EXEEXT) srxwrite$(EXEEXT) \ testrunner$(EXEEXT) @GETOPT_TRUE@am__append_1 = -I$(top_srcdir)/getopt @GETOPT_TRUE@am__append_2 = $(top_builddir)/getopt/libgetopt.la @GETOPT_TRUE@am__append_3 = $(top_builddir)/libgetopt/libgetopt.la @GETOPT_TRUE@am__append_4 = -I$(top_srcdir)/getopt @GETOPT_TRUE@am__append_5 = $(top_builddir)/getopt/libgetopt.la @GETOPT_TRUE@am__append_6 = $(top_builddir)/libgetopt/libgetopt.la @GETOPT_TRUE@am__append_7 = -I$(top_srcdir)/getopt @GETOPT_TRUE@am__append_8 = $(top_builddir)/getopt/libgetopt.la @GETOPT_TRUE@am__append_9 = $(top_builddir)/libgetopt/libgetopt.la subdir = utils DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librasqalcmdline_la_LIBADD = am_librasqalcmdline_la_OBJECTS = read_files.lo results.lo librasqalcmdline_la_OBJECTS = $(am_librasqalcmdline_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_check_query_OBJECTS = check_query-check_query.$(OBJEXT) check_query_OBJECTS = $(am_check_query_OBJECTS) check_query_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(check_query_LDFLAGS) $(LDFLAGS) -o $@ am_roqet_OBJECTS = roqet-roqet.$(OBJEXT) roqet_OBJECTS = $(am_roqet_OBJECTS) roqet_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(roqet_LDFLAGS) $(LDFLAGS) -o $@ am_srxread_OBJECTS = srxread.$(OBJEXT) srxread_OBJECTS = $(am_srxread_OBJECTS) srxread_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(srxread_LDFLAGS) $(LDFLAGS) -o $@ am_srxwrite_OBJECTS = srxwrite.$(OBJEXT) srxwrite_OBJECTS = $(am_srxwrite_OBJECTS) srxwrite_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(srxwrite_LDFLAGS) $(LDFLAGS) -o $@ am_testrunner_OBJECTS = testrunner-testrunner.$(OBJEXT) \ testrunner-manifest.$(OBJEXT) testrunner_OBJECTS = $(am_testrunner_OBJECTS) testrunner_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(testrunner_LDFLAGS) $(LDFLAGS) -o $@ am_to_ntriples_OBJECTS = to_ntriples-to-ntriples.$(OBJEXT) to_ntriples_OBJECTS = $(am_to_ntriples_OBJECTS) to_ntriples_LDADD = $(LDADD) to_ntriples_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(to_ntriples_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(librasqalcmdline_la_SOURCES) $(check_query_SOURCES) \ $(roqet_SOURCES) $(srxread_SOURCES) $(srxwrite_SOURCES) \ $(testrunner_SOURCES) $(to_ntriples_SOURCES) DIST_SOURCES = $(librasqalcmdline_la_SOURCES) $(check_query_SOURCES) \ $(roqet_SOURCES) $(srxread_SOURCES) $(srxwrite_SOURCES) \ $(testrunner_SOURCES) $(to_ntriples_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) ETAGS = etags CTAGS = ctags 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @RASQAL_INTERNAL_LIBS@ $(MEM_LIBS) LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ $(MEM) STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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) *.plist man_MANS = roqet.1 AM_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ -I$(top_srcdir)/src AM_CFLAGS = $(MEM) ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = librasqalcmdline.la librasqalcmdline_la_SOURCES = \ read_files.c \ results.c \ rasqalcmdline.h roqet_SOURCES = roqet.c roqet_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_1) roqet_LDADD = $(top_builddir)/src/librasqal.la librasqalcmdline.la \ $(am__append_2) roqet_DEPENDENCIES = $(top_builddir)/src/librasqal.la \ librasqalcmdline.la $(am__append_3) roqet_LDFLAGS = @RAPTOR2_LIBS@ check_query_SOURCES = check_query.c check_query_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_4) check_query_LDADD = $(top_builddir)/src/librasqal.la \ librasqalcmdline.la $(am__append_5) check_query_DEPENDENCIES = $(top_builddir)/src/librasqal.la \ librasqalcmdline.la $(am__append_6) check_query_LDFLAGS = @RAPTOR2_LIBS@ testrunner_SOURCES = testrunner.c manifest.c manifest.h testrunner_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_7) testrunner_LDADD = $(top_builddir)/src/librasqal.la \ librasqalcmdline.la $(am__append_8) testrunner_DEPENDENCIES = $(top_builddir)/src/librasqal.la \ librasqalcmdline.la $(am__append_9) testrunner_LDFLAGS = @RAPTOR2_LIBS@ to_ntriples_SOURCES = to-ntriples.c to_ntriples_CPPFLAGS = $(AM_CPPFLAGS) to_ntriples_LDFLAGS = @RAPTOR2_LIBS@ srxread_SOURCES = srxread.c srxread_LDADD = $(top_builddir)/src/librasqal.la srxread_DEPENDENCIES = $(top_builddir)/src/librasqal.la srxread_LDFLAGS = @RAPTOR2_LIBS@ srxwrite_SOURCES = srxwrite.c srxwrite_LDADD = $(top_builddir)/src/librasqal.la srxwrite_DEPENDENCIES = $(top_builddir)/src/librasqal.la srxwrite_LDFLAGS = @RAPTOR2_LIBS@ EXTRA_DIST = \ $(man_MANS) \ roqet.html 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 utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu utils/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done librasqalcmdline.la: $(librasqalcmdline_la_OBJECTS) $(librasqalcmdline_la_DEPENDENCIES) $(EXTRA_librasqalcmdline_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(librasqalcmdline_la_OBJECTS) $(librasqalcmdline_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list installcheck-binPROGRAMS: $(bin_PROGRAMS) bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ esac; \ f=`echo "$$p" | \ sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ for opt in --help --version; do \ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ 2>c$${pid}_.err &2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list check-query$(EXEEXT): $(check_query_OBJECTS) $(check_query_DEPENDENCIES) $(EXTRA_check_query_DEPENDENCIES) @rm -f check-query$(EXEEXT) $(AM_V_CCLD)$(check_query_LINK) $(check_query_OBJECTS) $(check_query_LDADD) $(LIBS) roqet$(EXEEXT): $(roqet_OBJECTS) $(roqet_DEPENDENCIES) $(EXTRA_roqet_DEPENDENCIES) @rm -f roqet$(EXEEXT) $(AM_V_CCLD)$(roqet_LINK) $(roqet_OBJECTS) $(roqet_LDADD) $(LIBS) srxread$(EXEEXT): $(srxread_OBJECTS) $(srxread_DEPENDENCIES) $(EXTRA_srxread_DEPENDENCIES) @rm -f srxread$(EXEEXT) $(AM_V_CCLD)$(srxread_LINK) $(srxread_OBJECTS) $(srxread_LDADD) $(LIBS) srxwrite$(EXEEXT): $(srxwrite_OBJECTS) $(srxwrite_DEPENDENCIES) $(EXTRA_srxwrite_DEPENDENCIES) @rm -f srxwrite$(EXEEXT) $(AM_V_CCLD)$(srxwrite_LINK) $(srxwrite_OBJECTS) $(srxwrite_LDADD) $(LIBS) testrunner$(EXEEXT): $(testrunner_OBJECTS) $(testrunner_DEPENDENCIES) $(EXTRA_testrunner_DEPENDENCIES) @rm -f testrunner$(EXEEXT) $(AM_V_CCLD)$(testrunner_LINK) $(testrunner_OBJECTS) $(testrunner_LDADD) $(LIBS) to-ntriples$(EXEEXT): $(to_ntriples_OBJECTS) $(to_ntriples_DEPENDENCIES) $(EXTRA_to_ntriples_DEPENDENCIES) @rm -f to-ntriples$(EXEEXT) $(AM_V_CCLD)$(to_ntriples_LINK) $(to_ntriples_OBJECTS) $(to_ntriples_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_query-check_query.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_files.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/results.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/roqet-roqet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srxread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srxwrite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrunner-manifest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrunner-testrunner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/to_ntriples-to-ntriples.Po@am__quote@ .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 $< .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 `$(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 $@ $< check_query-check_query.o: check_query.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_query_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT check_query-check_query.o -MD -MP -MF $(DEPDIR)/check_query-check_query.Tpo -c -o check_query-check_query.o `test -f 'check_query.c' || echo '$(srcdir)/'`check_query.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_query-check_query.Tpo $(DEPDIR)/check_query-check_query.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='check_query.c' object='check_query-check_query.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) $(check_query_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o check_query-check_query.o `test -f 'check_query.c' || echo '$(srcdir)/'`check_query.c check_query-check_query.obj: check_query.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_query_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT check_query-check_query.obj -MD -MP -MF $(DEPDIR)/check_query-check_query.Tpo -c -o check_query-check_query.obj `if test -f 'check_query.c'; then $(CYGPATH_W) 'check_query.c'; else $(CYGPATH_W) '$(srcdir)/check_query.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_query-check_query.Tpo $(DEPDIR)/check_query-check_query.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='check_query.c' object='check_query-check_query.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) $(check_query_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o check_query-check_query.obj `if test -f 'check_query.c'; then $(CYGPATH_W) 'check_query.c'; else $(CYGPATH_W) '$(srcdir)/check_query.c'; fi` roqet-roqet.o: roqet.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(roqet_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT roqet-roqet.o -MD -MP -MF $(DEPDIR)/roqet-roqet.Tpo -c -o roqet-roqet.o `test -f 'roqet.c' || echo '$(srcdir)/'`roqet.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/roqet-roqet.Tpo $(DEPDIR)/roqet-roqet.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='roqet.c' object='roqet-roqet.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) $(roqet_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o roqet-roqet.o `test -f 'roqet.c' || echo '$(srcdir)/'`roqet.c roqet-roqet.obj: roqet.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(roqet_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT roqet-roqet.obj -MD -MP -MF $(DEPDIR)/roqet-roqet.Tpo -c -o roqet-roqet.obj `if test -f 'roqet.c'; then $(CYGPATH_W) 'roqet.c'; else $(CYGPATH_W) '$(srcdir)/roqet.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/roqet-roqet.Tpo $(DEPDIR)/roqet-roqet.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='roqet.c' object='roqet-roqet.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) $(roqet_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o roqet-roqet.obj `if test -f 'roqet.c'; then $(CYGPATH_W) 'roqet.c'; else $(CYGPATH_W) '$(srcdir)/roqet.c'; fi` testrunner-testrunner.o: testrunner.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testrunner-testrunner.o -MD -MP -MF $(DEPDIR)/testrunner-testrunner.Tpo -c -o testrunner-testrunner.o `test -f 'testrunner.c' || echo '$(srcdir)/'`testrunner.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testrunner-testrunner.Tpo $(DEPDIR)/testrunner-testrunner.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testrunner.c' object='testrunner-testrunner.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) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testrunner-testrunner.o `test -f 'testrunner.c' || echo '$(srcdir)/'`testrunner.c testrunner-testrunner.obj: testrunner.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testrunner-testrunner.obj -MD -MP -MF $(DEPDIR)/testrunner-testrunner.Tpo -c -o testrunner-testrunner.obj `if test -f 'testrunner.c'; then $(CYGPATH_W) 'testrunner.c'; else $(CYGPATH_W) '$(srcdir)/testrunner.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testrunner-testrunner.Tpo $(DEPDIR)/testrunner-testrunner.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testrunner.c' object='testrunner-testrunner.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) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testrunner-testrunner.obj `if test -f 'testrunner.c'; then $(CYGPATH_W) 'testrunner.c'; else $(CYGPATH_W) '$(srcdir)/testrunner.c'; fi` testrunner-manifest.o: manifest.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testrunner-manifest.o -MD -MP -MF $(DEPDIR)/testrunner-manifest.Tpo -c -o testrunner-manifest.o `test -f 'manifest.c' || echo '$(srcdir)/'`manifest.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testrunner-manifest.Tpo $(DEPDIR)/testrunner-manifest.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='manifest.c' object='testrunner-manifest.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) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testrunner-manifest.o `test -f 'manifest.c' || echo '$(srcdir)/'`manifest.c testrunner-manifest.obj: manifest.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testrunner-manifest.obj -MD -MP -MF $(DEPDIR)/testrunner-manifest.Tpo -c -o testrunner-manifest.obj `if test -f 'manifest.c'; then $(CYGPATH_W) 'manifest.c'; else $(CYGPATH_W) '$(srcdir)/manifest.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testrunner-manifest.Tpo $(DEPDIR)/testrunner-manifest.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='manifest.c' object='testrunner-manifest.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) $(testrunner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testrunner-manifest.obj `if test -f 'manifest.c'; then $(CYGPATH_W) 'manifest.c'; else $(CYGPATH_W) '$(srcdir)/manifest.c'; fi` to_ntriples-to-ntriples.o: to-ntriples.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(to_ntriples_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT to_ntriples-to-ntriples.o -MD -MP -MF $(DEPDIR)/to_ntriples-to-ntriples.Tpo -c -o to_ntriples-to-ntriples.o `test -f 'to-ntriples.c' || echo '$(srcdir)/'`to-ntriples.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/to_ntriples-to-ntriples.Tpo $(DEPDIR)/to_ntriples-to-ntriples.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='to-ntriples.c' object='to_ntriples-to-ntriples.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) $(to_ntriples_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o to_ntriples-to-ntriples.o `test -f 'to-ntriples.c' || echo '$(srcdir)/'`to-ntriples.c to_ntriples-to-ntriples.obj: to-ntriples.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(to_ntriples_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT to_ntriples-to-ntriples.obj -MD -MP -MF $(DEPDIR)/to_ntriples-to-ntriples.Tpo -c -o to_ntriples-to-ntriples.obj `if test -f 'to-ntriples.c'; then $(CYGPATH_W) 'to-ntriples.c'; else $(CYGPATH_W) '$(srcdir)/to-ntriples.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/to_ntriples-to-ntriples.Tpo $(DEPDIR)/to_ntriples-to-ntriples.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='to-ntriples.c' object='to_ntriples-to-ntriples.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) $(to_ntriples_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o to_ntriples-to-ntriples.obj `if test -f 'to-ntriples.c'; then $(CYGPATH_W) 'to-ntriples.c'; else $(CYGPATH_W) '$(srcdir)/to-ntriples.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 $(LTLIBRARIES) $(PROGRAMS) $(MANS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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-binPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -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-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: installcheck-binPROGRAMS maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS 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-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installcheck-binPROGRAMS installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-man uninstall-man1 @MAINTAINER_MODE_TRUE@roqet.html: $(srcdir)/roqet.1 $(srcdir)/../scripts/fix-groff-xhtml.pl @MAINTAINER_MODE_TRUE@ -groff -man -Thtml -P-l $< | tidy -asxml -wrap 1000 2>/dev/null | $(PERL) $(srcdir)/../scripts/fix-groff-xhtml.pl $@ $(top_builddir)/src/librasqal.la: cd $(top_builddir)/src && $(MAKE) librasqal.la $(top_builddir)/libgetopt/libgetopt.la: cd $(top_builddir)/libgetopt && $(MAKE) libgetopt.la examples: srxread$(EXTEXE) srxwrite$(EXTEXE) # Run Clang static analyzer over sources. @MAINTAINER_MODE_TRUE@analyze: $(SOURCES) @MAINTAINER_MODE_TRUE@ @list='$(SOURCES)'; \ @MAINTAINER_MODE_TRUE@ result=0; \ @MAINTAINER_MODE_TRUE@ for file in $$list; do \ @MAINTAINER_MODE_TRUE@ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ @MAINTAINER_MODE_TRUE@ $(RECHO) "Analyzing $$file"; \ @MAINTAINER_MODE_TRUE@ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ @MAINTAINER_MODE_TRUE@ status=$$?; \ @MAINTAINER_MODE_TRUE@ if test $$status != 0; then \ @MAINTAINER_MODE_TRUE@ result=1; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ done; \ @MAINTAINER_MODE_TRUE@ set -e; exit $$result all-programs: $(PROGRAMS) $(EXTRA_PROGRAMS) # 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: rasqal-0.9.33/utils/manifest.h0000644000175000017500000001211312356406761013141 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * manifest.h - Rasqal RDF Query library test runner header * f * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * 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. * */ #ifndef MANIFEST_H #define MANIFEST_H #ifdef __cplusplus extern "C" { #endif typedef enum { STATE_PASS, STATE_FAIL, STATE_XFAIL, STATE_UXPASS, STATE_SKIP, STATE_LAST = STATE_SKIP } manifest_test_state; typedef enum { /* these are alternatives */ FLAG_IS_QUERY = 1, /* SPARQL query; lang="sparql10" or "sparql11" */ FLAG_IS_UPDATE = 2, /* SPARQL update; lang="sparql-update" */ FLAG_IS_PROTOCOL = 4, /* SPARQL protocol */ FLAG_IS_SYNTAX = 8, /* syntax test: implies no execution */ /* these are extras */ FLAG_LANG_SPARQL_11 = 16, /* "sparql11" else "sparql10" */ FLAG_MUST_FAIL = 32, /* must FAIL otherwise must PASS */ FLAG_HAS_ENTAILMENT_REGIME = 64, FLAG_RESULT_CARDINALITY_LAX = 128, /* else strict (exact match) */ FLAG_TEST_APPROVED = 256, /* else unapproved */ FLAG_TEST_WITHDRAWN = 512, /* else live */ FLAG_ENTAILMENT = 1024, /* else does not require entailment */ } manifest_test_type_bitflags; typedef struct { rasqal_world* world; raptor_world* raptor_world_ptr; /* Namespace URIs */ raptor_uri* rdfs_namespace_uri; raptor_uri* mf_namespace_uri; raptor_uri* t_namespace_uri; raptor_uri* qt_namespace_uri; raptor_uri* dawgt_namespace_uri; raptor_uri* sd_namespace_uri; /* URIs */ raptor_uri* mf_Manifest_uri; raptor_uri* mf_entries_uri; raptor_uri* mf_name_uri; raptor_uri* mf_action_uri; raptor_uri* mf_result_uri; raptor_uri* mf_resultCardinality_uri; raptor_uri* rdf_type_uri; raptor_uri* rdf_first_uri; raptor_uri* rdf_rest_uri; raptor_uri* rdf_nil_uri; raptor_uri* rdfs_comment_uri; raptor_uri* t_path_uri; raptor_uri* qt_data_uri; raptor_uri* qt_graphData_uri; raptor_uri* qt_query_uri; raptor_uri* dawgt_approval_uri; raptor_uri* sd_entailmentRegime_uri; /* Literals */ rasqal_literal* mf_Manifest_literal; rasqal_literal* mf_entries_literal; rasqal_literal* mf_name_literal; rasqal_literal* mf_action_literal; rasqal_literal* mf_result_literal; rasqal_literal* mf_resultCardinality_literal; rasqal_literal* rdf_type_literal; rasqal_literal* rdf_first_literal; rasqal_literal* rdf_rest_literal; rasqal_literal* rdfs_comment_literal; rasqal_literal* t_path_literal; rasqal_literal* qt_data_literal; rasqal_literal* qt_graphData_literal; rasqal_literal* qt_query_literal; rasqal_literal* dawgt_approval_literal; rasqal_literal* sd_entailmentRegime_literal; } manifest_world; typedef struct { manifest_test_state state; char* details; char* log; /* error log */ raptor_sequence* states[STATE_LAST + 1]; } manifest_test_result; typedef struct { manifest_world* mw; int usage; char* dir; rasqal_literal* test_node; /* the test node (URI or blank node) */ char* name; /* mf:name ?value */ char* desc; /* rdfs:comment ?value */ manifest_test_state expect; /* derived from rdf:type ?value */ raptor_uri* query; /* qt:query ?uri */ raptor_sequence* data_graphs; /* sequence of data graphs. background graph qt:data ?uri and named graphs qt:dataGraph ?uri */ raptor_uri* expected_result; /* mf:result ?uri */ unsigned int flags; /* bit flags from #manifest_test_type_bitflags */ /* Test output */ manifest_test_result* result; int error_count; } manifest_test; typedef struct { manifest_world* mw; manifest_test_state state; char* name; /* short name */ char* desc; /* description from ?manifest rdfs:comment ?value */ char* dir; /* directory */ char* path; /* for envariable PATH */ raptor_sequence* tests; /* sequence of manifest_test */ char* details; /* error details */ } manifest_testsuite; /* world */ manifest_world* manifest_new_world(rasqal_world* world); void manifest_free_world(manifest_world* mw); /* test */ const char* manifest_test_get_query_language(manifest_test* t); manifest_test_result* manifest_manifests_run(manifest_world* mw, raptor_sequence* manifest_uris, raptor_uri* base_uri, const char* test_string, unsigned int indent, int dryrun, int verbose, int approved); manifest_test_result* manifest_testsuite_run_suite(manifest_testsuite* ts, unsigned int indent, int dryrun, int verbose, int approved); /* test results */ void manifest_free_test_result(manifest_test_result* result); #ifdef __cplusplus } #endif #endif rasqal-0.9.33/utils/testrunner.c0000644000175000017500000002035412434455625013545 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * manifest.c - Run tests from SPARQL query test manifests * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * 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. * * USAGE: * testrunner MANIFEST-FILE [BASE-URI] * * Run the tests in MANIFEST-FILE * * NOTE: This is not a supported utility. It is only used for testing * invoked by 'improve' and 'check-sparql' and may be replaced. * */ #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_GETOPT_H #include #endif #ifndef HAVE_GETOPT #include #endif /* Rasqal includes */ #include #include #include #include "manifest.h" #include "rasqalcmdline.h" #ifdef NEED_OPTIND_DECLARATION extern int optind; extern char *optarg; #endif int main(int argc, char *argv[]); static char *program = NULL; #ifdef HAVE_GETOPT_LONG #define HELP_TEXT(short, long, description) " -" short ", --" long " " description #define HELP_TEXT_LONG(long, description) " --" long " " description #define HELP_ARG(short, long) "--" #long #define HELP_PAD "\n " #else #define HELP_TEXT(short, long, description) " -" short " " description #define HELP_TEXT_LONG(long, description) #define HELP_ARG(short, long) "-" #short #define HELP_PAD "\n " #endif #define GETOPT_STRING "ahnqt:v" #ifdef HAVE_GETOPT_LONG static struct option long_options[] = { /* name, has_arg, flag, val */ {"approved", 0, 0, 'a'}, {"help", 0, 0, 'h'}, {"dryrun", 0, 0, 'n'}, {"quiet", 0, 0, 'q'}, {"test", 1, 0, 't'}, {"version", 0, 0, 'v'}, {NULL, 0, 0, 0} }; #endif static int error_count = 0; static int warning_count = 0; static const char *title_string = "Rasqal RDF test runner utility"; static void testrunner_log_handler(void *data, raptor_log_message *message) { /* rasqal_world *world = (rasqal_world*)data; */ switch(message->level) { case RAPTOR_LOG_LEVEL_FATAL: case RAPTOR_LOG_LEVEL_ERROR: fprintf(stderr, "%s: Error - ", program); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); error_count++; break; case RAPTOR_LOG_LEVEL_WARN: fprintf(stderr, "%s: Warning - ", program); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); warning_count++; break; case RAPTOR_LOG_LEVEL_NONE: case RAPTOR_LOG_LEVEL_TRACE: case RAPTOR_LOG_LEVEL_DEBUG: case RAPTOR_LOG_LEVEL_INFO: fprintf(stderr, "%s: Unexpected %s message - ", program, raptor_log_level_get_label(message->level)); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); break; } } static void print_help(rasqal_world* world, raptor_world* raptor_world_ptr) { puts(title_string); puts(rasqal_version_string); putchar('\n'); puts("Run an RDF query test suite."); printf("Usage: %s [OPTIONS] [base URI]\n", program); fputs(rasqal_copyright_string, stdout); fputs("\nLicense: ", stdout); puts(rasqal_license_string); fputs("Rasqal home page: ", stdout); puts(rasqal_home_url_string); puts("\nOptions:"); puts(HELP_TEXT("a", "approved ", "Run only approved tests")); puts(HELP_TEXT("h", "help ", "Print this help, then exit")); puts(HELP_TEXT("n", "dryrun ", "Prepare but do not run the query")); puts(HELP_TEXT("q", "quiet ", "No extra information messages")); puts(HELP_TEXT("t TEST", "test TEST ", "Run just one TEST")); puts(HELP_TEXT("v", "version ", "Print the Rasqal version")); puts("\nReport bugs to http://bugs.librdf.org/"); } int main(int argc, char *argv[]) { char *p; rasqal_world *world = NULL; raptor_world* raptor_world_ptr = NULL; unsigned char *uri_string; raptor_uri *uri; raptor_uri *base_uri; int rc = 0; int free_uri_string = 0; int usage = 0; int help = 0; int quiet = 0; int dryrun = 0; int approved = 0; manifest_world* mw; raptor_sequence* seq; manifest_test_result* result; char* test_string = NULL; program = argv[0]; if((p = strrchr(program, '/'))) program = p + 1; else if((p = strrchr(program, '\\'))) program = p + 1; argv[0] = program; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); rc = 1; goto tidy; } raptor_world_ptr = rasqal_world_get_raptor(world); rasqal_world_set_log_handler(world, world, testrunner_log_handler); while (!usage && !help) { int c; #ifdef HAVE_GETOPT_LONG int option_index = 0; c = getopt_long (argc, argv, GETOPT_STRING, long_options, &option_index); #else c = getopt (argc, argv, GETOPT_STRING); #endif if (c == -1) break; switch (c) { case 0: case '?': /* getopt() - unknown option */ usage = 1; break; case 'a': approved = 1; break; case 'h': help = 1; break; case 'n': dryrun = 1; break; case 't': if(optarg) test_string = optarg; break; case 'q': quiet = 1; break; case 'v': fputs(rasqal_version_string, stdout); fputc('\n', stdout); rasqal_free_world(world); exit(0); } } if(!help && !usage) { if(optind != argc-1 && optind != argc-2) usage = 2; /* Title and usage */ } if(usage) { if(usage > 1) { fputs(title_string, stderr); fputs(rasqal_version_string, stderr); putc('\n', stderr); fputs("Rasqal home page: ", stderr); fputs(rasqal_home_url_string, stderr); fputc('\n', stderr); fputs(rasqal_copyright_string, stderr); fputs("\nLicense: ", stderr); fputs(rasqal_license_string, stderr); fputs("\n\n", stderr); } fprintf(stderr, "Try `%s " HELP_ARG(h, help) "' for more information.\n", program); rasqal_free_world(world); exit(1); } if(help) { print_help(world, raptor_world_ptr); rasqal_free_world(world); exit(0); } uri_string = (unsigned char*)argv[optind]; if(!access((const char*)uri_string, R_OK)) { uri_string = raptor_uri_filename_to_uri_string((char*)uri_string); uri = raptor_new_uri(raptor_world_ptr, uri_string); free_uri_string = 1; } else { uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)uri_string); } if(optind == argc-1) { char* base_uri_string = argv[optind+1]; base_uri = raptor_new_uri(raptor_world_ptr, (unsigned char*)(base_uri_string)); } else { base_uri = raptor_uri_copy(uri); } mw = manifest_new_world(world); if(!mw) { fprintf(stderr, "%s: manifest_new_world() failed\n", program); rc = 1; goto tidy; } /* A sequence of owned URIs */ seq = raptor_new_sequence((raptor_data_free_handler)raptor_free_uri, NULL); raptor_sequence_push(seq, raptor_uri_copy(uri)); result = manifest_manifests_run(mw, seq, base_uri, test_string, /* indent */ 0, dryrun, !quiet, approved); raptor_free_sequence(seq); if(result) { rc = result->state == STATE_PASS ? 0 : 1; manifest_free_test_result(result); } else rc = 1; raptor_free_uri(base_uri); raptor_free_uri(uri); if(free_uri_string) raptor_free_memory(uri_string); manifest_free_world(mw); tidy: if(world) rasqal_free_world(world); return rc; } rasqal-0.9.33/utils/srxwrite.c0000644000175000017500000001154212343762317013220 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * srxwrite.c - SPARQL Results Format writing test program * * Copyright (C) 2010, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #ifdef RAPTOR_V2_AVAILABLE #else #define raptor_new_iostream_to_file_handle(world, fh) raptor_new_iostream_to_file_handle(fh) #endif static char *program = NULL; int main(int argc, char *argv[]); int main(int argc, char *argv[]) { int rc = 0; raptor_iostream* iostr = NULL; char* p; raptor_uri* base_uri = NULL; rasqal_query_results* results = NULL; const char* write_formatter_name = NULL; rasqal_query_results_formatter* write_formatter = NULL; rasqal_world *world; rasqal_variables_table* vars_table = NULL; rasqal_row* row = NULL; rasqal_literal* l = NULL; #ifdef RAPTOR_V2_AVAILABLE raptor_world *raptor_world_ptr; #endif program = argv[0]; if((p=strrchr(program, '/'))) program = p+1; else if((p=strrchr(program, '\\'))) program = p+1; argv[0] = program; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } if(argc < 2 || argc > 2) { fprintf(stderr, "USAGE: %s []\n", program); rc = 1; goto tidy; } if(argc > 1) { if(strcmp(argv[1], "-")) write_formatter_name = argv[1]; } #ifdef RAPTOR_V2_AVAILABLE raptor_world_ptr = rasqal_world_get_raptor(world); #endif vars_table = rasqal_new_variables_table(world); if(!vars_table) { fprintf(stderr, "%s: Failed to create variables table\n", program); rc = 1; goto tidy; } #define NUMBER_VARIABLES 2 rasqal_variables_table_add2(vars_table, RASQAL_VARIABLE_TYPE_NORMAL, (const unsigned char*)"a", 1, NULL); rasqal_variables_table_add2(vars_table, RASQAL_VARIABLE_TYPE_NORMAL, (const unsigned char*)"b", 1, NULL); results = rasqal_new_query_results2(world, NULL, RASQAL_QUERY_RESULTS_BINDINGS); if(!results) { fprintf(stderr, "%s: Failed to create query results\n", program); rc = 1; goto tidy; } row = rasqal_new_row_for_size(world, NUMBER_VARIABLES); l = rasqal_new_boolean_literal(world, 1); if(!l) { fprintf(stderr, "%s: Failed to create boolean literal\n", program); rc = 1; goto tidy; } rasqal_row_set_value_at(row, 0, l); rasqal_free_literal(l); l = NULL; l = rasqal_new_integer_literal(world, RASQAL_LITERAL_INTEGER, 42); if(!l) { fprintf(stderr, "%s: Failed to integer boolean literal\n", program); rc = 1; goto tidy; } rasqal_row_set_value_at(row, 1, l); rasqal_free_literal(l); l = NULL; rasqal_query_results_add_row(results, row); row = NULL; /* now owned by results */ write_formatter = rasqal_new_query_results_formatter(world, write_formatter_name, NULL, NULL); if(!write_formatter) { fprintf(stderr, "%s: Failed to create query results write formatter '%s'\n", program, write_formatter_name); rc = 1; goto tidy; } iostr = raptor_new_iostream_to_file_handle(raptor_world_ptr, stdout); if(!iostr) { fprintf(stderr, "%s: Creating output iostream failed\n", program); } else { rasqal_query_results_formatter_write(iostr, write_formatter, results, base_uri); raptor_free_iostream(iostr); } iostr = NULL; tidy: if(l) rasqal_free_literal(l); if(row) rasqal_free_row(row); if(write_formatter) rasqal_free_query_results_formatter(write_formatter); if(iostr) raptor_free_iostream(iostr); if(results) rasqal_free_query_results(results); if(vars_table) rasqal_free_variables_table(vars_table); if(base_uri) raptor_free_uri(base_uri); rasqal_free_world(world); return (rc); } rasqal-0.9.33/utils/check_query.c0000644000175000017500000004703512441120534013625 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * check_query.c - Rasqal RDF query test utility * * Copyright (C) 2011, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_GETOPT_H #include #endif #ifndef HAVE_GETOPT #include #endif #ifdef HAVE_UNISTD_H #include #endif /* Rasqal includes */ #include /* FIXME * This code uses internal structs * rasqal_dataset * and macros * RASQAL_CALLOC() * RASQAL_FREE() * and APIs: * rasqal_new_dataset() * rasqal_dataset_load_graph_iostream() * rasqal_free_dataset() * rasqal_literal_equals_flags() * rasqal_query_results_sort() * * The dataset API calls are used to read RDF graphs but nothing is * done with the data at present. * */ #include #include "rasqalcmdline.h" #ifdef NEED_OPTIND_DECLARATION extern int optind; extern char *optarg; #endif int main(int argc, char *argv[]); static char *program = NULL; #ifdef HAVE_GETOPT_LONG #define HELP_TEXT(short, long, description) " -" short ", --" long " " description #define HELP_TEXT_LONG(long, description) " --" long " " description #define HELP_ARG(short, long) "--" #long #define HELP_PAD "\n " #else #define HELP_TEXT(short, long, description) " -" short " " description #define HELP_TEXT_LONG(long, description) #define HELP_ARG(short, long) "-" #short #define HELP_PAD "\n " #endif #define GETOPT_STRING "dF:g:hl:n:q:Q:r:R:v" #ifdef HAVE_GETOPT_LONG static struct option long_options[] = { /* name, has_arg, flag, val */ {"debug", 0, 0, 'd'}, {"data-format", 1, 0, 'F'}, {"default-graph", 1, 0, 'g'}, {"help", 0, 0, 'h'}, {"language", 1, 0, 'l'}, {"named-graph", 1, 0, 'n'}, {"query", 1, 0, 'q'}, {"query-base-uri", 1, 0, 'Q'}, {"result", 1, 0, 'r'}, {"result-format", 1, 0, 'R'}, {"version", 0, 0, 'v'}, {NULL, 0, 0, 0} }; #endif static int error_count = 0; static int verbose = 0; static const char *title_string = "Rasqal RDF query test utility"; static void check_query_log_handler(void* user_data, raptor_log_message *message) { /* Only interested in errors and more severe */ if(message->level < RAPTOR_LOG_LEVEL_ERROR) return; fprintf(stderr, "%s: Error: ", program); if(message->locator) { raptor_locator_print(message->locator, stderr); fputs(" : ", stderr); } fprintf(stderr, "%s\n", message->text); error_count++; } static rasqal_query* check_query_init_query(rasqal_world *world, const char* ql_name, const unsigned char* query_string, raptor_uri* base_uri, raptor_sequence* data_graphs) { rasqal_query* rq; rq = rasqal_new_query(world, (const char*)ql_name, NULL); if(!rq) { fprintf(stderr, "%s: Failed to create query in language %s\n", program, ql_name); goto tidy_query; } if(rasqal_query_prepare(rq, (const unsigned char*)query_string, base_uri)) { fprintf(stderr, "%s: Parsing query failed\n", program); rasqal_free_query(rq); rq = NULL; goto tidy_query; } if(data_graphs) { rasqal_data_graph* dg; while((dg = (rasqal_data_graph*)raptor_sequence_pop(data_graphs))) { if(rasqal_query_add_data_graph(rq, dg)) { fprintf(stderr, "%s: Failed to add data graph to query\n", program); goto tidy_query; } } } tidy_query: return rq; } #define DEFAULT_QUERY_LANGUAGE "sparql" #define DEFAULT_DATA_FORMAT_NAME_GRAPH "guess" #define DEFAULT_RESULT_FORMAT_NAME "xml" int main(int argc, char *argv[]) { rasqal_world *world; raptor_world* raptor_world_ptr = NULL; int rc = 0; int usage = 0; int help = 0; const char* query_language = DEFAULT_QUERY_LANGUAGE; const char* query_filename = NULL; const char* data_format_name = NULL; const char* result_filename = NULL; const char* result_format_name = NULL; unsigned char* query_string = NULL; size_t query_len = 0; unsigned char *query_base_uri_string = NULL; int free_query_base_uri_string = 0; raptor_uri* query_base_uri = NULL; rasqal_query* rq = NULL; rasqal_query_results* results = NULL; rasqal_query_results* expected_results = NULL; raptor_sequence* data_graphs = NULL; raptor_iostream* result_iostr = NULL; rasqal_dataset* ds = NULL; rasqal_query_results_type results_type; /* Set globals */ if(1) { char *p; program = argv[0]; if((p = strrchr(program, '/'))) program = p + 1; else if((p = strrchr(program, '\\'))) program = p + 1; argv[0] = program; } world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } raptor_world_ptr = rasqal_world_get_raptor(world); rasqal_world_set_log_handler(world, world, check_query_log_handler); /* Option parsing */ while (!usage && !help) { int c; #ifdef HAVE_GETOPT_LONG int option_index = 0; c = getopt_long (argc, argv, GETOPT_STRING, long_options, &option_index); #else c = getopt (argc, argv, GETOPT_STRING); #endif if (c == -1) break; switch (c) { case 0: case '?': /* getopt() - unknown option */ usage = 1; break; case 'd': verbose++; break; case 'F': if(optarg) { data_format_name = optarg; } break; case 'h': help = 1; break; case 'l': if(optarg) { query_language = optarg; } break; case 'q': if(optarg) { query_filename = optarg; } break; case 'Q': if(optarg) { query_base_uri_string = (unsigned char*)optarg; } break; case 'r': if(optarg) { result_filename = optarg; } break; case 'R': if(optarg) { result_format_name = optarg; } break; case 'v': fputs(rasqal_version_string, stdout); fputc('\n', stdout); rasqal_free_world(world); exit(0); case 'g': case 'n': if(optarg) { rasqal_data_graph *dg = NULL; rasqal_data_graph_flags type; type = (c == 'n') ? RASQAL_DATA_GRAPH_NAMED : RASQAL_DATA_GRAPH_BACKGROUND; dg = rasqal_cmdline_read_data_graph(world, type, (const char*)optarg, data_format_name); if(!dg) { fprintf(stderr, "%s: Failed to create data graph for `%s'\n", program, optarg); return(1); } if(!data_graphs) { data_graphs = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, NULL); if(!data_graphs) { fprintf(stderr, "%s: Failed to create data graphs sequence\n", program); return(1); } } raptor_sequence_push(data_graphs, dg); } break; } } /* end while option */ if(!help && !usage) { if(optind != argc) { fprintf(stderr, "%s: Extra arguments.\n", program); usage = 1; } else if(!result_filename) { usage = 2; /* Title and usage */ } else if(!query_filename) { usage = 2; /* Title and usage */ } } if(usage) { if(usage > 1) { fputs(title_string, stderr); fputs(rasqal_version_string, stderr); putc('\n', stderr); fputs("Rasqal home page: ", stderr); fputs(rasqal_home_url_string, stderr); fputc('\n', stderr); fputs(rasqal_copyright_string, stderr); fputs("\nLicense: ", stderr); fputs(rasqal_license_string, stderr); fputs("\n\n", stderr); } fprintf(stderr, "Try `%s " HELP_ARG(h, help) "' for more information.\n", program); rasqal_free_world(world); exit(1); } if(help) { int i; puts(title_string); puts(rasqal_version_string); putchar('\n'); puts("Run an RDF query and check it against a known result."); printf("Usage: %s [OPTIONS] -g DATA -q QUERY-FILE -r RESULT-FILE\n\n", program); fputs(rasqal_copyright_string, stdout); fputs("\nLicense: ", stdout); puts(rasqal_license_string); fputs("Rasqal home page: ", stdout); puts(rasqal_home_url_string); puts("\nNormal operation is to execute the query in the QUERY-FILE and\ncompare to the query results in RESULT-FILE."); puts("\nMain options:"); puts(HELP_TEXT("g URI", "default-graph URI", "Use URI as the default graph in the dataset")); puts(HELP_TEXT("l", "language LANGUAGE ", "Set query language name to one of:")); for(i = 0; 1; i++) { const raptor_syntax_description* desc; desc = rasqal_world_get_query_language_description(world, RASQAL_GOOD_CAST(unsigned int, i)); if(!desc) break; printf(" %-15s %s", desc->names[0], desc->label); if(!i) puts(" (default)"); else putchar('\n'); } puts(HELP_TEXT("n URI", "named-graph URI ", "Add named graph URI to dataset")); puts(HELP_TEXT("q FILE", "query QUERY-FILE", "Execute query in file QUERY-FILE")); puts(HELP_TEXT("r FILE", "result FILE ", "Compare to result in file RESULTS-FILE")); puts("\nAdditional options:"); puts(HELP_TEXT("d", "debug ", "Increase debug message level")); puts(HELP_TEXT("F", "data-format NAME ", "Set the data source format NAME (default: " DEFAULT_DATA_FORMAT_NAME_GRAPH ")")); puts(HELP_TEXT("h", "help ", "Print this help, then exit")); puts(HELP_TEXT("Q URI", "query-base-uri URI", "Set the base URI for the query")); puts(HELP_TEXT("R", "result-format NAME ", "Set the result format NAME (default: " DEFAULT_RESULT_FORMAT_NAME ")")); puts(" For variable bindings and boolean results:"); for(i = 0; 1; i++) { const raptor_syntax_description* desc; desc = rasqal_world_get_query_results_format_description(world, RASQAL_GOOD_CAST(unsigned int, i)); if(!desc) break; if(desc->flags & RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER) { printf(" %-10s %s", desc->names[0], desc->label); if(!strcmp(desc->names[0], DEFAULT_RESULT_FORMAT_NAME)) puts(" (default)"); else putchar('\n'); } } puts(" For RDF graph results:"); for(i = 0; 1; i++) { const raptor_syntax_description *desc; desc = raptor_world_get_parser_description(raptor_world_ptr, RASQAL_GOOD_CAST(unsigned int, i)); if(!desc) break; printf(" %-15s%s", desc->names[0], desc->label); if(!strcmp(desc->names[0], DEFAULT_DATA_FORMAT_NAME_GRAPH)) puts(" (default)"); else putchar('\n'); } puts(HELP_TEXT("v", "version ", "Print the Rasqal version")); puts("\nReport bugs to http://bugs.librdf.org/"); rasqal_free_world(world); exit(0); } /* Compute query base URI from filename or passed in -Q QUERY-BASE-URI */ if(!query_base_uri_string) { query_base_uri_string = raptor_uri_filename_to_uri_string(query_filename); free_query_base_uri_string = 1; } query_base_uri = raptor_new_uri(raptor_world_ptr, query_base_uri_string); if(!query_base_uri) { fprintf(stderr, "%s: Failed to create URI for %s\n", program, query_base_uri_string); return(1); } /* Read query from file into a string */ query_string = rasqal_cmdline_read_file_string(world, query_filename, "query file", &query_len); if(!query_string) { rc = 1; goto tidy_setup; } /* Report information */ if(verbose) { fprintf(stderr, "%s: Reading query in language %s from file %s URI %s:\n", program, query_language, query_filename, raptor_uri_as_string(query_base_uri)); if(verbose > 1) fprintf(stderr, "%s\n", (const char*)query_string); fprintf(stderr, "%s: Reading results from file '%s'\n", program, result_filename); } /* Parse and prepare query */ rq = check_query_init_query(world, query_language, query_string, query_base_uri, data_graphs); rasqal_free_memory(query_string); if(!rq) { fprintf(stderr, "%s: Parsing query in %s failed\n", program, query_filename); goto tidy_query; } /* Query prepared OK - we now know the query details such as result type */ /* Read expected results */ if(1) { results_type = rasqal_query_get_result_type(rq); fprintf(stderr, "%s: Expecting result type %u\n", program, results_type); /* Read result file */ result_iostr = raptor_new_iostream_from_filename(raptor_world_ptr, result_filename); if(!result_iostr) { fprintf(stderr, "%s: result file '%s' open failed - %s\n", program, result_filename, strerror(errno)); rc = 1; goto tidy_setup; } switch(results_type) { case RASQAL_QUERY_RESULTS_BINDINGS: case RASQAL_QUERY_RESULTS_BOOLEAN: /* read results via rasqal query results format */ expected_results = rasqal_cmdline_read_results(world, raptor_world_ptr, results_type, result_iostr, result_filename, result_format_name); raptor_free_iostream(result_iostr); result_iostr = NULL; if(!expected_results) { fprintf(stderr, "%s: Failed to create query results\n", program); rc = 1; goto tidy_setup; } break; case RASQAL_QUERY_RESULTS_GRAPH: /* read results via raptor parser */ if(1) { const char* format_name = NULL; if(result_format_name) { if(!raptor_world_is_parser_name(raptor_world_ptr, result_format_name)) { fprintf(stderr, "%s: invalid parser name `%s' for `" HELP_ARG(R, result-format) "'\n\n", program, result_format_name); } else format_name = result_format_name; } if(!format_name) format_name = DEFAULT_RESULT_FORMAT_NAME; ds = rasqal_new_dataset(world); if(!ds) { fprintf(stderr, "%s: Failed to create dataset", program); rc = 1; goto tidy_setup; } if(rasqal_dataset_load_graph_iostream(ds, format_name, result_iostr, NULL)) { fprintf(stderr, "%s: Failed to load graph into dataset", program); rc = 1; goto tidy_setup; } raptor_free_iostream(result_iostr); result_iostr = NULL; /* FIXME * * The code at this point should do something with triples * in the dataset; save them for later to compare them to * the expected triples. that requires a triples compare * OR a true RDF graph compare. * * Deleting the dataset here frees the triples just loaded. */ rasqal_free_dataset(ds); ds = NULL; } break; case RASQAL_QUERY_RESULTS_SYNTAX: case RASQAL_QUERY_RESULTS_UNKNOWN: /* failure */ fprintf(stderr, "%s: Reading %s query results format is not supported", program, rasqal_query_results_type_label(results_type)); rc = 1; goto tidy_setup; } } /* save results for query execution so we can print and rewind */ rasqal_query_set_store_results(rq, 1); results = rasqal_query_execute(rq); if(results) { switch(results_type) { case RASQAL_QUERY_RESULTS_BINDINGS: fprintf(stderr, "%s: Expected bindings results:\n", program); rasqal_cmdline_print_bindings_results_simple(program, expected_results, stderr, 1, 0); fprintf(stderr, "%s: Actual bindings results:\n", program); rasqal_cmdline_print_bindings_results_simple(program, results, stderr, 1, 0); rasqal_query_results_rewind(expected_results); rasqal_query_results_rewind(results); /* FIXME: should NOT do this if results are expected to be ordered */ rasqal_query_results_sort(expected_results); rasqal_query_results_sort(results); if(1) { rasqal_results_compare* rrc; rrc = rasqal_new_results_compare(world, expected_results, "expected", results, "actual"); rasqal_results_compare_set_log_handler(rrc, world, check_query_log_handler); rc = !rasqal_results_compare_compare(rrc); rasqal_free_results_compare(rrc); rrc = NULL; } break; case RASQAL_QUERY_RESULTS_BOOLEAN: if(1) { int expected_boolean = rasqal_query_results_get_boolean(expected_results); int actual_boolean = rasqal_query_results_get_boolean(results); RASQAL_DEBUG2("Expected boolean result: %d\n", expected_boolean); RASQAL_DEBUG2("Actual boolean result: %d\n", actual_boolean); rc = (expected_boolean != actual_boolean); } break; case RASQAL_QUERY_RESULTS_GRAPH: case RASQAL_QUERY_RESULTS_SYNTAX: case RASQAL_QUERY_RESULTS_UNKNOWN: /* failure */ fprintf(stderr, "%s: Query result format %u cannot be tested.", program, results_type); rc = 1; goto tidy_setup; } } else rc = 1; if(verbose) { fprintf(stdout, "%s: Result: %s\n", program, rc ? "FAILURE" : "success"); } if(results) { rasqal_free_query_results(results); results = NULL; } tidy_query: if(rq) rasqal_free_query(rq); tidy_setup: if(expected_results) rasqal_free_query_results(expected_results); if(results) rasqal_free_query_results(results); if(result_iostr) raptor_free_iostream(result_iostr); if(ds) rasqal_free_dataset(ds); if(free_query_base_uri_string) raptor_free_memory(query_base_uri_string); if(query_base_uri) raptor_free_uri(query_base_uri); if(data_graphs) raptor_free_sequence(data_graphs); rasqal_free_world(world); return (rc); } rasqal-0.9.33/utils/roqet.html0000644000175000017500000002540112441117526013177 00000000000000 Rasqal RDF Query Library - Rasqal RDF parser utility

Rasqal RDF Query Library - Rasqal RDF parser utility


NAME

roqet − Rasqal RDF query utility

SYNOPSIS

roqet [OPTIONS] <query-URI> [base-URI]
roqet
[OPTIONS]-e query-string [base-URI]
roqet
[OPTIONS]-p sparql-protocol-service-URI query-URI [base-URI]
roqet
[OPTIONS]-p sparql-protocol-service-URI [-e query-string ] [base-URI]
roqet
[OPTIONS]-t query results file [base-URI]

DESCRIPTION

The roqet utility allows querying of RDF content using the Rasqal RDF query library, printing the results for variable bindings, RDF graph or boolean results in a variety of formats. The query is read from query-URI and the optional base-URI is used as the base URI of the query if present.

MAIN OPTIONS

roqet uses the usual GNU command line syntax, with long options starting with two dashes (’-’) if supported by the getopt_long function. Otherwise only the short options are available.
−e, −−exec QUERY

Execute the query string in the argument QUERY instead of reading the query from a URI (when −e / −−exec is not given).

−i, −−input LANGUAGE

Set the input query LANGUAGE to one of the supported languages which includes ’sparql’ (SPARQL Query Language for RDF, default), ’sparql11’ and ’laqrs’. The full list of supported languages and subsets is given in the help summary with the −h / −−help option.

−p, −−protocol SERVICE-URI

Call the SPARQL HTTP protocol SERVICE-URI to execute the query instead of executing it inside the Rasqal query engine locally ( when -e is given, or a query string given)

−r, −−results FORMAT

Set the query results output FORMAT

For variable bindings, the values of FORMAT vary upon what Rasqal supports but include ’simple’ for a simple text format (default), ’xml’ for the SPARQL Query Results XML format, ’csv’ for SPARQL CSV, ’tsv’ for SPARQL TSV, ’rdfxml’ and ’turtle’ for RDF syntax formats, and ’json’ for a JSON version of the results.

For RDF graph results, the values of FORMAT are ’ntriples’ (N-Triples, default), ’rdfxml-abbrev’ (RDF/XML Abbreviated), ’rdfxml’ (RDF/XML), ’turtle’ (Turtle), ’json’ (RDF/JSON resource centric), ’json-triples’ (RDF/JSON triples) or ’rss-1.0’ (RSS 1.0, also an RDF/XML syntax).

The exact list of formats depends on what libraptor2(3) was built with but is given correct in the usage message with −h.

−R, −−results-input-format FORMAT

Set the query results input FORMAT

This is for use with −t and takes values of ’xml’ for the SPARQL Query Results XML format,, ’csv’ for SPARQL CSV,, ’tsv’ for SPARQL TSV, ’turtle’ and ’rdfxml’ for RDF syntax formats.

−t, −−results−input FILE

Read query results from FILE

OTHER OPTIONS

−c, −−count

Only count the triples and produce no other output.

−d, −−dump−query FORMAT

Print the parsed query out in a given FORMAT one of ’none’ (default), ’debug’, ’structure’ or ’sparql’

−D, −−data URI

Add RDF data source URI (not a named graph). If no data sources are given, the query itself must point to the data such as via SPARQL FROM uri statements.

−E, −−ignore−errors

Do not print error messages and do not exit with a non-0 status.

−f, −−feature NAME(=VALUE)

Set query feature NAME to the VALUE or integer 1 if omitted. The known features can be shown with -f help or --feature help.

−F, −−format NAME

Set the data source format name for subsequent data graphs called with −D / −−data or −G / −−named. The default if this is not specified is for the query engine to guess. The name is a Raptor parser name.

−G, −−named URI

Add RDF data source URI (named graph)

−h, −−help

Show a summary of the options.

−n, −−dryrun

Prepare the query but do not execute it.

−q, −−quiet

No extra information messages.

−s, −−source URI

Add RDF data source URI (named graph) URI by adding it to the list of query data source URIs. FORMAT to ’simple’ (default) or ’xml’ (an experimental XML format)

−v, −−version

Print the rasqal library version and exit.

−W, −−warnings LEVEL

Set the warning LEVEL in the range 0 (do not warn about anything) to 100 (show every warning). The Rasqal default is in the middle (50).

EXAMPLES

roqet sparql-query-file.rq

Run a SPARQL query contained in the local file sparql-query-file.rq. The data used would be described in FROM statements in the query file.

roqet -q -i sparql http://example.org/sparql-query.rq

Run a SPARQL query that is in the web at URI http://example.org/sparql-query.rq without an extra messages (quiet, -q).

roqet -q query-file.rq http://example.org/base/

Run an query (default languge SPARQL) from a local file query-file.rq but using base URI http://example.org/base/ to resolve any relative URIs.

roqet -q -i sparql -r xml http://example.org/sparql-query.rq

Run a SPARQL query that is in the web at URI http://example.org/sparql-query.rq and format the results in the SPARQL Query Results XML format with no extra messages.

roqet -i sparql -e ’SELECT * WHERE { ?s ?p ?o }’ -D stuff.rdf

Run a SPARQL query given on the command line against data in the file stuff.rdf. The type of the file will be guessed and likely is of format RDF/XML.

roqet -t result.srx -r html

Read a SPARQL query results in SPARQL Query Results XML format (default) and print it in HTML.

roqet -t result.ttl -R turtle -r csv

Read a SPARQL query results in RDF/Turtle format and print it in CSV.

CONFORMING TO

SPARQL 1.1 Query Language, Steve Harris and Andy Seaborne (eds), W3C Recommendation, 21 March 2013 http://www.w3.org/TR/2013/REC-sparql11-query-20130321/

SPARQL Query Results XML Format (Second Edition), Sandro Hawke (Second Edition ed), Jeen Broekstra and Dave Beckett (eds), W3C Recommendation, 21 March 2013. http://www.w3.org/TR/2013/REC-rdf-sparql-XMLres-20130321/

SEE ALSO

librasqal(3),libraptor(3)

CHANGES

AUTHOR

Dave Beckett - http://www.dajobe.org/


Copyright 2002-2014 Dave Beckett
2002-2005 University of Bristol

rasqal-0.9.33/utils/roqet.10000644000175000017500000001521712441117015012370 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" .\" roqet.1 - Rasqal RDF query utility .\" .\" Copyright (C) 2004-2014 David Beckett - http://www.dajobe.org/ .\" Copyright (C) 2004-2005 University of Bristol - http://www.bristol.ac.uk/ .\" .TH roqet 1 "2013-12-11" .\" Please adjust this date whenever revising the manpage. .SH NAME roqet \- Rasqal RDF query utility .SH SYNOPSIS .B roqet .RB [ OPTIONS ] .IR "" .IR "[base-URI]" .br .B roqet .RB [ OPTIONS ] -e .IR "query-string" .IR "[base-URI]" .br .B roqet .RB [ OPTIONS ] -p .IR "sparql-protocol-service-URI" .IR "query-URI" .IR "[base-URI]" .br .B roqet .RB [ OPTIONS ] -p .IR "sparql-protocol-service-URI" .RB [ -e .IR "query-string" .RB ] .IR "[base-URI]" .br .B roqet .RB [ OPTIONS ] -t .IR "query results file" .IR "[base-URI]" .SH DESCRIPTION The .B roqet utility allows querying of RDF content using the .B Rasqal RDF query library, printing the results for variable bindings, RDF graph or boolean results in a variety of formats. The query is read from \fIquery-URI\fR and the optional \fIbase-URI\fR is used as the base URI of the query if present. .SH MAIN OPTIONS roqet uses the usual GNU command line syntax, with long options starting with two dashes (`-') if supported by the getopt_long function. Otherwise only the short options are available. .TP .B \-e, \-\-exec QUERY Execute the query string in the argument .I QUERY instead of reading the query from a URI (when \fB\-e\fP / \fB\-\-exec\fP is not given). .TP .B \-i, \-\-input LANGUAGE Set the input query .I LANGUAGE to one of the supported languages which includes 'sparql' (SPARQL Query Language for RDF, default), 'sparql11' and 'laqrs'. The full list of supported languages and subsets is given in the help summary with the \fB\-h\fP / \fB\-\-help\fP option. .TP .B \-p, \-\-protocol SERVICE-URI Call the SPARQL HTTP protocol \fISERVICE-URI\fP to execute the query instead of executing it inside the Rasqal query engine locally ( when \fB-e\fP is given, or a query string given) .TP .B \-r, \-\-results FORMAT Set the query results output .I FORMAT .IP For variable bindings, the values of .I FORMAT vary upon what Rasqal supports but include 'simple' for a simple text format (default), 'xml' for the SPARQL Query Results XML format, 'csv' for SPARQL CSV, 'tsv' for SPARQL TSV, 'rdfxml' and 'turtle' for RDF syntax formats, and 'json' for a JSON version of the results. .IP For RDF graph results, the values of .I FORMAT are 'ntriples' (N-Triples, default), 'rdfxml-abbrev' (RDF/XML Abbreviated), 'rdfxml' (RDF/XML), 'turtle' (Turtle), 'json' (RDF/JSON resource centric), 'json-triples' (RDF/JSON triples) or 'rss-1.0' (RSS 1.0, also an RDF/XML syntax). .IP The exact list of formats depends on what libraptor2(3) was built with but is given correct in the usage message with \-h. .TP .B \-R, \-\-results-input-format FORMAT Set the query results input .I FORMAT .IP This is for use with \-t and takes values of 'xml' for the SPARQL Query Results XML format,, 'csv' for SPARQL CSV,, 'tsv' for SPARQL TSV, 'turtle' and 'rdfxml' for RDF syntax formats. .TP .B \-t, \-\-results\-input FILE Read query results from .I FILE .SH OTHER OPTIONS .TP .B \-c, \-\-count Only count the triples and produce no other output. .TP .B \-d, \-\-dump\-query FORMAT Print the parsed query out in a given .I FORMAT one of 'none' (default), 'debug', 'structure' or 'sparql' .TP .B \-D, \-\-data URI Add RDF data source URI (not a named graph). If no data sources are given, the query itself must point to the data such as via SPARQL FROM \fIuri\fP statements. .TP .B \-E, \-\-ignore\-errors Do not print error messages and do not exit with a non-0 status. .TP .B \-f, \-\-feature NAME(=VALUE) Set query feature .I NAME to the .I VALUE or integer 1 if omitted. The known features can be shown with \fB-f help\fP or \fB--feature help\fP. .TP .B \-F, \-\-format NAME Set the data source format \fIname\fP for subsequent data graphs called with \fB\-D\fP / \fB\-\-data\fP or \fB\-G\fP / \fB\-\-named\fP. The default if this is not specified is for the query engine to guess. The \fIname\fP is a Raptor parser name. .TP .B \-G, \-\-named URI Add RDF data source URI (named graph) .TP .B \-h, \-\-help Show a summary of the options. .TP .B \-n, \-\-dryrun Prepare the query but do not execute it. .TP .B \-q, \-\-quiet No extra information messages. .TP .B \-s, \-\-source URI Add RDF data source URI (named graph) .I URI by adding it to the list of query data source URIs. .I FORMAT to 'simple' (default) or 'xml' (an experimental XML format) .TP .B \-v, \-\-version Print the rasqal library version and exit. .TP .B \-W, \-\-warnings LEVEL Set the warning .I LEVEL in the range 0 (do not warn about anything) to 100 (show every warning). The Rasqal default is in the middle (50). .SH EXAMPLES .IP .B roqet sparql-query-file.rq .LP Run a SPARQL query contained in the local file sparql-query-file.rq. The data used would be described in FROM statements in the query file. .IP .B roqet -q -i sparql http://example.org/sparql-query.rq .LP Run a SPARQL query that is in the web at URI http://example.org/sparql-query.rq without an extra messages (quiet, -q). .IP .B roqet -q query-file.rq http://example.org/base/ .LP Run an query (default languge SPARQL) from a local file query-file.rq but using base URI http://example.org/base/ to resolve any relative URIs. .IP .B roqet -q -i sparql -r xml http://example.org/sparql-query.rq .LP Run a SPARQL query that is in the web at URI http://example.org/sparql-query.rq and format the results in the SPARQL Query Results XML format with no extra messages. .IP .B roqet -i sparql -e 'SELECT * WHERE { ?s ?p ?o }' -D stuff.rdf .LP Run a SPARQL query given on the command line against data in the file stuff.rdf. The type of the file will be guessed and likely is of format RDF/XML. .IP .B roqet -t result.srx -r html .LP Read a SPARQL query results in SPARQL Query Results XML format (default) and print it in HTML. .IP .B roqet -t result.ttl -R turtle -r csv .LP Read a SPARQL query results in RDF/Turtle format and print it in CSV. .SH "CONFORMING TO" \fISPARQL 1.1 Query Language\fR, Steve Harris and Andy Seaborne (eds), W3C Recommendation, 21 March 2013 .UR http://www.w3.org/TR/2013/REC-sparql11-query-20130321/ http://www.w3.org/TR/2013/REC-sparql11-query-20130321/ .UE .LP \fISPARQL Query Results XML Format (Second Edition)\fR, Sandro Hawke (Second Edition ed), Jeen Broekstra and Dave Beckett (eds), W3C Recommendation, 21 March 2013. .UR http://www.w3.org/TR/2013/REC-rdf-sparql-XMLres-20130321/ http://www.w3.org/TR/2013/REC-rdf-sparql-XMLres-20130321/ .UE .SH SEE ALSO .BR librasqal(3), libraptor(3) .SH CHANGES .br .SH AUTHOR Dave Beckett - .UR http://www.dajobe.org/ http://www.dajobe.org/ .UE .br rasqal-0.9.33/utils/srxread.c0000644000175000017500000001512412434455625013003 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * srxread.c - SPARQL Results Formats reading test program * * Copyright (C) 2007-2008, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include /* Rasqal includes */ #include #ifdef RAPTOR_V2_AVAILABLE #else #define raptor_new_uri(world, string) raptor_new_uri(string) #define raptor_new_iostream_from_filename(world, filename) raptor_new_iostream_from_filename(filename) #define raptor_new_iostream_to_file_handle(world, fh) raptor_new_iostream_to_file_handle(fh) #endif static const char *title_string = "Rasqal RDF query results utility"; static char *program = NULL; int main(int argc, char *argv[]); int main(int argc, char *argv[]) { int rc = 0; const char* filename = NULL; raptor_iostream* iostr = NULL; char* p; unsigned char* uri_string = NULL; raptor_uri* base_uri = NULL; rasqal_query_results* results = NULL; const char* read_formatter_name = NULL; const char* write_formatter_name = NULL; rasqal_query_results_formatter* read_formatter = NULL; rasqal_query_results_formatter* write_formatter = NULL; raptor_iostream *write_iostr = NULL; rasqal_world *world; #ifdef RAPTOR_V2_AVAILABLE raptor_world *raptor_world_ptr; #endif program = argv[0]; if((p=strrchr(program, '/'))) program = p+1; else if((p=strrchr(program, '\\'))) program = p+1; argv[0] = program; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } if(argc < 2 || argc > 4) { int i; puts(title_string); puts(rasqal_version_string); putchar('\n'); puts("Read an RDF Query results file in one format and print in another\n"); printf("Usage: %s [read format [write format]]\n\n", program); fputs(rasqal_copyright_string, stdout); fputs("\nLicense: ", stdout); puts(rasqal_license_string); fputs("Rasqal home page: ", stdout); puts(rasqal_home_url_string); puts("\nFormats supported are:"); for(i = 0; 1; i++) { const raptor_syntax_description* desc; int need_comma = 0; desc = rasqal_world_get_query_results_format_description(world, i); if(!desc) break; printf(" %-10s %s (", desc->names[0], desc->label); if(desc->flags & RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER) { fputs("read", stdout); need_comma = 1; } if(desc->flags & RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER) { if(need_comma) fputs(", ", stdout); fputs("write", stdout); need_comma = 1; } if(!i) { if(need_comma) fputs(", ", stdout); fputs("default", stdout); } fputs(")\n", stdout); if(desc->mime_types[0].mime_type) { int mimei; const char* mt; for(mimei = 0; (mt = desc->mime_types[mimei].mime_type); mimei++) { fprintf(stdout, " %s\n", mt); } } } rc = 1; goto tidy; } filename = argv[1]; if(argc > 2) { if(strcmp(argv[2], "-")) read_formatter_name = argv[2]; if(argc > 3) { if(strcmp(argv[3], "-")) write_formatter_name = argv[3]; } } #ifdef RAPTOR_V2_AVAILABLE raptor_world_ptr = rasqal_world_get_raptor(world); #endif uri_string = raptor_uri_filename_to_uri_string((const char*)filename); if(!uri_string) goto tidy; base_uri = raptor_new_uri(raptor_world_ptr, uri_string); raptor_free_memory(uri_string); results = rasqal_new_query_results2(world, NULL, RASQAL_QUERY_RESULTS_BINDINGS); if(!results) { fprintf(stderr, "%s: Failed to create query results\n", program); rc = 1; goto tidy; } iostr = raptor_new_iostream_from_filename(raptor_world_ptr, filename); if(!iostr) { fprintf(stderr, "%s: Failed to open iostream to file %s\n", program, filename); rc = 1; goto tidy; } read_formatter = rasqal_new_query_results_formatter(world, read_formatter_name, NULL, NULL); if(!read_formatter) { fprintf(stderr, "%s: Failed to create query results read formatter '%s'\n", program, read_formatter_name); rc = 1; goto tidy; } rc = rasqal_query_results_formatter_read(world, iostr, read_formatter, results, base_uri); if(rc) { fprintf(stderr, "%s: Failed to read query results with read formatter '%s'\n", program, read_formatter_name); goto tidy; } write_formatter = rasqal_new_query_results_formatter(world, write_formatter_name, NULL, NULL); if(!write_formatter) { fprintf(stderr, "%s: Failed to create query results write formatter '%s'\n", program, write_formatter_name); rc = 1; goto tidy; } write_iostr = raptor_new_iostream_to_file_handle(raptor_world_ptr, stdout); if(!write_iostr) { fprintf(stderr, "%s: Creating output iostream failed\n", program); } else { rasqal_query_results_formatter_write(write_iostr, write_formatter, results, base_uri); raptor_free_iostream(write_iostr); } tidy: if(write_formatter) rasqal_free_query_results_formatter(write_formatter); if(read_formatter) rasqal_free_query_results_formatter(read_formatter); if(iostr) raptor_free_iostream(iostr); if(results) rasqal_free_query_results(results); if(base_uri) raptor_free_uri(base_uri); rasqal_free_world(world); return (rc); } rasqal-0.9.33/utils/rasqalcmdline.h0000644000175000017500000000355612322537657014167 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqalcmdline.h - Rasqal command line utility functions * * Copyright (C) 2013, David Beckett http://www.dajobe.org/ * * 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. * */ #ifndef RASQAL_CMDLINE_H #define RASQAL_CMDLINE_H typedef struct compare_query_results_t compare_query_results; /* read_files.c */ unsigned char* rasqal_cmdline_read_file_fh(rasqal_world* world, FILE* fh, const char* filename, const char* label, size_t* len_p); unsigned char* rasqal_cmdline_read_file_string(rasqal_world* world, const char* filename, const char* label, size_t* len_p); unsigned char* rasqal_cmdline_read_uri_file_stdin_contents(rasqal_world* world, raptor_uri* uri, const char* filename, size_t* len_p); rasqal_data_graph* rasqal_cmdline_read_data_graph(rasqal_world* world, rasqal_data_graph_flags type, const char* name, const char* format_name); /* results.c */ rasqal_query_results* rasqal_cmdline_read_results(rasqal_world* world, raptor_world* raptor_world_ptr, rasqal_query_results_type results_type, raptor_iostream* result_iostr, const char* result_filename, const char* result_format_name); void rasqal_cmdline_print_bindings_results_simple(const char* program, rasqal_query_results *results, FILE* output, int quiet, int count); #endif rasqal-0.9.33/utils/manifest.c0000644000175000017500000014524312356406761013147 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * manifest.c - Decode tests and testsuites from manifests * * Copyright (C) 2014, David Beckett http://www.dajobe.org/ * * 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. * */ #include #include #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include #include #include "manifest.h" #include "rasqalcmdline.h" static const unsigned int indent_step = 2; static const unsigned int linewrap = 78; static const unsigned int banner_width = 68 /* linewrap - 10 */; static const char manifest_test_state_chars[STATE_LAST + 1] = { '.', 'F', '*', '!', '-' }; static const char* manifest_test_state_labels[STATE_LAST + 1] = { "pass", "FAIL", "XFAIL", "UXPASS", "SKIP" }; #define DEFAULT_RESULT_FORMAT_NAME "guess" /* prototypes */ static void manifest_free_test(manifest_test* t); static void manifest_free_testsuite(manifest_testsuite* ts); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 0 static void manifest_test_print(FILE*fh, manifest_test* t, int indent); #endif static void manifest_indent(FILE* fh, unsigned int indent) { while(indent--) fputc(' ', fh); } static void manifest_indent_multiline(FILE* fh, const char* str, unsigned int indent, int max_lines_count) { int lines_count = 0; char c; while((c = *str++)) { fputc(c, fh); if(c == '\n') { lines_count++; if(max_lines_count >=0 && lines_count > max_lines_count) break; manifest_indent(fh, indent); } } if(lines_count > max_lines_count) { manifest_indent(fh, indent); fputs("...\n", fh); } } static void manifest_banner(FILE* fh, unsigned int width, char banner) { while(width--) fputc(banner, fh); fputc('\n', fh); } static char manifest_test_state_char(manifest_test_state state) { if(state > STATE_LAST) return '\0'; return manifest_test_state_chars[(unsigned int)state]; } static const char* manifest_test_state_label(manifest_test_state state) { if(state > STATE_LAST) return NULL; return manifest_test_state_labels[(unsigned int)state]; } manifest_world* manifest_new_world(rasqal_world* world) { manifest_world* mw; raptor_world* raptor_world_ptr = rasqal_world_get_raptor(world); mw = (manifest_world*)calloc(sizeof(*mw), 1); if(!mw) return NULL; mw->world = world; mw->raptor_world_ptr = raptor_world_ptr; /* Create Namespace URIs, concept URIs and rasqal literal concepts */ mw->rdfs_namespace_uri = raptor_new_uri(raptor_world_ptr, raptor_rdf_schema_namespace_uri); mw->mf_namespace_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"); mw->t_namespace_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://ns.librdf.org/2009/test-manifest#"); mw->qt_namespace_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://www.w3.org/2001/sw/DataAccess/tests/test-query#"); mw->dawgt_namespace_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#"); mw->sd_namespace_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)"http://www.w3.org/ns/sparql-service-description#"); mw->mf_Manifest_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->mf_namespace_uri, (const unsigned char*)"Manifest"); mw->mf_entries_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->mf_namespace_uri, (const unsigned char*)"entries"); mw->mf_name_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->mf_namespace_uri, (const unsigned char*)"name"); mw->mf_action_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->mf_namespace_uri, (const unsigned char*)"action"); mw->mf_result_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->mf_namespace_uri, (const unsigned char*)"result"); mw->mf_resultCardinality_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->mf_namespace_uri, (const unsigned char*)"resultCardinality"); mw->rdf_type_uri = raptor_new_uri_for_rdf_concept(raptor_world_ptr, (const unsigned char*)"type"); mw->rdf_first_uri = raptor_new_uri_for_rdf_concept(raptor_world_ptr, (const unsigned char*)"first"); mw->rdf_rest_uri = raptor_new_uri_for_rdf_concept(raptor_world_ptr, (const unsigned char*)"rest"); mw->rdf_nil_uri = raptor_new_uri_for_rdf_concept(raptor_world_ptr, (const unsigned char*)"nil"); mw->rdfs_comment_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->rdfs_namespace_uri, (const unsigned char*)"comment"); mw->t_path_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->t_namespace_uri, (const unsigned char*)"path"); mw->qt_data_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->qt_namespace_uri, (const unsigned char*)"data"); mw->qt_graphData_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->qt_namespace_uri, (const unsigned char*)"graphData"); mw->qt_query_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->qt_namespace_uri, (const unsigned char*)"query"); mw->dawgt_approval_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->dawgt_namespace_uri, (const unsigned char*)"approval"); mw->sd_entailmentRegime_uri = raptor_new_uri_from_uri_local_name(raptor_world_ptr, mw->sd_namespace_uri, (const unsigned char*)"entailmentRegime"); mw->mf_Manifest_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->mf_Manifest_uri)); mw->mf_entries_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->mf_entries_uri)); mw->mf_name_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->mf_name_uri)); mw->mf_action_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->mf_action_uri)); mw->mf_result_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->mf_result_uri)); mw->mf_resultCardinality_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->mf_resultCardinality_uri)); mw->rdf_type_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->rdf_type_uri)); mw->rdf_first_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->rdf_first_uri)); mw->rdf_rest_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->rdf_rest_uri)); mw->rdfs_comment_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->rdfs_comment_uri)); mw->t_path_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->t_path_uri)); mw->qt_data_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->qt_data_uri)); mw->qt_graphData_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->qt_graphData_uri)); mw->qt_query_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->qt_query_uri)); mw->dawgt_approval_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->dawgt_approval_uri)); mw->sd_entailmentRegime_literal = rasqal_new_uri_literal(world, raptor_uri_copy(mw->sd_entailmentRegime_uri)); return mw; } void manifest_free_world(manifest_world* mw) { if(!mw) return; if(mw->rdfs_namespace_uri) raptor_free_uri(mw->rdfs_namespace_uri); if(mw->mf_namespace_uri) raptor_free_uri(mw->mf_namespace_uri); if(mw->t_namespace_uri) raptor_free_uri(mw->t_namespace_uri); if(mw->qt_namespace_uri) raptor_free_uri(mw->qt_namespace_uri); if(mw->dawgt_namespace_uri) raptor_free_uri(mw->dawgt_namespace_uri); if(mw->sd_namespace_uri) raptor_free_uri(mw->sd_namespace_uri); if(mw->mf_Manifest_uri) raptor_free_uri(mw->mf_Manifest_uri); if(mw->mf_entries_uri) raptor_free_uri(mw->mf_entries_uri); if(mw->mf_name_uri) raptor_free_uri(mw->mf_name_uri); if(mw->mf_action_uri) raptor_free_uri(mw->mf_action_uri); if(mw->mf_result_uri) raptor_free_uri(mw->mf_result_uri); if(mw->mf_resultCardinality_uri) raptor_free_uri(mw->mf_resultCardinality_uri); if(mw->rdf_type_uri) raptor_free_uri(mw->rdf_type_uri); if(mw->rdf_first_uri) raptor_free_uri(mw->rdf_first_uri); if(mw->rdf_rest_uri) raptor_free_uri(mw->rdf_rest_uri); if(mw->rdf_nil_uri) raptor_free_uri(mw->rdf_nil_uri); if(mw->rdfs_comment_uri) raptor_free_uri(mw->rdfs_comment_uri); if(mw->t_path_uri) raptor_free_uri(mw->t_path_uri); if(mw->qt_data_uri) raptor_free_uri(mw->qt_data_uri); if(mw->qt_graphData_uri) raptor_free_uri(mw->qt_graphData_uri); if(mw->qt_query_uri) raptor_free_uri(mw->qt_query_uri); if(mw->dawgt_approval_uri) raptor_free_uri(mw->dawgt_approval_uri); if(mw->sd_entailmentRegime_uri) raptor_free_uri(mw->sd_entailmentRegime_uri); if(mw->mf_Manifest_literal) rasqal_free_literal(mw->mf_Manifest_literal); if(mw->mf_entries_literal) rasqal_free_literal(mw->mf_entries_literal); if(mw->mf_name_literal) rasqal_free_literal(mw->mf_name_literal); if(mw->mf_action_literal) rasqal_free_literal(mw->mf_action_literal); if(mw->mf_result_literal) rasqal_free_literal(mw->mf_result_literal); if(mw->mf_resultCardinality_literal) rasqal_free_literal(mw->mf_resultCardinality_literal); if(mw->rdf_type_literal) rasqal_free_literal(mw->rdf_type_literal); if(mw->rdf_first_literal) rasqal_free_literal(mw->rdf_first_literal); if(mw->rdf_rest_literal) rasqal_free_literal(mw->rdf_rest_literal); if(mw->rdfs_comment_literal) rasqal_free_literal(mw->rdfs_comment_literal); if(mw->t_path_literal) rasqal_free_literal(mw->t_path_literal); if(mw->qt_data_literal) rasqal_free_literal(mw->qt_data_literal); if(mw->qt_graphData_literal) rasqal_free_literal(mw->qt_graphData_literal); if(mw->qt_query_literal) rasqal_free_literal(mw->qt_query_literal); if(mw->dawgt_approval_literal) rasqal_free_literal(mw->dawgt_approval_literal); if(mw->sd_entailmentRegime_literal) rasqal_free_literal(mw->sd_entailmentRegime_literal); free(mw); } static manifest_test_result* manifest_new_test_result(manifest_test_state state) { manifest_test_result* result; int i; result = (manifest_test_result*)calloc(sizeof(*result), 1); if(!result) return NULL; result->state = state; /* total_result->details = NULL; */ for(i = 0; i <= STATE_LAST; i++) result->states[i] = raptor_new_sequence((raptor_data_free_handler)manifest_free_test, NULL); return result; } void manifest_free_test_result(manifest_test_result* result) { int i; if(!result) return; if(result->details) free(result->details); if(result->log) free(result->log); for(i = 0; i <= STATE_LAST; i++) { if(result->states[i]) raptor_free_sequence(result->states[i]); } free(result); } static int manifest_testsuite_result_format(FILE* fh, manifest_test_result* result, const char* ts_name, unsigned indent, int verbose) { raptor_sequence* seq; int i; seq = result->states[STATE_FAIL]; if(seq && raptor_sequence_size(seq)) { manifest_test* t; manifest_indent(fh, indent); fputs("Failed tests:\n", fh); for(i = 0; (t = RASQAL_GOOD_CAST(manifest_test*, raptor_sequence_get_at(seq, i))); i++) { manifest_indent(fh, indent + indent_step); if(verbose) { manifest_banner(fh, banner_width, '='); manifest_indent(fh, indent + indent_step); fprintf(fh, "%s in suite %s\n", t->name, ts_name); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 0 manifest_test_print(fh, t, indent + indent_step); #endif } else { fputs(t->name, fh); fputc('\n', fh); } if(verbose) { if(t->result) { if(t->result->details) { manifest_indent(fh, indent + indent_step); fputs(t->result->details, fh); fputc('\n', fh); } if(t->result->log) { manifest_indent_multiline(fh, t->result->log, indent + indent_step * 2, 15); } } manifest_indent(fh, indent + indent_step); manifest_banner(fh, banner_width, '='); } } } seq = result->states[STATE_UXPASS]; if(seq && raptor_sequence_size(seq)) { manifest_test* t; manifest_indent(fh, indent); fputs("Unexpected passed tests:\n", fh); for(i = 0; (t = RASQAL_GOOD_CAST(manifest_test*, raptor_sequence_get_at(seq, i))); i++) { manifest_indent(fh, indent + indent_step); if(verbose) { manifest_banner(fh, banner_width, '='); manifest_indent(fh, indent + indent_step); fprintf(fh, "%s in suite %s\n", t->name, ts_name); } else { fputs(t->name, fh); fputc('\n', fh); } if(verbose) { if(t->result) { if(t->result->details) { manifest_indent(fh, indent + indent_step); fputs(t->result->details, fh); fputc('\n', fh); } } } } } manifest_indent(fh, indent); for(i = 0; i <= STATE_LAST; i++) { int count = 0; if(i == STATE_XFAIL || i == STATE_UXPASS) continue; seq = result->states[i]; if(seq) count = raptor_sequence_size(seq); fprintf(fh, "%s: %3d ", manifest_test_state_label(RASQAL_GOOD_CAST(manifest_test_state, i)), count); } fputc('\n', fh); return 0; } static unsigned int manifest_decode_test_type(raptor_uri* test_type) { unsigned int flags = 0; const char* str; if(!test_type) return flags; str = (const char*)raptor_uri_as_string(test_type); if(strstr(str, "UpdateEvaluationTest")) return FLAG_IS_UPDATE; if(strstr(str, "ProtocolTest")) return FLAG_IS_PROTOCOL; if(strstr(str, "Syntax")) { flags |= FLAG_IS_SYNTAX; if(strstr(str, "Negative") || strstr(str, "TestBadSyntax")) { flags |= FLAG_MUST_FAIL; } } if(strstr(str, "Test11")) flags |= FLAG_LANG_SPARQL_11; return flags; } /** * manifest_new_test: * @mw: manifest world * @ds: dataset to read from * @entry_node: test identifier node * @dir: directory * * Create a new test from parameters * * These are all input parameters and become owned by this object. * */ static manifest_test* manifest_new_test(manifest_world* mw, rasqal_dataset* ds, rasqal_literal* entry_node, char* dir) { rasqal_literal* node = NULL; const unsigned char* str = NULL; raptor_uri *uri; size_t size; manifest_test* t; char* test_name = NULL; char* test_desc = NULL; rasqal_literal* action_node; raptor_uri* test_query_uri = NULL; raptor_sequence* test_data_graphs = NULL; raptor_uri* test_result_uri = NULL; raptor_uri* test_type = NULL; unsigned int test_flags; rasqal_dataset_term_iterator* iter = NULL; /* Get test fields */ node = rasqal_dataset_get_target(ds, entry_node, mw->mf_name_literal); if(node) { str = rasqal_literal_as_counted_string(node, &size, 0, NULL); if(str) { test_name = (char*)malloc(size + 1); memcpy(test_name, str, size + 1); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test name: '%s'\n", test_name); #endif } } node = rasqal_dataset_get_target(ds, entry_node, mw->rdfs_comment_literal); if(node) { str = rasqal_literal_as_counted_string(node, &size, 0, NULL); if(str) { test_desc = (char*)malloc(size + 1); memcpy(test_desc, str, size + 1); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test desc: '%s'\n", test_desc); #endif } } action_node = rasqal_dataset_get_target(ds, entry_node, mw->mf_action_literal); if(action_node) { #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fputs(" Action node is: ", stderr); rasqal_literal_print(action_node, stderr); fputc('\n', stderr); #endif if(action_node->type == RASQAL_LITERAL_URI) { node = action_node; } else { node = rasqal_dataset_get_target(ds, action_node, mw->qt_query_literal); } if(node && node->type == RASQAL_LITERAL_URI) { uri = rasqal_literal_as_uri(node); if(uri) { test_query_uri = raptor_uri_copy(uri); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test query URI: '%s'\n", raptor_uri_as_string(test_query_uri)); #endif } } test_data_graphs = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, (raptor_data_print_handler)rasqal_data_graph_print); node = rasqal_dataset_get_target(ds, action_node, mw->qt_data_literal); if(node && node->type == RASQAL_LITERAL_URI) { uri = rasqal_literal_as_uri(node); if(uri) { rasqal_data_graph* dg; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test data URI: '%s'\n", raptor_uri_as_string(uri)); #endif dg = rasqal_new_data_graph_from_uri(mw->world, uri, NULL /* graph name URI */, RASQAL_DATA_GRAPH_BACKGROUND, NULL /* format mime type */, NULL /* format/parser name */, NULL /* format URI */); raptor_sequence_push(test_data_graphs, dg); } } iter = rasqal_dataset_get_targets_iterator(ds, action_node, mw->qt_graphData_literal); if(iter) { while(1) { node = rasqal_dataset_term_iterator_get(iter); if(!node) break; if(node->type == RASQAL_LITERAL_URI) { /* FIXME: seen qt:graphData [ qt:graph ; rdfs:label "string" ] */ uri = rasqal_literal_as_uri(node); if(uri) { rasqal_data_graph* dg; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test graph data URI: '%s'\n", raptor_uri_as_string(uri)); #endif dg = rasqal_new_data_graph_from_uri(mw->world, uri, uri, RASQAL_DATA_GRAPH_NAMED, NULL /* format mime type */, NULL /* format/parser name */, NULL /* format URI */); raptor_sequence_push(test_data_graphs, dg); } } if(rasqal_dataset_term_iterator_next(iter)) break; } rasqal_free_dataset_term_iterator(iter); } /* end if graphData iter */ } /* end if action node */ node = rasqal_dataset_get_target(ds, entry_node, mw->mf_result_literal); if(node && node->type == RASQAL_LITERAL_URI) { uri = rasqal_literal_as_uri(node); if(uri) { test_result_uri = raptor_uri_copy(uri); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test result URI: '%s'\n", raptor_uri_as_string(test_result_uri)); #endif } } node = rasqal_dataset_get_target(ds, entry_node, mw->rdf_type_literal); if(node && node->type == RASQAL_LITERAL_URI) { test_type = rasqal_literal_as_uri(node); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test type: '%s'\n", raptor_uri_as_string(test_type)); #endif } test_flags = manifest_decode_test_type(test_type); if(!(test_flags & (FLAG_IS_QUERY | FLAG_IS_UPDATE | FLAG_IS_PROTOCOL | FLAG_IS_SYNTAX) )) { test_flags |= FLAG_IS_QUERY; } /* Get a few more flags from other nodes */ node = rasqal_dataset_get_target(ds, entry_node, mw->mf_resultCardinality_literal); if(node && node->type == RASQAL_LITERAL_URI) { uri = rasqal_literal_as_uri(node); if(uri) { int is_lax; str = raptor_uri_as_string(uri); is_lax = (strstr((const char*)str, "LaxCardinality") != NULL); if(is_lax) test_flags |= FLAG_RESULT_CARDINALITY_LAX; } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test result cardinality: %s\n", (test_flags & FLAG_RESULT_CARDINALITY_LAX) ? "lax" : "strict"); #endif node = rasqal_dataset_get_target(ds, entry_node, mw->dawgt_approval_literal); if(node && node->type == RASQAL_LITERAL_URI) { uri = rasqal_literal_as_uri(node); if(uri) { int is_approved; int is_withdrawn; str = raptor_uri_as_string(uri); is_approved = (strstr((const char*)str, "Approved") != NULL && strstr((const char*)str, "NotApproved") == NULL); is_withdrawn = (strstr((const char*)str, "Withdrawn") != NULL); if(is_approved) test_flags |= FLAG_TEST_APPROVED; if(is_withdrawn) test_flags |= FLAG_TEST_WITHDRAWN; } } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test approved: %s\n", (test_flags & FLAG_TEST_APPROVED) ? "yes" : "no"); fprintf(stderr, " Test withdrawn: %s\n", (test_flags & FLAG_TEST_WITHDRAWN) ? "yes" : "no"); #endif node = rasqal_dataset_get_target(ds, action_node, mw->sd_entailmentRegime_literal); if(node) test_flags |= FLAG_ENTAILMENT; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, " Test entailment: %s\n", (test_flags & FLAG_ENTAILMENT) ? "yes" : "no"); #endif t = (manifest_test*)calloc(sizeof(*t), 1); if(!t) return NULL; t->mw = mw; t->name = test_name; t->desc = test_desc; t->expect = (test_flags & FLAG_MUST_FAIL) ? STATE_FAIL : STATE_PASS; t->dir = dir; t->test_node = rasqal_new_literal_from_literal(entry_node); t->query = test_query_uri; t->data_graphs = test_data_graphs; t->expected_result = test_result_uri; t->flags = test_flags; t->usage = 1; return t; } static manifest_test* manifest_new_test_from_test(manifest_test* t) { t->usage++; return t; } static void manifest_free_test(manifest_test* t) { if(!t) return; if(--t->usage) return; if(t->name) free(t->name); if(t->desc) free(t->desc); if(t->dir) free(t->dir); if(t->test_node) rasqal_free_literal(t->test_node); if(t->query) raptor_free_uri(t->query); if(t->data_graphs) raptor_free_sequence(t->data_graphs); if(t->expected_result) raptor_free_uri(t->expected_result); if(t->result) manifest_free_test_result(t->result); free(t); } const char* manifest_test_get_query_language(manifest_test* t) { const char* language = "sparql"; if(t->flags & FLAG_IS_UPDATE) language = "sparql-update"; if(t->flags & FLAG_LANG_SPARQL_11) language = "sparql11"; return language; } /** * manifest_new_testsuite: * @world: rasqal world * @name: testsuite name * @dir: directory containing testsuite * @uri: manifest URI * @base_uri: manifest base URI * * Create a new testsuite from a manifest */ static manifest_testsuite* manifest_new_testsuite(manifest_world* mw, char *name, char* dir, raptor_uri* uri, raptor_uri* base_uri) { manifest_testsuite *ts; rasqal_dataset* ds = NULL; rasqal_literal* manifest_node = NULL; rasqal_literal* entries_node = NULL; rasqal_literal* list_node = NULL; rasqal_literal* node = NULL; const unsigned char* str = NULL; size_t size; raptor_sequence* tests = NULL; /* Initialize base */ ts = (manifest_testsuite*)calloc(sizeof(*ts), 1); if(!ts) return NULL; ts->mw = mw; ts->state = STATE_PASS; ts->name = strdup(name); /* ts->desc = NULL; */ ts->dir = dir ? strdup(dir) : NULL; /* ts->path = NULL; */ /* ts->tests = NULL; */ /* ts->details = NULL; */ /* Make an RDF graph (dataset) to query */ ds = rasqal_new_dataset(mw->world); if(!ds) { RASQAL_DEBUG1("Failed to create dataset"); manifest_free_testsuite(ts); ts = NULL; goto tidy; } if(rasqal_dataset_load_graph_uri(ds, /* graph name */ NULL, uri, base_uri)) { RASQAL_DEBUG2("Failed to load graph %s into dataset", raptor_uri_as_string(uri)); manifest_free_testsuite(ts); ts = NULL; goto tidy; } manifest_node = rasqal_dataset_get_source(ds, mw->rdf_type_literal, mw->mf_Manifest_literal); if(!manifest_node) { fprintf(stderr, "No manifest found in graph\n"); manifest_free_testsuite(ts); ts = NULL; goto tidy; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 fputs("Manifest node is: ", stderr); rasqal_literal_print(manifest_node, stderr); fputc('\n', stderr); #endif entries_node = rasqal_dataset_get_target(ds, manifest_node, mw->mf_entries_literal); if(!entries_node) { fprintf(stderr, "No tests found in manifest graph\n"); manifest_free_testsuite(ts); ts = NULL; goto tidy; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 2 fputs("Entries node is: ", stderr); rasqal_literal_print(entries_node, stderr); fputc('\n', stderr); #endif /* Get test suite fields */ node = rasqal_dataset_get_target(ds, manifest_node, mw->rdfs_comment_literal); if(node) { str = rasqal_literal_as_counted_string(node, &size, 0, NULL); if(str) { ts->desc = (char*)malloc(size + 1); memcpy(ts->desc, str, size + 1); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "Testsuite Description is: '%s'\n", ts->desc); #endif } } node = rasqal_dataset_get_target(ds, manifest_node, mw->t_path_literal); if(node) { str = rasqal_literal_as_counted_string(node, &size, 0, NULL); if(str) { ts->path = (char*)malloc(size + 1); memcpy(ts->path, str, size + 1); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fprintf(stderr, "Testsuite PATH is: '%s'\n", ts->path); #endif } } tests = raptor_new_sequence((raptor_data_free_handler)manifest_free_test, NULL); for(list_node = entries_node; list_node; ) { rasqal_literal* entry_node; manifest_test* t; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fputs("List node is: ", stderr); rasqal_literal_print(list_node, stderr); fputc('\n', stderr); #endif entry_node = rasqal_dataset_get_target(ds, list_node, mw->rdf_first_literal); #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 1 fputs("Test resource is: ", stderr); rasqal_literal_print(entry_node, stderr); fputc('\n', stderr); #endif t = manifest_new_test(mw, ds, entry_node, dir); if(t) raptor_sequence_push(tests, t); list_node = rasqal_dataset_get_target(ds, list_node, mw->rdf_rest_literal); if(!list_node) break; if(list_node->type == RASQAL_LITERAL_URI) { uri = rasqal_literal_as_uri(list_node); if(uri && raptor_uri_equals(uri, mw->rdf_nil_uri)) break; } } /* end for list_node */ ts->tests = tests; tests = NULL; ts->state = STATE_PASS; ts->details = NULL; tidy: if(ds) rasqal_free_dataset(ds); if(tests) raptor_free_sequence(tests); return ts; } static void manifest_free_testsuite(manifest_testsuite* ts) { if(!ts) return; if(ts->name) free(ts->name); if(ts->desc) free(ts->desc); if(ts->dir) free(ts->dir); if(ts->path) free(ts->path); if(ts->tests) raptor_free_sequence(ts->tests); if(ts->details) free(ts->details); free(ts); } static void manifest_test_run_log_handler(void* user_data, raptor_log_message *message) { manifest_test* t = (manifest_test*)user_data; /* Only interested in errors and more severe */ if(message->level < RAPTOR_LOG_LEVEL_ERROR) return; fprintf(stderr, "%s\n", message->text); t->error_count++; } #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 0 static void manifest_test_print(FILE* fh, manifest_test* t, int indent) { manifest_indent(fh, indent); if(t->desc) fprintf(fh, "Test %s : \"%s\"\n", t->name, t->desc); else fprintf(fh, "Test %s\n", t->name); indent += indent_step; manifest_indent(fh, indent); fprintf(fh, "SPARQL version: %s\n", (t->flags & FLAG_LANG_SPARQL_11) ? "1.1" : "1.0"); manifest_indent(fh, indent); fprintf(fh, "Expect: %s\n", (t->flags & FLAG_MUST_FAIL) ? "fail" : "pass"); manifest_indent(fh, indent); fputs("Flags: ", fh); if(t->flags & FLAG_IS_QUERY) fputs("Query ", fh); if(t->flags & FLAG_IS_UPDATE) fputs("Update ", fh); if(t->flags & FLAG_IS_PROTOCOL) fputs("Protocol ", fh); if(t->flags & FLAG_IS_SYNTAX) fputs("Syntax ", fh); if(t->flags & FLAG_TEST_APPROVED) fputs("Approved ", fh); if(t->flags & FLAG_TEST_WITHDRAWN) fputs("Withdrawn ", fh); if(t->flags & FLAG_RESULT_CARDINALITY_LAX) fputs("LaxCardinality", fh); if(t->flags & FLAG_ENTAILMENT) fputs("Entailment ", fh); fprintf(fh, "(0x%04X)\n", t->flags); if(t->query) { manifest_indent(fh, indent); fprintf(fh, "Query URI: '%s'\n", raptor_uri_as_string(t->query)); } if(t->data_graphs && raptor_sequence_size(t->data_graphs) > 0) { manifest_indent(fh, indent); fputs("Data URIs: ", fh); raptor_sequence_print(t->data_graphs, fh); fputc('\n', fh); } if(t->expected_result) { manifest_indent(fh, indent); fprintf(fh, "Result URI: '%s'\n", raptor_uri_as_string(t->expected_result)); } } #endif /** * manifest_test_run: * @t: test * @path: env PATH * * Run a test * * Return value: a test result or NULL on failure */ static manifest_test_result* manifest_test_run(manifest_test* t, const char* path) { rasqal_world* world = t->mw->world; raptor_world* raptor_world_ptr = t->mw->raptor_world_ptr; manifest_test_result* result; manifest_test_state state = STATE_FAIL; unsigned char* query_string = NULL; const unsigned char* query_uri_string; const char* ql_name; rasqal_query* rq = NULL; raptor_uri* base_uri = NULL; rasqal_query_results_type results_type; rasqal_query_results* expected_results = NULL; char* result_filename = NULL; raptor_iostream* result_iostr = NULL; rasqal_query_results *actual_results = NULL; #if defined(RASQAL_DEBUG) && RASQAL_DEBUG > 0 RASQAL_DEBUG1("Running "); manifest_test_print(stderr, t, 0); #endif if(t && t->flags & (FLAG_IS_UPDATE | FLAG_IS_PROTOCOL)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_WARN, NULL, "Ignoring test %s type UPDATE / PROTOCOL - not supported\n", rasqal_literal_as_string(t->test_node)); return NULL; } result = manifest_new_test_result(STATE_FAIL); if(!result) goto tidy; if(!t->query) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_WARN, NULL, "Ignoring test %s with no query - not supported\n", rasqal_literal_as_string(t->test_node)); return NULL; } /* Read query from file into a string */ query_uri_string = raptor_uri_as_string(t->query); if(raptor_uri_uri_string_is_file_uri(query_uri_string)) { char* query_filename = raptor_uri_uri_string_to_filename(query_uri_string); query_string = rasqal_cmdline_read_file_string(world, query_filename, "query file", NULL); raptor_free_memory(query_filename); } else { raptor_www *www; www = raptor_new_www(raptor_world_ptr); if(www) { raptor_www_fetch_to_string(www, t->query, (void**)&query_string, NULL, rasqal_alloc_memory); raptor_free_www(www); } } if(!query_string) { manifest_free_test_result(result); result = NULL; goto tidy; } ql_name = manifest_test_get_query_language(t); RASQAL_DEBUG4("Read %lu bytes '%s' query string from %s\n", strlen((const char*)query_string), ql_name, query_uri_string); /* Parse and prepare query */ rq = rasqal_new_query(world, ql_name, NULL); if(!rq) { RASQAL_DEBUG2("Failed to create query in language %s\n", ql_name); manifest_free_test_result(result); result = NULL; goto tidy; } if(rasqal_query_prepare(rq, (const unsigned char*)query_string, base_uri)) state = STATE_FAIL; else state = STATE_PASS; /* Query prepared / parsed OK so for a syntax test, we are done */ if(t->flags & FLAG_IS_SYNTAX) goto returnresult; else if(state == STATE_FAIL) { /* Otherwise for non-syntax test, stop at a failure */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Parsing %s query '%s' failed", ql_name, query_string); goto setreturnresult; } /* Default to failure so we just need to set passes */ state = STATE_FAIL; /* Add any data graphs */ if(t->data_graphs) { rasqal_data_graph* dg; while((dg = (rasqal_data_graph*)raptor_sequence_pop(t->data_graphs))) { if(rasqal_query_add_data_graph(rq, dg)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Failed to add data graph %s to query", raptor_uri_as_string(dg->uri)); manifest_free_test_result(result); result = NULL; goto tidy; } } } /* we now know the query details such as result type */ /* Read expected results */ results_type = rasqal_query_get_result_type(rq); RASQAL_DEBUG2("Expecting result type %s\n", rasqal_query_results_type_label(results_type)); if(t->expected_result) { unsigned char* expected_result_uri_string; /* Read result file */ expected_result_uri_string = raptor_uri_as_string(t->expected_result); if(raptor_uri_uri_string_is_file_uri(expected_result_uri_string)) { result_filename = raptor_uri_uri_string_to_filename(expected_result_uri_string); result_iostr = raptor_new_iostream_from_filename(raptor_world_ptr, result_filename); if(!result_iostr) rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Result file '%s' open failed - %s", result_filename, strerror(errno)); } else rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Result '%s' is not a local file", expected_result_uri_string); if(!result_iostr) { manifest_free_test_result(result); result = NULL; goto tidy; } RASQAL_DEBUG3("Reading result type %s from file %s\n", rasqal_query_results_type_label(results_type), result_filename); switch(results_type) { case RASQAL_QUERY_RESULTS_BINDINGS: case RASQAL_QUERY_RESULTS_BOOLEAN: /* read results via rasqal query results format */ expected_results = rasqal_cmdline_read_results(world, raptor_world_ptr, results_type, result_iostr, result_filename, /* format name */ NULL); raptor_free_iostream(result_iostr); result_iostr = NULL; if(!expected_results) { RASQAL_DEBUG1("Failed to create query results\n"); manifest_free_test_result(result); result = NULL; goto tidy; } #if defined(RASQAL_DEBUG) if(results_type == RASQAL_QUERY_RESULTS_BINDINGS) { RASQAL_DEBUG1("Expected bindings results:\n"); if(!expected_results) fprintf(stderr, "NO RESULTS\n"); else { rasqal_cmdline_print_bindings_results_simple("fake", expected_results, stderr, 1, 0); rasqal_query_results_rewind(expected_results); } } else { int expected_boolean = rasqal_query_results_get_boolean(expected_results); RASQAL_DEBUG2("Expected boolean result: %d\n", expected_boolean); } #endif break; case RASQAL_QUERY_RESULTS_GRAPH: /* read results via raptor parser */ if(1) { const char* format_name = DEFAULT_RESULT_FORMAT_NAME; rasqal_dataset* ds; ds = rasqal_new_dataset(world); if(!ds) { RASQAL_DEBUG1("Failed to create dataset\n"); manifest_free_test_result(result); result = NULL; goto tidy; } if(rasqal_dataset_load_graph_iostream(ds, format_name, result_iostr, t->expected_result)) { RASQAL_DEBUG1("Failed to load graph into dataset\n"); manifest_free_test_result(result); result = NULL; goto tidy; } raptor_free_iostream(result_iostr); result_iostr = NULL; #ifdef RASQAL_DEBUG rasqal_dataset_print(ds, stderr); #endif /* FIXME * * The code at this point should do something with triples * in the dataset; save them for later to compare them to * the expected triples. that requires a triples compare * OR a true RDF graph compare. * * Deleting the dataset here frees the triples just loaded. */ RASQAL_DEBUG1("No support for comparing RDF graph results\n"); rasqal_free_dataset(ds); ds = NULL; } break; case RASQAL_QUERY_RESULTS_SYNTAX: case RASQAL_QUERY_RESULTS_UNKNOWN: /* failure */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Reading %s query results format is not supported", rasqal_query_results_type_label(results_type)); manifest_free_test_result(result); result = NULL; goto tidy; } } /* end if results expected */ /* save results for query execution so we can print and rewind */ rasqal_query_set_store_results(rq, 1); actual_results = rasqal_query_execute(rq); #if defined(RASQAL_DEBUG) /* Debug print what we got */ if(actual_results) { switch(results_type) { case RASQAL_QUERY_RESULTS_BINDINGS: RASQAL_DEBUG1("Actual bindings results:\n"); rasqal_cmdline_print_bindings_results_simple("fake", actual_results, stderr, 1, 0); rasqal_query_results_rewind(actual_results); break; case RASQAL_QUERY_RESULTS_BOOLEAN: if(1) { int actual_boolean = rasqal_query_results_get_boolean(actual_results); RASQAL_DEBUG2("Actual boolean result: %d\n", actual_boolean); } break; case RASQAL_QUERY_RESULTS_GRAPH: RASQAL_DEBUG1("Actual RDF graph result: (cannot be printed yet)\n"); break; case RASQAL_QUERY_RESULTS_SYNTAX: case RASQAL_QUERY_RESULTS_UNKNOWN: /* failure */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Query result format %s (%d) cannot be printed.", rasqal_query_results_type_label(results_type), results_type); state = STATE_FAIL; goto tidy; } } #endif /* Check actual vs expected */ if(actual_results) { if(!expected_results) state = STATE_PASS; else switch(results_type) { case RASQAL_QUERY_RESULTS_BINDINGS: if(1) { int rc; rasqal_results_compare* rrc; /* FIXME: should NOT do this if results are expected to be ordered */ rasqal_query_results_sort(expected_results); rasqal_query_results_sort(actual_results); rrc = rasqal_new_results_compare(world, expected_results, "expected", actual_results, "actual"); t->error_count = 0; rasqal_results_compare_set_log_handler(rrc, t, manifest_test_run_log_handler); rc = rasqal_results_compare_compare(rrc); RASQAL_DEBUG3("rasqal_results_compare_compare returned %d - %s\n", rc, (rc ? "equal" : "different")); rasqal_free_results_compare(rrc); rrc = NULL; if(rc && !t->error_count) state = STATE_PASS; } break; case RASQAL_QUERY_RESULTS_BOOLEAN: if(1) { int rc; int expected_boolean = rasqal_query_results_get_boolean(expected_results); int actual_boolean = rasqal_query_results_get_boolean(actual_results); rc = !(expected_boolean == actual_boolean); if(!rc) state = STATE_PASS; } break; case RASQAL_QUERY_RESULTS_GRAPH: case RASQAL_QUERY_RESULTS_SYNTAX: case RASQAL_QUERY_RESULTS_UNKNOWN: /* failure */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Query result format %s (%d) cannot be checked.", rasqal_query_results_type_label(results_type), results_type); state = STATE_FAIL; goto tidy; } } else { /* no actual results */ if(expected_results) /* FAIL: expected results but got none */ state = STATE_FAIL; } returnresult: RASQAL_DEBUG3("Test result state %s expected %s\n", manifest_test_state_label(state), manifest_test_state_label(t->expect)); if(t->expect == STATE_FAIL) { if(state == STATE_FAIL) { state = STATE_PASS; result->details = strdup("Test failed as expected"); } else { state = STATE_FAIL; result->details = strdup("Test passed but expected to fail"); } } setreturnresult: if(result) result->state = state; RASQAL_DEBUG2("Test result: %s\n", manifest_test_state_label(state)); tidy: if(result_iostr) raptor_free_iostream(result_iostr); if(actual_results) rasqal_free_query_results(actual_results); if(expected_results) rasqal_free_query_results(expected_results); if(result_filename) raptor_free_memory(result_filename); if(rq) rasqal_free_query(rq); if(query_string) rasqal_free_memory(query_string); return result; } static int manifest_test_matches_string(manifest_test* t, const char* test_string) { int found = 0; const char* s = RASQAL_GOOD_CAST(const char*, rasqal_literal_as_string(t->test_node)); found = (t->name && !strcmp(t->name, test_string)) || (s && !strcmp(s, test_string)); return found; } static int manifest_testsuite_select_tests_by_string(manifest_testsuite* ts, const char* string) { raptor_sequence* seq; seq = raptor_new_sequence((raptor_data_free_handler)manifest_free_test, NULL); if(!seq) return -1; if(string) { manifest_test* t; while((t = (manifest_test*)raptor_sequence_pop(ts->tests))) { if(manifest_test_matches_string(t, string)) { raptor_sequence_push(seq, t); break; } else manifest_free_test(t); } } raptor_free_sequence(ts->tests); ts->tests = seq; return raptor_sequence_size(ts->tests); } manifest_test_result* manifest_testsuite_run_suite(manifest_testsuite* ts, unsigned int indent, int dryrun, int verbose, int approved) { rasqal_world* world = ts->mw->world; char* name = ts->name; char* desc = ts->desc ? ts->desc : name; int i; unsigned int expected_failures_count = 0; manifest_test* t = NULL; unsigned int column; manifest_test_result* result; manifest_test_state state; unsigned int failed_count; /* Initialize */ result = manifest_new_test_result(STATE_FAIL); /* Run testsuite */ manifest_indent(stdout, indent); fprintf(stdout, "Running testsuite %s: %s\n", name, desc); column = indent; for(i = 0; (t = (manifest_test*)raptor_sequence_get_at(ts->tests, i)); i++) { if(t->flags & (FLAG_IS_UPDATE | FLAG_IS_PROTOCOL)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_WARN, NULL, "Ignoring test %s type UPDATE / PROTOCOL - not supported\n", rasqal_literal_as_string(t->test_node)); t->result = manifest_new_test_result(STATE_SKIP); } else if(approved && !(t->flags & (FLAG_TEST_APPROVED))) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_WARN, NULL, "Ignoring test %s - unapproved\n", rasqal_literal_as_string(t->test_node)); t->result = manifest_new_test_result(STATE_SKIP); } else if(dryrun) { t->result = manifest_new_test_result(STATE_SKIP); } else { t->result = manifest_test_run(t, ts->path); } if(t->expect == STATE_FAIL) expected_failures_count++; if(t->result) state = t->result->state; else { RASQAL_DEBUG2("Test %s returned no result - failing\n", rasqal_literal_as_string(t->test_node)); state = STATE_FAIL; } if(!verbose) fputc(manifest_test_state_char(state), stdout); raptor_sequence_push(result->states[(unsigned int)state], manifest_new_test_from_test(t)); column++; if(!verbose && column > linewrap) { fputc('\n', stdout); manifest_indent(stdout, indent); column = indent; } if(verbose) { const char* label = manifest_test_state_label(state); unsigned int my_indent = indent + indent_step; manifest_indent(stdout, my_indent); fputs(t->name, stdout); fputs(": ", stdout); fputs(label, stdout); if(t->result) { if(t->result->details) { fputs(" - ", stdout); fputs(t->result->details, stdout); } } fputc('\n', stdout); if(verbose > 1) { if(state == STATE_FAIL && t->result && t->result->log) { manifest_indent_multiline(stdout, t->result->log, indent, -1); } } } } if(!verbose) fputc('\n', stderr); failed_count = raptor_sequence_size(result->states[STATE_FAIL]); result->state = !failed_count ? STATE_PASS : STATE_FAIL; return result; } /** * manifest_manifests_run: * @world: world * @manifest_uris: sequence of #raptor_uri manifest URIs * @base_uri: base URI for manifest * @test_string: string for running just one test (by name or URI) * @indent: indent size * @dryrun: dryrun * @verbose: verbose * @approved: approved * * Run the given manifest testsuites returning a test result * * Return value: test result or NULL on failure */ manifest_test_result* manifest_manifests_run(manifest_world* mw, raptor_sequence* manifest_uris, raptor_uri* base_uri, const char* test_string, unsigned int indent, int dryrun, int verbose, int approved) { manifest_test_state total_state = STATE_PASS; manifest_test_result* total_result = NULL; raptor_uri* uri; int i = 0; total_result = manifest_new_test_result(STATE_PASS); if(!total_result) return NULL; for(i = 0; (uri = (raptor_uri*)raptor_sequence_get_at(manifest_uris, i)); i++) { int j; manifest_testsuite *ts; manifest_test_result* result = NULL; char* testsuite_name = (char*)raptor_uri_as_string(uri); ts = manifest_new_testsuite(mw, /* name */ testsuite_name, /* dir */ NULL, uri, base_uri); if(!ts) { RASQAL_DEBUG2("Failed to create test suite %s\n", testsuite_name); total_state = STATE_FAIL; break; } if(test_string) manifest_testsuite_select_tests_by_string(ts, test_string); result = manifest_testsuite_run_suite(ts, indent, dryrun, verbose, approved); if(result) { manifest_testsuite_result_format(stdout, result, ts->name, indent + indent_step, verbose); for(j = 0; j <= STATE_LAST; j++) raptor_sequence_join(total_result->states[j], result->states[j]); if(result->state == STATE_FAIL) { RASQAL_DEBUG2("Testsuite %s returned fail\n", ts->name); total_state = STATE_FAIL; } manifest_free_test_result(result); } else { RASQAL_DEBUG2("Testsuite %s failed to return result object\n", ts->name); total_state = STATE_FAIL; } if(i > 1) fputc('\n', stdout); if(ts) manifest_free_testsuite(ts); } total_result->state = total_state; manifest_indent(stdout, indent); fputs("Testsuites summary:\n", stdout); manifest_testsuite_result_format(stdout, total_result, "total", indent + indent_step, verbose); if(verbose) { manifest_indent(stdout, indent); fprintf(stdout, "Result status: %d\n", total_state); } return total_result; } rasqal-0.9.33/utils/results.c0000644000175000017500000001105412343762317013030 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * results.c - Rasqal command line results utility functions * * Copyright (C) 2013, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include "rasqalcmdline.h" rasqal_query_results* rasqal_cmdline_read_results(rasqal_world* world, raptor_world* raptor_world_ptr, rasqal_query_results_type results_type, raptor_iostream* result_iostr, const char* result_filename, const char* result_format_name) { rasqal_query_results_formatter* qrf = NULL; unsigned char *query_results_base_uri_string = NULL; raptor_uri* query_results_base_uri = NULL; rasqal_query_results* results = NULL; int rc; query_results_base_uri_string = raptor_uri_filename_to_uri_string(result_filename); query_results_base_uri = raptor_new_uri(raptor_world_ptr, query_results_base_uri_string); raptor_free_memory(query_results_base_uri_string); results = rasqal_new_query_results2(world, NULL, results_type); if(!results) goto tidy_fail; if(result_format_name) { /* check name */ if(!rasqal_query_results_formats_check2(world, result_format_name, NULL /* uri */, NULL /* mime type */, RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER)) return NULL; } else { /* or use default */ result_format_name = rasqal_world_guess_query_results_format_name(world, NULL /* uri */, NULL /* mime_type */, NULL /* buffer */, 0, (const unsigned char*)result_filename); } qrf = rasqal_new_query_results_formatter(world, result_format_name, NULL /* mime type */, NULL /* uri */); if(!qrf) goto tidy_fail; rc = rasqal_query_results_formatter_read(world, result_iostr, qrf, results, query_results_base_uri); rasqal_free_query_results_formatter(qrf); qrf = NULL; raptor_free_uri(query_results_base_uri); query_results_base_uri = NULL; if(rc) goto tidy_fail; return results; tidy_fail: if(results) rasqal_free_query_results(results); if(query_results_base_uri) raptor_free_uri(query_results_base_uri); return NULL; } void rasqal_cmdline_print_bindings_results_simple(const char* program, rasqal_query_results *results, FILE* output, int quiet, int count) { if(!quiet) fprintf(stderr, "%s: Query has a variable bindings result\n", program); while(!rasqal_query_results_finished(results)) { if(!count) { int i; fputs("row: [", output); for(i = 0; i < rasqal_query_results_get_bindings_count(results); i++) { const unsigned char *name; rasqal_literal *value; name = rasqal_query_results_get_binding_name(results, i); value = rasqal_query_results_get_binding_value(results, i); if(i > 0) fputs(", ", output); fprintf(output, "%s=", name); rasqal_literal_print(value, output); } fputs("]\n", output); } rasqal_query_results_next(results); } if(!quiet) fprintf(stderr, "%s: Query returned %d results\n", program, rasqal_query_results_get_count(results)); } rasqal-0.9.33/utils/roqet.c0000644000175000017500000012474712441120534012463 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * roqet.c - Rasqal RDF Query utility * * Copyright (C) 2004-2013, David Beckett http://www.dajobe.org/ * Copyright (C) 2004-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. * * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_ERRNO_H #include #endif /* for access() and R_OK */ #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_GETOPT_H #include #endif #ifndef HAVE_GETOPT #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif /* Rasqal includes */ #include #ifdef RASQAL_INTERNAL #include #endif #include "rasqalcmdline.h" #ifdef NEED_OPTIND_DECLARATION extern int optind; extern char *optarg; #endif int main(int argc, char *argv[]); static char *program=NULL; #ifdef HAVE_GETOPT_LONG #define HELP_TEXT(short, long, description) " -" short ", --" long " " description #define HELP_TEXT_LONG(long, description) " --" long " " description #define HELP_ARG(short, long) "--" #long #define HELP_PAD "\n " #else #define HELP_TEXT(short, long, description) " -" short " " description #define HELP_TEXT_LONG(long, description) #define HELP_ARG(short, long) "-" #short #define HELP_PAD "\n " #endif #ifdef RASQAL_INTERNAL /* add 'g:' */ #define GETOPT_STRING "cd:D:e:Ef:F:g:G:hi:np:qr:R:s:t:vW:" #else #define GETOPT_STRING "cd:D:e:Ef:F:G:hi:np:qr:R:s:t:vW:" #endif #ifdef HAVE_GETOPT_LONG #ifdef RASQAL_INTERNAL #define STORE_RESULTS_FLAG 0x100 #endif static struct option long_options[] = { /* name, has_arg, flag, val */ {"count", 0, 0, 'c'}, {"dump-query", 1, 0, 'd'}, {"data", 1, 0, 'D'}, {"exec", 1, 0, 'e'}, {"ignore-errors", 0, 0, 'E'}, {"feature", 1, 0, 'f'}, {"format", 1, 0, 'F'}, {"named", 1, 0, 'G'}, {"help", 0, 0, 'h'}, {"input", 1, 0, 'i'}, {"dryrun", 0, 0, 'n'}, {"protocol", 0, 0, 'p'}, {"quiet", 0, 0, 'q'}, {"results", 1, 0, 'r'}, {"results-input-format", 1, 0, 'R'}, {"source", 1, 0, 's'}, {"results-input", 1, 0, 't'}, {"version", 0, 0, 'v'}, {"warnings", 1, 0, 'W'}, #ifdef STORE_RESULTS_FLAG {"store-results", 1, 0, STORE_RESULTS_FLAG}, #endif {NULL, 0, 0, 0} }; #endif static int error_count = 0; static int warning_count = 0; static int warning_level = -1; static int ignore_errors = 0; static const char *title_string = "Rasqal RDF query utility "; #define MAX_QUERY_ERROR_REPORT_LEN 512 static void roqet_log_handler(void *data, raptor_log_message *message) { switch(message->level) { case RAPTOR_LOG_LEVEL_FATAL: case RAPTOR_LOG_LEVEL_ERROR: if(!ignore_errors) { fprintf(stderr, "%s: Error - ", program); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); } error_count++; break; case RAPTOR_LOG_LEVEL_WARN: if(warning_level > 0) { fprintf(stderr, "%s: Warning - ", program); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); } warning_count++; break; case RAPTOR_LOG_LEVEL_NONE: case RAPTOR_LOG_LEVEL_TRACE: case RAPTOR_LOG_LEVEL_DEBUG: case RAPTOR_LOG_LEVEL_INFO: fprintf(stderr, "%s: Unexpected %s message - ", program, raptor_log_level_get_label(message->level)); raptor_locator_print(message->locator, stderr); fprintf(stderr, " - %s\n", message->text); break; } } #define SPACES_LENGTH 80 static const char spaces[SPACES_LENGTH + 1] = " "; static void roqet_write_indent(FILE *fh, unsigned int indent) { while(indent > 0) { unsigned int sp = (indent > SPACES_LENGTH) ? SPACES_LENGTH : indent; (void)fwrite(spaces, sizeof(char), sp, fh); indent -= sp; } } static void roqet_graph_pattern_walk(rasqal_graph_pattern *gp, int gp_index, FILE *fh, unsigned int indent) { int triple_index = 0; rasqal_graph_pattern_operator op; int seen; raptor_sequence *seq; int idx; rasqal_expression* expr; rasqal_variable* var; rasqal_literal* literal; op = rasqal_graph_pattern_get_operator(gp); roqet_write_indent(fh, indent); fprintf(fh, "%s graph pattern", rasqal_graph_pattern_operator_as_string(op)); idx = rasqal_graph_pattern_get_index(gp); if(idx >= 0) fprintf(fh, "[%d]", idx); if(gp_index >= 0) fprintf(fh, " #%d", gp_index); fputs(" {\n", fh); indent += 2; /* look for LET variable and value */ var = rasqal_graph_pattern_get_variable(gp); if(var) { roqet_write_indent(fh, indent); fprintf(fh, "%s := ", var->name); rasqal_expression_print(var->expression, fh); } /* look for GRAPH literal */ literal = rasqal_graph_pattern_get_origin(gp); if(literal) { roqet_write_indent(fh, indent); fputs("origin ", fh); rasqal_literal_print(literal, fh); fputc('\n', fh); } /* look for SERVICE literal */ literal = rasqal_graph_pattern_get_service(gp); if(literal) { roqet_write_indent(fh, indent); rasqal_literal_print(literal, fh); fputc('\n', fh); } /* look for triples */ seen = 0; while(1) { rasqal_triple* t; t = rasqal_graph_pattern_get_triple(gp, triple_index); if(!t) break; if(!seen) { roqet_write_indent(fh, indent); fputs("triples {\n", fh); seen = 1; } roqet_write_indent(fh, indent + 2); fprintf(fh, "triple #%d { ", triple_index); rasqal_triple_print(t, fh); fputs(" }\n", fh); triple_index++; } if(seen) { roqet_write_indent(fh, indent); fputs("}\n", fh); } /* look for sub-graph patterns */ seq = rasqal_graph_pattern_get_sub_graph_pattern_sequence(gp); if(seq && raptor_sequence_size(seq) > 0) { roqet_write_indent(fh, indent); fprintf(fh, "sub-graph patterns (%d) {\n", raptor_sequence_size(seq)); gp_index = 0; while(1) { rasqal_graph_pattern* sgp; sgp = rasqal_graph_pattern_get_sub_graph_pattern(gp, gp_index); if(!sgp) break; roqet_graph_pattern_walk(sgp, gp_index, fh, indent + 2); gp_index++; } roqet_write_indent(fh, indent); fputs("}\n", fh); } /* look for filter */ expr = rasqal_graph_pattern_get_filter_expression(gp); if(expr) { roqet_write_indent(fh, indent); fputs("filter { ", fh); rasqal_expression_print(expr, fh); fputs("}\n", fh); } indent -= 2; roqet_write_indent(fh, indent); fputs("}\n", fh); } static void roqet_query_write_variable(FILE* fh, rasqal_variable* v) { fputs((const char*)v->name, fh); if(v->expression) { fputc('=', fh); rasqal_expression_print(v->expression, fh); } } static void roqet_query_walk(rasqal_query *rq, FILE *fh, unsigned int indent) { rasqal_query_verb verb; int i; rasqal_graph_pattern* gp; raptor_sequence *seq; verb = rasqal_query_get_verb(rq); roqet_write_indent(fh, indent); fprintf(fh, "query verb: %s\n", rasqal_query_verb_as_string(verb)); i = rasqal_query_get_distinct(rq); if(i != 0) { roqet_write_indent(fh, indent); fprintf(fh, "query asks for distinct results\n"); } i = rasqal_query_get_limit(rq); if(i >= 0) { roqet_write_indent(fh, indent); fprintf(fh, "query asks for result limits %d\n", i); } i = rasqal_query_get_offset(rq); if(i >= 0) { roqet_write_indent(fh, indent); fprintf(fh, "query asks for result offset %d\n", i); } seq = rasqal_query_get_bound_variable_sequence(rq); if(seq && raptor_sequence_size(seq) > 0) { int size = raptor_sequence_size(seq); fprintf(fh, "query projected variable names (%d): ", size); i = 0; while(1) { rasqal_variable* v = (rasqal_variable*)raptor_sequence_get_at(seq, i); if(!v) break; if(i > 0) fputs(", ", fh); fputs((const char*)v->name, fh); i++; } fputc('\n', fh); fprintf(fh, "query bound variables (%d): ", size); i = 0; while(1) { rasqal_variable* v = (rasqal_variable*)raptor_sequence_get_at(seq, i); if(!v) break; if(i > 0) fputs(", ", fh); roqet_query_write_variable(fh, v); i++; } fputc('\n', fh); } gp = rasqal_query_get_query_graph_pattern(rq); if(!gp) return; seq = rasqal_query_get_construct_triples_sequence(rq); if(seq && raptor_sequence_size(seq) > 0) { roqet_write_indent(fh, indent); fprintf(fh, "query construct triples (%d) {\n", raptor_sequence_size(seq)); i = 0; while(1) { rasqal_triple* t = rasqal_query_get_construct_triple(rq, i); if(!t) break; roqet_write_indent(fh, indent + 2); fprintf(fh, "triple #%d { ", i); rasqal_triple_print(t, fh); fputs(" }\n", fh); i++; } roqet_write_indent(fh, indent); fputs("}\n", fh); } /* look for binding rows */ seq = rasqal_query_get_bindings_variables_sequence(rq); if(seq) { roqet_write_indent(fh, indent); fprintf(fh, "bindings variables (%d): ", raptor_sequence_size(seq)); i = 0; while(1) { rasqal_variable* v = rasqal_query_get_bindings_variable(rq, i); if(!v) break; if(i > 0) fputs(", ", fh); roqet_query_write_variable(fh, v); i++; } fputc('\n', fh); seq = rasqal_query_get_bindings_rows_sequence(rq); fprintf(fh, "bindings rows (%d) {\n", raptor_sequence_size(seq)); i = 0; while(1) { rasqal_row* row; row = rasqal_query_get_bindings_row(rq, i); if(!row) break; roqet_write_indent(fh, indent + 2); fprintf(fh, "row #%d { ", i); rasqal_row_print(row, fh); fputs("}\n", fh); i++; } } fputs("query ", fh); roqet_graph_pattern_walk(gp, -1, fh, indent); } typedef enum { QUERY_OUTPUT_UNKNOWN, QUERY_OUTPUT_NONE, QUERY_OUTPUT_DEBUG, QUERY_OUTPUT_STRUCTURE, QUERY_OUTPUT_SPARQL, QUERY_OUTPUT_LAST = QUERY_OUTPUT_SPARQL } query_output_format; const char* query_output_format_labels[QUERY_OUTPUT_LAST + 1][2] = { { NULL, NULL }, { "none", "No debug data" }, { "debug", "Debug query dump (output format may change)" }, { "structure", "Query structure walk (output format may change)" }, { "sparql", "SPARQL" } }; static void print_boolean_result_simple(rasqal_query_results *results, FILE* output, int quiet) { fprintf(stderr, "%s: Query has a boolean result: %s\n", program, rasqal_query_results_get_boolean(results) ? "true" : "false"); } static int print_graph_result(rasqal_query* rq, rasqal_query_results *results, raptor_world* raptor_world_ptr, FILE* output, const char* serializer_syntax_name, raptor_uri* base_uri, int quiet) { int triple_count = 0; rasqal_prefix* prefix; int i; raptor_serializer* serializer = NULL; if(!quiet) fprintf(stderr, "%s: Query has a graph result:\n", program); if(!raptor_world_is_serializer_name(raptor_world_ptr, serializer_syntax_name)) { fprintf(stderr, "%s: invalid query result serializer name `%s' for `" HELP_ARG(r, results) "'\n", program, serializer_syntax_name); return 1; } serializer = raptor_new_serializer(raptor_world_ptr, serializer_syntax_name); if(!serializer) { fprintf(stderr, "%s: Failed to create raptor serializer type %s\n", program, serializer_syntax_name); return(1); } /* Declare any query namespaces in the output serializer */ for(i = 0; (prefix = rasqal_query_get_prefix(rq, i)); i++) raptor_serializer_set_namespace(serializer, prefix->uri, prefix->prefix); raptor_serializer_start_to_file_handle(serializer, base_uri, output); while(1) { raptor_statement *rs = rasqal_query_results_get_triple(results); if(!rs) break; raptor_serializer_serialize_statement(serializer, rs); triple_count++; if(rasqal_query_results_next_triple(results)) break; } raptor_serializer_serialize_end(serializer); raptor_free_serializer(serializer); if(!quiet) fprintf(stderr, "%s: Total %d triples\n", program, triple_count); return 0; } static int print_formatted_query_results(rasqal_world* world, rasqal_query_results* results, raptor_world* raptor_world_ptr, FILE* output, const char* result_format_name, raptor_uri* base_uri, int quiet) { raptor_iostream *iostr; rasqal_query_results_formatter* results_formatter; int rc = 0; results_formatter = rasqal_new_query_results_formatter(world, result_format_name, NULL, NULL); if(!results_formatter) { fprintf(stderr, "%s: Invalid bindings result format `%s'\n", program, result_format_name); rc = 1; goto tidy; } iostr = raptor_new_iostream_to_file_handle(raptor_world_ptr, output); if(!iostr) { rasqal_free_query_results_formatter(results_formatter); rc = 1; goto tidy; } rc = rasqal_query_results_formatter_write(iostr, results_formatter, results, base_uri); raptor_free_iostream(iostr); rasqal_free_query_results_formatter(results_formatter); tidy: if(rc) fprintf(stderr, "%s: Formatting query results failed\n", program); return rc; } static rasqal_query_results* roqet_call_sparql_service(rasqal_world* world, raptor_uri* service_uri, const unsigned char* query_string, raptor_sequence* data_graphs, const char* format) { rasqal_service* svc; rasqal_query_results* results; svc = rasqal_new_service(world, service_uri, query_string, data_graphs); if(!svc) { fprintf(stderr, "%s: Failed to create service object\n", program); return NULL; } rasqal_service_set_format(svc, format); results = rasqal_service_execute(svc); rasqal_free_service(svc); return results; } static rasqal_query* roqet_init_query(rasqal_world *world, const char* ql_name, const char* ql_uri, const unsigned char* query_string, raptor_uri* base_uri, rasqal_feature query_feature, int query_feature_value, const unsigned char* query_feature_string_value, int store_results, raptor_sequence* data_graphs) { rasqal_query* rq; rq = rasqal_new_query(world, (const char*)ql_name, (const unsigned char*)ql_uri); if(!rq) { fprintf(stderr, "%s: Failed to create query name %s\n", program, ql_name); goto tidy_query; } if(query_feature_value >= 0) rasqal_query_set_feature(rq, query_feature, query_feature_value); if(query_feature_string_value) rasqal_query_set_feature_string(rq, query_feature, query_feature_string_value); #ifdef STORE_RESULTS_FLAG if(store_results >= 0) rasqal_query_set_store_results(rq, store_results); #endif if(rasqal_query_prepare(rq, query_string, base_uri)) { size_t len = strlen((const char*)query_string); fprintf(stderr, "%s: Parsing query '", program); if(len > MAX_QUERY_ERROR_REPORT_LEN) { (void)fwrite(query_string, RASQAL_GOOD_CAST(size_t, MAX_QUERY_ERROR_REPORT_LEN), sizeof(char), stderr); fprintf(stderr, "...' (%d bytes) failed\n", RASQAL_BAD_CAST(int, len)); } else { (void)fwrite(query_string, len, sizeof(char), stderr); fputs("' failed\n", stderr); } rasqal_free_query(rq); rq = NULL; goto tidy_query; } if(data_graphs) { rasqal_data_graph* dg; while((dg = (rasqal_data_graph*)raptor_sequence_pop(data_graphs))) { if(rasqal_query_add_data_graph(rq, dg)) { fprintf(stderr, "%s: Failed to add data graph to query\n", program); goto tidy_query; } } } tidy_query: return rq; } static void roqet_print_query(rasqal_query* rq, raptor_world* raptor_world_ptr, query_output_format output_format, raptor_uri* base_uri) { fprintf(stderr, "Query:\n"); switch(output_format) { case QUERY_OUTPUT_NONE: break; case QUERY_OUTPUT_DEBUG: rasqal_query_print(rq, stdout); break; case QUERY_OUTPUT_STRUCTURE: roqet_query_walk(rq, stdout, 0); break; case QUERY_OUTPUT_SPARQL: if(1) { raptor_iostream* output_iostr; output_iostr = raptor_new_iostream_to_file_handle(raptor_world_ptr, stdout); rasqal_query_write(output_iostr, rq, NULL, base_uri); raptor_free_iostream(output_iostr); } break; case QUERY_OUTPUT_UNKNOWN: default: fprintf(stderr, "%s: Unknown query output format %u\n", program, output_format); abort(); } } /* Default parser for input graphs */ #define DEFAULT_DATA_GRAPH_FORMAT "guess" /* Default serializer for output graphs */ #define DEFAULT_GRAPH_FORMAT "ntriples" /* Default input result format name */ #define DEFAULT_RESULT_FORMAT_NAME "xml" static void print_help(rasqal_world* world, raptor_world* raptor_world_ptr) { unsigned int i; puts(title_string); puts(rasqal_version_string); putchar('\n'); puts("Run an RDF query against data into formatted results."); printf("Usage: %s [OPTIONS] [base URI]\n", program); printf(" %s [OPTIONS] -e [base URI]\n", program); printf(" %s [OPTIONS] -p [base URI]\n", program); printf(" %s [OPTIONS] -p -e [base URI]\n", program); printf(" %s [OPTIONS] -t [base URI]\n\n", program); fputs(rasqal_copyright_string, stdout); fputs("\nLicense: ", stdout); puts(rasqal_license_string); fputs("Rasqal home page: ", stdout); puts(rasqal_home_url_string); puts("\nNormal operation is to execute the query retrieved from URI "); puts("and print the results in a simple text format."); puts("\nMain options:"); puts(HELP_TEXT("e", "exec QUERY ", "Execute QUERY string instead of ")); puts(HELP_TEXT("p", "protocol URI ", "Execute QUERY against a SPARQL protocol service URI")); puts(HELP_TEXT("i", "input LANGUAGE ", "Set query language name to one of:")); for(i = 0; 1; i++) { const raptor_syntax_description* desc; desc = rasqal_world_get_query_language_description(world, i); if(!desc) break; printf(" %-15s %s", desc->names[0], desc->label); if(!i) puts(" (default)"); else putchar('\n'); } puts(HELP_TEXT("r", "results FORMAT ", "Set query results output format to one of:")); puts(" For variable bindings and boolean results:"); puts(" simple A simple text format (default)"); for(i = 0; 1; i++) { const raptor_syntax_description* desc; desc = rasqal_world_get_query_results_format_description(world, i); if(!desc) break; if(desc->flags & RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER) printf(" %-10s %s\n", desc->names[0], desc->label); } puts(" For RDF graph results:"); for(i = 0; 1; i++) { const raptor_syntax_description *desc; desc = raptor_world_get_parser_description(raptor_world_ptr, i); if(!desc) break; printf(" %-15s %s", desc->names[0], desc->label); if(!i) puts(" (default)"); else putchar('\n'); } puts(HELP_TEXT("t", "results FILE ", "Read query results from a FILE")); puts(HELP_TEXT("R", "results-input-format FORMAT", HELP_PAD "Set input query results format to one of:")); for(i = 0; 1; i++) { const raptor_syntax_description* desc; desc = rasqal_world_get_query_results_format_description(world, i); if(!desc) break; if(desc->flags & RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER) { printf(" %-10s %s", desc->names[0], desc->label); if(!strcmp(desc->names[0], DEFAULT_RESULT_FORMAT_NAME)) puts(" (default)"); else putchar('\n'); } } puts("\nAdditional options:"); puts(HELP_TEXT("c", "count ", "Count triples - no output")); puts(HELP_TEXT("d FORMAT", "dump-query FORMAT", HELP_PAD "Print the parsed query out in FORMAT:")); for(i = 1; i <= QUERY_OUTPUT_LAST; i++) printf(" %-15s %s\n", query_output_format_labels[i][0], query_output_format_labels[i][1]); puts(HELP_TEXT("D URI", "data URI ", "RDF data source URI")); puts(HELP_TEXT("E", "ignore-errors ", "Ignore error messages")); puts(HELP_TEXT("f FEATURE(=VALUE)", "feature FEATURE(=VALUE)", HELP_PAD "Set query features" HELP_PAD " Use `-f help' for a list of valid features")); puts(HELP_TEXT("F NAME", "format NAME", "Set data source format name (default: guess)")); puts(HELP_TEXT("G URI", "named URI ", "RDF named graph data source URI")); puts(HELP_TEXT("h", "help ", "Print this help, then exit")); puts(HELP_TEXT("n", "dryrun ", "Prepare but do not run the query")); puts(HELP_TEXT("q", "quiet ", "No extra information messages")); puts(HELP_TEXT("s URI", "source URI ", "Same as `-G URI'")); puts(HELP_TEXT("v", "version ", "Print the Rasqal version")); puts(HELP_TEXT("W LEVEL", "warnings LEVEL", HELP_PAD "Set warning message LEVEL from 0: none to 100: all")); #ifdef STORE_RESULTS_FLAG puts("\nDEBUG options:"); puts(HELP_TEXT_LONG("store-results BOOL", "Set store results yes/no BOOL")); #endif puts("\nReport bugs to http://bugs.librdf.org/"); } typedef enum { MODE_EXEC_UNKNOWN, MODE_EXEC_QUERY_STRING, MODE_EXEC_QUERY_URI, MODE_CALL_PROTOCOL_URI, MODE_CALL_PROTOCOL_QUERY_STRING, MODE_READ_RESULTS } roqet_mode; int main(int argc, char *argv[]) { int query_from_string = 0; unsigned char *query_string = NULL; unsigned char *uri_string = NULL; int free_uri_string = 0; unsigned char *base_uri_string = NULL; rasqal_query *rq = NULL; rasqal_query_results *results; const char *ql_name = "sparql"; char *ql_uri = NULL; int rc = 0; raptor_uri *uri = NULL; raptor_uri *base_uri = NULL; char *filename = NULL; char *p; int usage = 0; int help = 0; int quiet = 0; int count = 0; int dryrun = 0; raptor_sequence* data_graphs = NULL; const char *result_format_name = NULL; query_output_format output_format = QUERY_OUTPUT_NONE; rasqal_feature query_feature = (rasqal_feature)-1; int query_feature_value= -1; unsigned char* query_feature_string_value = NULL; rasqal_world *world; raptor_world* raptor_world_ptr = NULL; #ifdef RASQAL_INTERNAL int store_results = -1; #endif char* data_graph_parser_name = NULL; raptor_iostream* iostr = NULL; const unsigned char* service_uri_string = 0; raptor_uri* service_uri = NULL; const char* result_filename = NULL; const char *result_input_format_name = NULL; roqet_mode mode = MODE_EXEC_UNKNOWN; program = argv[0]; if((p = strrchr(program, '/'))) program = p + 1; else if((p = strrchr(program, '\\'))) program = p + 1; argv[0] = program; world = rasqal_new_world(); if(!world || rasqal_world_open(world)) { fprintf(stderr, "%s: rasqal_world init failed\n", program); return(1); } raptor_world_ptr = rasqal_world_get_raptor(world); rasqal_world_set_log_handler(world, world, roqet_log_handler); #ifdef STORE_RESULTS_FLAG /* This is for debugging only */ if(1) { char* sr = getenv("RASQAL_DEBUG_STORE_RESULTS"); if(sr) store_results = atoi(sr); } #endif while (!usage && !help) { int c; #ifdef HAVE_GETOPT_LONG int option_index = 0; c = getopt_long (argc, argv, GETOPT_STRING, long_options, &option_index); #else c = getopt (argc, argv, GETOPT_STRING); #endif if (c == -1) break; switch (c) { case 0: case '?': /* getopt() - unknown option */ usage = 1; break; case 'c': count = 1; break; case 'd': output_format = QUERY_OUTPUT_UNKNOWN; if(optarg) { int i; for(i = 1; i <= QUERY_OUTPUT_LAST; i++) if(!strcmp(optarg, query_output_format_labels[i][0])) { output_format = (query_output_format)i; break; } } if(output_format == QUERY_OUTPUT_UNKNOWN) { int i; fprintf(stderr, "%s: invalid argument `%s' for `" HELP_ARG(d, dump-query) "'\n", program, optarg); for(i = 1; i <= QUERY_OUTPUT_LAST; i++) fprintf(stderr, " %-12s for %s\n", query_output_format_labels[i][0], query_output_format_labels[i][1]); usage = 1; } break; case 'e': if(optarg) { query_string = (unsigned char*)optarg; query_from_string = 1; } break; case 'f': if(optarg) { if(!strcmp(optarg, "help")) { unsigned int i; fprintf(stderr, "%s: Valid query features are:\n", program); for(i = 0; i < rasqal_get_feature_count(); i++) { const char *feature_name; const char *feature_label; if(!rasqal_features_enumerate(world, (rasqal_feature)i, &feature_name, NULL, &feature_label)) { const char *const feature_type = (rasqal_feature_value_type((rasqal_feature)i) == 0) ? (const char*)"" : (const char*)" (string)"; fprintf(stderr, " %-20s %s%s\n", feature_name, feature_label, feature_type); } } fputs("Features are set with `" HELP_ARG(f, feature) " FEATURE=VALUE or `-f FEATURE'\nand take a decimal integer VALUE except where noted, defaulting to 1 if omitted.\n", stderr); rasqal_free_world(world); exit(0); } else { unsigned int i; size_t arg_len = strlen(optarg); for(i = 0; i < rasqal_get_feature_count(); i++) { const char *feature_name; size_t len; if(rasqal_features_enumerate(world, (rasqal_feature)i, &feature_name, NULL, NULL)) continue; len = strlen(feature_name); if(!strncmp(optarg, feature_name, len)) { query_feature = (rasqal_feature)i; if(rasqal_feature_value_type(query_feature) == 0) { if(len < arg_len && optarg[len] == '=') query_feature_value=atoi(&optarg[len + 1]); else if(len == arg_len) query_feature_value = 1; } else { if(len < arg_len && optarg[len] == '=') query_feature_string_value = (unsigned char*)&optarg[len + 1]; else if(len == arg_len) query_feature_string_value = (unsigned char*)""; } break; } } if(query_feature_value < 0 && !query_feature_string_value) { fprintf(stderr, "%s: invalid argument `%s' for `" HELP_ARG(f, feature) "'\nTry '%s " HELP_ARG(f, feature) " help' for a list of valid features\n", program, optarg, program); usage = 1; } } } break; case 'F': if(optarg) { if(!raptor_world_is_parser_name(raptor_world_ptr, optarg)) { fprintf(stderr, "%s: invalid parser name `%s' for `" HELP_ARG(F, format) "'\nTry '%s -h' for a list of valid parsers\n", program, optarg, program); usage = 1; } else { data_graph_parser_name = optarg; } } break; case 'h': help = 1; break; case 'n': dryrun = 1; break; case 'p': if(optarg) service_uri_string = (const unsigned char*)optarg; break; case 'r': if(optarg) { if(!strcmp(optarg, "simple")) optarg = NULL; else { if(!rasqal_query_results_formats_check2(world, optarg, NULL /* uri */, NULL /* mime type */, RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER)) { fprintf(stderr, "%s: invalid output result format `%s' for `" HELP_ARG(r, results) "'\nTry '%s -h' for a list of valid formats\n", program, optarg, program); usage = 1; } else result_format_name = optarg; } } break; case 'R': if(optarg) { if(!rasqal_query_results_formats_check2(world, optarg, NULL /* uri */, NULL /* mime type */, RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER)) { fprintf(stderr, "%s: invalid input result format `%s' for `" HELP_ARG(R, results-input-format) "'\nTry '%s -h' for a list of valid formats\n", program, optarg, program); usage = 1; } else result_input_format_name = optarg; } break; case 'i': if(rasqal_language_name_check(world, optarg)) ql_name = optarg; else { unsigned int i; fprintf(stderr, "%s: invalid query language `%s' for `" HELP_ARG(i, input) "'\n", program, optarg); fprintf(stderr, "Valid query languages are:\n"); for(i = 0; 1; i++) { const raptor_syntax_description* desc; desc = rasqal_world_get_query_language_description(world, i); if(desc == NULL) break; fprintf(stderr, " %-18s for %s\n", desc->names[0], desc->label); } usage = 1; } break; case 'q': quiet = 1; break; case 's': case 'D': case 'G': if(optarg) { rasqal_data_graph *dg = NULL; rasqal_data_graph_flags type; type = (c == 's' || c == 'G') ? RASQAL_DATA_GRAPH_NAMED : RASQAL_DATA_GRAPH_BACKGROUND; dg = rasqal_cmdline_read_data_graph(world, type, (const char*)optarg, data_graph_parser_name); if(!dg) { fprintf(stderr, "%s: Failed to create data graph for `%s'\n", program, optarg); return(1); } if(!data_graphs) { data_graphs = raptor_new_sequence((raptor_data_free_handler)rasqal_free_data_graph, NULL); if(!data_graphs) { fprintf(stderr, "%s: Failed to create data graphs sequence\n", program); return(1); } } raptor_sequence_push(data_graphs, dg); } break; case 'W': if(optarg) warning_level = atoi(optarg); else warning_level = 0; if(warning_level >= 0) rasqal_world_set_warning_level(world, RASQAL_GOOD_CAST(unsigned int, warning_level)); break; case 'E': ignore_errors = 1; break; case 't': if(optarg) { result_filename = optarg; } break; case 'v': fputs(rasqal_version_string, stdout); fputc('\n', stdout); rasqal_free_world(world); exit(0); #ifdef STORE_RESULTS_FLAG case STORE_RESULTS_FLAG: if(optarg) store_results = (!strcmp(optarg, "yes") || !strcmp(optarg, "YES")); break; #endif } } if(!help && !usage) { if(service_uri_string) { if(optind != argc && optind != argc-1) usage = 2; /* Title and usage */ } else if(query_string) { if(optind != argc && optind != argc-1) usage = 2; /* Title and usage */ } else if(result_filename) { if(optind != argc && optind != argc-1) usage = 2; /* Title and usage */ } else { if(optind != argc-1 && optind != argc-2) usage = 2; /* Title and usage */ } } if(usage) { if(usage > 1) { fputs(title_string, stderr); fputs(rasqal_version_string, stderr); putc('\n', stderr); fputs("Rasqal home page: ", stderr); fputs(rasqal_home_url_string, stderr); fputc('\n', stderr); fputs(rasqal_copyright_string, stderr); fputs("\nLicense: ", stderr); fputs(rasqal_license_string, stderr); fputs("\n\n", stderr); } fprintf(stderr, "Try `%s " HELP_ARG(h, help) "' for more information.\n", program); rasqal_free_world(world); exit(1); } if(help) { print_help(world, raptor_world_ptr); rasqal_free_world(world); exit(0); } if(service_uri_string && query_string) { mode = MODE_CALL_PROTOCOL_URI; service_uri = raptor_new_uri(raptor_world_ptr, service_uri_string); if(optind == argc-1) base_uri_string = (unsigned char*)argv[optind]; } else if(query_string) { mode = MODE_EXEC_QUERY_STRING; if(optind == argc-1) base_uri_string = (unsigned char*)argv[optind]; } else if(result_filename) { mode = MODE_READ_RESULTS; if(optind == argc-1) base_uri_string = (unsigned char*)argv[optind]; } else { /* read a query from stdin, file or URI */ if(service_uri_string) { mode = MODE_CALL_PROTOCOL_QUERY_STRING; service_uri = raptor_new_uri(raptor_world_ptr, service_uri_string); } else mode = MODE_EXEC_QUERY_URI; if(optind == argc-1) uri_string = (unsigned char*)argv[optind]; else { uri_string = (unsigned char*)argv[optind++]; base_uri_string = (unsigned char*)argv[optind]; } /* If uri_string is "path-to-file", turn it into a file: URI */ if(!strcmp((const char*)uri_string, "-")) { if(!base_uri_string) { fprintf(stderr, "%s: A base URI is required when reading a query from standard input.\n", program); return(1); } uri_string = NULL; } else if(!access((const char*)uri_string, R_OK)) { filename = (char*)uri_string; uri_string = raptor_uri_filename_to_uri_string(filename); free_uri_string = 1; } if(uri_string) { uri = raptor_new_uri(raptor_world_ptr, uri_string); if(!uri) { fprintf(stderr, "%s: Failed to create URI for %s\n", program, uri_string); return(1); } } else uri = NULL; /* stdin */ query_string = rasqal_cmdline_read_uri_file_stdin_contents(world, uri, filename, NULL); if(!query_string) { rc = 1; goto tidy_setup; } } /* Compute base URI */ if(!base_uri_string) { if(uri) base_uri = raptor_uri_copy(uri); } else base_uri = raptor_new_uri(raptor_world_ptr, base_uri_string); if(base_uri_string && !base_uri) { fprintf(stderr, "%s: Failed to create URI for %s\n", program, base_uri_string); return(1); } switch(mode) { case MODE_CALL_PROTOCOL_QUERY_STRING: case MODE_CALL_PROTOCOL_URI: if(!quiet) { fputs(program, stderr); fputs(": Calling SPARQL service at URI ", stderr); fputs(RASQAL_GOOD_CAST(const char*, service_uri_string), stderr); if(mode == MODE_CALL_PROTOCOL_QUERY_STRING) { if(query_string) fprintf(stderr, " with query '%s'", query_string); } else { if(filename) fprintf(stderr, " with query from file %s", filename); else if(uri_string) fprintf(stderr, " querying URI %s", uri_string); } if(base_uri_string) fprintf(stderr, " with base URI %s", base_uri_string); fputc('\n', stderr); } /* Execute query remotely */ if(!dryrun) results = roqet_call_sparql_service(world, service_uri, query_string, data_graphs, /* service_format */ NULL); break; case MODE_EXEC_QUERY_STRING: case MODE_EXEC_QUERY_URI: if(!quiet) { fputs(program, stderr); fputs(": Running query", stderr); if(mode == MODE_EXEC_QUERY_STRING) { fprintf(stderr, " '%s'", query_string); } else { if(filename) { fputs(" from file ", stderr); fputs(filename, stderr); } else if(uri_string) { fputs(" from URI ", stderr); fputs(RASQAL_GOOD_CAST(const char*, uri_string), stderr); } } if(base_uri_string) { fputs(" with base URI ", stderr); fputs(RASQAL_GOOD_CAST(const char*, base_uri_string), stderr); } fputc('\n', stderr); } /* Execute query in this query engine (from URI or from -e QUERY) */ rq = roqet_init_query(world, ql_name, ql_uri, query_string, base_uri, query_feature, query_feature_value, query_feature_string_value, store_results, data_graphs); if(!rq) { rc = 1; goto tidy_query; } if(output_format != QUERY_OUTPUT_NONE && !quiet) roqet_print_query(rq, raptor_world_ptr, output_format, base_uri); if(!dryrun) results = rasqal_query_execute(rq); break; case MODE_READ_RESULTS: if(!quiet) { if(base_uri_string) fprintf(stderr, "%s: Reading results from file %s in format %s with base URI %s\n", program, result_filename, result_input_format_name, base_uri_string); else fprintf(stderr, "%s: Reading results from file %s\n", program, result_filename); } /* Read result set from filename */ if(1) { raptor_iostream* result_iostr; result_iostr = raptor_new_iostream_from_filename(raptor_world_ptr, result_filename); if(!result_iostr) { fprintf(stderr, "%s: results file '%s' open failed - %s\n", program, result_filename, strerror(errno)); rc = 1; goto tidy_setup; } results = rasqal_cmdline_read_results(world, raptor_world_ptr, RASQAL_QUERY_RESULTS_BINDINGS, result_iostr, result_filename, result_input_format_name); raptor_free_iostream(result_iostr); result_iostr = NULL; } if(!results) { fprintf(stderr, "%s: Failed to read results from '%s'\n", program, result_filename); rc = 1; goto tidy_setup; } break; case MODE_EXEC_UNKNOWN: break; } /* No results from dryrun */ if(dryrun) goto tidy_query; if(!results) { fprintf(stderr, "%s: Query execution failed\n", program); rc = 1; goto tidy_query; } if(rasqal_query_results_is_bindings(results)) { if(result_format_name) rc = print_formatted_query_results(world, results, raptor_world_ptr, stdout, result_format_name, base_uri, quiet); else rasqal_cmdline_print_bindings_results_simple(program, results, stdout, quiet, count); } else if(rasqal_query_results_is_boolean(results)) { if(result_format_name) rc = print_formatted_query_results(world, results, raptor_world_ptr, stdout, result_format_name, base_uri, quiet); else print_boolean_result_simple(results, stdout, quiet); } else if(rasqal_query_results_is_graph(results)) { if(!result_format_name) result_format_name = DEFAULT_GRAPH_FORMAT; rc = print_graph_result(rq, results, raptor_world_ptr, stdout, result_format_name, base_uri, quiet); } else { fprintf(stderr, "%s: Query returned unknown result format\n", program); rc = 1; } rasqal_free_query_results(results); tidy_query: if(!query_from_string) free(query_string); if(rq) rasqal_free_query(rq); tidy_setup: if(data_graphs) raptor_free_sequence(data_graphs); if(base_uri) raptor_free_uri(base_uri); if(uri) raptor_free_uri(uri); if(free_uri_string) raptor_free_memory(uri_string); if(iostr) raptor_free_iostream(iostr); if(service_uri) raptor_free_uri(service_uri); rasqal_free_world(world); if(error_count && !ignore_errors) return 1; if(warning_count && warning_level != 0) return 2; return (rc); } rasqal-0.9.33/utils/read_files.c0000644000175000017500000001761212311460057013421 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * common.c - Rasqal command line utility functions * * Copyright (C) 2013, David Beckett http://www.dajobe.org/ * * 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 #endif #ifdef WIN32 #include #endif #include #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include #include #ifdef BUFSIZ #define FILE_READ_BUF_SIZE BUFSIZ #else #define FILE_READ_BUF_SIZE 1024 #endif #include "rasqalcmdline.h" unsigned char* rasqal_cmdline_read_file_fh(rasqal_world *world, FILE* fh, const char* filename, const char* label, size_t* len_p) { raptor_stringbuffer *sb; size_t len; unsigned char* string = NULL; unsigned char* buffer = NULL; raptor_locator my_locator; memset(&my_locator, '\0', sizeof(my_locator)); my_locator.file = filename; sb = raptor_new_stringbuffer(); if(!sb) return NULL; buffer = (unsigned char*)rasqal_alloc_memory(FILE_READ_BUF_SIZE); if(!buffer) goto tidy; while(!feof(fh)) { size_t read_len; read_len = fread((char*)buffer, 1, FILE_READ_BUF_SIZE, fh); if(read_len > 0) raptor_stringbuffer_append_counted_string(sb, buffer, read_len, 1); if(read_len < FILE_READ_BUF_SIZE) { if(ferror(fh)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, &my_locator, "Read failed - %s\n", strerror(errno)); goto tidy; } break; } } len = raptor_stringbuffer_length(sb); string = (unsigned char*)rasqal_alloc_memory(len + 1); if(string) { raptor_stringbuffer_copy_to_string(sb, string, len); if(len_p) *len_p = len; } tidy: if(buffer) rasqal_free_memory(buffer); if(sb) raptor_free_stringbuffer(sb); return string; } unsigned char* rasqal_cmdline_read_file_string(rasqal_world* world, const char* filename, const char* label, size_t* len_p) { FILE *fh = NULL; unsigned char* string = NULL; raptor_locator my_locator; memset(&my_locator, '\0', sizeof(my_locator)); my_locator.file = filename; fh = fopen(filename, "r"); if(!fh) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, &my_locator, "%s '%s' open failed - %s\n", label, filename, strerror(errno)); goto tidy; } string = rasqal_cmdline_read_file_fh(world, fh, filename, label, len_p); fclose(fh); tidy: return string; } /* * rasqal_cmdline_read_uri_file_stdin_contents: * @world: rasqal world * @uri: uri to use (or NULL) * @filename: filename to use (or NULL) * @len_p: address to store length of result (or NULL) * * INTERNAL - Read a query string from a @uri or @filename or otherwise from stdin * * Return value: query string at the source or NULL on failure */ unsigned char* rasqal_cmdline_read_uri_file_stdin_contents(rasqal_world* world, raptor_uri* uri, const char* filename, size_t* len_p) { raptor_world* raptor_world_ptr = rasqal_world_get_raptor(world); unsigned char* string = NULL; if(uri) { raptor_www *www; www = raptor_new_www(raptor_world_ptr); if(www) { raptor_www_fetch_to_string(www, uri, (void**)&string, len_p, rasqal_alloc_memory); raptor_free_www(www); } } else if(filename) { string = rasqal_cmdline_read_file_string(world, filename, "query file", len_p); } else { /* stdin */ string = rasqal_cmdline_read_file_fh(world, stdin, "stdin", "query string stdin", len_p); } return string; } /* * rasqal_cmdline_read_data_graph: * @world: world * @type: data graph type * @name: graph name "-" (stdin) or filename or UI * @format_name: format name (or NULL) * * INTERNAL - Construct a data graph object from arguments * * Data graph or NULL on failure */ rasqal_data_graph* rasqal_cmdline_read_data_graph(rasqal_world* world, rasqal_data_graph_flags type, const char* name, const char* format_name) { raptor_world* raptor_world_ptr = rasqal_world_get_raptor(world); rasqal_data_graph* dg = NULL; if(!strcmp(name, "-")) { /* stdin: use an iostream not a URI data graph */ unsigned char* source_uri_string; raptor_uri* iostr_base_uri = NULL; raptor_uri* graph_name = NULL; /* FIXME - get base URI from somewhere else */ source_uri_string = (unsigned char*)"file:///dev/stdin"; iostr_base_uri = raptor_new_uri(raptor_world_ptr, source_uri_string); if(iostr_base_uri) { raptor_iostream* iostr; iostr = raptor_new_iostream_from_file_handle(raptor_world_ptr, stdin); if(iostr) dg = rasqal_new_data_graph_from_iostream(world, iostr, iostr_base_uri, graph_name, type, NULL, format_name, NULL); raptor_free_uri(iostr_base_uri); } } else if(!access(name, R_OK)) { /* file: use URI */ unsigned char* source_uri_string; raptor_uri* source_uri; raptor_uri* graph_name = NULL; source_uri_string = raptor_uri_filename_to_uri_string(name); source_uri = raptor_new_uri(raptor_world_ptr, source_uri_string); raptor_free_memory(source_uri_string); if(type == RASQAL_DATA_GRAPH_NAMED) graph_name = source_uri; if(source_uri) dg = rasqal_new_data_graph_from_uri(world, source_uri, graph_name, type, NULL, format_name, NULL); if(source_uri) raptor_free_uri(source_uri); } else { raptor_uri* source_uri; raptor_uri* graph_name = NULL; /* URI: use URI */ source_uri = raptor_new_uri(raptor_world_ptr, (const unsigned char*)name); if(type == RASQAL_DATA_GRAPH_NAMED) graph_name = source_uri; if(source_uri) dg = rasqal_new_data_graph_from_uri(world, source_uri, graph_name, type, NULL, format_name, NULL); if(source_uri) raptor_free_uri(source_uri); } return dg; } rasqal-0.9.33/aclocal.m40000644000175000017500000012167612434455631011676 00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file 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. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file 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. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Copyright (C) 2011 Free Software Foundation, Inc. # # This file 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. # serial 1 # AM_PROG_AR([ACT-IF-FAIL]) # ------------------------- # Try to determine the archiver interface, and trigger the ar-lib wrapper # if it is needed. If the detection of archiver interface fails, run # ACT-IF-FAIL (default is to abort configure with a proper error message). AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([ar-lib])dnl AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) : ${AR=ar} AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], [am_cv_ar_interface=ar AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a ]) ]) case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) m4_default([$1], [AC_MSG_ERROR([could not determine $AR interface])]) ;; esac AC_SUBST([AR])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file 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. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file 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. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file 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. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file 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. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, # 2011 Free Software Foundation, Inc. # # This file 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. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file 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. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file 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. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009, 2011 Free Software Foundation, Inc. # # This file 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. # serial 2 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few `make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using `$V' instead of `$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file 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. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file 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. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([build/gtk-doc.m4]) m4_include([build/libtool.m4]) m4_include([build/ltoptions.m4]) m4_include([build/ltsugar.m4]) m4_include([build/ltversion.m4]) m4_include([build/lt~obsolete.m4]) m4_include([build/pkg.m4]) rasqal-0.9.33/libmtwist/0000755000175000017500000000000012443715251012114 500000000000000rasqal-0.9.33/libmtwist/Makefile.am0000644000175000017500000000172712241744661014102 00000000000000# -*- Mode: Makefile -*- # # Makefile for libmtwist convienience library # ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = libmtwist.la AM_CPPFLAGS = -DMTWIST_CONFIG -I$(top_srcdir)/src libmtwist_la_SOURCES = \ mt.c \ mtwist.h \ mtwist_internal.h \ seed.c TESTS=mttest mttest_SOURCES = test.c mttest_LDADD = libmtwist.la EXTRA_PROGRAMS=$(TESTS) CLEANFILES=$(TESTS) \ *.plist if MAINTAINER_MODE # Run Clang static analyzer over sources. analyze: $(SOURCES) @list='$(SOURCES)'; \ result=0; \ for file in $$list; do \ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ $(RECHO) "Analyzing $$file"; \ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ status=$$?; \ if test $$status != 0; then \ result=1; \ fi; \ fi; \ done; \ set -e; exit $$result endif rasqal-0.9.33/libmtwist/Makefile.in0000644000175000017500000005272512434455632014120 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 for libmtwist convienience library # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ TESTS = mttest$(EXEEXT) EXTRA_PROGRAMS = $(am__EXEEXT_1) subdir = libmtwist DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/rasqal_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmtwist_la_LIBADD = am_libmtwist_la_OBJECTS = mt.lo seed.lo libmtwist_la_OBJECTS = $(am_libmtwist_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__EXEEXT_1 = mttest$(EXEEXT) am_mttest_OBJECTS = test.$(OBJEXT) mttest_OBJECTS = $(am_mttest_OBJECTS) mttest_DEPENDENCIES = libmtwist.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles 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_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ 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_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libmtwist_la_SOURCES) $(mttest_SOURCES) DIST_SOURCES = $(libmtwist_la_SOURCES) $(mttest_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_TIME_H = @HAVE_TIME_H@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ 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@ PCRE_CONFIG = @PCRE_CONFIG@ PERL = @PERL@ PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ PKGCONFIG_LIBS = @PKGCONFIG_LIBS@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ RAPTOR2_CFLAGS = @RAPTOR2_CFLAGS@ RAPTOR2_LIBS = @RAPTOR2_LIBS@ RAPTOR_MIN_VERSION = @RAPTOR_MIN_VERSION@ RAPTOR_VERSION_DEC = @RAPTOR_VERSION_DEC@ RASQAL_EXTERNAL_LIBS = @RASQAL_EXTERNAL_LIBS@ RASQAL_INTERNAL_CPPFLAGS = @RASQAL_INTERNAL_CPPFLAGS@ RASQAL_INTERNAL_LIBS = @RASQAL_INTERNAL_LIBS@ RASQAL_LIBTOOLLIBS = @RASQAL_LIBTOOLLIBS@ RASQAL_LIBTOOL_VERSION = @RASQAL_LIBTOOL_VERSION@ RASQAL_VERSION = @RASQAL_VERSION@ RASQAL_VERSION_DECIMAL = @RASQAL_VERSION_DECIMAL@ RASQAL_VERSION_MAJOR = @RASQAL_VERSION_MAJOR@ RASQAL_VERSION_MINOR = @RASQAL_VERSION_MINOR@ RASQAL_VERSION_RELEASE = @RASQAL_VERSION_RELEASE@ RECHO = @RECHO@ RECHO_C = @RECHO_C@ RECHO_N = @RECHO_N@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STANDARD_CFLAGS = @STANDARD_CFLAGS@ STRIP = @STRIP@ TAR = @TAR@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_CONFIG = @UUID_CONFIG@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CONFIG = @XML_CONFIG@ 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@ 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@ ANALYZE = clang ANALYZE_FLAGS = "--analyze" # Based on COMPILE target ANALYZE_COMMAND = $(ANALYZE) \ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ $(ANALYZE_FLAGS) noinst_LTLIBRARIES = libmtwist.la AM_CPPFLAGS = -DMTWIST_CONFIG -I$(top_srcdir)/src libmtwist_la_SOURCES = \ mt.c \ mtwist.h \ mtwist_internal.h \ seed.c mttest_SOURCES = test.c mttest_LDADD = libmtwist.la CLEANFILES = $(TESTS) \ *.plist 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 libmtwist/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libmtwist/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libmtwist.la: $(libmtwist_la_OBJECTS) $(libmtwist_la_DEPENDENCIES) $(EXTRA_libmtwist_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libmtwist_la_OBJECTS) $(libmtwist_la_LIBADD) $(LIBS) mttest$(EXEEXT): $(mttest_OBJECTS) $(mttest_DEPENDENCIES) $(EXTRA_mttest_DEPENDENCIES) @rm -f mttest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mttest_OBJECTS) $(mttest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ .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 $< .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 `$(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 $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(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 $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) 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 clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \ 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 uninstall uninstall-am # Run Clang static analyzer over sources. @MAINTAINER_MODE_TRUE@analyze: $(SOURCES) @MAINTAINER_MODE_TRUE@ @list='$(SOURCES)'; \ @MAINTAINER_MODE_TRUE@ result=0; \ @MAINTAINER_MODE_TRUE@ for file in $$list; do \ @MAINTAINER_MODE_TRUE@ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \ @MAINTAINER_MODE_TRUE@ $(RECHO) "Analyzing $$file"; \ @MAINTAINER_MODE_TRUE@ $(ANALYZE_COMMAND) $(srcdir)/$$file; \ @MAINTAINER_MODE_TRUE@ status=$$?; \ @MAINTAINER_MODE_TRUE@ if test $$status != 0; then \ @MAINTAINER_MODE_TRUE@ result=1; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ done; \ @MAINTAINER_MODE_TRUE@ set -e; exit $$result # 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: rasqal-0.9.33/libmtwist/mtwist.h0000644000175000017500000000347311660625413013543 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * mtwist.h - Mersenne Twister header * * This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the benefit * of the public at large and to the detriment of our heirs and * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * For more information, please refer to * */ #ifndef MTWIST_H #define MTWIST_H #ifdef __cplusplus extern "C" { #endif /* Mersenne Twister state */ typedef struct mtwist_s mtwist; /* constructor */ mtwist* mtwist_new(void); /* destructor */ void mtwist_free(mtwist* mt); /* methods */ void mtwist_init(mtwist* mt, unsigned long seed); unsigned long mtwist_u32rand(mtwist* mt); double mtwist_drand(mtwist* mt); /* utility functions */ unsigned long mtwist_seed_from_system(mtwist* mt); #ifdef __cplusplus } #endif #endif rasqal-0.9.33/libmtwist/test.c0000644000175000017500000001131212241743324013153 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * test.c - Mersenne Twister tests * * This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the benefit * of the public at large and to the detriment of our heirs and * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * For more information, please refer to * */ #ifdef MTWIST_CONFIG #include #endif #include #include int main(int argc, char *argv[]); #define N_TESTS 1000 #define TEST_SEED 54321U /* test set 1: results 0..19 */ #define TEST_SET_1_START 0 #define TEST_SET_1_END 19 #define TEST_SET_1_NRESULTS (TEST_SET_1_END - TEST_SET_1_START + 1) #define ULONG_C(v) (v ## UL) static unsigned long const test_seed_54321_results_1[TEST_SET_1_NRESULTS] = { ULONG_C(3915467345), ULONG_C(2189234826), ULONG_C(2679307290), ULONG_C( 787501152), ULONG_C(3400771556), ULONG_C(3473638550), ULONG_C(1845911630), ULONG_C(4027756818), ULONG_C(2332222920), ULONG_C( 127158527), ULONG_C(1775789767), ULONG_C(3371479562), ULONG_C( 367824108), ULONG_C( 703848432), ULONG_C(3339822589), ULONG_C(1863375487), ULONG_C(2100022882), ULONG_C(2466459787), ULONG_C( 217027622), ULONG_C( 932105407) }; #define TEST_SET_1_RESULTS test_seed_54321_results_1 /* test set 2: results 622..629 */ #define TEST_SET_2_START 622 #define TEST_SET_2_END 629 #define TEST_SET_2_NRESULTS (TEST_SET_2_END - TEST_SET_2_START + 1) static unsigned long const test_seed_54321_results_2[TEST_SET_2_NRESULTS] = { ULONG_C(2109020469), ULONG_C( 264978304), ULONG_C(3951898066), ULONG_C(3322908472), ULONG_C(2243665931), ULONG_C(3379990241), ULONG_C(1427746768), ULONG_C(3217532946) }; #define TEST_SET_2_RESULTS test_seed_54321_results_2 /* test set 3: results 990..999 */ #define TEST_SET_3_START 990 #define TEST_SET_3_END 999 #define TEST_SET_3_NRESULTS (TEST_SET_3_END - TEST_SET_3_START + 1) static unsigned long const test_seed_54321_results_3[TEST_SET_3_NRESULTS] = { ULONG_C(4262956485), ULONG_C(2083563531), ULONG_C(1724557607), ULONG_C(4100776152), ULONG_C(4050777500), ULONG_C(3146323433), ULONG_C(2882918002), ULONG_C(3891093309), ULONG_C(1534503088), ULONG_C(1821071197) }; #define TEST_SET_3_RESULTS test_seed_54321_results_3 int main(int argc, char *argv[]) { const char *program = argv[0]; int failures = 0; int test; mtwist* mt = NULL; if(argc != 1) return 1; mt = mtwist_new(); if(!mt) { fprintf(stderr, "%s: mtwist_new() failed\n", program); failures++; goto tidy; } mtwist_init(mt, TEST_SEED); for(test = 0; test < N_TESTS; test++) { int check = 0; unsigned long expected_v; unsigned long v; v = mtwist_u32rand(mt); if(test >= TEST_SET_1_START && test <= TEST_SET_1_END) { check = 1; expected_v = TEST_SET_1_RESULTS[test - TEST_SET_1_START]; } else if(test >= TEST_SET_2_START && test <= TEST_SET_2_END) { check = 1; expected_v = TEST_SET_2_RESULTS[test - TEST_SET_2_START]; } else if(test >= TEST_SET_3_START && test <= TEST_SET_3_END) { check = 1; expected_v = TEST_SET_3_RESULTS[test - TEST_SET_3_START]; } if(check && v != expected_v) { fprintf(stderr, "%s: Test %3d returned value: %lu expected %lu\n", program, test, v, expected_v); failures++; } else { #if defined(DEBUG) && DEBUG > 1 if(check) fprintf(stderr, "%s: Test %3d returned expected value: %lu OK\n", program, test, v); else fprintf(stderr, "%s: Test %3d returned value: %lu OK\n", program, test, v); #endif } } fprintf(stdout, "%s: Returned %d failures\n", program, failures); tidy: if(mt) mtwist_free(mt); return failures; } rasqal-0.9.33/libmtwist/mtwist_internal.h0000644000175000017500000000373311660625413015436 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * mtwist_internal.c - Mersenne Twister internals * * This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the benefit * of the public at large and to the detriment of our heirs and * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * For more information, please refer to * */ #ifndef MTWIST_INTERNAL_H #define MTWIST_INTERNAL_H 1 #define MTWIST_N 624 #define MTWIST_M 397 #define MT_STATIC_SEED 5489UL /* Mersenne Twister library state */ struct mtwist_s { /* MT buffer holding N 32 bit unsigned integers */ uint32_t state[MTWIST_N]; /* Pointer into above - next long to use */ uint32_t* next; /* Number of remaining integers in state before an update is needed */ unsigned int remaining; /* 1 if a seed was given */ unsigned int seeded : 1; /* 1 to always return a static system seed (MT_STATIC_SEED) */ unsigned int static_system_seed : 1; }; #endif rasqal-0.9.33/libmtwist/mt.c0000644000175000017500000001112311752012202012602 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * mt.c - Mersenne Twister functions * * This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the benefit * of the public at large and to the detriment of our heirs and * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * For more information, please refer to * */ #ifdef MTWIST_CONFIG #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDINT_H /* To get UINT32_C */ #define __STDC_CONSTANT_MACROS 1 #include #else /* pessimistic - use an unsigned long */ typedef unsigned long uint32_t; #define UINT32_C(v) (v ## UL) #endif #include #include /* * Mersenne Twister (MT19937) algorithm * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html * * http://en.wikipedia.org/wiki/Mersenne_twister * */ #define MTWIST_UPPER_MASK UINT32_C(0x80000000) #define MTWIST_LOWER_MASK UINT32_C(0x7FFFFFFF) #define MTWIST_FULL_MASK UINT32_C(0xFFFFFFFF) #define MTWIST_MATRIX_A UINT32_C(0x9908B0DF) #define MTWIST_MIXBITS(u, v) ( ( (u) & MTWIST_UPPER_MASK) | ( (v) & MTWIST_LOWER_MASK) ) #define MTWIST_TWIST(u, v) ( (MTWIST_MIXBITS(u, v) >> 1) ^ ( (v) & UINT32_C(1) ? MTWIST_MATRIX_A : UINT32_C(0)) ) /** * mtwist_new: * * Construct a Mersenne Twister object * * Return value: new MT object or NULL on failure */ mtwist* mtwist_new(void) { mtwist* mt; mt = (mtwist*)calloc(1, sizeof(*mt)); if(!mt) return NULL; mt->remaining = 0; mt->next = NULL; mt->seeded = 0; return mt; } /** * mtwist_free: * @mt: mt object * * Destroy a Mersenne Twister object */ void mtwist_free(mtwist* mt) { if(mt) free(mt); } /** * mtwist_init: * @mt: mt object * @seed: seed (lower 32 bits used) * * Initialise a Mersenne Twister with an unsigned 32 bit int seed */ void mtwist_init(mtwist* mt, unsigned long seed) { int i; if(!mt) return; mt->state[0] = (uint32_t)(seed & MTWIST_FULL_MASK); for(i = 1; i < MTWIST_N; i++) { mt->state[i] = (UINT32_C(1812433253) * (mt->state[i - 1] ^ (mt->state[i - 1] >> 30)) + i); mt->state[i] &= MTWIST_FULL_MASK; } mt->remaining = 0; mt->next = NULL; mt->seeded = 1; } static void mtwist_update_state(mtwist* mt) { int count; uint32_t *p = mt->state; for(count = (MTWIST_N - MTWIST_M + 1); --count; p++) *p = p[MTWIST_M] ^ MTWIST_TWIST(p[0], p[1]); for(count = MTWIST_M; --count; p++) *p = p[MTWIST_M - MTWIST_N] ^ MTWIST_TWIST(p[0], p[1]); *p = p[MTWIST_M - MTWIST_N] ^ MTWIST_TWIST(p[0], mt->state[0]); mt->remaining = MTWIST_N; mt->next = mt->state; } /** * mtwist_u32rand: * @mt: mt object * * Get a random unsigned 32 bit integer from the random number generator * * Return value: unsigned long with 32 valid bits */ unsigned long mtwist_u32rand(mtwist* mt) { uint32_t r; if(!mt) return 0UL; if(!mt->seeded) mtwist_init(mt, mtwist_seed_from_system(mt)); if(!mt->remaining) mtwist_update_state(mt); r = *mt->next++; mt->remaining--; /* Tempering */ r ^= (r >> 11); r ^= (r << 7) & UINT32_C(0x9D2C5680); r ^= (r << 15) & UINT32_C(0xEFC60000); r ^= (r >> 18); r &= MTWIST_FULL_MASK; return (unsigned long)r; } /** * mtwist_drand: * @mt: mt object * * Get a random double from the random number generator * * Return value: random double in the range 0.0 inclusive to 1.0 exclusive; [0.0, 1.0) */ double mtwist_drand(mtwist* mt) { unsigned long r; double d; if(!mt) return 0.0; r = mtwist_u32rand(mt); d = r / 4294967296.0; /* 2^32 */ return d; } rasqal-0.9.33/libmtwist/seed.c0000644000175000017500000000542011660625413013121 00000000000000/* -*- Mode: c; c-basic-offset: 2 -*- * * seed.c - Seeding functions * * This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the benefit * of the public at large and to the detriment of our heirs and * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * For more information, please refer to * */ #ifdef MTWIST_CONFIG #include #endif #include #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDINT_H #include #else /* pessimistic - use an unsigned long */ typedef unsigned long uint32_t; #endif #include #include /** * mtwist_seed_from_system: * @mt: mt object * * Get a 32 bit unsigned integer random seed based on system sources * * Return value: seed with only lower 32 bits valid */ unsigned long mtwist_seed_from_system(mtwist* mt) { /* SOURCE 1: processor clock ticks since process started */ uint32_t a = (uint32_t)clock(); /* SOURCE 2: unix time in seconds since epoch */ uint32_t b = (uint32_t)time(NULL); uint32_t c; #ifdef HAVE_UNISTD_H /* SOURCE 3: process ID (on unix) */ c = getpid(); #else c = 0; #endif /* Mix seed sources using public domain code from * http://www.burtleburtle.net/bob/c/lookup3.c */ #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) /* inlined mix(a, b, c) macro */ a -= c; a ^= rot(c, 4); c += b; b -= a; b ^= rot(a, 6); a += c; c -= b; c ^= rot(b, 8); b += a; a -= c; a ^= rot(c,16); c += b; b -= a; b ^= rot(a,19); /* a += c; */ /* CLANG: not needed because of below */ c -= b; c ^= rot(b, 4); /* b += a; */ /* CLANG: last calculation not needed */ if(mt->static_system_seed) c = MT_STATIC_SEED; return (unsigned long)c; } rasqal-0.9.33/gtk-doc.make0000644000175000017500000002061312311460143012176 00000000000000# -*- mode: makefile -*- #################################### # Everything below here is generic # #################################### if GTK_DOC_USE_LIBTOOL GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) GTKDOC_RUN = $(LIBTOOL) --mode=execute else GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) GTKDOC_RUN = endif # We set GPATH here; this gives us semantics for GNU make # which are more like other make's VPATH, when it comes to # whether a source that is a target of one rule is then # searched for in VPATH/GPATH. # GPATH = $(srcdir) TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) SETUP_FILES = \ $(content_files) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt EXTRA_DIST = \ $(HTML_IMAGES) \ $(SETUP_FILES) DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ html-build.stamp pdf-build.stamp \ tmpl.stamp sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ $(DOC_MODULE).interfaces \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals REPORT_FILES = \ $(DOC_MODULE)-undocumented.txt \ $(DOC_MODULE)-undeclared.txt \ $(DOC_MODULE)-unused.txt CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) if ENABLE_GTK_DOC if GTK_DOC_BUILD_HTML HTML_BUILD_STAMP=html-build.stamp else HTML_BUILD_STAMP= endif if GTK_DOC_BUILD_PDF PDF_BUILD_STAMP=pdf-build.stamp else PDF_BUILD_STAMP= endif all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) else all-local: endif docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) $(REPORT_FILES): sgml-build.stamp #### setup #### setup-build.stamp: -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ echo ' DOC Preparing build'; \ files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ if test "x$$files" != "x" ; then \ for file in $$files ; do \ test -f $(abs_srcdir)/$$file && \ cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ done; \ fi; \ test -d $(abs_srcdir)/tmpl && \ { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ chmod -R u+w $(abs_builddir)/tmpl; } \ fi @touch setup-build.stamp #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo ' DOC Scanning header files' @_source_dir='' ; \ for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ done ; \ gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ echo " DOC Introspecting gobjects"; \ scanobj_options=""; \ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ if test "$(?)" = "0"; then \ if test "x$(V)" = "x1"; then \ scanobj_options="--verbose"; \ fi; \ fi; \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ else \ for i in $(SCANOBJ_FILES) ; do \ test -f $$i || touch $$i ; \ done \ fi @touch scan-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true #### templates #### tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt @echo ' DOC Rebuilding template files' @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ if test -w $(abs_srcdir) ; then \ cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ fi \ fi @touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @true $(srcdir)/tmpl/*.sgml: @true #### xml #### sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) @echo ' DOC Building XML' @-chmod -R u+w $(srcdir) @_source_dir='' ; \ for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ done ; \ gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) @touch sgml-build.stamp sgml.stamp: sgml-build.stamp @true #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo ' DOC Building HTML' @rm -rf html @mkdir html @mkhtml_options=""; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ if test "$(?)" = "0"; then \ if test "x$(V)" = "x1"; then \ mkhtml_options="$$mkhtml_options --verbose"; \ fi; \ fi; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) -@test "x$(HTML_IMAGES)" = "x" || \ for file in $(HTML_IMAGES) ; do \ if test -f $(abs_srcdir)/$$file ; then \ cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ fi; \ if test -f $(abs_builddir)/$$file ; then \ cp $(abs_builddir)/$$file $(abs_builddir)/html; \ fi; \ done; @echo ' DOC Fixing cross-references' @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @touch html-build.stamp #### pdf #### pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo ' DOC Building PDF' @rm -f $(DOC_MODULE).pdf @mkpdf_options=""; \ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ if test "$(?)" = "0"; then \ if test "x$(V)" = "x1"; then \ mkpdf_options="$$mkpdf_options --verbose"; \ fi; \ fi; \ if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ if test $$? != 0; then \ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ done; \ fi; \ gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) @touch pdf-build.stamp ############## clean-local: @rm -f *~ *.bak @rm -rf .libs distclean-local: @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ rm -rf tmpl; \ fi maintainer-clean-local: clean @rm -rf xml html install-data-local: @installfiles=`echo $(builddir)/html/*`; \ if test "$$installfiles" = '$(builddir)/html/*'; \ then echo 1>&2 'Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ echo ' $(INSTALL_DATA) '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ fi; \ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ fi uninstall-local: @if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ else \ installdir="$(DESTDIR)$(TARGET_DIR)"; \ fi; \ rm -rf $${installdir} # # Require gtk-doc when making dist # if ENABLE_GTK_DOC dist-check-gtkdoc: else dist-check-gtkdoc: @echo "*** gtk-doc must be installed and enabled in order to make dist" @false endif dist-hook: dist-check-gtkdoc dist-hook-local @mkdir $(distdir)/tmpl @mkdir $(distdir)/html @-cp ./tmpl/*.sgml $(distdir)/tmpl @cp ./html/* $(distdir)/html @-cp ./$(DOC_MODULE).pdf $(distdir)/ @-cp ./$(DOC_MODULE).types $(distdir)/ @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ @cd $(distdir) && rm -f $(DISTCLEANFILES) @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs

"\t" } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-select-01.rq0000644000175000017500000000002310362621550023274 00000000000000SELECT * WHERE { } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-04.rq0000644000175000017500000000011210362621550021630 00000000000000PREFIX : SELECT * WHERE { <\u0078> :\u0070 ?xx\u0078 } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-03.rq0000644000175000017500000000007410362621550022222 00000000000000PREFIX : SELECT * WHERE { ( ) :p 1 } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-general-01.rq0000644000175000017500000000003510362621550022474 00000000000000SELECT * WHERE { } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-select-02.rq0000644000175000017500000000001510362621550023276 00000000000000SELECT * { } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-03.rq0000644000175000017500000000010610362621550022705 00000000000000PREFIX q: SELECT * WHERE { FILTER (q:name( )) } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-general-02.rq0000644000175000017500000000003510362621550022475 00000000000000SELECT * WHERE { _:x } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-lists-01.rq0000644000175000017500000000007210362621550022216 00000000000000PREFIX : SELECT * WHERE { () :p 1 } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-describe01.rq0000644000175000017500000000001510362621550023521 00000000000000DESCRIBE rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-function-04.rq0000644000175000017500000000016510362621550022713 00000000000000PREFIX q: SELECT * WHERE { FILTER (q:name(1 )) . FILTER (q:name(1,2)) . FILTER (q:name(1 ,2))} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-form-ask-02.rq0000644000175000017500000000000710362621550022576 00000000000000ASK {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-dataset-01.rq0000644000175000017500000000012210362621550022501 00000000000000PREFIX : SELECT ?x FROM WHERE {} rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-bnode-02.rq0000644000175000017500000000010410362621550022144 00000000000000PREFIX : # Tab SELECT * WHERE { [ ] :p [ ] } rasqal-0.9.33/tests/sparql/SyntaxDev/Syntax-SPARQL2/syntax-esc-02.rq0000644000175000017500000000004110362621550021627 00000000000000SELECT * WHERE {