"SFLIGHT"."CONNECTIONS_C"
in the Graph Visualizer.SET SCHEMA "SFLIGHT";
--DROP TYPE "TT_NODES" CASCADE;
CREATE TYPE "TT_NODES" AS TABLE ("ID" NVARCHAR(3), "NAME" NVARCHAR(25));
--DROP PROCEDURE "NHOOD";
CREATE OR REPLACE PROCEDURE "NHOOD"(
IN startV NVARCHAR(3),
OUT res "TT_NODES")
LANGUAGE GRAPH READS SQL DATA AS
BEGIN
INTEGER minDepth = 1;
INTEGER maxDepth = 1;
GRAPH g = Graph("CONNECTIONS_C");
VERTEX v_s = Vertex(:g, :startV);
MULTISET<VERTEX> ms_n = Neighbors(:g, :v_s, :minDepth, :maxDepth);
res = SELECT :v."ID", :v."NAME" FOREACH v IN :ms_n;
END;
TT_NODES
table type, to be used to output results: ID
and the NAME
of airportsLANGUAGE GRAPH
definition -- meaning it is a GraphScriptID
of the node) as an input, and returns a list of airports as an outputGRAPH
or VERTEX
, and collection types, like MULTISET
Neighbors()
is a HANA's built-in graph function, which takes graph g
and start vertex v_s
as input. It returns a set of vertices that are neighbors within a given depths (in this case only 1
degree of separation, i.e. direct connections)ms_n
are assigned to the result variable res
using projection expression SELECT ... FOREACH ... IN
statementSIN
airport code as in the previous blog.CALL "NHOOD"('SIN', ?);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
41 | |
25 | |
17 | |
14 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 |