From e5e30eed07f624927211217e518186b3c8653007 Mon Sep 17 00:00:00 2001 From: Thomas Jung Date: Wed, 14 Oct 2026 09:58:28 -0400 Subject: [PATCH 1/4] fix(hana-cloud-smart-multi-model-4): align code-fence indentation to valid CommonMark --- .../hana-cloud-smart-multi-model-4.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tutorials/hana-cloud-smart-multi-model-4/hana-cloud-smart-multi-model-4.md b/tutorials/hana-cloud-smart-multi-model-4/hana-cloud-smart-multi-model-4.md index 0fd83bcfe..9a912cbc8 100644 --- a/tutorials/hana-cloud-smart-multi-model-4/hana-cloud-smart-multi-model-4.md +++ b/tutorials/hana-cloud-smart-multi-model-4/hana-cloud-smart-multi-model-4.md @@ -45,49 +45,49 @@ You can see in this image the circle you will create: 1. First, select the two points from the previous tutorials using this statement: - ```SQL +```SQL SELECT ST_GeomFromText('POINT (706327.107445 5710259.94449)', 32630) AS START_PT, SHAPE AS TARGET_PT FROM LONDON_POI lp WHERE "osmid" = 6274057185; - ``` +``` 2. To create a line geometry, which is connecting both points, you can then use the function [`ST_MakeLine`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/57758b2af95346db9a478a53ec2c4ccb.html). - ```SQL +```SQL SELECT ST_MakeLine(START_PT, TARGET_PT) AS CONN_LINE FROM ( -- previous statement ); - ``` +``` 3. To retrieve an arbitrary point on this line, we need to use function [`ST_LineInterpolatePoint`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/c8efe60825514403865090fdf1dc1550.html), which takes a fraction of the line as argument. For retrieving the center point of the line, we pass the value 0.5. - ```SQL +```SQL SELECT CONN_LINE.ST_LineInterpolatePoint(0.5) AS CENTER_PT FROM ( -- previous statement ); - ``` +``` 4. As a final step, we would like to draw a circle with radius distance (start, target)/2 + 500 around `CENTER_PT`. The respective function, which takes the radius as an input, is called [`ST_Buffer`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/010c53e227a94966bb009d52d9ec47a2.html). - ```SQL +```SQL SELECT CENTER_PT.ST_Buffer(4835) AS AREA FROM ( -- previous statement ); - ``` +``` 5. The above steps can be combined into a single select using method chaining. - ```SQL +```SQL SELECT ST_MakeLine( ST_GeomFromText('POINT (706327.107445 5710259.94449)', 32630), @@ -97,7 +97,7 @@ SELECT .ST_Buffer(5000) AS AREA FROM LONDON_POI WHERE "osmid" = 6274057185; - ``` +``` ### Add flags for all nodes in a circle @@ -106,7 +106,7 @@ Next, you need to flag all nodes of the transportation network located in the ci 1. First, we need to enhance the existing vertex table by column `in_scope`. - ```SQL +```SQL ALTER TABLE LONDON_VERTICES ADD (IN_SCOPE INTEGER); ``` @@ -114,7 +114,7 @@ ALTER TABLE LONDON_VERTICES ADD (IN_SCOPE INTEGER); 3. Instead of using an [UPDATE](https://help.sap.com/viewer/c1d3f60099654ecfb3fe36ac93c121bb/LATEST/en-US/20ff268675191014964add3d17700909.html) statement, we will use [MERGE INTO](https://help.sap.com/viewer/c1d3f60099654ecfb3fe36ac93c121bb/LATEST/en-US/3226201f95764a57810dd256c9524d56.html), which allows a more complex update logic. - ```SQL +```SQL MERGE INTO LONDON_VERTICES lv USING ( @@ -135,9 +135,9 @@ WHEN MATCHED THEN UPDATE SET lv.IN_SCOPE = CIRCLE.AREA.ST_Intersects(SHAPE); 4. You can confirm that you properly selected the nodes by using your preferred tool for visualizing the result set with this query: - ```SQL +```SQL SELECT SHAPE FROM LONDON_VERTICES WHERE IN_SCOPE = 1; - ``` +``` ![relevant nodes](ss-02-relevant-nodes.png) From e4ebe240d95da33c6408c329622114de603c16fa Mon Sep 17 00:00:00 2001 From: Thomas Jung Date: Wed, 14 Oct 2026 09:58:39 -0400 Subject: [PATCH 2/4] fix(hana-cloud-smart-multi-model-9): align code-fence indentation to valid CommonMark --- .../hana-cloud-smart-multi-model-9.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tutorials/hana-cloud-smart-multi-model-9/hana-cloud-smart-multi-model-9.md b/tutorials/hana-cloud-smart-multi-model-9/hana-cloud-smart-multi-model-9.md index a7f06e74b..c5ea930f2 100644 --- a/tutorials/hana-cloud-smart-multi-model-9/hana-cloud-smart-multi-model-9.md +++ b/tutorials/hana-cloud-smart-multi-model-9/hana-cloud-smart-multi-model-9.md @@ -127,13 +127,13 @@ Second, you would like to find "attractive" paths. You will calculate a new meas 1. First, let's calculate **`PUBINESS`** by counting pubs within 100m distance and add this to our `LONDON_EDGES` table. You are using the spatial `ST_WithinDistance` predicate as join condition: - ```SQL +```SQL ON pubs."SHAPE".ST_WithinDistance(e."EDGESHAPE", 100) = 1 ``` 2. This is the complete statement to alter the table and adding our **`PUBINESS`** measure. Paste and execute it: - ```SQL +```SQL ALTER TABLE "LONDON_EDGES" ADD ("PUBINESS" DOUBLE DEFAULT 0); MERGE INTO "LONDON_EDGES" USING ( @@ -149,7 +149,7 @@ WHEN MATCHED THEN UPDATE SET "LONDON_EDGES"."PUBINESS" = U."PUBINESS"; 3. Using this statement, you can check the distribution of this new **`PUBINESS`** property. - ```SQL +```SQL SELECT "PUBINESS", COUNT(*) AS C FROM "LONDON_EDGES" GROUP BY "PUBINESS" ORDER BY "PUBINESS" ASC; ``` @@ -159,7 +159,7 @@ SELECT "PUBINESS", COUNT(*) AS C FROM "LONDON_EDGES" GROUP BY "PUBINESS" ORDER B Now, you can use the new measure as part of the cost function for path finding with mode "**pub**". - ``` +``` Shortest_Path(:g, :v_start, :v_end, (Edge e) => DOUBLE { RETURN :e."length"/(5.0*:e."PUBINESS"+1.0); }, :i_direction); @@ -169,7 +169,7 @@ RETURN :e."length"/(5.0*:e."PUBINESS"+1.0); For finding the path with mode "**bike**", you can use a conditional cost function. Street segments which are of type "**cycleway**" are boosted by dividing the length by 10. - ```SQL +```SQL Shortest_Path(:g, :v_start, :v_end, (EDGE e)=> DOUBLE { IF(:e."highway" == 'cycleway') { RETURN :e."length"/10.0; } ELSE { RETURN :e."length"; } @@ -182,7 +182,7 @@ ELSE { RETURN :e."length"; } 5. Create a **TABLE TYPE** first with the following statement. - ```SQL +```SQL CREATE TYPE "TT_SPOO_MULTI_MODE" AS TABLE ( "ID" NVARCHAR(5000), "SOURCE" BIGINT, "TARGET" BIGINT, "EDGE_ORDER" BIGINT, "length" DOUBLE, "SPEED_MPH" INT, "highway" NVARCHAR(5000) ); @@ -190,7 +190,7 @@ CREATE TYPE "TT_SPOO_MULTI_MODE" AS TABLE ( 6. Then create the **procedure** with this statement. - ```SQL +```SQL CREATE OR REPLACE PROCEDURE "GS_SPOO_MULTI_MODE"( IN i_startVertex BIGINT, -- the ID of the start vertex IN i_endVertex BIGINT, -- the ID of the end vertex @@ -231,7 +231,7 @@ END; 7. To see the results, you can again use a **CALL** statement: - ```SQL +```SQL CALL "GS_SPOO_MULTI_MODE"(1433737988, 1794145673, 'ANY', 'pub', ?, ?, ?); CALL "GS_SPOO_MULTI_MODE"(1433737988, 1794145673, 'ANY', 'bike', ?, ?, ?); ``` @@ -244,15 +244,15 @@ The procedure above returns more than one output - the path's length, weight, an 1. First, as in the previous examples, create the **TABLE TYPE**: - ```SQL +```SQL CREATE TYPE "TT_EDGES_SPOO_F" AS TABLE ( "ID" NVARCHAR(5000), "SOURCE" BIGINT, "TARGET" BIGINT, "EDGE_ORDER" BIGINT, "length" DOUBLE, "SHAPE" ST_GEOMETRY(32630) ); - ``` +``` 2. Then create the **function**: - ```SQL +```SQL CREATE OR REPLACE FUNCTION "F_SPOO_EDGES"( IN i_startVertex BIGINT, IN i_endVertex BIGINT, @@ -267,22 +267,22 @@ BEGIN CALL "GS_SPOO_MULTI_MODE"(:i_startVertex, :i_endVertex, :i_direction, :i_mode, o_path_length, o_path_weight, o_edges); RETURN SELECT lbe.* FROM :o_edges AS P LEFT JOIN "LONDON_EDGES" lbe ON P."ID" = lbe."ID"; END; - ``` +``` 3. Now you can simply calculate the **average** **`PUBINESS`** of a path, or UNION two paths to compare. To calculate the average value of one path, use this statement: - ```SQL +```SQL SELECT AVG("PUBINESS") FROM "F_SPOO_EDGES"(1433737988, 1794145673, 'ANY', 'pub'); - ``` +``` 4. To compare two paths, you can use this statement: - ```SQL +```SQL SELECT "ID", "SHAPE" FROM "F_SPOO_EDGES"(1433737988, 1794145673, 'ANY', 'pub') UNION SELECT "ID", "SHAPE" FROM "F_SPOO_EDGES"(1433737988, 1794145673, 'ANY', 'bike'); - ``` +``` 5. Visualizing this comparison should look like this: From 186ca9ae11daf249099dc6fadb09dd3c14684e01 Mon Sep 17 00:00:00 2001 From: Thomas Jung Date: Wed, 14 Oct 2026 09:58:53 -0400 Subject: [PATCH 3/4] fix(hana-cloud-smart-multi-model-10): align code-fence indentation to valid CommonMark --- .../hana-cloud-smart-multi-model-10.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tutorials/hana-cloud-smart-multi-model-10/hana-cloud-smart-multi-model-10.md b/tutorials/hana-cloud-smart-multi-model-10/hana-cloud-smart-multi-model-10.md index 9b910167a..58589bf09 100644 --- a/tutorials/hana-cloud-smart-multi-model-10/hana-cloud-smart-multi-model-10.md +++ b/tutorials/hana-cloud-smart-multi-model-10/hana-cloud-smart-multi-model-10.md @@ -49,7 +49,7 @@ ELSE { END TRAVERSE; } 1. Here is the complete statement that you can run in your example. As previously, first you create a **table type** and then the **GRAPH procedure**: - ```SQL +```SQL CREATE TYPE "TT_SPOA_VERTICES" AS TABLE ("osmid" BIGINT, "CALCULATED_COST" DOUBLE); CREATE OR REPLACE PROCEDURE "GS_SPOA"( IN i_startVertex BIGINT, -- the key of the start vertex @@ -72,13 +72,13 @@ END; 2. As an example, what to do with the SPOA method, you can calculate, where you can go in 300 seconds from your starting point Canary Wharf with this statement: - ```SQL +```SQL CALL "GS_SPOA" (1433737988, 300, ?); ``` 3. To visualize the data, let's wrap it in a function and do some post-processing to our graph results. With `resultType` = `POINTS` the function will **return the raw data**, i.e. the individual street intersections that are reachable given a certain maximum of travel time. With `resultType` = `CONVEXHULL` the function will **calculate a convex hull of the points and return a single shape**. Finally, with `resultType` = `HEXAGON` a spatial clustering is applied, and **travel times are averaged for each cluster cell**. - ```SQL +```SQL CREATE OR REPLACE FUNCTION "F_SPOA_VERTICES"( IN i_startVertex BIGINT, -- the key of the start vertex IN i_max DOUBLE, -- the maximum distance/cost @@ -109,7 +109,7 @@ END; 4. You can use these three statements to explore from your starting point Canary Wharf: - ```SQL +```SQL SELECT * FROM "F_SPOA_VERTICES"(1433737988, 60, 'POINTS') ORDER BY "CALCULATED_COST" DESC; SELECT * FROM "F_SPOA_VERTICES"(1433737988, 60, 'CONVEXHULL') ORDER BY "CALCULATED_COST" DESC; SELECT * FROM "F_SPOA_VERTICES"(1433737988, 240, 'HEXAGON') ORDER BY "CALCULATED_COST" DESC; @@ -123,7 +123,7 @@ SELECT * FROM "F_SPOA_VERTICES"(1433737988, 240, 'HEXAGON') ORDER BY "CALCULATED So let's calculate 3 min drive time areas around all the bike repair shops in London. You'll use the `MAP_MERGE` operation to digest multiple POI's: - ```SQL +```SQL CREATE OR REPLACE FUNCTION "F_SPOA_VERTICES_MULTI" (IN i_filter VARCHAR(5000), IN i_max DOUBLE, IN i_resultType VARCHAR(20)) RETURNS TABLE("ID" BIGINT, "SHAPE" ST_GEOMETRY(32630), "CALCULATED_COST" DOUBLE) LANGUAGE SQLSCRIPT READS SQL DATA AS @@ -150,7 +150,7 @@ For this step, you will use a different network, the London Tube network. It is 1. First, select the tables and then create a **GRAPH workspace** with these statements: - ```SQL +```SQL SELECT * FROM "LONDON_TUBE_STATIONS"; SELECT * FROM "LONDON_TUBE_CONNECTIONS"; CREATE GRAPH WORKSPACE "TUBE_GRAPH" @@ -165,7 +165,7 @@ CREATE GRAPH WORKSPACE "TUBE_GRAPH" When you traverse a network in a breadth first search manner, you explore the vertices level by level. Starting at a vertex, you first visit all its direct neighbors, then the neighbors of the neighbors and so forth. BFS is a fundamental building block for many custom graph algorithms. In SAP HANA Cloud, SAP HANA database you can "hook" into the vertex/edge "visit" events, executing any logic. - ```SQL +```SQL TRAVERSE BFS ('ANY') :g FROM :v_start ON VISIT VERTEX (Vertex v_visited, BIGINT lvl) { [any logic goes here] @@ -176,7 +176,7 @@ ON VISIT VERTEX (Vertex v_visited, BIGINT lvl) { 2. As usual, create the **table type** first: - ```SQL +```SQL CREATE TYPE "TT_RESULT_CC" AS TABLE ( "ID" BIGINT, "CLOSENESS_CENTRALITY" DOUBLE, "NORMALIZED_CLOSENESS_CENTRALITY" DOUBLE, "HARMONIC_CENTRALITY" DOUBLE, "NORMALIZED_HARMONIC_CENTRALITY" DOUBLE ); @@ -184,7 +184,7 @@ CREATE TYPE "TT_RESULT_CC" AS TABLE ( 3. Then, create the **GRAPH procedure**: - ```SQL +```SQL CREATE OR REPLACE PROCEDURE "GS_CC_SINGLE_SOURCE"( IN i_start BIGINT, OUT o_vertices "TT_RESULT_CC") @@ -225,7 +225,7 @@ END; 4. Once the procedure is created, you can call it: - ```SQL +```SQL CALL "GS_CC_SINGLE_SOURCE"(117, ?); ``` @@ -233,7 +233,7 @@ CALL "GS_CC_SINGLE_SOURCE"(117, ?); 5. Create the **function** like this: - ```SQL +```SQL CREATE OR REPLACE FUNCTION "F_CC_SINGLE_SOURCE"(IN i_start BIGINT) RETURNS "TT_RESULT_CC" LANGUAGE SQLSCRIPT READS SQL DATA AS @@ -245,7 +245,7 @@ END; 6. Next, you can invoke this function on a set input parameter in a parallel way. - ```SQL +```SQL CREATE OR REPLACE FUNCTION "F_CC_MAP_MERGE" () RETURNS "TT_RESULT_CC" LANGUAGE SQLSCRIPT READS SQL DATA AS @@ -258,13 +258,13 @@ END; 7. Then you can select from it: - ```SQL +```SQL SELECT * FROM "F_CC_MAP_MERGE"() ORDER BY "NORMALIZED_CLOSENESS_CENTRALITY" DESC; ``` 8. Again, you can mix the results from a graph function with other SQL operations, like a JOIN. - ```SQL +```SQL SELECT * FROM "F_CC_MAP_MERGE"() AS C LEFT JOIN "LONDON_TUBE_STATIONS" AS S From a8c61d5dbd1c33d65f2881c45fbd680a5c415fb7 Mon Sep 17 00:00:00 2001 From: Thomas Jung Date: Wed, 14 Oct 2026 09:59:14 -0400 Subject: [PATCH 4/4] fix(hana-cloud-trial-qgis-3): align code-fence indentation to valid CommonMark --- tutorials/hana-cloud-trial-qgis-3/hana-cloud-trial-qgis-3.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/hana-cloud-trial-qgis-3/hana-cloud-trial-qgis-3.md b/tutorials/hana-cloud-trial-qgis-3/hana-cloud-trial-qgis-3.md index e334b8a2e..70d60f5a9 100644 --- a/tutorials/hana-cloud-trial-qgis-3/hana-cloud-trial-qgis-3.md +++ b/tutorials/hana-cloud-trial-qgis-3/hana-cloud-trial-qgis-3.md @@ -57,7 +57,7 @@ Follow the steps to create an SQL view doing a hexagonal clustering and counting 5. Copy the following SQL statement into the SQL Console and execute: - ``` +``` CREATE VIEW POI_DENSITY AS ( SELECT @@ -67,7 +67,7 @@ CREATE VIEW POI_DENSITY AS FROM "gis_osm_pois_free_1" GROUP CLUSTER BY "geom" USING HEXAGON X CELLS 100 ) - ``` +``` You can find more information on [Spatial Clustering](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/2020_04_QRC/en-US/7eb3c0e6bbf04fc6bcb9809d81533e6f.html) in the [SAP HANA Spatial Reference](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/2020_04_QRC/en-US/e1c934157bd14021a3b43b5822b2cbe9.html).