Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

fix: resolve 59 clippy errors + add 3-way vision benchmark

FABIOTESS8ddc878cc7ef
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ffd0a71b..f9f2afba 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,6 +8,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
+ env:
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
diff --git a/Cargo.lock b/Cargo.lock
index 277f1409..952e8af9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -31,6 +31,12 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "allocator-api2"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
+
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -350,6 +356,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+[[package]]
+name = "base64ct"
+version = "1.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
+
[[package]]
name = "bindgen"
version = "0.71.1"
@@ -381,6 +393,9 @@ name = "bitflags"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
+dependencies = [
+ "serde_core",
+]
[[package]]
name = "block-buffer"
@@ -531,6 +546,21 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
+[[package]]
+name = "concurrent-queue"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "const-oid"
+version = "0.9.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+
[[package]]
name = "const-random"
version = "0.1.18"
@@ -586,6 +616,21 @@ dependencies = [
"libc",
]
+[[package]]
+name = "crc"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+
[[package]]
name = "crc32fast"
version = "1.5.0"
@@ -614,6 +659,15 @@ dependencies = [
"crossbeam-utils",
]
+[[package]]
+name = "crossbeam-queue"
+version = "0.3.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115"
+dependencies = [
+ "crossbeam-utils",
+]
+
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
@@ -705,6 +759,17 @@ dependencies = [
"parking_lot_core",
]
+[[package]]
+name = "der"
+version = "0.7.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
+dependencies = [
+ "const-oid",
+ "pem-rfc7468",
+ "zeroize",
+]
+
[[package]]
name = "derive_arbitrary"
version = "1.4.2"
@@ -723,7 +788,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
+ "const-oid",
"crypto-common",
+ "subtle",
]
[[package]]
@@ -737,6 +804,12 @@ dependencies = [
"syn",
]
+[[package]]
+name = "dotenvy"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
+
[[package]]
name = "dyn-clone"
version = "1.0.20"
@@ -748,6 +821,9 @@ name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+dependencies = [
+ "serde",
+]
[[package]]
name = "encoding_rs"
@@ -774,6 +850,28 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "etcetera"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943"
+dependencies = [
+ "cfg-if",
+ "home",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "event-listener"
+version = "5.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
+dependencies = [
+ "concurrent-queue",
+ "parking",
+ "pin-project-lite",
+]
+
[[package]]
name = "fallible-iterator"
version = "0.3.0"
@@ -818,6 +916,17 @@ dependencies = [
"miniz_oxide",
]
+[[package]]
+name = "flume"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+ "spin",
+]
+
[[package]]
name = "fnv"
version = "1.0.7"
@@ -896,6 +1005,17 @@ dependencies = [
"futures-util",
]
+[[package]]
+name = "futures-intrusive"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
+dependencies = [
+ "futures-core",
+ "lock_api",
+ "parking_lot",
+]
+
[[package]]
name = "futures-io"
version = "0.3.32"
@@ -1040,6 +1160,8 @@ version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
+ "allocator-api2",
+ "equivalent",
"foldhash",
]
@@ -1058,6 +1180,15 @@ dependencies = [
"hashbrown 0.14.5",
]
+[[package]]
+name = "hashlink"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
+dependencies = [
+ "hashbrown 0.15.5",
+]
+
[[package]]
name = "heck"
version = "0.5.0"
@@ -1070,6 +1201,33 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+[[package]]
+name = "hkdf"
+version = "0.12.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
+dependencies = [
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+dependencies = [
+ "digest",
+]
+
+[[package]]
+name = "home"
+version = "0.5.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "http"
version = "1.4.0"
@@ -1412,6 +1570,9 @@ name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+dependencies = [
+ "spin",
+]
[[package]]
name = "leb128fmt"
@@ -1498,6 +1659,18 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
+[[package]]
+name = "libredox"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a"
+dependencies = [
+ "bitflags 2.11.0",
+ "libc",
+ "plain",
+ "redox_syscall 0.7.3",
+]
+
[[package]]
name = "libsqlite3-sys"
version = "0.30.1"
@@ -1654,6 +1827,22 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "num-bigint-dig"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"
+dependencies = [
+ "lazy_static",
+ "libm",
+ "num-integer",
+ "num-iter",
+ "num-traits",
+ "rand",
+ "smallvec",
+ "zeroize",
+]
+
[[package]]
name = "num-complex"
version = "0.4.6"
@@ -1737,6 +1926,7 @@ dependencies = [
"serde",
"serde_json",
"serde_yaml",
+ "sqlx",
"tempfile",
"tokio",
"toml",
@@ -1919,6 +2109,12 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "parking"
+version = "2.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
+
[[package]]
name = "parking_lot"
version = "0.12.5"
@@ -1937,7 +2133,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall",
+ "redox_syscall 0.5.18",
"smallvec",
"windows-link",
]
@@ -2008,6 +2204,15 @@ version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "132dca9b868d927b35b5dd728167b2dee150eb1ad686008fc71ccb298b776fca"
+[[package]]
+name = "pem-rfc7468"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
+dependencies = [
+ "base64ct",
+]
+
[[package]]
name = "percent-encoding"
version = "2.3.2"
@@ -2026,12 +2231,39 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "pkcs1"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
+dependencies = [
+ "der",
+ "pkcs8",
+ "spki",
+]
+
+[[package]]
+name = "pkcs8"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
+dependencies = [
+ "der",
+ "spki",
+]
+
[[package]]
name = "pkg-config"
version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
+[[package]]
+name = "plain"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
+
[[package]]
name = "potential_utf"
version = "0.1.4"
@@ -2169,6 +2401,15 @@ dependencies = [
"bitflags 2.11.0",
]
+[[package]]
+name = "redox_syscall"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16"
+dependencies = [
+ "bitflags 2.11.0",
+]
+
[[package]]
name = "ref-cast"
version = "1.0.25"
@@ -2307,6 +2548,26 @@ dependencies = [
"syn",
]
+[[package]]
+name = "rsa"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
+dependencies = [
+ "const-oid",
+ "digest",
+ "num-bigint-dig",
+ "num-integer",
+ "num-traits",
+ "pkcs1",
+ "pkcs8",
+ "rand_core",
+ "signature",
+ "spki",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "rusqlite"
version = "0.32.1"
@@ -2316,7 +2577,7 @@ dependencies = [
"bitflags 2.11.0",
"fallible-iterator",
"fallible-streaming-iterator",
- "hashlink",
+ "hashlink 0.9.1",
"libsqlite3-sys",
"smallvec",
]
@@ -2605,6 +2866,16 @@ dependencies = [
"libc",
]
+[[package]]
+name = "signature"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
+dependencies = [
+ "digest",
+ "rand_core",
+]
+
[[package]]
name = "simd-adler32"
version = "0.3.8"
@@ -2634,6 +2905,9 @@ name = "smallvec"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+dependencies = [
+ "serde",
+]
[[package]]
name = "socket2"
@@ -2706,6 +2980,213 @@ dependencies = [
"spargebra",
]
+[[package]]
+name = "spin"
+version = "0.9.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
+dependencies = [
+ "lock_api",
+]
+
+[[package]]
+name = "spki"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
+dependencies = [
+ "base64ct",
+ "der",
+]
+
+[[package]]
+name = "sqlx"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc"
+dependencies = [
+ "sqlx-core",
+ "sqlx-macros",
+ "sqlx-mysql",
+ "sqlx-postgres",
+ "sqlx-sqlite",
+]
+
+[[package]]
+name = "sqlx-core"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6"
+dependencies = [
+ "base64",
+ "bytes",
+ "crc",
+ "crossbeam-queue",
+ "either",
+ "event-listener",
+ "futures-core",
+ "futures-intrusive",
+ "futures-io",
+ "futures-util",
+ "hashbrown 0.15.5",
+ "hashlink 0.10.0",
+ "indexmap",
+ "log",
+ "memchr",
+ "once_cell",
+ "percent-encoding",
+ "serde",
+ "serde_json",
+ "sha2",
+ "smallvec",
+ "thiserror",
+ "tokio",
+ "tokio-stream",
+ "tracing",
+ "url",
+]
+
+[[package]]
+name = "sqlx-macros"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "sqlx-core",
+ "sqlx-macros-core",
+ "syn",
+]
+
+[[package]]
+name = "sqlx-macros-core"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b"
+dependencies = [
+ "dotenvy",
+ "either",
+ "heck",
+ "hex",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "sha2",
+ "sqlx-core",
+ "sqlx-mysql",
+ "sqlx-postgres",
+ "sqlx-sqlite",
+ "syn",
+ "tokio",
+ "url",
+]
+
+[[package]]
+name = "sqlx-mysql"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526"
+dependencies = [
+ "atoi",
+ "base64",
+ "bitflags 2.11.0",
+ "byteorder",
+ "bytes",
+ "crc",
+ "digest",
+ "dotenvy",
+ "either",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "generic-array",
+ "hex",
+ "hkdf",
+ "hmac",
+ "itoa",
+ "log",
+ "md-5",
+ "memchr",
+ "once_cell",
+ "percent-encoding",
+ "rand",
+ "rsa",
+ "serde",
+ "sha1",
+ "sha2",
+ "smallvec",
+ "sqlx-core",
+ "stringprep",
+ "thiserror",
+ "tracing",
+ "whoami",
+]
+
+[[package]]
+name = "sqlx-postgres"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46"
+dependencies = [
+ "atoi",
+ "base64",
+ "bitflags 2.11.0",
+ "byteorder",
+ "crc",
+ "dotenvy",
+ "etcetera",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "hex",
+ "hkdf",
+ "hmac",
+ "home",
+ "itoa",
+ "log",
+ "md-5",
+ "memchr",
+ "once_cell",
+ "rand",
+ "serde",
+ "serde_json",
+ "sha2",
+ "smallvec",
+ "sqlx-core",
+ "stringprep",
+ "thiserror",
+ "tracing",
+ "whoami",
+]
+
+[[package]]
+name = "sqlx-sqlite"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea"
+dependencies = [
+ "atoi",
+ "flume",
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-intrusive",
+ "futures-util",
+ "libsqlite3-sys",
+ "log",
+ "percent-encoding",
+ "serde",
+ "serde_urlencoded",
+ "sqlx-core",
+ "thiserror",
+ "tracing",
+ "url",
+]
+
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
@@ -2718,6 +3199,17 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+[[package]]
+name = "stringprep"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+ "unicode-properties",
+]
+
[[package]]
name = "strsim"
version = "0.11.1"
@@ -2854,6 +3346,21 @@ dependencies = [
"zerovec",
]
+[[package]]
+name = "tinyvec"
+version = "1.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
[[package]]
name = "tokio"
version = "1.50.0"
@@ -2902,6 +3409,17 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "tokio-stream"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70"
+dependencies = [
+ "futures-core",
+ "pin-project-lite",
+ "tokio",
+]
+
[[package]]
name = "tokio-util"
version = "0.7.18"
@@ -3007,6 +3525,7 @@ version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
+ "log",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@@ -3084,12 +3603,33 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
+[[package]]
+name = "unicode-bidi"
+version = "0.3.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
+
[[package]]
name = "unicode-ident"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+[[package]]
+name = "unicode-normalization"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "unicode-properties"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
+
[[package]]
name = "unicode-xid"
version = "0.2.6"
@@ -3183,6 +3723,12 @@ dependencies = [
"wit-bindgen",
]
+[[package]]
+name = "wasite"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
+
[[package]]
name = "wasm-bindgen"
version = "0.2.114"
@@ -3286,6 +3832,16 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "whoami"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d"
+dependencies = [
+ "libredox",
+ "wasite",
+]
+
[[package]]
name = "windows-core"
version = "0.62.2"
@@ -3356,13 +3912,22 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-targets",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -3374,34 +3939,67 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
- "windows_aarch64_gnullvm",
- "windows_aarch64_msvc",
- "windows_i686_gnu",
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_gnullvm",
- "windows_x86_64_msvc",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
]
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
@@ -3414,24 +4012,48 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
diff --git a/benchmark/vision/compare_approaches.py b/benchmark/vision/compare_approaches.py
new file mode 100644
index 00000000..1202787d
--- /dev/null
+++ b/benchmark/vision/compare_approaches.py
@@ -0,0 +1,274 @@
+#!/usr/bin/env python3
+"""3-way comparison: Manual annotation vs Pure Claude vs RDF Pipeline.
+
+Computes object recall, category recall, and structural metrics across
+10 real photographs processed by parallel Claude agents.
+"""
+import json
+import os
+import glob
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+DATASET_DIR = os.path.join(SCRIPT_DIR, "dataset")
+
+
+def fuzzy_match(detected: str, ground_truth_set: set) -> bool:
+ """Check if a detected label fuzzy-matches any ground truth label."""
+ d = detected.lower().strip()
+ for gt in ground_truth_set:
+ g = gt.lower().strip()
+ if d == g or d in g or g in d:
+ return True
+ return False
+
+
+def compute_recall(detected: list, ground_truth: list) -> float:
+ """What fraction of ground truth items were detected (fuzzy match)."""
+ if not ground_truth:
+ return 1.0
+ gt_set = set(ground_truth)
+ detected_lower = {d.lower().strip() for d in detected}
+ hits = 0
+ for gt in gt_set:
+ g = gt.lower().strip()
+ if any(g == d or g in d or d in g for d in detected_lower):
+ hits += 1
+ return hits / len(gt_set)
+
+
+def compute_precision(detected: list, ground_truth: list) -> float:
+ """What fraction of detected items match ground truth (fuzzy)."""
+ if not detected:
+ return 0.0
+ gt_set = {g.lower().strip() for g in ground_truth}
+ hits = 0
+ for d in detected:
+ dl = d.lower().strip()
+ if any(dl == g or dl in g or g in dl for g in gt_set):
+ hits += 1
+ return hits / len(detected)
+
+
+# Ground truth (manual annotation)
+with open(os.path.join(DATASET_DIR, "ground_truth.json")) as f:
+ ground_truth = json.load(f)
+
+# Pure Claude results (from parallel agents)
+pure_claude = {
+ "img_1.jpg": {
+ "objects": ["steering wheel", "dashboard", "windshield", "truck", "seat", "rust", "trees", "bushes", "foliage", "gauges"],
+ "categories": ["vehicle", "nature", "decay"],
+ },
+ "img_2.jpg": {
+ "objects": ["laptop", "notebook", "pen", "camera", "earbuds", "desk", "screen", "grid paper", "sketches", "wood table"],
+ "categories": ["technology", "workspace", "stationery", "photography"],
+ },
+ "img_3.jpg": {
+ "objects": ["frog", "duckweed", "water", "eyes"],
+ "categories": ["animal", "nature", "water"],
+ },
+ "img_4.jpg": {
+ "objects": ["trees", "forest", "hill", "field", "grass", "sky", "mist"],
+ "categories": ["nature", "landscape", "forest"],
+ },
+ "img_5.jpg": {
+ "objects": ["wooden deck", "planks", "nails", "buildings", "tower", "sky"],
+ "categories": ["architecture", "nature", "urban"],
+ },
+ "img_6.jpg": {
+ "objects": ["canoe", "paddle", "water", "people", "hat", "jacket", "fog", "reflection"],
+ "categories": ["nature", "water", "recreation", "people"],
+ },
+ "img_7.jpg": {
+ "objects": ["ocean", "beach", "coastline", "cliffs", "hills", "houses", "buildings", "trees", "vegetation", "sand", "waves", "roads", "golf course", "boat"],
+ "categories": ["nature", "landscape", "coastal", "urban", "water"],
+ },
+ "img_8.jpg": {
+ "objects": ["deer", "fawn", "spots", "ears", "trees", "branches", "leaves", "forest floor", "log", "sunlight"],
+ "categories": ["animal", "nature", "wildlife", "forest"],
+ },
+ "img_9.jpg": {
+ "objects": ["cat", "nose", "whiskers", "fur", "mouth", "nostrils"],
+ "categories": ["animal", "pet"],
+ },
+ "img_10.jpg": {
+ "objects": ["van", "windows", "tires", "wheels", "roof", "trees", "road", "leaves", "rust", "paint"],
+ "categories": ["vehicle", "nature", "transportation"],
+ },
+}
+
+# RDF Pipeline results (from parallel agents generating Turtle)
+rdf_pipeline = {
+ "img_1.jpg": {
+ "objects": ["truck", "steering wheel", "dashboard", "windshield", "tree"],
+ "categories": ["vehicle", "nature"],
+ "triples": 88, "relationships": 6,
+ },
+ "img_2.jpg": {
+ "objects": ["laptop", "notebook", "pen", "earbuds", "camera", "desk"],
+ "categories": ["technology", "workspace", "photography"],
+ "triples": 126, "relationships": 8,
+ },
+ "img_3.jpg": {
+ "objects": ["frog", "frog eyes", "pond water", "duckweed", "frog head", "small insect", "frog nostrils"],
+ "categories": ["amphibian", "animal body part", "water body", "aquatic plant", "insect"],
+ "triples": 104, "relationships": 12,
+ },
+ "img_4.jpg": {
+ "objects": ["overcast sky", "coniferous tree line", "grassy meadow", "distant hills", "haze", "bare trunks", "hill slope"],
+ "categories": ["nature", "landscape", "vegetation", "terrain"],
+ "triples": 97, "relationships": 8,
+ },
+ "img_5.jpg": {
+ "objects": ["boardwalk surface", "wooden planks", "clear blue sky", "cylindrical tower", "background buildings", "horizon line"],
+ "categories": ["architecture", "urban", "nature"],
+ "triples": 82, "relationships": 6,
+ },
+ "img_6.jpg": {
+ "objects": ["canoe", "stern paddler", "bow paddler", "paddle", "lake", "fog", "water reflection"],
+ "categories": ["recreation", "water", "nature", "people"],
+ "triples": 84, "relationships": 10,
+ },
+ "img_7.jpg": {
+ "objects": ["ocean", "sandy beach", "sandstone cliffs", "golf course", "residential neighborhood", "hillside vegetation", "shallow water zone", "roads", "small vessel", "coastal canyon"],
+ "categories": ["nature", "landscape", "coastal", "urban", "water", "geological formation"],
+ "triples": 110, "relationships": 12,
+ },
+ "img_8.jpg": {
+ "objects": ["fallow deer fawn", "forest floor", "deciduous forest trees", "golden backlight", "fallen tree branch", "airborne dust motes", "autumn foliage"],
+ "categories": ["wildlife", "terrain", "vegetation", "lighting", "natural debris"],
+ "triples": 94, "relationships": 8,
+ },
+ "img_9.jpg": {
+ "objects": ["cat nose", "whisker pads", "philtrum", "fur", "nostrils", "nose bridge", "muzzle"],
+ "categories": ["animal", "pet", "macro"],
+ "triples": 106, "relationships": 8,
+ },
+ "img_10.jpg": {
+ "objects": ["volkswagen type 2 van", "raised roof", "side windows", "front wheel", "rear wheel", "asphalt road", "foliage", "fallen leaves", "rust patches", "rear window"],
+ "categories": ["vehicle", "nature", "transportation"],
+ "triples": 98, "relationships": 10,
+ },
+}
+
+
+def main():
+ results = {}
+ total_manual_obj = 0
+ total_manual_cat = 0
+
+ for img in sorted(ground_truth.keys()):
+ gt = ground_truth[img]
+ pc = pure_claude.get(img, {"objects": [], "categories": []})
+ rp = rdf_pipeline.get(img, {"objects": [], "categories": [], "triples": 0, "relationships": 0})
+
+ # Object recall
+ pc_obj_recall = compute_recall(pc["objects"], gt["objects"])
+ rp_obj_recall = compute_recall(rp["objects"], gt["objects"])
+
+ # Category recall
+ pc_cat_recall = compute_recall(pc["categories"], gt["categories"])
+ rp_cat_recall = compute_recall(rp["categories"], gt["categories"])
+
+ # Precision
+ pc_obj_precision = compute_precision(pc["objects"], gt["objects"])
+ rp_obj_precision = compute_precision(rp["objects"], gt["objects"])
+
+ results[img] = {
+ "gt_objects": len(gt["objects"]),
+ "gt_categories": len(gt["categories"]),
+ "pure_claude": {
+ "objects_detected": len(pc["objects"]),
+ "object_recall": round(pc_obj_recall, 2),
+ "object_precision": round(pc_obj_precision, 2),
+ "category_recall": round(pc_cat_recall, 2),
+ },
+ "rdf_pipeline": {
+ "objects_detected": len(rp["objects"]),
+ "object_recall": round(rp_obj_recall, 2),
+ "object_precision": round(rp_obj_precision, 2),
+ "category_recall": round(rp_cat_recall, 2),
+ "triples": rp.get("triples", 0),
+ "relationships": rp.get("relationships", 0),
+ },
+ }
+
+ # Aggregate
+ n = len(results)
+ pc_avg_obj_recall = sum(r["pure_claude"]["object_recall"] for r in results.values()) / n
+ pc_avg_cat_recall = sum(r["pure_claude"]["category_recall"] for r in results.values()) / n
+ pc_avg_precision = sum(r["pure_claude"]["object_precision"] for r in results.values()) / n
+
+ rp_avg_obj_recall = sum(r["rdf_pipeline"]["object_recall"] for r in results.values()) / n
+ rp_avg_cat_recall = sum(r["rdf_pipeline"]["category_recall"] for r in results.values()) / n
+ rp_avg_precision = sum(r["rdf_pipeline"]["object_precision"] for r in results.values()) / n
+ rp_total_triples = sum(r["rdf_pipeline"]["triples"] for r in results.values())
+ rp_total_rels = sum(r["rdf_pipeline"]["relationships"] for r in results.values())
+ rp_avg_objects = sum(r["rdf_pipeline"]["objects_detected"] for r in results.values()) / n
+
+ # Count TTL files
+ ttl_files = glob.glob(os.path.join(DATASET_DIR, "*.ttl"))
+
+ summary = {
+ "dataset": "10 real photographs (picsum.photos)",
+ "approach_comparison": {
+ "manual_annotation": {
+ "description": "Human expert labels objects and categories",
+ "effort": "~2 min per image",
+ "queryable": False,
+ "relationships": False,
+ "confidence_scores": False,
+ },
+ "pure_claude": {
+ "description": "Claude vision returns JSON text labels",
+ "avg_object_recall": round(pc_avg_obj_recall, 2),
+ "avg_object_precision": round(pc_avg_precision, 2),
+ "avg_category_recall": round(pc_avg_cat_recall, 2),
+ "avg_objects_per_image": round(sum(r["pure_claude"]["objects_detected"] for r in results.values()) / n, 1),
+ "queryable": False,
+ "relationships": False,
+ "confidence_scores": False,
+ },
+ "rdf_pipeline": {
+ "description": "Claude vision → structured Turtle with ontology, validated with Open Ontologies",
+ "avg_object_recall": round(rp_avg_obj_recall, 2),
+ "avg_object_precision": round(rp_avg_precision, 2),
+ "avg_category_recall": round(rp_avg_cat_recall, 2),
+ "avg_objects_per_image": round(rp_avg_objects, 1),
+ "total_triples": rp_total_triples,
+ "total_relationships": rp_total_rels,
+ "ttl_files_generated": len(ttl_files),
+ "queryable": True,
+ "relationships": True,
+ "confidence_scores": True,
+ },
+ },
+ "per_image": results,
+ }
+
+ out_path = os.path.join(DATASET_DIR, "benchmark_results.json")
+ with open(out_path, "w") as f:
+ json.dump(summary, f, indent=2)
+
+ # Print comparison table
+ print("=" * 90)
+ print("3-WAY COMPARISON: Manual vs Pure Claude vs RDF Pipeline")
+ print("=" * 90)
+ print(f"{'Metric':<30} {'Manual':>12} {'Pure Claude':>14} {'RDF Pipeline':>14}")
+ print("-" * 90)
+ print(f"{'Object Recall':<30} {'100%':>12} {pc_avg_obj_recall*100:>13.0f}% {rp_avg_obj_recall*100:>13.0f}%")
+ print(f"{'Object Precision':<30} {'100%':>12} {pc_avg_precision*100:>13.0f}% {rp_avg_precision*100:>13.0f}%")
+ print(f"{'Category Recall':<30} {'100%':>12} {pc_avg_cat_recall*100:>13.0f}% {rp_avg_cat_recall*100:>13.0f}%")
+ print(f"{'Avg Objects/Image':<30} {'—':>12} {sum(r['pure_claude']['objects_detected'] for r in results.values())/n:>13.1f} {rp_avg_objects:>13.1f}")
+ print(f"{'Total RDF Triples':<30} {'0':>12} {'0':>14} {rp_total_triples:>14}")
+ print(f"{'Spatial Relationships':<30} {'0':>12} {'0':>14} {rp_total_rels:>14}")
+ print(f"{'SPARQL Queryable':<30} {'No':>12} {'No':>14} {'Yes':>14}")
+ print(f"{'Confidence Scores':<30} {'No':>12} {'No':>14} {'Yes':>14}")
+ print(f"{'Effort per Image':<30} {'~2 min':>12} {'~8 sec':>14} {'~8 sec':>14}")
+ print(f"{'Scales to 1000 images':<30} {'No':>12} {'Yes':>14} {'Yes':>14}")
+ print("=" * 90)
+ print(f"\nResults saved to {out_path}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/benchmark/vision/dataset/benchmark_results.json b/benchmark/vision/dataset/benchmark_results.json
new file mode 100644
index 00000000..1e50a224
--- /dev/null
+++ b/benchmark/vision/dataset/benchmark_results.json
@@ -0,0 +1,217 @@
+{
+ "dataset": "10 real photographs (picsum.photos)",
+ "approach_comparison": {
+ "manual_annotation": {
+ "description": "Human expert labels objects and categories",
+ "effort": "~2 min per image",
+ "queryable": false,
+ "relationships": false,
+ "confidence_scores": false
+ },
+ "pure_claude": {
+ "description": "Claude vision returns JSON text labels",
+ "avg_object_recall": 0.89,
+ "avg_object_precision": 0.54,
+ "avg_category_recall": 0.79,
+ "avg_objects_per_image": 8.5,
+ "queryable": false,
+ "relationships": false,
+ "confidence_scores": false
+ },
+ "rdf_pipeline": {
+ "description": "Claude vision \u2192 structured Turtle with ontology, validated with Open Ontologies",
+ "avg_object_recall": 0.73,
+ "avg_object_precision": 0.6,
+ "avg_category_recall": 0.68,
+ "avg_objects_per_image": 7.2,
+ "total_triples": 989,
+ "total_relationships": 88,
+ "ttl_files_generated": 10,
+ "queryable": true,
+ "relationships": true,
+ "confidence_scores": true
+ }
+ },
+ "per_image": {
+ "img_1.jpg": {
+ "gt_objects": 5,
+ "gt_categories": 3,
+ "pure_claude": {
+ "objects_detected": 10,
+ "object_recall": 1.0,
+ "object_precision": 0.5,
+ "category_recall": 1.0
+ },
+ "rdf_pipeline": {
+ "objects_detected": 5,
+ "object_recall": 1.0,
+ "object_precision": 1.0,
+ "category_recall": 0.67,
+ "triples": 88,
+ "relationships": 6
+ }
+ },
+ "img_10.jpg": {
+ "gt_objects": 4,
+ "gt_categories": 3,
+ "pure_claude": {
+ "objects_detected": 10,
+ "object_recall": 0.5,
+ "object_precision": 0.2,
+ "category_recall": 0.33
+ },
+ "rdf_pipeline": {
+ "objects_detected": 10,
+ "object_recall": 0.5,
+ "object_precision": 0.1,
+ "category_recall": 0.33,
+ "triples": 98,
+ "relationships": 10
+ }
+ },
+ "img_2.jpg": {
+ "gt_objects": 6,
+ "gt_categories": 3,
+ "pure_claude": {
+ "objects_detected": 10,
+ "object_recall": 0.83,
+ "object_precision": 0.5,
+ "category_recall": 1.0
+ },
+ "rdf_pipeline": {
+ "objects_detected": 6,
+ "object_recall": 0.83,
+ "object_precision": 0.83,
+ "category_recall": 1.0,
+ "triples": 126,
+ "relationships": 8
+ }
+ },
+ "img_3.jpg": {
+ "gt_objects": 3,
+ "gt_categories": 4,
+ "pure_claude": {
+ "objects_detected": 4,
+ "object_recall": 1.0,
+ "object_precision": 0.75,
+ "category_recall": 0.75
+ },
+ "rdf_pipeline": {
+ "objects_detected": 7,
+ "object_recall": 1.0,
+ "object_precision": 0.86,
+ "category_recall": 0.75,
+ "triples": 104,
+ "relationships": 12
+ }
+ },
+ "img_4.jpg": {
+ "gt_objects": 5,
+ "gt_categories": 3,
+ "pure_claude": {
+ "objects_detected": 7,
+ "object_recall": 1.0,
+ "object_precision": 0.71,
+ "category_recall": 1.0
+ },
+ "rdf_pipeline": {
+ "objects_detected": 7,
+ "object_recall": 0.4,
+ "object_precision": 0.43,
+ "category_recall": 0.67,
+ "triples": 97,
+ "relationships": 8
+ }
+ },
+ "img_5.jpg": {
+ "gt_objects": 4,
+ "gt_categories": 3,
+ "pure_claude": {
+ "objects_detected": 6,
+ "object_recall": 0.75,
+ "object_precision": 0.5,
+ "category_recall": 0.67
+ },
+ "rdf_pipeline": {
+ "objects_detected": 6,
+ "object_recall": 0.75,
+ "object_precision": 0.5,
+ "category_recall": 0.67,
+ "triples": 82,
+ "relationships": 6
+ }
+ },
+ "img_6.jpg": {
+ "gt_objects": 6,
+ "gt_categories": 4,
+ "pure_claude": {
+ "objects_detected": 8,
+ "object_recall": 0.83,
+ "object_precision": 0.62,
+ "category_recall": 1.0
+ },
+ "rdf_pipeline": {
+ "objects_detected": 7,
+ "object_recall": 0.83,
+ "object_precision": 1.0,
+ "category_recall": 1.0,
+ "triples": 84,
+ "relationships": 10
+ }
+ },
+ "img_7.jpg": {
+ "gt_objects": 6,
+ "gt_categories": 4,
+ "pure_claude": {
+ "objects_detected": 14,
+ "object_recall": 1.0,
+ "object_precision": 0.43,
+ "category_recall": 0.5
+ },
+ "rdf_pipeline": {
+ "objects_detected": 10,
+ "object_recall": 0.67,
+ "object_precision": 0.4,
+ "category_recall": 0.5,
+ "triples": 110,
+ "relationships": 12
+ }
+ },
+ "img_8.jpg": {
+ "gt_objects": 5,
+ "gt_categories": 4,
+ "pure_claude": {
+ "objects_detected": 10,
+ "object_recall": 1.0,
+ "object_precision": 0.5,
+ "category_recall": 1.0
+ },
+ "rdf_pipeline": {
+ "objects_detected": 7,
+ "object_recall": 0.6,
+ "object_precision": 0.43,
+ "category_recall": 0.25,
+ "triples": 94,
+ "relationships": 8
+ }
+ },
+ "img_9.jpg": {
+ "gt_objects": 4,
+ "gt_categories": 3,
+ "pure_claude": {
+ "objects_detected": 6,
+ "object_recall": 1.0,
+ "object_precision": 0.67,
+ "category_recall": 0.67
+ },
+ "rdf_pipeline": {
+ "objects_detected": 7,
+ "object_recall": 0.75,
+ "object_precision": 0.43,
+ "category_recall": 1.0,
+ "triples": 106,
+ "relationships": 8
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/benchmark/vision/dataset/ground_truth.json b/benchmark/vision/dataset/ground_truth.json
new file mode 100644
index 00000000..f380e26c
--- /dev/null
+++ b/benchmark/vision/dataset/ground_truth.json
@@ -0,0 +1,52 @@
+{
+ "img_1.jpg": {
+ "objects": ["truck", "steering wheel", "dashboard", "windshield", "tree"],
+ "scene": "abandoned vehicle interior",
+ "categories": ["vehicle", "nature", "decay"]
+ },
+ "img_2.jpg": {
+ "objects": ["laptop", "notebook", "pen", "camera", "earphones", "desk"],
+ "scene": "workspace on wooden desk",
+ "categories": ["technology", "workspace", "photography"]
+ },
+ "img_3.jpg": {
+ "objects": ["frog", "duckweed", "water"],
+ "scene": "frog camouflaged in duckweed pond",
+ "categories": ["animal", "amphibian", "nature", "water"]
+ },
+ "img_4.jpg": {
+ "objects": ["trees", "forest", "hill", "field", "sky"],
+ "scene": "coniferous forest treeline on overcast day",
+ "categories": ["landscape", "nature", "forest"]
+ },
+ "img_5.jpg": {
+ "objects": ["boardwalk", "wood planks", "buildings", "sky"],
+ "scene": "wooden boardwalk with shallow depth of field",
+ "categories": ["architecture", "urban", "outdoor"]
+ },
+ "img_6.jpg": {
+ "objects": ["canoe", "people", "paddle", "lake", "water", "fog"],
+ "scene": "two people canoeing on foggy lake",
+ "categories": ["recreation", "water", "nature", "people"]
+ },
+ "img_7.jpg": {
+ "objects": ["coastline", "ocean", "beach", "cliffs", "buildings", "roads"],
+ "scene": "aerial view of coastal town and beach",
+ "categories": ["landscape", "aerial", "ocean", "urban"]
+ },
+ "img_8.jpg": {
+ "objects": ["deer", "fawn", "forest", "leaves", "sunlight"],
+ "scene": "young fawn standing in autumn forest",
+ "categories": ["animal", "wildlife", "nature", "forest"]
+ },
+ "img_9.jpg": {
+ "objects": ["cat", "nose", "whiskers", "fur"],
+ "scene": "extreme close-up of cat nose and mouth",
+ "categories": ["animal", "pet", "macro"]
+ },
+ "img_10.jpg": {
+ "objects": ["van", "volkswagen", "vehicle", "trees"],
+ "scene": "vintage blue VW camper van parked on road",
+ "categories": ["vehicle", "vintage", "automotive"]
+ }
+}
diff --git a/benchmark/vision/dataset/img_1.jpg b/benchmark/vision/dataset/img_1.jpg
new file mode 100644
index 00000000..a94bccb1
Binary files /dev/null and b/benchmark/vision/dataset/img_1.jpg differ
diff --git a/benchmark/vision/dataset/img_1.ttl b/benchmark/vision/dataset/img_1.ttl
new file mode 100644
index 00000000..09d22093
--- /dev/null
+++ b/benchmark/vision/dataset/img_1.ttl
@@ -0,0 +1,112 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image Node ===
+
+ex:img_1 a schema:ImageObject ;
+ schema:name "img_1.jpg" ;
+ schema:description "Interior view of an abandoned, rusted truck cab overtaken by surrounding vegetation, showing a worn steering wheel, corroded dashboard and instruments, a dirty cracked windshield, and a large tree visible through the glass." ;
+ schema:keywords "abandoned vehicle", "truck interior", "decay", "nature reclaiming", "rust", "steering wheel", "dashboard", "windshield", "tree", "overgrown" ;
+ schema:contentLocation "outdoor rural setting" ;
+ ex:detectedObjectCount "5"^^xsd:integer .
+
+# === Object 1: Truck (vehicle cab) ===
+
+ex:img1_obj_1 a schema:Car ;
+ rdf:type ex:AbandonedVehicle ;
+ rdfs:label "Truck" ;
+ schema:category "vehicle" ;
+ schema:description "An old, heavily rusted and abandoned truck cab. The body panels and interior surfaces show extensive corrosion and weathering. The vehicle has been stationary long enough for vegetation to grow around and into it." ;
+ schema:material "metal, rubber" ;
+ schema:additionalProperty [
+ schema:name "condition" ;
+ schema:value "severely rusted and abandoned"
+ ] ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ ex:boundingBoxRegion "entire frame" ;
+ ex:spatialRelation ex:img1_obj_5 ;
+ ex:spatialRelationLabel "surrounded by" .
+
+# === Object 2: Steering Wheel ===
+
+ex:img1_obj_2 a ex:VehiclePart ;
+ rdfs:label "Steering wheel" ;
+ schema:category "vehicle" ;
+ schema:description "A thin-rimmed, dark-colored steering wheel typical of a mid-20th-century truck. It is mounted on a steering column angled toward the left side of the cab. The rim appears worn and aged." ;
+ schema:material "metal, rubber" ;
+ schema:isPartOf ex:img1_obj_1 ;
+ ex:confidence "0.98"^^xsd:decimal ;
+ ex:boundingBoxRegion "center-left" ;
+ ex:spatialRelation ex:img1_obj_3 ;
+ ex:spatialRelationLabel "in front of" .
+
+# === Object 3: Dashboard ===
+
+ex:img1_obj_3 a ex:VehiclePart ;
+ rdfs:label "Dashboard" ;
+ schema:category "vehicle" ;
+ schema:description "The corroded metal dashboard of the truck, showing an instrument cluster area on the right side and various rusted controls. The surface is heavily oxidized with patches of flaking paint and rust." ;
+ schema:material "metal" ;
+ schema:isPartOf ex:img1_obj_1 ;
+ schema:additionalProperty [
+ schema:name "condition" ;
+ schema:value "heavily corroded and rusted"
+ ] ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:boundingBoxRegion "center-right" ;
+ ex:spatialRelation ex:img1_obj_4 ;
+ ex:spatialRelationLabel "below" .
+
+# === Object 4: Windshield ===
+
+ex:img1_obj_4 a ex:VehiclePart ;
+ rdfs:label "Windshield" ;
+ schema:category "vehicle" ;
+ schema:description "A dirty, hazy windshield with grime, water stains, and possible cracks. It is partially transparent, allowing the tree and green foliage outside to be visible through it. The glass has a cloudy, weathered appearance." ;
+ schema:material "glass" ;
+ schema:isPartOf ex:img1_obj_1 ;
+ schema:additionalProperty [
+ schema:name "condition" ;
+ schema:value "dirty, hazy, weathered"
+ ] ;
+ ex:confidence "0.92"^^xsd:decimal ;
+ ex:boundingBoxRegion "upper half" ;
+ ex:spatialRelation ex:img1_obj_5 ;
+ ex:spatialRelationLabel "in front of" ;
+ ex:spatialRelation ex:img1_obj_3 ;
+ ex:spatialRelationLabel "above" .
+
+# === Object 5: Tree ===
+
+ex:img1_obj_5 a schema:Thing ;
+ rdf:type ex:Vegetation ;
+ rdfs:label "Tree" ;
+ schema:category "nature" ;
+ schema:description "A large, mature tree with a thick trunk and spreading canopy of green leaves, visible through and above the windshield. Dense green foliage and undergrowth also surround the vehicle on all visible sides." ;
+ schema:additionalProperty [
+ schema:name "foliage" ;
+ schema:value "dense green leaves, full canopy"
+ ] ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ ex:boundingBoxRegion "background, visible through windshield and around vehicle" ;
+ ex:spatialRelation ex:img1_obj_1 ;
+ ex:spatialRelationLabel "behind and around" .
+
+# === Additional Spatial Relationships ===
+
+ex:img1_obj_2 schema:spatialCoverage "center-left of cab interior" .
+ex:img1_obj_3 schema:spatialCoverage "center-right of cab interior" .
+ex:img1_obj_4 schema:spatialCoverage "upper portion of frame, between interior and exterior" .
+ex:img1_obj_5 schema:spatialCoverage "background exterior, visible through and around the cab" .
+ex:img1_obj_1 schema:spatialCoverage "entire frame, foreground to midground" .
+
+# === Scene-Level Annotations ===
+
+ex:img_1 ex:scene "abandoned vehicle interior" ;
+ ex:dominantColors "green, brown, rust, grey" ;
+ ex:mood "melancholic, post-apocalyptic, nature reclaiming" ;
+ ex:lightingCondition "natural daylight, overcast or filtered through canopy" ;
+ ex:photographicStyle "close-up interior shot, shallow to moderate depth of field" .
diff --git a/benchmark/vision/dataset/img_10.jpg b/benchmark/vision/dataset/img_10.jpg
new file mode 100644
index 00000000..b5396a2d
Binary files /dev/null and b/benchmark/vision/dataset/img_10.jpg differ
diff --git a/benchmark/vision/dataset/img_10.ttl b/benchmark/vision/dataset/img_10.ttl
new file mode 100644
index 00000000..f27a8c6f
--- /dev/null
+++ b/benchmark/vision/dataset/img_10.ttl
@@ -0,0 +1,135 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image node ===
+ex:img_10 a schema:ImageObject ;
+ schema:name "img_10.jpg" ;
+ schema:description "Side view of a weathered blue Volkswagen Type 2 camper van parked on a dark road surface with dense green foliage in the background and scattered yellow leaves on the ground." ;
+ schema:keywords "volkswagen, vw, type 2, camper van, vintage, blue, weathered, rust, parked, road, foliage" .
+
+# === Object 1: Volkswagen Type 2 Van ===
+ex:img10_obj_1 a schema:Car ;
+ rdf:type schema:Vehicle ;
+ rdfs:label "Volkswagen Type 2 Camper Van" ;
+ schema:category "vehicle" ;
+ schema:color "blue and white" ;
+ schema:description "A weathered and rusted Volkswagen Type 2 (Transporter) camper van with a blue lower body and white roof, seen from the passenger side. Paint is heavily faded and patchy with visible corrosion." ;
+ schema:additionalProperty [
+ schema:name "condition" ;
+ schema:value "weathered, rusted, faded paint"
+ ] ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ ex:partOf ex:img_10 .
+
+# === Object 2: White roof ===
+ex:img10_obj_2 a schema:Thing ;
+ rdfs:label "White Roof" ;
+ schema:category "vehicle part" ;
+ schema:color "white" ;
+ schema:description "The raised white roof section of the camper van, indicating a high-top or pop-top conversion." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ ex:partOf ex:img10_obj_1 .
+
+# === Object 3: Windows ===
+ex:img10_obj_3 a schema:Thing ;
+ rdfs:label "Side Windows" ;
+ schema:category "vehicle part" ;
+ schema:description "A row of side windows along the upper body of the van, including a narrow rear window with a dark tint or curtain." ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:partOf ex:img10_obj_1 .
+
+# === Object 4: Front wheel ===
+ex:img10_obj_4 a schema:Thing ;
+ rdfs:label "Front Wheel" ;
+ schema:category "vehicle part" ;
+ schema:description "The front wheel of the van with a dark steel rim and black tyre, partially visible." ;
+ ex:confidence "0.92"^^xsd:decimal ;
+ ex:partOf ex:img10_obj_1 ;
+ ex:spatialRelation [
+ schema:name "leftOf" ;
+ schema:value ex:img10_obj_5
+ ] .
+
+# === Object 5: Rear wheel ===
+ex:img10_obj_5 a schema:Thing ;
+ rdfs:label "Rear Wheel" ;
+ schema:category "vehicle part" ;
+ schema:description "The rear wheel of the van with a dark steel rim and black tyre." ;
+ ex:confidence "0.92"^^xsd:decimal ;
+ ex:partOf ex:img10_obj_1 ;
+ ex:spatialRelation [
+ schema:name "rightOf" ;
+ schema:value ex:img10_obj_4
+ ] .
+
+# === Object 6: Road surface ===
+ex:img10_obj_6 a schema:Thing ;
+ rdfs:label "Road Surface" ;
+ schema:category "ground" ;
+ schema:description "Dark asphalt road surface on which the van is parked. Appears wet or recently rained on." ;
+ ex:confidence "0.94"^^xsd:decimal ;
+ ex:partOf ex:img_10 ;
+ ex:spatialRelation [
+ schema:name "below" ;
+ schema:value ex:img10_obj_1
+ ] .
+
+# === Object 7: Foliage / Trees ===
+ex:img10_obj_7 a schema:Thing ;
+ rdfs:label "Dense Green Foliage" ;
+ schema:category "vegetation" ;
+ schema:color "dark green" ;
+ schema:description "Thick, dense green foliage and trees forming a dark backdrop behind the van." ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:partOf ex:img_10 ;
+ ex:spatialRelation [
+ schema:name "behind" ;
+ schema:value ex:img10_obj_1
+ ] .
+
+# === Object 8: Fallen yellow leaves ===
+ex:img10_obj_8 a schema:Thing ;
+ rdfs:label "Fallen Yellow Leaves" ;
+ schema:category "vegetation" ;
+ schema:color "yellow" ;
+ schema:description "Several small yellow leaves scattered on the road surface around the van, suggesting autumn." ;
+ ex:confidence "0.85"^^xsd:decimal ;
+ ex:partOf ex:img_10 ;
+ ex:spatialRelation [
+ schema:name "on" ;
+ schema:value ex:img10_obj_6
+ ] ;
+ ex:spatialRelation [
+ schema:name "near" ;
+ schema:value ex:img10_obj_1
+ ] .
+
+# === Object 9: Rust and corrosion patches ===
+ex:img10_obj_9 a schema:Thing ;
+ rdfs:label "Rust and Corrosion Patches" ;
+ schema:category "surface defect" ;
+ schema:description "Widespread rust and paint corrosion across the lower body panels of the van, with exposed bare metal and orange-brown oxidation." ;
+ ex:confidence "0.91"^^xsd:decimal ;
+ ex:partOf ex:img10_obj_1 ;
+ schema:spatialCoverage "lower body panels, wheel arches, door panels" .
+
+# === Object 10: Rear window (narrow) ===
+ex:img10_obj_10 a schema:Thing ;
+ rdfs:label "Rear Narrow Window" ;
+ schema:category "vehicle part" ;
+ schema:description "A narrow horizontal window at the rear upper section of the van body, darker than the side windows." ;
+ ex:confidence "0.82"^^xsd:decimal ;
+ ex:partOf ex:img10_obj_1 ;
+ ex:spatialRelation [
+ schema:name "rightOf" ;
+ schema:value ex:img10_obj_3
+ ] .
+
+# === Spatial relationships at image level ===
+ex:img10_obj_1 schema:spatialCoverage "center of frame, occupying most of the horizontal extent" .
+ex:img10_obj_7 schema:spatialCoverage "upper background, behind and above the van" .
+ex:img10_obj_6 schema:spatialCoverage "lower portion of frame, beneath the van" .
+ex:img10_obj_8 schema:spatialCoverage "lower left and lower right foreground on the road" .
diff --git a/benchmark/vision/dataset/img_2.jpg b/benchmark/vision/dataset/img_2.jpg
new file mode 100644
index 00000000..b7583cdc
Binary files /dev/null and b/benchmark/vision/dataset/img_2.jpg differ
diff --git a/benchmark/vision/dataset/img_2.ttl b/benchmark/vision/dataset/img_2.ttl
new file mode 100644
index 00000000..3e402667
--- /dev/null
+++ b/benchmark/vision/dataset/img_2.ttl
@@ -0,0 +1,167 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image Node ===
+
+ex:img_2 a schema:ImageObject ;
+ schema:description "A top-down photograph of a creative workspace on a warm-toned wooden desk, featuring an open laptop, a notebook with handwritten notes and sketches, a pen, earbuds, and a vintage camera." ;
+ schema:keywords "workspace, desk, laptop, notebook, pen, camera, earbuds, wooden table, creative, top-down, flat lay" ;
+ schema:about ex:img2_obj_1 , ex:img2_obj_2 , ex:img2_obj_3 , ex:img2_obj_4 , ex:img2_obj_5 , ex:img2_obj_6 .
+
+# === Object: Laptop ===
+
+ex:img2_obj_1 a schema:Product ;
+ rdf:type ex:Laptop ;
+ rdfs:label "Open laptop computer" ;
+ schema:category "Electronics" ;
+ schema:brand "Apple" ;
+ schema:model "MacBook Air" ;
+ schema:description "A silver Apple MacBook Air with the screen open, displaying a desktop with multiple browser or application windows. The screen shows a macOS interface." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "left side of desk" ;
+ ex:relationType "occupies" ;
+ ex:target ex:img2_obj_6
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "left of notebook" ;
+ ex:relationType "leftOf" ;
+ ex:target ex:img2_obj_2
+ ] .
+
+# === Object: Notebook ===
+
+ex:img2_obj_2 a schema:Product ;
+ rdf:type ex:Notebook ;
+ rdfs:label "Open notebook with handwritten notes" ;
+ schema:category "Stationery" ;
+ schema:description "A grid-ruled notebook open to pages containing handwritten notes, small sketches, and wireframe-style drawings. The pages show planning or brainstorming content." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "right of laptop" ;
+ ex:relationType "rightOf" ;
+ ex:target ex:img2_obj_1
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "below camera" ;
+ ex:relationType "below" ;
+ ex:target ex:img2_obj_5
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "pen resting on notebook" ;
+ ex:relationType "supports" ;
+ ex:target ex:img2_obj_3
+ ] .
+
+# === Object: Pen ===
+
+ex:img2_obj_3 a schema:Product ;
+ rdf:type ex:Pen ;
+ rdfs:label "Black pen" ;
+ schema:category "Stationery" ;
+ schema:description "A black pen resting diagonally across the open pages of the notebook." ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "on top of notebook" ;
+ ex:relationType "on" ;
+ ex:target ex:img2_obj_2
+ ] .
+
+# === Object: Earbuds ===
+
+ex:img2_obj_4 a schema:Product ;
+ rdf:type ex:Earbuds ;
+ rdfs:label "White earbuds" ;
+ schema:category "Electronics" ;
+ schema:description "A pair of white wired earbuds with the cable trailing between the laptop and the notebook." ;
+ ex:confidence "0.85"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "between laptop and notebook" ;
+ ex:relationType "between" ;
+ ex:leftBound ex:img2_obj_1 ;
+ ex:rightBound ex:img2_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "on desk surface" ;
+ ex:relationType "on" ;
+ ex:target ex:img2_obj_6
+ ] .
+
+# === Object: Camera ===
+
+ex:img2_obj_5 a schema:Product ;
+ rdf:type ex:Camera ;
+ rdfs:label "Vintage-style camera" ;
+ schema:category "Electronics" ;
+ schema:description "A compact vintage or retro-style camera with a silver and black body, positioned in the upper-right area of the desk above the notebook." ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "above notebook" ;
+ ex:relationType "above" ;
+ ex:target ex:img2_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "upper-right of desk" ;
+ ex:relationType "occupies" ;
+ ex:target ex:img2_obj_6
+ ] .
+
+# === Object: Wooden Desk Surface ===
+
+ex:img2_obj_6 a schema:Product ;
+ rdf:type ex:DeskSurface ;
+ rdfs:label "Wooden desk surface" ;
+ schema:category "Furniture" ;
+ schema:description "A warm brown wooden desk or table surface with visible wood grain, serving as the background for all objects in the scene." ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ schema:spatialCoverage "Entire image background" ;
+ ex:spatialRelation [
+ rdfs:label "supports all objects" ;
+ ex:relationType "supports" ;
+ ex:target ex:img2_obj_1 , ex:img2_obj_2 , ex:img2_obj_3 , ex:img2_obj_4 , ex:img2_obj_5
+ ] .
+
+# === Type Definitions ===
+
+ex:Laptop a rdfs:Class ;
+ rdfs:label "Laptop" ;
+ rdfs:subClassOf schema:Product .
+
+ex:Notebook a rdfs:Class ;
+ rdfs:label "Notebook" ;
+ rdfs:subClassOf schema:Product .
+
+ex:Pen a rdfs:Class ;
+ rdfs:label "Pen" ;
+ rdfs:subClassOf schema:Product .
+
+ex:Earbuds a rdfs:Class ;
+ rdfs:label "Earbuds" ;
+ rdfs:subClassOf schema:Product .
+
+ex:Camera a rdfs:Class ;
+ rdfs:label "Camera" ;
+ rdfs:subClassOf schema:Product .
+
+ex:DeskSurface a rdfs:Class ;
+ rdfs:label "Desk Surface" ;
+ rdfs:subClassOf schema:Product .
+
+# === Property Definitions ===
+
+ex:confidence a rdf:Property ;
+ rdfs:label "detection confidence" ;
+ rdfs:comment "Confidence score for object detection, ranging from 0.0 to 1.0." ;
+ rdfs:range xsd:decimal .
+
+ex:spatialRelation a rdf:Property ;
+ rdfs:label "spatial relation" ;
+ rdfs:comment "Describes a spatial relationship between two objects in the image." .
+
+ex:relationType a rdf:Property ;
+ rdfs:label "relation type" ;
+ rdfs:comment "The type of spatial relation (e.g., leftOf, rightOf, above, below, on, between, supports, occupies)." ;
+ rdfs:range xsd:string .
diff --git a/benchmark/vision/dataset/img_3.jpg b/benchmark/vision/dataset/img_3.jpg
new file mode 100644
index 00000000..5d79979d
Binary files /dev/null and b/benchmark/vision/dataset/img_3.jpg differ
diff --git a/benchmark/vision/dataset/img_3.ttl b/benchmark/vision/dataset/img_3.ttl
new file mode 100644
index 00000000..deb5c0f9
--- /dev/null
+++ b/benchmark/vision/dataset/img_3.ttl
@@ -0,0 +1,147 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image node ===
+ex:img_3
+ rdf:type schema:ImageObject ;
+ rdfs:label "Frog camouflaged in duckweed-covered water" ;
+ schema:description "A frog partially submerged in still water densely covered with duckweed. The frog is heavily camouflaged by duckweed clinging to its head and body, with only its prominent eyes and the top of its head clearly visible above the water surface." ;
+ schema:keywords "frog, duckweed, camouflage, pond, wildlife, amphibian, green, water surface, macro photography" ;
+ schema:contentUrl "img_3.jpg" ;
+ schema:hasPart ex:img3_obj_1 ,
+ ex:img3_obj_2 ,
+ ex:img3_obj_3 ,
+ ex:img3_obj_4 ,
+ ex:img3_obj_5 ,
+ ex:img3_obj_6 ,
+ ex:img3_obj_7 .
+
+# === Object 1: Frog ===
+ex:img3_obj_1
+ rdf:type schema:Thing ;
+ rdfs:label "Frog" ;
+ schema:category "Amphibian" ;
+ schema:description "A frog partially submerged in water, heavily covered with duckweed providing natural camouflage. Only the top of its head and eyes protrude above the water surface." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "centered in frame" ;
+ schema:description "The frog is positioned at the center of the image"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "submerged in" ;
+ schema:targetObject ex:img3_obj_3 ;
+ schema:description "The frog is partially submerged in the pond water"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "covered by" ;
+ schema:targetObject ex:img3_obj_4 ;
+ schema:description "The frog is covered with duckweed plants providing camouflage"
+ ] .
+
+# === Object 2: Frog eyes ===
+ex:img3_obj_2
+ rdf:type schema:Thing ;
+ rdfs:label "Frog eyes" ;
+ schema:category "Animal body part" ;
+ schema:description "Two large, round, dark eyes with textured eyelids visible above the water surface. The eyes are the most prominent and identifiable feature of the camouflaged frog." ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "part of" ;
+ schema:targetObject ex:img3_obj_1 ;
+ schema:description "The eyes are part of the frog"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "above" ;
+ schema:targetObject ex:img3_obj_3 ;
+ schema:description "The eyes protrude above the water surface"
+ ] .
+
+# === Object 3: Pond water ===
+ex:img3_obj_3
+ rdf:type schema:Thing ;
+ rdfs:label "Pond water" ;
+ schema:category "Water body" ;
+ schema:description "Still, calm pond water visible beneath the dense layer of duckweed. The water surface is almost entirely obscured by floating vegetation." ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ schema:spatialCoverage "Entire image background" ;
+ ex:spatialRelation [
+ rdfs:label "beneath" ;
+ schema:targetObject ex:img3_obj_4 ;
+ schema:description "The water lies beneath the floating duckweed layer"
+ ] .
+
+# === Object 4: Duckweed (Lemna) ===
+ex:img3_obj_4
+ rdf:type schema:Thing ;
+ rdfs:label "Duckweed" ;
+ schema:category "Aquatic plant" ;
+ schema:description "A dense mat of tiny green duckweed (Lemna) plants covering the entire water surface. The individual fronds are small, round, and bright green, forming a continuous carpet across the pond." ;
+ ex:confidence "0.96"^^xsd:decimal ;
+ schema:spatialCoverage "Entire water surface" ;
+ ex:spatialRelation [
+ rdfs:label "floating on" ;
+ schema:targetObject ex:img3_obj_3 ;
+ schema:description "The duckweed floats on the surface of the pond water"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "covering" ;
+ schema:targetObject ex:img3_obj_1 ;
+ schema:description "Duckweed covers the frog, providing camouflage"
+ ] .
+
+# === Object 5: Frog head ===
+ex:img3_obj_5
+ rdf:type schema:Thing ;
+ rdfs:label "Frog head" ;
+ schema:category "Animal body part" ;
+ schema:description "The top of the frog's head, textured and bumpy, partially visible above the water surface and covered with duckweed fronds clinging to its skin." ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "part of" ;
+ schema:targetObject ex:img3_obj_1 ;
+ schema:description "The head is part of the frog"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "above" ;
+ schema:targetObject ex:img3_obj_3 ;
+ schema:description "The head protrudes slightly above the water"
+ ] .
+
+# === Object 6: Insect ===
+ex:img3_obj_6
+ rdf:type schema:Thing ;
+ rdfs:label "Small insect" ;
+ schema:category "Insect" ;
+ schema:description "A small dark insect resting on the duckweed surface, visible in the upper-left area of the image near the frog." ;
+ ex:confidence "0.60"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "above-left of" ;
+ schema:targetObject ex:img3_obj_1 ;
+ schema:description "The insect is positioned above and to the left of the frog"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "resting on" ;
+ schema:targetObject ex:img3_obj_4 ;
+ schema:description "The insect sits on the duckweed surface"
+ ] .
+
+# === Object 7: Frog nostrils ===
+ex:img3_obj_7
+ rdf:type schema:Thing ;
+ rdfs:label "Frog nostrils" ;
+ schema:category "Animal body part" ;
+ schema:description "The frog's nostrils are faintly visible between the eyes on the top of the head, positioned just above the waterline to allow breathing." ;
+ ex:confidence "0.55"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "part of" ;
+ schema:targetObject ex:img3_obj_5 ;
+ schema:description "The nostrils are part of the frog's head"
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "between" ;
+ schema:targetObject ex:img3_obj_2 ;
+ schema:description "The nostrils are positioned between the two eyes"
+ ] .
diff --git a/benchmark/vision/dataset/img_4.jpg b/benchmark/vision/dataset/img_4.jpg
new file mode 100644
index 00000000..3a206245
Binary files /dev/null and b/benchmark/vision/dataset/img_4.jpg differ
diff --git a/benchmark/vision/dataset/img_4.ttl b/benchmark/vision/dataset/img_4.ttl
new file mode 100644
index 00000000..fadc22bc
--- /dev/null
+++ b/benchmark/vision/dataset/img_4.ttl
@@ -0,0 +1,132 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image node ===
+ex:img_4
+ rdf:type schema:ImageObject ;
+ rdfs:label "img_4.jpg" ;
+ schema:description "A moody, overcast rural landscape showing a dense row of tall coniferous trees spanning the middle ground, with misty forested hills receding into the background and a dry grassy meadow in the foreground." ;
+ schema:keywords "landscape", "forest", "coniferous trees", "meadow", "overcast", "hills", "mist", "rural", "nature" ;
+ schema:hasPart ex:img4_obj_1 ,
+ ex:img4_obj_2 ,
+ ex:img4_obj_3 ,
+ ex:img4_obj_4 ,
+ ex:img4_obj_5 ,
+ ex:img4_obj_6 ,
+ ex:img4_obj_7 .
+
+# === Object 1: Overcast sky ===
+ex:img4_obj_1
+ rdf:type schema:Thing ;
+ rdfs:label "Overcast sky" ;
+ schema:category "sky" ;
+ schema:description "A flat, grey overcast sky covering the upper third of the image with no visible sun or blue patches." ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "above coniferous tree line" ;
+ schema:spatialCoverage ex:img4_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "above distant hills" ;
+ schema:spatialCoverage ex:img4_obj_4
+ ] .
+
+# === Object 2: Dense coniferous tree line ===
+ex:img4_obj_2
+ rdf:type schema:Thing ;
+ rdfs:label "Dense coniferous tree line" ;
+ schema:category "vegetation" ;
+ schema:description "A continuous row of tall, dark coniferous trees (likely spruce or pine) stretching across the full width of the image in the middle ground. Trunks are visible beneath the canopy." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "below overcast sky" ;
+ schema:spatialCoverage ex:img4_obj_1
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "above grassy meadow" ;
+ schema:spatialCoverage ex:img4_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "in front of distant forested hills" ;
+ schema:spatialCoverage ex:img4_obj_4
+ ] .
+
+# === Object 3: Grassy meadow ===
+ex:img4_obj_3
+ rdf:type schema:Thing ;
+ rdfs:label "Grassy meadow" ;
+ schema:category "terrain" ;
+ schema:description "A dry, brownish-green grassy field occupying the lower foreground, sloping gently upward toward the tree line. The grass appears short and dormant, suggesting late autumn or early spring." ;
+ ex:confidence "0.94"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "below coniferous tree line" ;
+ schema:spatialCoverage ex:img4_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "in front of coniferous tree line" ;
+ schema:spatialCoverage ex:img4_obj_2
+ ] .
+
+# === Object 4: Distant forested hills ===
+ex:img4_obj_4
+ rdf:type schema:Thing ;
+ rdfs:label "Distant forested hills" ;
+ schema:category "terrain" ;
+ schema:description "Rolling hills covered in dense forest visible behind and above the main tree line, partially obscured by atmospheric haze and mist. Multiple layers of hills recede into the background." ;
+ ex:confidence "0.88"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "behind coniferous tree line" ;
+ schema:spatialCoverage ex:img4_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "below overcast sky" ;
+ schema:spatialCoverage ex:img4_obj_1
+ ] .
+
+# === Object 5: Atmospheric haze/mist ===
+ex:img4_obj_5
+ rdf:type schema:Thing ;
+ rdfs:label "Atmospheric haze" ;
+ schema:category "atmospheric condition" ;
+ schema:description "A layer of mist or haze visible between the main tree line and the distant hills, reducing visibility and creating depth layering in the landscape." ;
+ ex:confidence "0.82"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "between tree line and distant hills" ;
+ schema:spatialCoverage ex:img4_obj_2 ,
+ ex:img4_obj_4
+ ] .
+
+# === Object 6: Visible tree trunks ===
+ex:img4_obj_6
+ rdf:type schema:Thing ;
+ rdfs:label "Visible tree trunks" ;
+ schema:category "vegetation" ;
+ schema:description "Bare, straight trunks of the coniferous trees visible beneath the canopy, indicating mature plantation-style or naturally dense forest with high canopy and little undergrowth." ;
+ ex:confidence "0.80"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "part of coniferous tree line" ;
+ schema:spatialCoverage ex:img4_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "above grassy meadow" ;
+ schema:spatialCoverage ex:img4_obj_3
+ ] .
+
+# === Object 7: Gentle hill slope ===
+ex:img4_obj_7
+ rdf:type schema:Thing ;
+ rdfs:label "Gentle hill slope" ;
+ schema:category "terrain" ;
+ schema:description "The foreground meadow rises on a gentle slope from lower-left toward the tree line, indicating the landscape sits on undulating terrain." ;
+ ex:confidence "0.78"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "part of grassy meadow" ;
+ schema:spatialCoverage ex:img4_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "leading up to coniferous tree line" ;
+ schema:spatialCoverage ex:img4_obj_2
+ ] .
diff --git a/benchmark/vision/dataset/img_5.jpg b/benchmark/vision/dataset/img_5.jpg
new file mode 100644
index 00000000..7222c4cb
Binary files /dev/null and b/benchmark/vision/dataset/img_5.jpg differ
diff --git a/benchmark/vision/dataset/img_5.ttl b/benchmark/vision/dataset/img_5.ttl
new file mode 100644
index 00000000..fad0fc41
--- /dev/null
+++ b/benchmark/vision/dataset/img_5.ttl
@@ -0,0 +1,106 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image node ===
+ex:img_5 a schema:ImageObject ;
+ schema:description "A low-angle close-up photograph of a weathered wooden boardwalk with planks receding into the distance, a clear blue sky above, and blurred buildings including a cylindrical tower structure visible on the horizon." ;
+ schema:keywords "boardwalk, wooden deck, planks, sky, buildings, tower, shallow depth of field, outdoor, waterfront" ;
+ schema:contentUrl "img_5.jpg" ;
+ ex:hasObject ex:img5_obj_1 ,
+ ex:img5_obj_2 ,
+ ex:img5_obj_3 ,
+ ex:img5_obj_4 ,
+ ex:img5_obj_5 ,
+ ex:img5_obj_6 .
+
+# === Object 1: Wooden boardwalk surface ===
+ex:img5_obj_1 a schema:Thing ;
+ rdf:type ex:PhysicalObject ;
+ rdfs:label "Wooden boardwalk surface" ;
+ schema:category "Structure" ;
+ schema:material "Wood" ;
+ ex:confidence "0.98"^^xsd:decimal ;
+ ex:dominatesFrame true ;
+ schema:description "Weathered wooden planks forming a boardwalk or deck, seen from a very low angle with visible grain, gaps between planks, and surface wear." ;
+ schema:spatialCoverage "foreground, lower two-thirds of frame" .
+
+# === Object 2: Wooden planks (individual) ===
+ex:img5_obj_2 a schema:Thing ;
+ rdf:type ex:PhysicalObject ;
+ rdfs:label "Wooden planks" ;
+ schema:category "Component" ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ schema:description "Individual horizontal wooden planks with visible grain texture, small cracks, and debris in the gaps between them." ;
+ schema:spatialCoverage "foreground, extending toward midground" ;
+ ex:spatialRelation [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_2 ;
+ ex:predicate "partOf" ;
+ ex:object ex:img5_obj_1 ] .
+
+# === Object 3: Clear blue sky ===
+ex:img5_obj_3 a schema:Thing ;
+ rdf:type ex:NaturalFeature ;
+ rdfs:label "Clear blue sky" ;
+ schema:category "Sky" ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ schema:color "Blue" ;
+ schema:description "A clear blue sky with no visible clouds, occupying the upper portion of the frame." ;
+ schema:spatialCoverage "upper third of frame, background" ;
+ ex:spatialRelation [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_3 ;
+ ex:predicate "above" ;
+ ex:object ex:img5_obj_1 ] .
+
+# === Object 4: Cylindrical tower structure ===
+ex:img5_obj_4 a schema:Thing ;
+ rdf:type ex:PhysicalObject ;
+ rdfs:label "Cylindrical tower structure" ;
+ schema:category "Building" ;
+ ex:confidence "0.72"^^xsd:decimal ;
+ schema:description "A blurred cylindrical or tower-like structure visible on the horizon, possibly a water tower, observation tower, or industrial structure." ;
+ schema:spatialCoverage "center-right background, at horizon line" ;
+ ex:spatialRelation [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_4 ;
+ ex:predicate "behind" ;
+ ex:object ex:img5_obj_1 ] ,
+ [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_4 ;
+ ex:predicate "below" ;
+ ex:object ex:img5_obj_3 ] .
+
+# === Object 5: Background buildings ===
+ex:img5_obj_5 a schema:Thing ;
+ rdf:type ex:PhysicalObject ;
+ rdfs:label "Background buildings" ;
+ schema:category "Building" ;
+ ex:confidence "0.65"^^xsd:decimal ;
+ schema:description "Low-rise blurred building silhouettes visible along the horizon line, likely part of a waterfront or coastal settlement." ;
+ schema:spatialCoverage "background, along horizon line left to right" ;
+ ex:spatialRelation [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_5 ;
+ ex:predicate "behind" ;
+ ex:object ex:img5_obj_1 ] ,
+ [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_5 ;
+ ex:predicate "leftOf" ;
+ ex:object ex:img5_obj_4 ] .
+
+# === Object 6: Horizon line ===
+ex:img5_obj_6 a schema:Thing ;
+ rdf:type ex:VisualFeature ;
+ rdfs:label "Horizon line" ;
+ schema:category "Boundary" ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ schema:description "The horizon line where the boardwalk surface meets the sky, running roughly horizontally across the upper third of the image." ;
+ schema:spatialCoverage "horizontal band at upper third of frame" ;
+ ex:spatialRelation [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_6 ;
+ ex:predicate "separates" ;
+ ex:object ex:img5_obj_1 ] ,
+ [ a ex:SpatialRelation ;
+ ex:subject ex:img5_obj_6 ;
+ ex:predicate "separates" ;
+ ex:object ex:img5_obj_3 ] .
diff --git a/benchmark/vision/dataset/img_6.jpg b/benchmark/vision/dataset/img_6.jpg
new file mode 100644
index 00000000..8721f899
Binary files /dev/null and b/benchmark/vision/dataset/img_6.jpg differ
diff --git a/benchmark/vision/dataset/img_6.ttl b/benchmark/vision/dataset/img_6.ttl
new file mode 100644
index 00000000..2ddbea8d
--- /dev/null
+++ b/benchmark/vision/dataset/img_6.ttl
@@ -0,0 +1,105 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image Node ===
+ex:img_6 a schema:ImageObject ;
+ schema:description "Two people paddling a canoe on calm, misty water. The scene is enveloped in fog, giving a muted teal-green tone. The still water produces a near-perfect mirror reflection of the canoe and its occupants." ;
+ schema:keywords "canoe", "paddling", "lake", "fog", "mist", "reflection", "water", "outdoor recreation", "teal", "calm" .
+
+# === Object: Canoe ===
+ex:img6_obj_1 a schema:Product ;
+ rdf:type ex:Watercraft ;
+ rdfs:label "Canoe" ;
+ schema:category "Watercraft" ;
+ schema:description "A green open-top canoe carrying two passengers, positioned centrally in the frame" ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ schema:spatialCoverage "center of image, horizontal midline" ;
+ ex:spatialRelation ex:img6_obj_5 ;
+ ex:relationDescription "floating on the lake surface" .
+
+# === Object: Person in stern (rear) ===
+ex:img6_obj_2 a schema:Person ;
+ rdfs:label "Stern paddler" ;
+ schema:category "Person" ;
+ schema:description "Person seated at the rear of the canoe, wearing a teal or dark green hooded jacket. Holding a paddle but not actively stroking." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ schema:spatialCoverage "right-center of image, seated in rear of canoe" ;
+ ex:spatialRelation ex:img6_obj_1 ;
+ ex:relationDescription "seated inside the canoe at the stern" .
+
+# === Object: Person in bow (front) ===
+ex:img6_obj_3 a schema:Person ;
+ rdfs:label "Bow paddler" ;
+ schema:category "Person" ;
+ schema:description "Person seated at the front of the canoe, wearing a light blue-green top and a hat or cap. Actively raising an orange-bladed paddle." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ schema:spatialCoverage "left-center of image, seated in front of canoe" ;
+ ex:spatialRelation ex:img6_obj_1 ;
+ ex:relationDescription "seated inside the canoe at the bow" .
+
+# === Object: Paddle with orange blade ===
+ex:img6_obj_4 a schema:Product ;
+ rdf:type ex:PaddlingEquipment ;
+ rdfs:label "Canoe paddle" ;
+ schema:category "Sports Equipment" ;
+ schema:description "A canoe paddle with a bright orange blade, held raised by the bow paddler" ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ schema:spatialCoverage "left-center, above canoe, angled upward" ;
+ ex:spatialRelation ex:img6_obj_3 ;
+ ex:relationDescription "held by the bow paddler" .
+
+# === Object: Lake / Water body ===
+ex:img6_obj_5 a schema:Place ;
+ rdf:type ex:WaterBody ;
+ rdfs:label "Lake" ;
+ schema:category "Natural Water Body" ;
+ schema:description "A calm lake with very still, teal-green water filling the lower two-thirds of the image. The surface is glassy and produces clear reflections." ;
+ ex:confidence "0.98"^^xsd:decimal ;
+ schema:spatialCoverage "lower two-thirds of image" .
+
+# === Object: Fog / Mist ===
+ex:img6_obj_6 a schema:Place ;
+ rdf:type ex:AtmosphericCondition ;
+ rdfs:label "Fog" ;
+ schema:category "Weather Condition" ;
+ schema:description "Dense fog or mist obscuring the background and horizon, giving the scene a flat grey-white sky and limited visibility" ;
+ ex:confidence "0.96"^^xsd:decimal ;
+ schema:spatialCoverage "upper third of image and background" ;
+ ex:spatialRelation ex:img6_obj_5 ;
+ ex:relationDescription "hanging above the lake surface" .
+
+# === Object: Reflection on water ===
+ex:img6_obj_7 a schema:CreativeWork ;
+ rdf:type ex:Reflection ;
+ rdfs:label "Water reflection" ;
+ schema:category "Optical Phenomenon" ;
+ schema:description "A near-perfect mirror reflection of the canoe and both paddlers visible on the still water surface directly below them" ;
+ ex:confidence "0.92"^^xsd:decimal ;
+ schema:spatialCoverage "lower-center of image, beneath the canoe" ;
+ ex:spatialRelation ex:img6_obj_1 ;
+ ex:relationDescription "mirror image of the canoe reflected on the water surface" ;
+ ex:spatialRelation ex:img6_obj_5 ;
+ ex:relationDescription "visible on the lake surface" .
+
+# === Spatial relationships between people ===
+ex:img6_obj_2 ex:spatialRelation ex:img6_obj_3 ;
+ ex:relationDescription "sitting behind the bow paddler in the same canoe" .
+
+ex:img6_obj_3 ex:spatialRelation ex:img6_obj_2 ;
+ ex:relationDescription "sitting in front of the stern paddler in the same canoe" .
+
+# === Canoe on the water ===
+ex:img6_obj_1 ex:spatialRelation ex:img6_obj_5 ;
+ ex:relationDescription "floating on the lake surface" .
+
+# === Image contains all objects ===
+ex:img_6 schema:about ex:img6_obj_1 ,
+ ex:img6_obj_2 ,
+ ex:img6_obj_3 ,
+ ex:img6_obj_4 ,
+ ex:img6_obj_5 ,
+ ex:img6_obj_6 ,
+ ex:img6_obj_7 .
diff --git a/benchmark/vision/dataset/img_7.jpg b/benchmark/vision/dataset/img_7.jpg
new file mode 100644
index 00000000..58398102
Binary files /dev/null and b/benchmark/vision/dataset/img_7.jpg differ
diff --git a/benchmark/vision/dataset/img_7.ttl b/benchmark/vision/dataset/img_7.ttl
new file mode 100644
index 00000000..c624a2ce
--- /dev/null
+++ b/benchmark/vision/dataset/img_7.ttl
@@ -0,0 +1,157 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image node ===
+ex:img_7
+ rdf:type schema:ImageObject ;
+ schema:description "Aerial photograph of a coastal landscape showing a deep blue ocean, sandy beach, eroded sandstone cliffs, a golf course with manicured green fairways, residential neighborhoods with houses and roads, and hillside vegetation. The viewpoint is from high altitude looking down at an oblique angle." ;
+ schema:keywords "aerial view, coastline, ocean, beach, cliffs, golf course, residential area, California coast, landscape, bird's-eye view" .
+
+# === Object: Ocean ===
+ex:img7_obj_1
+ rdf:type schema:BodyOfWater ;
+ rdfs:label "Ocean"@en ;
+ schema:category "water body" ;
+ schema:description "Deep blue ocean occupying the lower-left and bottom portions of the image, with darker tones in deep water transitioning to turquoise near the shore" ;
+ ex:confidence "0.98"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "adjacent to beach" ;
+ schema:spatialCoverage ex:img7_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "below cliffs" ;
+ schema:spatialCoverage ex:img7_obj_3
+ ] .
+
+# === Object: Sandy Beach ===
+ex:img7_obj_2
+ rdf:type schema:Beach ;
+ rdfs:label "Sandy Beach"@en ;
+ schema:category "landform" ;
+ schema:description "Curved sandy beach forming a crescent shape along the shoreline, with pale sand visible between the ocean and the base of the cliffs" ;
+ ex:confidence "0.96"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "between ocean and cliffs" ;
+ schema:spatialCoverage ex:img7_obj_1 ,
+ ex:img7_obj_3
+ ] .
+
+# === Object: Sandstone Cliffs ===
+ex:img7_obj_3
+ rdf:type schema:Landform ;
+ rdfs:label "Sandstone Cliffs"@en ;
+ schema:category "geological formation" ;
+ schema:description "Eroded tan and brown sandstone bluffs rising steeply from the beach, with visible geological layering and erosion patterns running across the center of the image" ;
+ ex:confidence "0.94"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "above beach" ;
+ schema:spatialCoverage ex:img7_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "below residential area" ;
+ schema:spatialCoverage ex:img7_obj_5
+ ] .
+
+# === Object: Golf Course ===
+ex:img7_obj_4
+ rdf:type schema:GolfCourse ;
+ rdfs:label "Golf Course"@en ;
+ schema:category "recreational facility" ;
+ schema:description "Manicured golf course with bright green fairways and landscaped areas visible on the coastal terrace near the cliff edge, at the right-center of the image" ;
+ ex:confidence "0.88"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "adjacent to cliffs" ;
+ schema:spatialCoverage ex:img7_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "adjacent to residential area" ;
+ schema:spatialCoverage ex:img7_obj_5
+ ] .
+
+# === Object: Residential Area ===
+ex:img7_obj_5
+ rdf:type schema:Residence ;
+ rdfs:label "Residential Neighborhood"@en ;
+ schema:category "built environment" ;
+ schema:description "Suburban residential neighborhoods with houses, streets, and driveways spread across the upper portion of the image, extending inland from the cliff tops" ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "above cliffs" ;
+ schema:spatialCoverage ex:img7_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "interspersed with vegetation" ;
+ schema:spatialCoverage ex:img7_obj_6
+ ] .
+
+# === Object: Hillside Vegetation ===
+ex:img7_obj_6
+ rdf:type schema:Landform ;
+ rdfs:label "Hillside Vegetation"@en ;
+ schema:category "natural vegetation" ;
+ schema:description "Patches of green and brown vegetation covering the hillsides and canyon areas between residential developments, including scrubland and scattered trees" ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "on cliffs and hillsides" ;
+ schema:spatialCoverage ex:img7_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "between residential areas" ;
+ schema:spatialCoverage ex:img7_obj_5
+ ] .
+
+# === Object: Shallow Water / Surf Zone ===
+ex:img7_obj_7
+ rdf:type schema:BodyOfWater ;
+ rdfs:label "Shallow Water Zone"@en ;
+ schema:category "water body" ;
+ schema:description "Turquoise and light-colored shallow water zone near the shoreline where the ocean floor is visible through the water, with possible sediment plumes" ;
+ ex:confidence "0.91"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "between deep ocean and beach" ;
+ schema:spatialCoverage ex:img7_obj_1 ,
+ ex:img7_obj_2
+ ] .
+
+# === Object: Roads ===
+ex:img7_obj_8
+ rdf:type schema:Road ;
+ rdfs:label "Roads"@en ;
+ schema:category "infrastructure" ;
+ schema:description "Network of roads and streets winding through the residential areas and along the cliff tops, visible as grey lines in the upper portion of the image" ;
+ ex:confidence "0.85"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "within residential area" ;
+ schema:spatialCoverage ex:img7_obj_5
+ ] .
+
+# === Object: Small Vessel ===
+ex:img7_obj_9
+ rdf:type schema:Vehicle ;
+ rdfs:label "Small Vessel"@en ;
+ schema:category "watercraft" ;
+ schema:description "A small white object on the ocean surface, likely a boat, visible in the lower-center area of the image near the shallow water zone" ;
+ ex:confidence "0.62"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "on ocean surface" ;
+ schema:spatialCoverage ex:img7_obj_1
+ ] .
+
+# === Object: Canyon / Ravine ===
+ex:img7_obj_10
+ rdf:type schema:Landform ;
+ rdfs:label "Coastal Canyon"@en ;
+ schema:category "geological formation" ;
+ schema:description "A canyon or ravine cutting through the cliffs from the residential area down toward the beach, visible as a darker indentation in the cliff face" ;
+ ex:confidence "0.82"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "cutting through cliffs" ;
+ schema:spatialCoverage ex:img7_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "leading to beach" ;
+ schema:spatialCoverage ex:img7_obj_2
+ ] .
diff --git a/benchmark/vision/dataset/img_8.jpg b/benchmark/vision/dataset/img_8.jpg
new file mode 100644
index 00000000..b2b89160
Binary files /dev/null and b/benchmark/vision/dataset/img_8.jpg differ
diff --git a/benchmark/vision/dataset/img_8.ttl b/benchmark/vision/dataset/img_8.ttl
new file mode 100644
index 00000000..cb639c57
--- /dev/null
+++ b/benchmark/vision/dataset/img_8.ttl
@@ -0,0 +1,128 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image Node ===
+ex:img_8 a schema:ImageObject ;
+ schema:description "A young fallow deer fawn with white spots standing in a sunlit forest clearing, surrounded by fallen leaves and soft golden backlight filtering through the trees." ;
+ schema:keywords "deer, fawn, fallow deer, spotted, forest, woodland, autumn, sunlight, wildlife, nature" ;
+ schema:contentUrl "img_8.jpg" ;
+ schema:width "1024"^^xsd:integer ;
+ schema:height "1024"^^xsd:integer .
+
+# === Object: Fallow Deer Fawn ===
+ex:img8_obj_1 a schema:Thing ;
+ rdf:type ex:Animal ;
+ rdfs:label "Fallow deer fawn" ;
+ schema:category "Wildlife" ;
+ schema:description "A young fallow deer (Dama dama) with characteristic white spots on brown fur, large ears, and dark eyes, standing alert and looking slightly to the left." ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdfs:label "standing on" ;
+ ex:target ex:img8_obj_2
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "in front of" ;
+ ex:target ex:img8_obj_3
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "below" ;
+ ex:target ex:img8_obj_5
+ ] ;
+ schema:spatialCoverage "center-foreground" .
+
+# === Object: Forest Floor / Fallen Leaves ===
+ex:img8_obj_2 a schema:Thing ;
+ rdf:type ex:GroundCover ;
+ rdfs:label "Forest floor with fallen leaves" ;
+ schema:category "Terrain" ;
+ schema:description "A layer of dry brown and tan fallen leaves covering the forest floor, typical of autumn woodland." ;
+ ex:confidence "0.95"^^xsd:decimal ;
+ schema:spatialCoverage "bottom" ;
+ ex:spatialRelation [
+ rdfs:label "beneath" ;
+ ex:target ex:img8_obj_1
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "beneath" ;
+ ex:target ex:img8_obj_3
+ ] .
+
+# === Object: Trees / Forest Background ===
+ex:img8_obj_3 a schema:Thing ;
+ rdf:type ex:Vegetation ;
+ rdfs:label "Deciduous forest trees" ;
+ schema:category "Vegetation" ;
+ schema:description "Multiple bare and partially leafed deciduous trees forming a soft, bokeh-blurred woodland background." ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ schema:spatialCoverage "background" ;
+ ex:spatialRelation [
+ rdfs:label "behind" ;
+ ex:target ex:img8_obj_1
+ ] .
+
+# === Object: Sunlight / Golden Backlight ===
+ex:img8_obj_4 a schema:Thing ;
+ rdf:type ex:LightingCondition ;
+ rdfs:label "Golden backlight" ;
+ schema:category "Lighting" ;
+ schema:description "Warm golden sunlight filtering through the trees from behind, creating a soft backlit glow around the fawn and illuminating airborne particles." ;
+ ex:confidence "0.92"^^xsd:decimal ;
+ schema:spatialCoverage "background-upper" ;
+ ex:spatialRelation [
+ rdfs:label "illuminates" ;
+ ex:target ex:img8_obj_1
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "filters through" ;
+ ex:target ex:img8_obj_3
+ ] .
+
+# === Object: Fallen Tree Branch / Log ===
+ex:img8_obj_5 a schema:Thing ;
+ rdf:type ex:NaturalObject ;
+ rdfs:label "Fallen tree branch" ;
+ schema:category "Natural debris" ;
+ schema:description "A thick dark tree branch or log extending horizontally across the upper-right portion of the frame above the deer." ;
+ ex:confidence "0.88"^^xsd:decimal ;
+ schema:spatialCoverage "upper-right" ;
+ ex:spatialRelation [
+ rdfs:label "above" ;
+ ex:target ex:img8_obj_1
+ ] .
+
+# === Object: Airborne Particles / Dust Motes ===
+ex:img8_obj_6 a schema:Thing ;
+ rdf:type ex:AtmosphericElement ;
+ rdfs:label "Airborne dust motes" ;
+ schema:category "Atmospheric effect" ;
+ schema:description "Tiny particles and dust motes visible in the air, illuminated by the golden backlight creating a magical, ethereal atmosphere." ;
+ ex:confidence "0.80"^^xsd:decimal ;
+ schema:spatialCoverage "center-background" ;
+ ex:spatialRelation [
+ rdfs:label "surrounding" ;
+ ex:target ex:img8_obj_1
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "illuminated by" ;
+ ex:target ex:img8_obj_4
+ ] .
+
+# === Object: Autumn Foliage (background) ===
+ex:img8_obj_7 a schema:Thing ;
+ rdf:type ex:Vegetation ;
+ rdfs:label "Autumn foliage" ;
+ schema:category "Vegetation" ;
+ schema:description "Patches of warm golden and amber foliage visible in the blurred background, indicating autumn season." ;
+ ex:confidence "0.82"^^xsd:decimal ;
+ schema:spatialCoverage "background-right" ;
+ ex:spatialRelation [
+ rdfs:label "behind" ;
+ ex:target ex:img8_obj_1
+ ] ;
+ ex:spatialRelation [
+ rdfs:label "part of" ;
+ ex:target ex:img8_obj_3
+ ] .
diff --git a/benchmark/vision/dataset/img_9.jpg b/benchmark/vision/dataset/img_9.jpg
new file mode 100644
index 00000000..cdbfc21e
Binary files /dev/null and b/benchmark/vision/dataset/img_9.jpg differ
diff --git a/benchmark/vision/dataset/img_9.ttl b/benchmark/vision/dataset/img_9.ttl
new file mode 100644
index 00000000..e5a68c09
--- /dev/null
+++ b/benchmark/vision/dataset/img_9.ttl
@@ -0,0 +1,133 @@
+@prefix ex: <http://example.org/image/> .
+@prefix schema: <http://schema.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+# === Image node ===
+ex:img_9
+ rdf:type schema:ImageObject ;
+ schema:name "img_9.jpg" ;
+ schema:description "Extreme close-up macro photograph of a cat's nose and muzzle, showing fine fur texture, pink nose leather, and the cleft of the upper lip against a soft blurred background." ;
+ schema:keywords "cat, nose, muzzle, macro, close-up, fur, whiskers, feline, pet, animal" ;
+ schema:about ex:img9_obj_1 , ex:img9_obj_2 , ex:img9_obj_3 , ex:img9_obj_4 , ex:img9_obj_5 , ex:img9_obj_6 , ex:img9_obj_7 .
+
+# === Object 1: Cat (whole animal, partially visible) ===
+ex:img9_obj_1
+ rdf:type schema:Thing ;
+ rdfs:label "Cat" ;
+ schema:category "Animal" ;
+ schema:description "A domestic cat seen in extreme close-up; only the nose and surrounding muzzle area are visible. The fur is grey tabby with lighter and darker banding." ;
+ ex:confidence "0.97"^^xsd:decimal ;
+ schema:hasPart ex:img9_obj_2 , ex:img9_obj_3 , ex:img9_obj_4 , ex:img9_obj_5 , ex:img9_obj_6 , ex:img9_obj_7 .
+
+# === Object 2: Nose leather ===
+ex:img9_obj_2
+ rdf:type schema:Thing ;
+ rdfs:label "Nose leather" ;
+ schema:category "Animal body part" ;
+ schema:description "The cat's nose leather, a smooth pinkish-brown pad at the center of the muzzle with visible fine texture and pores." ;
+ ex:confidence "0.98"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_2 ;
+ ex:relationType "centerOf" ;
+ ex:object ex:img9_obj_1 ;
+ rdfs:comment "The nose leather is at the center of the visible muzzle area."
+ ] ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_2 ;
+ ex:relationType "above" ;
+ ex:object ex:img9_obj_4 ;
+ rdfs:comment "The nose leather sits directly above the philtrum and upper lip."
+ ] .
+
+# === Object 3: Fur (muzzle area) ===
+ex:img9_obj_3
+ rdf:type schema:Thing ;
+ rdfs:label "Fur" ;
+ schema:category "Animal covering" ;
+ schema:description "Dense, short grey tabby fur covering the muzzle and bridge of the nose. Individual hairs are visible, showing banded grey-brown coloration typical of a tabby pattern." ;
+ ex:confidence "0.96"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_3 ;
+ ex:relationType "surrounds" ;
+ ex:object ex:img9_obj_2 ;
+ rdfs:comment "The fur surrounds the nose leather on all sides."
+ ] .
+
+# === Object 4: Philtrum and upper lip ===
+ex:img9_obj_4
+ rdf:type schema:Thing ;
+ rdfs:label "Philtrum" ;
+ schema:category "Animal body part" ;
+ schema:description "The vertical groove (philtrum) running from the base of the nose leather down to the cleft of the upper lip. The lip line forms a distinct inverted-Y shape." ;
+ ex:confidence "0.93"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_4 ;
+ ex:relationType "below" ;
+ ex:object ex:img9_obj_2 ;
+ rdfs:comment "The philtrum extends directly below the nose leather."
+ ] .
+
+# === Object 5: Nostrils ===
+ex:img9_obj_5
+ rdf:type schema:Thing ;
+ rdfs:label "Nostrils" ;
+ schema:category "Animal body part" ;
+ schema:description "Two dark nostrils visible at the lower edge of the nose leather, partially shadowed." ;
+ ex:confidence "0.90"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_5 ;
+ ex:relationType "partOf" ;
+ ex:object ex:img9_obj_2 ;
+ rdfs:comment "The nostrils are openings at the base of the nose leather."
+ ] ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_5 ;
+ ex:relationType "above" ;
+ ex:object ex:img9_obj_4 ;
+ rdfs:comment "The nostrils sit above the philtrum."
+ ] .
+
+# === Object 6: Whisker pads ===
+ex:img9_obj_6
+ rdf:type schema:Thing ;
+ rdfs:label "Whisker pads" ;
+ schema:category "Animal body part" ;
+ schema:description "The rounded, fur-covered whisker pads flanking the nose on both sides. They appear puffy and are covered with the same tabby fur." ;
+ ex:confidence "0.88"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_6 ;
+ ex:relationType "adjacentTo" ;
+ ex:object ex:img9_obj_2 ;
+ rdfs:comment "The whisker pads sit on either side of the nose leather."
+ ] ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_6 ;
+ ex:relationType "adjacentTo" ;
+ ex:object ex:img9_obj_4 ;
+ rdfs:comment "The whisker pads flank the philtrum laterally."
+ ] .
+
+# === Object 7: Bridge of nose (forehead fur) ===
+ex:img9_obj_7
+ rdf:type schema:Thing ;
+ rdfs:label "Bridge of nose" ;
+ schema:category "Animal body part" ;
+ schema:description "The upper portion of the image showing the fur-covered bridge of the cat's nose extending upward toward the forehead. The tabby striping is faintly visible." ;
+ ex:confidence "0.85"^^xsd:decimal ;
+ ex:spatialRelation [
+ rdf:type ex:SpatialRelation ;
+ ex:subject ex:img9_obj_7 ;
+ ex:relationType "above" ;
+ ex:object ex:img9_obj_2 ;
+ rdfs:comment "The bridge of the nose extends above the nose leather toward the top of the frame."
+ ] .
diff --git a/benchmark/vision/download_dataset.py b/benchmark/vision/download_dataset.py
new file mode 100644
index 00000000..7df0b102
--- /dev/null
+++ b/benchmark/vision/download_dataset.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python3
+"""Download a small annotated image dataset for benchmarking.
+Uses Wikimedia Commons thumbnails (public domain) with known subjects."""
+import os
+import json
+import urllib.request
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+OUT_DIR = os.path.join(SCRIPT_DIR, "dataset")
+
+# 10 diverse images from Wikimedia Commons (public domain / CC0)
+# Each has manual ground truth labels
+IMAGES = [
+ {
+ "file": "airplane.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Cessna_172_Skyhawk_%28D-ECHO%29_02.jpg/320px-Cessna_172_Skyhawk_%28D-ECHO%29_02.jpg",
+ "labels": ["airplane", "aircraft", "vehicle", "sky"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "cat.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/220px-Cat_November_2010-1a.jpg",
+ "labels": ["cat", "animal", "pet", "feline"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "car.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/2019_Honda_Civic_sedan_%28facelift%2C_red%29%2C_front_9.29.19.jpg/320px-2019_Honda_Civic_sedan_%28facelift%2C_red%29%2C_front_9.29.19.jpg",
+ "labels": ["car", "automobile", "vehicle", "red"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "flower.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Sunflower_from_Silesia2.jpg/220px-Sunflower_from_Silesia2.jpg",
+ "labels": ["flower", "sunflower", "plant", "yellow"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "bicycle.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg",
+ "labels": ["ant", "insect", "animal", "macro"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "dog.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/YellowLabradorLooking_new.jpg/220px-YellowLabradorLooking_new.jpg",
+ "labels": ["dog", "animal", "pet", "labrador"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "bridge.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/GoldenGateBridge-001.jpg/320px-GoldenGateBridge-001.jpg",
+ "labels": ["bridge", "structure", "golden gate", "architecture"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "guitar.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/GuitareClassique5.png/120px-GuitareClassique5.png",
+ "labels": ["guitar", "instrument", "music", "strings"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "mountain.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Everest_North_Face_toward_Base_Camp_Tibet_Luca_Galuzzi_2006.jpg/320px-Everest_North_Face_toward_Base_Camp_Tibet_Luca_Galuzzi_2006.jpg",
+ "labels": ["mountain", "landscape", "snow", "nature", "everest"],
+ "source": "Wikimedia Commons",
+ },
+ {
+ "file": "clock.jpg",
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Clock_Tower_-_Palace_of_Westminster%2C_London_-_September_2006.jpg/180px-Clock_Tower_-_Palace_of_Westminster%2C_London_-_September_2006.jpg",
+ "labels": ["clock", "tower", "big ben", "architecture", "london"],
+ "source": "Wikimedia Commons",
+ },
+]
+
+
+def main():
+ os.makedirs(OUT_DIR, exist_ok=True)
+ ground_truth = {}
+
+ for img in IMAGES:
+ path = os.path.join(OUT_DIR, img["file"])
+ if not os.path.exists(path):
+ print(f"Downloading {img['file']}...")
+ try:
+ req = urllib.request.Request(img["url"], headers={"User-Agent": "Mozilla/5.0"})
+ with urllib.request.urlopen(req, timeout=15) as resp:
+ with open(path, "wb") as f:
+ f.write(resp.read())
+ except Exception as e:
+ print(f" SKIP: {e}")
+ continue
+ ground_truth[img["file"]] = img["labels"]
+ size = os.path.getsize(path)
+ print(f" {img['file']}: {size:,} bytes, labels: {img['labels']}")
+
+ gt_path = os.path.join(OUT_DIR, "ground_truth.json")
+ with open(gt_path, "w") as f:
+ json.dump(ground_truth, f, indent=2)
+ print(f"\nGround truth saved to {gt_path}")
+ print(f"Total: {len(ground_truth)} images ready")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/clinical.rs b/src/clinical.rs
index 9c1c24c3..11891ffb 100644
--- a/src/clinical.rs
+++ b/src/clinical.rs
@@ -1,6 +1,5 @@
use crate::drift::jaro_winkler;
use crate::graph::GraphStore;
-use std::sync::Arc;
/// A single crosswalk mapping row.
#[derive(Debug, Clone)]
@@ -119,9 +118,9 @@ impl ClinicalCrosswalks {
let mut validated = Vec::new();
let mut unmatched = Vec::new();
- if let Ok(json) = graph.sparql_select(label_query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(json) = graph.sparql_select(label_query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let (Some(class_iri), Some(label)) = (row["c"].as_str(), row["l"].as_str()) {
let label_clean = label.trim_matches('"').split("^^").next().unwrap_or("").trim_matches('"');
@@ -142,8 +141,6 @@ impl ClinicalCrosswalks {
}
}
}
- }
- }
serde_json::json!({
"validated": validated,
diff --git a/src/config.rs b/src/config.rs
index 1e845a86..daec11bb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -4,17 +4,11 @@ use std::path::Path;
#[derive(Debug, Deserialize)]
#[serde(default)]
+#[derive(Default)]
pub struct Config {
pub general: GeneralConfig,
}
-impl Default for Config {
- fn default() -> Self {
- Self {
- general: GeneralConfig::default(),
- }
- }
-}
impl Config {
pub fn load(path: &Path) -> Result<Self> {
@@ -42,10 +36,9 @@ impl Default for GeneralConfig {
/// Expand a leading `~` in a path to the user's home directory.
pub fn expand_tilde(path: &str) -> String {
- if path.starts_with("~/") || path == "~" {
- if let Some(home) = std::env::var_os("HOME") {
+ if (path.starts_with("~/") || path == "~")
+ && let Some(home) = std::env::var_os("HOME") {
return path.replacen("~", &home.to_string_lossy(), 1);
}
- }
path.to_string()
}
diff --git a/src/drift.rs b/src/drift.rs
index 3fff95d4..1465c149 100644
--- a/src/drift.rs
+++ b/src/drift.rs
@@ -77,6 +77,7 @@ impl DriftDetector {
}
/// Record feedback for a rename prediction.
+ #[allow(clippy::too_many_arguments)]
pub fn record_feedback(
&self,
from_iri: &str,
@@ -144,7 +145,7 @@ impl DriftDetector {
}
// Compute correlation of each signal with correctness
- let n = rows.len() as f64;
+ let _n = rows.len() as f64;
let mut weights = vec![0.0f64; 4];
for row in &rows {
weights[0] += row.0 * row.4;
@@ -174,7 +175,7 @@ impl DriftDetector {
if let Ok(json) = store.sparql_select(class_query) {
for iri in parse_iris(&json, "c") {
vocab.entry(iri.clone()).or_insert_with(|| VocabEntry {
- iri: iri,
+ iri,
kind: "class".to_string(),
label: None,
domain: None,
@@ -191,7 +192,7 @@ impl DriftDetector {
if let Ok(json) = store.sparql_select(prop_query) {
for iri in parse_iris(&json, "p") {
vocab.entry(iri.clone()).or_insert_with(|| VocabEntry {
- iri: iri,
+ iri,
kind: "property".to_string(),
label: None,
domain: None,
@@ -202,9 +203,9 @@ impl DriftDetector {
// Labels
let label_query = "SELECT ?s ?l WHERE { ?s <http://www.w3.org/2000/01/rdf-schema#label> ?l }";
- if let Ok(json) = store.sparql_select(label_query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(json) = store.sparql_select(label_query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let (Some(s), Some(l)) = (row["s"].as_str(), row["l"].as_str()) {
let s = s.trim_matches(|c| c == '<' || c == '>');
@@ -215,17 +216,15 @@ impl DriftDetector {
}
}
}
- }
- }
// Domain/Range
let dr_query = "SELECT ?p ?d ?r WHERE { \
OPTIONAL { ?p <http://www.w3.org/2000/01/rdf-schema#domain> ?d } \
OPTIONAL { ?p <http://www.w3.org/2000/01/rdf-schema#range> ?r } \
}";
- if let Ok(json) = store.sparql_select(dr_query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(json) = store.sparql_select(dr_query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let Some(p) = row["p"].as_str() {
let p = p.trim_matches(|c| c == '<' || c == '>');
@@ -240,8 +239,6 @@ impl DriftDetector {
}
}
}
- }
- }
vocab
}
diff --git a/src/enforce.rs b/src/enforce.rs
index 0db8114b..933557bd 100644
--- a/src/enforce.rs
+++ b/src/enforce.rs
@@ -1,6 +1,5 @@
use crate::graph::GraphStore;
use crate::state::StateDb;
-use std::collections::{HashMap, HashSet};
use std::sync::Arc;
/// Design pattern enforcement with built-in and custom rule packs.
@@ -220,12 +219,11 @@ impl Enforcer {
"ASK {{ <{}> <http://www.w3.org/2002/07/owl#disjointWith> <{}> }}",
children[i], children[j]
);
- if let Ok(result) = self.graph.sparql_select(&disjoint_query) {
- if !result.contains("true") {
+ if let Ok(result) = self.graph.sparql_select(&disjoint_query)
+ && !result.contains("true") {
all_disjoint = false;
break;
}
- }
}
if !all_disjoint {
break;
@@ -283,9 +281,9 @@ impl Enforcer {
}
fn query_iris(&self, query: &str, var: &str) -> Vec<String> {
- if let Ok(json) = self.graph.sparql_select(query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(json) = self.graph.sparql_select(query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array() {
return results
.iter()
.filter_map(|r| {
@@ -293,8 +291,6 @@ impl Enforcer {
})
.collect();
}
- }
- }
Vec::new()
}
}
diff --git a/src/ingest.rs b/src/ingest.rs
index 31fdcb64..b3ede618 100644
--- a/src/ingest.rs
+++ b/src/ingest.rs
@@ -180,14 +180,13 @@ impl DataIngester {
}
}
Ok(Event::Text(e)) => {
- if depth == 3 {
- if let (Some(row), Some(field)) =
+ if depth == 3
+ && let (Some(row), Some(field)) =
(&mut current_row, &current_field)
{
let text = e.unescape().unwrap_or_default().to_string();
row.insert(field.clone(), text);
}
- }
}
Ok(Event::End(_)) => {
match depth {
@@ -234,7 +233,7 @@ impl DataIngester {
let headers: Vec<String> = header_row
.iter()
- .map(|cell| Self::calamine_cell_to_string(cell))
+ .map(Self::calamine_cell_to_string)
.collect();
let mut rows = Vec::new();
diff --git a/src/main.rs b/src/main.rs
index 6d839f8f..f0bdb2ca 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -455,9 +455,9 @@ async fn main() -> anyhow::Result<()> {
let mut to_import: Vec<String> = Vec::new();
let query = "SELECT ?import WHERE { ?onto <http://www.w3.org/2002/07/owl#imports> ?import }";
- if let Ok(result) = graph.sparql_select(query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&result) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(result) = graph.sparql_select(query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&result)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let Some(uri) = row["import"].as_str() {
let uri = uri.trim_matches(|c| c == '<' || c == '>');
@@ -465,12 +465,10 @@ async fn main() -> anyhow::Result<()> {
}
}
}
- }
- }
let mut depth = 0;
while !to_import.is_empty() && depth < max_depth {
- let batch = to_import.drain(..).collect::<Vec<_>>();
+ let batch = std::mem::take(&mut to_import);
for url in batch {
if imported.contains(&url) { continue; }
match GraphStore::fetch_url(&url).await {
@@ -643,12 +641,8 @@ async fn main() -> anyhow::Result<()> {
};
// 3. Reason (optional)
- let reason_result = if let Some(ref prof) = profile {
- Some(Reasoner::run(&graph, prof, true)
- .unwrap_or_else(|e| format!(r#"{{"error":"{}"}}"#, e)))
- } else {
- None
- };
+ let reason_result = profile.as_ref().map(|prof| Reasoner::run(&graph, prof, true)
+ .unwrap_or_else(|e| format!(r#"{{"error":"{}"}}"#, e)));
output_json(&serde_json::json!({
"ok": true,
diff --git a/src/monitor.rs b/src/monitor.rs
index e1601a44..545b3964 100644
--- a/src/monitor.rs
+++ b/src/monitor.rs
@@ -173,10 +173,10 @@ impl Monitor {
// Expect a SELECT query returning a ?count binding
match self.graph.sparql_select(query) {
Ok(json) => {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
- if let Some(first) = results.first() {
- if let Some(count_str) = first["count"].as_str() {
+ if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array()
+ && let Some(first) = results.first()
+ && let Some(count_str) = first["count"].as_str() {
// Oxigraph returns literal like "\"1\"^^<http://...>"
let cleaned = count_str
.trim_matches('"')
@@ -186,9 +186,6 @@ impl Monitor {
.trim_matches('"');
return cleaned.parse().unwrap_or(0.0);
}
- }
- }
- }
0.0
}
Err(_) => 0.0,
diff --git a/src/plan.rs b/src/plan.rs
index 5e6c1db1..7ec19e3e 100644
--- a/src/plan.rs
+++ b/src/plan.rs
@@ -233,9 +233,9 @@ impl Planner {
fn extract_iris(&self, store: &GraphStore, query: &str, var: &str) -> HashSet<String> {
let mut set = HashSet::new();
- if let Ok(json) = store.sparql_select(query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(json) = store.sparql_select(query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let Some(iri) = row[var].as_str() {
let iri = iri.trim_matches(|c| c == '<' || c == '>');
@@ -243,8 +243,6 @@ impl Planner {
}
}
}
- }
- }
set
}
@@ -254,11 +252,11 @@ impl Planner {
{{ <{iri}> ?p ?o }} UNION {{ ?s <{iri}> ?o }} UNION {{ ?s ?p <{iri}> }} \
}}"
);
- if let Ok(json) = self.graph.sparql_select(&query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json) {
- if let Some(results) = parsed["results"].as_array() {
- if let Some(first) = results.first() {
- if let Some(count_str) = first["count"].as_str() {
+ if let Ok(json) = self.graph.sparql_select(&query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&json)
+ && let Some(results) = parsed["results"].as_array()
+ && let Some(first) = results.first()
+ && let Some(count_str) = first["count"].as_str() {
let cleaned = count_str
.trim_matches('"')
.split("^^")
@@ -267,10 +265,6 @@ impl Planner {
.trim_matches('"');
return cleaned.parse().unwrap_or(0);
}
- }
- }
- }
- }
0
}
}
diff --git a/src/reason.rs b/src/reason.rs
index 60b38b89..50851685 100644
--- a/src/reason.rs
+++ b/src/reason.rs
@@ -403,11 +403,10 @@ impl Reasoner {
// cls-int: x type ALL members → x type intersection class
for (cls, members) in &intersection_classes {
for &(x, _) in &type_idx {
- if let Some(x_types) = inst_types.get(&x) {
- if members.iter().all(|m| x_types.contains(m)) {
+ if let Some(x_types) = inst_types.get(&x)
+ && members.iter().all(|m| x_types.contains(m)) {
new.push((x, rdf_type, *cls));
}
- }
}
}
diff --git a/src/schema.rs b/src/schema.rs
index 9636364c..549baf0f 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -1,5 +1,4 @@
/// Database schema introspection and OWL generation.
-
pub struct TableInfo {
pub name: String,
pub columns: Vec<ColumnInfo>,
diff --git a/src/server.rs b/src/server.rs
index 24a5d1e7..31ba64fd 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -458,9 +458,9 @@ impl OpenOntologiesServer {
let mut to_import: Vec<String> = Vec::new();
let query = "SELECT ?import WHERE { ?onto <http://www.w3.org/2002/07/owl#imports> ?import }";
- if let Ok(result) = self.graph.sparql_select(query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&result) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(result) = self.graph.sparql_select(query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&result)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let Some(uri) = row["import"].as_str() {
let uri = uri.trim_matches(|c| c == '<' || c == '>');
@@ -468,12 +468,10 @@ impl OpenOntologiesServer {
}
}
}
- }
- }
let mut depth = 0;
while !to_import.is_empty() && depth < max_depth {
- let batch = to_import.drain(..).collect::<Vec<_>>();
+ let batch = std::mem::take(&mut to_import);
for url in batch {
if imported.contains(&url) { continue; }
match GraphStore::fetch_url(&url).await {
@@ -481,9 +479,9 @@ impl OpenOntologiesServer {
match self.graph.load_turtle(&content, None) {
Ok(_count) => {
imported.push(url.clone());
- if let Ok(result) = self.graph.sparql_select(query) {
- if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&result) {
- if let Some(results) = parsed["results"].as_array() {
+ if let Ok(result) = self.graph.sparql_select(query)
+ && let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&result)
+ && let Some(results) = parsed["results"].as_array() {
for row in results {
if let Some(uri) = row["import"].as_str() {
let uri = uri.trim_matches(|c| c == '<' || c == '>').to_string();
@@ -493,8 +491,6 @@ impl OpenOntologiesServer {
}
}
}
- }
- }
}
Err(e) => { imported.push(format!("FAILED:{}: {}", url, e)); }
}
@@ -643,13 +639,11 @@ impl OpenOntologiesServer {
"ontology_properties": prop_iris,
});
- if let Some(ref save_path) = input.save_path {
- if let Ok(json) = serde_json::to_string_pretty(&mapping) {
- if let Err(e) = std::fs::write(save_path, &json) {
+ if let Some(ref save_path) = input.save_path
+ && let Ok(json) = serde_json::to_string_pretty(&mapping)
+ && let Err(e) = std::fs::write(save_path, &json) {
return format!(r#"{{"error":"Cannot write mapping file: {}"}}"#, e);
}
- }
- }
result.to_string()
}
@@ -768,13 +762,12 @@ impl OpenOntologiesServer {
let monitor = self.monitor();
// Add watchers if provided
- if let Some(ref watchers_json) = input.watchers {
- if let Ok(watchers) = serde_json::from_str::<Vec<crate::monitor::Watcher>>(watchers_json) {
+ if let Some(ref watchers_json) = input.watchers
+ && let Ok(watchers) = serde_json::from_str::<Vec<crate::monitor::Watcher>>(watchers_json) {
for w in watchers {
monitor.add_watcher(w);
}
}
- }
let result = monitor.run_watchers();
self.lineage().record(&self.session_id, "M", "monitor", &result.status);
diff --git a/src/tableaux.rs b/src/tableaux.rs
index a160e651..deb78fbf 100644
--- a/src/tableaux.rs
+++ b/src/tableaux.rs
@@ -514,11 +514,10 @@ impl OwlParser {
}
// Blank nodes: check for complex class expressions
- if node.starts_with("_:") {
- if let Some(c) = self.try_parse_complex(node) {
+ if node.starts_with("_:")
+ && let Some(c) = self.try_parse_complex(node) {
return c;
}
- }
// Named class
let id = self.interner.intern(node);
@@ -594,30 +593,25 @@ impl OwlParser {
.index
.object(node, OWL_MIN_QCARD)
.or_else(|| self.index.object(node, OWL_MIN_CARD))
- {
- if let Some(n) = parse_card_value(&val) {
+ && let Some(n) = parse_card_value(&val) {
return RawConcept::MinCard(prop, n, Box::new(filler));
}
- }
// maxQualifiedCardinality / maxCardinality → ≤n R.C
if let Some(val) = self
.index
.object(node, OWL_MAX_QCARD)
.or_else(|| self.index.object(node, OWL_MAX_CARD))
- {
- if let Some(n) = parse_card_value(&val) {
+ && let Some(n) = parse_card_value(&val) {
return RawConcept::MaxCard(prop, n, Box::new(filler));
}
- }
// exactCardinality → ≥n R.C ⊓ ≤n R.C
- if let Some(val) = self.index.object(node, OWL_EXACT_CARD) {
- if let Some(n) = parse_card_value(&val) {
+ if let Some(val) = self.index.object(node, OWL_EXACT_CARD)
+ && let Some(n) = parse_card_value(&val) {
return RawConcept::And(vec![
RawConcept::MinCard(prop, n, Box::new(filler.clone())),
RawConcept::MaxCard(prop, n, Box::new(filler)),
]);
}
- }
RawConcept::Top
}
@@ -625,11 +619,10 @@ impl OwlParser {
/// Parse cardinality value from OWL literal (e.g., "2"^^<xsd:nonNegativeInteger>).
fn parse_card_value(literal: &str) -> Option<u32> {
- if literal.starts_with('"') {
- let rest = &literal[1..];
- if let Some(end) = rest.find('"') {
- return rest[..end].parse().ok();
- }
+ if let Some(rest) = literal.strip_prefix('"')
+ && let Some(end) = rest.find('"')
+ {
+ return rest[..end].parse().ok();
}
literal.parse().ok()
}
@@ -756,31 +749,28 @@ impl TNode {
return true;
}
for label in &self.labels {
- if let Concept::Atom(a) = label {
- if self.labels.contains(&Concept::NegAtom(*a)) {
+ if let Concept::Atom(a) = label
+ && self.labels.contains(&Concept::NegAtom(*a)) {
return true;
}
- }
}
// MinCard/MaxCard direct clash: ≥n1 R.C and ≤n2 R.C with n1 > n2
for label in &self.labels {
if let Concept::MinCard(r1, n1, f1) = label {
for other in &self.labels {
- if let Concept::MaxCard(r2, n2, f2) = other {
- if r1 == r2 && n1 > n2 && (f1 == f2 || **f2 == Concept::Top) {
+ if let Concept::MaxCard(r2, n2, f2) = other
+ && r1 == r2 && n1 > n2 && (f1 == f2 || **f2 == Concept::Top) {
return true;
}
- }
}
}
// Exists(R, C) = ≥1 R.C clashes with MaxCard(R, 0, C/Top)
if let Concept::Exists(r1, f1) = label {
for other in &self.labels {
- if let Concept::MaxCard(r2, n2, f2) = other {
- if r1 == r2 && *n2 == 0 && (f1 == f2 || **f2 == Concept::Top) {
+ if let Concept::MaxCard(r2, n2, f2) = other
+ && r1 == r2 && *n2 == 0 && (f1 == f2 || **f2 == Concept::Top) {
return true;
}
- }
}
}
}
@@ -867,13 +857,12 @@ impl Tableau {
return false;
}
// Trigger concept definitions for atomic labels
- if let Concept::Atom(a) = &concept {
- if let Some(defs) = self.tbox.concept_defs.get(a).cloned() {
+ if let Concept::Atom(a) = &concept
+ && let Some(defs) = self.tbox.concept_defs.get(a).cloned() {
for d in defs {
self.add_label(node_id, d);
}
}
- }
true
}
@@ -897,15 +886,12 @@ impl Tableau {
}
// Inverse: if parent_role has inverse == role, parent is a role-successor
- if let Some(parent_id) = node.parent {
- if let Some(parent_role) = node.parent_role {
- if let Some(&inv_of_parent) = self.tbox.inverse_roles.get(&parent_role) {
- if role == inv_of_parent {
+ if let Some(parent_id) = node.parent
+ && let Some(parent_role) = node.parent_role
+ && let Some(&inv_of_parent) = self.tbox.inverse_roles.get(&parent_role)
+ && role == inv_of_parent {
result.insert(parent_id);
}
- }
- }
- }
result
}
@@ -946,11 +932,10 @@ impl Tableau {
.collect();
for sup_role in super_roles {
for label in &parent_labels {
- if let Concept::ForAll(r, f) = label {
- if *r == sup_role {
+ if let Concept::ForAll(r, f) = label
+ && *r == sup_role {
self.add_label(succ, *f.clone());
}
- }
}
}
@@ -1008,11 +993,10 @@ impl Tableau {
}
let node = self.nodes.get_mut(&nid).unwrap();
for targets in node.edges.values_mut() {
- if targets.remove(&remove_id) {
- if nid != keep_id {
+ if targets.remove(&remove_id)
+ && nid != keep_id {
targets.insert(keep_id);
}
- }
}
// Update parent references
if node.parent == Some(remove_id) {
@@ -1072,7 +1056,7 @@ impl Tableau {
let succs = self.successors(nid, role);
let has_matching =
succs.iter().any(|&s| {
- self.nodes.get(&s).map_or(false, |n| n.labels.contains(&filler))
+ self.nodes.get(&s).is_some_and(|n| n.labels.contains(&filler))
});
if !has_matching {
self.create_successor(nid, role, filler);
@@ -1089,7 +1073,7 @@ impl Tableau {
let matching: usize = succs
.iter()
.filter(|&&s| {
- self.nodes.get(&s).map_or(false, |n| n.labels.contains(&filler))
+ self.nodes.get(&s).is_some_and(|n| n.labels.contains(&filler))
})
.count();
if matching < n {
@@ -1170,7 +1154,7 @@ impl Tableau {
.filter(|&&s| {
self.nodes
.get(&s)
- .map_or(false, |node| node.labels.contains(&filler))
+ .is_some_and(|node| node.labels.contains(&filler))
})
.copied()
.collect();
@@ -1466,7 +1450,7 @@ impl DlReasoner {
let mut pairs: Vec<(u32, u32)> = Vec::new();
for &sub in &satisfiable {
for &sup in &satisfiable {
- if sub != sup && !told.get(&sub).map_or(false, |s| s.contains(&sup)) {
+ if sub != sup && !told.get(&sub).is_some_and(|s| s.contains(&sup)) {
pairs.push((sub, sup));
}
}
@@ -1498,11 +1482,10 @@ impl DlReasoner {
let mut equivalences: Vec<(u32, u32)> = Vec::new();
for (&a, a_supers) in &hierarchy {
for &b in a_supers {
- if a < b {
- if hierarchy.get(&b).map_or(false, |bs| bs.contains(&a)) {
+ if a < b
+ && hierarchy.get(&b).is_some_and(|bs| bs.contains(&a)) {
equivalences.push((a, b));
}
- }
}
}
@@ -1578,11 +1561,10 @@ impl DlReasoner {
for (&ind, &node_id) in &ind_to_node {
if let Some(node) = tableau.nodes.get(&node_id) {
for label in &node.labels {
- if let Concept::Atom(cls) = label {
- if !self.individual_types[&ind].contains(cls) {
+ if let Concept::Atom(cls) = label
+ && !self.individual_types[&ind].contains(cls) {
inferred.entry(ind).or_default().insert(*cls);
}
- }
}
}
}
diff --git a/tools/imgflip/resize.py b/tools/imgflip/resize.py
new file mode 100644
index 00000000..37c8029e
--- /dev/null
+++ b/tools/imgflip/resize.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+"""Resize images to optimal size for Claude vision. Minimal tokens, max understanding."""
+import os
+import sys
+import struct
+import zlib
+from concurrent.futures import ThreadPoolExecutor
+
+MAX_DIM = 256 # Claude understands fine at this size, 4x fewer tokens than 512
+
+
+def read_png_dimensions(path):
+ """Read PNG width/height from header without PIL."""
+ with open(path, "rb") as f:
+ sig = f.read(8)
+ if sig[:4] != b"\x89PNG":
+ return None, None
+ f.read(4) # chunk length
+ f.read(4) # IHDR
+ w = struct.unpack(">I", f.read(4))[0]
+ h = struct.unpack(">I", f.read(4))[0]
+ return w, h
+
+
+def resize_with_sips(src, dst, max_dim):
+ """Use macOS sips (built-in, no dependencies) to resize."""
+ w, h = read_png_dimensions(src)
+ if w and h and max(w, h) <= max_dim:
+ os.link(src, dst) if not os.path.exists(dst) else None
+ return
+ # sips resizes keeping aspect ratio with --resampleHeightWidthMax
+ os.system(f'sips --resampleHeightWidthMax {max_dim} "{src}" --out "{dst}" >/dev/null 2>&1')
+
+
+def process_dir(input_dir, output_dir, max_dim=MAX_DIM):
+ os.makedirs(output_dir, exist_ok=True)
+ images = [
+ f for f in os.listdir(input_dir)
+ if f.lower().endswith((".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp"))
+ ]
+ if not images:
+ print(f"No images found in {input_dir}")
+ return []
+
+ def resize_one(name):
+ src = os.path.join(input_dir, name)
+ dst = os.path.join(output_dir, os.path.splitext(name)[0] + ".png")
+ resize_with_sips(src, dst, max_dim)
+ return dst
+
+ with ThreadPoolExecutor(max_workers=os.cpu_count()) as pool:
+ results = list(pool.map(resize_one, images))
+
+ print(f"Resized {len(results)} images to {output_dir} (max {max_dim}px)")
+ return results
+
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print("Usage: resize.py <input_dir> [output_dir] [max_dim]")
+ sys.exit(1)
+ input_dir = sys.argv[1]
+ output_dir = sys.argv[2] if len(sys.argv) > 2 else os.path.join(input_dir, "resized")
+ max_dim = int(sys.argv[3]) if len(sys.argv) > 3 else MAX_DIM
+ process_dir(input_dir, output_dir, max_dim)