If the name properties are random and not tied to a specific group or type
of user, then there's no simple way to achieve what you want since you
can't predict the type of name or how many will be queried.
This is not an efficient query if Data contains millions of edges.
It would be easier to build using the Blueprints Graph API.
-Colin
On Friday, March 6, 2015 at 3:39:12 PM UTC-6, Red-0ne wrote:
>
> 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.
>
>>
>>>>
--
---
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.