//We create an id set to contain the records to be appended
var dict = new Dictionary<string, List<long>>();
dict["Suspects"] = new List<long>();
//In this case, via results from a query...
var qry2 = "MATCH (s:Suspects) RETURN s";
QueuedTask.Run(async () =>
{
using (var kg = kg_layer.GetDatastore())
{
var graphQuery = new KnowledgeGraphQueryFilter()
{
QueryText = qry2
};
using (var kgRowCursor = kg.SubmitQuery(graphQuery))
{
while (await kgRowCursor.WaitForRowsAsync())
{
while (kgRowCursor.MoveNext())
{
using (var graphRow = kgRowCursor.Current)
{
var obj_val = graphRow[0] as KnowledgeGraphNamedObjectValue;
var oid = (long)obj_val.GetObjectID();
dict["Suspects"].Add(oid);
}
}
}
}
//make an ID Set to append to the LinkChart
var idSet = KnowledgeGraphLayerIDSet.FromDictionary(kg, dict);
//Get the relevant link chart to which records will be
//appended...in this case, from an open map pane in the
//Pro application...
var mapPanes = FrameworkApplication.Panes.OfType<IMapPane>().ToList();
var mapPane = mapPanes.First(
mp => mp.MapView.IsLinkChartView &&
mp.MapView.Map.Name == "Acme Link Chart");
var linkChartMap = mapPane.MapView.Map;
//or get the link chart from an item in the catalog...etc.,etc.
//var projectItem = Project.Current.GetItems<MapProjectItem>()
// .FirstOrDefault(pi => pi.Name == "Acme Link Chart");
//var linkChartMap = projectItem?.GetMap();
//Call AppendToLinkChart with the id set
if (linkChartMap.CanAppendToLinkChart(idSet))
linkChartMap.AppendToLinkChart(idSet);
}
});