lundi 20 juin 2016

OrientDB - filter selected vertices by other vertices connected to them

I'm not an OrientDB profi, so maybe my question will sound dumb; but I didn't find any answers in docs or on the Net.

This is a sample of a data structure that I have: I want to find all of the beavers, that have blue eyes, and they're happy and they know it.

I do manage to select the eye color and the happiness state with out() function - something like

SELECT out('has').eyeColors, out('is').happinessState FROM beavers

But how do I filter by those connected vertices? I've tried

SELECT * FROM beavers WHERE out('has').eyeColors = 'blue' AND out('is').happinessState = 'happy and knows it'

and

SELECT * FROM beavers WHERE (SELECT out('has').eyeColors FROM beavers) = 'blue' AND (SELECT out('is').happinessState FROM beavers) = 'happy and knows it'

but both of the query types tend to return empty results.

So - how can I achieve such a selection?

*I run Community Edition, v. 2.1.11, and do all of this in server-side JS function.

Thanks, Gregory

Aucun commentaire:

Enregistrer un commentaire