Project(Join(Project(Extend(Extend(AggregationJoin(Aggregation(??agg1: ?s, SAMPLE, {}, G1=Group((?s), BGP( ?s ?label))), Aggregation(??agg2: ?label, COUNT, {}, G1)), ?s, ??agg1), ?label_count, ??agg2), {?s, ?label_count}), BGP( ?s ?o)), {?label_count, ?o, ?s})