Repository navigation
Generate the regular method families of the temporal points from the catalog - #107
Merged
estebanzimanyi merged 1 commit intoOct 31, 2026
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.