orientjs icon indicating copy to clipboard operation
orientjs copied to clipboard

Query over Edge

Open jfellien opened this issue 9 years ago • 5 comments

Hi, may be I have not understand it right, but I can't se any way to query by query builder over an Edge.

My Graph are: I have Stores (V) and Postzips (V). Both are connected by an Edge (Store-->responsible_for-->Postzip). The query I use in Orient Studio to get a specific Store by Postzip is:

select Name, Id from Store where Out("responsible_for") contains (Value = "13189")

Is it possible to build this query by query builder? Or have I generally an failure in my query?

Thx for helping me

jfellien avatar Apr 10 '16 15:04 jfellien

Hi @jfellien try this. In Orient Studio there is no query builder.

SELECT Name, Id FROM ( TRAVERSE OUT('responsible_for') FROM Store ) WHERE contains (Value = '13189')

Please specifiy what types are you using. Here you can see the syntax how to apply the contains command. http://orientdb.com/docs/2.0/orientdb.wiki/SQL-Where.html

StarpTech avatar Apr 10 '16 22:04 StarpTech

Hi @StarpTech, oh sorry, I meant the query builder of orientjs :)

With this query builder I want to select the values. But when I look at your statement, may be I can use the syntax:

db.traverse().from('Store').where({Value: '13189'}).all()
.then(function (records) {
    console.log('found records', records);

});

Is this right?

jfellien avatar Apr 11 '16 05:04 jfellien

hi @jfellien

is the property "Value" stored in PostZip right?

wolf4ood avatar Apr 14 '16 09:04 wolf4ood

Yes it is a property of PostZip.

jfellien avatar Apr 14 '16 09:04 jfellien

You should start from PostZip in this case

select expand(in('responsible_for')) from PostZip where (Value = "13189")

wolf4ood avatar May 13 '16 16:05 wolf4ood