Skip to content

Commit 9a48682

Browse files
committed
Add typed interval_duration
1 parent c907944 commit 9a48682

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

terminusdb_client/woqlquery/woql_query.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,38 @@ def interval_relation(self, relation, x_start, x_end, y_start, y_end):
24382438
self._cursor["y_end"] = self._clean_object(y_end)
24392439
return self
24402440

2441+
def interval_relation_typed(self, relation, x, y):
2442+
"""Allen's Interval Algebra on xdd:dateTimeInterval values.
2443+
2444+
Classifies or validates the temporal relationship between two
2445+
interval values. When relation is ground, validates that the named
2446+
relation holds. When relation is a variable, determines which of the
2447+
13 Allen relations holds (deterministic).
2448+
2449+
Parameters
2450+
----------
2451+
relation : str or dict
2452+
relation name (e.g. "before") or variable for classification
2453+
x : str or dict
2454+
first xdd:dateTimeInterval value
2455+
y : str or dict
2456+
second xdd:dateTimeInterval value
2457+
2458+
Returns
2459+
-------
2460+
WOQLQuery object
2461+
query object that can be chained and/or execute
2462+
"""
2463+
if relation is None or x is None or y is None:
2464+
raise ValueError("IntervalRelationTyped takes three parameters")
2465+
if self._cursor.get("@type"):
2466+
self._wrap_cursor_with_and()
2467+
self._cursor["@type"] = "IntervalRelationTyped"
2468+
self._cursor["relation"] = self._clean_object(relation)
2469+
self._cursor["x"] = self._clean_object(x)
2470+
self._cursor["y"] = self._clean_object(y)
2471+
return self
2472+
24412473
def interval(self, start, end, interval_val):
24422474
"""Constructs or deconstructs a half-open xdd:dateTimeInterval [start, end).
24432475

0 commit comments

Comments
 (0)