Ok here is an example: CREATE DATABASE remote:localhost/testdb root root memory
CREATE CLASS Data EXTENDS V; CREATE PROPERTY Data.id INTEGER; CREATE CLASS Tag EXTENDS V; CREATE PROPERTY Tag.name STRING; CREATE CLASS hasTag EXTENDS E; CREATE VERTEX Data SET id = 1; CREATE VERTEX Data SET id = 2; CREATE VERTEX Tag SET name = 'A'; CREATE VERTEX Tag SET name = 'B'; #Link to both A and B CREATE EDGE hasTag FROM (SELECT FROM Data WHERE id = 1) TO (SELECT FROM Tag WHERE name = 'A'); CREATE EDGE hasTag FROM (SELECT FROM Data WHERE id = 1) TO (SELECT FROM Tag WHERE name = 'B'); #Link only to A CREATE EDGE hasTag FROM (SELECT FROM Data WHERE id = 2) TO (SELECT FROM Tag WHERE name = 'A'); #Get Data that is linked to both (Tag vertices having name) A and B, should get Data with id = 1 SELECT FROM Data WHERE out('hasTag') CONTAINS (name = 'A') AND out('hasTag') CONTAINS (name = 'B'); In my app Tag vertices (having name 'A' and 'B') are provided by the client app and could be more than 2 Tags, that's why I'm trying to avoid the *CONTAINS ... AND CONTAINS* ... part, when building my query. Thank you for your patience. On Friday, 6 March 2015 05:36:04 UTC+1, Colin wrote: > > If A, B, C are all vertices and each represents a different type of class, > then you could could create a different edge type for each one. > > Are A, B, C all unique types that derive from a common base? > > Maybe if you can give a more real-world example with the needed result, we > can figure it out. > > Sorry, if I'm being dense. :-) > > -Colin > > On Thursday, March 5, 2015 at 4:05:44 PM UTC-6, Red-0ne wrote: >> >> Sorry for being misleading. A, B, C are vertices of themselves and >> created through "CREATE VERTEX" command. I just tried to represent them by >> their @rids in the above query. >> >> On Thursday, 5 March 2015 16:51:14 UTC+1, Colin wrote: >>> >>> I think I'm a little puzzled why/how A, B are @rids and vertices but >>> not. :-) >>> >>> Are A, B, C always unique 'tags' as in properties of vertices that >>> denote some kind of type? Or, are A, B, C types of vertices themselves? >>> >>> >>> On Thursday, March 5, 2015 at 5:37:37 AM UTC-6, Red-0ne wrote: >>>> >>>> Actually vertices A, B, C... are kind of *tags*, and Vi are *data*. My >>>> use case is as simple as: "get data that matches *all* given tags". >>>> >>>> On Tuesday, 3 March 2015 19:19:58 UTC+1, Colin wrote: >>>>> >>>>> -- --- 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 orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.