How can I fetch more than one nodes at a time?

Query:

starting with all users

Start={User.*};

result = select user, book from StartUsers:user-(WILL_READ)->Book:book limit 100;

Note: the above query is not executable in tiger, but what I hope.

is a tuple needed?

Thanks!

The above question may be too specific. I change it to the fellowing:

I want to find out you are the couple and when their relationship started.

Schema:

Vertex

People: (primary_id name string, age int, gender int)

Edge

LOVE:(FROM People, TO People, startDate datetime)

Wanted:

start = {People.*};

SELECT [man.name](http://man.name/), [female.name](http://female.name/), e.startDate FROM start:man-(LOVE:e)->People:female where man.gender == 1 and female.gender == 2;

From the document, the above is impossible, because each select only return one single node or edge. But I want the whole information, not one guy who has lover.

Further more, is the following query supported in Tiger?

SELECT [what ever, I don't care now] FROM start:man-()->People:female-(GIVE_BIRTH_TO)->People:child;

which means selecting people who marry and have kids.

Hi Sody,

Although you cannot select multiple vertex set at once, you can try something like the following using accumulator:

SumAccum @femaleName;
SumAccum @loveStartDate;

start = { People.* };
start =
  SELECT man
  FROM start:man-(LOVE:e)->People:female
  WHERE man.gender == 1 AND female.gender == 2
  ACCUM
    man.@femaleName = female.name,
    man.@loveStartDate = datetime_to_epoch(e.startDate);

PRINT start[start.name, start.@femaleName, epoch_to_datetime(start.@loveStartDate)];

TigerGraph has various type of accumulators, so please take a look at here.

The second query is not yet supported in TigerGraph.

For the first query, I simply assumed that the edge type LOVE is one-to-one relation. In case of one-to-many relation, you can try something like this:
TYPEDEF TUPLE<STRING name, DATETIME startDate> friendship;
ListAccum @friends;

start = { People.* };
start =
  SELECT man
  FROM start:man-(KNOW:e)-People:female
  WHERE man.gender == 1 AND female.gender == 2
  ACCUM man.@friends += friendship(female.name, e.startDate);

PRINT start[start.name, start.@friends];

For the second query. to be more clear, you can write multiple blocks of queries to translate such a statement. Here’s an example:

SumAccum<STRING> @manName;

SumAccum<INT> @loveStartDate;

ListAccum<STRING> @children;

start = { People.* };

next = 

  SELECT female

  FROM start:man-(LOVE:e)->People:female

  WHERE man.gender == 1 AND female.gender == 2

  ACCUM 

    female.@manName = [man.name](http://man.name/),

    female.@loveStartDate = datetime_to_epoch(e.startDate);

next =

  SELECT female

  FROM next:female-(GIVE_BIRTH_TO:e)-People:child

  ACCUM female.@children += [child.name](http://child.name/);

PRINT next[next.@manName, [next.name](http://next.name/), epoch_to_datetime(next.@loveStartDate), next.@children];

Plus, TigerGraph will support such syntax in the upcoming release :slight_smile: