Search code examples
sqlorientdbgraph-databases

How can I query an edge property by value?


I'm using OrientDB (Community-2.0.9) and have two vertices: Person and University and one edge: isStudent. The edge isStudent has the property 'mark' as float. Person --isStudent--> University.

Now I want to select all persons, where the mark is greater than 3.0, but I got no results, but if I query for equality I got two results.

Do you have any ideas how to solve this?

Queries:

SELECT FROM PERSON WHERE out_isStudent.mark = 3.4 --> two results
SELECT FROM PERSON WHERE out_isStudent.mark > 3.0 --> no results

Solution

  • If you:

    select out_isStudent.mark from Person
    

    you see that it returns the list [3.4] instead of 3.4

    The query that should not work is the first since you're comparing [3.4] == 3.4

    You can achieve what you want with:

    select from Person where out_isStudent[0].mark > 3