Skip to content

Commit 70cb274

Browse files
feat(berlinmod): route the streaming-form spatial predicates through MEOS
Every BerlinMOD-9 × 3-form spatial predicate evaluates through MEOS via the thin MEOSBridge wiring rather than in-binding spatial mathematics: the within-distance predicate builds the vehicle position as a tgeogpoint instant and calls edwithin_tgeo_geo against the query geography in metres on the WGS84 spheroid (the operator MobilityNebula/Queries/Query1.yaml names); region containment calls eintersects_tgeo_geo between the point's tgeompoint instant and the region polygon; pairwise and cumulative distances call geog_distance. MEOSBridge holds no spatial mathematics of its own — it constructs the MEOS temporal instants and geographies and delegates the computation to libmeos, initialising MEOS on the calling task thread. The pure-Java Haversine and SegmentDistance classes are removed.
1 parent c086a78 commit 70cb274

22 files changed

Lines changed: 108 additions & 262 deletions

doc/berlinmod-q3-streaming-forms.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ The `BerlinMODQ3Main` entry point uses:
8989

9090
## Predicate implementation
9191

92-
The scaffold today uses a pure-Java great-circle (Haversine) distance check in
93-
[`Haversine`](../flink-processor/src/main/java/berlinmod/Haversine.java). This
94-
matches the predicate semantics of the MEOS `edwithin_tgeo_geo` operator (the
95-
same call used by `MobilityNebula/Queries/Query1.yaml`), so swapping the
96-
predicate body for a JMEOS-bridged `edwithin_tgeo_geo` call is a one-line
97-
change once the JMEOS surface for that operator is verified — it is marked
98-
`TODO(meos)` in each form's class.
92+
The within-distance predicate evaluates through the MEOS `edwithin_tgeo_geo`
93+
operator — the same call used by `MobilityNebula/Queries/Query1.yaml`. The
94+
vehicle position is built as a `tgeogpoint` instant and tested against the
95+
query geography in metres on the WGS84 spheroid. All spatial predicates route
96+
through [`MEOSBridge`](../flink-processor/src/main/java/berlinmod/MEOSBridge.java),
97+
which holds no spatial mathematics of its own: it constructs the MEOS inputs
98+
(temporal instants and geographies) and delegates the computation to libmeos.
9999

100100
## Companion producer
101101

flink-processor/src/main/java/berlinmod/BerlinMODQ1LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public class BerlinMODQ1LocalTest {
3838
private static final long T0 = 1_735_711_200_000L;
3939

4040
public static void main(String[] args) throws Exception {
41-
System.setProperty("mobilityflink.meos.enabled", "false");
4241
LOG.info("BerlinMODQ1LocalTest starting; window={}s tick={}ms",
4342
WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
4443

flink-processor/src/main/java/berlinmod/BerlinMODQ2LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class BerlinMODQ2LocalTest {
4444
private static final long T0 = 1_735_711_200_000L; // 2025-01-01 06:00:00 UTC
4545

4646
public static void main(String[] args) throws Exception {
47-
System.setProperty("mobilityflink.meos.enabled", "false");
4847
LOG.info("BerlinMODQ2LocalTest starting; X={} window={}s tick={}ms",
4948
TARGET_VEHICLE_ID, WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
5049

flink-processor/src/main/java/berlinmod/BerlinMODQ3LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public class BerlinMODQ3LocalTest {
5555
private static final long T0 = 1_735_711_200_000L; // 2025-01-01 06:00:00 UTC
5656

5757
public static void main(String[] args) throws Exception {
58-
System.setProperty("mobilityflink.meos.enabled", "false");
5958
LOG.info("BerlinMODQ3LocalTest starting; P=({}, {}) radius={}m window={}s tick={}ms",
6059
P_LON, P_LAT, RADIUS_METRES, WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
6160

flink-processor/src/main/java/berlinmod/BerlinMODQ4LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class BerlinMODQ4LocalTest {
6060
private static final long T0 = 1_735_711_200_000L;
6161

6262
public static void main(String[] args) throws Exception {
63-
System.setProperty("mobilityflink.meos.enabled", "false");
6463
LOG.info("BerlinMODQ4LocalTest starting; R=({},{},{},{}) window={}s tick={}ms",
6564
XMIN, YMIN, XMAX, YMAX, WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
6665

flink-processor/src/main/java/berlinmod/BerlinMODQ5LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public class BerlinMODQ5LocalTest {
5252
private static final long T0 = 1_735_711_200_000L;
5353

5454
public static void main(String[] args) throws Exception {
55-
System.setProperty("mobilityflink.meos.enabled", "false");
5655
LOG.info("BerlinMODQ5LocalTest starting; P=({}, {}) dP={}m dMeet={}m",
5756
P_LON, P_LAT, D_P_METRES, D_MEET_METRES);
5857

flink-processor/src/main/java/berlinmod/BerlinMODQ6LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class BerlinMODQ6LocalTest {
6060
private static final double V300_DLON = -200.0 / (111_000.0 * Math.cos(Math.toRadians(50.85)));
6161

6262
public static void main(String[] args) throws Exception {
63-
System.setProperty("mobilityflink.meos.enabled", "false");
6463
LOG.info("BerlinMODQ6LocalTest starting; window={}s tick={}ms",
6564
WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
6665

flink-processor/src/main/java/berlinmod/BerlinMODQ7LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public class BerlinMODQ7LocalTest {
5959
new PointOfInterest(3, 4.2100, 50.7600, 2_000.0));
6060

6161
public static void main(String[] args) throws Exception {
62-
System.setProperty("mobilityflink.meos.enabled", "false");
6362
LOG.info("BerlinMODQ7LocalTest starting; #POIs={} window={}s tick={}ms",
6463
POIS.size(), WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
6564

flink-processor/src/main/java/berlinmod/BerlinMODQ8LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class BerlinMODQ8LocalTest {
5151
private static final long T0 = 1_735_711_200_000L;
5252

5353
public static void main(String[] args) throws Exception {
54-
System.setProperty("mobilityflink.meos.enabled", "false");
5554
LOG.info("BerlinMODQ8LocalTest starting; segment=({},{}) → ({},{}) d={}m",
5655
S1_LON, S1_LAT, S2_LON, S2_LAT, RADIUS_METRES);
5756

flink-processor/src/main/java/berlinmod/BerlinMODQ9LocalTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class BerlinMODQ9LocalTest {
4545
private static final long T0 = 1_735_711_200_000L;
4646

4747
public static void main(String[] args) throws Exception {
48-
System.setProperty("mobilityflink.meos.enabled", "false");
4948
LOG.info("BerlinMODQ9LocalTest starting; X={} Y={} window={}s tick={}ms",
5049
X_VEHICLE_ID, Y_VEHICLE_ID, WINDOW_SIZE_SECONDS, SNAPSHOT_TICK_MILLIS);
5150

0 commit comments

Comments
 (0)