Thanks Artem. I'm having trouble running gremlin command line so I'll try that as soon as the problem is solved. I created a POST for this as well https://groups.google.com/forum/#!topic/orient-database/c6Mob7K0CMs
On Tuesday, January 14, 2014 8:10:11 PM UTC+2, Artem Orobets wrote: > > The idea is to find edges to the translations instead of translations > itself, then you can take a projection of a result into translation_name, > count and depth of projection. Then during processing of query result you > can take count value if depth = 1 or 0 otherwise. > > With growing of complexity of traversal logic it's become more and more > complicated to write a proper SQL query. Possibly make sense to take a look > at gremlin queries. This query language is more flexible and allow to > implement some queries in more simple way. However it has its cost of > performance, some gremlin queries can work much longer then its SQL variant. > > > Best regards, > Artem Orobets > > *Orient Technologies the Company behind OrientDB* > > > 2014/1/14 SHak <[email protected] <javascript:>> > >> For those that have a direct edge, I would like to have their counts, for >> the others it could stay null or 0. >> >> If the data is structured as in the example below, Allo and Salut are a >> direct link while Bonjour is indirect via italian ciao. >> >> "Hello"->"Allo" (5 times) >> "Hello"->"Salut" (15 times) >> "Hello"->"Ciao" >> "Ciao"->"Bonjour" >> >> if I query for french translations, it would be nice to order the result >> as in example below, so the most common translation is on top. As >> edge/counts are added between "Hello" and "Bonjour", then we can show the >> most used translation on top. >> "Salut" (15 times) >> "Allo" (5 times) >> "Bonjour" (null or 0 times) >> >> >> On Tuesday, January 14, 2014 3:46:43 PM UTC+2, Artem Orobets wrote: >> >>> I'm not sure that understand usecase for second query. Do you want to >>> get count only of first level translation or all transitive translation of >>> some word (Like "Hello" -> "Marhaba")? >>> >>> For the first case you can simply use query like: >>> select outV().name, inV().name, count from translatesTo where >>> outV().name = 'Hello' >>> >>> For the second one I don't understand how do you want to calculate count. >>> >>> Best regards, >>> Artem Orobets >>> >>> * Orient Technologiesthe Company behind OrientDB* >>> >>> >>> 2014/1/14 SHak <[email protected]> >>> >>>> until I hear back if this is the correct approach, I'm following on my >>>> 2nd problem which is to order by the Edge property. >>>> >>>> I changed these 2 edges to have a count property >>>> >>>> create edge translatesTo from (select from Label where name = 'Hello') >>>> to (select from Label where name = 'Good day') SET count=10; >>>> create edge translatesTo from (select from Label where name = 'Hello') >>>> to (select from Label where name = 'Hallo') SET count=5; >>>> >>>> the problem I see is that my previous query filters to @class='Label' >>>> and the edge properties are of class='translateTo' and they are on a >>>> separate record when I run this query. >>>> >>>> TRAVERSE * FROM (SELECT FROM label WHERE name like '%Hello%') while >>>> @class = 'Label' >>>> >>>> I thought that maybe expand on this query might help but it's too late >>>> because of filter of @class, any suggestions? >>>> >>>> >>>> >>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "OrientDB" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
