From a73f7135c197bc6909194823cd62253b1d473b81 Mon Sep 17 00:00:00 2001 From: Rob Atkinson Date: Wed, 28 Oct 2026 15:51:38 +1100 Subject: [PATCH] Speed up inherited-time check in testRequiredTime Bind ?path (resultTime/phenomenonTime) before matching the collection's triples instead of filtering it afterwards. With ?path unbound, rdflib enumerated every property of the collection (e.g. all geojson:features links) and ran the "nearer collection" NOT EXISTS test for each row before the filter removed them: ~5s per observation on a 1168-feature CSD (40 min for 486 observations), now ~0.03s. VALUES would be simpler but is not allowed in SHACL-SPARQL constraints. Co-Authored-By: Claude Opus 5.5 --- _sources/properties/execution/shapes.shacl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_sources/properties/execution/shapes.shacl b/_sources/properties/execution/shapes.shacl index 0f6cbfff..b9d8c928 100644 --- a/_sources/properties/execution/shapes.shacl +++ b/_sources/properties/execution/shapes.shacl @@ -39,9 +39,12 @@ $this ?path ?time . FILTER(?path IN (sosa:resultTime, sosa:phenomenonTime)) } UNION { + # Binding ?path first (rather than filtering it afterwards) means the costly + # "nearer" test below runs only for time values, not for every property of the + # collection (e.g. all its features). VALUES is not allowed in SHACL-SPARQL. + { BIND(sosa:resultTime AS ?path) } UNION { BIND(sosa:phenomenonTime AS ?path) } ?holder (sosa:hasMember|geojson:features|^sosa:memberOf)+ $this ; ?path ?time . - FILTER(?path IN (sosa:resultTime, sosa:phenomenonTime)) FILTER NOT EXISTS { $this ?path ?own } FILTER NOT EXISTS { ?holder (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?nearer .