Vue d’ensemble
La clause find().edges() récupère des edges du graphset qui répondent à des conditions spécifiées.
Syntaxe
Alias de clause: Type d'EDGE; l'alias par défaut est edges
| Méthode | Type Paramètre | Spécification Paramètre | Requis | Description | Alias | 
|---|---|---|---|---|---|
| edges() | Filtre | / | Oui | Les conditions des edges à récupérer | N/A | 
| limit() | Entier | ≥-1 | Non | Nombre de résultats à retourner pour chaque sous-requête, -1signifie retourner tous | N/A | 
Exemples
Exemple de Graph

Exécutez ces UQLs ligne par ligne dans un graphset vide pour créer ce graph:
create().node_schema("professor").node_schema("student").edge_schema("mentor").edge_schema("assist")
create().node_property(@*, "age", int32).node_property(@*, "email", string).edge_property(@*, "year", int32)
insert().into(@professor).nodes([{_id:"P001",_uuid:1,age:53,email:"[email protected]"},{_id:"P002",_uuid:2,age:27,email:"[email protected]"}])
insert().into(@student).nodes([{_id:"S001",_uuid:3,age:27,email:"[email protected]"},{_id:"S002",_uuid:4,age:20,email:"[email protected]"},{_id:"S003",_uuid:5,age:25,email:"[email protected]"}])
insert().into(@mentor).edges([{_uuid:1, _from_uuid:2, _to_uuid:3, year:2020},{_uuid:2, _from_uuid:1, _to_uuid:3, year:2021},{_uuid:3, _from_uuid:1, _to_uuid:4, year:2021},{_uuid:4, _from_uuid:1, _to_uuid:5, year:2022}])
insert().into(@assist).edges([{_uuid:5, _from_uuid:3, _to_uuid:2, year:2020},{_uuid:6, _from_uuid:4, _to_uuid:1, year:2022}])
Trouver Tous les Edges
find().edges() as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
| 2 | P001 | S001 | 1 | 3 | mentor | 2021 | 
| 3 | P001 | S002 | 1 | 4 | mentor | 2021 | 
| 4 | P001 | S003 | 1 | 5 | mentor | 2022 | 
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 5 | S001 | P002 | 3 | 2 | assist | 2020 | 
| 6 | S002 | P001 | 4 | 1 | assist | 2022 | 
Trouver des Edges par UUID
find().edges(1) as e
return e{*}
Le filtre
{_uuid == 1}peut être simplifié en1.
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
find().edges([1,3]) as e
return e{*}
Le filtre
{_uuid in [1,3]}peut être simplifié en[1,3].
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
| 3 | P001 | S002 | 1 | 4 | mentor | 2021 | 
Trouver des Edges par Noeuds de Départ
find().edges({_from == "P001"}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 2 | P001 | S001 | 1 | 3 | mentor | 2021 | 
| 3 | P001 | S002 | 1 | 4 | mentor | 2021 | 
| 4 | P001 | S003 | 1 | 5 | mentor | 2022 | 
Trouver des Edges par Noeuds de Fin
find().edges({_to == "P001"}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 6 | S002 | P001 | 4 | 1 | assist | 2022 | 
Trouver des Edges par Schema
find().edges({@assist}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 5 | S001 | P002 | 3 | 2 | assist | 2020 | 
| 6 | S002 | P001 | 4 | 1 | assist | 2022 | 
find().edges({@assist || @mentor}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
| 2 | P001 | S001 | 1 | 3 | mentor | 2021 | 
| 3 | P001 | S002 | 1 | 4 | mentor | 2021 | 
| 4 | P001 | S003 | 1 | 5 | mentor | 2022 | 
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 5 | S001 | P002 | 3 | 2 | assist | 2020 | 
| 6 | S002 | P001 | 4 | 1 | assist | 2022 | 
Trouver des Edges par Propriété
find().edges({year == 2020}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 5 | S001 | P002 | 3 | 2 | assist | 2020 | 
Trouver des Edges par Schema et Propriété
find().edges({@assist.year == 2020}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 5 | S001 | P002 | 3 | 2 | assist | 2020 | 
Utiliser l'Alias de Clause par Défaut
find().edges().limit(3)
return edges{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
| 2 | P001 | S001 | 1 | 3 | mentor | 2021 | 
| 3 | P001 | S002 | 1 | 4 | mentor | 2021 | 
Utiliser limit()
find().edges().limit(3) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 1 | P002 | S001 | 2 | 3 | mentor | 2020 | 
| 2 | P001 | S001 | 1 | 3 | mentor | 2021 | 
| 3 | P001 | S002 | 1 | 4 | mentor | 2021 | 
Utiliser OPTIONAL
uncollect [2022, 2023, 2024] as value
optional find().edges({year == value}) as e
return e{*}
Résultat:
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 4 | P001 | S003 | 1 | 5 | mentor | 2022 | 
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | year | 
|---|---|---|---|---|---|---|
| 6 | S002 | P001 | 4 | 1 | assist | 2022 | 
| _uuid | _from | _to | _from_uuid | _to_uuid | Schema | 
|---|---|---|---|---|---|
| null | null | null | null | null | null | 
| null | null | null | null | null | null | 
Si le préfixe OPTIONAL n'est pas utilisé, les résultats null ne seront pas retournés.
 
        