# tests/cypher/corpus/guard.jsonl, method get_catalog_graph
query: "CYPHER 25 MATCH (a WHERE (a.tenant_id IN $__scope_tenants OR (a.tenant_id IS NULL AND a:`CatalogModel`|`EntityLabel`|`ModelField`|`Theme`)))-[r]->(b WHERE (b.tenant_id IN $__scope_tenants OR (b.tenant_id IS NULL AND b:`CatalogModel`|`EntityLabel`|`ModelField`|`Theme`))) WHERE (a:CatalogModel OR a:EntityLabel) AND (b:CatalogModel OR b:EntityLabel) AND CASE WHEN (r IS NULL OR all(__scope_x IN [r] WHERE (startNode(__scope_x).tenant_id IN $__scope_tenants OR (startNode(__scope_x).tenant_id IS NULL AND startNode(__scope_x):`CatalogModel`|`EntityLabel`|`ModelField`|`Theme`)) AND (endNode(__scope_x).tenant_id IN $__scope_tenants OR (endNode(__scope_x).tenant_id IS NULL AND endNode(__scope_x):`CatalogModel`|`EntityLabel`|`ModelField`|`Theme`)))) THEN (NOT type(r) IN [$__scope_s0, $__scope_s1]) ELSE false END RETURN labels(a)[0] AS source_kind, coalesce(a.name, a.label) AS source, type(r) AS rel_type, properties(r) AS props, labels(b)[0] AS target_kind, coalesce(b.name, b.label) AS target"
---
Match optional=False
  Path var=None selector=None
    Node var=a labels=* props={} where=(OR (IN (Prop (Var a) tenant_id) (Param __scope_tenants)) (AND (IS NULL (Prop (Var a) tenant_id)) (LabelTest (Var a) (CatalogModel|EntityLabel|ModelField|Theme))))
    Rel var=r types=* dir=out props={} where=None
    Node var=b labels=* props={} where=(OR (IN (Prop (Var b) tenant_id) (Param __scope_tenants)) (AND (IS NULL (Prop (Var b) tenant_id)) (LabelTest (Var b) (CatalogModel|EntityLabel|ModelField|Theme))))
  where=(AND (AND (OR (LabelTest (Var a) (CatalogModel)) (LabelTest (Var a) (EntityLabel))) (OR (LabelTest (Var b) (CatalogModel)) (LabelTest (Var b) (EntityLabel)))) (Case (WHEN (OR (IS NULL (Var r)) (all __scope_x (List (Var r)) where=(AND (OR (IN (Prop (Func startnode (Var __scope_x)) tenant_id) (Param __scope_tenants)) (AND (IS NULL (Prop (Func startnode (Var __scope_x)) tenant_id)) (LabelTest (Func startnode (Var __scope_x)) (CatalogModel|EntityLabel|ModelField|Theme)))) (OR (IN (Prop (Func endnode (Var __scope_x)) tenant_id) (Param __scope_tenants)) (AND (IS NULL (Prop (Func endnode (Var __scope_x)) tenant_id)) (LabelTest (Func endnode (Var __scope_x)) (CatalogModel|EntityLabel|ModelField|Theme))))))) (NOT (IN (Func type (Var r)) (List (Param __scope_s0) (Param __scope_s1))))) else=(Lit false)))
Return distinct=False order=() skip=None limit=None
  source_kind = (Index (Func labels (Var a)) (Lit 0))
  source = (Func coalesce (Prop (Var a) name) (Prop (Var a) label))
  rel_type = (Func type (Var r))
  props = (Func properties (Var r))
  target_kind = (Index (Func labels (Var b)) (Lit 0))
  target = (Func coalesce (Prop (Var b) name) (Prop (Var b) label))
