ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / KnowledgeGraphMappingExtensions Class / CanAppendToLinkChart Method
The set of named object types and records.
Example

In This Topic
    CanAppendToLinkChart Method
    In This Topic
    Determines if the set of named object types and their records can be appended to the link chart map.
    Syntax
    public static bool CanAppendToLinkChart( 
       Map linkChart,
       KnowledgeGraphLayerIDSet idSet
    )
    Public Shared Function CanAppendToLinkChart( _
       ByVal linkChart As Map, _
       ByVal idSet As KnowledgeGraphLayerIDSet _
    ) As Boolean

    Parameters

    linkChart
    idSet
    The set of named object types and records.

    Return Value

    True if the records can be appended. False otherwise.
    Remarks
    You should use this method before calling AppendToLinkChart. An ID set can only be appended if the map is of type MapType.LinkChart, a Knowledge Graph layer already exists and the ID set is not null or empty and does not contain any invalid Named Object types.
    Note: Named Object names in a KnowledgeGraphLayerLinkChartIDSet are case-sensitive.
    Example
    Append to Link Chart
    //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);
      }
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.3 or higher.
    See Also