Join
An example query to join two data sources to obtain a new data source with more information. In particular, how to list the links with the labels for the source and destination nodes.
You can match the
from
field of the links with the id
field of the nodes to ask for the links, and join them with the
nodes:links | join nodes from id
After executing the query above you will get all the links fields, plus a new field
called joined_node_from_id
, it contains the node which satisfies the
link.from == node.id
condition. You can use the dot syntax to
access the sub fields of joined_node_from_id
Because we also want to get the labels for the
to
field of the
links
you add another join
and exclude the empty
labels of the node referred by to
to get more interesting
data:links | join nodes from id | join nodes to id | where joined_node_to_id.label != ""
This will obtain a huge amount of data, which is difficult to understand. To only get the
relevant information, you can use a
select
:links | join nodes from id | join nodes to id | where joined_node_to_id.label != "" | select from joined_node_from_id.label to joined_node_to_id.label protocol