This is an automated email from the ASF dual-hosted git repository.
leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/bazel-migration by this push:
new 0aad004cd3 rdf did not work correctly. Remigrated redland and raptor
0aad004cd3 is described below
commit 0aad004cd358600d095dbd04e3b861dae5fcc30d
Author: Peter Kovacs <[email protected]>
AuthorDate: Sun Jun 14 10:28:22 2026 +0200
rdf did not work correctly.
Remigrated redland and raptor
---
CLAUDE.md | 5 +-
Migrated-packages.md | 4 +-
ext_libraries/modules/raptor2/2.0.15/BUILD.bazel | 52 +-
ext_libraries/modules/raptor2/2.0.15/MODULE.bazel | 5 +-
.../raptor2/2.0.15/{ => overlay}/BUILD.bazel | 52 +-
.../modules/raptor2/2.0.15/overlay/MODULE.bazel | 9 +
.../modules/raptor2/2.0.15/overlay/src/unistd.h | 9 +
ext_libraries/modules/raptor2/2.0.15/source.json | 16 +-
ext_libraries/modules/rasqal/0.9.33/MODULE.bazel | 5 +-
.../modules/rasqal/0.9.33/overlay/BUILD.bazel | 69 ++
.../modules/rasqal/0.9.33/overlay/MODULE.bazel | 10 +
.../rasqal/0.9.33/overlay/src/rasqal_config.h | 289 +++++++
.../rasqal/0.9.33/overlay/src/rasqal_ntriples.c | 861 +++++++++++++++++++++
.../modules/rasqal/0.9.33/overlay/src/unistd.h | 10 +
ext_libraries/modules/rasqal/0.9.33/source.json | 11 +-
ext_libraries/modules/redland/1.0.17/BUILD.bazel | 99 ++-
ext_libraries/modules/redland/1.0.17/MODULE.bazel | 5 +-
.../modules/redland/1.0.17/overlay/BUILD.bazel | 95 +++
.../modules/redland/1.0.17/overlay/MODULE.bazel | 9 +
.../redland/1.0.17/overlay/src/rdf_concepts.c | 338 ++++++++
.../redland/1.0.17/overlay/src/rdf_config.h | 389 ++++++++++
.../modules/redland/1.0.17/overlay/src/unistd.h | 9 +
.../redland/1.0.17/overlay/src/win32_rdf_config.h | 275 +++++++
ext_libraries/modules/redland/1.0.17/source.json | 14 +-
main/postprocess/BUILD.bazel | 4 +-
main/staging/BUILD.bazel | 1 +
main/unoxml/BUILD.bazel | 29 +
main/unoxml/readme.md | 18 +-
rdf-readme.md | 195 +++++
29 files changed, 2826 insertions(+), 61 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 19c6f1f073..687fb1fda6 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -219,7 +219,10 @@ one TAB-delimited line per translatable string
# dependency notes
icu - ext_libraries\modules\icu\Readme.md
-redland - ext_libraries\modules\redland\README
+redland / raptor2 / rasqal (RDF stack, native-cc static) + unordf.dll -
rdf-readme.md
+ (the modules\<lib>\README files are the original autotools docs; the Bazel
+ migration notes — overlay mechanism, *_INTERNAL/HAVE_CONFIG_H defines,
+ local_defines vs defines, *_STATIC, RAPTOR_WWW_NONE/S_ISREG — are in
rdf-readme.md)
rhino - ext_libraries\modules\rhino\README
sal_pch - was merged with sal_headers
## Out of scope
diff --git a/Migrated-packages.md b/Migrated-packages.md
index 33f7492d3a..e29729ad73 100644
--- a/Migrated-packages.md
+++ b/Migrated-packages.md
@@ -96,7 +96,9 @@ vbahelper ✅ (vbahelper.dll, msforms.dll) —
main/vbahelper/readme.md
── Layer 14 — pre-app infrastructure ─────────────────────────────────────
ucb ✅ (ucb1, cached1, srtrs1, ucpexpand1, ucpext, ucpfile1,
ucphier1,
ucppkg1, ucptdoc1, ucpftp1, ucpdav1) — main/ucb/readme.md
-unoxml ✅ (unoxml.dll — DOM/XPath/Events; unordf deferred: redland not
yet on Windows) — main/unoxml/readme.md
+unoxml ✅ (unoxml.dll — DOM/XPath/Events; unordf.dll — RDF/metadata
librdf_Repository) — main/unoxml/readme.md
+ RDF stack (native-cc, static): redland (librdf) + raptor2 +
rasqal — rdf-readme.md
+ build-side complete 2026-06-14; save *runtime* path still open
(see rdf-readme.md)
eventattacher ✅ (evtatt.dll) — main/eventattacher/readme.md
UnoControls ✅ (ctl.dll) — main/UnoControls/readme.md
dtrans ✅ (dtrans.dll, mcnttype.dll, dnd.dll, ftransl.dll,
sysdtrans.dll) — main/dtrans/readme.md
diff --git a/ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
b/ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
index 772a4835f1..d657414840 100644
--- a/ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
+++ b/ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
@@ -11,7 +11,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef HAVE_ERRNO_H": "#define HAVE_ERRNO_H 1",
"#undef HAVE_FCNTL_H": "/* #undef HAVE_FCNTL_H */",
"#undef HAVE_FETCH_H": "/* #undef HAVE_FETCH_H */",
- "#undef HAVE_GETOPT": "/* #undef HAVE_GETOPT */",
+ "#undef HAVE_GETOPT\n": "/* #undef HAVE_GETOPT */\n",
# \n: avoid prefix-clobbering HAVE_GETOPT_H/_LONG
"#undef HAVE_GETOPT_H": "/* #undef HAVE_GETOPT_H */",
"#undef HAVE_GETOPT_LONG": "/* #undef HAVE_GETOPT_LONG
*/",
"#undef HAVE_GETTIMEOFDAY": "#define HAVE_GETTIMEOFDAY 1",
@@ -30,7 +30,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef HAVE_QSORT_R": "/* #undef HAVE_QSORT_R */",
"#undef HAVE_QSORT_S": "/* #undef HAVE_QSORT_S */",
"#undef HAVE_RAPTOR_PARSE_DATE": "#define
HAVE_RAPTOR_PARSE_DATE 1",
- "#undef HAVE_SETJMP": "#define HAVE_SETJMP 1",
+ "#undef HAVE_SETJMP\n": "#define HAVE_SETJMP 1\n", #
\n: avoid prefix-clobbering HAVE_SETJMP_H
"#undef HAVE_SETJMP_H": "#define HAVE_SETJMP_H 1",
"#undef HAVE_STAT": "#define HAVE_STAT 1",
"#undef HAVE_STDDEF_H": "#define HAVE_STDDEF_H 1",
@@ -54,7 +54,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef MAINTAINER_MODE": "/* #undef MAINTAINER_MODE */",
"#undef NEED_OPTIND_DECLARATION": "/* #undef
NEED_OPTIND_DECLARATION */",
"#undef NO_MINUS_C_MINUS_O": "/* #undef NO_MINUS_C_MINUS_O
*/",
- "#undef PACKAGE": "#define PACKAGE \"raptor2\"",
+ "#undef PACKAGE\n": "#define PACKAGE
\"raptor2\"\n", # \n: avoid prefix-clobbering PACKAGE_NAME/_STRING/etc.
"#undef PACKAGE_BUGREPORT": "#define PACKAGE_BUGREPORT
\"\"",
"#undef PACKAGE_NAME": "#define PACKAGE_NAME
\"raptor2\"",
"#undef PACKAGE_STRING": "#define PACKAGE_STRING
\"raptor2 2.0.15\"",
@@ -86,7 +86,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef RAPTOR_SERIALIZER_JSON": "#define
RAPTOR_SERIALIZER_JSON 1",
"#undef RAPTOR_SERIALIZER_NQUADS": "#define
RAPTOR_SERIALIZER_NQUADS 1",
"#undef RAPTOR_SERIALIZER_NTRIPLES": "#define
RAPTOR_SERIALIZER_NTRIPLES 1",
- "#undef RAPTOR_SERIALIZER_RDFXML": "#define
RAPTOR_SERIALIZER_RDFXML 1",
+ "#undef RAPTOR_SERIALIZER_RDFXML\n": "#define
RAPTOR_SERIALIZER_RDFXML 1\n", # \n: avoid prefix-clobbering
RAPTOR_SERIALIZER_RDFXML_ABBREV
"#undef RAPTOR_SERIALIZER_RDFXML_ABBREV": "#define
RAPTOR_SERIALIZER_RDFXML_ABBREV 1",
"#undef RAPTOR_SERIALIZER_RSS_1_0": "#define
RAPTOR_SERIALIZER_RSS_1_0 1",
"#undef RAPTOR_SERIALIZER_TURTLE": "#define
RAPTOR_SERIALIZER_TURTLE 1",
@@ -124,6 +124,13 @@ RAPTOR_CONFIG_WINDOWS_SUBSTITUTIONS = {
"#undef TIME_WITH_SYS_TIME": "/* #undef TIME_WITH_SYS_TIME */",
"#undef _FILE_OFFSET_BITS": "/* #undef _FILE_OFFSET_BITS */",
"#undef HAVE_STRINGS_H": "/* #undef HAVE_STRINGS_H */",
+ # No HTTP backend: ODF metadata is local-file only, and our libxml2 was
built
+ # without NanoHTTP (xmlNanoHTTP* missing). Use RAPTOR_WWW_NONE so
+ # raptor_www_libxml.c compiles to nothing.
+ "#undef RAPTOR_WWW_LIBXML": "/* #undef RAPTOR_WWW_LIBXML */",
+ # Also inject the POSIX S_ISREG macro MSVC lacks (raptor_uri.c);
_S_IFMT/_S_IFREG
+ # come from <sys/stat.h>, which raptor_uri.c includes before using S_ISREG.
+ "#undef RAPTOR_WWW_NONE": "#define RAPTOR_WWW_NONE 1\n#ifndef
S_ISREG\n#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)\n#endif",
}
# ── Unix-specific ─────────────────────────────────────────────
@@ -222,8 +229,13 @@ RAPTOR2_CORE_SRCS = [
# Platform-specific sources
RAPTOR2_WINDOWS_SRCS = [
- "src/strcasecmp.c", # MSVC lacks strcasecmp
- "src/raptor_uri_win32.c", # Windows URI handling
+ # strcasecmp.c intentionally omitted: MSVC has stricmp, so the autotools
+ # STRCASECMP condition (strcasecmp==no AND stricmp==no) is false. We map
+ # raptor_strcasecmp->stricmp via HAVE_STRICMP instead; compiling
strcasecmp.c
+ # would redefine stricmp (raptor_internal.h macro) and clash with the CRT.
+ #
+ # raptor_uri_win32.c does NOT exist in the tarball — Windows URI handling
is
+ # inline in raptor_uri.c under #ifdef WIN32. (Phantom src from the
migrator.)
]
RAPTOR2_UNIX_SRCS = [
@@ -233,6 +245,8 @@ RAPTOR2_UNIX_SRCS = [
# ── Defines ────────────────────────────────────────────────────
RAPTOR2_COMMON_DEFINES = [
+ "RAPTOR_INTERNAL=1", # unlocks raptor_internal.h body
(structs/typedefs/macros); autotools sets it via @RAPTOR_INTERNAL_CPPFLAGS@
+ "HAVE_CONFIG_H=1", # include the generated raptor_config.h
(RAPTOR_MIN_VERSION_DECIMAL + all HAVE_*); the curated -D's below are now
redundant but harmless
"PACKAGE=\\\"raptor2\\\"",
"VERSION=\\\"2.0.15\\\"",
"RAPTOR_VERSION_MAJOR=2",
@@ -240,7 +254,7 @@ RAPTOR2_COMMON_DEFINES = [
"RAPTOR_VERSION_RELEASE=15",
"RAPTOR_VERSION_DECIMAL=20015",
"RAPTOR_XML_LIBXML=1",
- "RAPTOR_WWW_LIBXML=1",
+ "RAPTOR_WWW_NONE=1", # no HTTP backend (libxml2 has no NanoHTTP); see
WINDOWS substitutions
"RAPTOR_PARSER_RDFXML=1",
"RAPTOR_PARSER_NTRIPLES=1",
"RAPTOR_PARSER_TURTLE=1",
@@ -268,8 +282,14 @@ RAPTOR2_WINDOWS_DEFINES = [
"WIN32=1",
"_WINDOWS=1",
"_CRT_SECURE_NO_WARNINGS=1",
- "HAVE_STRCASECMP=0",
- "RAPTOR_STATIC=1", # static lib on Windows
+ # NB: do NOT define HAVE_STRCASECMP — raptor_internal.h tests it with
#ifdef,
+ # so even =0 would (wrongly) map raptor_strcasecmp to the nonexistent
+ # strcasecmp. HAVE_STRICMP routes raptor_strcasecmp->stricmp/strnicmp
(MSVC).
+ "HAVE_STRICMP=1",
+ "access=_access", # raptor_uri.c POSIX access() -> MSVC _access
+ "R_OK=4", # POSIX access() mode flag, absent from MSVC
headers
+ # RAPTOR_STATIC is intentionally NOT here — it is a propagating `defines`
+ # entry below (consumers' raptor2.h needs it to avoid dllimport).
]
RAPTOR2_LINUX_DEFINES = [
@@ -292,6 +312,7 @@ RAPTOR2_MACOS_DEFINES = [
RAPTOR2_WINDOWS_COPTS = [
"/W3",
+ "/wd4005", # identical-macro redefinition between raptor_config.h and the
curated -D defines
"/wd4996",
"/wd4244",
"/wd4267",
@@ -313,7 +334,10 @@ genrule(
}),
outs = ["src/raptor_config.h"],
cmd = "cp $< $@",
- cmd_bat = "copy $< $@", # Windows
+ # NB: cmd.exe `copy` treats `+` as the file-concatenation operator, and the
+ # bzlmod repo dir is named "raptor2+", so `copy ...raptor2+\src\x` is
mis-parsed
+ # as a concat of a nonexistent file. `type > ` does not special-case `+`.
+ cmd_bat = "type \"$<\" > \"$@\"", # Windows
)
# ── Main library target ────────────────────────────────────────
@@ -330,11 +354,17 @@ cc_library(
]) +
[":raptor2_h", ":raptor_config_h"],
includes = ["src"],
- defines = RAPTOR2_COMMON_DEFINES + select({
+ # Build-private macros (HAVE_*, PACKAGE, VERSION, RAPTOR_INTERNAL, parser/
+ # serializer flags, …) MUST be local_defines, not defines: as `defines`
they
+ # propagate to every dependent (rasqal/redland/unordf) and clobber their
own
+ # config — e.g. HAVE_STDINT_H=1 forced rasqal to #include <stdint.h>, which
+ # VS2008 lacks. Only RAPTOR_STATIC must reach consumers (raptor2.h
dllimport guard).
+ local_defines = RAPTOR2_COMMON_DEFINES + select({
"@platforms//os:windows": RAPTOR2_WINDOWS_DEFINES,
"@platforms//os:linux": RAPTOR2_LINUX_DEFINES,
"@platforms//os:macos": RAPTOR2_MACOS_DEFINES,
}),
+ defines = ["RAPTOR_STATIC=1"],
copts = select({
"@platforms//os:windows": RAPTOR2_WINDOWS_COPTS,
"//conditions:default": RAPTOR2_UNIX_COPTS,
diff --git a/ext_libraries/modules/raptor2/2.0.15/MODULE.bazel
b/ext_libraries/modules/raptor2/2.0.15/MODULE.bazel
index 1de0b415da..90b7bd8896 100644
--- a/ext_libraries/modules/raptor2/2.0.15/MODULE.bazel
+++ b/ext_libraries/modules/raptor2/2.0.15/MODULE.bazel
@@ -2,6 +2,7 @@ module(
name = "raptor2",
version = "2.0.15",
)
-bazel_dep(name = "libxslt", version = "1.1.35")
-bazel_dep(name = "curl", version = "8.7.1")
+bazel_dep(name = "rules_cc", version = "0.2.17")
+bazel_dep(name = "bazel_skylib", version = "1.7.1")
+bazel_dep(name = "libxml2", version = "2.9.10")
bazel_dep(name = "platforms", version = "1.0.0")
diff --git a/ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
b/ext_libraries/modules/raptor2/2.0.15/overlay/BUILD.bazel
similarity index 82%
copy from ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
copy to ext_libraries/modules/raptor2/2.0.15/overlay/BUILD.bazel
index 772a4835f1..d657414840 100644
--- a/ext_libraries/modules/raptor2/2.0.15/BUILD.bazel
+++ b/ext_libraries/modules/raptor2/2.0.15/overlay/BUILD.bazel
@@ -11,7 +11,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef HAVE_ERRNO_H": "#define HAVE_ERRNO_H 1",
"#undef HAVE_FCNTL_H": "/* #undef HAVE_FCNTL_H */",
"#undef HAVE_FETCH_H": "/* #undef HAVE_FETCH_H */",
- "#undef HAVE_GETOPT": "/* #undef HAVE_GETOPT */",
+ "#undef HAVE_GETOPT\n": "/* #undef HAVE_GETOPT */\n",
# \n: avoid prefix-clobbering HAVE_GETOPT_H/_LONG
"#undef HAVE_GETOPT_H": "/* #undef HAVE_GETOPT_H */",
"#undef HAVE_GETOPT_LONG": "/* #undef HAVE_GETOPT_LONG
*/",
"#undef HAVE_GETTIMEOFDAY": "#define HAVE_GETTIMEOFDAY 1",
@@ -30,7 +30,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef HAVE_QSORT_R": "/* #undef HAVE_QSORT_R */",
"#undef HAVE_QSORT_S": "/* #undef HAVE_QSORT_S */",
"#undef HAVE_RAPTOR_PARSE_DATE": "#define
HAVE_RAPTOR_PARSE_DATE 1",
- "#undef HAVE_SETJMP": "#define HAVE_SETJMP 1",
+ "#undef HAVE_SETJMP\n": "#define HAVE_SETJMP 1\n", #
\n: avoid prefix-clobbering HAVE_SETJMP_H
"#undef HAVE_SETJMP_H": "#define HAVE_SETJMP_H 1",
"#undef HAVE_STAT": "#define HAVE_STAT 1",
"#undef HAVE_STDDEF_H": "#define HAVE_STDDEF_H 1",
@@ -54,7 +54,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef MAINTAINER_MODE": "/* #undef MAINTAINER_MODE */",
"#undef NEED_OPTIND_DECLARATION": "/* #undef
NEED_OPTIND_DECLARATION */",
"#undef NO_MINUS_C_MINUS_O": "/* #undef NO_MINUS_C_MINUS_O
*/",
- "#undef PACKAGE": "#define PACKAGE \"raptor2\"",
+ "#undef PACKAGE\n": "#define PACKAGE
\"raptor2\"\n", # \n: avoid prefix-clobbering PACKAGE_NAME/_STRING/etc.
"#undef PACKAGE_BUGREPORT": "#define PACKAGE_BUGREPORT
\"\"",
"#undef PACKAGE_NAME": "#define PACKAGE_NAME
\"raptor2\"",
"#undef PACKAGE_STRING": "#define PACKAGE_STRING
\"raptor2 2.0.15\"",
@@ -86,7 +86,7 @@ RAPTOR_CONFIG_COMMON_SUBSTITUTIONS = {
"#undef RAPTOR_SERIALIZER_JSON": "#define
RAPTOR_SERIALIZER_JSON 1",
"#undef RAPTOR_SERIALIZER_NQUADS": "#define
RAPTOR_SERIALIZER_NQUADS 1",
"#undef RAPTOR_SERIALIZER_NTRIPLES": "#define
RAPTOR_SERIALIZER_NTRIPLES 1",
- "#undef RAPTOR_SERIALIZER_RDFXML": "#define
RAPTOR_SERIALIZER_RDFXML 1",
+ "#undef RAPTOR_SERIALIZER_RDFXML\n": "#define
RAPTOR_SERIALIZER_RDFXML 1\n", # \n: avoid prefix-clobbering
RAPTOR_SERIALIZER_RDFXML_ABBREV
"#undef RAPTOR_SERIALIZER_RDFXML_ABBREV": "#define
RAPTOR_SERIALIZER_RDFXML_ABBREV 1",
"#undef RAPTOR_SERIALIZER_RSS_1_0": "#define
RAPTOR_SERIALIZER_RSS_1_0 1",
"#undef RAPTOR_SERIALIZER_TURTLE": "#define
RAPTOR_SERIALIZER_TURTLE 1",
@@ -124,6 +124,13 @@ RAPTOR_CONFIG_WINDOWS_SUBSTITUTIONS = {
"#undef TIME_WITH_SYS_TIME": "/* #undef TIME_WITH_SYS_TIME */",
"#undef _FILE_OFFSET_BITS": "/* #undef _FILE_OFFSET_BITS */",
"#undef HAVE_STRINGS_H": "/* #undef HAVE_STRINGS_H */",
+ # No HTTP backend: ODF metadata is local-file only, and our libxml2 was
built
+ # without NanoHTTP (xmlNanoHTTP* missing). Use RAPTOR_WWW_NONE so
+ # raptor_www_libxml.c compiles to nothing.
+ "#undef RAPTOR_WWW_LIBXML": "/* #undef RAPTOR_WWW_LIBXML */",
+ # Also inject the POSIX S_ISREG macro MSVC lacks (raptor_uri.c);
_S_IFMT/_S_IFREG
+ # come from <sys/stat.h>, which raptor_uri.c includes before using S_ISREG.
+ "#undef RAPTOR_WWW_NONE": "#define RAPTOR_WWW_NONE 1\n#ifndef
S_ISREG\n#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)\n#endif",
}
# ── Unix-specific ─────────────────────────────────────────────
@@ -222,8 +229,13 @@ RAPTOR2_CORE_SRCS = [
# Platform-specific sources
RAPTOR2_WINDOWS_SRCS = [
- "src/strcasecmp.c", # MSVC lacks strcasecmp
- "src/raptor_uri_win32.c", # Windows URI handling
+ # strcasecmp.c intentionally omitted: MSVC has stricmp, so the autotools
+ # STRCASECMP condition (strcasecmp==no AND stricmp==no) is false. We map
+ # raptor_strcasecmp->stricmp via HAVE_STRICMP instead; compiling
strcasecmp.c
+ # would redefine stricmp (raptor_internal.h macro) and clash with the CRT.
+ #
+ # raptor_uri_win32.c does NOT exist in the tarball — Windows URI handling
is
+ # inline in raptor_uri.c under #ifdef WIN32. (Phantom src from the
migrator.)
]
RAPTOR2_UNIX_SRCS = [
@@ -233,6 +245,8 @@ RAPTOR2_UNIX_SRCS = [
# ── Defines ────────────────────────────────────────────────────
RAPTOR2_COMMON_DEFINES = [
+ "RAPTOR_INTERNAL=1", # unlocks raptor_internal.h body
(structs/typedefs/macros); autotools sets it via @RAPTOR_INTERNAL_CPPFLAGS@
+ "HAVE_CONFIG_H=1", # include the generated raptor_config.h
(RAPTOR_MIN_VERSION_DECIMAL + all HAVE_*); the curated -D's below are now
redundant but harmless
"PACKAGE=\\\"raptor2\\\"",
"VERSION=\\\"2.0.15\\\"",
"RAPTOR_VERSION_MAJOR=2",
@@ -240,7 +254,7 @@ RAPTOR2_COMMON_DEFINES = [
"RAPTOR_VERSION_RELEASE=15",
"RAPTOR_VERSION_DECIMAL=20015",
"RAPTOR_XML_LIBXML=1",
- "RAPTOR_WWW_LIBXML=1",
+ "RAPTOR_WWW_NONE=1", # no HTTP backend (libxml2 has no NanoHTTP); see
WINDOWS substitutions
"RAPTOR_PARSER_RDFXML=1",
"RAPTOR_PARSER_NTRIPLES=1",
"RAPTOR_PARSER_TURTLE=1",
@@ -268,8 +282,14 @@ RAPTOR2_WINDOWS_DEFINES = [
"WIN32=1",
"_WINDOWS=1",
"_CRT_SECURE_NO_WARNINGS=1",
- "HAVE_STRCASECMP=0",
- "RAPTOR_STATIC=1", # static lib on Windows
+ # NB: do NOT define HAVE_STRCASECMP — raptor_internal.h tests it with
#ifdef,
+ # so even =0 would (wrongly) map raptor_strcasecmp to the nonexistent
+ # strcasecmp. HAVE_STRICMP routes raptor_strcasecmp->stricmp/strnicmp
(MSVC).
+ "HAVE_STRICMP=1",
+ "access=_access", # raptor_uri.c POSIX access() -> MSVC _access
+ "R_OK=4", # POSIX access() mode flag, absent from MSVC
headers
+ # RAPTOR_STATIC is intentionally NOT here — it is a propagating `defines`
+ # entry below (consumers' raptor2.h needs it to avoid dllimport).
]
RAPTOR2_LINUX_DEFINES = [
@@ -292,6 +312,7 @@ RAPTOR2_MACOS_DEFINES = [
RAPTOR2_WINDOWS_COPTS = [
"/W3",
+ "/wd4005", # identical-macro redefinition between raptor_config.h and the
curated -D defines
"/wd4996",
"/wd4244",
"/wd4267",
@@ -313,7 +334,10 @@ genrule(
}),
outs = ["src/raptor_config.h"],
cmd = "cp $< $@",
- cmd_bat = "copy $< $@", # Windows
+ # NB: cmd.exe `copy` treats `+` as the file-concatenation operator, and the
+ # bzlmod repo dir is named "raptor2+", so `copy ...raptor2+\src\x` is
mis-parsed
+ # as a concat of a nonexistent file. `type > ` does not special-case `+`.
+ cmd_bat = "type \"$<\" > \"$@\"", # Windows
)
# ── Main library target ────────────────────────────────────────
@@ -330,11 +354,17 @@ cc_library(
]) +
[":raptor2_h", ":raptor_config_h"],
includes = ["src"],
- defines = RAPTOR2_COMMON_DEFINES + select({
+ # Build-private macros (HAVE_*, PACKAGE, VERSION, RAPTOR_INTERNAL, parser/
+ # serializer flags, …) MUST be local_defines, not defines: as `defines`
they
+ # propagate to every dependent (rasqal/redland/unordf) and clobber their
own
+ # config — e.g. HAVE_STDINT_H=1 forced rasqal to #include <stdint.h>, which
+ # VS2008 lacks. Only RAPTOR_STATIC must reach consumers (raptor2.h
dllimport guard).
+ local_defines = RAPTOR2_COMMON_DEFINES + select({
"@platforms//os:windows": RAPTOR2_WINDOWS_DEFINES,
"@platforms//os:linux": RAPTOR2_LINUX_DEFINES,
"@platforms//os:macos": RAPTOR2_MACOS_DEFINES,
}),
+ defines = ["RAPTOR_STATIC=1"],
copts = select({
"@platforms//os:windows": RAPTOR2_WINDOWS_COPTS,
"//conditions:default": RAPTOR2_UNIX_COPTS,
diff --git a/ext_libraries/modules/raptor2/2.0.15/overlay/MODULE.bazel
b/ext_libraries/modules/raptor2/2.0.15/overlay/MODULE.bazel
new file mode 100644
index 0000000000..4952deb080
--- /dev/null
+++ b/ext_libraries/modules/raptor2/2.0.15/overlay/MODULE.bazel
@@ -0,0 +1,9 @@
+module(
+ name = "raptor2",
+ version = "2.0.15",
+)
+
+bazel_dep(name = "rules_cc", version = "0.2.17")
+bazel_dep(name = "bazel_skylib", version = "1.7.1")
+bazel_dep(name = "libxml2", version = "2.9.10")
+bazel_dep(name = "platforms", version = "1.0.0")
diff --git a/ext_libraries/modules/raptor2/2.0.15/overlay/src/unistd.h
b/ext_libraries/modules/raptor2/2.0.15/overlay/src/unistd.h
new file mode 100644
index 0000000000..0b2966afaa
--- /dev/null
+++ b/ext_libraries/modules/raptor2/2.0.15/overlay/src/unistd.h
@@ -0,0 +1,9 @@
+/* Dummy unistd.h for the MSVC (Windows) build.
+ *
+ * The flex-generated lexers (turtle_lexer.h, ntriples, etc.) do an
+ * unconditional `#include <unistd.h>`. MSVC has no unistd.h; the dmake build
+ * satisfied this with the empty stub delivered by main/soltools/winunistd on
+ * the solver include path (-I$(PRJ)/$(INPATH)/inc). Cross-repo `-I main/...`
+ * is fragile under Bazel, so this overlay reproduces the same empty stub on
+ * raptor2's own include path (-Isrc).
+ */
diff --git a/ext_libraries/modules/raptor2/2.0.15/source.json
b/ext_libraries/modules/raptor2/2.0.15/source.json
index d887557cfa..6181ef2749 100644
--- a/ext_libraries/modules/raptor2/2.0.15/source.json
+++ b/ext_libraries/modules/raptor2/2.0.15/source.json
@@ -2,13 +2,11 @@
"url": "https://download.librdf.org/source/raptor2-2.0.15.tar.gz",
"integrity": "sha256-rafwulR4ezNIXQkNPSaAUzUgzUQm0vf7R4LdSmoUgO0=",
"strip_prefix": "raptor2-2.0.15",
- "patches": {
- "raptor2-2.0.15.patch":
"sha256-32zuch/mbAtRP3hstQRh2g1ggFxweobysWXX5pJV1rU=",
- "raptor2-2.0.15.patch.nspace":
"sha256-O1vGY+tDgBqbJ9lovzotH8Iy0hBBJUd9dmQ4KgT0aXI=",
- "raptor2-2.0.15.patch.os2":
"sha256-FbSfYnPJtvNorKnJMNc1jjbPQ67fKWpEeT/lhxmrXzg=",
- "raptor2-2.0.15.patch.win32":
"sha256-EdSBMxtce8S/dcywtbSEJXXbEWktWPbFwXFfivDCFnY=",
- "raptor2-2.0.15.patch.dmake":
"sha256-ppbyKmd0D2SiWS8rP34zOAQBjxYSkeqkVinXeirknzU="
+ "overlay": {
+ "MODULE.bazel": "sha256-XZycZuc5Q7ZGwJEre8zEgm7OrCR5Js6ESjuhoErYxe4=",
+ "BUILD.bazel": "sha256-L3vxJ6FeveNptTwWTI4ba6q5fFNwuFn9/4XHrYQfnKg=",
+ "src/unistd.h": "sha256-jkN7WWHGaIZYf5O63jqD0HhtohfeRrWnLKQdI+Klj3U="
},
- "patch_strip": 1,
- "build_file": "BUILD.bazel"
-}
\ No newline at end of file
+ "patches": {},
+ "patch_strip": 0
+}
diff --git a/ext_libraries/modules/rasqal/0.9.33/MODULE.bazel
b/ext_libraries/modules/rasqal/0.9.33/MODULE.bazel
index c676c83a8b..b90a6474dc 100644
--- a/ext_libraries/modules/rasqal/0.9.33/MODULE.bazel
+++ b/ext_libraries/modules/rasqal/0.9.33/MODULE.bazel
@@ -4,4 +4,7 @@ module(
compatibility_level = 1,
)
-bazel_dep(name = "raptor2", version = "2.0.15")
\ No newline at end of file
+bazel_dep(name = "rules_cc", version = "0.2.17")
+bazel_dep(name = "bazel_skylib", version = "1.7.1")
+bazel_dep(name = "raptor2", version = "2.0.15")
+bazel_dep(name = "libxml2", version = "2.9.10")
\ No newline at end of file
diff --git a/ext_libraries/modules/rasqal/0.9.33/overlay/BUILD.bazel
b/ext_libraries/modules/rasqal/0.9.33/overlay/BUILD.bazel
new file mode 100644
index 0000000000..ae282abdf5
--- /dev/null
+++ b/ext_libraries/modules/rasqal/0.9.33/overlay/BUILD.bazel
@@ -0,0 +1,69 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+
+package(default_visibility = ["//visibility:public"])
+
+# ── configure replacement ────────────────────────────────────
+# rasqal.h is the only generated public header. Substitutions mirror the
+# legacy makefile.mk Windows recipe (PERL -p -e on src/rasqal.h.in).
+expand_template(
+ name = "rasqal_h",
+ template = "src/rasqal.h.in",
+ out = "src/rasqal.h",
+ substitutions = {
+ "@RASQAL_VERSION_DECIMAL@": "933",
+ "@VERSION@": "0.9.33",
+ "@RASQAL_VERSION_MAJOR@": "0",
+ "@RASQAL_VERSION_MINOR@": "9",
+ "@RASQAL_VERSION_RELEASE@": "33",
+ "@RAPTOR_VERSION_DEC@": "2.0.15",
+ "@HAVE_SYS_TIME_H@": "0",
+ "@HAVE_TIME_H@": "1",
+ },
+)
+
+# ── Main library target ──────────────────────────────────────
+# Windows-only native build. Config comes from the hand-maintained
+# src/win32_rasqal_config.h (pulled in by every source via `#ifdef WIN32`),
+# so no autotools/config-header generation and no legacy patches are needed.
+# RASQAL_STATIC ⇒ RASQAL_API expands empty (no __declspec(dllimport)) so the
+# static lib exposes undecorated C symbols for unordf/redland to link.
+cc_library(
+ name = "rasqal",
+ srcs = glob(
+ ["src/*.c"],
+ exclude = ["src/rasqal_query_test.c"], # test main, not part of the
lib
+ ) + ["libsv/sv.c"], # libsv/libsv.la is an unconditional LIBADD
+ hdrs = glob(["src/*.h", "libsv/*.h"]) + [":rasqal_h"],
+ includes = [
+ "src", # rasqal.h (generated), win32_rasqal_config.h, sparql_*.h,
sv_config.h
+ "libsv", # sv.h for rasqal_format_sv.c
+ ],
+ # Build-private macros are local_defines so they don't propagate to
consumers
+ # (redland/unordf) and clobber their config — same trap as raptor2's
HAVE_STDINT_H.
+ local_defines = [
+ "WIN32=1", # selects win32_rasqal_config.h in every
source (MSVC shims)
+ "HAVE_CONFIG_H=1", # selects rasqal_config.h (HAVE_* feature
flags); dmake defines both
+ "RASQAL_INTERNAL=1", # unlocks rasqal_internal.h body;
autotools sets it via @RASQAL_INTERNAL_CPPFLAGS@
+ "SV_CONFIG=1", # dmake -DSV_CONFIG: libsv/sv.c includes
sv_config.h (sv_*->rasqal_sv_* renames)
+ "_CRT_SECURE_NO_WARNINGS=1",
+ ],
+ defines = ["RASQAL_STATIC=1"], # RASQAL_API → empty; consumers' rasqal.h
needs it (no dllimport)
+ copts = [
+ "/W3",
+ "/wd4005", # benign identical-macro redefinition between
rasqal_config.h and win32_rasqal_config.h
+ "/wd4996",
+ "/wd4244",
+ "/wd4267",
+ "/wd4305",
+ "/wd4018",
+ "/wd4101",
+ "/wd4133",
+ ],
+ linkopts = ["ws2_32.lib"], # timeval/winsock via win32_rasqal_config.h
+ deps = [
+ "@raptor2//:raptor2",
+ "@libxml2//:libxml2",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/ext_libraries/modules/rasqal/0.9.33/overlay/MODULE.bazel
b/ext_libraries/modules/rasqal/0.9.33/overlay/MODULE.bazel
new file mode 100644
index 0000000000..a18d7dcaa9
--- /dev/null
+++ b/ext_libraries/modules/rasqal/0.9.33/overlay/MODULE.bazel
@@ -0,0 +1,10 @@
+module(
+ name = "rasqal",
+ version = "0.9.33",
+ compatibility_level = 1,
+)
+
+bazel_dep(name = "rules_cc", version = "0.2.17")
+bazel_dep(name = "bazel_skylib", version = "1.7.1")
+bazel_dep(name = "raptor2", version = "2.0.15")
+bazel_dep(name = "libxml2", version = "2.9.10")
diff --git a/ext_libraries/modules/rasqal/0.9.33/overlay/src/rasqal_config.h
b/ext_libraries/modules/rasqal/0.9.33/overlay/src/rasqal_config.h
new file mode 100644
index 0000000000..6f06b58f83
--- /dev/null
+++ b/ext_libraries/modules/rasqal/0.9.33/overlay/src/rasqal_config.h
@@ -0,0 +1,289 @@
+/* src/rasqal_config.h. Generated from rasqal_config.h.in by configure. */
+/* 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 */
+#define FLEX_VERSION_DECIMAL 00000
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #define HAVE_DLFCN_H */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <float.h> header file. */
+#define HAVE_FLOAT_H 1
+
+/* Define to 1 if you have the <gcrypt.h> header file. */
+/* #undef HAVE_GCRYPT_H */
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#define HAVE_GETOPT_LONG 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define to 1 if you have the <gmp.h> 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. */
+#define HAVE_INITSTATE 1
+
+/* Define to 1 if you have the `initstate_r' function. */
+/* #undef HAVE_INITSTATE_R */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <libxml/schemasInternals.h> header file. */
+#define HAVE_LIBXML_SCHEMASINTERNALS_H 1
+
+/* Define to 1 if you have the <libxml/xmlschemastypes.h> header file. */
+#define HAVE_LIBXML_XMLSCHEMASTYPES_H 1
+
+/* Define to 1 if you have the <libxml/xmlschemas.h> header file. */
+#define HAVE_LIBXML_XMLSCHEMAS_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <math.h> header file. */
+#define HAVE_MATH_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <mhash.h> header file. */
+/* #undef HAVE_MHASH_H */
+
+/* Define to 1 if you have the <mpfr.h> header file. */
+/* #undef HAVE_MPFR_H */
+
+/* Define to 1 if you have the `rand' function. */
+#define HAVE_RAND 1
+
+/* Define to 1 if you have the `random' function. */
+#define HAVE_RANDOM 1
+
+/* Define to 1 if you have the `random_r' function. */
+/* #undef HAVE_RANDOM_R */
+
+/* Define to 1 if you have the `rand_r' function. */
+#define HAVE_RAND_R 1
+
+/* Define to 1 if you have the <regex.h> 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. */
+#define HAVE_SRAND 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+/* #undef HAVE_STRCASECMP */
+
+/* Define to 1 if you have the `stricmp' function. */
+#define HAVE_STRICMP 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `timegm' function. */
+/* #undef HAVE_TIMEGM */
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* struct tm has tm_gmtoff field */
+/* #undef HAVE_TM_GMTOFF */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <uuid/uuid.h> header file. */
+/* #undef HAVE_UUID_UUID_H */
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Is __FUNCTION__ available */
+#define HAVE___FUNCTION__ 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* 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 */
+#define PACKAGE "rasqal"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://bugs.librdf.org/"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "Rasqal RDF Query Library"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "Rasqal RDF Query Library 0.9.33"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "rasqal"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.9.33"
+
+/* 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() */
+#define RANDOM_ALGO_RAND 1
+
+/* 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 */
+#define RASQAL_DECIMAL_NONE 1
+
+/* Use gcrypt library for message digests */
+/* #undef RASQAL_DIGEST_GCRYPT */
+
+/* Use internal routines for message digests */
+#define RASQAL_DIGEST_INTERNAL 1
+
+/* Use mhash library for message digests */
+/* #undef RASQAL_DIGEST_MHASH */
+
+/* Use no message digest library */
+/* #undef RASQAL_DIGEST_NONE */
+
+/* Building LAQRS query */
+#define RASQAL_QUERY_LAQRS 1
+
+/* Building SPARQL query */
+#define RASQAL_QUERY_SPARQL 1
+
+/* 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 */
+#define RASQAL_UUID_INTERNAL 1
+
+/* 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 */
+#define RASQAL_VERSION_DECIMAL 933
+
+/* Major version number */
+#define RASQAL_VERSION_MAJOR 0
+
+/* Minor version number */
+#define RASQAL_VERSION_MINOR 9
+
+/* Release version number */
+#define RASQAL_VERSION_RELEASE 33
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+/* #undef TIME_WITH_SYS_TIME */
+
+/* Version number of package */
+#define VERSION "0.9.33"
+
+/* 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[]'. */
+#define YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
diff --git a/ext_libraries/modules/rasqal/0.9.33/overlay/src/rasqal_ntriples.c
b/ext_libraries/modules/rasqal/0.9.33/overlay/src/rasqal_ntriples.c
new file mode 100644
index 0000000000..72523d5a2f
--- /dev/null
+++ b/ext_libraries/modules/rasqal/0.9.33/overlay/src/rasqal_ntriples.c
@@ -0,0 +1,861 @@
+/* -*- Mode: c; c-basic-offset: 2 -*-
+ *
+ * rasqal_ntriples.c - Rasqal N-Triples parsing utilities
+ *
+ * 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 <rasqal_config.h>
+#endif
+
+#ifdef WIN32
+#include <win32_rasqal_config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#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\"^^<URI-ref> 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;
+}
diff --git a/ext_libraries/modules/rasqal/0.9.33/overlay/src/unistd.h
b/ext_libraries/modules/rasqal/0.9.33/overlay/src/unistd.h
new file mode 100644
index 0000000000..278e27de9d
--- /dev/null
+++ b/ext_libraries/modules/rasqal/0.9.33/overlay/src/unistd.h
@@ -0,0 +1,10 @@
+/* Dummy unistd.h for the MSVC (Windows) build.
+ *
+ * Faithful to dmake: src/makefile.mk compiles with -DHAVE_CONFIG_H, so sources
+ * do `#ifdef HAVE_UNISTD_H #include <unistd.h>` (rasqal_config.h sets it to
1).
+ * dmake satisfies that include via `-I$(PRJ)/$(INPATH)/inc`, the solver
include
+ * dir, which holds the empty unistd.h stub delivered by
main/soltools/winunistd.
+ * Cross-repo `-I main/...` is fragile under Bazel, so this overlay reproduces
the
+ * same empty stub on rasqal's own include path (-Isrc). The POSIX functions
+ * rasqal uses on Windows come from <io.h>/<windows.h> via
win32_rasqal_config.h.
+ */
diff --git a/ext_libraries/modules/rasqal/0.9.33/source.json
b/ext_libraries/modules/rasqal/0.9.33/source.json
index 464b12d495..d6123f9bfa 100644
--- a/ext_libraries/modules/rasqal/0.9.33/source.json
+++ b/ext_libraries/modules/rasqal/0.9.33/source.json
@@ -1,5 +1,14 @@
{
"url": "https://download.librdf.org/source/rasqal-0.9.33.tar.gz",
"integrity": "sha256-aSTJrGVwvSQalmn4O0Z8cooyJHC/NPSy2k9pSSzP2Xw=",
- "strip_prefix": "rasqal-0.9.33"
+ "strip_prefix": "rasqal-0.9.33",
+ "overlay": {
+ "MODULE.bazel": "sha256-LzoH6hfz7IOqbWsWmgBZo1WyrQNcdj2ZFRKI7KJ+Y3k=",
+ "BUILD.bazel": "sha256-hpY38TBFs0Y3ma+Q/D8JK/sll6Pl+1aZMXgJW6I2/gs=",
+ "src/rasqal_config.h":
"sha256-9xHwERo71aVsFYEfXa2qhSleuOO5Bq4nNHjq0xwXcCA=",
+ "src/unistd.h": "sha256-8UrEOC4mwmG08FixBPRjvzV3XeyrgQ0wapUzpWISf1g=",
+ "src/rasqal_ntriples.c":
"sha256-PPZDmfGN2UigNKRaspV7NybIHRA7zV3HBxxtUjVbMUg="
+ },
+ "patches": {},
+ "patch_strip": 0
}
diff --git a/ext_libraries/modules/redland/1.0.17/BUILD.bazel
b/ext_libraries/modules/redland/1.0.17/BUILD.bazel
index f9dee0585c..e92cc25fe7 100644
--- a/ext_libraries/modules/redland/1.0.17/BUILD.bazel
+++ b/ext_libraries/modules/redland/1.0.17/BUILD.bazel
@@ -1,26 +1,95 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
-load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
package(default_visibility = ["//visibility:public"])
-filegroup(
- name = "all_srcs",
- srcs = glob(["**"]),
-)
+# Native-cc build of librdf (redland), Windows/MSVC.
+#
+# Originally configure_make, but that needs a bash+make toolchain
(rules_foreign_cc
+# could not even bootstrap GNU Make under VS2008 — w32os.c uses C99 mid-block
+# declarations the VS2008 C compiler rejects), which contradicts the project
goal
+# of eliminating the Cygwin/make dependency. raptor2 and rasqal are
native-cc, so
+# redland is too — no configure, no make, no cross-toolchain linking.
+#
+# Source set + defines are taken verbatim from the dmake recipe
+# (redland-1.0.17.patch.dmake src/makefile.mk SLOFILES + CDEFS):
SQL/mysql/pgsql/
+# sqlite/tstore/virtuoso/bdb backends and memcmp.c are excluded. Config comes
from
+# the .win32-patched rdf_config.h (HAVE_CONFIG_H) + win32_rdf_config.h (WIN32),
+# both supplied as overlay files.
+
+REDLAND_SRCS = [
+ "src/rdf_concepts.c",
+ "src/rdf_digest.c",
+ "src/rdf_digest_md5.c",
+ "src/rdf_digest_sha1.c",
+ "src/rdf_files.c",
+ "src/rdf_hash.c",
+ "src/rdf_hash_cursor.c",
+ "src/rdf_hash_memory.c",
+ "src/rdf_heuristics.c",
+ "src/rdf_init.c",
+ "src/rdf_iterator.c",
+ "src/rdf_list.c",
+ "src/rdf_log.c",
+ "src/rdf_model.c",
+ "src/rdf_model_storage.c",
+ "src/rdf_node.c",
+ "src/rdf_node_common.c",
+ "src/rdf_parser.c",
+ "src/rdf_parser_raptor.c",
+ "src/rdf_query.c",
+ "src/rdf_query_rasqal.c",
+ "src/rdf_query_results.c",
+ "src/rdf_raptor.c",
+ "src/rdf_serializer.c",
+ "src/rdf_serializer_raptor.c",
+ "src/rdf_statement.c",
+ "src/rdf_statement_common.c",
+ "src/rdf_storage.c",
+ "src/rdf_storage_file.c",
+ "src/rdf_storage_hashes.c",
+ "src/rdf_storage_list.c",
+ "src/rdf_storage_trees.c",
+ "src/rdf_stream.c",
+ "src/rdf_uri.c",
+ "src/rdf_utf8.c",
+]
-configure_make(
+cc_library(
name = "redland",
- configure_in_place = True,
- configure_options = [
- "--disable-shared",
- "--enable-static",
- "--with-threads=no",
- "--disable-modular",
+ srcs = REDLAND_SRCS,
+ hdrs = glob(["src/*.h"]),
+ includes = ["src"], # redland.h, rdf_config.h, win32_rdf_config.h,
unistd.h stub
+ # Build-private macros: local_defines so they don't propagate to unordf.
+ # From dmake CDEFS (redland-1.0.17.patch.dmake).
+ local_defines = [
+ "WIN32=1", # selects win32_rdf_config.h (MSVC shims) in
every source
+ "_WINDOWS=1",
+ "HAVE_CONFIG_H=1", # selects rdf_config.h (HAVE_* feature flags)
+ "LIBRDF_INTERNAL=1", # unlocks rdf_internal.h body
+ "RAPTOR_INTERNAL=1", # dmake sets it; harmless (redland uses
raptor2's public API)
+ "_CRT_SECURE_NO_WARNINGS=1",
],
- lib_source = ":all_srcs",
- out_static_libs = ["librdf.a"],
+ # REDLAND_API → empty (librdf.h): plain C symbols in this static lib, and
+ # consumers (unordf) must see the same to avoid
__declspec(dllimport)/__imp_.
+ # REDLAND_STATIC is checked before LIBRDF_INTERNAL, so it also suppresses
the
+ # dllexport path when building redland itself. Propagated to dependents.
+ defines = ["REDLAND_STATIC=1"],
+ copts = [
+ "/W3",
+ "/wd4005", # benign identical-macro redefinition (rdf_config.h vs
win32_rdf_config.h)
+ "/wd4996",
+ "/wd4244",
+ "/wd4267",
+ "/wd4305",
+ "/wd4018",
+ "/wd4101",
+ "/wd4133",
+ ],
+ linkopts = ["ws2_32.lib"],
deps = [
"@raptor2//:raptor2",
"@rasqal//:rasqal",
+ "@libxml2//:libxml2",
],
-)
\ No newline at end of file
+ visibility = ["//visibility:public"],
+)
diff --git a/ext_libraries/modules/redland/1.0.17/MODULE.bazel
b/ext_libraries/modules/redland/1.0.17/MODULE.bazel
index 039666534b..aef7453929 100644
--- a/ext_libraries/modules/redland/1.0.17/MODULE.bazel
+++ b/ext_libraries/modules/redland/1.0.17/MODULE.bazel
@@ -2,5 +2,8 @@ module(
name = "redland",
version = "1.0.17",
)
+
+bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "raptor2", version = "2.0.15")
-bazel_dep(name = "rasqal", version = "0.9.33")
\ No newline at end of file
+bazel_dep(name = "rasqal", version = "0.9.33")
+bazel_dep(name = "libxml2", version = "2.9.10")
diff --git a/ext_libraries/modules/redland/1.0.17/overlay/BUILD.bazel
b/ext_libraries/modules/redland/1.0.17/overlay/BUILD.bazel
new file mode 100644
index 0000000000..e92cc25fe7
--- /dev/null
+++ b/ext_libraries/modules/redland/1.0.17/overlay/BUILD.bazel
@@ -0,0 +1,95 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+package(default_visibility = ["//visibility:public"])
+
+# Native-cc build of librdf (redland), Windows/MSVC.
+#
+# Originally configure_make, but that needs a bash+make toolchain
(rules_foreign_cc
+# could not even bootstrap GNU Make under VS2008 — w32os.c uses C99 mid-block
+# declarations the VS2008 C compiler rejects), which contradicts the project
goal
+# of eliminating the Cygwin/make dependency. raptor2 and rasqal are
native-cc, so
+# redland is too — no configure, no make, no cross-toolchain linking.
+#
+# Source set + defines are taken verbatim from the dmake recipe
+# (redland-1.0.17.patch.dmake src/makefile.mk SLOFILES + CDEFS):
SQL/mysql/pgsql/
+# sqlite/tstore/virtuoso/bdb backends and memcmp.c are excluded. Config comes
from
+# the .win32-patched rdf_config.h (HAVE_CONFIG_H) + win32_rdf_config.h (WIN32),
+# both supplied as overlay files.
+
+REDLAND_SRCS = [
+ "src/rdf_concepts.c",
+ "src/rdf_digest.c",
+ "src/rdf_digest_md5.c",
+ "src/rdf_digest_sha1.c",
+ "src/rdf_files.c",
+ "src/rdf_hash.c",
+ "src/rdf_hash_cursor.c",
+ "src/rdf_hash_memory.c",
+ "src/rdf_heuristics.c",
+ "src/rdf_init.c",
+ "src/rdf_iterator.c",
+ "src/rdf_list.c",
+ "src/rdf_log.c",
+ "src/rdf_model.c",
+ "src/rdf_model_storage.c",
+ "src/rdf_node.c",
+ "src/rdf_node_common.c",
+ "src/rdf_parser.c",
+ "src/rdf_parser_raptor.c",
+ "src/rdf_query.c",
+ "src/rdf_query_rasqal.c",
+ "src/rdf_query_results.c",
+ "src/rdf_raptor.c",
+ "src/rdf_serializer.c",
+ "src/rdf_serializer_raptor.c",
+ "src/rdf_statement.c",
+ "src/rdf_statement_common.c",
+ "src/rdf_storage.c",
+ "src/rdf_storage_file.c",
+ "src/rdf_storage_hashes.c",
+ "src/rdf_storage_list.c",
+ "src/rdf_storage_trees.c",
+ "src/rdf_stream.c",
+ "src/rdf_uri.c",
+ "src/rdf_utf8.c",
+]
+
+cc_library(
+ name = "redland",
+ srcs = REDLAND_SRCS,
+ hdrs = glob(["src/*.h"]),
+ includes = ["src"], # redland.h, rdf_config.h, win32_rdf_config.h,
unistd.h stub
+ # Build-private macros: local_defines so they don't propagate to unordf.
+ # From dmake CDEFS (redland-1.0.17.patch.dmake).
+ local_defines = [
+ "WIN32=1", # selects win32_rdf_config.h (MSVC shims) in
every source
+ "_WINDOWS=1",
+ "HAVE_CONFIG_H=1", # selects rdf_config.h (HAVE_* feature flags)
+ "LIBRDF_INTERNAL=1", # unlocks rdf_internal.h body
+ "RAPTOR_INTERNAL=1", # dmake sets it; harmless (redland uses
raptor2's public API)
+ "_CRT_SECURE_NO_WARNINGS=1",
+ ],
+ # REDLAND_API → empty (librdf.h): plain C symbols in this static lib, and
+ # consumers (unordf) must see the same to avoid
__declspec(dllimport)/__imp_.
+ # REDLAND_STATIC is checked before LIBRDF_INTERNAL, so it also suppresses
the
+ # dllexport path when building redland itself. Propagated to dependents.
+ defines = ["REDLAND_STATIC=1"],
+ copts = [
+ "/W3",
+ "/wd4005", # benign identical-macro redefinition (rdf_config.h vs
win32_rdf_config.h)
+ "/wd4996",
+ "/wd4244",
+ "/wd4267",
+ "/wd4305",
+ "/wd4018",
+ "/wd4101",
+ "/wd4133",
+ ],
+ linkopts = ["ws2_32.lib"],
+ deps = [
+ "@raptor2//:raptor2",
+ "@rasqal//:rasqal",
+ "@libxml2//:libxml2",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/ext_libraries/modules/redland/1.0.17/overlay/MODULE.bazel
b/ext_libraries/modules/redland/1.0.17/overlay/MODULE.bazel
new file mode 100644
index 0000000000..aef7453929
--- /dev/null
+++ b/ext_libraries/modules/redland/1.0.17/overlay/MODULE.bazel
@@ -0,0 +1,9 @@
+module(
+ name = "redland",
+ version = "1.0.17",
+)
+
+bazel_dep(name = "rules_cc", version = "0.2.17")
+bazel_dep(name = "raptor2", version = "2.0.15")
+bazel_dep(name = "rasqal", version = "0.9.33")
+bazel_dep(name = "libxml2", version = "2.9.10")
diff --git a/ext_libraries/modules/redland/1.0.17/overlay/src/rdf_concepts.c
b/ext_libraries/modules/redland/1.0.17/overlay/src/rdf_concepts.c
new file mode 100644
index 0000000000..e90d97c409
--- /dev/null
+++ b/ext_libraries/modules/redland/1.0.17/overlay/src/rdf_concepts.c
@@ -0,0 +1,338 @@
+/* -*- Mode: c; c-basic-offset: 2 -*-
+ *
+ * rdf_concepts.c - Nodes representing concepts from the RDF Model
+ *
+ * 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.
+ *
+ *
+ */
+
+
+
+#ifdef HAVE_CONFIG_H
+#include <rdf_config.h>
+#endif
+
+#ifdef WIN32
+#include <win32_rdf_config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <redland.h>
+#include <rdf_node.h>
+
+#ifndef STANDALONE
+
+/* FIXME: All the stuff here and in rdf_concepts.h should be machine
+ * generated from the schemas but there is a catch-22 here - can't do
+ * it without representing it
+ */
+
+
+/* TAKE CARE: Tokens != Labels */
+
+/* Tokens used by the RDF world */
+static const char* const librdf_concept_tokens[LIBRDF_CONCEPT_LAST+1]={
+ /* RDF M&S */
+ "Alt", "Bag", "Property", "Seq", "Statement", "object", "predicate",
"subject", "type", "value", "li",
+ "RDF", "Description",
+ "aboutEach", "aboutEachPrefix",
+ /* all new in RDF/XML revised */
+ "nodeID",
+ "List", "first", "rest", "nil",
+ "XMLLiteral",
+
+ /* RDF S */
+ "Class", "ConstraintProperty", "ConstraintResource", "Container",
"ContainerMembershipProperty", "Literal", "Resource", "comment", "domain",
"isDefinedBy", "label", "range", "seeAlso", "subClassOf", "subPropertyOf",
+
+ /* RDF 1.1 */
+ "HTML", "langString"
+};
+
+
+static const unsigned char * const librdf_concept_ms_namespace=(const unsigned
char *)"http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+static const unsigned char * const librdf_concept_schema_namespace=(const
unsigned char *)"http://www.w3.org/2000/01/rdf-schema#";
+
+/**
+ * librdf_init_concepts:
+ * @world: redland world object
+ *
+ * INTERNAL - Initialise the concepts module.
+ *
+ **/
+void
+librdf_init_concepts(librdf_world *world)
+{
+ int i;
+
+ /* Create the Unique URI objects */
+ world->concept_ms_namespace_uri = librdf_new_uri(world,
librdf_concept_ms_namespace);
+ world->concept_schema_namespace_uri = librdf_new_uri(world,
librdf_concept_schema_namespace);
+ /* MSVC does not seem to be able to export global data from DLLs */
+ /* world->xsd_namespace_uri = librdf_new_uri(world,
raptor_xmlschema_datatypes_namespace_uri); */
+ world->xsd_namespace_uri = librdf_new_uri(world,
"http://www.w3.org/2001/XMLSchema#");
+ if(!world->concept_ms_namespace_uri ||
+ !world->concept_schema_namespace_uri ||
+ !world->xsd_namespace_uri)
+ LIBRDF_FATAL1(world, LIBRDF_FROM_CONCEPTS, "Out of memory creating
namespace URIs");
+
+ /* Create arrays for the M&S and Schema resource nodes and uris */
+ world->concept_uris = LIBRDF_CALLOC(librdf_uri**, LIBRDF_CONCEPT_LAST + 1,
+ sizeof(librdf_uri*));
+ world->concept_resources = LIBRDF_CALLOC(librdf_node**, LIBRDF_CONCEPT_LAST
+ 1,
+ sizeof(librdf_node*));
+ if(!world->concept_uris || !world->concept_resources)
+ LIBRDF_FATAL1(world, LIBRDF_FROM_CONCEPTS, "Out of memory creating
node/uri arrays");
+
+ /* Create the M&S and Schema resource nodes */
+ for (i = 0; i <= LIBRDF_CONCEPT_LAST; i++) {
+ librdf_uri* ns_uri = (LIBRDF_CONCEPT_FIRST_S_ID <= i &&
+ i <= LIBRDF_CONCEPT_LAST_S_ID) ?
+ world->concept_schema_namespace_uri : world->concept_ms_namespace_uri;
+ const unsigned char * token = (const unsigned char
*)librdf_concept_tokens[i];
+
+ world->concept_resources[i] = librdf_new_node_from_uri_local_name(world,
ns_uri, token);
+ if(!world->concept_resources[i])
+ LIBRDF_FATAL1(world, LIBRDF_FROM_CONCEPTS, "Failed to create Node from
URI\n");
+
+ /* keep shared copy of URI from node */
+ world->concept_uris[i] = librdf_node_get_uri(world->concept_resources[i]);
+ }
+}
+
+
+/**
+ * librdf_get_concept_ms_namespace:
+ * @world: librdf world object
+ *
+ * Get a shared #librdf_uri for the RDF Syntax namespace.
+ *
+ * Return value: #librdf_uri pointer or NULL on failure.
+ */
+librdf_uri *
+librdf_get_concept_ms_namespace(librdf_world *world)
+{
+ librdf_world_open(world);
+ return world->concept_ms_namespace_uri;
+}
+
+
+/**
+ * librdf_get_concept_schema_namespace:
+ * @world: librdf world object
+ *
+ * Get a shared #librdf_uri for the RDF Schema namespace.
+ *
+ * Return value: #librdf_uri pointer or NULL on failure.
+ */
+librdf_uri *
+librdf_get_concept_schema_namespace(librdf_world *world)
+{
+ librdf_world_open(world);
+ return world->concept_schema_namespace_uri;
+}
+
+
+/**
+ * librdf_get_concept_by_name:
+ * @world: redland world object
+ * @is_ms: non zero if name is a RDF namespace concept (else is RDF schema)
+ * @name: the name to look up
+ * @uri_p: pointer to variable to hold #librdf_uri of concept or NULL if not
required
+ * @node_p: pointer to variable to hold #librdf_node of concept or NULL if not
required
+ *
+ * Get Redland uri and/or node objects for RDF concepts.
+ *
+ * Allows the dynamic look-up of an RDF concept by the local_name of
+ * the concept in either the RDF or RDF Schema namespace. Returns
+ * the #librdf_uri and/or #librdf_node found as required.
+ **/
+void
+librdf_get_concept_by_name(librdf_world *world, int is_ms,
+ const char *name,
+ librdf_uri **uri_p, librdf_node **node_p)
+{
+ int i;
+
+ librdf_world_open(world);
+
+ for (i=0; i < LIBRDF_CONCEPT_LAST; i++) {
+ int this_is_ms = !(LIBRDF_CONCEPT_FIRST_S_ID <= i &&
+ i <= LIBRDF_CONCEPT_LAST_S_ID);
+ if(this_is_ms != is_ms)
+ continue;
+
+ if(!strcmp(librdf_concept_tokens[i], name)) {
+ if(uri_p)
+ *uri_p=world->concept_uris[i];
+ if(node_p)
+ *node_p=world->concept_resources[i];
+ }
+ }
+}
+
+
+/**
+ * librdf_get_concept_resource_by_index:
+ * @world: redland world object
+ * @idx: #librdf_concepts_index
+ *
+ * Get Redland node object for RDF concepts.
+ *
+ * Return value: #librdf_node pointer or NULL on failure.
+ **/
+librdf_node*
+librdf_get_concept_resource_by_index(librdf_world *world,
+ librdf_concepts_index idx)
+{
+ librdf_world_open(world);
+
+ if ((int)idx < 0 || idx > LIBRDF_CONCEPT_LAST)
+ return NULL;
+
+ return world->concept_resources[idx];
+}
+
+
+/**
+ * librdf_get_concept_uri_by_index:
+ * @world: redland world object
+ * @idx: #librdf_concepts_index
+ *
+ * Get Redland uri object for RDF concepts.
+ *
+ * Return value: #librdf_uri pointer or NULL on failure.
+ **/
+librdf_uri*
+librdf_get_concept_uri_by_index(librdf_world *world,
+ librdf_concepts_index idx)
+{
+ librdf_world_open(world);
+
+ if ((int)idx < 0 || idx > LIBRDF_CONCEPT_LAST)
+ return NULL;
+
+ return world->concept_uris[idx];
+}
+
+
+/**
+ * librdf_finish_concepts:
+ * @world: redland world object
+ *
+ * INTERNAL - Terminate the concepts module.
+ *
+ **/
+void
+librdf_finish_concepts(librdf_world *world)
+{
+ int i;
+
+ /* Free resources and set pointers to NULL so that they are cleared
+ * in case the concepts module is initialised again in the same process. */
+
+ if(world->xsd_namespace_uri) {
+ librdf_free_uri(world->xsd_namespace_uri);
+ world->xsd_namespace_uri = NULL;
+ }
+
+ if(world->concept_ms_namespace_uri) {
+ librdf_free_uri(world->concept_ms_namespace_uri);
+ world->concept_ms_namespace_uri = NULL;
+ }
+
+ if(world->concept_schema_namespace_uri) {
+ librdf_free_uri(world->concept_schema_namespace_uri);
+ world->concept_schema_namespace_uri = NULL;
+ }
+
+ if(world->concept_resources) {
+ for (i=0; i<= LIBRDF_CONCEPT_LAST; i++) {
+ /* deletes associated URI too */
+ if(world->concept_resources[i])
+ librdf_free_node(world->concept_resources[i]);
+ }
+ LIBRDF_FREE(librdf_node**, world->concept_resources);
+ world->concept_resources=NULL;
+ }
+
+ if(world->concept_uris) {
+ /* uris were freed above, now just free the array */
+ LIBRDF_FREE(librdf_uri**, world->concept_uris);
+ world->concept_uris=NULL;
+ }
+}
+
+#endif
+
+
+/* TEST CODE */
+
+
+#ifdef STANDALONE
+
+/* one more prototype */
+int main(int argc, char *argv[]);
+
+
+#define EXPECTED_STRING "http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"
+int
+main(int argc, char *argv[])
+{
+ const char *program=librdf_basename((const char*)argv[0]);
+ librdf_world *world;
+ librdf_uri* uri;
+ librdf_node* node;
+ unsigned char* actual;
+
+ world=librdf_new_world();
+ librdf_world_open(world);
+
+ uri=LIBRDF_MS_Seq_URI(world);
+ if(!uri) {
+ fprintf(stderr, "%s: Got no concept URI for rdf:Seq\n", program);
+ exit(1);
+ }
+
+ actual=librdf_uri_as_string(uri);
+ if(strcmp(EXPECTED_STRING, (const char*)actual)) {
+ fprintf(stderr, "%s: Expected URI: <%s> Got: <%s>\n", program,
+ EXPECTED_STRING, actual);
+ exit(1);
+ }
+
+ node=librdf_get_concept_resource_by_index(world, LIBRDF_CONCEPT_LAST);
+ if(!node) {
+ fprintf(stderr, "%s: Got no concept node for the last concept\n", program);
+ exit(1);
+ }
+
+ librdf_free_world(world);
+
+ /* keep gcc -Wall happy */
+ return(0);
+}
+
+#endif
diff --git a/ext_libraries/modules/redland/1.0.17/overlay/src/rdf_config.h
b/ext_libraries/modules/redland/1.0.17/overlay/src/rdf_config.h
new file mode 100644
index 0000000000..d5a636b40d
--- /dev/null
+++ b/ext_libraries/modules/redland/1.0.17/overlay/src/rdf_config.h
@@ -0,0 +1,389 @@
+/* src/rdf_config.h. Generated from rdf_config.h.in by configure. */
+/* src/rdf_config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define to 1 if you have the `argz_add' function. */
+/* #undef HAVE_ARGZ_ADD */
+
+/* Define to 1 if you have the `argz_append' function. */
+/* #undef HAVE_ARGZ_APPEND */
+
+/* Define to 1 if you have the `argz_count' function. */
+/* #undef HAVE_ARGZ_COUNT */
+
+/* Define to 1 if you have the `argz_create_sep' function. */
+/* #undef HAVE_ARGZ_CREATE_SEP */
+
+/* Define to 1 if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define to 1 if you have the `argz_insert' function. */
+/* #undef HAVE_ARGZ_INSERT */
+
+/* Define to 1 if you have the `argz_next' function. */
+/* #undef HAVE_ARGZ_NEXT */
+
+/* Define to 1 if you have the `argz_stringify' function. */
+/* #undef HAVE_ARGZ_STRINGIFY */
+
+/* BDB has close method with 2 args */
+/* #undef HAVE_BDB_CLOSE_2_ARGS */
+
+/* BDB defines DBC */
+/* #undef HAVE_BDB_CURSOR */
+
+/* BDB cursor method has 4 arguments */
+/* #undef HAVE_BDB_CURSOR_4_ARGS */
+
+/* BDB defines DB_TXN */
+/* #undef HAVE_BDB_DB_TXN */
+
+/* BDB has fd method with 2 args */
+/* #undef HAVE_BDB_FD_2_ARGS */
+
+/* Have BDB hash support */
+/* #undef HAVE_BDB_HASH */
+
+/* BDB has open method with 6 args */
+/* #undef HAVE_BDB_OPEN_6_ARGS */
+
+/* BDB has open method with 7 args */
+/* #undef HAVE_BDB_OPEN_7_ARGS */
+
+/* BDB has set_flags method */
+/* #undef HAVE_BDB_SET_FLAGS */
+
+/* Define to 1 if the system has the type `byte'. */
+/* #undef HAVE_BYTE */
+
+/* Define to 1 if you have the `closedir' function. */
+#define HAVE_CLOSEDIR 1
+
+/* BDB has dbopen method */
+/* #undef HAVE_DBOPEN */
+
+/* BDB has db_create method */
+/* #undef HAVE_DB_CREATE */
+
+/* Define to 1 if you have the <db.h> header file. */
+/* #undef HAVE_DB_H */
+
+/* BDB has db_open method */
+/* #undef HAVE_DB_OPEN */
+
+/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
+ you don't. */
+/* #undef HAVE_DECL_CYGWIN_CONV_PATH */
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define if you have the GNU dld library. */
+/* #undef HAVE_DLD */
+
+/* Define to 1 if you have the <dld.h> header file. */
+/* #undef HAVE_DLD_H */
+
+/* Define to 1 if you have the `dlerror' function. */
+#define HAVE_DLERROR 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the <dl.h> header file. */
+/* #undef HAVE_DL_H */
+
+/* Define if you have the _dyld_func_lookup function. */
+/* #undef HAVE_DYLD */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if the system has the type `error_t'. */
+/* #undef HAVE_ERROR_T */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `getenv' function. */
+#define HAVE_GETENV 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#define HAVE_GETOPT_LONG 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define if you have the libdl library or equivalent. */
+#define HAVE_LIBDL 1
+
+/* Define if libdlloader will be built on this platform */
+#define HAVE_LIBDLLOADER 1
+
+/* Define to 1 if you have the <libpq-fe.h> header file. */
+/* #undef HAVE_LIBPQ_FE_H */
+
+/* Have local MD5 digest */
+#define HAVE_LOCAL_MD5_DIGEST 1
+
+/* Have local RIPEMD160 digest */
+/* #undef HAVE_LOCAL_RIPEMD160_DIGEST */
+
+/* Have local SHA1 digest */
+#define HAVE_LOCAL_SHA1_DIGEST 1
+
+/* Define this if a modern libltdl is already installed */
+#define HAVE_LTDL 1
+
+/* Define to 1 if you have the <mach-o/dyld.h> header file. */
+/* #undef HAVE_MACH_O_DYLD_H */
+
+/* Define to 1 if you have the `memcmp' function. */
+#define HAVE_MEMCMP 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+/* #undef HAVE_MKSTEMP */
+
+/* Define to 1 if you have the `mktemp' function. */
+#define HAVE_MKTEMP 1
+
+/* have MYSQL_OPT_RECONNECT declared */
+/* #undef HAVE_MYSQL_OPT_RECONNECT */
+
+/* Define to 1 if you have the `opendir' function. */
+#define HAVE_OPENDIR 1
+
+/* Define if libtool can extract symbol lists from object files. */
+#define HAVE_PRELOADED_SYMBOLS 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to 1 if you have the `readdir' function. */
+#define HAVE_READDIR 1
+
+/* Define if you have the shl_load function. */
+/* #undef HAVE_SHL_LOAD */
+
+/* Define to 1 if you have the <sqlite3.h> header file. */
+/* #undef HAVE_SQLITE3_H */
+
+/* Define to 1 if you have the <sqlite.h> header file. */
+/* #undef HAVE_SQLITE_H */
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the <sys/dl.h> header file. */
+/* #undef HAVE_SYS_DL_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the `tmpnam' function. */
+#define HAVE_TMPNAM 1
+
+/* Define to 1 if the system has the type `u32'. */
+/* #undef HAVE_U32 */
+
+/* Define to 1 if the system has the type `u64'. */
+/* #undef HAVE_U64 */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* This value is set to 1 to indicate that the system argz facility works */
+/* #undef HAVE_WORKING_ARGZ */
+
+/* Run time assertion checks. */
+#define LIBRDF_ASSERT 1
+
+/* Print run time assertion check failure messages. */
+#define LIBRDF_ASSERT_MESSAGES 1
+
+/* Release version as a decimal */
+#define LIBRDF_VERSION_DECIMAL 10017
+
+/* Major version number */
+#define LIBRDF_VERSION_MAJOR 1
+
+/* Minor version number */
+#define LIBRDF_VERSION_MINOR 0
+
+/* Release version number */
+#define LIBRDF_VERSION_RELEASE 17
+
+/* Define if the OS needs help to load dependent libraries for dlopen(). */
+/* #undef LTDL_DLOPEN_DEPLIBS */
+
+/* Define to the system default library search path. */
+#define LT_DLSEARCH_PATH "/lib:/usr/lib"
+
+/* The archive extension */
+#define LT_LIBEXT "a"
+
+/* The archive prefix */
+#define LT_LIBPREFIX "lib"
+
+/* Define to the extension used for runtime loadable modules, say, ".so". */
+#define LT_MODULE_EXT ".so"
+
+/* Define to the name of the environment variable that determines the run-time
+ module search path. */
+#define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH"
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Define to the shared library suffix, say, ".dylib". */
+/* #undef LT_SHARED_EXT */
+
+/* Build storage backends as modules */
+/* #undef MODULAR_LIBRDF */
+
+/* Define if dlsym() requires a leading underscore in symbol names. */
+/* #undef NEED_USCORE */
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "redland"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://bugs.librdf.org/"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "Redland librdf RDF API Library"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "Redland librdf RDF API Library 1.0.17"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "redland"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.0.17"
+
+/* The size of `unsigned char', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_CHAR 1
+
+/* The size of `unsigned int', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_INT 4
+
+/* The size of `unsigned long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG 8
+
+/* The size of `unsigned long long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG_LONG 8
+
+/* define to SQLINTEGER if not defined in the ODBC headers */
+#define SQLLEN SQLINTEGER
+
+/* define to SQLUINTEGER if not defined in the ODBC headers */
+#define SQLULEN SQLUINTEGER
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Building file storage */
+#define STORAGE_FILE 1
+
+/* Building hashes storage */
+#define STORAGE_HASHES 1
+
+/* Building memory storage */
+#define STORAGE_MEMORY 1
+
+/* Building MySQL storage */
+/* #undef STORAGE_MYSQL */
+
+/* Building PostgreSQL storage */
+/* #undef STORAGE_POSTGRESQL */
+
+/* Building SQLite storage */
+/* #undef STORAGE_SQLITE */
+
+/* Building trees storage */
+#define STORAGE_TREES 1
+
+/* Building 3store storage */
+/* #undef STORAGE_TSTORE */
+
+/* Building Virtuoso storage */
+/* #undef STORAGE_VIRTUOSO */
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+/* #undef TIME_WITH_SYS_TIME */
+
+/* Version number of package */
+#define VERSION "1.0.17"
+
+/* Use POSIX threads */
+#define WITH_THREADS 1
+
+/* 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 so that glibc/gnulib argp.h does not typedef error_t. */
+#define __error_t_defined 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to a type to use for `error_t' if it is not otherwise available. */
+#define error_t int
diff --git a/ext_libraries/modules/redland/1.0.17/overlay/src/unistd.h
b/ext_libraries/modules/redland/1.0.17/overlay/src/unistd.h
new file mode 100644
index 0000000000..0b2966afaa
--- /dev/null
+++ b/ext_libraries/modules/redland/1.0.17/overlay/src/unistd.h
@@ -0,0 +1,9 @@
+/* Dummy unistd.h for the MSVC (Windows) build.
+ *
+ * The flex-generated lexers (turtle_lexer.h, ntriples, etc.) do an
+ * unconditional `#include <unistd.h>`. MSVC has no unistd.h; the dmake build
+ * satisfied this with the empty stub delivered by main/soltools/winunistd on
+ * the solver include path (-I$(PRJ)/$(INPATH)/inc). Cross-repo `-I main/...`
+ * is fragile under Bazel, so this overlay reproduces the same empty stub on
+ * raptor2's own include path (-Isrc).
+ */
diff --git
a/ext_libraries/modules/redland/1.0.17/overlay/src/win32_rdf_config.h
b/ext_libraries/modules/redland/1.0.17/overlay/src/win32_rdf_config.h
new file mode 100644
index 0000000000..d41d15ff25
--- /dev/null
+++ b/ext_libraries/modules/redland/1.0.17/overlay/src/win32_rdf_config.h
@@ -0,0 +1,275 @@
+/* -*- Mode: c; c-basic-offset: 2 -*-
+ *
+ * win32_rdf_config.h - redland WIN32 hard-coded config
+ *
+ * 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.
+ *
+ */
+
+#ifndef WIN32_RDF_CONFIG_H
+#define WIN32_RDF_CONFIG_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WIN32_LEAN_AND_MEAN 1
+
+/* getopt is not in standard win32 C library - define if we have it */
+/* #define HAVE_GETOPT_H 1 */
+
+#define HAVE_STDLIB_H 1
+
+/* For using expat on win32 */
+/*#define RAPTOR_XML_EXPAT 1
+#define HAVE_EXPAT_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
+#define close _close
+#define unlink _unlink
+#define mktemp _mktemp
+
+/* definition from winsock2.h */
+#ifndef _TIMEVAL_DEFINED
+#define _TIMEVAL_DEFINED
+typedef struct timeval {
+ long tv_sec;
+ long tv_usec;
+} timeval;
+#endif
+
+#define HAVE_C99_VSNPRINTF 1
+
+/* Define the following if you are calling the librdf from C# or any language
which uses stdcall */
+#define USE_STDCALL_CALLBACKS 1
+
+/* for access() which is POSIX but doesn't seem to have the defines in VC */
+#ifndef R_OK
+#define F_OK 0
+#define R_OK 4
+#endif
+
+/* __func__ doesn't exist in Visual Studio 6 */
+#define __func__ ""
+
+#undef REDLAND_INLINE
+#define REDLAND_INLINE __inline
+
+
+/*
+ * Defines that come from rdf_config.h
+ */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `getenv' function. */
+#define HAVE_GETENV 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#define HAVE_GETOPT_LONG 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* W3C libwww is present */
+/* #undef HAVE_LIBWWW */
+
+/* Have local MD5 digest */
+#define HAVE_LOCAL_MD5_DIGEST 1
+
+/* Have local RIPEMD160 digest */
+/* #undef HAVE_LOCAL_RIPEMD160_DIGEST */
+
+/* Have local SHA1 digest */
+#define HAVE_LOCAL_SHA1_DIGEST 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+/* #undef HAVE_MKSTEMP */
+
+/* Define to 1 if you have the `mktemp' function. */
+#define HAVE_MKTEMP 1
+
+/* MySQL libraries are present */
+#define HAVE_MYSQL 1
+
+/* Define to 1 if you have the <openssl/crypto.h> header file. */
+/* #undef HAVE_OPENSSL_CRYPTO_H */
+
+/* Have openssl MD5 digest */
+/* #undef HAVE_OPENSSL_CRYPTO_MD5_DIGEST */
+
+/* Have openssl RIPEMD160 digest */
+/* #undef HAVE_OPENSSL_CRYPTO_RIPEMD160_DIGEST */
+
+/* Have openssl SHA1 digest */
+/* #undef HAVE_OPENSSL_CRYPTO_SHA1_DIGEST */
+
+/* Have openssl digests */
+/* #undef HAVE_OPENSSL_DIGESTS */
+
+/* Define to 1 if you have the <pthread.h> header file. */
+/* #undef HAVE_PTHREAD_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/*#define HAVE_SYS_TIME_H*/
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the `tmpnam' function. */
+#define HAVE_TMPNAM 1
+
+/* Have 3store available */
+/* #undef HAVE_TSTORE */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #define HAVE_UNISTD_H */
+
+/* Disable run time assertion checks. */
+/* #undef LIBRDF_DISABLE_ASSERT */
+
+/* Disable run time assertion check messages. */
+/* #undef LIBRDF_DISABLE_ASSERT_MESSAGES */
+
+/* Release version as a decimal */
+#define LIBRDF_VERSION_DECIMAL 10017
+
+/* Major version number */
+#define LIBRDF_VERSION_MAJOR 1
+
+/* Minor version number */
+#define LIBRDF_VERSION_MINOR 0
+
+/* Release version number */
+#define LIBRDF_VERSION_RELEASE 17
+
+/* The size of a `unsigned char', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_CHAR 1
+
+/* The size of a `unsigned short', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_SHORT 2
+
+/* The size of a `unsigned int', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_INT 4
+
+/* The size of a `unsigned long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG 4
+
+/* The size of a `unsigned long long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG_LONG 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Building file storage */
+#define STORAGE_FILE 1
+
+#define STORAGE_HASHES 1
+#define STORAGE_MEMORY 1
+#define STORAGE_TREES 1
+
+/* Building MySQL storage */
+/* #define STORAGE_MYSQL 1 */
+
+/* Building PostgreSQL storage */
+/*#undef STORAGE_POSTGRESQL*/
+
+/* Building SQLite storage */
+/*#undef STORAGE_SQLITE 1 */
+
+/* Building 3store storage */
+/*#undef STORAGE_TSTORE*/
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+/* #define TIME_WITH_SYS_TIME*/
+
+/* Version number of package */
+#define VERSION "1.0.17"
+
+/* Use POSIX threads */
+#undef WITH_THREADS
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+
+#include <windows.h>
+#include <io.h>
+#include <memory.h>
+
+/* get _isnan() since it is not in math.h */
+#include <float.h>
+#ifndef isnan
+#define isnan(d) (_isnan(d))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ext_libraries/modules/redland/1.0.17/source.json
b/ext_libraries/modules/redland/1.0.17/source.json
index 0952a2723a..33d0e9cf68 100644
--- a/ext_libraries/modules/redland/1.0.17/source.json
+++ b/ext_libraries/modules/redland/1.0.17/source.json
@@ -1,5 +1,15 @@
{
"url": "https://download.librdf.org/source/redland-1.0.17.tar.gz",
"integrity": "sha256-3hhH97WQIcFr3HKrtNji2Rh81hJNaRVvMybdNO4ENoE=",
- "strip_prefix": "redland-1.0.17"
-}
\ No newline at end of file
+ "strip_prefix": "redland-1.0.17",
+ "overlay": {
+ "MODULE.bazel": "sha256-mdLvH8IkZglQDx2aAybFSThNZXM0X8VZhBNQbc4tqic=",
+ "BUILD.bazel": "sha256-FdiGE/VusX7Ow821cVYuNYAyzGIi2F4sG/9BwhnvEQQ=",
+ "src/rdf_config.h": "sha256-Rg8EBMZqhx6TTxjWdV1fgPNOEWNhYDF/2VEdXWiKfpI=",
+ "src/win32_rdf_config.h":
"sha256-iCGJQ/pA6paMfw2ZHL9QBQBxZRJZIDbVy2RsicM2n2c=",
+ "src/rdf_concepts.c":
"sha256-+iQaQbZ8ESAu/txVLuEAc2ji/N2xeYFdSyeO/uSfWGQ=",
+ "src/unistd.h": "sha256-jkN7WWHGaIZYf5O63jqD0HhtohfeRrWnLKQdI+Klj3U="
+ },
+ "patches": {},
+ "patch_strip": 0
+}
diff --git a/main/postprocess/BUILD.bazel b/main/postprocess/BUILD.bazel
index e7d63734af..86d8629cc1 100644
--- a/main/postprocess/BUILD.bazel
+++ b/main/postprocess/BUILD.bazel
@@ -493,9 +493,9 @@ _SERVICES_COMPONENTS = {
"//main/unotools:util/utl.component":
basis_native("utl.dll"),
- # ── unoxml (both components use the same DLL) ─────────────────────────
+ # ── unoxml (DOM/XPath/Events) + unordf (RDF/metadata, separate DLL) ───
"//main/unoxml:source/rdf/unordf.component":
- basis_native("unoxml.dll"),
+ basis_native("unordf.dll"),
"//main/unoxml:source/service/unoxml.component":
basis_native("unoxml.dll"),
diff --git a/main/staging/BUILD.bazel b/main/staging/BUILD.bazel
index 1fba4e33df..92acd954ad 100644
--- a/main/staging/BUILD.bazel
+++ b/main/staging/BUILD.bazel
@@ -79,6 +79,7 @@ collect_outputs(
"//main/package:package2",
"//main/package:xstor",
"//main/unoxml:unoxml",
+ "//main/unoxml:unordf",
"//main/xmlhelp:tvhlp1",
"//main/xmlhelp:ucpchelp1",
"//main/ucb:ucb1",
diff --git a/main/unoxml/BUILD.bazel b/main/unoxml/BUILD.bazel
index 3243b1d0ca..b0dc323e65 100644
--- a/main/unoxml/BUILD.bazel
+++ b/main/unoxml/BUILD.bazel
@@ -80,5 +80,34 @@ filegroup(
visibility = ["//visibility:public"],
)
+# ── unordf.dll ────────────────────────────────────────────────────
+# RDF/metadata UNO component (source/rdf/), backed by static redland
+# (librdf + raptor2 + rasqal). Needed by ODF document metadata, e.g.
+# saving a Writer doc writes manifest.rdf — without this the librdf_Repository
+# service can't activate and the save silently fails (file dialog re-prompts).
+# Was deferred ("redland not yet on Windows"); redland is now built (static),
+# so split into its own DLL (own component_getFactory; cannot merge into
unoxml).
+cc_binary(
+ name = "unordf",
+ srcs = glob([
+ "source/rdf/*.cxx",
+ "source/rdf/*.hxx",
+ ]),
+ copts = _COPTS + ["/Imain/unoxml/source/rdf"],
+ defines = _DEFINES,
+ linkshared = True,
+ deps = _DEPS + ["@redland//:redland", "@libxslt//:libxslt"],
+ additional_linker_inputs = _LINKINPUTS,
+ linkopts = _LINKOPTS,
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "unordf_implib",
+ srcs = [":unordf"],
+ output_group = "interface_library",
+ visibility = ["//visibility:public"],
+)
+
exports_files(glob(["**/*.component"]))
diff --git a/main/unoxml/readme.md b/main/unoxml/readme.md
index cd7e9cd72b..39096f8a46 100644
--- a/main/unoxml/readme.md
+++ b/main/unoxml/readme.md
@@ -6,7 +6,8 @@
|--------|--------|--------|
| `//main/unoxml:unoxml` | `unoxml.dll` | ✅ |
| `//main/unoxml:unoxml_implib` | `unoxml.lib` (interface library) | ✅ |
-| `unordf.dll` | RDF repository UNO component | ⬜ deferred |
+| `//main/unoxml:unordf` | `unordf.dll` (RDF repository UNO component) | ✅ |
+| `//main/unoxml:unordf_implib` | `unordf.lib` (interface library) | ✅ |
## What builds
@@ -20,9 +21,18 @@ Sources: `source/dom/` (22 files), `source/events/` (6
files), `source/xpath/` (
External dependency: `@libxml2` (static, provides `<libxml/...>` headers).
-## What is deferred
-
-**unordf.dll** — RDF repository UNO component (`source/rdf/`). Requires
Redland (`@redland`), which depends on raptor2 and rasqal. These libraries have
no Windows/MSVC `configure_make` BUILD setup yet. Defer until redland is ported.
+**unordf.dll** — RDF/metadata UNO component (`source/rdf/`): the
`librdf_Repository`
+service used by ODF document metadata (e.g. `manifest.rdf` on save). Backed by
the
+static Redland stack (`@redland` → `@raptor2` + `@rasqal`), plus `@libxml2` and
+`@libxslt`. Own `component_getFactory`, so it is a **separate** cc_binary
(cannot
+merge into `unoxml.dll`).
+
+The Redland stack was migrated to **native cc_library** (not `configure_make`)
and
+is documented in detail in the top-level **`rdf-readme.md`** — including the
+`*_INTERNAL`/`HAVE_CONFIG_H` defines, `local_defines`-vs-`defines`
propagation, the
+`*_STATIC` dllimport guard, the win32 config-header reproduction, and the
+`RAPTOR_WWW_NONE`/`S_ISREG` link fixes. Build-side complete; the save
*runtime* path
+is the remaining open item (see `rdf-readme.md` → Open items).
## Key decisions
diff --git a/rdf-readme.md b/rdf-readme.md
new file mode 100644
index 0000000000..67a3694b30
--- /dev/null
+++ b/rdf-readme.md
@@ -0,0 +1,195 @@
+# RDF stack — Bazel migration (Redland / raptor2 / rasqal + unordf)
+
+Status as of **2026-06-14**: the full RDF library stack and the `unordf.dll`
UNO
+component **build, link, and stage** under Bazel (MSVC VS2008, x86, debug CRT).
+The document-metadata *runtime* path (saving an ODF writes `manifest.rdf`) is
the
+remaining open item — see [Open items](#open-items).
+
+## Why this exists
+
+ODF document metadata (RDF/XML in `manifest.rdf`, package metadata) is provided
+by the `librdf_Repository` UNO service in **`unordf.dll`**
(`main/unoxml/source/rdf/`).
+That component is backed by the **Redland** C library (`librdf`), which in turn
+depends on **raptor2** (RDF parsers/serializers) and **rasqal** (SPARQL query).
+
+Without `unordf.dll` the `librdf_Repository` service cannot activate, so
saving a
+Writer/Calc/Impress document fails (the file dialog re-prompts / save silently
+aborts). The component had been **deferred** in the original migration with the
+note *"redland not yet on Windows"*.
+
+## Layout
+
+| Module | Kind | Output | BUILD style |
+|--------|------|--------|-------------|
+| `@raptor2` (`ext_libraries/modules/raptor2/2.0.15`) | third-party C |
`raptor2.lib` (static) | native cc_library |
+| `@rasqal` (`ext_libraries/modules/rasqal/0.9.33`) | third-party C |
`rasqal.lib` (static) | native cc_library |
+| `@redland` (`ext_libraries/modules/redland/1.0.17`) | third-party C |
`redland.lib` (static) | native cc_library |
+| `//main/unoxml:unordf` | first-party C++ | `unordf.dll` | cc_binary (UNO
component) |
+
+`unordf.dll` links all three static libs + `@libxml2` + `@libxslt`, plus the
usual
+UNO implibs (sal/cppu/cppuhelper/comphelper/ucbhelper/sax).
+
+## The central decision: native-cc, not configure_make
+
+The migrator originally wrapped all three libraries with **`configure_make`**
+(rules_foreign_cc). That is a dead end in this environment and was reverted to
+**native `cc_library`** for every lib:
+
+- `configure_make` needs a bash + `make` toolchain. rules_foreign_cc tries to
+ **bootstrap GNU Make from source with MSVC**, which fails on VS2008
+ (`w32os.c` uses C99 mid-block declarations the VS2008 C compiler rejects) →
+ no `gnumake.exe`.
+- Even with a `make`, `./configure` would have to find the **MSVC-built**
+ raptor2/rasqal via pkg-config (no `.pc` files) — a cross-toolchain mismatch.
+- It directly contradicts the project's primary constraint: **eliminate the
+ Cygwin/bash/make dependency**.
+
+Native-cc means: no configure, no make, no bash; one consistent MSVC toolchain;
+clean Bazel `deps = ["@raptor2//:raptor2", ...]`. Source lists and `-D`
defines are
+taken **verbatim from each library's dmake recipe** (`src/makefile.mk` added
by the
+`*.patch.dmake` patch — `SLOFILES` + `CDEFS`), so the build matches what AOO
+shipped on Windows.
+
+## How the libraries are wired (the `overlay` mechanism)
+
+These modules were set up with `"build_file": "BUILD.bazel"` in `source.json`,
+which is **ignored** in this bzlmod local-registry setup (proven: `@@rasqal+`
had
+no BUILD; rasqal's checked-in `BUILD.bazel` was even 0 bytes). The working
+mechanism is the icu-proven **`overlay`**:
+
+```
+ext_libraries/modules/<lib>/<ver>/
+ source.json # url, integrity, strip_prefix, overlay{path: sha256},
patches{}
+ MODULE.bazel # registry metadata (bazel_deps the BUILD uses)
+ overlay/
+ BUILD.bazel # the real build (referenced by SHA-256 in source.json)
+ MODULE.bazel
+ src/... # any added/patched source or config files
+```
+
+Each file in the `overlay` map is referenced by its SHA-256; after editing any
+overlay file you must recompute the hash, update `source.json`, delete the
stale
+`external/<lib>+` dir, and rebuild with `--lockfile_mode=refresh`. (See the
+"Bazel 9.0.1 last-patch-section bug" memo — patches are avoided in favour of
+overlay files for the same reason.)
+
+## Per-library gotchas (the ones that bit)
+
+These are the non-obvious things; each was a separate build failure.
+
+### Common to raptor2 / rasqal / redland
+
+1. **`<LIB>_INTERNAL` define is mandatory.** Each `*_internal.h` wraps its
entire
+ body (structs, typedefs, `RAPTOR_CALLOC`/etc. macros) in
+ `#ifdef RAPTOR_INTERNAL` / `RASQAL_INTERNAL` / `LIBRDF_INTERNAL`. Without it
+ every internal type is "undefined" in every source. Autotools supplies it
via
+ `@<LIB>_INTERNAL_CPPFLAGS@`.
+
+2. **`HAVE_CONFIG_H` + dual config headers.** Sources do
+ `#ifdef HAVE_CONFIG_H #include <lib_config.h>` *and*
+ `#ifdef WIN32 #include <win32_lib_config.h>`. dmake defines **both** and
copies
+ the `.win32`-patched `lib_config.h.in` → `lib_config.h`. We reproduce that
+ generated header as an **overlay file** (apply the patch's config hunk with
+ `patch -p2`, stage the result), and define `HAVE_CONFIG_H`.
`win32_*_config.h`
+ carries the MSVC shims (`snprintf`→`_snprintf`, `stricmp`,
`access`→`_access`,
+ `RASQAL_INLINE __inline`, `struct timeval`, …).
+
+3. **`local_defines`, not `defines`.** Build-private macros (`HAVE_*`,
`PACKAGE`,
+ `VERSION`, `*_INTERNAL`, parser/serializer flags) must be `local_defines` —
as
+ `defines` they propagate to every dependent and clobber its config.
Concretely:
+ raptor2's `HAVE_STDINT_H=1` leaked into rasqal and forced
+ `#include <stdint.h>`, which VS2008 lacks. **Only the `*_STATIC` guard is a
+ propagating `defines`** entry — consumers' public headers need it (see #4).
+
+4. **`*_STATIC` for static linking.** `librdf.h`/`raptor2.h`/`rasqal.h` gate
their
+ API macro: `#ifdef WIN32 → #ifdef <LIB>_STATIC → (empty) #elif
<LIB>_INTERNAL →
+ dllexport #else → dllimport`. Building static libs with plain C symbols
requires
+ `REDLAND_STATIC` / `RAPTOR_STATIC` / `RASQAL_STATIC`, and the **consumer**
+ (`unordf`) must see the same or it links against `__imp_*` (dllimport)
symbols
+ that the static `.lib` doesn't have. Hence each lib exports its `*_STATIC`
via
+ propagating `defines`.
+
+5. **Empty `unistd.h` stub.** Flex lexers and a few sources `#include
<unistd.h>`,
+ which MSVC lacks. dmake satisfied this with the empty soltools/winunistd
stub on
+ `-I<solver>/inc`; we drop the same empty stub into each lib's `overlay/src/`
+ (found via the existing `-Isrc`).
+
+### raptor2-specific
+
+- **`expand_template` prefix collisions.** `raptor_config.h` is generated from
+ `raptor_config.h.in` via `expand_template`, which does *sequential substring*
+ replacement. Keys that are a prefix of a longer key corrupt the longer line
+ (`#undef HAVE_GETOPT` → `/* #undef HAVE_GETOPT */_H`). Fix:
newline-terminate the
+ shorter colliding keys (`"#undef HAVE_GETOPT\n"`). Colliders: `HAVE_GETOPT`
+ (⊂`_H`,`_LONG`), `HAVE_SETJMP` (⊂`_H`), `PACKAGE` (⊂`_NAME`/`_STRING`/…),
+ `RAPTOR_SERIALIZER_RDFXML` (⊂`_ABBREV`). The template is LF.
+- **`RAPTOR_WWW_NONE`.** raptor's libxml HTTP backend (`raptor_www_libxml.c`)
calls
+ `xmlNanoHTTP*`, which our libxml2 was built without. ODF metadata is
local-file
+ only, so select `RAPTOR_WWW_NONE` (the file then compiles to nothing).
+- **`S_ISREG`** is not a macro on MSVC (`raptor_uri.c` uses it). Injected
+ `#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)` via the windows config
+ (`_S_IFMT`/`_S_IFREG` come from `<sys/stat.h>`).
+- **`strcasecmp.c` omitted** — MSVC has `stricmp`, so the autotools STRCASECMP
+ condition is false; `HAVE_STRICMP` maps `raptor_strcasecmp`→`stricmp`.
Compiling
+ `strcasecmp.c` would redefine `stricmp` and clash with the CRT.
+- **`raptor_uri_win32.c` is a phantom** — it does not exist in the tarball;
Windows
+ URI handling is inline in `raptor_uri.c` under `#ifdef WIN32`.
+- **genrule `copy` + `+`.** The bzlmod repo dir is `raptor2+`; `cmd.exe copy`
+ treats `+` as the file-concatenation operator, so the `raptor_config.h` copy
+ genrule uses `type "$<" > "$@"` instead.
+
+### rasqal-specific
+
+- **`SV_CONFIG`** define — `libsv/sv.c` only includes `sv_config.h` under
+ `#ifdef SV_CONFIG`, which renames `sv_*`→`rasqal_sv_*`. Without it, link
mismatch
+ with `rasqal_format_sv.c`.
+- **`src/rasqal_config.h` overlay** is required even though sources gate it on
+ `HAVE_CONFIG_H`, because `libsv/sv_config.h` includes it *unconditionally*.
+- **`rasqal_ntriples.c`** is the one source upstream that lacks the
+ `#ifdef WIN32 #include <win32_rasqal_config.h>` line (it needs `struct
timeval`);
+ the `.win32` patch adds it — reproduced as an overlay file.
+- Library source set = `glob(src/*.c)` minus `rasqal_query_test.c`, plus
+ `libsv/sv.c` (the one unconditional `LIBADD`); libmtwist/getopt skipped (not
in
+ the Windows config).
+
+### redland-specific
+
+- 35-file source set from the dmake `SLOFILES` — SQL / mysql / postgresql /
sqlite /
+ tstore / virtuoso / bdb backends and `memcmp.c` are excluded.
+- Overlay files: `.win32`-patched `rdf_config.h`, `win32_rdf_config.h`,
+ `rdf_concepts.c`, plus the `unistd.h` stub. `.ooo_build`/`.autotools`
patches only
+ touch `Makefile.am`/`configure` (irrelevant to native-cc) and are skipped.
+- `redland.h` itself has no dllexport/dllimport macros, but the per-subsystem
+ headers use `REDLAND_API` (see #4) → `REDLAND_STATIC`.
+
+## unordf.dll
+
+- Own `component_getFactory` (cannot merge into `unoxml.dll` — symbol
collision),
+ so it is a separate cc_binary in `main/unoxml/BUILD.bazel` with `linkshared
= True`.
+- `deps = _DEPS + ["@redland//:redland", "@libxslt//:libxslt"]` —
+ `librdf_repository.cxx` includes `<libxslt/security.h>`; redland pulls
raptor2 +
+ rasqal + libxml2 transitively.
+- Registered in `services.rdb` via `main/postprocess/BUILD.bazel`
+ (`unordf.component` → `basis_native("unordf.dll")`) and staged in
+ `main/staging/BUILD.bazel`.
+
+## Open items
+
+- **Save runtime path.** `unordf.dll` loads, but saving an ODF document does
not yet
+ complete (the save dialog re-prompts). This is a runtime exception inside the
+ `librdf_Repository` activation / metadata write, *not* a build problem.
+ Next diagnostic step: capture the thrown UNO/C++ exception type during the
save
+ attempt (cdb `sxe -c "... e06d7363"` decoding the `_ThrowInfo` type
descriptor)
+ to determine whether a redland storage/parser/serializer factory fails to
+ register at runtime, or the failure is elsewhere (file picker, IO).
+- Cosmetic `.uno` infix divergence for the component DLL name is the same known
+ divergence documented in `CLAUDE.md`.
+
+## Rebuild recipe (any RDF lib change)
+
+```powershell
+# after editing an overlay file + updating its sha256 in source.json:
+Remove-Item -Recurse -Force C:\Users\legin\_bazel_legin\<hash>\external\<lib>+
-ErrorAction SilentlyContinue
+bazel build //main/staging:install --compilation_mode=dbg
--//build:debug_info=True `
+ --features=generate_pdb --jobs=1 --lockfile_mode=refresh
+```