From 058f20c48131b143124867261fd6f7871ef55a49 Mon Sep 17 00:00:00 2001 From: Yannan <73408381+YannanGao-gs@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:02:30 -0400 Subject: [PATCH] update dataspace template query showcase (#832) --- .../Data Space With Exectuables/code.pure | 79 +++++++++++++------ .../Relational Store/Service/Basic/code.pure | 40 +++++----- showcases/pom.xml | 2 +- 3 files changed, 76 insertions(+), 45 deletions(-) diff --git a/showcases/data/Model/Document and share your model/Data Space With Exectuables/code.pure b/showcases/data/Model/Document and share your model/Data Space With Exectuables/code.pure index b38740084..652fdda74 100644 --- a/showcases/data/Model/Document and share your model/Data Space With Exectuables/code.pure +++ b/showcases/data/Model/Document and share your model/Data Space With Exectuables/code.pure @@ -264,35 +264,41 @@ DataSpace showcase::northwind::dataspace::NorthwindDataSpaceWithExecutables executables: [ { - title: 'Northwind Data Space -Shipper Validation Defects'; - description: 'Shipper Validation Defects'; + title: 'this is title (service) - Northwind Data Space -Shipper Validation Defects'; + description: 'this is description (service) Shipper Validation Defects'; executable: showcase::northwind::services::graph::ShipperValidationDefects; }, + { + id: my_id_1; + title: 'this is title (function pointer) - Top Categories'; + description: 'this is description (function pointer) - TopCategories'; + executable: showcase::northwind::model::Order_QueryFunction():TabularDataSet[1]; + }, { id: my_id; - title: 'this is title - Top Categories'; - description: 'this is description - TopCategories'; + title: 'this is title (inline query) - Top Categories'; + description: 'this is description (inline query) - TopCategories'; query: |showcase::northwind::model::Order.all()->groupBy( - [ - x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.id, - x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.name - ], - [ - agg( - x: showcase::northwind::model::Order[1]|$x.id, - x: Integer[*]|$x->distinct()->count() - ) - ], - [ - 'Category Id', - 'Category Name', - 'Order Count' - ] - )->sort( - [ - desc('Order Count') - ] - )->take(5); + [ + x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.id, + x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.name + ], + [ + agg( + x: showcase::northwind::model::Order[1]|$x.id, + x: Integer[*]|$x->distinct()->count() + ) + ], + [ + 'Category Id', + 'Category Name', + 'Order Count' + ] + )->sort( + [ + desc('Order Count') + ] + )->take(5); executionContextKey: 'externally-public-PROD'; } ]; @@ -974,6 +980,31 @@ Association showcase::northwind::model::associations::Employee_Manager manager: showcase::northwind::model::crm::Employee[0..1]; } +function showcase::northwind::model::Order_QueryFunction(): meta::pure::tds::TabularDataSet[1] +{ + showcase::northwind::model::Order.all()->groupBy( + [ + x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.id, + x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.name + ], + [ + agg( + x: showcase::northwind::model::Order[1]|$x.id, + x: Integer[*]|$x->distinct()->count() + ) + ], + [ + 'Category Id', + 'Category Name', + 'Order Count' + ] + )->sort( + [ + desc('Order Count') + ] + )->take(5) +} + ###Mapping Mapping showcase::northwind::mapping::NorthwindMapping diff --git a/showcases/data/Store/Relational Store/Service/Basic/code.pure b/showcases/data/Store/Relational Store/Service/Basic/code.pure index 1e43b07ab..521117882 100644 --- a/showcases/data/Store/Relational Store/Service/Basic/code.pure +++ b/showcases/data/Store/Relational Store/Service/Basic/code.pure @@ -306,26 +306,26 @@ DataSpace showcase::northwind::dataspace::NorthwindDataSpaceWithTemplateQuery title: 'this is title - Top Categories'; description: 'this is description - TopCategories'; query: |showcase::northwind::model::Order.all()->groupBy( - [ - x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.id, - x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.name - ], - [ - agg( - x: showcase::northwind::model::Order[1]|$x.id, - x: Integer[*]|$x->distinct()->count() - ) - ], - [ - 'Category Id', - 'Category Name', - 'Order Count' - ] - )->sort( - [ - desc('Order Count') - ] - )->take(5); + [ + x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.id, + x: showcase::northwind::model::Order[1]|$x.lineItems.product.category.name + ], + [ + agg( + x: showcase::northwind::model::Order[1]|$x.id, + x: Integer[*]|$x->distinct()->count() + ) + ], + [ + 'Category Id', + 'Category Name', + 'Order Count' + ] + )->sort( + [ + desc('Order Count') + ] + )->take(5); executionContextKey: 'externally-public-PROD'; } ]; diff --git a/showcases/pom.xml b/showcases/pom.xml index cc30fabc3..5ec8da9bd 100644 --- a/showcases/pom.xml +++ b/showcases/pom.xml @@ -16,7 +16,7 @@ 1.8 3 data - 4.45.0 + 4.54.1