/// <summary> /// Expects an incoming <code>Vertex</code> and projects it to a <code>Map</code> with the specified <code>Enrichment</code>> /// values passed to it. /// </summary> public static GraphTraversal <Vertex, IDictionary <string, object> > Enrich(this GraphTraversal <Vertex, Vertex> t, bool includeIdLabel, params Enrichment[] enrichments) { var projectTraversals = enrichments.Select(e => e.GetTraversals()).SelectMany(i => i).ToList(); if (includeIdLabel) { projectTraversals.Add(__.Id()); projectTraversals.Add(__.Map <object>(__.Label())); } var keys = enrichments.Select(e => e.GetProjectedKeys()).SelectMany(i => i).ToList(); if (includeIdLabel) { keys.Add("id"); keys.Add("label"); } var projectedKeys = keys.GetRange(1, keys.Count() - 1).ToArray(); var te = t.Project <object>(keys.First(), projectedKeys); foreach (GraphTraversal <object, object> projectTraversal in projectTraversals) { te = te.By(projectTraversal); } return(te); }