次の方法で共有


all() (グラフ関数)

適用対象: ✅Microsoft FabricAzure データ エクスプローラーAzure MonitorMicrosoft Sentinel

all()グラフ関数は、可変長パスに沿って各エッジノードまたは内部ノードの条件を評価します。

この関数は、 グラフ一致 演算子と グラフ最短パス 演算子で使用されます。

構文

all( edge,条件)

all(inner_nodes( edge),条件)

パラメーター

名前 タイプ 必須 説明
string ✔️ グラフ一致演算子またはグラフ最短パス演算子パターンからの可変長エッジ。 詳細については、「 グラフ パターン表記」を参照してください。
条件 string ✔️ 可変長エッジでエッジまたは内部ノードのプロパティで構成されるブール式inner_nodes使用されます。 プロパティは、プロパティ名を使用して直接参照されます。 式は、可変長エッジ内のエッジまたは内部ノードごとに評価されます。

返品ポリシー

可変長エッジでinner_nodesが使用されている場合に、各trueまたはtrueに対して条件がに評価された場合に、を返します。 それ以外の場合は、falseを返します。

長さ 0 のパスの場合、条件は trueに評価されます。

例示

次の例は、 graph-match 演算子と all() 関数を使用して、輸送ネットワーク内の 2 つのステーション間のすべてのラウンド トリップ パスを検索する方法を示しています。 方向ごとに異なる線が使用されます。 このクエリは、 connections データからグラフを作成し、外側のルートに "red" 線を使用する最大 5 つの接続、および戻りルートの "blue" 線を検索します。 all()関数を使用すると、可変長エッジのすべてのエッジが、"red"または"blue"の同じ線の一部になります。

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",
]; 
connections 
| make-graph from_station --> to_station with_node_id=station
| graph-match (start)-[outward*1..5]->(destination)-[return*1..5]->(start)
  where start.station != destination.station and 
        all(outward, line == "red") and
        all(return, line == "blue") 
  project from = start.station, 
          outward_stations = strcat_array(map(inner_nodes(outward), station), "->"), 
          to = destination.station, 
          return_stations = strcat_array(map(inner_nodes(return), station), "->"), 
          back=start.station

アウトプット

差出人 outward_stations 送信先 return_stations 戻る
中央 North->Central->South->South-West 西 中央
西 南西>サウス >セントラル >ノース 中央 西
中央 南>South-West 西 中央
西 南西>サウス 中央 西
中央 North->Central->South->South-West 西 Central->East 中央
西 南西>サウス >セントラル >ノース 中央 East->Central 西
中央 南>South-West 西 Central->East 中央
西 南西>サウス 中央 East->Central 西

次の例では、 graph-shortest-paths 演算子と all() 関数と inner_nodes 関数を使用して、輸送ネットワーク内の 2 つのステーション間のパスを検索する方法を示します。 このクエリは、 connections データからグラフを作成し、 "South-West" ステーションから "North" ステーションまでの最短パスを検索し、Wi-Fi が使用可能なステーションを通過します。

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-shortest-paths (start)-[connections*2..5]->(destination)
  where start.station == "South-West" and
        destination.station == "North" and 
        all(inner_nodes(connections), wifi)
  project from = start.station, 
          stations = strcat_array(map(inner_nodes(connections), station), "->"), 
          to = destination.station

アウトプット

差出人 送信先
South-West West->Central