Wow this is it! Thank you so much Izzet!
This bracket filtering is exactly the kind of orientdb magic I was looking 
for :)

The final query only needed a few tweaks:
select *, inE('hasTerm')[Origin = true].out.inE('hasConcept')[Origin = 
true].out.name as voc_name from <term_rid>

Thanks again!
cr0xfyre



On Tuesday, 14 April 2015 15:03:15 UTC+1, Izzet Pembeci wrote:
>
> Writing from the top of my head:
>
> select *, inE(hasTerm)[Origin = 
> True].inE(hasConcept)[Origin=True].vocab_name from term
>
> You can add conditions/filters by using the [...] syntax on the selected 
> edges. I am not sure if you need to use expand to write .inE(hasConcept) 
> and then later .vocab_name though.
>
> iZzeT
>
> On Tuesday, April 14, 2015 at 2:08:43 PM UTC+3, cr0xfyre wrote:
>>
>> Hi Colin,
>>
>> Thank you for answer! I was already able to learn something new: I didn't 
>> know about outE (can't find it in the manual) and kept using out_have for 
>> the same purpose (which always felt wrong to me...).
>>
>> This gets me half way to the solution. I now have:
>>
>> select in as term, out.inE('hasConcept') from (select from (select 
>> expand(inE('hasTerm')) from <term_rid>) where Origin = true)
>>
>> which returns the term and a list of the edges connecting that term's 
>> origin concept to all its vocabularies. 
>> Now how can I figure out which of those edges has Origin = true, so I can 
>> know the origin vocabulary of the concept, while at the same time keep the 
>> term's data. I've tried to expand the out.inE('hasConcept') but that makes 
>> the 'term' field disappear...
>>
>> i.e. what I'm trying to achieve is a row with all the term's information 
>> and an extra column at the end with it's origin vocabulary name.
>>
>> Is it possible?
>>
>>
>> On Monday, 13 April 2015 23:19:27 UTC+1, Colin wrote:
>>>
>>> Hi,
>>>
>>> Try a query like this:
>>>
>>> select from (select expand(outE('have')) from <some RID or vertex name, 
>>> etc.>) where Origin='SomeValue'
>>>
>>> Let me know if you need further clarification.
>>>
>>> Good luck!
>>>
>>> -Colin
>>>
>>> Orient Technologies
>>>
>>> The Company behind OrientDB
>>>
>>>
>>> On Monday, April 13, 2015 at 4:37:38 PM UTC-5, cr0xfyre wrote:
>>>>
>>>> Hi all,
>>>> I'm a new user of orient DB and graphs databases in general. I've 
>>>> recently started using it to build a vocabulary manager and my experience 
>>>> has been very positive so far.
>>>>
>>>> However, I've recently introduced a new complexity level to model of 
>>>> the DB: edges with properties; and now I'm having some problems with the 
>>>> queries to use them. It's probably really a newbie question, but I've 
>>>> searched a lot and have been unable to come up with a satisfactory 
>>>> solution.
>>>>
>>>> Here is the relevant part of the DB model:
>>>> vocabularies--have-->concepts
>>>> concepts--have-->terms
>>>>
>>>> but because vocabularies can have many concepts, and concepts many 
>>>> terms, I have included a property ORIGIN in the 'have' edges that tells me 
>>>> what concept is the origin of a term and the same between concepts and 
>>>> vocabularies. A term has always only one origin concept and a concept has 
>>>> always only one origin vocabulary.
>>>>
>>>> My question is, what is the best query I can do to the DB that given a 
>>>> term RID returns me its origin vocabulary?
>>>>
>>>> I've only came up with really complex queries that take a lot of time 
>>>> to run, so I'd really like to know what the take of someone with more 
>>>> experience would be on this.
>>>>
>>>> Thanks!
>>>> cr0xfyre
>>>>
>>>

-- 

--- 
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/d/optout.

Reply via email to