I'm trying to generate facets (aggregation counts) for the following documents in a graph (based on collections rather than a named graph):
{
"relation": "decreases",
"edge_type": "primary",
"subject_lbl": "act(p(HGNC:AKT1), ma(DEFAULT:kin))",
"object_lbl": "act(p(HGNC:CDKN1B), ma(DEFAULT:act))",
"annotations": [
{
"type": "Disease",
"label": "cancer",
"id": "cancer"
},
{
"type": "Anatomy",
"label": "liver",
"id": "liver"
}
]
}
The following works great to get facets (aggregation counts) for the edge_type:
FOR doc in edges
COLLECT
edge_type = doc.edge_type WITH COUNT INTO edge_type_cnt
RETURN {edge_type, edge_type_cnt}
I tried the following to get counts for the annotations[*].type value:
FOR doc in edges
COLLECT
edge_type = doc.edge_type WITH COUNT INTO edge_type_cnt,
annotations = doc.annotations[*].type WITH COUNT INTO anno_cnt
RETURN {edge_type, edge_type_cnt, annotations, anno_cnt}
Which results in an error - any ideas what I'm doing wrong? Thanks!