適用対象: ✅Microsoft Fabric✅Azure データ エクスプローラー✅Azure Monitor✅Microsoft Sentinel
any()グラフ関数は、可変長パスに沿って各エッジノードまたは内部ノードの条件を評価します。
構文
any(
edge,条件)
any(inner_nodes(
edge),条件)
パラメーター
| 名前 | タイプ | 必須 | 説明 |
|---|---|---|---|
| 端 | string |
✔️ | グラフ一致演算子またはグラフ最短パス演算子パターンからの可変長エッジ。 詳細については、「 グラフ パターン表記」を参照してください。 |
| 条件 | string |
✔️ | 可変長エッジでエッジまたは内部ノードのプロパティで構成されるブール式inner_nodes使用されます。 プロパティは、プロパティ名を使用して直接参照されます。 式は、可変長エッジ内のエッジまたは内部ノードごとに評価されます。 |
返品ポリシー
可変長エッジで、inner_nodesが使用されている場合に、少なくとも 1 つのtrueまたはtrueに対して条件がに評価された場合に、を返します。 それ以外の場合は、falseを返します。
長さ 0 のパスの場合、条件は falseに評価されます。
例示
次の例では、 Locations データ テーブルと Routes データ テーブルを使用して、ソースの場所から route経由で移動先の場所へのパスを検索するグラフを作成します。
any()関数を使用して、少なくとも 1 回"Train"輸送方法を使用するパスを検索します。 ルートに沿って、ソースの場所名、宛先の場所名、および輸送方法を返します。
// Locations table (nodes)
let Locations = datatable(LocationName: string, LocationType: string) [
"New York", "City",
"San Francisco", "City",
"Chicago", "City",
"Los Angeles", "City",
"Seattle", "Warehouse"
];
// Routes table (edges)
let Routes = datatable(OriginLocationID: string, DestinationLocationID: string, TransportMode: string) [
"New York", "San Francisco", "Truck",
"New York", "Chicago", "Train",
"San Francisco", "Los Angeles", "Truck",
"Chicago", "Seattle", "Train",
"Los Angeles", "New York", "Truck",
"Seattle", "San Francisco", "Train"
];
Routes
| make-graph OriginLocationID --> DestinationLocationID with Locations on LocationName
| graph-match (src)-[route*1..2]->(dest)
where any(route, TransportMode == "Train")
project src.LocationName,
dest.LocationName,
route_TransportModes = map(route, TransportMode)
出力
| src_LocationName | dest_LocationName | route_TransportModes |
|---|---|---|
| シアトル | サンフランシスコ | ["Train"] |
| シカゴ | シアトル | ["Train"] |
| ニューヨーク | シカゴ | ["Train"] |
| シアトル | ロサンゼルス | [ "Train", "Truck" ] |
| シカゴ | サンフランシスコ | [ "Train", "トレーニング" ] |
| ニューヨーク | シアトル | [ "Train", "トレーニング" ] |
| ロサンゼルス | シカゴ | [ "Truck", "トレーニング" ] |
次の例では、 graph-shortest-paths 演算子と any() 関数と inner_nodes 関数を使用して、輸送ネットワーク内の 2 つのステーション間のパスを検索する方法を示します。 このクエリは、 connections データからグラフを作成し、 "South-West" ステーションから "North" ステーションまでの最短パスを検索し、Wi-Fi が使用可能な少なくとも 1 つのステーションを通過します。
let connections = datatable(from_station:string, to_station:string, line:string)
[
"Central", "North", "red",
"North", "Central", "red",
"Central", "South", "red",
"South", "Central", "red",
"South", "South-West", "red",
"South-West", "South", "red",
"South-West", "West", "red",
"West", "South-West", "red",
"Central", "East", "blue",
"East", "Central", "blue",
"Central", "West", "blue",
"West", "Central", "blue",
];
let stations = datatable(station:string, wifi: bool)
[
"Central", true,
"North", false,
"South", false,
"South-West", true,
"West", true,
"East", false
];
connections
| make-graph from_station --> to_station with stations on station
| graph-match cycles=none (start)-[connections*2..5]->(destination)
where start.station == "South-West" and
destination.station == "North" and
any(inner_nodes(connections), wifi)
project from = start.station,
stations = strcat_array(map(inner_nodes(connections), station), "->"),
to = destination.station
出力
| 差出人 | 局 | 送信先 |
|---|---|---|
| South-West | South->Central | 北 |
| South-West | West->Central | 北 |