tutorials:common_graph_queries
see also: Graph queries in XL
In the following a set queries is listed and the results of them applied on the graph in the image. This graph is created by the turtle query: A[F A][R F A] F A ;
Query | Result | Description |
Basic | ||
A or a:A | {a1,a2,a3,a4} | addresses all instances of module A |
a:A,a.len==1 or A(1) | all A with len==1 | unary predicates |
Node based path pattern | ||
(* A F *) A | {a3} | direct combination of nodes |
(* F *) A | {a2,a3,a4} | other example |
Edge based path pattern | ||
ANY_EDGE | ||
(* A --> *) F | {f1,f2} | next node |
A (*<-- F*) | {a2,a3,a4} | prev node |
(* F -- *) A | {a1,a2,a3,a4} | undirected |
SUCCESSOR_EDGE | ||
(* A > *) F | {f2} | next node |
A (* < F *) | {a2,a3,a4} | prev node |
(* F --- *) A | {a1,a2,a3,a4} | undirected |
BRANCH_EDGE | ||
(*A +>*) F | {f1} | next node |
A (* <+ F *) | {} | prev node |
(*F -+- *) A | {a1} | undirected |
Single Match, Late Match and Optional Patterns | ||
A (: --> F) | {f1} | find first pattern |
A (& --> F) | {f1} | find last pattern |
A (? +> F) | {Null} | changes nothing to NULL |
Transitive closures | ||
(* A > > *) A | {a3} | Path described by single edges |
(* A +> > *) A | {a2} | other example |
(* A (-->)* *) A | {a1,a2,a3,a4} | (0-to-n edges possible) |
(* A (-->)+ *) A | {a2,a3,a4} | (1-to-n edges possible) |
(* A (-->)? *) F | {f1,f2} | (0-to-1 edges possible) |
(* A (-->){2} *)F | {f2} | 2 edges |
(* A (-->){1,2} *) A | {a2,a3} | min 1 max 2 edges |
Combined | ||
f:F, A +> f, A < f | {f1} | patterns combined by comma |
tutorials/common_graph_queries.txt · Last modified: 2024/11/28 11:00 by tim