For the query listed at the bottom of this post the variable that I’m most interested in returning is:
ListAccum @@words;
However, @@words is the combined total of all paths (phrases) and I need to return a collection of phrases such as:
{
construction,
shall,
be,
sixty,
(60),
feet,
wide
},
{
during,
any,
period,
of,
construction,
to,
a,
width,
of,
100,
feet
}
Rather than one long list of words. Also, the words must be listed in the correct order and currently they’re being resorted.
Do I need to return the json for the entire vertex instead of just each word’s text?
Thank you.
CREATE QUERY aFindPathContainingMulitCriteria(STRING criteria, INT maxDist) FOR GRAPH MyGraph {
/* exclusive,permanent,Right,Way */
ListAccum<string> @@criteriaWords;
SetAccum<edge> @@edgeSet;
SetAccum<vertex> @@vSet;
ListAccum<STRING> @@words;
STRING startWord;
STRING endWord;
INT wordCount;
@@criteriaWords += string_split(criteria,",");
startWord = @@criteriaWords.get(0);
endWord = @@criteriaWords.get(@@criteriaWords.size()-1);
Start (ANY) = {word.*};
Start = select s from Start:s where s.Text == startWord;
while Start.size() > 0 limit 20 do
Start = select t from Start:s-(nextword:e)-word:t
accum @@edgeSet += e,
@@vSet += t,
@@words += t.Text
having t.Text != endWord;
end;
vSet = @@vSet;
print @@vSet,@@edgeSet, vSet;
print @@words;
}