Skip to content

Generate the regular method families of the temporal points from the catalog - #107

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:refactor/oo-codegen-tpoint
Oct 31, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:refactor/oo-codegen-tpoint

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

tools/oo_codegen/codegen.py writes the comparisons, the spatial
relationships, the distances and the restrictions of TGeomPoint and
TGeogPoint as the mixins pymeos/main/generated/tgeompoint_methods.py and
tgeogpoint_methods.py, each the first base of its class. A class answers a
member with the overload whose catalog sqlSignatures take its SQL type as
first operand, tgeompoint or tgeogpoint, from the tpoint
* and tgeo_*
functions of the member, so each class carries the surface MobilityDB
declares for its type: a temporal point has no containment and no
covering, a temporal geography point has no touches, and its disjoint and
intersects take another temporal geography point. A geometry argument of a
temporal geography point converts as a geography, an STBox reaches a
temporal point through at, minus and nearest_approach_distance, the
functions MEOS defines for it, and a temporal point restricts to an
elevation span through tpoint_at_elevation and tpoint_minus_elevation.
Temporal.at and Temporal.minus restrict to a set through temporal_at_values
and temporal_minus_values.

The generator passes True for a trailing spheroid parameter, the default
of the SQL function, and orders the dispatch so that a point argument
reaches atValue before atGeometry.

Witness: against PyMEOS master 84dd465,
TGeomPointSeq('[Point(1 1 1)@2001-01-01, Point(1 1
3)@2001-01-03]').at(FloatSpan('[1.5, 2]')) raises TypeError and
TGeomPointSeq('[Point(1 1)@2001-01-01, Point(2 2)@2001-01-02]').ever_touches(Point(1,
1)) answers False where eTouches(tgeompoint, geometry), the function
etouches_tpoint_geo, answers true; against this branch the first answers
{[POINT Z (1 1 1.5)@2001-01-01 12:00:00+00, POINT Z (1 1 2)@2001-01-02
00:00:00+00]} and the second True.

Measured: on the catalog of MobilityDB a8e931bf50, 5446 functions
accounted for; TGeomPoint's mixin holds 24 methods and TGeogPoint's 21, in
place of 27 hand-written methods of TPoint, TGeomPoint and TGeogPoint; a
second generator run rewrites the six mixins byte for byte; 4859 tests, 8
of them the elevation and set restrictions and the absent containment,
covering and geography touches; ruff check and ruff format report no
finding.

Why: the bindings are projections of the MEOS catalog, so the methods of
a temporal point are the functions the catalog declares for its SQL type.

…catalog

tools/oo_codegen/codegen.py writes the comparisons, the spatial
relationships, the distances and the restrictions of TGeomPoint and
TGeogPoint as the mixins pymeos/main/_generated/tgeompoint_methods.py and
tgeogpoint_methods.py, each the first base of its class. A class answers a
member with the overload whose catalog sqlSignatures take its SQL type as
first operand, tgeompoint or tgeogpoint, from the tpoint_* and tgeo_*
functions of the member, so each class carries the surface MobilityDB
declares for its type: a temporal point has no containment and no
covering, a temporal geography point has no touches, and its disjoint and
intersects take another temporal geography point. A geometry argument of a
temporal geography point converts as a geography, an STBox reaches a
temporal point through at, minus and nearest_approach_distance, the
functions MEOS defines for it, and a temporal point restricts to an
elevation span through tpoint_at_elevation and tpoint_minus_elevation.
Temporal.at and Temporal.minus restrict to a set through temporal_at_values
and temporal_minus_values.

The generator passes True for a trailing spheroid parameter, the default
of the SQL function, and orders the dispatch so that a point argument
reaches atValue before atGeometry.

Witness: against PyMEOS master 84dd465,
TGeomPointSeq('[Point(1 1 1)@2001-01-01, Point(1 1
3)@2001-01-03]').at(FloatSpan('[1.5, 2]')) raises TypeError and
TGeomPointSeq('[Point(1 1)@2001-01-01, Point(2 2)@2001-01-02]').ever_touches(Point(1,
1)) answers False where eTouches(tgeompoint, geometry), the function
etouches_tpoint_geo, answers true; against this branch the first answers
{[POINT Z (1 1 1.5)@2001-01-01 12:00:00+00, POINT Z (1 1 2)@2001-01-02
00:00:00+00]} and the second True.

Measured: on the catalog of MobilityDB a8e931bf50, 5446 functions
accounted for; TGeomPoint's mixin holds 24 methods and TGeogPoint's 21, in
place of 27 hand-written methods of TPoint, TGeomPoint and TGeogPoint; a
second generator run rewrites the six mixins byte for byte; 4859 tests, 8
of them the elevation and set restrictions and the absent containment,
covering and geography touches; ruff check and ruff format report no
finding.

Why: the bindings are projections of the MEOS catalog, so the methods of
a temporal point are the functions the catalog declares for its SQL type.
@estebanzimanyi
estebanzimanyi merged commit 9397400 into MobilityDB:master Oct 31, 2026
8 checks passed
@estebanzimanyi
estebanzimanyi deleted the refactor/oo-codegen-tpoint branch October 31, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant