From e93f88a8231c8b09c18b0316db99e6cf0f0d51df Mon Sep 17 00:00:00 2001 From: Michael Brichko Date: Wed, 29 Oct 2025 14:13:37 +0200 Subject: [PATCH 1/4] initial --- data-explorer/kusto/query/node-id.md | 75 ++++++++++++++++++++++++++++ data-explorer/kusto/query/toc.yml | 2 + 2 files changed, 77 insertions(+) create mode 100644 data-explorer/kusto/query/node-id.md diff --git a/data-explorer/kusto/query/node-id.md b/data-explorer/kusto/query/node-id.md new file mode 100644 index 0000000000..059c04340c --- /dev/null +++ b/data-explorer/kusto/query/node-id.md @@ -0,0 +1,75 @@ +--- +title: node_id (graph function) +description: This article describes the node_id() function. +ms.topic: reference +ms.date: 10/29/2025 +--- + +# node_id() (graph function) + +> [!INCLUDE [applies](../includes/applies-to-version/applies.md)] [!INCLUDE [fabric](../includes/applies-to-version/fabric.md)] [!INCLUDE [azure-data-explorer](../includes/applies-to-version/azure-data-explorer.md)] + +The `node_id` function calculates the graph node identifier as it was set by the user either in make-graph or graph model. + +> [!NOTE] +> This function is used with the [`graph-match`](graph-match-operator.md) and [`graph-shortest-paths`](graph-shortest-paths-operator.md) operators. + +## Syntax + +`node_id([`*node*`])` + +[!INCLUDE [syntax-conventions-note](../includes/syntax-conventions-note.md)] + +## Parameters + +| Name | Type | Required | Description | +|---|---|---|---| +| *node* | `string` | | The reference to a graph node variable in a graph pattern.
Don't pass any parameters when used inside [all()](all-graph-function.md), [any()](any-graph-function.md), and [map()](map-graph-function.md) graph functions, with [inner_nodes()](inner-nodes-graph-function.md).| + +## Returns + +Returns the node ID string representation of the input node or of all inner nodes, when used inside [all()](all-graph-function.md), [any()](any-graph-function.md), and [map()](map-graph-function.md) functions with [inner_nodes()](inner-nodes-graph-function.md). + +## Example + +The following example creates a graph to analyze a hierarchical structure of employees and their managers. + +:::moniker range="azure-data-explorer" +> [!div class="nextstepaction"] +> Run the query +::: moniker-end + +```kusto +let employees = datatable(name:string, age:long) +[ + "Alice", 32, + "Bob", 31, + "Eve", 27, +]; +let reports = datatable(employee:string, manager:string) +[ + "Bob", "Alice", + "Chris", "Alice", + "Eve", "Bob", +]; +reports +| make-graph employee --> manager with employees on name +| graph-match (n) + where node_id(n) startswith "C" + project node_id(n) +``` + +**Output** + +| node_id_n | +|--| +| Chris | + +## Related content + +* [Graph overview](graph-semantics-overview.md) +* [Graph operators](graph-operators.md) +* [graph-match operator](graph-match-operator.md) +* [node-degree-out](node-degree-out.md) +* [any()](any-graph-function.md) +* [map()](map-graph-function.md) diff --git a/data-explorer/kusto/query/toc.yml b/data-explorer/kusto/query/toc.yml index 21342b94bc..ce9c8630d1 100644 --- a/data-explorer/kusto/query/toc.yml +++ b/data-explorer/kusto/query/toc.yml @@ -1325,6 +1325,8 @@ items: - name: node_degree_out() displayName: graph, node, Node degree out node_degree_out, outdegree node_degree_out href: node-degree-out.md + displayName: graph, node, Node Id + href: node-id.md - name: Visualization items: - name: Overview From f3d8370ded73f7f2c34d3e308ca2d10111562879 Mon Sep 17 00:00:00 2001 From: Michael Brichko Date: Wed, 29 Oct 2025 14:18:43 +0200 Subject: [PATCH 2/4] fix toc --- data-explorer/kusto/query/toc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/data-explorer/kusto/query/toc.yml b/data-explorer/kusto/query/toc.yml index ce9c8630d1..e76d1b2215 100644 --- a/data-explorer/kusto/query/toc.yml +++ b/data-explorer/kusto/query/toc.yml @@ -1325,6 +1325,7 @@ items: - name: node_degree_out() displayName: graph, node, Node degree out node_degree_out, outdegree node_degree_out href: node-degree-out.md + - name: node_id() displayName: graph, node, Node Id href: node-id.md - name: Visualization From a3a8834d1414da30b6db4bd60ba1d598862da157 Mon Sep 17 00:00:00 2001 From: Michael Brichko Date: Wed, 29 Oct 2025 14:33:23 +0200 Subject: [PATCH 3/4] improve example --- data-explorer/kusto/query/node-id.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/data-explorer/kusto/query/node-id.md b/data-explorer/kusto/query/node-id.md index 059c04340c..c830713c61 100644 --- a/data-explorer/kusto/query/node-id.md +++ b/data-explorer/kusto/query/node-id.md @@ -36,34 +36,36 @@ The following example creates a graph to analyze a hierarchical structure of emp :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto let employees = datatable(name:string, age:long) [ - "Alice", 32, - "Bob", 31, - "Eve", 27, +"Alice", 32, +"Bob", 31, +"Eve", 27, ]; let reports = datatable(employee:string, manager:string) [ - "Bob", "Alice", - "Chris", "Alice", - "Eve", "Bob", +"Bob", "Alice", +"Chris", "Alice", +"Eve", "Bob", ]; reports | make-graph employee --> manager with employees on name -| graph-match (n) - where node_id(n) startswith "C" - project node_id(n) +| graph-match (employee)-[reports*1..3]->(manager) + where node_id(employee) startswith "E" + project manager1 = node_id(manager), manager2 = map(inner_nodes(reports), node_id()) ``` **Output** -| node_id_n | -|--| -| Chris | +| manager_1 | manager_2 | +|--|--| +| Bob | [] | +| Alice | ["Bob"] + ## Related content From 2675d3efef9989b9e676ff023e9e39c9c9e4e5a7 Mon Sep 17 00:00:00 2001 From: Michael Brichko Date: Wed, 29 Oct 2025 16:20:01 +0200 Subject: [PATCH 4/4] add preview tag --- data-explorer/kusto/query/node-id.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data-explorer/kusto/query/node-id.md b/data-explorer/kusto/query/node-id.md index c830713c61..1d48ae033e 100644 --- a/data-explorer/kusto/query/node-id.md +++ b/data-explorer/kusto/query/node-id.md @@ -14,6 +14,9 @@ The `node_id` function calculates the graph node identifier as it was set by the > [!NOTE] > This function is used with the [`graph-match`](graph-match-operator.md) and [`graph-shortest-paths`](graph-shortest-paths-operator.md) operators. +> [!WARNING] +> This feature is currently in public preview. Functionality and syntax are subject to change before General Availability. + ## Syntax `node_id([`*node*`])`