Hi,
My schema is basically Incident - instanceOf - AbstractIncident - connectedTo -> OtherThings
The instanceOf edge is undirected, while connectedTo is directed and has an attribute of "incNumber"
I am trying to do a simple breath first search to get everything reachable from AbstractIncident.
When the first commented out WHERE line is used, the code returns everything I expect BUT the Incident vertex and the instanceOf edge
INTERPRET QUERY () FOR GRAPH historicDelays {
SetAccum<edge> @@edgeList;
OrAccum @visited;
allNodes = {};
theinc = {};
incs = {incident.*};
theinc = SELECT v FROM incs:v WHERE v.incNumber == 377188 ;
visitedNodes (ANY) = theinc;
while visitedNodes.size() != 0 DO
visitedNodes = SELECT s FROM visitedNodes-(:e)-:s
// WHERE s.@visited == false AND (e.incNumber == 377188 OR e.type == "instanceOf")
// WHERE s.@visited == false AND e.type == "instanceOf"
WHERE s.@visited == false AND (e.type == "instanceOf" OR e.incNumber == 377188)
ACCUM @@edgeList += e
POST-ACCUM s.@visited = true;
allNodes = allNodes UNION visitedNodes;
end;
print allNodes.size() as TotalNodeCount;
print allNodes[allNodes.type];
print @@edgeList.size() as TotalEdgeCount;
print @@edgeList;
}
The second WHERE was a test to make sure the data was setup like I'd expected.
Only the third WHERE line is working in that it returns all of the vertices reachable from AbstractIncident. Am I doing something wrong, did I overlook something in the docs, or am I not understanding something about how this while loop works (internally)? A breadth first search ought to get all the vertices.
Also, how can you get the print statement to output the composite key of a vertex (akin to how the type or user attributes can be)?
Thanks
Doug