From 47447a73526c7fba8e48b9f83b9a9ebbcde0f736 Mon Sep 17 00:00:00 2001 From: recalcitrantsupplant Date: Wed, 4 Dec 2024 17:01:30 +1000 Subject: [PATCH] fix: remove use of JSON LD from CQL JSON parsing --- prez/dependencies.py | 17 +-- prez/examples/cql/geo_contains_inverse.json | 4 +- prez/examples/cql/geo_crosses.json | 38 ++----- prez/repositories/base.py | 19 ++-- prez/services/query_generation/cql.py | 105 ++++++++---------- .../additional_temporal_disjoint_instant.rq | 4 +- .../additional_temporal_during_intervals.rq | 8 +- .../expected_generated_queries/clause7_12.rq | 4 +- .../expected_generated_queries/clause7_13.rq | 8 +- .../expected_generated_queries/example20.rq | 4 +- .../expected_generated_queries/example21.rq | 4 +- .../expected_generated_queries/example22.rq | 8 +- .../expected_generated_queries/example27.rq | 4 +- .../expected_generated_queries/example53.rq | 4 +- .../expected_generated_queries/example54.rq | 4 +- .../expected_generated_queries/example55.rq | 8 +- .../expected_generated_queries/example56.rq | 8 +- .../expected_generated_queries/example57.rq | 8 +- .../expected_generated_queries/example58.rq | 4 +- .../expected_generated_queries/example59.rq | 8 +- .../expected_generated_queries/example60.rq | 8 +- .../expected_generated_queries/example61.rq | 8 +- .../expected_generated_queries/example62.rq | 8 +- .../expected_generated_queries/example63.rq | 8 +- .../expected_generated_queries/example64.rq | 8 +- .../expected_generated_queries/example65.rq | 8 +- .../expected_generated_queries/example66.rq | 8 +- .../expected_generated_queries/example67.rq | 8 +- .../additional_temporal_disjoint_instant.json | 2 +- .../additional_temporal_during_intervals.json | 2 +- ...dditional_temporal_intersects_instant.json | 2 +- test_data/cql/input/clause6_01.json | 2 +- test_data/cql/input/clause6_02a.json | 2 +- test_data/cql/input/clause6_02b.json | 2 +- test_data/cql/input/clause6_02d.json | 2 +- test_data/cql/input/clause6_03.json | 2 +- test_data/cql/input/clause7_03a.json | 2 +- test_data/cql/input/clause7_03b.json | 2 +- test_data/cql/input/clause7_05.json | 2 +- test_data/cql/input/clause7_12.json | 2 +- test_data/cql/input/clause7_13.json | 2 +- test_data/cql/input/clause7_18.json | 4 +- test_data/cql/input/clause7_19.json | 4 +- test_data/cql/input/example07.json | 2 +- test_data/cql/input/example09.json | 2 +- test_data/cql/input/example10.json | 2 +- test_data/cql/input/example11.json | 2 +- test_data/cql/input/example12.json | 2 +- test_data/cql/input/example13.json | 2 +- test_data/cql/input/example14.json | 2 +- test_data/cql/input/example15.json | 4 +- test_data/cql/input/example16.json | 8 +- test_data/cql/input/example17.json | 6 +- test_data/cql/input/example18.json | 4 +- test_data/cql/input/example19.json | 6 +- test_data/cql/input/example20.json | 2 +- test_data/cql/input/example21.json | 2 +- test_data/cql/input/example22.json | 2 +- test_data/cql/input/example23.json | 2 +- test_data/cql/input/example24.json | 2 +- test_data/cql/input/example25.json | 2 +- test_data/cql/input/example26.json | 2 +- test_data/cql/input/example27.json | 2 +- test_data/cql/input/example29.json | 2 +- test_data/cql/input/example30.json | 2 +- test_data/cql/input/example31.json | 2 +- test_data/cql/input/example32.json | 2 +- test_data/cql/input/example33.json | 2 +- test_data/cql/input/example34.json | 2 +- test_data/cql/input/example35.json | 2 +- test_data/cql/input/example36.json | 2 +- test_data/cql/input/example37.json | 2 +- test_data/cql/input/example38.json | 2 +- test_data/cql/input/example39.json | 2 +- test_data/cql/input/example40.json | 2 +- test_data/cql/input/example41.json | 2 +- test_data/cql/input/example42.json | 2 +- test_data/cql/input/example43.json | 4 +- test_data/cql/input/example44.json | 4 +- test_data/cql/input/example53.json | 2 +- test_data/cql/input/example54.json | 2 +- test_data/cql/input/example55.json | 2 +- test_data/cql/input/example56.json | 2 +- test_data/cql/input/example57.json | 2 +- test_data/cql/input/example58.json | 2 +- test_data/cql/input/example59.json | 2 +- test_data/cql/input/example60.json | 2 +- test_data/cql/input/example61.json | 2 +- test_data/cql/input/example62.json | 2 +- test_data/cql/input/example63.json | 2 +- test_data/cql/input/example64.json | 2 +- test_data/cql/input/example65.json | 2 +- test_data/cql/input/example66.json | 2 +- test_data/cql/input/example67.json | 2 +- test_data/cql/input/example70.json | 2 +- test_data/cql/input/example71.json | 2 +- test_data/cql/input/example72.json | 2 +- test_data/cql/input/example73.json | 4 +- test_data/cql/input/example74.json | 2 +- test_data/cql/input/example75.json | 4 +- test_data/cql/input/example76.json | 4 +- test_data/cql/input/example77.json | 2 +- test_data/cql/input/example78.json | 2 +- test_data/cql/input/example79.json | 2 +- test_data/cql/input/example80.json | 2 +- test_data/cql/input/example81.json | 2 +- test_data/cql/input/example82.json | 2 +- test_data/cql/input/example85.json | 2 +- test_data/cql/input/example86.json | 2 +- tests/{_test_cql.py => test_cql.py} | 18 ++- tests/test_cql_time.py | 8 +- 111 files changed, 264 insertions(+), 291 deletions(-) rename tests/{_test_cql.py => test_cql.py} (81%) diff --git a/prez/dependencies.py b/prez/dependencies.py index e719eb32..459068b9 100755 --- a/prez/dependencies.py +++ b/prez/dependencies.py @@ -150,11 +150,8 @@ async def cql_post_parser_dependency( ) -> CQLParser: try: body = await request.json() - context = json.load( - (Path(__file__).parent / "reference_data/cql/default_context.json").open() - ) cql_parser = CQLParser( - cql=body, context=context, queryable_props=queryable_props + cql=body, queryable_props=queryable_props ) cql_parser.generate_jsonld() cql_parser.parse() @@ -175,16 +172,14 @@ async def cql_get_parser_dependency( try: crs = query_params.filter_crs query = json.loads(query_params.filter) - context = json.load( - ( - Path(__file__).parent / "reference_data/cql/default_context.json" - ).open() - ) cql_parser = CQLParser( - cql=query, context=context, crs=crs, queryable_props=queryable_props + cql=query, crs=crs, queryable_props=queryable_props ) cql_parser.generate_jsonld() - cql_parser.parse() + try: + cql_parser.parse() + except Exception as e: + raise e return cql_parser except json.JSONDecodeError: raise HTTPException(status_code=400, detail="Invalid JSON format.") diff --git a/prez/examples/cql/geo_contains_inverse.json b/prez/examples/cql/geo_contains_inverse.json index 5354484f..a6125c83 100644 --- a/prez/examples/cql/geo_contains_inverse.json +++ b/prez/examples/cql/geo_contains_inverse.json @@ -52,9 +52,9 @@ "op": "=", "args": [ { - "property": "^http://www.w3.org/2000/01/rdf-schema#member" + "property": "http://www.w3.org/2000/01/rdf-schema#member" }, - { "@id": "http://example.com/datasets/sandgate/facilities" } + "http://example.com/datasets/sandgate/facilities" ] } ] diff --git a/prez/examples/cql/geo_crosses.json b/prez/examples/cql/geo_crosses.json index 51ed1707..af434070 100644 --- a/prez/examples/cql/geo_crosses.json +++ b/prez/examples/cql/geo_crosses.json @@ -1,35 +1,17 @@ { "op": "s_crosses", "args": [ - { - "property": "geometry" - }, + { "property": "geometry" }, { "type": "LineString", - "coordinates": [ - [ - [ - 153.06307, - -27.3151243 - ], - [ - 153.069877, - -27.3151243 - ], - [ - 153.069877, - -27.2859541 - ], - [ - 153.06307, - -27.2859541 - ], - [ - 153.06307, - -27.3151243 - ] - ] - ] + "coordinates": [ [ 172.03086, 1.5 ], + [ 1.1, -90.0 ], + [ -159.757695, 0.99999 ], + [ -180.0, 0.5 ], + [ -12.111235, 81.336403 ], + [ -0.5, 64.43958 ], + [ 0.0, 81.991815 ], + [ -155.93831, 90.0 ] ] } ] -} \ No newline at end of file +} diff --git a/prez/repositories/base.py b/prez/repositories/base.py index 277c3b7f..79d38e01 100755 --- a/prez/repositories/base.py +++ b/prez/repositories/base.py @@ -27,14 +27,17 @@ async def send_queries( tabular_queries: List[Tuple[URIRef | None, str]] = None, ) -> Tuple[Graph, List]: # Common logic to send both query types in parallel - results = await asyncio.gather( - *[self.rdf_query_to_graph(query) for query in rdf_queries if query], - *[ - self.tabular_query_to_table(query, context) - for context, query in tabular_queries - if query - ], - ) + try: + results = await asyncio.gather( + *[self.rdf_query_to_graph(query) for query in rdf_queries if query], + *[ + self.tabular_query_to_table(query, context) + for context, query in tabular_queries + if query + ], + ) + except Exception as e: + print(e) g = Graph(namespace_manager=prefix_graph.namespace_manager) tabular_results = [] for result in results: diff --git a/prez/services/query_generation/cql.py b/prez/services/query_generation/cql.py index 61c40284..0087c372 100755 --- a/prez/services/query_generation/cql.py +++ b/prez/services/query_generation/cql.py @@ -89,7 +89,6 @@ class CQLParser: def __init__( self, cql=None, - context: dict = None, cql_json: dict = None, crs=None, queryable_props=None, @@ -98,7 +97,6 @@ def __init__( self.inner_select_gpnt_list = None self.inner_select_vars: list[Var] = [] self.cql: dict = cql - self.context = context self.cql_json = cql_json self.var_counter = 0 self.query_object = None @@ -110,8 +108,7 @@ def __init__( self.queryable_props = queryable_props def generate_jsonld(self): - combined = {"@context": self.context, **self.cql} - self.cql_json = jsonld.expand(combined, options={"base": "h"})[0] + self.cql_json = self.cql def parse(self): root = self.cql_json @@ -142,8 +139,8 @@ def parse(self): def parse_logical_operators( self, element, existing_ggps=None ) -> Generator[GroupGraphPatternSub, None, None]: - operator = element.get(str(CQL.operator))[0].get("@value") - args = element.get(str(CQL.args)) + operator = element.get("op") + args = element.get("args") ggps = existing_ggps if existing_ggps is not None else GroupGraphPatternSub() @@ -208,11 +205,11 @@ def _add_triple(self, ggps, subject, predicate, object): def _handle_comparison(self, operator, args, existing_ggps=None): ggps, object = self._add_tss_tssp(args, existing_ggps) - val = args[1].get("@value") + val = args[1] if not val: # then should be an IRI - val = args[1].get("@id") + val = args[1] value = IRI(value=val) - elif val.startswith("http"): # hack + elif isinstance(val, str) and val.startswith("http"): # hack value = IRI(value=val) elif isinstance(val, str): # literal string value = RDFLiteral(value=val) @@ -240,7 +237,7 @@ def _handle_comparison(self, operator, args, existing_ggps=None): def _add_tss_tssp(self, args, existing_ggps): self.var_counter += 1 ggps = existing_ggps if existing_ggps is not None else GroupGraphPatternSub() - prop = args[0].get(str(CQL.property))[0].get("@id") + prop = args[0].get("property") if prop in self.queryable_props: object = self._handle_shacl_defined_prop(prop) else: @@ -255,7 +252,6 @@ def _handle_like(self, args, existing_ggps=None): value = ( args[1] - .get("@value") .replace("%", ".*") .replace("_", ".") .replace("\\", "\\\\") @@ -286,16 +282,16 @@ def _handle_spatial(self, operator, args, existing_ggps=None): self.var_counter += 1 ggps = existing_ggps if existing_ggps is not None else GroupGraphPatternSub() - coordinates_list = args[1].get("http://example.com/vocab/coordinates") - coordinates, geom_type = self._extract_spatial_info(coordinates_list, args) - if geom_type in ["Polygon", "MultiPolygon"]: - coordinates = [coordinates] + coordinates = args[1].get("coordinates") + geom_type = args[1].get("type") + if args[1].get("bbox"): + geom_type = "Polygon" if coordinates: wkt = get_wkt_from_coords(coordinates, geom_type) wkt_with_crs = f"<{self.crs}> {wkt}" - prop = args[0].get(str(CQL.property))[0].get("@id") - if prop == "http://example.com/geometry": + prop = args[0].get("property") + if prop == "geometry": subject = Var(value="focus_node") else: subject = IRI(value=prop) @@ -327,11 +323,17 @@ def _handle_spatial(self, operator, args, existing_ggps=None): def _handle_in(self, args, existing_ggps=None): ggps, object = self._add_tss_tssp(args, existing_ggps) - literal_values = [item["@value"] for item in args if "@value" in item] - uri_values = [item["@id"] for item in args if "@id" in item] - for i, lit_val in enumerate(literal_values): - if lit_val.startswith("http"): # hack - uri_values.append(literal_values.pop(i)) + uri_values = [] + literal_values = [] + numeric_values = [] + for arg in args[1]: + if isinstance(arg, str) and arg.startswith("http"): + uri_values.append(arg) + elif isinstance(arg, (int, float)): + numeric_values.append(arg) + else: + literal_values.append(arg) + grammar_uri_values = [IRI(value=URIRef(value)) for value in uri_values] grammar_literal_values = [] for val in literal_values: @@ -367,15 +369,16 @@ def _extract_spatial_info(self, coordinates_list, args): coordinates = [] geom_type = None if coordinates_list: - coordinates = [ - [coordinates_list[i]["@value"], coordinates_list[i + 1]["@value"]] - for i in range(0, len(coordinates_list), 2) - ] - geom_type = args[1]["http://www.opengis.net/ont/sf#type"][0]["@value"] - bbox_list = args[1].get("http://example.com/vocab/bbox") + # coordinates = [ + # [coordinates_list[i], coordinates_list[i + 1]] + # for i in range(0, len(coordinates_list), 2) + # ] + coordinates = coordinates_list + geom_type = args[1].get("type") + bbox_list = args[1].get("bbox") if bbox_list: geom_type = "Polygon" - bbox_values = [item["@value"] for item in bbox_list] + bbox_values = [item for item in bbox_list] coordinates = format_coordinates_as_wkt(bbox_values, coordinates) return coordinates, geom_type @@ -390,35 +393,34 @@ def _handle_temporal(self, comp_func, args, existing_ggps=None): operands = {} for i, arg in enumerate(args, start=1): # check if the arg is an interval - interval_list = arg.get(str(CQL.interval)) + interval_list = arg.get("interval") if interval_list: for n, item in enumerate(interval_list): label = "start" if n == 0 else "end" - prop = item.get(str(CQL.property)) - if prop: - self._triple_for_time_prop(ggps, i, label, prop, operands) - date_val = item.get("@value") - if date_val: - self._dt_to_rdf_literal(i, date_val, label, operands) + if isinstance(item, dict): + prop = item.get("property") + if prop: + self._triple_for_time_prop(ggps, i, label, prop, operands) + elif isinstance(item, str): + self._dt_to_rdf_literal(i, item, label, operands) continue # handle instants - prop and date label = "instant" # check if the arg is a property - prop = arg.get(str(CQL.property)) + prop = arg.get("property") if prop: self._triple_for_time_prop(ggps, i, label, prop, operands) continue # check if the arg is a date date = ( - arg.get(str(CQL.date)) - or arg.get(str(CQL.datetime)) - or arg.get(str(CQL.timestamp)) + arg.get("date") + or arg.get("datetime") + or arg.get("timestamp") ) if date: - date_val = date[0].get("@value") - self._dt_to_rdf_literal(i, date_val, label, operands) + self._dt_to_rdf_literal(i, date, label, operands) gpnt = self.process_temporal_function(comp_func, operands) @@ -479,28 +481,11 @@ def process_temporal_function(self, comp_func, operands): ) def _triple_for_time_prop(self, ggps, i, label, prop, operands): - prop_uri = prop[0].get("@id") - value = IRI(value=prop_uri) + value = IRI(value=prop) var = Var(value=f"dt_{i}_{label}") operands[f"t{i}_{label}"] = var self._add_triple(ggps, Var(value="focus_node"), value, var) - def _handle_interval_list(self, all_args, comparator_args, interval_list): - for item in interval_list: - if item.get(str(CQL.property)): - prop = item.get(str(CQL.property))[0].get("@id") - comparator_args.append(IRI(value=prop)) - elif item.get("@value"): - val = item.get("@value") - # self._dt_to_rdf_literal(comparator_args, val) - dt, _ = parse_datetime(val) - comparator_args.append( - RDFLiteral( - value=dt.isoformat(), - datatype=IRI(value="http://www.w3.org/2001/XMLSchema#dateTime"), - ) - ) - all_args.append(comparator_args) def _dt_to_rdf_literal(self, i, dt_str, label, operands): if dt_str == "..": diff --git a/test_data/cql/expected_generated_queries/additional_temporal_disjoint_instant.rq b/test_data/cql/expected_generated_queries/additional_temporal_disjoint_instant.rq index 3f61c22d..ad3169be 100644 --- a/test_data/cql/expected_generated_queries/additional_temporal_disjoint_instant.rq +++ b/test_data/cql/expected_generated_queries/additional_temporal_disjoint_instant.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (?dt_1_instant > "2012-08-10T05:30:00+00:00"^^ || ?dt_1_instant < "2012-08-10T05:30:00+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/additional_temporal_during_intervals.rq b/test_data/cql/expected_generated_queries/additional_temporal_during_intervals.rq index c3d32c5d..35cd886d 100644 --- a/test_data/cql/expected_generated_queries/additional_temporal_during_intervals.rq +++ b/test_data/cql/expected_generated_queries/additional_temporal_during_intervals.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start > "2017-06-10T07:30:00+00:00"^^ && ?dt_1_end < "2017-06-11T10:30:00+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/clause7_12.rq b/test_data/cql/expected_generated_queries/clause7_12.rq index dd4a5abe..425fdb41 100644 --- a/test_data/cql/expected_generated_queries/clause7_12.rq +++ b/test_data/cql/expected_generated_queries/clause7_12.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (! (?dt_1_instant > "1969-07-24T16:50:35+00:00"^^ || ?dt_1_instant < "1969-07-16T05:32:00+00:00"^^)) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/clause7_13.rq b/test_data/cql/expected_generated_queries/clause7_13.rq index a1ce5696..4bd453cb 100644 --- a/test_data/cql/expected_generated_queries/clause7_13.rq +++ b/test_data/cql/expected_generated_queries/clause7_13.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start > "1969-07-16T13:32:00+00:00"^^ && ?dt_1_end < "1969-07-24T16:50:35+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example20.rq b/test_data/cql/expected_generated_queries/example20.rq index ce6a0ae3..cf5bbe28 100644 --- a/test_data/cql/expected_generated_queries/example20.rq +++ b/test_data/cql/expected_generated_queries/example20.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (?dt_1_instant < "2015-01-01T00:00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example21.rq b/test_data/cql/expected_generated_queries/example21.rq index 1ef93f98..28fb1acb 100644 --- a/test_data/cql/expected_generated_queries/example21.rq +++ b/test_data/cql/expected_generated_queries/example21.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (?dt_1_instant > "2012-06-05T00:00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example22.rq b/test_data/cql/expected_generated_queries/example22.rq index c3d32c5d..35cd886d 100644 --- a/test_data/cql/expected_generated_queries/example22.rq +++ b/test_data/cql/expected_generated_queries/example22.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start > "2017-06-10T07:30:00+00:00"^^ && ?dt_1_end < "2017-06-11T10:30:00+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example27.rq b/test_data/cql/expected_generated_queries/example27.rq index 373d83d4..31ec4834 100644 --- a/test_data/cql/expected_generated_queries/example27.rq +++ b/test_data/cql/expected_generated_queries/example27.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?datetime +?focus_node ?datetime } WHERE { -?focus_node ?datetime +?focus_node ?datetime FILTER (?datetime > "2012-06-05T00:00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example53.rq b/test_data/cql/expected_generated_queries/example53.rq index 4f1ae886..60e13b62 100644 --- a/test_data/cql/expected_generated_queries/example53.rq +++ b/test_data/cql/expected_generated_queries/example53.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (?dt_1_instant > "2010-02-10T00:00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example54.rq b/test_data/cql/expected_generated_queries/example54.rq index 8d1ae435..ac0d1e3f 100644 --- a/test_data/cql/expected_generated_queries/example54.rq +++ b/test_data/cql/expected_generated_queries/example54.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (?dt_1_instant < "2012-08-10T05:30:00+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example55.rq b/test_data/cql/expected_generated_queries/example55.rq index 1c71d701..6b1565a7 100644 --- a/test_data/cql/expected_generated_queries/example55.rq +++ b/test_data/cql/expected_generated_queries/example55.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start } WHERE { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start FILTER ("2000-01-01T00:00:00+00:00"^^ < ?dt_2_start && "2005-01-10T01:01:01.393216+00:00"^^ > ?dt_2_end) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example56.rq b/test_data/cql/expected_generated_queries/example56.rq index 4cf45fcc..ad1c2bb2 100644 --- a/test_data/cql/expected_generated_queries/example56.rq +++ b/test_data/cql/expected_generated_queries/example56.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start } WHERE { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start FILTER ("2005-01-10T01:01:01.393216+00:00"^^ < ?dt_2_start) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example57.rq b/test_data/cql/expected_generated_queries/example57.rq index 1e25ab9c..86309223 100644 --- a/test_data/cql/expected_generated_queries/example57.rq +++ b/test_data/cql/expected_generated_queries/example57.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start > "2005-01-10T00:00:00"^^ && ?dt_1_end < "2010-02-10T00:00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example58.rq b/test_data/cql/expected_generated_queries/example58.rq index f12a8efc..81b2ee4b 100644 --- a/test_data/cql/expected_generated_queries/example58.rq +++ b/test_data/cql/expected_generated_queries/example58.rq @@ -1,7 +1,7 @@ CONSTRUCT { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant } WHERE { -?focus_node ?dt_1_instant +?focus_node ?dt_1_instant FILTER (?dt_1_instant = "1851-04-29T00:00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example59.rq b/test_data/cql/expected_generated_queries/example59.rq index 0990ae97..eb980098 100644 --- a/test_data/cql/expected_generated_queries/example59.rq +++ b/test_data/cql/expected_generated_queries/example59.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start < "1991-10-07T08:21:06.393262+00:00"^^ && ?dt_1_end = "2010-02-10T05:29:20.073225+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example60.rq b/test_data/cql/expected_generated_queries/example60.rq index e601b608..d14c33bc 100644 --- a/test_data/cql/expected_generated_queries/example60.rq +++ b/test_data/cql/expected_generated_queries/example60.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start > "1991-10-07T00:00:00"^^ && ?dt_1_end = "2010-02-10T05:29:20.073225+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example61.rq b/test_data/cql/expected_generated_queries/example61.rq index e8ff1c78..609bff5c 100644 --- a/test_data/cql/expected_generated_queries/example61.rq +++ b/test_data/cql/expected_generated_queries/example61.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (! (?dt_1_end < "1991-10-07T08:21:06.393262+00:00"^^ || ?dt_1_start > "2010-02-10T05:29:20.073225+00:00"^^)) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example62.rq b/test_data/cql/expected_generated_queries/example62.rq index f9fb02ce..0550b0bb 100644 --- a/test_data/cql/expected_generated_queries/example62.rq +++ b/test_data/cql/expected_generated_queries/example62.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start } WHERE { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start FILTER ("2010-02-10T00:00:00"^^ = ?dt_2_start) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example63.rq b/test_data/cql/expected_generated_queries/example63.rq index 0fd6c765..e131d557 100644 --- a/test_data/cql/expected_generated_queries/example63.rq +++ b/test_data/cql/expected_generated_queries/example63.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start } WHERE { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start FILTER ("2010-02-10T05:29:20.073225+00:00"^^ = ?dt_2_end) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example64.rq b/test_data/cql/expected_generated_queries/example64.rq index d709e1bb..76aadcdb 100644 --- a/test_data/cql/expected_generated_queries/example64.rq +++ b/test_data/cql/expected_generated_queries/example64.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start } WHERE { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start FILTER ("1991-10-07T08:21:06.393262+00:00"^^ > ?dt_2_start && "1991-10-07T08:21:06.393262+00:00"^^ < ?dt_2_end && "2010-02-10T05:29:20.073225+00:00"^^ > ?dt_2_end) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example65.rq b/test_data/cql/expected_generated_queries/example65.rq index 5801e893..17284cd7 100644 --- a/test_data/cql/expected_generated_queries/example65.rq +++ b/test_data/cql/expected_generated_queries/example65.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start < "1991-10-07T08:21:06.393262+00:00"^^ && ?dt_1_end > "1991-10-07T08:21:06.393262+00:00"^^ && ?dt_1_end < "1992-10-09T08:08:08.393473+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example66.rq b/test_data/cql/expected_generated_queries/example66.rq index b5d0c198..fb81acad 100644 --- a/test_data/cql/expected_generated_queries/example66.rq +++ b/test_data/cql/expected_generated_queries/example66.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start } WHERE { -?focus_node ?dt_2_end . -?focus_node ?dt_2_start +?focus_node ?dt_2_end . +?focus_node ?dt_2_start FILTER ("1991-10-07T08:21:06.393262+00:00"^^ = ?dt_2_start && "2010-02-10T05:29:20.073225+00:00"^^ > ?dt_2_end) } \ No newline at end of file diff --git a/test_data/cql/expected_generated_queries/example67.rq b/test_data/cql/expected_generated_queries/example67.rq index eca86355..914ca2fb 100644 --- a/test_data/cql/expected_generated_queries/example67.rq +++ b/test_data/cql/expected_generated_queries/example67.rq @@ -1,10 +1,10 @@ CONSTRUCT { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start } WHERE { -?focus_node ?dt_1_end . -?focus_node ?dt_1_start +?focus_node ?dt_1_end . +?focus_node ?dt_1_start FILTER (?dt_1_start = "1991-10-07T08:21:06.393262+00:00"^^) } \ No newline at end of file diff --git a/test_data/cql/input/additional_temporal_disjoint_instant.json b/test_data/cql/input/additional_temporal_disjoint_instant.json index b3e0c8fb..8197917e 100644 --- a/test_data/cql/input/additional_temporal_disjoint_instant.json +++ b/test_data/cql/input/additional_temporal_disjoint_instant.json @@ -1,7 +1,7 @@ { "op": "t_disjoint", "args": [ - { "property": "updated_at" }, + { "property": "ex:updated_at" }, { "timestamp": "2012-08-10T05:30:00Z" } ] } diff --git a/test_data/cql/input/additional_temporal_during_intervals.json b/test_data/cql/input/additional_temporal_during_intervals.json index 34033d15..66b0cc52 100644 --- a/test_data/cql/input/additional_temporal_during_intervals.json +++ b/test_data/cql/input/additional_temporal_during_intervals.json @@ -1,7 +1,7 @@ { "op": "t_during", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "2017-06-10T07:30:00Z", "2017-06-11T10:30:00Z" ] } ] } diff --git a/test_data/cql/input/additional_temporal_intersects_instant.json b/test_data/cql/input/additional_temporal_intersects_instant.json index b3e0c8fb..8197917e 100644 --- a/test_data/cql/input/additional_temporal_intersects_instant.json +++ b/test_data/cql/input/additional_temporal_intersects_instant.json @@ -1,7 +1,7 @@ { "op": "t_disjoint", "args": [ - { "property": "updated_at" }, + { "property": "ex:updated_at" }, { "timestamp": "2012-08-10T05:30:00Z" } ] } diff --git a/test_data/cql/input/clause6_01.json b/test_data/cql/input/clause6_01.json index ca73c3d2..59061b80 100644 --- a/test_data/cql/input/clause6_01.json +++ b/test_data/cql/input/clause6_01.json @@ -1 +1 @@ -{ "op": "avg", "args": [ { "property": "windSpeed" } ] } +{ "op": "avg", "args": [ { "property": "ex:windSpeed" } ] } diff --git a/test_data/cql/input/clause6_02a.json b/test_data/cql/input/clause6_02a.json index f72df612..1de9d93c 100644 --- a/test_data/cql/input/clause6_02a.json +++ b/test_data/cql/input/clause6_02a.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "property": "city" }, + { "property": "ex:city" }, "Toronto" ] } diff --git a/test_data/cql/input/clause6_02b.json b/test_data/cql/input/clause6_02b.json index afcfda5f..aed624cd 100644 --- a/test_data/cql/input/clause6_02b.json +++ b/test_data/cql/input/clause6_02b.json @@ -3,7 +3,7 @@ "args": [ { "op": "avg", - "args": [ { "property": "windSpeed" } ] + "args": [ { "property": "ex:windSpeed" } ] }, 4 ] diff --git a/test_data/cql/input/clause6_02d.json b/test_data/cql/input/clause6_02d.json index 965a47a1..8fa944ef 100644 --- a/test_data/cql/input/clause6_02d.json +++ b/test_data/cql/input/clause6_02d.json @@ -1,7 +1,7 @@ { "op": ">=", "args": [ - { "property": "updated" }, + { "property": "ex:updated" }, { "date": "1970-01-01" } ] } diff --git a/test_data/cql/input/clause6_03.json b/test_data/cql/input/clause6_03.json index 1196a55e..bc5c6cc9 100644 --- a/test_data/cql/input/clause6_03.json +++ b/test_data/cql/input/clause6_03.json @@ -3,7 +3,7 @@ "args": [ { "op": "isNull", - "args": [ { "property": "geometry" } ] + "args": [ { "property": "ex:geometry" } ] } ] } diff --git a/test_data/cql/input/clause7_03a.json b/test_data/cql/input/clause7_03a.json index 78d2a35d..647d0ea1 100644 --- a/test_data/cql/input/clause7_03a.json +++ b/test_data/cql/input/clause7_03a.json @@ -1,7 +1,7 @@ { "op": "in", "args": [ - { "property": "cityName" }, + { "property": "ex:cityName" }, [ "Toronto", "Frankfurt", "Tokyo", "New York" ] ] } diff --git a/test_data/cql/input/clause7_03b.json b/test_data/cql/input/clause7_03b.json index 1ac740a9..7135a37f 100644 --- a/test_data/cql/input/clause7_03b.json +++ b/test_data/cql/input/clause7_03b.json @@ -4,7 +4,7 @@ { "op": "in", "args": [ - { "property": "category" }, + { "property": "ex:category" }, [ 1, 2, 3, 4 ] ] } diff --git a/test_data/cql/input/clause7_05.json b/test_data/cql/input/clause7_05.json index 6071fb47..305b6a73 100644 --- a/test_data/cql/input/clause7_05.json +++ b/test_data/cql/input/clause7_05.json @@ -3,7 +3,7 @@ "args": [ { "op": "accenti", - "args": [ { "property": "etat_vol" } ] + "args": [ { "property": "ex:etat_vol" } ] }, { "op": "accenti", diff --git a/test_data/cql/input/clause7_12.json b/test_data/cql/input/clause7_12.json index bbef8c63..5f595e2f 100644 --- a/test_data/cql/input/clause7_12.json +++ b/test_data/cql/input/clause7_12.json @@ -1,7 +1,7 @@ { "op": "t_intersects", "args": [ - { "property": "event_time" }, + { "property": "ex:event_time" }, { "interval": [ "1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z" ] } ] } diff --git a/test_data/cql/input/clause7_13.json b/test_data/cql/input/clause7_13.json index 19d6aaaf..2b72a7b6 100644 --- a/test_data/cql/input/clause7_13.json +++ b/test_data/cql/input/clause7_13.json @@ -1,7 +1,7 @@ { "op": "t_during", "args": [ - { "interval": [ { "property": "touchdown" }, { "property": "liftOff" } ] }, + { "interval": [ { "property": "ex:touchdown" }, { "property": "ex:liftOff" } ] }, { "interval": [ "1969-07-16T13:32:00Z", "1969-07-24T16:50:35Z" ] } ] } diff --git a/test_data/cql/input/clause7_18.json b/test_data/cql/input/clause7_18.json index 6cecc0a9..35041327 100644 --- a/test_data/cql/input/clause7_18.json +++ b/test_data/cql/input/clause7_18.json @@ -1,11 +1,11 @@ { "op": "s_within", "args": [ - { "property": "road" }, + { "property": "ex:road" }, { "op": "Buffer", "args": [ - { "property": "geometry" }, + { "property": "ex:geometry" }, 10, "m" ] diff --git a/test_data/cql/input/clause7_19.json b/test_data/cql/input/clause7_19.json index d9b785c6..d1928994 100644 --- a/test_data/cql/input/clause7_19.json +++ b/test_data/cql/input/clause7_19.json @@ -1,11 +1,11 @@ { "op": ">", "args": [ - { "property": "vehicle_height" }, + { "property": "ex:vehicle_height" }, { "op": "-", "args": [ - { "property": "bridge_clearance" }, + { "property": "ex:bridge_clearance" }, 1 ] } diff --git a/test_data/cql/input/example07.json b/test_data/cql/input/example07.json index d3b9cd68..c39a83fe 100644 --- a/test_data/cql/input/example07.json +++ b/test_data/cql/input/example07.json @@ -11,7 +11,7 @@ { "op": "s_intersects", "args": [ - { "property": "footprint" }, + { "property": "ex:footprint" }, { "type": "Polygon", "coordinates": [ diff --git a/test_data/cql/input/example09.json b/test_data/cql/input/example09.json index 60d0c83b..7eb330a6 100644 --- a/test_data/cql/input/example09.json +++ b/test_data/cql/input/example09.json @@ -1,7 +1,7 @@ { "op": ">", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 5 ] } diff --git a/test_data/cql/input/example10.json b/test_data/cql/input/example10.json index 8a0db022..073911cc 100644 --- a/test_data/cql/input/example10.json +++ b/test_data/cql/input/example10.json @@ -1,7 +1,7 @@ { "op": "<=", "args": [ - { "property": "taxes" }, + { "property": "ex:taxes" }, 500 ] } diff --git a/test_data/cql/input/example11.json b/test_data/cql/input/example11.json index d605fe18..bd9b4230 100644 --- a/test_data/cql/input/example11.json +++ b/test_data/cql/input/example11.json @@ -1,7 +1,7 @@ { "op": "like", "args": [ - { "property": "owner" }, + { "property": "ex:owner" }, "%Jones%" ] } diff --git a/test_data/cql/input/example12.json b/test_data/cql/input/example12.json index e7bca46e..bc864104 100644 --- a/test_data/cql/input/example12.json +++ b/test_data/cql/input/example12.json @@ -1,7 +1,7 @@ { "op": "like", "args": [ - { "property": "owner" }, + { "property": "ex:owner" }, "Mike%" ] } diff --git a/test_data/cql/input/example13.json b/test_data/cql/input/example13.json index 871284b8..abe4d4c6 100644 --- a/test_data/cql/input/example13.json +++ b/test_data/cql/input/example13.json @@ -4,7 +4,7 @@ { "op": "like", "args": [ - { "property": "owner" }, + { "property": "ex:owner" }, "%Mike%" ] } diff --git a/test_data/cql/input/example14.json b/test_data/cql/input/example14.json index 129dce86..356d489d 100644 --- a/test_data/cql/input/example14.json +++ b/test_data/cql/input/example14.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "property": "swimming_pool" }, + { "property": "ex:swimming_pool" }, true ] } diff --git a/test_data/cql/input/example15.json b/test_data/cql/input/example15.json index 588e5e1c..32190ba3 100644 --- a/test_data/cql/input/example15.json +++ b/test_data/cql/input/example15.json @@ -4,14 +4,14 @@ { "op": ">", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 5 ] }, { "op": "=", "args": [ - { "property": "swimming_pool" }, + { "property": "ex:swimming_pool" }, true ] } diff --git a/test_data/cql/input/example16.json b/test_data/cql/input/example16.json index c56fc669..a82dcc0a 100644 --- a/test_data/cql/input/example16.json +++ b/test_data/cql/input/example16.json @@ -4,7 +4,7 @@ { "op": "=", "args": [ - { "property": "swimming_pool" }, + { "property": "ex:swimming_pool" }, true ] }, @@ -14,21 +14,21 @@ { "op": ">", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 5 ] }, { "op": "like", "args": [ - { "property": "material" }, + { "property": "ex:material" }, "brick%" ] }, { "op": "like", "args": [ - { "property": "material" }, + { "property": "ex:material" }, "%brick" ] } diff --git a/test_data/cql/input/example17.json b/test_data/cql/input/example17.json index 67b4bb45..919030b8 100644 --- a/test_data/cql/input/example17.json +++ b/test_data/cql/input/example17.json @@ -7,14 +7,14 @@ { "op": ">", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 5 ] }, { "op": "=", "args": [ - { "property": "material" }, + { "property": "ex:material" }, "brick" ] } @@ -23,7 +23,7 @@ { "op": "=", "args": [ - { "property": "swimming_pool" }, + { "property": "ex:swimming_pool" }, true ] } diff --git a/test_data/cql/input/example18.json b/test_data/cql/input/example18.json index 62be7dee..864d88c9 100644 --- a/test_data/cql/input/example18.json +++ b/test_data/cql/input/example18.json @@ -7,7 +7,7 @@ { "op": "<", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 5 ] } @@ -16,7 +16,7 @@ { "op": "=", "args": [ - { "property": "swimming_pool" }, + { "property": "ex:swimming_pool" }, true ] } diff --git a/test_data/cql/input/example19.json b/test_data/cql/input/example19.json index ecf9c31d..7e1a134b 100644 --- a/test_data/cql/input/example19.json +++ b/test_data/cql/input/example19.json @@ -7,14 +7,14 @@ { "op": "like", "args": [ - { "property": "owner" }, + { "property": "ex:owner" }, "mike%" ] }, { "op": "like", "args": [ - { "property": "owner" }, + { "property": "ex:owner" }, "Mike%" ] } @@ -23,7 +23,7 @@ { "op": "<", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 4 ] } diff --git a/test_data/cql/input/example20.json b/test_data/cql/input/example20.json index 9968d5eb..bf961ca5 100644 --- a/test_data/cql/input/example20.json +++ b/test_data/cql/input/example20.json @@ -1,7 +1,7 @@ { "op": "t_before", "args": [ - { "property": "built" }, + { "property": "ex:built" }, { "date": "2015-01-01" } ] } diff --git a/test_data/cql/input/example21.json b/test_data/cql/input/example21.json index 82f86cd2..f4b3478c 100644 --- a/test_data/cql/input/example21.json +++ b/test_data/cql/input/example21.json @@ -1,7 +1,7 @@ { "op": "t_after", "args": [ - { "property": "built" }, + { "property": "ex:built" }, { "date": "2012-06-05" } ] } diff --git a/test_data/cql/input/example22.json b/test_data/cql/input/example22.json index 34033d15..66b0cc52 100644 --- a/test_data/cql/input/example22.json +++ b/test_data/cql/input/example22.json @@ -1,7 +1,7 @@ { "op": "t_during", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "2017-06-10T07:30:00Z", "2017-06-11T10:30:00Z" ] } ] } diff --git a/test_data/cql/input/example23.json b/test_data/cql/input/example23.json index b60365d7..01d1d677 100644 --- a/test_data/cql/input/example23.json +++ b/test_data/cql/input/example23.json @@ -1,7 +1,7 @@ { "op": "s_within", "args": [ - { "property": "location" }, + { "property": "ex:location" }, { "bbox": [ -118, 33.8, -117.9, 34 ] } ] } diff --git a/test_data/cql/input/example24.json b/test_data/cql/input/example24.json index 41e5b206..f09143a4 100644 --- a/test_data/cql/input/example24.json +++ b/test_data/cql/input/example24.json @@ -1,7 +1,7 @@ { "op": "s_intersects", "args": [ - { "property": "geometry" }, + { "property": "ex:geometry" }, { "type": "Polygon", "coordinates": [ [ [ -10, -10 ], [ 10, -10 ], [ 10, 10 ], [ -10, -10 ] ] ] diff --git a/test_data/cql/input/example25.json b/test_data/cql/input/example25.json index 4233215a..e4c2c53c 100644 --- a/test_data/cql/input/example25.json +++ b/test_data/cql/input/example25.json @@ -4,7 +4,7 @@ { "op": ">", "args": [ - { "property": "floors" }, + { "property": "ex:floors" }, 5 ] }, diff --git a/test_data/cql/input/example26.json b/test_data/cql/input/example26.json index d46b1165..a69c72b1 100644 --- a/test_data/cql/input/example26.json +++ b/test_data/cql/input/example26.json @@ -1,7 +1,7 @@ { "op": "in", "args": [ - { "op": "casei", "args": [ { "property": "road_class" } ] }, + { "op": "casei", "args": [ { "property": "ex:road_class" } ] }, [ { "op": "casei", "args": [ "Οδος" ] }, { "op": "casei", "args": [ "Straße" ] } diff --git a/test_data/cql/input/example27.json b/test_data/cql/input/example27.json index 0c94cbc1..ecab6b87 100644 --- a/test_data/cql/input/example27.json +++ b/test_data/cql/input/example27.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "op": "accenti", "args": [ { "property": "etat_vol" } ] }, + { "op": "accenti", "args": [ { "property": "ex:etat_vol" } ] }, { "op": "accenti", "args": [ "débárquér" ] } ] } diff --git a/test_data/cql/input/example29.json b/test_data/cql/input/example29.json index dbb44221..d96f9219 100644 --- a/test_data/cql/input/example29.json +++ b/test_data/cql/input/example29.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "property": "id" }, + { "property": "ex:id" }, "fa7e1920-9107-422d-a3db-c468cbc5d6df" ] } diff --git a/test_data/cql/input/example30.json b/test_data/cql/input/example30.json index 6056f60d..54b6b30c 100644 --- a/test_data/cql/input/example30.json +++ b/test_data/cql/input/example30.json @@ -1,7 +1,7 @@ { "op": "<>", "args": [ - { "property": "id" }, + { "property": "ex:id" }, "fa7e1920-9107-422d-a3db-c468cbc5d6df" ] } diff --git a/test_data/cql/input/example31.json b/test_data/cql/input/example31.json index 6c2c03a0..19878d48 100644 --- a/test_data/cql/input/example31.json +++ b/test_data/cql/input/example31.json @@ -1,7 +1,7 @@ { "op": "<", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10 ] } diff --git a/test_data/cql/input/example32.json b/test_data/cql/input/example32.json index ef1b6cad..efae78b9 100644 --- a/test_data/cql/input/example32.json +++ b/test_data/cql/input/example32.json @@ -1,7 +1,7 @@ { "op": ">", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10 ] } diff --git a/test_data/cql/input/example33.json b/test_data/cql/input/example33.json index 12cfdc21..3f17d5dc 100644 --- a/test_data/cql/input/example33.json +++ b/test_data/cql/input/example33.json @@ -1,7 +1,7 @@ { "op": "<=", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10 ] } diff --git a/test_data/cql/input/example34.json b/test_data/cql/input/example34.json index a8d6ca23..b3a80dc1 100644 --- a/test_data/cql/input/example34.json +++ b/test_data/cql/input/example34.json @@ -1,7 +1,7 @@ { "op": ">=", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10 ] } diff --git a/test_data/cql/input/example35.json b/test_data/cql/input/example35.json index 3b6fee0e..c7cfbad1 100644 --- a/test_data/cql/input/example35.json +++ b/test_data/cql/input/example35.json @@ -1,7 +1,7 @@ { "op": "like", "args": [ - { "property": "name" }, + { "property": "ex:name" }, "foo%" ] } diff --git a/test_data/cql/input/example36.json b/test_data/cql/input/example36.json index 273ace5b..e401f391 100644 --- a/test_data/cql/input/example36.json +++ b/test_data/cql/input/example36.json @@ -4,7 +4,7 @@ { "op": "like", "args": [ - { "property": "name" }, + { "property": "ex:name" }, "foo%" ] } diff --git a/test_data/cql/input/example37.json b/test_data/cql/input/example37.json index 2ec6db3c..1217c9f0 100644 --- a/test_data/cql/input/example37.json +++ b/test_data/cql/input/example37.json @@ -1,7 +1,7 @@ { "op": "between", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10, 20 ] } diff --git a/test_data/cql/input/example38.json b/test_data/cql/input/example38.json index c729fd3d..f31b081d 100644 --- a/test_data/cql/input/example38.json +++ b/test_data/cql/input/example38.json @@ -4,7 +4,7 @@ { "op": "between", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10, 20 ] } diff --git a/test_data/cql/input/example39.json b/test_data/cql/input/example39.json index b24ff974..947ec75e 100644 --- a/test_data/cql/input/example39.json +++ b/test_data/cql/input/example39.json @@ -1,7 +1,7 @@ { "op": "in", "args": [ - { "property": "value" }, + { "property": "ex:value" }, [ 1.0, 2.0, 3.0 ] ] } diff --git a/test_data/cql/input/example40.json b/test_data/cql/input/example40.json index a4dc7f80..eb79d78e 100644 --- a/test_data/cql/input/example40.json +++ b/test_data/cql/input/example40.json @@ -4,7 +4,7 @@ { "op": "in", "args": [ - { "property": "value" }, + { "property": "ex:value" }, [ "a", "b", "c" ] ] } diff --git a/test_data/cql/input/example41.json b/test_data/cql/input/example41.json index bb31b499..e49e5506 100644 --- a/test_data/cql/input/example41.json +++ b/test_data/cql/input/example41.json @@ -1,4 +1,4 @@ { "op": "isNull", - "args": [ { "property": "value" } ] + "args": [ { "property": "ex:value" } ] } diff --git a/test_data/cql/input/example42.json b/test_data/cql/input/example42.json index 29c3bb03..7cf9dcf6 100644 --- a/test_data/cql/input/example42.json +++ b/test_data/cql/input/example42.json @@ -3,7 +3,7 @@ "args": [ { "op": "isNull", - "args": [ { "property": "value" } ] + "args": [ { "property": "ex:value" } ] } ] } diff --git a/test_data/cql/input/example43.json b/test_data/cql/input/example43.json index 04986cb3..2ed79173 100644 --- a/test_data/cql/input/example43.json +++ b/test_data/cql/input/example43.json @@ -7,7 +7,7 @@ { "op": "like", "args": [ - { "property": "name" }, + { "property": "ex:name" }, "foo%" ] } @@ -16,7 +16,7 @@ { "op": ">", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10 ] } diff --git a/test_data/cql/input/example44.json b/test_data/cql/input/example44.json index 65fdbc43..d157f3e2 100644 --- a/test_data/cql/input/example44.json +++ b/test_data/cql/input/example44.json @@ -3,12 +3,12 @@ "args": [ { "op": "isNull", - "args": [ { "property": "value" } ] + "args": [ { "property": "ex:value" } ] }, { "op": "between", "args": [ - { "property": "value" }, + { "property": "ex:value" }, 10, 20 ] } diff --git a/test_data/cql/input/example53.json b/test_data/cql/input/example53.json index bc5dd7f7..52c6e46a 100644 --- a/test_data/cql/input/example53.json +++ b/test_data/cql/input/example53.json @@ -1,7 +1,7 @@ { "op": "t_after", "args": [ - { "property": "updated_at" }, + { "property": "ex:updated_at" }, { "date": "2010-02-10" } ] } diff --git a/test_data/cql/input/example54.json b/test_data/cql/input/example54.json index df7842a6..be4c4040 100644 --- a/test_data/cql/input/example54.json +++ b/test_data/cql/input/example54.json @@ -1,7 +1,7 @@ { "op": "t_before", "args": [ - { "property": "updated_at" }, + { "property": "ex:updated_at" }, { "timestamp": "2012-08-10T05:30:00Z" } ] } diff --git a/test_data/cql/input/example55.json b/test_data/cql/input/example55.json index 0cf0b477..c8db78ce 100644 --- a/test_data/cql/input/example55.json +++ b/test_data/cql/input/example55.json @@ -2,7 +2,7 @@ "op": "t_contains", "args": [ { "interval": [ "2000-01-01T00:00:00Z", "2005-01-10T01:01:01.393216Z" ] }, - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] } + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] } ] } diff --git a/test_data/cql/input/example56.json b/test_data/cql/input/example56.json index 3568235e..dd9fd852 100644 --- a/test_data/cql/input/example56.json +++ b/test_data/cql/input/example56.json @@ -2,6 +2,6 @@ "op": "t_disjoint", "args": [ { "interval": [ "..", "2005-01-10T01:01:01.393216Z" ] }, - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] } + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] } ] } diff --git a/test_data/cql/input/example57.json b/test_data/cql/input/example57.json index 63d460dc..58c41c6f 100644 --- a/test_data/cql/input/example57.json +++ b/test_data/cql/input/example57.json @@ -1,7 +1,7 @@ { "op": "t_during", "args": [ - {"interval": [{ "property": "starts_at" }, { "property": "ends_at" }]}, + {"interval": [{ "property": "ex:starts_at" }, { "property": "ex:ends_at" }]}, {"interval": ["2005-01-10", "2010-02-10"] } ] diff --git a/test_data/cql/input/example58.json b/test_data/cql/input/example58.json index ede6c7ab..c66e7534 100644 --- a/test_data/cql/input/example58.json +++ b/test_data/cql/input/example58.json @@ -1,7 +1,7 @@ { "op": "t_equals", "args": [ - { "property": "updated_at" }, + { "property": "ex:updated_at" }, { "date": "1851-04-29" } ] } diff --git a/test_data/cql/input/example59.json b/test_data/cql/input/example59.json index 4d479c09..00ce01a8 100644 --- a/test_data/cql/input/example59.json +++ b/test_data/cql/input/example59.json @@ -1,7 +1,7 @@ { "op": "t_finishedBy", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "1991-10-07T08:21:06.393262Z", "2010-02-10T05:29:20.073225Z" ] } ] } diff --git a/test_data/cql/input/example60.json b/test_data/cql/input/example60.json index 423d24f5..2aa844d8 100644 --- a/test_data/cql/input/example60.json +++ b/test_data/cql/input/example60.json @@ -1,7 +1,7 @@ { "op": "t_finishes", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "1991-10-07", "2010-02-10T05:29:20.073225Z" ] } ] } diff --git a/test_data/cql/input/example61.json b/test_data/cql/input/example61.json index ca95d573..881388b9 100644 --- a/test_data/cql/input/example61.json +++ b/test_data/cql/input/example61.json @@ -1,7 +1,7 @@ { "op": "t_intersects", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "1991-10-07T08:21:06.393262Z", "2010-02-10T05:29:20.073225Z" ] } ] } diff --git a/test_data/cql/input/example62.json b/test_data/cql/input/example62.json index 23360fb5..8be75fc1 100644 --- a/test_data/cql/input/example62.json +++ b/test_data/cql/input/example62.json @@ -2,6 +2,6 @@ "op": "t_meets", "args": [ { "interval": [ "2005-01-10", "2010-02-10" ] }, - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] } + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] } ] } diff --git a/test_data/cql/input/example63.json b/test_data/cql/input/example63.json index a4f7788e..2b2d92f0 100644 --- a/test_data/cql/input/example63.json +++ b/test_data/cql/input/example63.json @@ -2,6 +2,6 @@ "op": "t_metBy", "args": [ { "interval": [ "2010-02-10T05:29:20.073225Z", "2010-10-07" ] }, - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] } + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] } ] } diff --git a/test_data/cql/input/example64.json b/test_data/cql/input/example64.json index 51055eb8..7a16fab3 100644 --- a/test_data/cql/input/example64.json +++ b/test_data/cql/input/example64.json @@ -2,6 +2,6 @@ "op": "t_overlappedBy", "args": [ { "interval": [ "1991-10-07T08:21:06.393262Z", "2010-02-10T05:29:20.073225Z" ] }, - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] } + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] } ] } diff --git a/test_data/cql/input/example65.json b/test_data/cql/input/example65.json index ff749212..75349e19 100644 --- a/test_data/cql/input/example65.json +++ b/test_data/cql/input/example65.json @@ -1,7 +1,7 @@ { "op": "t_overlaps", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "1991-10-07T08:21:06.393262Z", "1992-10-09T08:08:08.393473Z" ] } ] } diff --git a/test_data/cql/input/example66.json b/test_data/cql/input/example66.json index 118ba307..40e8c545 100644 --- a/test_data/cql/input/example66.json +++ b/test_data/cql/input/example66.json @@ -2,6 +2,6 @@ "op": "t_startedBy", "args": [ { "interval": [ "1991-10-07T08:21:06.393262Z", "2010-02-10T05:29:20.073225Z" ] }, - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] } + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] } ] } diff --git a/test_data/cql/input/example67.json b/test_data/cql/input/example67.json index 551cf2cb..0f764af7 100644 --- a/test_data/cql/input/example67.json +++ b/test_data/cql/input/example67.json @@ -1,7 +1,7 @@ { "op": "t_starts", "args": [ - { "interval": [ { "property": "starts_at" }, { "property": "ends_at" } ] }, + { "interval": [ { "property": "ex:starts_at" }, { "property": "ex:ends_at" } ] }, { "interval": [ "1991-10-07T08:21:06.393262Z", ".." ] } ] } diff --git a/test_data/cql/input/example70.json b/test_data/cql/input/example70.json index 032569ff..b405e9e7 100644 --- a/test_data/cql/input/example70.json +++ b/test_data/cql/input/example70.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "op": "accenti", "args": [ { "property": "owner" } ] }, + { "op": "accenti", "args": [ { "property": "ex:owner" } ] }, { "op": "accenti", "args": [ "Beyoncé" ] } ] } diff --git a/test_data/cql/input/example71.json b/test_data/cql/input/example71.json index 184cde74..26142a98 100644 --- a/test_data/cql/input/example71.json +++ b/test_data/cql/input/example71.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "op": "casei", "args": [ { "property": "owner" } ] }, + { "op": "casei", "args": [ { "property": "ex:owner" } ] }, { "op": "casei", "args": [ "somebody else" ] } ] } diff --git a/test_data/cql/input/example72.json b/test_data/cql/input/example72.json index e97cc2db..e855b0bc 100644 --- a/test_data/cql/input/example72.json +++ b/test_data/cql/input/example72.json @@ -1,7 +1,7 @@ { "op": ">", "args": [ - { "property": "value" }, + { "property": "ex:value" }, { "op": "+", "args": [ diff --git a/test_data/cql/input/example73.json b/test_data/cql/input/example73.json index e436fc5d..8cf4e3cb 100644 --- a/test_data/cql/input/example73.json +++ b/test_data/cql/input/example73.json @@ -1,11 +1,11 @@ { "op": "<", "args": [ - { "property": "value" }, + { "property": "ex:value" }, { "op": "-", "args": [ - { "property": "foo" }, + { "property": "ex:foo" }, 10 ] } diff --git a/test_data/cql/input/example74.json b/test_data/cql/input/example74.json index 5321438b..e8485ff1 100644 --- a/test_data/cql/input/example74.json +++ b/test_data/cql/input/example74.json @@ -1,7 +1,7 @@ { "op": "<>", "args": [ - { "property": "value" }, + { "property": "ex:value" }, { "op": "*", "args": [ diff --git a/test_data/cql/input/example75.json b/test_data/cql/input/example75.json index 4bf7b7a4..b8d2f4ac 100644 --- a/test_data/cql/input/example75.json +++ b/test_data/cql/input/example75.json @@ -1,12 +1,12 @@ { "op": "=", "args": [ - { "property": "value" }, + { "property": "ex:value" }, { "op": "/", "args": [ 2, - { "property": "foo" } + { "property": "ex:foo" } ] } ] diff --git a/test_data/cql/input/example76.json b/test_data/cql/input/example76.json index 32020f0a..22e33af8 100644 --- a/test_data/cql/input/example76.json +++ b/test_data/cql/input/example76.json @@ -1,10 +1,10 @@ { "op": "<=", "args": [ - { "property": "value" }, + { "property": "ex:value" }, { "op": "^", - "args": [ 2, { "property": "foo" } ] + "args": [ 2, { "property": "ex:foo" } ] } ] } diff --git a/test_data/cql/input/example77.json b/test_data/cql/input/example77.json index 4486f909..8471a39f 100644 --- a/test_data/cql/input/example77.json +++ b/test_data/cql/input/example77.json @@ -4,7 +4,7 @@ 0, { "op": "%", - "args": [ { "property": "foo" }, 2 ] + "args": [ { "property": "ex:foo" }, 2 ] } ] } diff --git a/test_data/cql/input/example78.json b/test_data/cql/input/example78.json index f5a69441..45c7701a 100644 --- a/test_data/cql/input/example78.json +++ b/test_data/cql/input/example78.json @@ -4,7 +4,7 @@ 1, { "op": "div", - "args": [ { "property": "foo" }, 2 ] + "args": [ { "property": "ex:foo" }, 2 ] } ] } diff --git a/test_data/cql/input/example79.json b/test_data/cql/input/example79.json index e3311634..095d9d8d 100644 --- a/test_data/cql/input/example79.json +++ b/test_data/cql/input/example79.json @@ -1,7 +1,7 @@ { "op": "a_containedBy", "args": [ - { "property": "values" }, + { "property": "ex:values" }, [ "a", "b", "c" ] ] } diff --git a/test_data/cql/input/example80.json b/test_data/cql/input/example80.json index bef09367..62ed150d 100644 --- a/test_data/cql/input/example80.json +++ b/test_data/cql/input/example80.json @@ -1,7 +1,7 @@ { "op": "a_contains", "args": [ - { "property": "values" }, + { "property": "ex:values" }, [ "a", "b", "c" ] ] } diff --git a/test_data/cql/input/example81.json b/test_data/cql/input/example81.json index 4d35c75f..23c94fe0 100644 --- a/test_data/cql/input/example81.json +++ b/test_data/cql/input/example81.json @@ -2,6 +2,6 @@ "op": "a_equals", "args": [ [ "a", true, 1.0, 8 ], - { "property": "values" } + { "property": "ex:values" } ] } diff --git a/test_data/cql/input/example82.json b/test_data/cql/input/example82.json index 1537ec2e..d51ddaec 100644 --- a/test_data/cql/input/example82.json +++ b/test_data/cql/input/example82.json @@ -1,7 +1,7 @@ { "op": "a_overlaps", "args": [ - { "property": "values" }, + { "property": "ex:values" }, [ { "timestamp": "2012-08-10T05:30:00Z" }, { "date": "2010-02-10" }, false ] ] } diff --git a/test_data/cql/input/example85.json b/test_data/cql/input/example85.json index cc442d1c..e7aff050 100644 --- a/test_data/cql/input/example85.json +++ b/test_data/cql/input/example85.json @@ -1,7 +1,7 @@ { "op": "=", "args": [ - { "property": "value" }, + { "property": "ex:value" }, { "op": "-", "args": [ diff --git a/test_data/cql/input/example86.json b/test_data/cql/input/example86.json index 8d773393..ca69d4e3 100644 --- a/test_data/cql/input/example86.json +++ b/test_data/cql/input/example86.json @@ -1,7 +1,7 @@ { "op": "like", "args": [ - { "property": "name" }, + { "property": "ex:name" }, { "op": "casei", "args": [ "FOO%" ] } ] } diff --git a/tests/_test_cql.py b/tests/test_cql.py similarity index 81% rename from tests/_test_cql.py rename to tests/test_cql.py index 8527143c..15e5dd9f 100755 --- a/tests/_test_cql.py +++ b/tests/test_cql.py @@ -57,10 +57,24 @@ def test_simple_get(client, cql_json_filename): # response = client.post("/cql", json=cql_json, headers=headers) # assert response.status_code == 200 +cql_geo_filenames = [ + "geo_contains", + "geo_contains_filter", + "geo_contains_inverse", + "geo_contains_like", + "geo_crosses", + "geo_disjoint", + "geo_equals", + "geo_intersects", + "geo_overlaps", + "geo_touches", + "geo_within" +] -def test_intersects_get(client): +@pytest.mark.parametrize("cql_geo_filename", cql_geo_filenames) +def test_intersects_get(client, cql_geo_filename): cql_json_path = ( - Path(__file__).parent.parent / "test_data/cql/input/geo_intersects.json" + Path(__file__).parent.parent / f"prez/examples/cql/{cql_geo_filename}.json" ) cql_json = json.loads(cql_json_path.read_text()) query_string = quote_plus(json.dumps(cql_json)) diff --git a/tests/test_cql_time.py b/tests/test_cql_time.py index 4d40790f..abb6cd9d 100755 --- a/tests/test_cql_time.py +++ b/tests/test_cql_time.py @@ -49,13 +49,7 @@ def test_time_funcs(cql_json_filename, output_query_filename): Path(__file__).parent.parent / f"test_data/cql/expected_generated_queries/{output_query_filename}" ).read_text() - context = json.load( - ( - Path(__file__).parent.parent - / "prez/reference_data/cql/default_context.json" - ).open() - ) - cql_parser = CQLParser(cql=cql_json, context=context) + cql_parser = CQLParser(cql=cql_json) cql_parser.generate_jsonld() cql_parser.parse() if not cql_parser.query_str == reference_query: