Search code examples
orientdb

Find all vertex starting from an other (two ways are possible)


I have this template for my database:

enter image description here

I want to do a query that return all the "Ontologie" linked to one specific "Rubrique".

It can take all the edge except "Facultatif".

I actually have this query that return all the "Ontologie" but it doesn't pass by "Regle" so i don't have every "Ontologie"

SELECT *
FROM (
  SELECT expand(in('Synonyme').in('Identifie').in('Regroupe'))
  FROM Rubrique
  WHERE libelle = "collèges, lycées avec internat"
)

Thanks.


Solution

  • You could use

    select expand($c)
    let $a = ( SELECT * FROM (
     SELECT expand(in().in('Identifie').in('Regroupe'))
     FROM Rubrique
     WHERE libelle="collèges, lycées avec internat"
    )), 
    $b = ( SELECT * FROM (
     SELECT expand(in('Pertinent').out('Obligatoire'))
     FROM Rubrique
     WHERE libelle="collèges, lycées avec internat"
    )), 
    $c=unionAll($a,$b)
    

    Hope it helps